From 3fa67c317b57ed51b046939afbc33ff0275ef252 Mon Sep 17 00:00:00 2001 From: Sebastien ROBERT Date: Tue, 21 Dec 2021 11:43:08 +0900 Subject: [PATCH] Moved _shouldRoundPositionAndSize Drawer class member to drawTile() function argument --- src/drawer.js | 7 +++++-- src/tiledimage.js | 4 +--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/drawer.js b/src/drawer.js index 1b0c87ac..30d7fcf2 100644 --- a/src/drawer.js +++ b/src/drawer.js @@ -344,15 +344,18 @@ $.Drawer.prototype = { * where rendered is the context with the pre-drawn image. * @param {Float} [scale=1] - Apply a scale to tile position and size. Defaults to 1. * @param {OpenSeadragon.Point} [translate] A translation vector to offset tile position + * @param {Boolean} [shouldRoundPositionAndSize] - Tells whether to round + * position and size of tiles supporting alpha channel in non-transparency + * context. */ - drawTile: function(tile, drawingHandler, useSketch, scale, translate) { + drawTile: function(tile, drawingHandler, useSketch, scale, translate, shouldRoundPositionAndSize) { $.console.assert(tile, '[Drawer.drawTile] tile is required'); $.console.assert(drawingHandler, '[Drawer.drawTile] drawingHandler is required'); if (this.useCanvas) { var context = this._getContext(useSketch); scale = scale || 1; - tile.drawCanvas(context, drawingHandler, scale, translate, this._shouldRoundPositionAndSize); + tile.drawCanvas(context, drawingHandler, scale, translate, shouldRoundPositionAndSize); } else { tile.drawHTML( this.canvas ); } diff --git a/src/tiledimage.js b/src/tiledimage.js index 431bd422..a9d2e9e2 100644 --- a/src/tiledimage.js +++ b/src/tiledimage.js @@ -2214,11 +2214,9 @@ function drawTiles( tiledImage, lastDrawn ) { shouldRoundPositionAndSize = !isAnimating; } - tiledImage._drawer._shouldRoundPositionAndSize = shouldRoundPositionAndSize; - for (var i = lastDrawn.length - 1; i >= 0; i--) { tile = lastDrawn[ i ]; - tiledImage._drawer.drawTile( tile, tiledImage._drawingHandler, useSketch, sketchScale, sketchTranslate ); + tiledImage._drawer.drawTile( tile, tiledImage._drawingHandler, useSketch, sketchScale, sketchTranslate, shouldRoundPositionAndSize ); tile.beingDrawn = true; if( tiledImage.viewer ){