mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-26 00:02:08 -05:00
create cache only if necessary
git-svn-id: http://svn.osgeo.org/qgis/trunk@3027 c8812cc2-4d05-0410-92ff-de0c093fc19c
This commit is contained in:
parent
c3ab02e28a
commit
848242c655
@ -86,6 +86,7 @@ void QgsComposerMap::init ()
|
||||
|
||||
// Cache
|
||||
mCachePixmap = new QPixmap();
|
||||
mCacheUpdated = false;
|
||||
|
||||
// Potemkin
|
||||
mCalculateComboBox->insertItem( "Scale" );
|
||||
@ -195,6 +196,7 @@ void QgsComposerMap::cache ( void )
|
||||
p.end();
|
||||
|
||||
mNumCachedLayers = mMapCanvas->layerCount();
|
||||
mCacheUpdated = true;
|
||||
}
|
||||
|
||||
void QgsComposerMap::draw ( QPainter & painter )
|
||||
@ -205,7 +207,7 @@ void QgsComposerMap::draw ( QPainter & painter )
|
||||
if ( plotStyle() == QgsComposition::Preview && mPreviewMode == Cache ) { // Draw from cache
|
||||
std::cout << "use cache" << std::endl;
|
||||
|
||||
if ( mMapCanvas->layerCount() != mNumCachedLayers ) {
|
||||
if ( !mCacheUpdated || mMapCanvas->layerCount() != mNumCachedLayers ) {
|
||||
cache();
|
||||
}
|
||||
|
||||
@ -294,7 +296,7 @@ void QgsComposerMap::scaleChanged ( void )
|
||||
mSymbolScale = mSymbolScaleLineEdit->text().toDouble();
|
||||
mFontScale = mFontScaleLineEdit->text().toDouble();
|
||||
|
||||
cache();
|
||||
mCacheUpdated = false;
|
||||
QCanvasRectangle::update();
|
||||
QCanvasRectangle::canvas()->update();
|
||||
|
||||
@ -337,7 +339,7 @@ void QgsComposerMap::recalculate ( void )
|
||||
std::cout << "mExtent = " << mExtent.stringRep() << std::endl;
|
||||
|
||||
setOptions();
|
||||
cache();
|
||||
mCacheUpdated = false;
|
||||
}
|
||||
|
||||
void QgsComposerMap::frameChanged ( )
|
||||
|
@ -165,6 +165,9 @@ private:
|
||||
// It is very slow, with zoom in in QCanvasView, it seems, that QCanvas is stored as a big image
|
||||
// with resolution necessary for current zoom and so always a big image mus be redrawn.
|
||||
QPixmap *mCachePixmap;
|
||||
|
||||
// Is cache up to date
|
||||
bool mCacheUpdated;
|
||||
|
||||
// Resize schema
|
||||
QgsComposition::Calculate mCalculate;
|
||||
|
Loading…
x
Reference in New Issue
Block a user