| 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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 REPORTER_ASSERT_MESSAGE(reporter, result, "Initial A8 readPixels fai
led"); | 86 REPORTER_ASSERT_MESSAGE(reporter, result, "Initial A8 readPixels fai
led"); |
| 87 | 87 |
| 88 // make sure the original & read back versions match | 88 // make sure the original & read back versions match |
| 89 SkString msg; | 89 SkString msg; |
| 90 msg.printf("rt:%d, rb:%d A8", rt, SkToU32(rowBytes)); | 90 msg.printf("rt:%d, rb:%d A8", rt, SkToU32(rowBytes)); |
| 91 validate_alpha_data(reporter, X_SIZE, Y_SIZE, readback.get(), nonZer
oRowBytes, | 91 validate_alpha_data(reporter, X_SIZE, Y_SIZE, readback.get(), nonZer
oRowBytes, |
| 92 alphaData, msg); | 92 alphaData, msg); |
| 93 | 93 |
| 94 // Now try writing on the single channel texture (if we could create
as a RT). | 94 // Now try writing on the single channel texture (if we could create
as a RT). |
| 95 if (texture->asRenderTarget()) { | 95 if (texture->asRenderTarget()) { |
| 96 sk_sp<SkSurface> surf(SkSurface::MakeRenderTargetDirect(texture-
>asRenderTarget())); | 96 sk_sp<SkSurface> surf(SkSurface::MakeRenderTargetDirect(texture-
>asRenderTarget(), |
| 97 nullptr)
); |
| 97 SkCanvas* canvas = surf->getCanvas(); | 98 SkCanvas* canvas = surf->getCanvas(); |
| 98 | 99 |
| 99 SkPaint paint; | 100 SkPaint paint; |
| 100 | 101 |
| 101 const SkRect rect = SkRect::MakeLTRB(-10, -10, X_SIZE + 10, Y_SI
ZE + 10); | 102 const SkRect rect = SkRect::MakeLTRB(-10, -10, X_SIZE + 10, Y_SI
ZE + 10); |
| 102 | 103 |
| 103 paint.setColor(SK_ColorWHITE); | 104 paint.setColor(SK_ColorWHITE); |
| 104 | 105 |
| 105 canvas->drawRect(rect, paint); | 106 canvas->drawRect(rect, paint); |
| 106 | 107 |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 SkString msg; | 183 SkString msg; |
| 183 msg.printf("rt:%d, rb:%d 8888", rt, SkToU32(rowBytes)); | 184 msg.printf("rt:%d, rb:%d 8888", rt, SkToU32(rowBytes)); |
| 184 validate_alpha_data(reporter, X_SIZE, Y_SIZE, readback.get(), no
nZeroRowBytes, | 185 validate_alpha_data(reporter, X_SIZE, Y_SIZE, readback.get(), no
nZeroRowBytes, |
| 185 alphaData, msg); | 186 alphaData, msg); |
| 186 } | 187 } |
| 187 } | 188 } |
| 188 } | 189 } |
| 189 } | 190 } |
| 190 | 191 |
| 191 #endif | 192 #endif |
| OLD | NEW |