Skip to content

Commit

Permalink
fixed a bug where i had forgotten to set correct color type for BUF_BGR
Browse files Browse the repository at this point in the history
  • Loading branch information
pkrumins committed Jul 20, 2010
1 parent 772071c commit 7640b0a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion png.cc
Expand Up @@ -85,7 +85,11 @@ class PngEncoder {
if (!png_ptr)
return VException("png_create_info_struct failed.");

int color_type = (buf_type == BUF_RGB) ? PNG_COLOR_TYPE_RGB : PNG_COLOR_TYPE_RGB_ALPHA;
int color_type;
if (buf_type == BUF_RGB || buf_type == BUF_BGR)
color_type = PNG_COLOR_TYPE_RGB;
else
color_type = PNG_COLOR_TYPE_RGB_ALPHA;

png_set_IHDR(png_ptr, info_ptr, width, height,
8, color_type, PNG_INTERLACE_NONE,
Expand Down

0 comments on commit 7640b0a

Please sign in to comment.