Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(295)

Side by Side Diff: src/gpu/effects/GrTextureDomain.h

Issue 2215323003: Start using RenderTargetProxy (omnibus) (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: update Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/gpu/effects/GrSingleTextureEffect.h ('k') | src/gpu/effects/GrTextureDomain.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #ifndef GrTextureDomainEffect_DEFINED 8 #ifndef GrTextureDomainEffect_DEFINED
9 #define GrTextureDomainEffect_DEFINED 9 #define GrTextureDomainEffect_DEFINED
10 10
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 * @param index Pass a value >= 0 if using multiple texture domains in t he same effect. 53 * @param index Pass a value >= 0 if using multiple texture domains in t he same effect.
54 * It is used to keep inserted variables from causing name collisions. 54 * It is used to keep inserted variables from causing name collisions.
55 */ 55 */
56 GrTextureDomain(const SkRect& domain, Mode, int index = -1); 56 GrTextureDomain(const SkRect& domain, Mode, int index = -1);
57 57
58 const SkRect& domain() const { return fDomain; } 58 const SkRect& domain() const { return fDomain; }
59 Mode mode() const { return fMode; } 59 Mode mode() const { return fMode; }
60 60
61 /* Computes a domain that bounds all the texels in texelRect. Note that with bilerp enabled 61 /* Computes a domain that bounds all the texels in texelRect. Note that with bilerp enabled
62 texels neighboring the domain may be read. */ 62 texels neighboring the domain may be read. */
63 static const SkRect MakeTexelDomain(const GrTexture* texture, const SkIRect& texelRect) { 63 static const SkRect MakeTexelDomain(int width, int height, const SkIRect& te xelRect) {
64 SkScalar wInv = SK_Scalar1 / texture->width(); 64 SkScalar wInv = SK_Scalar1 / width;
65 SkScalar hInv = SK_Scalar1 / texture->height(); 65 SkScalar hInv = SK_Scalar1 / height;
66 SkRect result = { 66 SkRect result = {
67 texelRect.fLeft * wInv, 67 texelRect.fLeft * wInv,
68 texelRect.fTop * hInv, 68 texelRect.fTop * hInv,
69 texelRect.fRight * wInv, 69 texelRect.fRight * wInv,
70 texelRect.fBottom * hInv 70 texelRect.fBottom * hInv
71 }; 71 };
72 return result; 72 return result;
73 } 73 }
74 74
75 static const SkRect MakeTexelDomainForMode(const GrTexture* texture, const S kIRect& texelRect, Mode mode) { 75 static const SkRect MakeTexelDomainForMode(const GrTexture* texture, const S kIRect& texelRect, Mode mode) {
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 class GrTextureDomainEffect : public GrSingleTextureEffect { 166 class GrTextureDomainEffect : public GrSingleTextureEffect {
167 167
168 public: 168 public:
169 static sk_sp<GrFragmentProcessor> Make(GrTexture*, 169 static sk_sp<GrFragmentProcessor> Make(GrTexture*,
170 sk_sp<GrColorSpaceXform>, 170 sk_sp<GrColorSpaceXform>,
171 const SkMatrix&, 171 const SkMatrix&,
172 const SkRect& domain, 172 const SkRect& domain,
173 GrTextureDomain::Mode, 173 GrTextureDomain::Mode,
174 GrTextureParams::FilterMode filterMod e); 174 GrTextureParams::FilterMode filterMod e);
175 175
176 static sk_sp<GrFragmentProcessor> Make(GrTextureProxy*,
177 sk_sp<GrColorSpaceXform>,
178 const SkMatrix&,
179 const SkRect& domain,
180 GrTextureDomain::Mode,
181 GrTextureParams::FilterMode filterMod e);
182
176 const char* name() const override { return "TextureDomain"; } 183 const char* name() const override { return "TextureDomain"; }
177 184
178 SkString dumpInfo() const override { 185 SkString dumpInfo() const override {
179 SkString str; 186 SkString str;
180 str.appendf("Domain: [L: %.2f, T: %.2f, R: %.2f, B: %.2f]", 187 str.appendf("Domain: [L: %.2f, T: %.2f, R: %.2f, B: %.2f]",
181 fTextureDomain.domain().fLeft, fTextureDomain.domain().fTop, 188 fTextureDomain.domain().fLeft, fTextureDomain.domain().fTop,
182 fTextureDomain.domain().fRight, fTextureDomain.domain().fBot tom); 189 fTextureDomain.domain().fRight, fTextureDomain.domain().fBot tom);
183 str.append(INHERITED::dumpInfo()); 190 str.append(INHERITED::dumpInfo());
184 return str; 191 return str;
185 } 192 }
(...skipping 19 matching lines...) Expand all
205 GR_DECLARE_FRAGMENT_PROCESSOR_TEST; 212 GR_DECLARE_FRAGMENT_PROCESSOR_TEST;
206 213
207 typedef GrSingleTextureEffect INHERITED; 214 typedef GrSingleTextureEffect INHERITED;
208 }; 215 };
209 216
210 class GrDeviceSpaceTextureDecalFragmentProcessor : public GrFragmentProcessor { 217 class GrDeviceSpaceTextureDecalFragmentProcessor : public GrFragmentProcessor {
211 public: 218 public:
212 static sk_sp<GrFragmentProcessor> Make(GrTexture*, const SkIRect& subset, 219 static sk_sp<GrFragmentProcessor> Make(GrTexture*, const SkIRect& subset,
213 const SkIPoint& deviceSpaceOffset); 220 const SkIPoint& deviceSpaceOffset);
214 221
222 static sk_sp<GrFragmentProcessor> Make(GrTextureProxy*, const SkIRect& subse t,
223 const SkIPoint& deviceSpaceOffset);
224
215 const char* name() const override { return "GrDeviceSpaceTextureDecalFragmen tProcessor"; } 225 const char* name() const override { return "GrDeviceSpaceTextureDecalFragmen tProcessor"; }
216 226
217 SkString dumpInfo() const override { 227 SkString dumpInfo() const override {
218 SkString str; 228 SkString str;
219 str.appendf("Domain: [L: %.2f, T: %.2f, R: %.2f, B: %.2f] Offset: [%d %d ]", 229 str.appendf("Domain: [L: %.2f, T: %.2f, R: %.2f, B: %.2f] Offset: [%d %d ]",
220 fTextureDomain.domain().fLeft, fTextureDomain.domain().fTop, 230 fTextureDomain.domain().fLeft, fTextureDomain.domain().fTop,
221 fTextureDomain.domain().fRight, fTextureDomain.domain().fBot tom, 231 fTextureDomain.domain().fRight, fTextureDomain.domain().fBot tom,
222 fDeviceSpaceOffset.fX, fDeviceSpaceOffset.fY); 232 fDeviceSpaceOffset.fX, fDeviceSpaceOffset.fY);
223 str.append(INHERITED::dumpInfo()); 233 str.append(INHERITED::dumpInfo());
224 return str; 234 return str;
(...skipping 12 matching lines...) Expand all
237 void onGetGLSLProcessorKey(const GrGLSLCaps&, GrProcessorKeyBuilder*) const override {} 247 void onGetGLSLProcessorKey(const GrGLSLCaps&, GrProcessorKeyBuilder*) const override {}
238 248
239 bool onIsEqual(const GrFragmentProcessor& fp) const override; 249 bool onIsEqual(const GrFragmentProcessor& fp) const override;
240 void onComputeInvariantOutput(GrInvariantOutput* inout) const override; 250 void onComputeInvariantOutput(GrInvariantOutput* inout) const override;
241 251
242 GR_DECLARE_FRAGMENT_PROCESSOR_TEST; 252 GR_DECLARE_FRAGMENT_PROCESSOR_TEST;
243 253
244 typedef GrFragmentProcessor INHERITED; 254 typedef GrFragmentProcessor INHERITED;
245 }; 255 };
246 #endif 256 #endif
OLDNEW
« no previous file with comments | « src/gpu/effects/GrSingleTextureEffect.h ('k') | src/gpu/effects/GrTextureDomain.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698