Commit 0ff05185 authored by fmalita@chromium.org's avatar fmalita@chromium.org

Simplify GraphicsContext::couldUseLCDRenderedText()

After https://codereview.chromium.org/719253002, Skia disables LCD text
for non-opaque save-layers automatically.

Also remove a couple of single-use getters.

R=reed@google.com,jbroman@chromium.org,senorblanco@chromium.org

Review URL: https://codereview.chromium.org/724063004

git-svn-id: svn://svn.chromium.org/blink/trunk@185342 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 97b836e3
...@@ -419,19 +419,6 @@ void GraphicsContext::adjustTextRenderMode(SkPaint* paint) const ...@@ -419,19 +419,6 @@ void GraphicsContext::adjustTextRenderMode(SkPaint* paint) const
paint->setLCDRenderText(couldUseLCDRenderedText()); paint->setLCDRenderText(couldUseLCDRenderedText());
} }
bool GraphicsContext::couldUseLCDRenderedText() const
{
ASSERT(m_canvas);
// Our layers only have a single alpha channel. This means that subpixel
// rendered text cannot be composited correctly when the layer is
// collapsed. Therefore, subpixel text is contextDisabled when we are drawing
// onto a layer.
if (contextDisabled() || m_canvas->isDrawingToLayer() || !isCertainlyOpaque())
return false;
return shouldSmoothFonts();
}
void GraphicsContext::setCompositeOperation(CompositeOperator compositeOperation, WebBlendMode blendMode) void GraphicsContext::setCompositeOperation(CompositeOperator compositeOperation, WebBlendMode blendMode)
{ {
if (contextDisabled()) if (contextDisabled())
......
...@@ -155,11 +155,10 @@ public: ...@@ -155,11 +155,10 @@ public:
// FIXME: the setter is only used once, at construction time; convert to a constructor param, // FIXME: the setter is only used once, at construction time; convert to a constructor param,
// and possibly consolidate with other flags (paintDisabled, isPrinting, ...) // and possibly consolidate with other flags (paintDisabled, isPrinting, ...)
void setShouldSmoothFonts(bool smoothFonts) { m_shouldSmoothFonts = smoothFonts; } void setShouldSmoothFonts(bool smoothFonts) { m_shouldSmoothFonts = smoothFonts; }
bool shouldSmoothFonts() const { return m_shouldSmoothFonts; }
// Turn off LCD text for the paint if not supported on this context. // Turn off LCD text for the paint if not supported on this context.
void adjustTextRenderMode(SkPaint*) const; void adjustTextRenderMode(SkPaint*) const;
bool couldUseLCDRenderedText() const; bool couldUseLCDRenderedText() const { return m_isCertainlyOpaque && m_shouldSmoothFonts; }
void setTextDrawingMode(TextDrawingModeFlags mode) { mutableState()->setTextDrawingMode(mode); } void setTextDrawingMode(TextDrawingModeFlags mode) { mutableState()->setTextDrawingMode(mode); }
TextDrawingModeFlags textDrawingMode() const { return immutableState()->textDrawingMode(); } TextDrawingModeFlags textDrawingMode() const { return immutableState()->textDrawingMode(); }
...@@ -188,7 +187,6 @@ public: ...@@ -188,7 +187,6 @@ public:
// the canvas may have transparency (as is the case when rendering // the canvas may have transparency (as is the case when rendering
// to a canvas object). // to a canvas object).
void setCertainlyOpaque(bool isOpaque) { m_isCertainlyOpaque = isOpaque; } void setCertainlyOpaque(bool isOpaque) { m_isCertainlyOpaque = isOpaque; }
bool isCertainlyOpaque() const { return m_isCertainlyOpaque; }
// Returns if the context is a printing context instead of a display // Returns if the context is a printing context instead of a display
// context. Bitmap shouldn't be resampled when printing to keep the best // context. Bitmap shouldn't be resampled when printing to keep the best
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment