Selaa lähdekoodia

Perf improvment - step 1

David Catuhe 6 vuotta sitten
vanhempi
commit
28b96e2918
2 muutettua tiedostoa jossa 3 lisäystä ja 0 poistoa
  1. 2 0
      gui/src/2D/advancedDynamicTexture.ts
  2. 1 0
      gui/src/2D/controls/control.ts

+ 2 - 0
gui/src/2D/advancedDynamicTexture.ts

@@ -574,6 +574,8 @@ export class AdvancedDynamicTexture extends DynamicTexture {
         context.strokeStyle = "white";
         var measure = new Measure(0, 0, renderWidth, renderHeight);
         this._rootContainer._layout(measure, context);
+        this._isDirty = false; // Restoring the dirty state that could have been set by controls during layout processing
+
         this._rootContainer._render(context);
     }
 

+ 1 - 0
gui/src/2D/controls/control.ts

@@ -1342,6 +1342,7 @@ export class Control {
     /** @hidden */
     public _render(context: CanvasRenderingContext2D): boolean {
         if (!this.isVisible || this.notRenderable || this._isClipped) {
+            this._isDirty = false;
             return false;
         }
         context.save();