| 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 16 matching lines...) Expand all Loading... |
| 27 if (e != a) { | 27 if (e != a) { |
| 28 ERRORF(reporter, | 28 ERRORF(reporter, |
| 29 "Failed alpha readback. Expected: 0x%02x, Got: 0x%02x at
(%d,%d), %s", | 29 "Failed alpha readback. Expected: 0x%02x, Got: 0x%02x at
(%d,%d), %s", |
| 30 e, a, x, y, extraMsg.c_str()); | 30 e, a, x, y, extraMsg.c_str()); |
| 31 return; | 31 return; |
| 32 } | 32 } |
| 33 } | 33 } |
| 34 } | 34 } |
| 35 } | 35 } |
| 36 | 36 |
| 37 DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(ReadWriteAlpha, reporter, ctxInfo) { | 37 DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ReadWriteAlpha, reporter, ctxInfo) { |
| 38 unsigned char alphaData[X_SIZE * Y_SIZE]; | 38 unsigned char alphaData[X_SIZE * Y_SIZE]; |
| 39 | 39 |
| 40 static const int kClearValue = 0x2; | 40 static const int kClearValue = 0x2; |
| 41 | 41 |
| 42 bool match; | 42 bool match; |
| 43 static const size_t kRowBytes[] = {0, X_SIZE, X_SIZE + 1, 2 * X_SIZE - 1}; | 43 static const size_t kRowBytes[] = {0, X_SIZE, X_SIZE + 1, 2 * X_SIZE - 1}; |
| 44 for (int rt = 0; rt < 2; ++rt) { | 44 for (int rt = 0; rt < 2; ++rt) { |
| 45 GrSurfaceDesc desc; | 45 GrSurfaceDesc desc; |
| 46 // let Skia know we will be using this texture as a render target | 46 // let Skia know we will be using this texture as a render target |
| 47 desc.fFlags = rt ? kRenderTarget_GrSurfaceFlag : kNone_GrSurfaceFlag
s; | 47 desc.fFlags = rt ? kRenderTarget_GrSurfaceFlag : kNone_GrSurfaceFlag
s; |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 SkString msg; | 182 SkString msg; |
| 183 msg.printf("rt:%d, rb:%d 8888", rt, SkToU32(rowBytes)); | 183 msg.printf("rt:%d, rb:%d 8888", rt, SkToU32(rowBytes)); |
| 184 validate_alpha_data(reporter, X_SIZE, Y_SIZE, readback.get(), no
nZeroRowBytes, | 184 validate_alpha_data(reporter, X_SIZE, Y_SIZE, readback.get(), no
nZeroRowBytes, |
| 185 alphaData, msg); | 185 alphaData, msg); |
| 186 } | 186 } |
| 187 } | 187 } |
| 188 } | 188 } |
| 189 } | 189 } |
| 190 | 190 |
| 191 #endif | 191 #endif |
| OLD | NEW |