瀏覽代碼

[scene] Properly reallocate gradient texture if size/orientation changes

Clément Espeute 11 月之前
父節點
當前提交
a0da34de41
共有 1 個文件被更改,包括 5 次插入1 次删除
  1. 5 1
      hrt/impl/Gradient.hx

+ 5 - 1
hrt/impl/Gradient.hx

@@ -246,7 +246,11 @@ class Gradient {
 
         var texture = Texture.fromPixels(genPixels(), RGBA);
         texture.realloc = function() {
-            texture.uploadPixels(genPixels());
+            var pixels = genPixels();
+            if (pixels.width != texture.width || pixels.height != texture.height) {
+                texture.resize(pixels.width, pixels.height);
+            }
+            texture.uploadPixels(pixels);
         }
 
 		#if !editor