Browse Source

fixed Texture.fromPixels : should use pixels format unless explicit set to another format

Nicolas Cannasse 4 năm trước cách đây
mục cha
commit
78fe510a7c
1 tập tin đã thay đổi với 2 bổ sung2 xóa
  1. 2 2
      h3d/mat/Texture.hx

+ 2 - 2
h3d/mat/Texture.hx

@@ -414,8 +414,8 @@ class Texture {
 		return t;
 	}
 
-	public static function fromPixels( pixels : hxd.Pixels ) {
-		var t = new Texture(pixels.width, pixels.height);
+	public static function fromPixels( pixels : hxd.Pixels, ?format ) {
+		var t = new Texture(pixels.width, pixels.height, null, format != null ? format : pixels.format);
 		t.uploadPixels(pixels);
 		return t;
 	}