OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 Google Inc. |
3 * | 3 * |
4 * 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 |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "Test.h" | 8 #include "Test.h" |
9 #if SK_SUPPORT_GPU | 9 #if SK_SUPPORT_GPU |
10 #include "GrCaps.h" | 10 #include "GrCaps.h" |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 for (int i = 0; i < kW; ++i) { | 152 for (int i = 0; i < kW; ++i) { |
153 origData[j * kW + i] = (j << 24) | (i << 16) | (i << 8) | i; | 153 origData[j * kW + i] = (j << 24) | (i << 16) | (i << 8) | i; |
154 } | 154 } |
155 } | 155 } |
156 | 156 |
157 GrSurfaceDesc desc; | 157 GrSurfaceDesc desc; |
158 desc.fFlags = kRenderTarget_GrSurfaceFlag; | 158 desc.fFlags = kRenderTarget_GrSurfaceFlag; |
159 desc.fWidth = kW; | 159 desc.fWidth = kW; |
160 desc.fHeight = kH; | 160 desc.fHeight = kH; |
161 desc.fConfig = kSRGBA_8888_GrPixelConfig; | 161 desc.fConfig = kSRGBA_8888_GrPixelConfig; |
162 if (context->caps()->isConfigRenderable(desc.fConfig, false) && | 162 if (context->caps()->srgbSupport() && |
| 163 context->caps()->isConfigRenderable(desc.fConfig, false) && |
163 context->caps()->isConfigTexturable(desc.fConfig)) { | 164 context->caps()->isConfigTexturable(desc.fConfig)) { |
164 SkAutoTUnref<GrTexture> tex(context->textureProvider()->createTexture( | 165 SkAutoTUnref<GrTexture> tex(context->textureProvider()->createTexture( |
165 desc, SkBudgeted::kNo)); | 166 desc, SkBudgeted::kNo)); |
166 if (!tex) { | 167 if (!tex) { |
167 ERRORF(reporter, "Could not create SRGBA texture."); | 168 ERRORF(reporter, "Could not create SRGBA texture."); |
168 return; | 169 return; |
169 } | 170 } |
170 | 171 |
171 float error = context->caps()->shaderCaps()->floatPrecisionVaries() ? 1.
2f : 0.5f; | 172 float error = context->caps()->shaderCaps()->floatPrecisionVaries() ? 1.
2f : 0.5f; |
172 | 173 |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 if (tex->writePixels(0, 0, kW, kH, kRGBA_8888_GrPixelConfig, origData))
{ | 224 if (tex->writePixels(0, 0, kW, kH, kRGBA_8888_GrPixelConfig, origData))
{ |
224 read_and_check_pixels(reporter, tex, origData, kSRGBA_8888_GrPixelCo
nfig, | 225 read_and_check_pixels(reporter, tex, origData, kSRGBA_8888_GrPixelCo
nfig, |
225 check_linear_to_srgb_conversion, 1.2f, | 226 check_linear_to_srgb_conversion, 1.2f, |
226 "write rgba/read srgba to rgba texture"); | 227 "write rgba/read srgba to rgba texture"); |
227 } else { | 228 } else { |
228 ERRORF(reporter, "Could not write rgba data to rgba texture."); | 229 ERRORF(reporter, "Could not write rgba data to rgba texture."); |
229 } | 230 } |
230 } | 231 } |
231 } | 232 } |
232 #endif | 233 #endif |
OLD | NEW |