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

Unified Diff: src/core/SkDraw.cpp

Issue 444003004: Allow custom blitters to be passed to SkDraw::drawPath (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 4 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/SkDraw.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkDraw.cpp
diff --git a/src/core/SkDraw.cpp b/src/core/SkDraw.cpp
index b77eb430c7be6ea33700a193a376d1b47ca719b8..9bc29b333a8123e5145fda6269ad2f698493bd27 100644
--- a/src/core/SkDraw.cpp
+++ b/src/core/SkDraw.cpp
@@ -54,9 +54,10 @@ public:
SkBlitter* get() const { return fBlitter; }
void choose(const SkBitmap& device, const SkMatrix& matrix,
- const SkPaint& paint) {
+ const SkPaint& paint, bool drawCoverage = false) {
SkASSERT(!fBlitter);
- fBlitter = SkBlitter::Choose(device, matrix, paint, &fAllocator);
+ fBlitter = SkBlitter::Choose(device, matrix, paint, &fAllocator,
+ drawCoverage);
}
private:
@@ -992,7 +993,7 @@ DRAW_PATH:
void SkDraw::drawPath(const SkPath& origSrcPath, const SkPaint& origPaint,
const SkMatrix* prePathMatrix, bool pathIsMutable,
- bool drawCoverage) const {
+ bool drawCoverage, SkBlitter* customBlitter) const {
SkDEBUGCODE(this->validate();)
// nothing to draw
@@ -1078,12 +1079,19 @@ void SkDraw::drawPath(const SkPath& origSrcPath, const SkPaint& origPaint,
// transform the path into device space
pathPtr->transform(*matrix, devPathPtr);
- SkAutoBlitterChoose blitter(*fBitmap, *fMatrix, *paint, drawCoverage);
+ SkBlitter* blitter = NULL;
+ SkAutoBlitterChoose blitterStorage;
+ if (NULL == customBlitter) {
+ blitterStorage.choose(*fBitmap, *fMatrix, *paint, drawCoverage);
+ blitter = blitterStorage.get();
+ } else {
+ blitter = customBlitter;
+ }
if (paint->getMaskFilter()) {
SkPaint::Style style = doFill ? SkPaint::kFill_Style :
SkPaint::kStroke_Style;
- if (paint->getMaskFilter()->filterPath(*devPathPtr, *fMatrix, *fRC, blitter.get(), style)) {
+ if (paint->getMaskFilter()->filterPath(*devPathPtr, *fMatrix, *fRC, blitter, style)) {
return; // filterPath() called the blitter, so we're done
}
}
@@ -1102,7 +1110,7 @@ void SkDraw::drawPath(const SkPath& origSrcPath, const SkPaint& origPaint,
proc = SkScan::HairPath;
}
}
- proc(*devPathPtr, *fRC, blitter.get());
+ proc(*devPathPtr, *fRC, blitter);
}
/** For the purposes of drawing bitmaps, if a matrix is "almost" translate
« no previous file with comments | « include/core/SkDraw.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698