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

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

Issue 422123003: Adding repeat mode to texture domain (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: feedback inc Created 6 years, 4 months 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/GrMatrixConvolutionEffect.cpp ('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
11 #include "GrSingleTextureEffect.h" 11 #include "GrSingleTextureEffect.h"
12 #include "gl/GrGLEffect.h" 12 #include "gl/GrGLEffect.h"
13 13
14 class GrGLShaderBuilder; 14 class GrGLShaderBuilder;
15 struct SkRect; 15 struct SkRect;
16 16
17 /** 17 /**
18 * Limits a texture's lookup coordinates to a domain. Samples outside the domain are either clamped 18 * Limits a texture's lookup coordinates to a domain. Samples outside the domain are either clamped
19 * the edge of the domain or result in a vec4 of zeros (decal mode). The domain is clipped to 19 * the edge of the domain or result in a vec4 of zeros (decal mode). The domain is clipped to
20 * normalized texture coords ([0,1]x[0,1] square). Bilinear filtering can cause texels outside the 20 * normalized texture coords ([0,1]x[0,1] square). Bilinear filtering can cause texels outside the
21 * domain to affect the read value unless the caller considers this when calcula ting the domain. 21 * domain to affect the read value unless the caller considers this when calcula ting the domain.
22 */ 22 */
23 class GrTextureDomain { 23 class GrTextureDomain {
24 public: 24 public:
25 enum Mode { 25 enum Mode {
26 kIgnore_Mode, // Ignore the texture domain rectangle. 26 // Ignore the texture domain rectangle.
27 kClamp_Mode, // Clamp texture coords to the domain rectangle. 27 kIgnore_Mode,
28 kDecal_Mode, // Treat the area outside the domain rectangle as fully t ransparent. 28 // Clamp texture coords to the domain rectangle.
29 kClamp_Mode,
30 // Treat the area outside the domain rectangle as fully transparent.
31 kDecal_Mode,
32 // Wrap texture coordinates. NOTE: filtering may not work as expected b ecause Bilerp will
33 // read texels outside of the domain. We could perform additional textu re reads and filter
34 // in the shader, but are not currently doing this for performance reaso ns
35 kRepeat_Mode,
29 36
30 kLastMode = kDecal_Mode 37 kLastMode = kRepeat_Mode
31 }; 38 };
32 static const int kModeCount = kLastMode + 1; 39 static const int kModeCount = kLastMode + 1;
33 40
34 static const GrTextureDomain& IgnoredDomain() { 41 static const GrTextureDomain& IgnoredDomain() {
35 static const SkRect gDummyRect = {0, 0, 0, 0}; 42 static const SkRect gDummyRect = {0, 0, 0, 0};
36 static const GrTextureDomain gDomain(gDummyRect, kIgnore_Mode); 43 static const GrTextureDomain gDomain(gDummyRect, kIgnore_Mode);
37 return gDomain; 44 return gDomain;
38 } 45 }
39 46
40 /** 47 /**
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 GrCoordSet); 173 GrCoordSet);
167 174
168 virtual bool onIsEqual(const GrEffect&) const SK_OVERRIDE; 175 virtual bool onIsEqual(const GrEffect&) const SK_OVERRIDE;
169 176
170 GR_DECLARE_EFFECT_TEST; 177 GR_DECLARE_EFFECT_TEST;
171 178
172 typedef GrSingleTextureEffect INHERITED; 179 typedef GrSingleTextureEffect INHERITED;
173 }; 180 };
174 181
175 #endif 182 #endif
OLDNEW
« no previous file with comments | « src/gpu/effects/GrMatrixConvolutionEffect.cpp ('k') | src/gpu/effects/GrTextureDomain.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698