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 718913003: Observe surface LCD settings in SkBaseDevice::drawTextBlob() (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: adopting Mike's comment Created 6 years, 1 month 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 | « 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 90ea705adc65a72d02dc9e6d2101a66db4af1972..bc6c892079622f956f00441d7b153c644974dd25 100644
--- a/src/core/SkDevice.cpp
+++ b/src/core/SkDevice.cpp
@@ -129,6 +129,7 @@ void SkBaseDevice::drawTextBlob(const SkDraw& draw, const SkTextBlob* blob, SkSc
// applyFontToPaint() always overwrites the exact same attributes,
// so it is safe to not re-seed the paint.
it.applyFontToPaint(&runPaint);
+ runPaint.setFlags(this->filterTextFlags(runPaint));
switch (it.positioning()) {
case SkTextBlob::kDefault_Positioning:
@@ -211,15 +212,20 @@ bool SkBaseDevice::EXPERIMENTAL_drawPicture(SkCanvas*, const SkPicture*, const S
//////////////////////////////////////////////////////////////////////////////////////////
-bool SkBaseDevice::shouldDisableLCD(const SkPaint& paint) const {
+uint32_t SkBaseDevice::filterTextFlags(const SkPaint& paint) const {
+ uint32_t flags = paint.getFlags();
+
if (!paint.isLCDRenderText() || !paint.isAntiAlias()) {
- return false;
+ return flags;
}
- if (kUnknown_SkPixelGeometry == fLeakyProperties->pixelGeometry()) {
- return true;
+ if (kUnknown_SkPixelGeometry == fLeakyProperties->pixelGeometry()
+ || this->onShouldDisableLCD(paint)) {
+
+ flags &= ~SkPaint::kLCDRenderText_Flag;
+ flags |= SkPaint::kGenA8FromLCD_Flag;
}
- return this->onShouldDisableLCD(paint);
+ return flags;
}
« no previous file with comments | « src/core/SkCanvas.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698