aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--src/effects/SkRectShaderImageFilter.cpp3
-rw-r--r--tests/ShaderImageFilterTest.cpp7
2 files changed, 6 insertions, 4 deletions
diff --git a/src/effects/SkRectShaderImageFilter.cpp b/src/effects/SkRectShaderImageFilter.cpp
index b6c78efd0f..eb5af2097c 100644
--- a/src/effects/SkRectShaderImageFilter.cpp
+++ b/src/effects/SkRectShaderImageFilter.cpp
@@ -47,7 +47,8 @@ bool SkRectShaderImageFilter::onFilterImage(Proxy* proxy,
const SkMatrix& matrix,
SkBitmap* result,
SkIPoint* loc) {
- SkAutoTUnref<SkDevice> device(proxy->createDevice(fRegion.width(), fRegion.height()));
+ SkAutoTUnref<SkDevice> device(proxy->createDevice(SkScalarCeilToInt(fRegion.width()),
+ SkScalarCeilToInt(fRegion.height())));
SkCanvas canvas(device.get());
SkPaint paint;
paint.setShader(fShader);
diff --git a/tests/ShaderImageFilterTest.cpp b/tests/ShaderImageFilterTest.cpp
index 934e8c23e6..78aa796caa 100644
--- a/tests/ShaderImageFilterTest.cpp
+++ b/tests/ShaderImageFilterTest.cpp
@@ -12,16 +12,17 @@
#include "SkGradientShader.h"
static void test_asShaderMode(skiatest::Reporter* reporter) {
- SkRect r = SkRect::MakeWH(10, 10); // Make small 10x10 gradient
+ int w = 10, h = 10;
+ SkRect r = SkRect::MakeWH(SkIntToScalar(w), SkIntToScalar(h)); // Make small 10x10 gradient
SkBitmap filterResult, shaderResult;
- filterResult.setConfig(SkBitmap::kARGB_8888_Config, r.width(), r.height());
+ filterResult.setConfig(SkBitmap::kARGB_8888_Config, w, h);
filterResult.allocPixels();
SkCanvas canvasFilter(filterResult);
canvasFilter.clear(0x00000000);
- shaderResult.setConfig(SkBitmap::kARGB_8888_Config, r.width(), r.height());
+ shaderResult.setConfig(SkBitmap::kARGB_8888_Config, w, h);
shaderResult.allocPixels();
SkCanvas canvasShader(shaderResult);
canvasShader.clear(0x00000000);