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
This commit is contained in:
scroggo 2014-10-27 08:43:12 -07:00 committed by Commit bot
parent a58fe35fda
commit 13f701a14d

View File

@ -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