Reland "limit mask drawing to clip bounds"

This reverts commit 35f1c154c5.

Reason for revert: <INSERT REASONING HERE>

Original change's description:
> Revert "limit mask drawing to clip bounds"
> 
> This reverts commit 41d087c262.
> 
> Reason for revert: very speculative revert to see if this fixes android roll
> 
> Original change's description:
> > limit mask drawing to clip bounds
> > 
> > Change-Id: Iab74531614654f241e12d1cd1af14725888580c8
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/207143
> > Reviewed-by: Mike Reed <reed@google.com>
> > Auto-Submit: Lee Salzman <lsalzman@mozilla.com>
> > Commit-Queue: Mike Klein <mtklein@google.com>
> 
> TBR=mtklein@chromium.org,mtklein@google.com,reed@google.com,lsalzman@mozilla.com
> 
> Change-Id: Ib848a276cc4bfdf346949acef3e81fd9f8b082a2
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/207860
> Reviewed-by: Greg Daniel <egdaniel@google.com>
> Commit-Queue: Greg Daniel <egdaniel@google.com>

TBR=mtklein@chromium.org,egdaniel@google.com,mtklein@google.com,reed@google.com,lsalzman@mozilla.com

Change-Id: I7c072e56ba744bad88f9b7cc65a857aef6fff756
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/207880
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
This commit is contained in:
Greg Daniel 2019-04-12 15:05:45 +00:00 committed by Skia Commit-Bot
parent c85f8e8dda
commit 01e1f4df7f

View File

@ -965,6 +965,11 @@ void SkDraw::drawPath(const SkPath& origSrcPath, const SkPaint& origPaint,
void SkDraw::drawBitmapAsMask(const SkBitmap& bitmap, const SkPaint& paint) const {
SkASSERT(bitmap.colorType() == kAlpha_8_SkColorType);
// nothing to draw
if (fRC->isEmpty()) {
return;
}
if (SkTreatAsSprite(*fMatrix, bitmap.dimensions(), paint)) {
int ix = SkScalarRoundToInt(fMatrix->getTranslateX());
int iy = SkScalarRoundToInt(fMatrix->getTranslateY());
@ -991,10 +996,11 @@ void SkDraw::drawBitmapAsMask(const SkBitmap& bitmap, const SkPaint& paint) cons
r.round(&mask.fBounds);
// set the mask's bounds to the transformed bitmap-bounds,
// clipped to the actual device
// clipped to the actual device and further limited by the clip bounds
{
SkIRect devBounds;
devBounds.set(0, 0, fDst.width(), fDst.height());
SkASSERT(fDst.bounds().contains(fRC->getBounds()));
SkIRect devBounds = fDst.bounds();
devBounds.intersect(fRC->getBounds().makeOutset(1, 1));
// need intersect(l, t, r, b) on irect
if (!mask.fBounds.intersect(devBounds)) {
return;