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
This commit is contained in:
parent
0f191f30af
commit
7d30a21315
@ -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:
|
||||
|
@ -922,7 +922,7 @@ bool drawWithMaskFilter(GrContext* context, const SkPath& path,
|
||||
// the current clip (and identity matrix) and grpaint settings
|
||||
|
||||
// used to compute inverse view, if necessary
|
||||
GrMatrix ivm = context->getMatrix();
|
||||
GrMatrix ivm = matrix;
|
||||
|
||||
GrAutoMatrix avm(context, GrMatrix::I());
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user