| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 Google Inc. |
| 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 #include "Test.h" | |
| 9 #include "SkColor.h" | 8 #include "SkColor.h" |
| 10 #include "SkColorPriv.h" | 9 #include "SkColorPriv.h" |
| 11 #include "SkMathPriv.h" | 10 #include "SkMathPriv.h" |
| 12 #include "SkRandom.h" | 11 #include "SkRandom.h" |
| 13 #include "SkUnPreMultiply.h" | 12 #include "SkUnPreMultiply.h" |
| 13 #include "Test.h" |
| 14 | 14 |
| 15 #define GetPackedR16As32(packed) (SkGetPackedR16(dc) << (8 - SK_R16_BITS)) | 15 #define GetPackedR16As32(packed) (SkGetPackedR16(dc) << (8 - SK_R16_BITS)) |
| 16 #define GetPackedG16As32(packed) (SkGetPackedG16(dc) << (8 - SK_G16_BITS)) | 16 #define GetPackedG16As32(packed) (SkGetPackedG16(dc) << (8 - SK_G16_BITS)) |
| 17 #define GetPackedB16As32(packed) (SkGetPackedB16(dc) << (8 - SK_B16_BITS)) | 17 #define GetPackedB16As32(packed) (SkGetPackedB16(dc) << (8 - SK_B16_BITS)) |
| 18 | 18 |
| 19 static inline void test_premul(skiatest::Reporter* reporter) { | 19 static inline void test_premul(skiatest::Reporter* reporter) { |
| 20 for (int a = 0; a <= 255; a++) { | 20 for (int a = 0; a <= 255; a++) { |
| 21 for (int x = 0; x <= 255; x++) { | 21 for (int x = 0; x <= 255; x++) { |
| 22 SkColor c0 = SkColorSetARGB(a, x, x, x); | 22 SkColor c0 = SkColorSetARGB(a, x, x, x); |
| 23 SkPMColor p0 = SkPreMultiplyColor(c0); | 23 SkPMColor p0 = SkPreMultiplyColor(c0); |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 REPORTER_ASSERT(reporter, SkFastFourByteInterp(src, dst, a255) == src); | 75 REPORTER_ASSERT(reporter, SkFastFourByteInterp(src, dst, a255) == src); |
| 76 } | 76 } |
| 77 } | 77 } |
| 78 | 78 |
| 79 DEF_TEST(Color, reporter) { | 79 DEF_TEST(Color, reporter) { |
| 80 test_premul(reporter); | 80 test_premul(reporter); |
| 81 //test_interp(reporter); | 81 //test_interp(reporter); |
| 82 test_fast_interp(reporter); | 82 test_fast_interp(reporter); |
| 83 //test_565blend(); | 83 //test_565blend(); |
| 84 } | 84 } |
| OLD | NEW |