aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkDraw.cpp
diff options
context:
space:
mode:
authorGravatar Greg Daniel <egdaniel@google.com>2018-05-07 13:40:04 +0000
committerGravatar Greg Daniel <egdaniel@google.com>2018-05-07 13:50:22 +0000
commit8a95244f626c2f7d4b66c8ca18266c2b0640bebb (patch)
tree5a2507fba430f64013f1085e96b7ce09d419f65c /src/core/SkDraw.cpp
parent2381add3ea636b74bbf7f1d9be9ae3ddd6793f1c (diff)
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>
Diffstat (limited to 'src/core/SkDraw.cpp')
-rw-r--r--src/core/SkDraw.cpp37
1 files changed, 16 insertions, 21 deletions
diff --git a/src/core/SkDraw.cpp b/src/core/SkDraw.cpp
index 34f5da5cfe..0526f76f8e 100644
--- a/src/core/SkDraw.cpp
+++ b/src/core/SkDraw.cpp
@@ -1441,15 +1441,11 @@ public:
SkRegion::Cliperator clipper(*fClip, mask.fBounds);
if (!clipper.done() && this->getImageData(glyph, &mask)) {
- 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());
- }
+ const SkIRect& cr = clipper.rect();
+ do {
+ this->blitMask(mask, cr);
+ clipper.next();
+ } while (!clipper.done());
}
} else {
SkIRect storage;
@@ -1464,11 +1460,7 @@ public:
}
if (this->getImageData(glyph, &mask)) {
- if (SkMask::kARGB32_Format == mask.fFormat) {
- this->blitARGB32Mask(mask);
- } else {
- fBlitter->blitMask(mask, *bounds);
- }
+ this->blitMask(mask, *bounds);
}
}
}
@@ -1499,14 +1491,17 @@ private:
return true;
}
- 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);
+ 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);
- fDraw.drawSprite(bm, mask.fBounds.x(), mask.fBounds.y(), fPaint);
+ fDraw.drawSprite(bm, mask.fBounds.x(), mask.fBounds.y(), fPaint);
+ } else {
+ fBlitter->blitMask(mask, clip);
+ }
}
const bool fUseRegionToDraw;