aboutsummaryrefslogtreecommitdiffhomepage
path: root/gm/drawbitmaprect.cpp
diff options
context:
space:
mode:
authorGravatar bsalomon@google.com <bsalomon@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-04-25 15:52:27 +0000
committerGravatar bsalomon@google.com <bsalomon@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-04-25 15:52:27 +0000
commit7d30a213156bcf50d05dbf60401cc7ab98d286c6 (patch)
tree4f750c67c271afab0601e19d377684a24de0fbc6 /gm/drawbitmaprect.cpp
parent0f191f30af7c067883c97b034baf70bfd92f5ea0 (diff)
Fixes matrix inconsistency in GPU draws with filters. Also adds a GM test.
May make GM go red on bots, will rebaseline. Committed on behalf of Guanqun.Lu@gmail.com Review URL: http://codereview.appspot.com/6049046/ git-svn-id: http://skia.googlecode.com/svn/trunk@3764 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'gm/drawbitmaprect.cpp')
-rw-r--r--gm/drawbitmaprect.cpp36
1 files changed, 36 insertions, 0 deletions
diff --git a/gm/drawbitmaprect.cpp b/gm/drawbitmaprect.cpp
index 5832a9c627..64e4cf3d4e 100644
--- a/gm/drawbitmaprect.cpp
+++ b/gm/drawbitmaprect.cpp
@@ -8,6 +8,7 @@
#include "gm.h"
#include "SkShader.h"
#include "SkColorPriv.h"
+#include "SkBlurMaskFilter.h"
// effects
#include "SkGradientShader.h"
@@ -15,6 +16,21 @@
namespace skiagm {
+static SkBitmap make_chessbm(int w, int h) {
+ SkBitmap bm;
+ bm.setConfig(SkBitmap::kARGB_8888_Config , w, h);
+ bm.allocPixels();
+
+ for (int y = 0; y < bm.height(); y++) {
+ uint32_t* p = bm.getAddr32(0, y);
+ for (int x = 0; x < bm.width(); x++) {
+ p[x] = ((x + y) & 1) ? SK_ColorWHITE : SK_ColorBLACK;
+ }
+ }
+ bm.unlockPixels();
+ return bm;
+}
+
static void makebm(SkBitmap* bm, SkBitmap::Config config, int w, int h) {
bm->setConfig(config, w, h);
bm->allocPixels();
@@ -140,6 +156,26 @@ protected:
}
}
}
+
+ {
+ // test the following code path:
+ // SkGpuDevice::drawPath() -> SkGpuDevice::drawWithMaskFilter()
+ SkIRect srcRect;
+ SkPaint paint;
+ SkBitmap bm;
+
+ bm = make_chessbm(5, 5);
+ paint.setFilterBitmap(true);
+
+ srcRect.setXYWH(1, 1, 3, 3);
+ SkMaskFilter* mf = SkBlurMaskFilter::Create(
+ 5,
+ SkBlurMaskFilter::kNormal_BlurStyle,
+ SkBlurMaskFilter::kHighQuality_BlurFlag |
+ SkBlurMaskFilter::kIgnoreTransform_BlurFlag);
+ paint.setMaskFilter(mf)->unref();
+ canvas->drawBitmapRect(bm, &srcRect, dstRect, &paint);
+ }
}
private: