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

Unified Diff: src/gpu/effects/GrTextureDomain.h

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, 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/effects/GrMatrixConvolutionEffect.cpp ('k') | src/gpu/effects/GrTextureDomain.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/effects/GrTextureDomain.h
diff --git a/src/gpu/effects/GrTextureDomain.h b/src/gpu/effects/GrTextureDomain.h
index 7efd9f2dee1850d1d054582be3e577b9df5ff829..6a462f96a8c77bdbce1396783679fb92122d3a17 100644
--- a/src/gpu/effects/GrTextureDomain.h
+++ b/src/gpu/effects/GrTextureDomain.h
@@ -69,6 +69,19 @@ public:
return result;
}
+ static const SkRect MakeTexelDomainForMode(const GrTexture* texture, const SkIRect& texelRect, Mode mode) {
+ // For Clamp mode, inset by half a texel.
+ SkScalar wInv = SK_Scalar1 / texture->width();
+ SkScalar hInv = SK_Scalar1 / texture->height();
+ SkScalar inset = (mode == kClamp_Mode && !texelRect.isEmpty()) ? SK_ScalarHalf : 0;
+ return SkRect::MakeLTRB(
+ (texelRect.fLeft + inset) * wInv,
+ (texelRect.fTop + inset) * hInv,
+ (texelRect.fRight - inset) * wInv,
+ (texelRect.fBottom - inset) * hInv
+ );
+ }
+
bool operator== (const GrTextureDomain& that) const {
return fMode == that.fMode && (kIgnore_Mode == fMode || fDomain == that.fDomain);
}
« 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