From 112e7e277702e104357f2d44742253ee1b0109ac Mon Sep 17 00:00:00 2001 From: fmalita Date: Thu, 13 Nov 2014 14:05:58 -0800 Subject: Observe surface LCD settings in SkBaseDevice::drawTextBlob() We're currently overwriting the paint LCD text flag based on the the run font data => this cancels any LCD filtering we might have performed higher up the stack. BUG=423362 R=reed@google.com Review URL: https://codereview.chromium.org/718913003 --- src/core/SkDevice.cpp | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'src/core/SkDevice.cpp') diff --git a/src/core/SkDevice.cpp b/src/core/SkDevice.cpp index 90ea705adc..bc6c892079 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; } -- cgit v1.2.3