| Index: Source/platform/graphics/GraphicsContext.cpp
|
| diff --git a/Source/platform/graphics/GraphicsContext.cpp b/Source/platform/graphics/GraphicsContext.cpp
|
| index 62c278281ef1aeef0be5148bd72acb027d9d80ff..f655de002f4885467da85cc843f9c7f4fd5d12cb 100644
|
| --- a/Source/platform/graphics/GraphicsContext.cpp
|
| +++ b/Source/platform/graphics/GraphicsContext.cpp
|
| @@ -56,6 +56,8 @@ class GraphicsContext::RecordingState {
|
| public:
|
| static PassOwnPtr<RecordingState> Create(SkCanvas* canvas, const SkMatrix& matrix)
|
| {
|
| + // Slimmming Paint uses m_pictureRecorder on GraphicsContext instead.
|
| + ASSERT(!RuntimeEnabledFeatures::slimmingPaintEnabled());
|
| return adoptPtr(new RecordingState(canvas, matrix));
|
| }
|
|
|
| @@ -111,6 +113,10 @@ GraphicsContext::GraphicsContext(SkCanvas* canvas, DisplayItemList* displayItemL
|
| DEFINE_STATIC_LOCAL(RefPtr<SkCanvas>, nullCanvas, (adoptRef(SkCreateNullCanvas())));
|
| m_canvas = nullCanvas.get();
|
| }
|
| +
|
| + // TODO(chrishtr): switch the type of the parameter to DisplayItemList&
|
| + ASSERT(displayItemList);
|
| + m_pictureRecorder = adoptPtr(new SkPictureRecorder);
|
| }
|
|
|
| GraphicsContext::~GraphicsContext()
|
| @@ -472,6 +478,11 @@ void GraphicsContext::beginRecording(const FloatRect& bounds, uint32_t recordFla
|
| if (contextDisabled())
|
| return;
|
|
|
| + if (RuntimeEnabledFeatures::slimmingPaintEnabled()) {
|
| + m_canvas = m_pictureRecorder->beginRecording(bounds, 0, recordFlags);
|
| + return;
|
| + }
|
| +
|
| m_recordingStateStack.append(
|
| RecordingState::Create(m_canvas, getTotalMatrix()));
|
| m_canvas = m_recordingStateStack.last()->recorder().beginRecording(bounds, 0, recordFlags);
|
| @@ -482,6 +493,13 @@ PassRefPtr<const SkPicture> GraphicsContext::endRecording()
|
| if (contextDisabled())
|
| return nullptr;
|
|
|
| + if (RuntimeEnabledFeatures::slimmingPaintEnabled()) {
|
| + RefPtr<const SkPicture> picture = adoptRef(m_pictureRecorder->endRecordingAsPicture());
|
| + m_canvas = nullptr;
|
| + ASSERT(picture);
|
| + return picture.release();
|
| + }
|
| +
|
| ASSERT(!m_recordingStateStack.isEmpty());
|
| RecordingState* recording = m_recordingStateStack.last().get();
|
| RefPtr<const SkPicture> picture = adoptRef(recording->recorder().endRecordingAsPicture());
|
| @@ -495,6 +513,9 @@ PassRefPtr<const SkPicture> GraphicsContext::endRecording()
|
|
|
| bool GraphicsContext::isRecording() const
|
| {
|
| + if (RuntimeEnabledFeatures::slimmingPaintEnabled())
|
| + return m_canvas;
|
| +
|
| return !m_recordingStateStack.isEmpty();
|
| }
|
|
|
|
|