aboutsummaryrefslogtreecommitdiffstats
path: root/src/images/SkImageDecoder_libjpeg.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/images/SkImageDecoder_libjpeg.cpp')
-rw-r--r--src/images/SkImageDecoder_libjpeg.cpp30
1 files changed, 14 insertions, 16 deletions
diff --git a/src/images/SkImageDecoder_libjpeg.cpp b/src/images/SkImageDecoder_libjpeg.cpp
index e3aefea..dc6ac5b 100644
--- a/src/images/SkImageDecoder_libjpeg.cpp
+++ b/src/images/SkImageDecoder_libjpeg.cpp
@@ -264,13 +264,9 @@ bool SkJPEGImageDecoder::onDecode(SkStream* stream, SkBitmap* bm, Mode mode) {
if (config == SkBitmap::kARGB_8888_Config) {
cinfo.out_color_space = JCS_RGBA_8888;
} else if (config == SkBitmap::kRGB_565_Config) {
- if (sampleSize == 1) {
- // SkScaledBitmapSampler can't handle RGB_565 yet,
- // so don't even try.
- cinfo.out_color_space = JCS_RGB_565;
- if (this->getDitherImage()) {
- cinfo.dither_mode = JDITHER_ORDERED;
- }
+ cinfo.out_color_space = JCS_RGB_565;
+ if (this->getDitherImage()) {
+ cinfo.dither_mode = JDITHER_ORDERED;
}
}
#endif
@@ -360,8 +356,8 @@ bool SkJPEGImageDecoder::onDecode(SkStream* stream, SkBitmap* bm, Mode mode) {
#ifdef ANDROID_RGB
} else if (JCS_RGBA_8888 == cinfo.out_color_space) {
sc = SkScaledBitmapSampler::kRGBX;
- //} else if (JCS_RGB_565 == cinfo.out_color_space) {
- // sc = SkScaledBitmapSampler::kRGB_565;
+ } else if (JCS_RGB_565 == cinfo.out_color_space) {
+ sc = SkScaledBitmapSampler::kRGB_565;
#endif
} else if (1 == cinfo.out_color_components &&
JCS_GRAYSCALE == cinfo.out_color_space) {
@@ -532,18 +528,18 @@ bool SkJPEGImageDecoder::onDecodeRegion(SkBitmap* bm, SkIRect region) {
config != SkBitmap::kRGB_565_Config) {
config = SkBitmap::kARGB_8888_Config;
}
+
+ /* default format is RGB */
+ cinfo->out_color_space = JCS_RGB;
+
#ifdef ANDROID_RGB
cinfo->dither_mode = JDITHER_NONE;
if (config == SkBitmap::kARGB_8888_Config) {
cinfo->out_color_space = JCS_RGBA_8888;
} else if (config == SkBitmap::kRGB_565_Config) {
- if (requestedSampleSize == 1) {
- // SkScaledBitmapSampler can't handle RGB_565 yet,
- // so don't even try.
- cinfo->out_color_space = JCS_RGB_565;
- if (this->getDitherImage()) {
- cinfo->dither_mode = JDITHER_ORDERED;
- }
+ cinfo->out_color_space = JCS_RGB_565;
+ if (this->getDitherImage()) {
+ cinfo->dither_mode = JDITHER_ORDERED;
}
}
#endif
@@ -606,6 +602,8 @@ bool SkJPEGImageDecoder::onDecodeRegion(SkBitmap* bm, SkIRect region) {
#ifdef ANDROID_RGB
} else if (JCS_RGBA_8888 == cinfo->out_color_space) {
sc = SkScaledBitmapSampler::kRGBX;
+ } else if (JCS_RGB_565 == cinfo->out_color_space) {
+ sc = SkScaledBitmapSampler::kRGB_565;
#endif
} else if (1 == cinfo->out_color_components &&
JCS_GRAYSCALE == cinfo->out_color_space) {