diff options
author | erg@chromium.org <erg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-29 20:18:29 +0000 |
---|---|---|
committer | erg@chromium.org <erg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-29 20:18:29 +0000 |
commit | 9fbc0f7ed6eec04c0ce218052269992f4779f63d (patch) | |
tree | ec0bcf4ad77c8ea0143065691760c2d28df26053 /gfx | |
parent | c9761f83eb776a6981d8f8c60e4f6319df0bc641 (diff) | |
download | chromium_src-9fbc0f7ed6eec04c0ce218052269992f4779f63d.zip chromium_src-9fbc0f7ed6eec04c0ce218052269992f4779f63d.tar.gz chromium_src-9fbc0f7ed6eec04c0ce218052269992f4779f63d.tar.bz2 |
Newer versions of libpng require a flush function to be given.
The documentation states that we can't pass NULL as the fourth
parameter to png_set_write_fn().
BUG=28399
TEST=none
Review URL: http://codereview.chromium.org/1759016
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@45978 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'gfx')
-rw-r--r-- | gfx/codec/png_codec.cc | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/gfx/codec/png_codec.cc b/gfx/codec/png_codec.cc index 9db0095..66fa787 100644 --- a/gfx/codec/png_codec.cc +++ b/gfx/codec/png_codec.cc @@ -530,6 +530,11 @@ void EncoderWriteCallback(png_structp png, png_bytep data, png_size_t size) { memcpy(&(*state->out)[old_size], data, size); } +void FakeFlushCallback(png_structp png) { + // We don't need to perform any flushing since we aren't doing real IO, but + // we're required to provide this function by libpng. +} + void ConvertBGRAtoRGB(const unsigned char* bgra, int pixel_width, unsigned char* rgb, bool* is_opaque) { for (int x = 0; x < pixel_width; x++) { @@ -562,7 +567,7 @@ bool DoLibpngWrite(png_struct* png_ptr, png_info* info_ptr, return false; // Set our callback for libpng to give us the data. - png_set_write_fn(png_ptr, state, EncoderWriteCallback, NULL); + png_set_write_fn(png_ptr, state, EncoderWriteCallback, FakeFlushCallback); png_set_IHDR(png_ptr, info_ptr, width, height, 8, png_output_color_type, PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_DEFAULT, |