From 13f701a14d2a303b153ea861a3482e25254a9c3c Mon Sep 17 00:00:00 2001 From: scroggo Date: Mon, 27 Oct 2014 08:43:12 -0700 Subject: 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 --- src/images/SkScaledBitmapSampler.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'src/images') 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 -- cgit v1.2.3