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

Unified Diff: src/core/SkDevice.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
« src/core/SkCanvas.cpp ('K') | « src/core/SkCanvas.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkDevice.cpp
diff --git a/src/core/SkDevice.cpp b/src/core/SkDevice.cpp
index 2f510700753d1c51d41e92ae83fbb204f61aa344..344118bc4d89866e77b798d4ed92dd5184430a69 100644
--- a/src/core/SkDevice.cpp
+++ b/src/core/SkDevice.cpp
@@ -8,6 +8,7 @@
#include "SkDevice.h"
#include "SkDeviceProperties.h"
#include "SkDraw.h"
+#include "SkDrawFilter.h"
#include "SkMetaData.h"
#include "SkPatchUtils.h"
#include "SkPathMeasure.h"
@@ -130,8 +131,15 @@ void SkBaseDevice::drawTextBlob(const SkDraw& draw, const SkTextBlob* blob, SkSc
size_t textLen = it.glyphCount() * sizeof(uint16_t);
const SkPoint& offset = it.offset();
// applyFontToPaint() always overwrites the exact same attributes,
- // so it is safe to not re-seed the paint.
+ // so it is safe to not re-seed the paint for this reason.
it.applyFontToPaint(&runPaint);
+
+ // For drawTextBlob calls, we defer applying draw filters
+ // until we have a complete run paint.
+ if (!!draw.fDrawFilter) {
reed1 2015/03/03 21:26:22 style: its fine to say if (draw.fDrawFilter), no
+ draw.fDrawFilter->filter(&runPaint, SkDrawFilter::kText_Type);
+ }
+
runPaint.setFlags(this->filterTextFlags(runPaint));
switch (it.positioning()) {
@@ -150,6 +158,11 @@ void SkBaseDevice::drawTextBlob(const SkDraw& draw, const SkTextBlob* blob, SkSc
SkFAIL("unhandled positioning mode");
}
+ if (!!draw.fDrawFilter) {
+ // A draw filter may change the paint arbitrarily, so we must re-seed in this case.
+ runPaint = paint;
+ }
+
it.next();
}
}
« src/core/SkCanvas.cpp ('K') | « src/core/SkCanvas.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698