Jelajahi Sumber

bugfix : progressive flag should be reset

ncannasse 7 tahun lalu
induk
melakukan
b75f018373
1 mengubah file dengan 2 tambahan dan 2 penghapusan
  1. 2 2
      hxd/res/NanoJpeg.hx

+ 2 - 2
hxd/res/NanoJpeg.hx

@@ -126,6 +126,7 @@ class NanoJpeg {
 		length = 0;
 		buf = 0;
 		bufbits = 0;
+		progressive = false;
 		for( i in 0...3 )
 			comps[i].dcpred = 0;
 	}
@@ -498,8 +499,6 @@ class NanoJpeg {
 		if( (!progressive && start != 0) || (count != 63 - start) || other != 0 ) notSupported();
 		njSkip(length);
 
-		if( progressive ) throw "Unsupported progressive JPG";
-
 		var mbx = 0, mby = 0;
 		var rstcount = rstinterval, nextrst = 0;
 		while( true ) {
@@ -712,6 +711,7 @@ class NanoJpeg {
 				njDecodeSOF();
 			case 0xC2:
 				progressive = true;
+				if( progressive ) throw "Unsupported progressive JPG";
 				for( i in 4...8 )
 					if( vlctab[i] == null )
 						vlctab[i] = alloc(1 << 17);