Преглед изворни кода

[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