Index: ui/gfx/codec/png_codec.cc |
diff --git a/ui/gfx/codec/png_codec.cc b/ui/gfx/codec/png_codec.cc |
index fe4020596fc9c3ba32609719060a727554b07e81..69a00c19449403b6a3853627217af1e18b838cfc 100644 |
--- a/ui/gfx/codec/png_codec.cc |
+++ b/ui/gfx/codec/png_codec.cc |
@@ -206,6 +206,9 @@ |
// Pick our row format converter necessary for this data. |
if (!input_has_alpha) { |
switch (state->output_format) { |
+ case PNGCodec::FORMAT_RGB: |
+ state->output_channels = 3; |
+ break; |
case PNGCodec::FORMAT_RGBA: |
state->output_channels = 4; |
png_set_add_alpha(png_ptr, 0xFF, PNG_FILLER_AFTER); |
@@ -222,6 +225,10 @@ |
} |
} else { |
switch (state->output_format) { |
+ case PNGCodec::FORMAT_RGB: |
+ state->output_channels = 3; |
+ png_set_strip_alpha(png_ptr); |
+ break; |
case PNGCodec::FORMAT_RGBA: |
state->output_channels = 4; |
break; |
@@ -627,6 +634,12 @@ |
int input_color_components, output_color_components; |
int png_output_color_type; |
switch (format) { |
+ case PNGCodec::FORMAT_RGB: |
+ input_color_components = 3; |
+ output_color_components = 3; |
+ png_output_color_type = PNG_COLOR_TYPE_RGB; |
+ break; |
+ |
case PNGCodec::FORMAT_RGBA: |
input_color_components = 4; |
if (discard_transparency) { |