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 23 matching lines...) Expand all Loading... |
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 SkCanvas::kBGRA_Unpremul_Config8888, | 39 SkCanvas::kBGRA_Unpremul_Config8888, |
40 SkCanvas::kRGBA_Unpremul_Config8888, | 40 SkCanvas::kRGBA_Unpremul_Config8888, |
41 }; | 41 }; |
42 | 42 |
43 void PremulAlphaRoundTripTest(skiatest::Reporter* reporter, GrContextFactory* fa
ctory) { | 43 void PremulAlphaRoundTripTest(skiatest::Reporter* reporter, GrContextFactory* fa
ctory) { |
44 SkAutoTUnref<SkDevice> device; | 44 SkAutoTUnref<SkBaseDevice> device; |
45 for (int dtype = 0; dtype < 2; ++dtype) { | 45 for (int dtype = 0; dtype < 2; ++dtype) { |
46 | 46 |
47 int glCtxTypeCnt = 1; | 47 int glCtxTypeCnt = 1; |
48 #if SK_SUPPORT_GPU | 48 #if SK_SUPPORT_GPU |
49 if (0 != dtype) { | 49 if (0 != dtype) { |
50 glCtxTypeCnt = GrContextFactory::kGLContextTypeCnt; | 50 glCtxTypeCnt = GrContextFactory::kGLContextTypeCnt; |
51 } | 51 } |
52 #endif | 52 #endif |
53 for (int glCtxType = 0; glCtxType < glCtxTypeCnt; ++glCtxType) { | 53 for (int glCtxType = 0; glCtxType < glCtxTypeCnt; ++glCtxType) { |
54 if (0 == dtype) { | 54 if (0 == dtype) { |
55 device.reset(new SkDevice(SkBitmap::kARGB_8888_Config, | 55 device.reset(new SkBitmapDevice(SkBitmap::kARGB_8888_Config, |
56 256, | 56 256, |
57 256, | 57 256, |
58 false)); | 58 false)); |
59 } else { | 59 } else { |
60 #if SK_SUPPORT_GPU | 60 #if SK_SUPPORT_GPU |
61 GrContextFactory::GLContextType type = | 61 GrContextFactory::GLContextType type = |
62 static_cast<GrContextFactory::GLContextType>(glCtxType); | 62 static_cast<GrContextFactory::GLContextType>(glCtxType); |
63 if (!GrContextFactory::IsRenderingGLContext(type)) { | 63 if (!GrContextFactory::IsRenderingGLContext(type)) { |
64 continue; | 64 continue; |
65 } | 65 } |
66 GrContext* context = factory->get(type); | 66 GrContext* context = factory->get(type); |
67 if (NULL == context) { | 67 if (NULL == context) { |
68 continue; | 68 continue; |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 } | 111 } |
112 } | 112 } |
113 } | 113 } |
114 } | 114 } |
115 } | 115 } |
116 } | 116 } |
117 } | 117 } |
118 | 118 |
119 #include "TestClassDef.h" | 119 #include "TestClassDef.h" |
120 DEFINE_GPUTESTCLASS("PremulAlphaRoundTripTest", PremulAlphaRoundTripTestClass, P
remulAlphaRoundTripTest) | 120 DEFINE_GPUTESTCLASS("PremulAlphaRoundTripTest", PremulAlphaRoundTripTestClass, P
remulAlphaRoundTripTest) |
OLD | NEW |