| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2014 Google Inc. | 3 * Copyright 2014 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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 } | 98 } |
| 99 | 99 |
| 100 SkTArray<SkMatrix> textureMatrices; | 100 SkTArray<SkMatrix> textureMatrices; |
| 101 textureMatrices.push_back().setIDiv(texture->width(), texture->height())
; | 101 textureMatrices.push_back().setIDiv(texture->width(), texture->height())
; |
| 102 textureMatrices.push_back() = textureMatrices[0]; | 102 textureMatrices.push_back() = textureMatrices[0]; |
| 103 textureMatrices.back().postScale(1.5f, 0.85f); | 103 textureMatrices.back().postScale(1.5f, 0.85f); |
| 104 textureMatrices.push_back() = textureMatrices[0]; | 104 textureMatrices.push_back() = textureMatrices[0]; |
| 105 textureMatrices.back().preRotate(45.f, texture->width() / 2.f, texture->
height() / 2.f); | 105 textureMatrices.back().preRotate(45.f, texture->width() / 2.f, texture->
height() / 2.f); |
| 106 | 106 |
| 107 const SkIRect texelDomains[] = { | 107 const SkIRect texelDomains[] = { |
| 108 SkIRect::MakeWH(fBmp.width(), fBmp.height()), | 108 fBmp.bounds(), |
| 109 SkIRect::MakeXYWH(fBmp.width() / 4, | 109 SkIRect::MakeXYWH(fBmp.width() / 4, |
| 110 fBmp.height() / 4, | 110 fBmp.height() / 4, |
| 111 fBmp.width() / 2, | 111 fBmp.width() / 2, |
| 112 fBmp.height() / 2), | 112 fBmp.height() / 2), |
| 113 }; | 113 }; |
| 114 | 114 |
| 115 SkRect renderRect = SkRect::MakeWH(SkIntToScalar(fBmp.width()), | 115 SkRect renderRect = SkRect::Make(fBmp.bounds()); |
| 116 SkIntToScalar(fBmp.height())); | |
| 117 renderRect.outset(kDrawPad, kDrawPad); | 116 renderRect.outset(kDrawPad, kDrawPad); |
| 118 | 117 |
| 119 SkScalar y = kDrawPad + kTestPad; | 118 SkScalar y = kDrawPad + kTestPad; |
| 120 for (int tm = 0; tm < textureMatrices.count(); ++tm) { | 119 for (int tm = 0; tm < textureMatrices.count(); ++tm) { |
| 121 for (size_t d = 0; d < SK_ARRAY_COUNT(texelDomains); ++d) { | 120 for (size_t d = 0; d < SK_ARRAY_COUNT(texelDomains); ++d) { |
| 122 SkScalar x = kDrawPad + kTestPad; | 121 SkScalar x = kDrawPad + kTestPad; |
| 123 for (int m = 0; m < GrTextureDomain::kModeCount; ++m) { | 122 for (int m = 0; m < GrTextureDomain::kModeCount; ++m) { |
| 124 GrTextureDomain::Mode mode = (GrTextureDomain::Mode) m; | 123 GrTextureDomain::Mode mode = (GrTextureDomain::Mode) m; |
| 125 SkAutoTUnref<GrFragmentProcessor> fp( | 124 SkAutoTUnref<GrFragmentProcessor> fp( |
| 126 GrTextureDomainEffect::Create(texture, textureMatrices[t
m], | 125 GrTextureDomainEffect::Create(texture, textureMatrices[t
m], |
| (...skipping 30 matching lines...) Expand all Loading... |
| 157 }; | 156 }; |
| 158 | 157 |
| 159 // Windows builds did not like SkScalar initialization in class :( | 158 // Windows builds did not like SkScalar initialization in class :( |
| 160 const SkScalar TextureDomainEffect::kDrawPad = 10.f; | 159 const SkScalar TextureDomainEffect::kDrawPad = 10.f; |
| 161 const SkScalar TextureDomainEffect::kTestPad = 10.f; | 160 const SkScalar TextureDomainEffect::kTestPad = 10.f; |
| 162 | 161 |
| 163 DEF_GM( return SkNEW(TextureDomainEffect); ) | 162 DEF_GM( return SkNEW(TextureDomainEffect); ) |
| 164 } | 163 } |
| 165 | 164 |
| 166 #endif | 165 #endif |
| OLD | NEW |