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

Unified Diff: Source/web/WebGraphicsContextImpl.h

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.h
diff --git a/Source/web/WebGraphicsContextImpl.h b/Source/web/WebGraphicsContextImpl.h
new file mode 100644
index 0000000000000000000000000000000000000000..c4f695ab40b714aa529167d931050c4ab134e52d
--- /dev/null
+++ b/Source/web/WebGraphicsContextImpl.h
@@ -0,0 +1,46 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
pdr. 2015/02/10 23:47:08 Can we combine this with WebGraphicsContext?
jbroman 2015/02/11 00:32:54 The interface/impl pattern seems to be more common
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef WebGraphicsContextImpl_h
+#define WebGraphicsContextImpl_h
+
+#include "platform/graphics/paint/DisplayItem.h"
+#include "platform/graphics/paint/DisplayItemClient.h"
+#include "public/web/WebGraphicsContext.h"
+#include "wtf/OwnPtr.h"
+
+namespace blink {
+
+class DrawingRecorder;
+class GraphicsContext;
+
+// Wraps a blink::GraphicsContext.
+// Internal consumers can extract the underlying context (via WebGraphicsContextImpl).
+// External consumers can make a single drawing using a WebCanvas.
+class WebGraphicsContextImpl : public WebGraphicsContext {
+public:
+ WebGraphicsContextImpl(GraphicsContext&, DisplayItemClient, DisplayItem::Type);
+ ~WebGraphicsContextImpl();
+ GraphicsContext& graphicsContext() { return m_graphicsContext; }
+
+ // blink::WebGraphicsContext
+ WebCanvas* beginDrawing(const WebFloatRect& bounds) override;
+ void endDrawing() override;
+
+private:
+ GraphicsContext& m_graphicsContext;
+ DisplayItemClient m_client;
+ DisplayItem::Type m_type;
+ OwnPtr<DrawingRecorder> m_drawingRecorder;
+#ifndef NDEBUG
+ bool m_hasBegunDrawing;
+#endif
+};
+
+// Source/web/ assumes that WebGraphicsContextImpl is the only implementation.
+DEFINE_TYPE_CASTS(WebGraphicsContextImpl, WebGraphicsContext, webGraphicsContext, true, true);
+
+} // namespace blink
+
+#endif

Powered by Google App Engine
This is Rietveld 408576698