Save and restore inside of the drawer

This commit is contained in:
Philip Giuliani 2015-04-13 19:05:23 +02:00
parent 3ce7024e97
commit 6677953d87
2 changed files with 3 additions and 5 deletions

View File

@ -310,14 +310,16 @@ $.Drawer.prototype = /** @lends OpenSeadragon.Drawer.prototype */{
return;
}
this.saveContext();
if ( typeof fillStyle === "function" ) {
this.context.fillStyle = fillStyle(this.context);
}
else {
this.context.fillStyle = fillStyle;
}
this.context.fillRect(rect.x, rect.y, rect.width, rect.height);
this.restoreContext();
},
// private

View File

@ -1172,12 +1172,8 @@ function drawTiles( tiledImage, lastDrawn ) {
}
if ( tiledImage.placeholderFillStyle && lastDrawn.length === 0 ) {
tiledImage._drawer.saveContext();
var placeholderRect = tiledImage._drawer.viewportToDrawerRectangle(tiledImage.getBounds(true));
tiledImage._drawer.drawPlaceholder(placeholderRect, tiledImage.placeholderFillStyle);
tiledImage._drawer.restoreContext();
}
for ( i = lastDrawn.length - 1; i >= 0; i-- ) {