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