| 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 // This test is specific to the GPU backend. | 8 // This test is specific to the GPU backend. |
| 9 #if SK_SUPPORT_GPU && !defined(SK_BUILD_FOR_ANDROID) | 9 #if SK_SUPPORT_GPU && !defined(SK_BUILD_FOR_ANDROID) |
| 10 | 10 |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 for (int x = 0; x < X_SIZE; ++x) { | 74 for (int x = 0; x < X_SIZE; ++x) { |
| 75 if (textureData[x][y] != readback[x][y]) { | 75 if (textureData[x][y] != readback[x][y]) { |
| 76 match = false; | 76 match = false; |
| 77 } | 77 } |
| 78 } | 78 } |
| 79 } | 79 } |
| 80 | 80 |
| 81 REPORTER_ASSERT(reporter, match); | 81 REPORTER_ASSERT(reporter, match); |
| 82 | 82 |
| 83 // Now try writing on the single channel texture | 83 // Now try writing on the single channel texture |
| 84 SkAutoTUnref<SkBaseDevice> device(SkGpuDevice::Create(texture->asRenderT
arget())); | 84 SkAutoTUnref<SkBaseDevice> device(SkGpuDevice::Create(texture->asRenderT
arget(), |
| 85 SkSurfaceProps(SkSurfaceProps::kLegacyFont
Host_InitType))); |
| 85 SkCanvas canvas(device); | 86 SkCanvas canvas(device); |
| 86 | 87 |
| 87 SkPaint paint; | 88 SkPaint paint; |
| 88 | 89 |
| 89 const SkRect rect = SkRect::MakeLTRB(-10, -10, X_SIZE + 10, Y_SIZE + 10)
; | 90 const SkRect rect = SkRect::MakeLTRB(-10, -10, X_SIZE + 10, Y_SIZE + 10)
; |
| 90 | 91 |
| 91 paint.setColor(SK_ColorWHITE); | 92 paint.setColor(SK_ColorWHITE); |
| 92 | 93 |
| 93 canvas.drawRect(rect, paint); | 94 canvas.drawRect(rect, paint); |
| 94 | 95 |
| 95 texture->readPixels(0, 0, desc.fWidth, desc.fHeight, desc.fConfig, | 96 texture->readPixels(0, 0, desc.fWidth, desc.fHeight, desc.fConfig, |
| 96 readback, 0); | 97 readback, 0); |
| 97 | 98 |
| 98 match = true; | 99 match = true; |
| 99 | 100 |
| 100 for (int y = 0; y < Y_SIZE; ++y) { | 101 for (int y = 0; y < Y_SIZE; ++y) { |
| 101 for (int x = 0; x < X_SIZE; ++x) { | 102 for (int x = 0; x < X_SIZE; ++x) { |
| 102 if (0xFF != readback[x][y]) { | 103 if (0xFF != readback[x][y]) { |
| 103 match = false; | 104 match = false; |
| 104 } | 105 } |
| 105 } | 106 } |
| 106 } | 107 } |
| 107 | 108 |
| 108 REPORTER_ASSERT(reporter, match); | 109 REPORTER_ASSERT(reporter, match); |
| 109 } | 110 } |
| 110 } | 111 } |
| 111 | 112 |
| 112 #endif | 113 #endif |
| OLD | NEW |