diff options
author | Ben Wagner <bungeman@google.com> | 2018-05-07 16:53:43 +0000 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-05-07 16:53:50 +0000 |
commit | 01c304e47686d946c4e6ec77a622221cf822b67f (patch) | |
tree | de78db827ea5e79b64dc740b51696f4d5bacd413 | |
parent | a585f73bbef8dec83fdc3951a1e9130a09bdcef1 (diff) |
Reland "Avoid drawing BW clipped color glyphs many times."
This reverts commit 8a95244f626c2f7d4b66c8ca18266c2b0640bebb.
Reason for revert: Didn't actually break anything.
Original change's description:
> Revert "Avoid drawing BW clipped color glyphs many times."
>
> This reverts commit bba38ee80e4140908ac0c351dc18a2f1224e5f0a.
>
> Reason for revert: possibly breaking chrome text
>
> Original change's description:
> > Avoid drawing BW clipped color glyphs many times.
> >
> > Prior to this change if a color glyph is drawn through the raster device
> > with an aliased clip the glyph is drawn once for each rectangular region
> > in the aliased clip. In addition, even when the glyph was not a color
> > glyph in this situation, the mask was checked for being a color glyph
> > once for each rectangular region of the aliased clip. This change hoists
> > the test for the color format out of the loop to ensure that the mask
> > format is checked once and the mask is drawn once.
> >
> > This issue was discovered by rotating the coloremoji_blendmodes gm.
> >
> > Change-Id: I18b6b546356780e0b00948fff7b65783219f5c92
> > Reviewed-on: https://skia-review.googlesource.com/125868
> > Reviewed-by: Mike Reed <reed@google.com>
> > Commit-Queue: Ben Wagner <bungeman@google.com>
>
> TBR=mtklein@google.com,bungeman@google.com,reed@google.com
>
> # Not skipping CQ checks because original CL landed > 1 day ago.
>
> Change-Id: Ife6d7255f9cb88b6f9d7a3c5800e88cc065e475b
> Reviewed-on: https://skia-review.googlesource.com/126401
> Reviewed-by: Greg Daniel <egdaniel@google.com>
> Commit-Queue: Greg Daniel <egdaniel@google.com>
TBR=egdaniel@google.com,mtklein@google.com,bungeman@google.com,reed@google.com
Change-Id: I7fc4c1f901bcee482f6b118b192caee14c112e43
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/126540
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
-rw-r--r-- | src/core/SkDraw.cpp | 37 |
1 files changed, 21 insertions, 16 deletions
diff --git a/src/core/SkDraw.cpp b/src/core/SkDraw.cpp index 0526f76f8e..34f5da5cfe 100644 --- a/src/core/SkDraw.cpp +++ b/src/core/SkDraw.cpp @@ -1441,11 +1441,15 @@ public: SkRegion::Cliperator clipper(*fClip, mask.fBounds); if (!clipper.done() && this->getImageData(glyph, &mask)) { - const SkIRect& cr = clipper.rect(); - do { - this->blitMask(mask, cr); - clipper.next(); - } while (!clipper.done()); + if (SkMask::kARGB32_Format == mask.fFormat) { + this->blitARGB32Mask(mask); + } else { + const SkIRect& cr = clipper.rect(); + do { + fBlitter->blitMask(mask, cr); + clipper.next(); + } while (!clipper.done()); + } } } else { SkIRect storage; @@ -1460,7 +1464,11 @@ public: } if (this->getImageData(glyph, &mask)) { - this->blitMask(mask, *bounds); + if (SkMask::kARGB32_Format == mask.fFormat) { + this->blitARGB32Mask(mask); + } else { + fBlitter->blitMask(mask, *bounds); + } } } } @@ -1491,17 +1499,14 @@ private: return true; } - void blitMask(const SkMask& mask, const SkIRect& clip) const { - if (SkMask::kARGB32_Format == mask.fFormat) { - SkBitmap bm; - bm.installPixels( - SkImageInfo::MakeN32Premul(mask.fBounds.width(), mask.fBounds.height()), - (SkPMColor*)mask.fImage, mask.fRowBytes); + void blitARGB32Mask(const SkMask& mask) const { + SkASSERT(SkMask::kARGB32_Format == mask.fFormat); + SkBitmap bm; + bm.installPixels( + SkImageInfo::MakeN32Premul(mask.fBounds.width(), mask.fBounds.height()), + (SkPMColor*)mask.fImage, mask.fRowBytes); - fDraw.drawSprite(bm, mask.fBounds.x(), mask.fBounds.y(), fPaint); - } else { - fBlitter->blitMask(mask, clip); - } + fDraw.drawSprite(bm, mask.fBounds.x(), mask.fBounds.y(), fPaint); } const bool fUseRegionToDraw; |