| OLD | NEW |
| 1 | |
| 2 /* | 1 /* |
| 3 * Copyright 2011 Google Inc. | 2 * Copyright 2011 Google Inc. |
| 4 * | 3 * |
| 5 * 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 |
| 6 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 7 */ | 6 */ |
| 7 |
| 8 #include "Test.h" | 8 #include "Test.h" |
| 9 #include "TestClassDef.h" |
| 9 #include "SkColor.h" | 10 #include "SkColor.h" |
| 10 #include "SkColorPriv.h" | 11 #include "SkColorPriv.h" |
| 11 #include "SkMathPriv.h" | 12 #include "SkMathPriv.h" |
| 12 #include "SkRandom.h" | 13 #include "SkRandom.h" |
| 13 #include "SkUnPreMultiply.h" | 14 #include "SkUnPreMultiply.h" |
| 14 | 15 |
| 15 #define GetPackedR16As32(packed) (SkGetPackedR16(dc) << (8 - SK_R16_BITS)) | 16 #define GetPackedR16As32(packed) (SkGetPackedR16(dc) << (8 - SK_R16_BITS)) |
| 16 #define GetPackedG16As32(packed) (SkGetPackedG16(dc) << (8 - SK_G16_BITS)) | 17 #define GetPackedG16As32(packed) (SkGetPackedG16(dc) << (8 - SK_G16_BITS)) |
| 17 #define GetPackedB16As32(packed) (SkGetPackedB16(dc) << (8 - SK_B16_BITS)) | 18 #define GetPackedB16As32(packed) (SkGetPackedB16(dc) << (8 - SK_B16_BITS)) |
| 18 | 19 |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 SkColor colorSrc = r.nextU(); | 70 SkColor colorSrc = r.nextU(); |
| 70 SkColor colorDst = r.nextU(); | 71 SkColor colorDst = r.nextU(); |
| 71 SkPMColor src = SkPreMultiplyColor(colorSrc); | 72 SkPMColor src = SkPreMultiplyColor(colorSrc); |
| 72 SkPMColor dst = SkPreMultiplyColor(colorDst); | 73 SkPMColor dst = SkPreMultiplyColor(colorDst); |
| 73 | 74 |
| 74 REPORTER_ASSERT(reporter, SkFastFourByteInterp(src, dst, a0) == dst); | 75 REPORTER_ASSERT(reporter, SkFastFourByteInterp(src, dst, a0) == dst); |
| 75 REPORTER_ASSERT(reporter, SkFastFourByteInterp(src, dst, a255) == src); | 76 REPORTER_ASSERT(reporter, SkFastFourByteInterp(src, dst, a255) == src); |
| 76 } | 77 } |
| 77 } | 78 } |
| 78 | 79 |
| 79 static void TestColor(skiatest::Reporter* reporter) { | 80 DEF_TEST(Color, reporter) { |
| 80 test_premul(reporter); | 81 test_premul(reporter); |
| 81 //test_interp(reporter); | 82 //test_interp(reporter); |
| 82 test_fast_interp(reporter); | 83 test_fast_interp(reporter); |
| 83 // test_565blend(); | 84 //test_565blend(); |
| 84 } | 85 } |
| 85 | |
| 86 #include "TestClassDef.h" | |
| 87 DEFINE_TESTCLASS("Color", ColorTestClass, TestColor) | |
| OLD | NEW |