aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar senorblanco@chromium.org <senorblanco@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2011-07-18 21:48:35 +0000
committerGravatar senorblanco@chromium.org <senorblanco@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2011-07-18 21:48:35 +0000
commit4a947d264b2764685e5f82b2e5d328a50e9612ea (patch)
tree2e2b1e98a12007bb1d9957621868409c671582be
parentef427d47128ef03c28a4d38d3f91d0d5a11115bb (diff)
Fix kernel width calculation in GPU-based Gaussian blur. When converting the
sigma value to a kernel width, it should be rounded up. Otherwise, for small sigmas, the edge pixels of the kernel may be missing. git-svn-id: http://skia.googlecode.com/svn/trunk@1891 2bbb7eff-a529-9590-31e7-b0007b416f81
-rw-r--r--samplecode/SampleBigBlur.cpp2
-rw-r--r--src/gpu/SkGpuDevice.cpp2
2 files changed, 2 insertions, 2 deletions
diff --git a/samplecode/SampleBigBlur.cpp b/samplecode/SampleBigBlur.cpp
index 243e0dfd71..aa5dc2824d 100644
--- a/samplecode/SampleBigBlur.cpp
+++ b/samplecode/SampleBigBlur.cpp
@@ -28,7 +28,7 @@ protected:
SkBlurMaskFilter::kHighQuality_BlurFlag);
paint.setMaskFilter(mf)->unref();
canvas->translate(200, 200);
- canvas->drawCircle(100, 100, 250, paint);
+ canvas->drawCircle(100, 100, 200, paint);
canvas->restore();
}
diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp
index 513b5bbdc9..90ab4bbbd9 100644
--- a/src/gpu/SkGpuDevice.cpp
+++ b/src/gpu/SkGpuDevice.cpp
@@ -865,7 +865,7 @@ static bool drawWithGPUMaskFilter(GrContext* context, const SkPath& path,
sigma *= 0.5f;
}
scaleRect(&srcRect, 1.0f / scaleFactor);
- int halfWidth = static_cast<int>(sigma * 3.0f);
+ int halfWidth = static_cast<int>(ceilf(sigma * 3.0f));
int kernelWidth = halfWidth * 2 + 1;
SkIRect srcIRect;