From 3ce7024e97797fc092bfbdf617ff80f380a86e37 Mon Sep 17 00:00:00 2001 From: Philip Giuliani Date: Mon, 13 Apr 2015 19:02:04 +0200 Subject: [PATCH] Revert to usedClip --- src/tiledimage.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/tiledimage.js b/src/tiledimage.js index da40bde7..cea8d2b1 100644 --- a/src/tiledimage.js +++ b/src/tiledimage.js @@ -1160,23 +1160,24 @@ function drawTiles( tiledImage, lastDrawn ) { tileSource, contextSaved = false; + var usedClip = false; if ( tiledImage._clip ) { tiledImage._drawer.saveContext(); - contextSaved = true; var box = tiledImage.imageToViewportRectangle(tiledImage._clip, true); var clipRect = tiledImage._drawer.viewportToDrawerRectangle(box); tiledImage._drawer.setClip(clipRect); + + usedClip = true; } if ( tiledImage.placeholderFillStyle && lastDrawn.length === 0 ) { - if ( !contextSaved ) { - tiledImage._drawer.saveContext(); - contextSaved = true; - } + 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-- ) { @@ -1211,7 +1212,7 @@ function drawTiles( tiledImage, lastDrawn ) { } } - if ( contextSaved ) { + if ( usedClip ) { tiledImage._drawer.restoreContext(); } }