SetLayerOpacity: don't recalc bbox needlessly
authorAndrew Chadwick <andrewc-git@piffle.org>
Fri, 9 Nov 2012 01:57:29 +0000 (01:57 +0000)
committerAndrew Chadwick <andrewc-git@piffle.org>
Fri, 9 Nov 2012 01:57:29 +0000 (01:57 +0000)
commitaed08632feecbabee7b3ee8f8f73ddf2cf341f27
tree9520b531faff22f0e80cdb0ba5d9c086bc92f176
parentbd87d61c4a07143ac69e3f78f4c8cf4edb9ba12a
SetLayerOpacity: don't recalc bbox needlessly

Minor UI jerkiness removal for a special case. If SetLayerOpacity makes
no changes to the effective opacity - which should only happen for
invisible layers - the command now no longer recalculate the bbox of the
layer once or twice for each move of the opacity slider. This can add up
to an appreciable but small delay for layers with a lot of tiles, and
jerkiness in what could be a smooth slider.

https://gna.org/bugs/?20287

The problem really lies with tiledsurface.get_tiles_bbox() and
MyPaintSurface.get_bbox() iterating over index-tuple-keyed hashes merely
to obtain four numbers - would it help matters elsewhere to maintain a
cache of extents?
lib/command.py