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

Unified Diff: src/core/SkCanvas.cpp

Issue 973973003: Text blob run paints should be filtered. (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: Created 5 years, 10 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
Index: src/core/SkCanvas.cpp
diff --git a/src/core/SkCanvas.cpp b/src/core/SkCanvas.cpp
index c10d390f56f61396fa2ddbb55d35ab70637f577c..4600615d08faae47c861bddc287f9b959801201f 100644
--- a/src/core/SkCanvas.cpp
+++ b/src/core/SkCanvas.cpp
@@ -236,6 +236,8 @@ public:
fClipStack = canvas->fClipStack.get();
fCurrLayer = canvas->fMCRec->fTopLayer;
fSkipEmptyClips = skipEmptyClips;
+
+ fDrawFilter = fCanvas->getDrawFilter();
reed1 2015/03/03 21:26:22 nit: cavas-> instead of fCanvas, just to match the
}
bool next() {
@@ -286,14 +288,15 @@ private:
class AutoDrawLooper {
public:
AutoDrawLooper(SkCanvas* canvas, const SkSurfaceProps& props, const SkPaint& paint,
- bool skipLayerForImageFilter = false,
- const SkRect* bounds = NULL) : fOrigPaint(paint) {
- fCanvas = canvas;
- fFilter = canvas->getDrawFilter();
- fPaint = &fOrigPaint;
- fSaveCount = canvas->getSaveCount();
- fDoClearImageFilter = false;
- fDone = false;
+ bool skipLayerForImageFilter, bool skipDrawFilter,
+ const SkRect* bounds = NULL)
+ : fCanvas(canvas)
+ , fOrigPaint(paint)
+ , fFilter(skipDrawFilter ? NULL : canvas->getDrawFilter())
+ , fPaint(&fOrigPaint)
+ , fSaveCount(canvas->getSaveCount())
+ , fDoClearImageFilter(false)
+ , fDone(false) {
if (!skipLayerForImageFilter && fOrigPaint.getImageFilter()) {
SkPaint tmp;
@@ -411,13 +414,19 @@ bool AutoDrawLooper::doNext(SkDrawFilter::Type drawType) {
#define LOOPER_BEGIN_DRAWDEVICE(paint, type) \
this->predrawNotify(); \
- AutoDrawLooper looper(this, fProps, paint, true); \
+ AutoDrawLooper looper(this, fProps, paint, true, false); \
while (looper.next(type)) { \
SkDrawIter iter(this);
#define LOOPER_BEGIN(paint, type, bounds) \
this->predrawNotify(); \
- AutoDrawLooper looper(this, fProps, paint, false, bounds); \
+ AutoDrawLooper looper(this, fProps, paint, false, false, bounds); \
+ while (looper.next(type)) { \
+ SkDrawIter iter(this);
+
+#define LOOPER_BEGIN_UNFILTERED(paint, type, bounds) \
+ this->predrawNotify(); \
+ AutoDrawLooper looper(this, fProps, paint, false, true, bounds); \
while (looper.next(type)) { \
SkDrawIter iter(this);
@@ -2161,7 +2170,9 @@ void SkCanvas::onDrawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y,
}
}
- LOOPER_BEGIN(paint, SkDrawFilter::kText_Type, NULL)
+ // Skip draw filters because the actual paint depends on run font info. Draw filters
+ // are applied at the device level, where we have access to the complete paint.
+ LOOPER_BEGIN_UNFILTERED(paint, SkDrawFilter::kText_Type, NULL)
while (iter.next()) {
SkDeviceFilteredPaint dfp(iter.fDevice, looper.paint());

Powered by Google App Engine
This is Rietveld 408576698