소스 검색

LibGfx/PNG: Don't try to guess if IHDR has been decoded

Lucas CHOLLET 2 년 전
부모
커밋
07f72b6d41
1개의 변경된 파일4개의 추가작업 그리고 3개의 파일을 삭제
  1. 4 3
      Userland/Libraries/LibGfx/ImageFormats/PNGLoader.cpp

+ 4 - 3
Userland/Libraries/LibGfx/ImageFormats/PNGLoader.cpp

@@ -630,10 +630,8 @@ static bool decode_png_ihdr(PNGLoadingContext& context)
 
         context.data_current_ptr = streamer.current_data_ptr();
 
-        if (context.width && context.height) {
-            context.state = PNGLoadingContext::State::IHDRDecoded;
+        if (context.state == PNGLoadingContext::State::IHDRDecoded)
             return true;
-        }
     }
 
     return false;
@@ -1018,6 +1016,9 @@ static ErrorOr<void> process_IHDR(ReadonlyBytes data, PNGLoadingContext& context
     default:
         return Error::from_string_literal("Unsupported color type");
     }
+
+    context.state = PNGLoadingContext::IHDRDecoded;
+
     return {};
 }