| Index: Source/core/paint/GraphicsContextRecorder.h
|
| diff --git a/Source/core/paint/GraphicsContextRecorder.h b/Source/core/paint/GraphicsContextRecorder.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..7ddac7b832e5fb2e459bc855e315e38c9eca4710
|
| --- /dev/null
|
| +++ b/Source/core/paint/GraphicsContextRecorder.h
|
| @@ -0,0 +1,47 @@
|
| +// Copyright 2014 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#ifndef GraphicsContextRecorder_h
|
| +#define GraphicsContextRecorder_h
|
| +
|
| +#include "core/paint/ClipRecorder.h"
|
| +#include "platform/RuntimeEnabledFeatures.h"
|
| +#include "platform/graphics/GraphicsContextStateSaver.h"
|
| +
|
| +namespace blink {
|
| +
|
| +class GraphicsContextRecorder {
|
| + STACK_ALLOCATED();
|
| +public:
|
| + static GraphicsContextRecorder& currentRecorder() { return *s_currentRecorder; }
|
| +
|
| + GraphicsContextRecorder(GraphicsContext& context, bool saveAndRestore = true)
|
| + : m_stateSaver(context, saveAndRestore)
|
| + , m_parent(s_currentRecorder)
|
| + {
|
| + s_currentRecorder = this;
|
| + }
|
| +
|
| + ~GraphicsContextRecorder()
|
| + {
|
| + ASSERT(s_currentRecorder == this);
|
| + s_currentRecorder = m_parent;
|
| + }
|
| +
|
| + void addClipRecorder(PassOwnPtr<ClipRecorder> clipRecorder)
|
| + {
|
| + ASSERT(RuntimeEnabledFeatures::slimmingPaintEnabled());
|
| + m_clipRecorders.append(clipRecorder);
|
| + }
|
| +private:
|
| + GraphicsContextStateSaver m_stateSaver;
|
| + GraphicsContextRecorder* m_parent;
|
| + Vector<OwnPtr<ClipRecorder>> m_clipRecorders;
|
| +
|
| + static GraphicsContextRecorder* s_currentRecorder;
|
| +};
|
| +
|
| +} // namespace blink
|
| +
|
| +#endif // GraphicsContextRecorder_h
|
|
|