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

Unified Diff: src/core/SkDraw.cpp

Issue 14637007: Detect color masks, and divert to draw-sprite instead of maskblitters (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 8 months 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 | « include/core/SkMask.h ('k') | src/core/SkDrawProcs.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkDraw.cpp
===================================================================
--- src/core/SkDraw.cpp (revision 8931)
+++ src/core/SkDraw.cpp (working copy)
@@ -1489,7 +1489,7 @@
mask.fRowBytes = glyph.rowBytes();
mask.fFormat = static_cast<SkMask::Format>(glyph.fMaskFormat);
mask.fImage = aa;
- state.fBlitter->blitMask(mask, *bounds);
+ state.blitMask(mask, *bounds);
}
static void D1G_NoBounder_RgnClip(const SkDraw1Glyph& state,
@@ -1523,7 +1523,7 @@
mask.fFormat = static_cast<SkMask::Format>(glyph.fMaskFormat);
mask.fImage = (uint8_t*)aa;
do {
- state.fBlitter->blitMask(mask, cr);
+ state.blitMask(mask, cr);
clipper.next();
} while (!clipper.done());
}
@@ -1563,7 +1563,7 @@
mask.fFormat = static_cast<SkMask::Format>(glyph.fMaskFormat);
mask.fImage = (uint8_t*)aa;
do {
- state.fBlitter->blitMask(mask, cr);
+ state.blitMask(mask, cr);
clipper.next();
} while (!clipper.done());
}
@@ -1592,11 +1592,12 @@
}
SkDraw1Glyph::Proc SkDraw1Glyph::init(const SkDraw* draw, SkBlitter* blitter,
- SkGlyphCache* cache) {
+ SkGlyphCache* cache, const SkPaint& pnt) {
fDraw = draw;
fBounder = draw->fBounder;
fBlitter = blitter;
fCache = cache;
+ fPaint = &pnt;
if (cache->isSubpixel()) {
fHalfSampleX = fHalfSampleY = (SK_FixedHalf >> SkGlyph::kSubBits);
@@ -1636,6 +1637,17 @@
}
}
+void SkDraw1Glyph::blitMaskAsSprite(const SkMask& mask) const {
+ SkASSERT(SkMask::kARGB32_Format == mask.fFormat);
+
+ SkBitmap bm;
+ bm.setConfig(SkBitmap::kARGB_8888_Config,
+ mask.fBounds.width(), mask.fBounds.height(), mask.fRowBytes);
+ bm.setPixels((SkPMColor*)mask.fImage);
+
+ fDraw->drawSprite(bm, mask.fBounds.x(), mask.fBounds.y(), *fPaint);
+}
+
///////////////////////////////////////////////////////////////////////////////
void SkDraw::drawText(const char text[], size_t byteLength,
@@ -1704,7 +1716,7 @@
SkAutoKern autokern;
SkDraw1Glyph d1g;
- SkDraw1Glyph::Proc proc = d1g.init(this, blitter, cache);
+ SkDraw1Glyph::Proc proc = d1g.init(this, blitter, cache, paint);
SkFixed fxMask = ~0;
SkFixed fyMask = ~0;
@@ -1866,7 +1878,7 @@
const char* stop = text + byteLength;
AlignProc alignProc = pick_align_proc(paint.getTextAlign());
SkDraw1Glyph d1g;
- SkDraw1Glyph::Proc proc = d1g.init(this, blitter, cache);
+ SkDraw1Glyph::Proc proc = d1g.init(this, blitter, cache, paint);
TextMapState tms(*fMatrix, constY);
TextMapState::Proc tmsProc = tms.pickProc(scalarsPerPosition);
« no previous file with comments | « include/core/SkMask.h ('k') | src/core/SkDrawProcs.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698