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

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

Issue 208313017: Add GM that tests GrTextureDomain and fix bug where kDecal_Mode gets incorrectly ignored. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Address comments and use gradients to init texture rather than noise. Created 6 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « gyp/gmslides.gypi ('k') | no next file » | 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 #include "GrTextureDomain.h" 8 #include "GrTextureDomain.h"
9 #include "GrSimpleTextureEffect.h" 9 #include "GrSimpleTextureEffect.h"
10 #include "GrTBackendEffectFactory.h" 10 #include "GrTBackendEffectFactory.h"
11 #include "gl/GrGLEffect.h" 11 #include "gl/GrGLEffect.h"
12 #include "SkFloatingPoint.h" 12 #include "SkFloatingPoint.h"
13 13
14 14
15 GrTextureDomain::GrTextureDomain(const SkRect& domain, Mode mode, int index) 15 GrTextureDomain::GrTextureDomain(const SkRect& domain, Mode mode, int index)
16 : fIndex(index) { 16 : fIndex(index) {
17 17
18 static const SkRect kFullRect = {0, 0, SK_Scalar1, SK_Scalar1}; 18 static const SkRect kFullRect = {0, 0, SK_Scalar1, SK_Scalar1};
19 if (domain.contains(kFullRect)) { 19 if (domain.contains(kFullRect) && kClamp_Mode == mode) {
20 fMode = kIgnore_Mode; 20 fMode = kIgnore_Mode;
21 } else { 21 } else {
22 fMode = mode; 22 fMode = mode;
23 } 23 }
24 24
25 if (fMode != kIgnore_Mode) { 25 if (fMode != kIgnore_Mode) {
26 // We don't currently handle domains that are empty or don't intersect t he texture. 26 // We don't currently handle domains that are empty or don't intersect t he texture.
27 // It is OK if the domain rect is a line or point, but it should not be inverted. We do not 27 // It is OK if the domain rect is a line or point, but it should not be inverted. We do not
28 // handle rects that do not intersect the [0..1]x[0..1] rect. 28 // handle rects that do not intersect the [0..1]x[0..1] rect.
29 SkASSERT(domain.fLeft <= domain.fRight); 29 SkASSERT(domain.fLeft <= domain.fRight);
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 const SkMatrix& matrix = GrEffectUnitTest::TestMatrix(random); 271 const SkMatrix& matrix = GrEffectUnitTest::TestMatrix(random);
272 bool bilerp = random->nextBool(); 272 bool bilerp = random->nextBool();
273 GrCoordSet coords = random->nextBool() ? kLocal_GrCoordSet : kPosition_GrCoo rdSet; 273 GrCoordSet coords = random->nextBool() ? kLocal_GrCoordSet : kPosition_GrCoo rdSet;
274 return GrTextureDomainEffect::Create(textures[texIdx], 274 return GrTextureDomainEffect::Create(textures[texIdx],
275 matrix, 275 matrix,
276 domain, 276 domain,
277 mode, 277 mode,
278 bilerp ? GrTextureParams::kBilerp_Filte rMode : GrTextureParams::kNone_FilterMode, 278 bilerp ? GrTextureParams::kBilerp_Filte rMode : GrTextureParams::kNone_FilterMode,
279 coords); 279 coords);
280 } 280 }
OLDNEW
« no previous file with comments | « gyp/gmslides.gypi ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698