| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2007 The Android Open Source Project | 2 * Copyright 2007 The Android Open Source Project |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 | 8 |
| 9 #include "SkScaledBitmapSampler.h" | 9 #include "SkScaledBitmapSampler.h" |
| 10 #include "SkBitmap.h" | 10 #include "SkBitmap.h" |
| (...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 389 if (c != 0) { | 389 if (c != 0) { |
| 390 dst[x] = c; | 390 dst[x] = c; |
| 391 } | 391 } |
| 392 src += deltaSrc; | 392 src += deltaSrc; |
| 393 } | 393 } |
| 394 return cc != A32_MASK_IN_PLACE; | 394 return cc != A32_MASK_IN_PLACE; |
| 395 } | 395 } |
| 396 | 396 |
| 397 static SkScaledBitmapSampler::RowProc | 397 static SkScaledBitmapSampler::RowProc |
| 398 get_index_to_8888_proc(const SkScaledBitmapSampler::Options& opts) { | 398 get_index_to_8888_proc(const SkScaledBitmapSampler::Options& opts) { |
| 399 if (!opts.fPremultiplyAlpha) { | 399 // The caller is expected to have created the source colortable |
| 400 // Unpremultiplied is not supported for an index source. | 400 // properly with respect to opts.fPremultiplyAlpha, so premul makes |
| 401 return NULL; | 401 // no difference here. |
| 402 } | |
| 403 // Dither makes no difference | 402 // Dither makes no difference |
| 404 if (opts.fSkipZeros) { | 403 if (opts.fSkipZeros) { |
| 405 return Sample_Index_D8888_SkipZ; | 404 return Sample_Index_D8888_SkipZ; |
| 406 } | 405 } |
| 407 return Sample_Index_D8888; | 406 return Sample_Index_D8888; |
| 408 } | 407 } |
| 409 | 408 |
| 410 static bool Sample_Index_D565(void* SK_RESTRICT dstRow, | 409 static bool Sample_Index_D565(void* SK_RESTRICT dstRow, |
| 411 const uint8_t* SK_RESTRICT src, | 410 const uint8_t* SK_RESTRICT src, |
| 412 int width, int deltaSrc, int, const SkPMColor ctable[]) { | 411 int width, int deltaSrc, int, const SkPMColor ctable[]) { |
| (...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 796 Sample_Gray_DA8, Sample_Gray_DA8, NULL, NULL
, // to A8 | 795 Sample_Gray_DA8, Sample_Gray_DA8, NULL, NULL
, // to A8 |
| 797 NULL, NULL, NULL, NULL
, // to Index8 | 796 NULL, NULL, NULL, NULL
, // to Index8 |
| 798 Sample_Gray_D565, Sample_Gray_D565_D, Sample_Gray_D565, Samp
le_Gray_D565_D, // to 565 | 797 Sample_Gray_D565, Sample_Gray_D565_D, Sample_Gray_D565, Samp
le_Gray_D565_D, // to 565 |
| 799 Sample_Gray_D4444, Sample_Gray_D4444_D, Sample_Gray_D4444, Samp
le_Gray_D4444_D, // to 4444 | 798 Sample_Gray_D4444, Sample_Gray_D4444_D, Sample_Gray_D4444, Samp
le_Gray_D4444_D, // to 4444 |
| 800 Sample_Gray_D8888, Sample_Gray_D8888, Sample_Gray_D8888, Samp
le_Gray_D8888, // to 8888 | 799 Sample_Gray_D8888, Sample_Gray_D8888, Sample_Gray_D8888, Samp
le_Gray_D8888, // to 8888 |
| 801 // Index | 800 // Index |
| 802 NULL, NULL, NULL, NULL
, // to A8 | 801 NULL, NULL, NULL, NULL
, // to A8 |
| 803 Sample_Index_DI, Sample_Index_DI, NULL, NULL
, // to Index8 | 802 Sample_Index_DI, Sample_Index_DI, NULL, NULL
, // to Index8 |
| 804 Sample_Index_D565, Sample_Index_D565_D, Sample_Index_D565, Samp
le_Index_D565_D, // to 565 | 803 Sample_Index_D565, Sample_Index_D565_D, Sample_Index_D565, Samp
le_Index_D565_D, // to 565 |
| 805 Sample_Index_D4444, Sample_Index_D4444_D, NULL, NULL
, // to 4444 | 804 Sample_Index_D4444, Sample_Index_D4444_D, NULL, NULL
, // to 4444 |
| 806 Sample_Index_D8888, Sample_Index_D8888, NULL, NULL
, // to 8888 | 805 Sample_Index_D8888, Sample_Index_D8888, Sample_Index_D8888, Samp
le_Index_D8888, // to 8888 |
| 807 // RGB | 806 // RGB |
| 808 NULL, NULL, NULL, NULL
, // to A8 | 807 NULL, NULL, NULL, NULL
, // to A8 |
| 809 NULL, NULL, NULL, NULL
, // to Index8 | 808 NULL, NULL, NULL, NULL
, // to Index8 |
| 810 Sample_RGBx_D565, Sample_RGBx_D565_D, Sample_RGBx_D565, Samp
le_RGBx_D565_D, // to 565 | 809 Sample_RGBx_D565, Sample_RGBx_D565_D, Sample_RGBx_D565, Samp
le_RGBx_D565_D, // to 565 |
| 811 Sample_RGBx_D4444, Sample_RGBx_D4444_D, Sample_RGBx_D4444, Samp
le_RGBx_D4444_D, // to 4444 | 810 Sample_RGBx_D4444, Sample_RGBx_D4444_D, Sample_RGBx_D4444, Samp
le_RGBx_D4444_D, // to 4444 |
| 812 Sample_RGBx_D8888, Sample_RGBx_D8888, Sample_RGBx_D8888, Samp
le_RGBx_D8888, // to 8888 | 811 Sample_RGBx_D8888, Sample_RGBx_D8888, Sample_RGBx_D8888, Samp
le_RGBx_D8888, // to 8888 |
| 813 // RGBx is the same as RGB | 812 // RGBx is the same as RGB |
| 814 NULL, NULL, NULL, NULL
, // to A8 | 813 NULL, NULL, NULL, NULL
, // to A8 |
| 815 NULL, NULL, NULL, NULL
, // to Index8 | 814 NULL, NULL, NULL, NULL
, // to Index8 |
| 816 Sample_RGBx_D565, Sample_RGBx_D565_D, Sample_RGBx_D565, Samp
le_RGBx_D565_D, // to 565 | 815 Sample_RGBx_D565, Sample_RGBx_D565_D, Sample_RGBx_D565, Samp
le_RGBx_D565_D, // to 565 |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 867 SkScaledBitmapSampler::RowProc actual = RowProcTester::getRo
wProc(sampler); | 866 SkScaledBitmapSampler::RowProc actual = RowProcTester::getRo
wProc(sampler); |
| 868 SkASSERT(expected == actual); | 867 SkASSERT(expected == actual); |
| 869 procCounter++; | 868 procCounter++; |
| 870 } | 869 } |
| 871 } | 870 } |
| 872 } | 871 } |
| 873 } | 872 } |
| 874 SkASSERT(SK_ARRAY_COUNT(gTestProcs) == procCounter); | 873 SkASSERT(SK_ARRAY_COUNT(gTestProcs) == procCounter); |
| 875 } | 874 } |
| 876 #endif // SK_DEBUG | 875 #endif // SK_DEBUG |
| OLD | NEW |