1
0
mirror of https://github.com/tobspr/shapez.io.git synced 2026-03-02 03:39:21 +00:00

Improve performance by getting rid of instanceof

This commit is contained in:
tobspr
2020-06-27 10:38:11 +02:00
parent d8bf4f9cd8
commit 419401b9be
21 changed files with 239 additions and 199 deletions

View File

@@ -144,9 +144,9 @@ export class AtlasSprite extends BaseSprite {
*/
drawCached(parameters, x, y, w = null, h = null, clipping = true) {
if (G_IS_DEV) {
assertAlways(parameters instanceof DrawParameters, "Not a valid context");
assertAlways(!!w && w > 0, "Not a valid width:" + w);
assertAlways(!!h && h > 0, "Not a valid height:" + h);
assert(parameters instanceof DrawParameters, "Not a valid context");
assert(!!w && w > 0, "Not a valid width:" + w);
assert(!!h && h > 0, "Not a valid height:" + h);
}
const visibleRect = parameters.visibleRect;