Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2650)

Unified Diff: Source/web/WebGraphicsContextImpl.cpp

Issue 867063004: [Slimming Paint] Paint the inspector overlay with GraphicsLayer DisplayList. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/web/WebGraphicsContextImpl.cpp
diff --git a/Source/web/WebGraphicsContextImpl.cpp b/Source/web/WebGraphicsContextImpl.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..a42783600791c9b96b19af395ae21db2fc3f082a
--- /dev/null
+++ b/Source/web/WebGraphicsContextImpl.cpp
@@ -0,0 +1,46 @@
+// Copyright 2015 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.
+
+#include "config.h"
+#include "web/WebGraphicsContextImpl.h"
+
+#include "platform/graphics/GraphicsContext.h"
+#include "platform/graphics/paint/DrawingRecorder.h"
+
+namespace blink {
+
+WebGraphicsContextImpl::WebGraphicsContextImpl(GraphicsContext& graphicsContext, DisplayItemClient client, DisplayItem::Type type)
+ : m_graphicsContext(graphicsContext)
+ , m_client(client)
+ , m_type(type)
+#ifndef NDEBUG
+ , m_hasBegunDrawing(false)
+#endif
+{
+}
+
+WebGraphicsContextImpl::~WebGraphicsContextImpl()
+{
+}
+
+WebCanvas* WebGraphicsContextImpl::beginDrawing(const WebFloatRect& bounds)
+{
+#ifndef NDEBUG
+ ASSERT(!m_hasBegunDrawing);
+ m_hasBegunDrawing = true;
+#endif
+ m_drawingRecorder = adoptPtr(new DrawingRecorder(&m_graphicsContext, m_client, m_type, bounds));
+
+ WebCanvas* canvas = m_graphicsContext.canvas();
+ ASSERT(canvas);
+ return canvas;
+}
+
+void WebGraphicsContextImpl::endDrawing()
+{
+ ASSERT(m_drawingRecorder);
+ m_drawingRecorder.clear();
+}
+
+} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698