Moved _shouldRoundPositionAndSize Drawer class member to drawTile() function argument

This commit is contained in:
Sebastien ROBERT 2021-12-21 11:43:08 +09:00
parent 2aebdbd066
commit 3fa67c317b
2 changed files with 6 additions and 5 deletions

View File

@ -344,15 +344,18 @@ $.Drawer.prototype = {
* where <code>rendered</code> 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 );
}

View File

@ -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 ){