OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2012 Google Inc. | 3 * Copyright 2012 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 #if SK_SUPPORT_GPU | 9 #if SK_SUPPORT_GPU |
10 | 10 |
11 #include "GrContext.h" | 11 #include "GrContext.h" |
12 #include "GrContextFactory.h" | 12 #include "GrContextFactory.h" |
13 #include "SkBitmap.h" | 13 #include "SkBitmap.h" |
14 #include "SkCanvas.h" | 14 #include "SkCanvas.h" |
15 #include "SkColor.h" | 15 #include "SkColor.h" |
16 #include "SkGpuDevice.h" | 16 #include "SkGpuDevice.h" |
17 #include "SkPaint.h" | 17 #include "SkPaint.h" |
18 #include "SkPixelRef.h" | 18 #include "SkPixelRef.h" |
19 #include "SkRect.h" | 19 #include "SkRect.h" |
20 #include "Test.h" | 20 #include "Test.h" |
| 21 #include "TestClassDef.h" |
21 | 22 |
22 static const char* boolStr(bool value) { | 23 static const char* boolStr(bool value) { |
23 return value ? "true" : "false"; | 24 return value ? "true" : "false"; |
24 } | 25 } |
25 | 26 |
26 // these are in the same order as the SkBitmap::Config enum | 27 // these are in the same order as the SkBitmap::Config enum |
27 static const char* gConfigName[] = { | 28 static const char* gConfigName[] = { |
28 "None", "8888" | 29 "None", "8888" |
29 }; | 30 }; |
30 | 31 |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 // dst should be unchanged from its initial state | 92 // dst should be unchanged from its initial state |
92 REPORTER_ASSERT(reporter, dst.config() == SkBitmap::kNo_Config); | 93 REPORTER_ASSERT(reporter, dst.config() == SkBitmap::kNo_Config); |
93 REPORTER_ASSERT(reporter, dst.width() == 0); | 94 REPORTER_ASSERT(reporter, dst.width() == 0); |
94 REPORTER_ASSERT(reporter, dst.height() == 0); | 95 REPORTER_ASSERT(reporter, dst.height() == 0); |
95 } | 96 } |
96 | 97 |
97 } | 98 } |
98 | 99 |
99 // Stripped down version of TestBitmapCopy that checks basic fields (width, heig
ht, config, genID) | 100 // Stripped down version of TestBitmapCopy that checks basic fields (width, heig
ht, config, genID) |
100 // to ensure that they were copied properly. | 101 // to ensure that they were copied properly. |
101 static void TestGpuBitmapCopy(skiatest::Reporter* reporter, GrContextFactory* fa
ctory) { | 102 DEF_GPUTEST(GpuBitmapCopy, reporter, factory) { |
102 #ifdef SK_BUILD_FOR_ANDROID // https://code.google.com/p/skia/issues/detail?id=7
53 | 103 #ifdef SK_BUILD_FOR_ANDROID // https://code.google.com/p/skia/issues/detail?id=7
53 |
103 return; | 104 return; |
104 #endif | 105 #endif |
105 for (int type = 0; type < GrContextFactory::kLastGLContextType; ++type) { | 106 for (int type = 0; type < GrContextFactory::kLastGLContextType; ++type) { |
106 GrContextFactory::GLContextType glType = static_cast<GrContextFactory::G
LContextType>(type); | 107 GrContextFactory::GLContextType glType = static_cast<GrContextFactory::G
LContextType>(type); |
107 if (!GrContextFactory::IsRenderingGLContext(glType)) { | 108 if (!GrContextFactory::IsRenderingGLContext(glType)) { |
108 continue; | 109 continue; |
109 } | 110 } |
110 | 111 |
111 GrContext* grContext = factory->get(glType); | 112 GrContext* grContext = factory->get(glType); |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 REPORTER_ASSERT(reporter, success == expected); | 185 REPORTER_ASSERT(reporter, success == expected); |
185 REPORTER_ASSERT(reporter, success == canSucceed); | 186 REPORTER_ASSERT(reporter, success == canSucceed); |
186 TestIndividualCopy(reporter, gPairs[j].fConfig, success, sub
set, subsetCopy, | 187 TestIndividualCopy(reporter, gPairs[j].fConfig, success, sub
set, subsetCopy, |
187 true); | 188 true); |
188 } | 189 } |
189 } // for (size_t j = ... | 190 } // for (size_t j = ... |
190 } // for (size_t i = ... | 191 } // for (size_t i = ... |
191 } // GrContextFactory::GLContextType | 192 } // GrContextFactory::GLContextType |
192 } | 193 } |
193 | 194 |
194 #include "TestClassDef.h" | |
195 DEFINE_GPUTESTCLASS("GpuBitmapCopy", TestGpuBitmapCopyClass, TestGpuBitmapCopy) | |
196 | |
197 #endif | 195 #endif |
OLD | NEW |