aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorWei-Ta Chen <weita@google.com>2010-12-03 14:32:42 -0800
committerWei-Ta Chen <weita@google.com>2010-12-06 14:20:05 -0800
commit11367612f6a2e15b3008920bcb1ce2793c350c3d (patch)
treebe77e7af994dccdd84cd5ab6903cb42c11e15b28 /src
parentafe4eb88f1f4ace85dbf386c17a5f40bc1b8c16d (diff)
downloadexternal_skia-11367612f6a2e15b3008920bcb1ce2793c350c3d.zip
external_skia-11367612f6a2e15b3008920bcb1ce2793c350c3d.tar.gz
external_skia-11367612f6a2e15b3008920bcb1ce2793c350c3d.tar.bz2
Add fPreferQualityOverSpeed to SkImageDecoder.
Currently the field only affects JPEG decode, in that when it is set to true, we choose a more accurate, but slightly slower, IDCT method. Bug: 3238925 Change-Id: I7da20de7281243dc3e246b328517df10039cd290
Diffstat (limited to 'src')
-rw-r--r--src/images/SkImageDecoder_libjpeg.cpp15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/images/SkImageDecoder_libjpeg.cpp b/src/images/SkImageDecoder_libjpeg.cpp
index dc6ac5b..7e425c1 100644
--- a/src/images/SkImageDecoder_libjpeg.cpp
+++ b/src/images/SkImageDecoder_libjpeg.cpp
@@ -236,7 +236,12 @@ bool SkJPEGImageDecoder::onDecode(SkStream* stream, SkBitmap* bm, Mode mode) {
*/
int sampleSize = this->getSampleSize();
- cinfo.dct_method = JDCT_IFAST;
+ if (this->getPreferQualityOverSpeed()) {
+ cinfo.dct_method = JDCT_ISLOW;
+ } else {
+ cinfo.dct_method = JDCT_IFAST;
+ }
+
cinfo.scale_num = 1;
cinfo.scale_denom = sampleSize;
@@ -464,7 +469,6 @@ bool SkJPEGImageDecoder::onBuildTileIndex(SkStream* stream,
index->index = (huffman_index*)malloc(sizeof(huffman_index));
jpeg_create_huffman_index(cinfo, index->index);
- cinfo->dct_method = JDCT_IFAST;
cinfo->scale_num = 1;
cinfo->scale_denom = 1;
if (!jpeg_build_huffman_index(cinfo, index->index)) {
@@ -493,7 +497,6 @@ bool SkJPEGImageDecoder::onBuildTileIndex(SkStream* stream,
//jpeg_start_decompress(cinfo);
jpeg_start_tile_decompress(cinfo);
- cinfo->dct_method = JDCT_IFAST;
cinfo->scale_num = 1;
index->cinfo = cinfo;
*height = cinfo->output_height;
@@ -522,6 +525,12 @@ bool SkJPEGImageDecoder::onDecodeRegion(SkBitmap* bm, SkIRect region) {
int requestedSampleSize = this->getSampleSize();
cinfo->scale_denom = requestedSampleSize;
+ if (this->getPreferQualityOverSpeed()) {
+ cinfo->dct_method = JDCT_ISLOW;
+ } else {
+ cinfo->dct_method = JDCT_IFAST;
+ }
+
SkBitmap::Config config = this->getPrefConfig(k32Bit_SrcDepth, false);
if (config != SkBitmap::kARGB_8888_Config &&
config != SkBitmap::kARGB_4444_Config &&