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))); | |
86 SkCanvas canvas(device); | 85 SkCanvas canvas(device); |
87 | 86 |
88 SkPaint paint; | 87 SkPaint paint; |
89 | 88 |
90 const SkRect rect = SkRect::MakeLTRB(-10, -10, X_SIZE + 10, Y_SIZE + 10)
; | 89 const SkRect rect = SkRect::MakeLTRB(-10, -10, X_SIZE + 10, Y_SIZE + 10)
; |
91 | 90 |
92 paint.setColor(SK_ColorWHITE); | 91 paint.setColor(SK_ColorWHITE); |
93 | 92 |
94 canvas.drawRect(rect, paint); | 93 canvas.drawRect(rect, paint); |
95 | 94 |
96 texture->readPixels(0, 0, desc.fWidth, desc.fHeight, desc.fConfig, | 95 texture->readPixels(0, 0, desc.fWidth, desc.fHeight, desc.fConfig, |
97 readback, 0); | 96 readback, 0); |
98 | 97 |
99 match = true; | 98 match = true; |
100 | 99 |
101 for (int y = 0; y < Y_SIZE; ++y) { | 100 for (int y = 0; y < Y_SIZE; ++y) { |
102 for (int x = 0; x < X_SIZE; ++x) { | 101 for (int x = 0; x < X_SIZE; ++x) { |
103 if (0xFF != readback[x][y]) { | 102 if (0xFF != readback[x][y]) { |
104 match = false; | 103 match = false; |
105 } | 104 } |
106 } | 105 } |
107 } | 106 } |
108 | 107 |
109 REPORTER_ASSERT(reporter, match); | 108 REPORTER_ASSERT(reporter, match); |
110 } | 109 } |
111 } | 110 } |
112 | 111 |
113 #endif | 112 #endif |
OLD | NEW |