Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(270)

Unified Diff: src/gpu/SkGpuDevice.cpp

Issue 65133003: [GPU] Use view matrix + rect to implement subrect for drawBitmap when there is a mask filter and ble (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: upload again, rietveld diff failed. Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gm/bleed.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/SkGpuDevice.cpp
diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp
index 063509a5a4d6b3d4e27a81f7a852d7c140030a40..0f9055e218bcd47ffc42472b55a578e4985d4ab4 100644
--- a/src/gpu/SkGpuDevice.cpp
+++ b/src/gpu/SkGpuDevice.cpp
@@ -1117,26 +1117,25 @@ void SkGpuDevice::drawBitmapCommon(const SkDraw& draw,
SkBitmap tmp; // subset of bitmap, if necessary
const SkBitmap* bitmapPtr = &bitmap;
if (NULL != srcRectPtr) {
- SkIRect iSrc;
- srcRect.roundOut(&iSrc);
-
- SkPoint offset = SkPoint::Make(SkIntToScalar(iSrc.fLeft),
- SkIntToScalar(iSrc.fTop));
-
- if (SkCanvas::kBleed_DrawBitmapRectFlag & flags) {
- // In bleed mode we want to expand the src rect on all sides
- // but stay within the bitmap bounds
- SkIRect iClampRect = SkIRect::MakeWH(bitmap.width(), bitmap.height());
- clamped_unit_outset_with_offset(&iSrc, &offset, iClampRect);
- }
-
- if (!bitmap.extractSubset(&tmp, iSrc)) {
- return; // extraction failed
+ // In bleed mode we position and trim the bitmap based on the src rect which is
+ // already accounted for in 'm' and 'srcRect'. In clamp mode we need to chop out
+ // the desired portion of the bitmap and then update 'm' and 'srcRect' to
+ // compensate.
+ if (!(SkCanvas::kBleed_DrawBitmapRectFlag & flags)) {
+ SkIRect iSrc;
+ srcRect.roundOut(&iSrc);
+
+ SkPoint offset = SkPoint::Make(SkIntToScalar(iSrc.fLeft),
+ SkIntToScalar(iSrc.fTop));
+
+ if (!bitmap.extractSubset(&tmp, iSrc)) {
+ return; // extraction failed
+ }
+ bitmapPtr = &tmp;
+ srcRect.offset(-offset.fX, -offset.fY);
+ // The source rect has changed so update the matrix
+ newM.preTranslate(offset.fX, offset.fY);
}
- bitmapPtr = &tmp;
- srcRect.offset(-offset.fX, -offset.fY);
- // The source rect has changed so update the matrix
- newM.preTranslate(offset.fX, offset.fY);
}
SkPaint paintWithTexture(paint);
« no previous file with comments | « gm/bleed.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698