From 5b36e937e2c8f8a0bbdcb478851f70d17434014a Mon Sep 17 00:00:00 2001 From: adroitwhiz Date: Sat, 16 May 2020 17:15:14 -0400 Subject: [PATCH] Inline the last _getDrawableScreenSpaceScale call --- src/RenderWebGL.js | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/src/RenderWebGL.js b/src/RenderWebGL.js index 0e9033f..36f68a9 100644 --- a/src/RenderWebGL.js +++ b/src/RenderWebGL.js @@ -1821,18 +1821,6 @@ class RenderWebGL extends EventEmitter { this._regionId = null; } - /** - * Get the screen-space scale of a drawable, as percentages of the drawable's "normal" size. - * @param {Drawable} drawable The drawable whose screen-space scale we're fetching. - * @returns {Array} The screen-space X and Y dimensions of the drawable's scale, as percentages. - */ - _getDrawableScreenSpaceScale (drawable) { - return [ - drawable.scale[0] * this._gl.canvas.width / this._nativeSize[0], - drawable.scale[1] * this._gl.canvas.height / this._nativeSize[1] - ]; - } - /** * Draw a set of Drawables, by drawable ID * @param {Array} drawables The Drawable IDs to draw, possibly this._drawList. @@ -1865,7 +1853,10 @@ class RenderWebGL extends EventEmitter { if (!drawable.getVisible() && !opts.ignoreVisibility) continue; // Combine drawable scale with the native vs. backing pixel ratio - const drawableScale = this._getDrawableScreenSpaceScale(drawable); + const drawableScale = [ + drawable.scale[0] * this._gl.canvas.width / this._nativeSize[0], + drawable.scale[1] * this._gl.canvas.height / this._nativeSize[1] + ]; // If the skin or texture isn't ready yet, skip it. if (!drawable.skin || !drawable.skin.getTexture(drawableScale)) continue;