Fix LCD text handling for SVG filters.

Turn off LCD (subpixel AA) text while recording the DisplayList used
for image filters, since we don't know about the opacity of the
destination playback canvas (and using the recording canvas's
opacity is wrong).

BUG=422176

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

git-svn-id: svn://svn.chromium.org/blink/trunk@183558 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 325ed8bd
......@@ -104,6 +104,7 @@ PassRefPtr<SVGFilterBuilder> RenderSVGResourceFilter::buildPrimitives(SVGFilter*
static void beginDeferredFilter(GraphicsContext* context, FilterData* filterData)
{
context->beginRecording(filterData->boundaries);
context->setShouldSmoothFonts(false);
// We pass the boundaries to SkPictureImageFilter so it knows the
// world-space position of the filter primitives. It gets them
// from the DisplayList, which also applies the inverse translate
......
......@@ -70,12 +70,13 @@ struct GraphicsContext::CanvasSaveState {
};
struct GraphicsContext::RecordingState {
RecordingState(SkPictureRecorder* recorder, SkCanvas* currentCanvas, const SkMatrix& currentMatrix,
RecordingState(SkPictureRecorder* recorder, SkCanvas* currentCanvas, const SkMatrix& currentMatrix, bool currentShouldSmoothFonts,
PassRefPtr<DisplayList> displayList, RegionTrackingMode trackingMode)
: m_displayList(displayList)
, m_recorder(recorder)
, m_savedCanvas(currentCanvas)
, m_savedMatrix(currentMatrix)
, m_savedShouldSmoothFonts(currentShouldSmoothFonts)
, m_regionTrackingMode(trackingMode) { }
~RecordingState() { }
......@@ -84,6 +85,7 @@ struct GraphicsContext::RecordingState {
SkPictureRecorder* m_recorder;
SkCanvas* m_savedCanvas;
const SkMatrix m_savedMatrix;
bool m_savedShouldSmoothFonts;
RegionTrackingMode m_regionTrackingMode;
};
......@@ -508,7 +510,7 @@ void GraphicsContext::beginRecording(const FloatRect& bounds, uint32_t recordFla
}
}
m_recordingStateStack.append(RecordingState(recorder, savedCanvas, savedMatrix, displayList,
m_recordingStateStack.append(RecordingState(recorder, savedCanvas, savedMatrix, m_shouldSmoothFonts, displayList,
static_cast<RegionTrackingMode>(m_regionTrackingMode)));
// Disable region tracking during recording.
......@@ -525,6 +527,7 @@ PassRefPtr<DisplayList> GraphicsContext::endRecording()
m_canvas = recording.m_savedCanvas;
setRegionTrackingMode(recording.m_regionTrackingMode);
setShouldSmoothFonts(recording.m_savedShouldSmoothFonts);
delete recording.m_recorder;
m_recordingStateStack.removeLast();
......
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