aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/images
diff options
context:
space:
mode:
authorGravatar scroggo <scroggo@google.com>2014-10-27 08:43:12 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2014-10-27 08:43:12 -0700
commit13f701a14d2a303b153ea861a3482e25254a9c3c (patch)
tree984605546ee76d7954ef17a77fc0dd62ec1ad563 /src/images
parenta58fe35fdae3481cf43062f7032820c320c3d163 (diff)
Allow index sources to be unpremul.
This only affects the PNG image decoder, where we have already created the color table without premultiplication. Since the RowProcChooser is just providing a proc that chooses indices into the color table, it can just return the same RowProc. Update test_row_proc_choice. It was testing to ensure that we hadn't changed the behavior from the original version of setPrefConfigTable. In this case, we deliberately changed the behavior, so we need to change the test. BUG=b/12024301 Review URL: https://codereview.chromium.org/657863005
Diffstat (limited to 'src/images')
-rw-r--r--src/images/SkScaledBitmapSampler.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/images/SkScaledBitmapSampler.cpp b/src/images/SkScaledBitmapSampler.cpp
index fe425d58b1..8bb1bde7c4 100644
--- a/src/images/SkScaledBitmapSampler.cpp
+++ b/src/images/SkScaledBitmapSampler.cpp
@@ -396,10 +396,9 @@ static bool Sample_Index_D8888_SkipZ(void* SK_RESTRICT dstRow,
static SkScaledBitmapSampler::RowProc
get_index_to_8888_proc(const SkScaledBitmapSampler::Options& opts) {
- if (!opts.fPremultiplyAlpha) {
- // Unpremultiplied is not supported for an index source.
- return NULL;
- }
+ // The caller is expected to have created the source colortable
+ // properly with respect to opts.fPremultiplyAlpha, so premul makes
+ // no difference here.
// Dither makes no difference
if (opts.fSkipZeros) {
return Sample_Index_D8888_SkipZ;
@@ -803,7 +802,7 @@ SkScaledBitmapSampler::RowProc gTestProcs[] = {
Sample_Index_DI, Sample_Index_DI, NULL, NULL, // to Index8
Sample_Index_D565, Sample_Index_D565_D, Sample_Index_D565, Sample_Index_D565_D, // to 565
Sample_Index_D4444, Sample_Index_D4444_D, NULL, NULL, // to 4444
- Sample_Index_D8888, Sample_Index_D8888, NULL, NULL, // to 8888
+ Sample_Index_D8888, Sample_Index_D8888, Sample_Index_D8888, Sample_Index_D8888, // to 8888
// RGB
NULL, NULL, NULL, NULL, // to A8
NULL, NULL, NULL, NULL, // to Index8