Skip to content

Commit

Permalink
The libpng patch had some missing ifdefs that went unnoticed because …
Browse files Browse the repository at this point in the history
…the patch itself was broken, so those bits were never applied. This caused problems on Mac, where we had libpng < 1.5. Fix up the patch to add the necessary ifdefs and use the old code if we have libpng < 1.5
  • Loading branch information
ewencp committed Feb 17, 2013
1 parent 80fba1d commit 72d47d5
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions patches/chromium_libpng_1.5.patch
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,19 @@ Index: third_party/WebKit/Source/WebCore/platform/image-decoders/png/PNGImageDec
ColorProfile colorProfile;
colorProfile.append(profile, profileLength);
return colorProfile;
@@ -241,11 +245,11 @@
@@ -241,11 +245,16 @@
{
png_structp png = m_reader->pngPtr();
png_infop info = m_reader->infoPtr();
- png_uint_32 width = png->width;
- png_uint_32 height = png->height;
+#if PNG_LIBPNG_VER_MAJOR >= 1 && PNG_LIBPNG_VER_MINOR >= 5
+ png_uint_32 width = png_get_image_width(png, info);
+ png_uint_32 height = png_get_image_height(png, info);
+#else
+ png_uint_32 width = png->width;
+ png_uint_32 height = png->height;
+#endif

// Protect against large images.
- if (png->width > cMaxPNGSize || png->height > cMaxPNGSize) {
Expand All @@ -55,13 +60,17 @@ Index: third_party/WebKit/Source/WebCore/platform/image-decoders/png/PNGImageDec
}
}

@@ -343,7 +351,8 @@
@@ -343,6 +351,11 @@
// For PNGs, the frame always fills the entire image.
buffer.setOriginalFrameRect(IntRect(IntPoint(), size()));

- if (m_reader->pngPtr()->interlaced)
+#if PNG_LIBPNG_VER_MAJOR >= 1 && PNG_LIBPNG_VER_MINOR >= 5
+ if (png_get_interlace_type(m_reader->pngPtr(), m_reader->infoPtr())
+ != PNG_INTERLACE_NONE)
+#else
+ if (m_reader->pngPtr()->interlaced)
+#endif
m_reader->createInterlaceBuffer((m_reader->hasAlpha() ? 4 : 3) * size().width() * size().height());
}

0 comments on commit 72d47d5

Please sign in to comment.