2
0
Эх сурвалжийг харах

Pixels: fix toPng not taking data offset into account (used by DDS files)

trethaller 2 жил өмнө
parent
commit
226ba80ced
1 өөрчлөгдсөн 5 нэмэгдсэн , 1 устгасан
  1. 5 1
      hxd/Pixels.hx

+ 5 - 1
hxd/Pixels.hx

@@ -512,7 +512,11 @@ class Pixels {
 	public function toPNG( ?level = 9 ) {
 		var png;
 		setFlip(false);
-		switch( format ) {
+		if( offset != 0 ) {
+			bytes = bytes.sub(offset, calcDataSize(width,height, format));
+			offset = 0;
+		}
+ 		switch( format ) {
 		case ARGB:
 			png = std.format.png.Tools.build32ARGB(width, height, bytes #if (format >= "3.3") , level #end);
 		default: