OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 SkScalar y = kDrawPad + kTestPad; | 110 SkScalar y = kDrawPad + kTestPad; |
111 for (int tm = 0; tm < textureMatrices.count(); ++tm) { | 111 for (int tm = 0; tm < textureMatrices.count(); ++tm) { |
112 for (size_t d = 0; d < SK_ARRAY_COUNT(texelDomains); ++d) { | 112 for (size_t d = 0; d < SK_ARRAY_COUNT(texelDomains); ++d) { |
113 SkScalar x = kDrawPad + kTestPad; | 113 SkScalar x = kDrawPad + kTestPad; |
114 for (int m = 0; m < GrTextureDomain::kModeCount; ++m) { | 114 for (int m = 0; m < GrTextureDomain::kModeCount; ++m) { |
115 GrTextureDomain::Mode mode = (GrTextureDomain::Mode) m; | 115 GrTextureDomain::Mode mode = (GrTextureDomain::Mode) m; |
116 GrPaint grPaint; | 116 GrPaint grPaint; |
117 grPaint.setXPFactory(GrPorterDuffXPFactory::Make(SkBlendMode
::kSrc)); | 117 grPaint.setXPFactory(GrPorterDuffXPFactory::Make(SkBlendMode
::kSrc)); |
118 sk_sp<GrFragmentProcessor> fp( | 118 sk_sp<GrFragmentProcessor> fp( |
119 GrTextureDomainEffect::Make(texture.get(), nullptr, text
ureMatrices[tm], | 119 GrTextureDomainEffect::Make(texture.get(), nullptr, text
ureMatrices[tm], |
120 GrTextureDomain::MakeTexelDomain
(texture.get(), | 120 GrTextureDomain::MakeTexelDomain
(texture->width(), |
| 121
texture->height(), |
121
texelDomains[d]), | 122
texelDomains[d]), |
122 mode, GrTextureParams::kNone_Fil
terMode)); | 123 mode, GrTextureParams::kNone_Fil
terMode)); |
123 | 124 |
124 if (!fp) { | 125 if (!fp) { |
125 continue; | 126 continue; |
126 } | 127 } |
127 const SkMatrix viewMatrix = SkMatrix::MakeTrans(x, y); | 128 const SkMatrix viewMatrix = SkMatrix::MakeTrans(x, y); |
128 grPaint.addColorFragmentProcessor(std::move(fp)); | 129 grPaint.addColorFragmentProcessor(std::move(fp)); |
129 | 130 |
130 sk_sp<GrDrawBatch> batch( | 131 sk_sp<GrDrawBatch> batch( |
(...skipping 14 matching lines...) Expand all Loading... |
145 static constexpr int kTargetHeight = 100; | 146 static constexpr int kTargetHeight = 100; |
146 SkBitmap fBmp; | 147 SkBitmap fBmp; |
147 | 148 |
148 typedef GM INHERITED; | 149 typedef GM INHERITED; |
149 }; | 150 }; |
150 | 151 |
151 DEF_GM(return new TextureDomainEffect;) | 152 DEF_GM(return new TextureDomainEffect;) |
152 } | 153 } |
153 | 154 |
154 #endif | 155 #endif |
OLD | NEW |