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

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

Issue 1057693002: Revert of Implement approx-match support in image filter saveLayer() offscreen. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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/GrMatrixConvolutionEffect.cpp ('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 #ifndef GrTextureDomainEffect_DEFINED 8 #ifndef GrTextureDomainEffect_DEFINED
9 #define GrTextureDomainEffect_DEFINED 9 #define GrTextureDomainEffect_DEFINED
10 10
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 SkScalar hInv = SK_Scalar1 / texture->height(); 62 SkScalar hInv = SK_Scalar1 / texture->height();
63 SkRect result = { 63 SkRect result = {
64 texelRect.fLeft * wInv, 64 texelRect.fLeft * wInv,
65 texelRect.fTop * hInv, 65 texelRect.fTop * hInv,
66 texelRect.fRight * wInv, 66 texelRect.fRight * wInv,
67 texelRect.fBottom * hInv 67 texelRect.fBottom * hInv
68 }; 68 };
69 return result; 69 return result;
70 } 70 }
71 71
72 static const SkRect MakeTexelDomainForMode(const GrTexture* texture, const S kIRect& texelRect, Mode mode) {
73 // For Clamp mode, inset by half a texel.
74 SkScalar wInv = SK_Scalar1 / texture->width();
75 SkScalar hInv = SK_Scalar1 / texture->height();
76 SkScalar inset = mode == kClamp_Mode ? SK_ScalarHalf : 0;
77 return SkRect::MakeLTRB(
78 (texelRect.fLeft + inset) * wInv,
79 (texelRect.fTop + inset) * hInv,
80 (texelRect.fRight - inset) * wInv,
81 (texelRect.fBottom - inset) * hInv
82 );
83 }
84
85 bool operator== (const GrTextureDomain& that) const { 72 bool operator== (const GrTextureDomain& that) const {
86 return fMode == that.fMode && (kIgnore_Mode == fMode || fDomain == that. fDomain); 73 return fMode == that.fMode && (kIgnore_Mode == fMode || fDomain == that. fDomain);
87 } 74 }
88 75
89 /** 76 /**
90 * A GrGLProcessor subclass that corresponds to a GrProcessor subclass that uses GrTextureDomain 77 * A GrGLProcessor subclass that corresponds to a GrProcessor subclass that uses GrTextureDomain
91 * should include this helper. It generates the texture domain GLSL, produce s the part of the 78 * should include this helper. It generates the texture domain GLSL, produce s the part of the
92 * effect key that reflects the texture domain code, and performs the unifor m uploads necessary 79 * effect key that reflects the texture domain code, and performs the unifor m uploads necessary
93 * for texture domains. 80 * for texture domains.
94 */ 81 */
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 bool onIsEqual(const GrFragmentProcessor&) const override; 175 bool onIsEqual(const GrFragmentProcessor&) const override;
189 176
190 void onComputeInvariantOutput(GrInvariantOutput* inout) const override; 177 void onComputeInvariantOutput(GrInvariantOutput* inout) const override;
191 178
192 GR_DECLARE_FRAGMENT_PROCESSOR_TEST; 179 GR_DECLARE_FRAGMENT_PROCESSOR_TEST;
193 180
194 typedef GrSingleTextureEffect INHERITED; 181 typedef GrSingleTextureEffect INHERITED;
195 }; 182 };
196 183
197 #endif 184 #endif
OLDNEW
« no previous file with comments | « src/gpu/effects/GrMatrixConvolutionEffect.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698