File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed
packages/melonjs/src/video Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -11,9 +11,10 @@ import CanvasRenderTarget from "./rendertarget/canvasrendertarget.js";
1111 * @ignore
1212 */
1313let sharedRenderTarget = null ;
14- let sharedLastGradient = null ;
14+ let sharedLastId = - 1 ;
1515let sharedLastX = NaN ;
1616let sharedLastY = NaN ;
17+ let nextGradientId = 0 ;
1718
1819/**
1920 * A Gradient object representing a linear or radial gradient fill.
@@ -30,6 +31,9 @@ export class Gradient {
3031 * gradient type
3132 * @type {"linear"|"radial" }
3233 */
34+ /** @ignore */
35+ this . _id = nextGradientId ++ ;
36+
3337 this . type = type ;
3438
3539 /**
@@ -150,7 +154,7 @@ export class Gradient {
150154 // skip if this gradient already rendered to the shared target at these coords
151155 if (
152156 sharedRenderTarget &&
153- sharedLastGradient === this &&
157+ sharedLastId === this . _id &&
154158 ! this . _dirty &&
155159 sharedLastX === x &&
156160 sharedLastY === y &&
@@ -206,7 +210,7 @@ export class Gradient {
206210 ctx . fillRect ( 0 , 0 , tw , th ) ;
207211
208212 this . _dirty = false ;
209- sharedLastGradient = this ;
213+ sharedLastId = this . _id ;
210214 sharedLastX = x ;
211215 sharedLastY = y ;
212216 this . _renderTarget . invalidate ( renderer ) ;
You can’t perform that action at this time.
0 commit comments