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 | 21 |
22 static const char* boolStr(bool value) { | 22 static const char* boolStr(bool value) { |
23 return value ? "true" : "false"; | 23 return value ? "true" : "false"; |
24 } | 24 } |
25 | 25 |
26 // these are in the same order as the SkBitmap::Config enum | 26 // these are in the same order as the SkBitmap::Config enum |
27 static const char* gConfigName[] = { | 27 static const char* gConfigName[] = { |
28 "None", "4444", "8888" | 28 "None", "8888" |
29 }; | 29 }; |
30 | 30 |
31 struct Pair { | 31 struct Pair { |
32 SkBitmap::Config fConfig; | 32 SkBitmap::Config fConfig; |
33 const char* fValid; | 33 const char* fValid; |
34 }; | 34 }; |
35 | 35 |
36 /** | 36 /** |
37 * Check to ensure that copying a GPU-backed SkBitmap behaved as expected. | 37 * Check to ensure that copying a GPU-backed SkBitmap behaved as expected. |
38 * @param reporter Used to report failures. | 38 * @param reporter Used to report failures. |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
111 GrContext* grContext = factory->get(glType); | 111 GrContext* grContext = factory->get(glType); |
112 if (NULL == grContext) { | 112 if (NULL == grContext) { |
113 continue; | 113 continue; |
114 } | 114 } |
115 | 115 |
116 | 116 |
117 if (NULL == grContext) { | 117 if (NULL == grContext) { |
118 return; | 118 return; |
119 } | 119 } |
120 static const Pair gPairs[] = { | 120 static const Pair gPairs[] = { |
121 { SkBitmap::kNo_Config, "000" }, | 121 { SkBitmap::kNo_Config, "000" }, |
scroggo
2013/06/21 18:56:59
These should now be "00" and "01", respectively.
reed1
2013/06/21 19:06:30
Done.
| |
122 { SkBitmap::kARGB_4444_Config, "011" }, | |
123 { SkBitmap::kARGB_8888_Config, "011" }, | 122 { SkBitmap::kARGB_8888_Config, "011" }, |
124 }; | 123 }; |
125 | 124 |
126 const int W = 20; | 125 const int W = 20; |
127 const int H = 33; | 126 const int H = 33; |
128 | 127 |
129 for (size_t i = 0; i < SK_ARRAY_COUNT(gPairs); i++) { | 128 for (size_t i = 0; i < SK_ARRAY_COUNT(gPairs); i++) { |
130 SkBitmap src, dst; | 129 SkBitmap src, dst; |
131 | 130 |
132 SkGpuDevice* device = SkNEW_ARGS(SkGpuDevice, (grContext, gPairs[i]. fConfig, W, H)); | 131 SkGpuDevice* device = SkNEW_ARGS(SkGpuDevice, (grContext, gPairs[i]. fConfig, W, H)); |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
189 } | 188 } |
190 } // for (size_t j = ... | 189 } // for (size_t j = ... |
191 } // for (size_t i = ... | 190 } // for (size_t i = ... |
192 } // GrContextFactory::GLContextType | 191 } // GrContextFactory::GLContextType |
193 } | 192 } |
194 | 193 |
195 #include "TestClassDef.h" | 194 #include "TestClassDef.h" |
196 DEFINE_GPUTESTCLASS("GpuBitmapCopy", TestGpuBitmapCopyClass, TestGpuBitmapCopy) | 195 DEFINE_GPUTESTCLASS("GpuBitmapCopy", TestGpuBitmapCopyClass, TestGpuBitmapCopy) |
197 | 196 |
198 #endif | 197 #endif |
OLD | NEW |