OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 only works with the GPU backend. | 8 // This test only works with the GPU backend. |
9 | 9 |
10 #include "gm.h" | 10 #include "gm.h" |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 if (i) { | 91 if (i) { |
92 vm.setRotate(90 * SK_Scalar1, | 92 vm.setRotate(90 * SK_Scalar1, |
93 S * SK_Scalar1, | 93 S * SK_Scalar1, |
94 S * SK_Scalar1); | 94 S * SK_Scalar1); |
95 } else { | 95 } else { |
96 vm.reset(); | 96 vm.reset(); |
97 } | 97 } |
98 SkMatrix tm; | 98 SkMatrix tm; |
99 tm = vm; | 99 tm = vm; |
100 tm.postIDiv(2*S, 2*S); | 100 tm.postIDiv(2*S, 2*S); |
101 paint.addColorTextureProcessor(texture, tm); | 101 paint.addColorTextureProcessor(texture, nullptr, tm); |
102 | 102 |
103 drawContext->drawRect(clip, paint, vm, SkRect::MakeWH(2*S, 2*S)); | 103 drawContext->drawRect(clip, paint, vm, SkRect::MakeWH(2*S, 2*S)); |
104 | 104 |
105 // now update the lower right of the texture in first pass | 105 // now update the lower right of the texture in first pass |
106 // or upper right in second pass | 106 // or upper right in second pass |
107 offset = 0; | 107 offset = 0; |
108 for (int y = 0; y < S; ++y) { | 108 for (int y = 0; y < S; ++y) { |
109 for (int x = 0; x < S; ++x) { | 109 for (int x = 0; x < S; ++x) { |
110 gTextureData[offset + y * stride + x] = | 110 gTextureData[offset + y * stride + x] = |
111 ((x + y) % 2) ? (i ? green : red) : blue; | 111 ((x + y) % 2) ? (i ? green : red) : blue; |
112 } | 112 } |
113 } | 113 } |
114 texture->writePixels(S, (i ? 0 : S), S, S, | 114 texture->writePixels(S, (i ? 0 : S), S, S, |
115 texture->config(), gTextureData.get(), | 115 texture->config(), gTextureData.get(), |
116 4 * stride); | 116 4 * stride); |
117 drawContext->drawRect(clip, paint, vm, SkRect::MakeWH(2*S, 2*S)); | 117 drawContext->drawRect(clip, paint, vm, SkRect::MakeWH(2*S, 2*S)); |
118 } | 118 } |
119 } | 119 } |
120 #endif | 120 #endif |
121 | 121 |
OLD | NEW |