aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/SkGpuDevice.cpp
diff options
context:
space:
mode:
authorGravatar junov@google.com <junov@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2011-07-28 20:10:09 +0000
committerGravatar junov@google.com <junov@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2011-07-28 20:10:09 +0000
commit1d32978f7e927cb39da480c3bdce18363967313a (patch)
treeca74b13f20626e35bfe8d3f45da4caad3df18874 /src/gpu/SkGpuDevice.cpp
parent3eba9d31157d5d414f26dd9660ced79fbf50b4fd (diff)
Fixing the ignore transform flag in Ganesh with mask filter and drawBitmap
TEST=SampleApp/Texture Domain BUG=http://code.google.com/p/skia/issues/detail?id=335 REVIEW=http://codereview.appspot.com/4803052/ git-svn-id: http://skia.googlecode.com/svn/trunk@1987 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/gpu/SkGpuDevice.cpp')
-rw-r--r--src/gpu/SkGpuDevice.cpp28
1 files changed, 14 insertions, 14 deletions
diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp
index d9b618a08a..4294e49072 100644
--- a/src/gpu/SkGpuDevice.cpp
+++ b/src/gpu/SkGpuDevice.cpp
@@ -1237,33 +1237,33 @@ void SkGpuDevice::drawBitmap(const SkDraw& draw,
}
if (paint.getMaskFilter()){
- SkBitmap tmp; // storage if we need a subset of bitmap
+ // Convert the bitmap to a shader so that the rect can be drawn
+ // through drawRect, which supports mask filters.
+ SkBitmap tmp; // subset of bitmap, if necessary
const SkBitmap* bitmapPtr = &bitmap;
if (srcRectPtr) {
if (!bitmap.extractSubset(&tmp, srcRect)) {
return; // extraction failed
}
bitmapPtr = &tmp;
+ srcRect.set(0,0, srcRect.width(), srcRect.height());
}
SkPaint paintWithTexture(paint);
paintWithTexture.setShader(SkShader::CreateBitmapShader( *bitmapPtr,
SkShader::kClamp_TileMode, SkShader::kClamp_TileMode))->unref();
- paintWithTexture.getShader()->setLocalMatrix(m);
-
SkRect ScalarRect;
ScalarRect.set(srcRect);
- if (m.rectStaysRect()) {
- // Preferred drawing method, optimized for rectangles
- m.mapRect(&ScalarRect);
- this->drawRect(draw, ScalarRect, paintWithTexture);
- } else {
- // Slower drawing method, for warped or rotated rectangles
- SkPath path;
- path.addRect(ScalarRect);
- path.transform(m);
- this->drawPath(draw, path, paintWithTexture, NULL, true);
- }
+ // Transform 'm' needs to be concatenated to the draw matrix,
+ // rather than transforming the primitive directly, so that 'm' will
+ // also affect the behavior of the mask filter.
+ SkMatrix drawMatrix;
+ drawMatrix.setConcat(*draw.fMatrix, m);
+ SkDraw transformedDraw(draw);
+ transformedDraw.fMatrix = &drawMatrix;
+
+ this->drawRect(transformedDraw, ScalarRect, paintWithTexture);
+
return;
}