OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 #include "Test.h" | 9 #include "Test.h" |
10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
(...skipping 18 matching lines...) Expand all Loading... |
29 for (int a = 0; a < 256; ++a) { | 29 for (int a = 0; a < 256; ++a) { |
30 for (int r = 0; r < 256; ++r) { | 30 for (int r = 0; r < 256; ++r) { |
31 pixels[a * 256 + r] = SkPackConfig8888(unpremulConfig, a, r, 0, 0); | 31 pixels[a * 256 + r] = SkPackConfig8888(unpremulConfig, a, r, 0, 0); |
32 } | 32 } |
33 } | 33 } |
34 canvas->writePixels(bmp, 0, 0, unpremulConfig); | 34 canvas->writePixels(bmp, 0, 0, unpremulConfig); |
35 } | 35 } |
36 | 36 |
37 static const SkCanvas::Config8888 gUnpremulConfigs[] = { | 37 static const SkCanvas::Config8888 gUnpremulConfigs[] = { |
38 SkCanvas::kNative_Unpremul_Config8888, | 38 SkCanvas::kNative_Unpremul_Config8888, |
39 /** | |
40 * There is a bug in Ganesh (http://code.google.com/p/skia/issues/detail?id=438) | |
41 * that causes the readback of pixels from BGRA canvas to an RGBA bitmap to | |
42 * fail. This should be removed as soon as the issue above is resolved. | |
43 */ | |
44 #if !defined(SK_BUILD_FOR_ANDROID) | |
45 SkCanvas::kBGRA_Unpremul_Config8888, | 39 SkCanvas::kBGRA_Unpremul_Config8888, |
46 #endif | |
47 SkCanvas::kRGBA_Unpremul_Config8888, | 40 SkCanvas::kRGBA_Unpremul_Config8888, |
48 }; | 41 }; |
49 | 42 |
50 void PremulAlphaRoundTripTest(skiatest::Reporter* reporter, GrContextFactory* fa
ctory) { | 43 void PremulAlphaRoundTripTest(skiatest::Reporter* reporter, GrContextFactory* fa
ctory) { |
51 SkAutoTUnref<SkDevice> device; | 44 SkAutoTUnref<SkDevice> device; |
52 for (int dtype = 0; dtype < 2; ++dtype) { | 45 for (int dtype = 0; dtype < 2; ++dtype) { |
53 | 46 |
54 int glCtxTypeCnt = 1; | 47 int glCtxTypeCnt = 1; |
55 #if SK_SUPPORT_GPU | 48 #if SK_SUPPORT_GPU |
56 if (0 != dtype) { | 49 if (0 != dtype) { |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 } | 111 } |
119 } | 112 } |
120 } | 113 } |
121 } | 114 } |
122 } | 115 } |
123 } | 116 } |
124 } | 117 } |
125 | 118 |
126 #include "TestClassDef.h" | 119 #include "TestClassDef.h" |
127 DEFINE_GPUTESTCLASS("PremulAlphaRoundTripTest", PremulAlphaRoundTripTestClass, P
remulAlphaRoundTripTest) | 120 DEFINE_GPUTESTCLASS("PremulAlphaRoundTripTest", PremulAlphaRoundTripTestClass, P
remulAlphaRoundTripTest) |
OLD | NEW |