| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 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 | 9 |
| 10 // This test is specific to the GPU backend. | 10 // This test is specific to the GPU backend. |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 if (e != a) { | 26 if (e != a) { |
| 27 ERRORF(reporter, | 27 ERRORF(reporter, |
| 28 "Failed alpha readback. Expected: 0x%02x, Got: 0x%02x at
(%d,%d), %s", | 28 "Failed alpha readback. Expected: 0x%02x, Got: 0x%02x at
(%d,%d), %s", |
| 29 e, a, x, y, extraMsg.c_str()); | 29 e, a, x, y, extraMsg.c_str()); |
| 30 return; | 30 return; |
| 31 } | 31 } |
| 32 } | 32 } |
| 33 } | 33 } |
| 34 } | 34 } |
| 35 | 35 |
| 36 DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ReadWriteAlpha, reporter, ctxInfo) { | 36 DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(ReadWriteAlpha, reporter, ctxInfo) { |
| 37 unsigned char alphaData[X_SIZE * Y_SIZE]; | 37 unsigned char alphaData[X_SIZE * Y_SIZE]; |
| 38 | 38 |
| 39 bool match; | 39 bool match; |
| 40 static const size_t kRowBytes[] = {0, X_SIZE, X_SIZE + 1, 2 * X_SIZE - 1}; | 40 static const size_t kRowBytes[] = {0, X_SIZE, X_SIZE + 1, 2 * X_SIZE - 1}; |
| 41 for (int rt = 0; rt < 2; ++rt) { | 41 for (int rt = 0; rt < 2; ++rt) { |
| 42 GrSurfaceDesc desc; | 42 GrSurfaceDesc desc; |
| 43 // let Skia know we will be using this texture as a render target | 43 // let Skia know we will be using this texture as a render target |
| 44 desc.fFlags = rt ? kRenderTarget_GrSurfaceFlag : kNone_GrSurfaceFlag
s; | 44 desc.fFlags = rt ? kRenderTarget_GrSurfaceFlag : kNone_GrSurfaceFlag
s; |
| 45 // it is a single channel texture | 45 // it is a single channel texture |
| 46 desc.fConfig = kAlpha_8_GrPixelConfig; | 46 desc.fConfig = kAlpha_8_GrPixelConfig; |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 SkString msg; | 176 SkString msg; |
| 177 msg.printf("rt:%d, rb:%d", rt, SkToU32(rowBytes)); | 177 msg.printf("rt:%d, rb:%d", rt, SkToU32(rowBytes)); |
| 178 validate_alpha_data(reporter, X_SIZE, Y_SIZE, readback.get(), no
nZeroRowBytes, | 178 validate_alpha_data(reporter, X_SIZE, Y_SIZE, readback.get(), no
nZeroRowBytes, |
| 179 alphaData, msg); | 179 alphaData, msg); |
| 180 } | 180 } |
| 181 } | 181 } |
| 182 } | 182 } |
| 183 } | 183 } |
| 184 | 184 |
| 185 #endif | 185 #endif |
| OLD | NEW |