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

Unified Diff: src/effects/SkGpuBlurUtils.cpp

Issue 20789003: Small optimization for convolution shader: only apply the bounds check in (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Make direction() context Created 7 years, 5 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 | « no previous file | src/gpu/effects/GrConvolutionEffect.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/effects/SkGpuBlurUtils.cpp
diff --git a/src/effects/SkGpuBlurUtils.cpp b/src/effects/SkGpuBlurUtils.cpp
index 076923735366c68ca4ebb9d22d60071d9f81f392..28ccd4589b327712169647bb6933dc1217299db8 100644
--- a/src/effects/SkGpuBlurUtils.cpp
+++ b/src/effects/SkGpuBlurUtils.cpp
@@ -49,14 +49,14 @@ static void convolve_gaussian(GrContext* context,
Gr1DKernelEffect::Direction direction) {
GrPaint paint;
paint.reset();
- float cropRect[4] = { 0.0f, 1.0f, 0.0f, 1.0f };
+ float bounds[2] = { 0.0f, 1.0f };
if (cropToSrcRect) {
if (direction == Gr1DKernelEffect::kX_Direction) {
- cropRect[0] = SkScalarToFloat(srcRect.left()) / texture->width();
- cropRect[1] = SkScalarToFloat(srcRect.right()) / texture->width();
+ bounds[0] = SkScalarToFloat(srcRect.left()) / texture->width();
+ bounds[1] = SkScalarToFloat(srcRect.right()) / texture->width();
} else {
- cropRect[2] = SkScalarToFloat(srcRect.top()) / texture->height();
- cropRect[3] = SkScalarToFloat(srcRect.bottom()) / texture->height();
+ bounds[0] = SkScalarToFloat(srcRect.top()) / texture->height();
+ bounds[1] = SkScalarToFloat(srcRect.bottom()) / texture->height();
}
}
@@ -65,7 +65,7 @@ static void convolve_gaussian(GrContext* context,
radius,
sigma,
cropToSrcRect,
- cropRect));
+ bounds));
paint.addColorEffect(conv);
context->drawRectToRect(paint, dstRect, srcRect);
}
« no previous file with comments | « no previous file | src/gpu/effects/GrConvolutionEffect.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698