patch_for_2166_1449_2302.diff
src/core/qgsmaprenderer.cpp | ||
---|---|---|
275 | 275 |
//so must be false at every new render operation |
276 | 276 |
mRenderContext.setRenderingStopped( false ); |
277 | 277 |
|
278 |
QSettings mySettings; // used in a few places |
|
279 |
// this is used several times |
|
280 |
bool isRenderCachingEnabled = mySettings.value( "/qgis/enable_render_caching", false ).toBool(); |
|
281 |
|
|
278 | 282 |
//calculate scale factor |
279 | 283 |
//use the specified dpi and not those from the paint device |
280 | 284 |
//because sometimes QPainter units are in a local coord sys (e.g. in case of QGraphicsScene) |
... | ... | |
303 | 307 |
} |
304 | 308 |
if ( mLastExtent != mExtent ) |
305 | 309 |
{ |
306 |
mLastExtent = mExtent; |
|
310 |
if ( isRenderCachingEnabled ) |
|
311 |
{ |
|
312 |
mLastExtent = mExtent; // only if caching is enabled to prevent using some previously cached image at a different extent |
|
313 |
} |
|
307 | 314 |
mySameAsLastFlag = false; |
308 | 315 |
} |
309 | 316 |
|
... | ... | |
316 | 323 |
if ( !mySameAsLastFlag ) |
317 | 324 |
{ |
318 | 325 |
//clear the cache pixmap if we changed resolution / extent |
319 |
QSettings mySettings; |
|
320 |
if ( mySettings.value( "/qgis/enable_render_caching", false ).toBool() ) |
|
326 |
if ( isRenderCachingEnabled ) |
|
321 | 327 |
{ |
322 | 328 |
QgsMapLayerRegistry::instance()->clearAllLayerCaches(); |
323 | 329 |
} |
... | ... | |
448 | 454 |
} |
449 | 455 |
} |
450 | 456 |
|
451 |
QSettings mySettings;
|
|
452 |
if ( ! split )//render caching does not yet cater for split extents |
|
457 |
// don't use cache for overview
|
|
458 |
if ( ! split && ! mOverview )//render caching does not yet cater for split extents
|
|
453 | 459 |
{ |
454 |
if ( mySettings.value( "/qgis/enable_render_caching", false ).toBool() )
|
|
460 |
if ( isRenderCachingEnabled )
|
|
455 | 461 |
{ |
456 | 462 |
if ( !mySameAsLastFlag || ml->cacheImage() == 0 ) |
457 | 463 |
{ |
... | ... | |
516 | 522 |
mRenderContext.painter()->restore(); |
517 | 523 |
} |
518 | 524 |
|
519 |
if ( mySettings.value( "/qgis/enable_render_caching", false ).toBool() )
|
|
525 |
if ( isRenderCachingEnabled )
|
|
520 | 526 |
{ |
521 |
if ( !split )
|
|
527 |
if ( !split && ! mOverview ) // don't use cache for overview
|
|
522 | 528 |
{ |
523 | 529 |
// composite the cached image into our view and then clean up from caching |
524 | 530 |
// by reinstating the painter as it was swapped out for caching renders |
src/core/qgsvectorlayer.cpp | ||
---|---|---|
948 | 948 |
//set update threshold before each draw to make sure the current setting is picked up |
949 | 949 |
QSettings settings; |
950 | 950 |
mUpdateThreshold = settings.value( "Map/updateThreshold", 0 ).toInt(); |
951 |
// if render caching is enabled, don't draw incrementally |
|
952 |
mUpdateThreshold = settings.value( "/qgis/enable_render_caching", false ).toBool() ? 0 : mUpdateThreshold; |
|
951 | 953 |
|
952 | 954 |
if ( mUsingRendererV2 ) |
953 | 955 |
{ |
src/gui/qgsmapoverviewcanvas.cpp | ||
---|---|---|
93 | 93 |
{ |
94 | 94 |
if ( mNewSize.isValid() ) |
95 | 95 |
{ |
96 |
if ( mPixmap.paintingActive() ) |
|
97 |
{ |
|
98 |
// cancel current render progress |
|
99 |
if ( mMapRenderer ) |
|
100 |
{ |
|
101 |
QgsRenderContext* theRenderContext = mMapRenderer->rendererContext(); |
|
102 |
if ( theRenderContext ) |
|
103 |
{ |
|
104 |
theRenderContext->setRenderingStopped( true ); |
|
105 |
} |
|
106 |
} |
|
107 |
return; |
|
108 |
} |
|
109 |
|
|
96 | 110 |
mPixmap = QPixmap( mNewSize ); |
97 | 111 |
mMapRenderer->setOutputSize( mNewSize, mPixmap.logicalDpiX() ); |
98 | 112 |
mNewSize = QSize(); |
113 |
// on resize, show full extent of overview, rather than keeping the current overview extent (the map scale decreases as window is made smaller) |
|
114 |
updateFullExtent( mMapCanvas->fullExtent() ); |
|
99 | 115 |
refresh(); |
100 | 116 |
} |
101 | 117 |
|
... | ... | |
190 | 206 |
// if (mPanningWidget->isHidden()) |
191 | 207 |
// return; |
192 | 208 |
|
193 |
// set offset in panning widget if inside it |
|
194 |
// for better experience with panning :) |
|
195 |
if ( mPanningWidget->geometry().contains( e->pos() ) ) |
|
196 |
{ |
|
197 |
mPanningCursorOffset = e->pos() - mPanningWidget->pos(); |
|
198 |
} |
|
199 |
else |
|
209 |
if ( e->button() == Qt::LeftButton ) // handle only left button |
|
200 | 210 |
{ |
201 |
// use center of the panning widget if outside |
|
202 |
QSize s = mPanningWidget->size(); |
|
203 |
mPanningCursorOffset = QPoint( s.width() / 2, s.height() / 2 ); |
|
211 |
// set offset in panning widget if inside it |
|
212 |
// for better experience with panning :) |
|
213 |
if ( mPanningWidget->geometry().contains( e->pos() ) ) |
|
214 |
{ |
|
215 |
mPanningCursorOffset = e->pos() - mPanningWidget->pos(); |
|
216 |
} |
|
217 |
else |
|
218 |
{ |
|
219 |
// use center of the panning widget if outside |
|
220 |
QSize s = mPanningWidget->size(); |
|
221 |
mPanningCursorOffset = QPoint( s.width() / 2, s.height() / 2 ); |
|
222 |
} |
|
223 |
updatePanningWidget( e->pos() ); |
|
204 | 224 |
} |
205 |
updatePanningWidget( e->pos() ); |
|
206 | 225 |
} |
207 | 226 |
|
208 | 227 |
|
src/ui/qgsoptionsbase.ui | ||
---|---|---|
60 | 60 |
<rect> |
61 | 61 |
<x>0</x> |
62 | 62 |
<y>0</y> |
63 |
<width>780</width>
|
|
64 |
<height>755</height>
|
|
63 |
<width>764</width>
|
|
64 |
<height>747</height>
|
|
65 | 65 |
</rect> |
66 | 66 |
</property> |
67 | 67 |
<layout class="QGridLayout" name="gridLayout_12"> |
... | ... | |
499 | 499 |
<rect> |
500 | 500 |
<x>0</x> |
501 | 501 |
<y>0</y> |
502 |
<width>780</width>
|
|
503 |
<height>433</height>
|
|
502 |
<width>764</width>
|
|
503 |
<height>416</height>
|
|
504 | 504 |
</rect> |
505 | 505 |
</property> |
506 | 506 |
<layout class="QGridLayout" name="gridLayout_8"> |
... | ... | |
667 | 667 |
<rect> |
668 | 668 |
<x>0</x> |
669 | 669 |
<y>0</y> |
670 |
<width>780</width>
|
|
671 |
<height>456</height>
|
|
670 |
<width>764</width>
|
|
671 |
<height>410</height>
|
|
672 | 672 |
</rect> |
673 | 673 |
</property> |
674 | 674 |
<layout class="QGridLayout" name="gridLayout_4"> |
... | ... | |
947 | 947 |
<rect> |
948 | 948 |
<x>0</x> |
949 | 949 |
<y>0</y> |
950 |
<width>795</width>
|
|
951 |
<height>415</height>
|
|
950 |
<width>781</width>
|
|
951 |
<height>401</height>
|
|
952 | 952 |
</rect> |
953 | 953 |
</property> |
954 | 954 |
<layout class="QGridLayout" name="gridLayout_10"> |
... | ... | |
1022 | 1022 |
<rect> |
1023 | 1023 |
<x>0</x> |
1024 | 1024 |
<y>0</y> |
1025 |
<width>795</width>
|
|
1026 |
<height>415</height>
|
|
1025 |
<width>781</width>
|
|
1026 |
<height>401</height>
|
|
1027 | 1027 |
</rect> |
1028 | 1028 |
</property> |
1029 | 1029 |
<layout class="QGridLayout" name="gridLayout_13"> |
... | ... | |
1352 | 1352 |
<rect> |
1353 | 1353 |
<x>0</x> |
1354 | 1354 |
<y>0</y> |
1355 |
<width>795</width>
|
|
1356 |
<height>415</height>
|
|
1355 |
<width>781</width>
|
|
1356 |
<height>401</height>
|
|
1357 | 1357 |
</rect> |
1358 | 1358 |
</property> |
1359 | 1359 |
<layout class="QGridLayout" name="gridLayout_15"> |
... | ... | |
1520 | 1520 |
<rect> |
1521 | 1521 |
<x>0</x> |
1522 | 1522 |
<y>0</y> |
1523 |
<width>780</width>
|
|
1523 |
<width>764</width>
|
|
1524 | 1524 |
<height>527</height> |
1525 | 1525 |
</rect> |
1526 | 1526 |
</property> |
... | ... | |
1611 | 1611 |
<rect> |
1612 | 1612 |
<x>0</x> |
1613 | 1613 |
<y>0</y> |
1614 |
<width>780</width>
|
|
1615 |
<height>461</height>
|
|
1614 |
<width>764</width>
|
|
1615 |
<height>463</height>
|
|
1616 | 1616 |
</rect> |
1617 | 1617 |
</property> |
1618 | 1618 |
<layout class="QGridLayout" name="gridLayout_20"> |
... | ... | |
1971 | 1971 |
</hint> |
1972 | 1972 |
</hints> |
1973 | 1973 |
</connection> |
1974 |
<connection> |
|
1975 |
<sender>chkUseRenderCaching</sender> |
|
1976 |
<signal>toggled(bool)</signal> |
|
1977 |
<receiver>spinBoxUpdateThreshold</receiver> |
|
1978 |
<slot>setDisabled(bool)</slot> |
|
1979 |
<hints> |
|
1980 |
<hint type="sourcelabel"> |
|
1981 |
<x>402</x> |
|
1982 |
<y>158</y> |
|
1983 |
</hint> |
|
1984 |
<hint type="destinationlabel"> |
|
1985 |
<x>585</x> |
|
1986 |
<y>114</y> |
|
1987 |
</hint> |
|
1988 |
</hints> |
|
1989 |
</connection> |
|
1974 | 1990 |
</connections> |
1975 | 1991 |
</ui> |