| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 Google Inc. |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 // This test only works with the GPU backend. | 9 // This test only works with the GPU backend. |
| 10 | 10 |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 paint.setPorterDuffXPFactory(SkXfermode::kSrcOver_Mode); | 102 paint.setPorterDuffXPFactory(SkXfermode::kSrcOver_Mode); |
| 103 | 103 |
| 104 SkMatrix vm; | 104 SkMatrix vm; |
| 105 if (i) { | 105 if (i) { |
| 106 vm.setRotate(90 * SK_Scalar1, | 106 vm.setRotate(90 * SK_Scalar1, |
| 107 S * SK_Scalar1, | 107 S * SK_Scalar1, |
| 108 S * SK_Scalar1); | 108 S * SK_Scalar1); |
| 109 } else { | 109 } else { |
| 110 vm.reset(); | 110 vm.reset(); |
| 111 } | 111 } |
| 112 ctx->setMatrix(vm); | |
| 113 SkMatrix tm; | 112 SkMatrix tm; |
| 114 tm = vm; | 113 tm = vm; |
| 115 tm.postIDiv(2*S, 2*S); | 114 tm.postIDiv(2*S, 2*S); |
| 116 paint.addColorTextureProcessor(texture, tm); | 115 paint.addColorTextureProcessor(texture, tm); |
| 117 | 116 |
| 118 ctx->drawRect(paint, SkRect::MakeWH(2*S, 2*S)); | 117 ctx->drawRect(paint, vm, SkRect::MakeWH(2*S, 2*S)); |
| 119 | 118 |
| 120 // now update the lower right of the texture in first pass | 119 // now update the lower right of the texture in first pass |
| 121 // or upper right in second pass | 120 // or upper right in second pass |
| 122 offset = 0; | 121 offset = 0; |
| 123 for (int y = 0; y < S; ++y) { | 122 for (int y = 0; y < S; ++y) { |
| 124 for (int x = 0; x < S; ++x) { | 123 for (int x = 0; x < S; ++x) { |
| 125 gTextureData[offset + y * stride + x] = | 124 gTextureData[offset + y * stride + x] = |
| 126 ((x + y) % 2) ? (i ? green : red) : blue; | 125 ((x + y) % 2) ? (i ? green : red) : blue; |
| 127 } | 126 } |
| 128 } | 127 } |
| 129 texture->writePixels(S, (i ? 0 : S), S, S, | 128 texture->writePixels(S, (i ? 0 : S), S, S, |
| 130 texture->config(), gTextureData.get(), | 129 texture->config(), gTextureData.get(), |
| 131 4 * stride); | 130 4 * stride); |
| 132 ctx->drawRect(paint, SkRect::MakeWH(2*S, 2*S)); | 131 ctx->drawRect(paint, vm, SkRect::MakeWH(2*S, 2*S)); |
| 133 } | 132 } |
| 134 } | 133 } |
| 135 } | 134 } |
| 136 | 135 |
| 137 private: | 136 private: |
| 138 typedef GM INHERITED; | 137 typedef GM INHERITED; |
| 139 }; | 138 }; |
| 140 | 139 |
| 141 ////////////////////////////////////////////////////////////////////////////// | 140 ////////////////////////////////////////////////////////////////////////////// |
| 142 | 141 |
| 143 static GM* MyFactory(void*) { return new TexDataGM; } | 142 static GM* MyFactory(void*) { return new TexDataGM; } |
| 144 static GMRegistry reg(MyFactory); | 143 static GMRegistry reg(MyFactory); |
| 145 | 144 |
| 146 } | 145 } |
| 147 | 146 |
| 148 #endif | 147 #endif |
| OLD | NEW |