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

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

Issue 1034733002: Implement approx-match support in image filter saveLayer() offscreen. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix empty/out-of-range rects in GrTextureDomain Clamp mode Created 5 years, 8 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/GrTextureDomain.h ('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 "GrInvariantOutput.h" 9 #include "GrInvariantOutput.h"
10 #include "GrSimpleTextureEffect.h" 10 #include "GrSimpleTextureEffect.h"
(...skipping 10 matching lines...) Expand all
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);
30 SkASSERT(domain.fTop <= domain.fBottom); 30 SkASSERT(domain.fTop <= domain.fBottom);
31 fDomain.fLeft = SkMaxScalar(domain.fLeft, kFullRect.fLeft); 31 fDomain.fLeft = SkScalarPin(domain.fLeft, kFullRect.fLeft, kFullRect.fRi ght);
32 fDomain.fRight = SkMinScalar(domain.fRight, kFullRect.fRight); 32 fDomain.fRight = SkScalarPin(domain.fRight, kFullRect.fLeft, kFullRect.f Right);
33 fDomain.fTop = SkMaxScalar(domain.fTop, kFullRect.fTop); 33 fDomain.fTop = SkScalarPin(domain.fTop, kFullRect.fTop, kFullRect.fBotto m);
34 fDomain.fBottom = SkMinScalar(domain.fBottom, kFullRect.fBottom); 34 fDomain.fBottom = SkScalarPin(domain.fBottom, kFullRect.fTop, kFullRect. fBottom);
35 SkASSERT(fDomain.fLeft <= fDomain.fRight); 35 SkASSERT(fDomain.fLeft <= fDomain.fRight);
36 SkASSERT(fDomain.fTop <= fDomain.fBottom); 36 SkASSERT(fDomain.fTop <= fDomain.fBottom);
37 } 37 }
38 } 38 }
39 39
40 ////////////////////////////////////////////////////////////////////////////// 40 //////////////////////////////////////////////////////////////////////////////
41 41
42 void GrTextureDomain::GLDomain::sampleTexture(GrGLShaderBuilder* builder, 42 void GrTextureDomain::GLDomain::sampleTexture(GrGLShaderBuilder* builder,
43 const GrTextureDomain& textureDoma in, 43 const GrTextureDomain& textureDoma in,
44 const char* outColor, 44 const char* outColor,
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
302 const SkMatrix& matrix = GrProcessorUnitTest::TestMatrix(random); 302 const SkMatrix& matrix = GrProcessorUnitTest::TestMatrix(random);
303 bool bilerp = mode != GrTextureDomain::kRepeat_Mode ? random->nextBool() : f alse; 303 bool bilerp = mode != GrTextureDomain::kRepeat_Mode ? random->nextBool() : f alse;
304 GrCoordSet coords = random->nextBool() ? kLocal_GrCoordSet : kDevice_GrCoord Set; 304 GrCoordSet coords = random->nextBool() ? kLocal_GrCoordSet : kDevice_GrCoord Set;
305 return GrTextureDomainEffect::Create(textures[texIdx], 305 return GrTextureDomainEffect::Create(textures[texIdx],
306 matrix, 306 matrix,
307 domain, 307 domain,
308 mode, 308 mode,
309 bilerp ? GrTextureParams::kBilerp_Filte rMode : GrTextureParams::kNone_FilterMode, 309 bilerp ? GrTextureParams::kBilerp_Filte rMode : GrTextureParams::kNone_FilterMode,
310 coords); 310 coords);
311 } 311 }
OLDNEW
« no previous file with comments | « src/gpu/effects/GrTextureDomain.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698