OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef WebGraphicsContextImpl_h | 5 #ifndef WebGraphicsContextImpl_h |
6 #define WebGraphicsContextImpl_h | 6 #define WebGraphicsContextImpl_h |
7 | 7 |
8 #include "platform/graphics/paint/DisplayItem.h" | 8 #include "platform/graphics/paint/DisplayItem.h" |
9 #include "platform/graphics/paint/DisplayItemClient.h" | 9 #include "platform/graphics/paint/DisplayItemClient.h" |
10 #include "public/web/WebGraphicsContext.h" | 10 #include "public/web/WebGraphicsContext.h" |
11 #include "wtf/Allocator.h" | |
12 #include "wtf/OwnPtr.h" | 11 #include "wtf/OwnPtr.h" |
13 | 12 |
14 namespace blink { | 13 namespace blink { |
15 | 14 |
16 class DrawingRecorder; | 15 class DrawingRecorder; |
17 class GraphicsContext; | 16 class GraphicsContext; |
18 | 17 |
19 // Wraps a blink::GraphicsContext. | 18 // Wraps a blink::GraphicsContext. |
20 // Internal consumers can extract the underlying context (via WebGraphicsContext
Impl). | 19 // Internal consumers can extract the underlying context (via WebGraphicsContext
Impl). |
21 // External consumers can make a single drawing using a WebCanvas. | 20 // External consumers can make a single drawing using a WebCanvas. |
22 class WebGraphicsContextImpl final : public WebGraphicsContext { | 21 class WebGraphicsContextImpl : public WebGraphicsContext { |
23 DISALLOW_ALLOCATION(); | |
24 public: | 22 public: |
25 WebGraphicsContextImpl(GraphicsContext&, const DisplayItemClientWrapper&, Di
splayItem::Type); | 23 WebGraphicsContextImpl(GraphicsContext&, const DisplayItemClientWrapper&, Di
splayItem::Type); |
26 ~WebGraphicsContextImpl(); | 24 ~WebGraphicsContextImpl(); |
27 GraphicsContext& graphicsContext() { return m_graphicsContext; } | 25 GraphicsContext& graphicsContext() { return m_graphicsContext; } |
28 | 26 |
29 // blink::WebGraphicsContext | 27 // blink::WebGraphicsContext |
30 WebCanvas* beginDrawing(const WebFloatRect& bounds) override; | 28 WebCanvas* beginDrawing(const WebFloatRect& bounds) override; |
31 void endDrawing() override; | 29 void endDrawing() override; |
32 | 30 |
33 private: | 31 private: |
34 GraphicsContext& m_graphicsContext; | 32 GraphicsContext& m_graphicsContext; |
35 DisplayItemClientWrapper m_client; | 33 DisplayItemClientWrapper m_client; |
36 DisplayItem::Type m_type; | 34 DisplayItem::Type m_type; |
37 OwnPtr<DrawingRecorder> m_drawingRecorder; | 35 OwnPtr<DrawingRecorder> m_drawingRecorder; |
38 #ifndef NDEBUG | 36 #ifndef NDEBUG |
39 bool m_hasBegunDrawing; | 37 bool m_hasBegunDrawing; |
40 #endif | 38 #endif |
41 }; | 39 }; |
42 | 40 |
43 // Source/web/ assumes that WebGraphicsContextImpl is the only implementation. | 41 // Source/web/ assumes that WebGraphicsContextImpl is the only implementation. |
44 DEFINE_TYPE_CASTS(WebGraphicsContextImpl, WebGraphicsContext, webGraphicsContext
, true, true); | 42 DEFINE_TYPE_CASTS(WebGraphicsContextImpl, WebGraphicsContext, webGraphicsContext
, true, true); |
45 | 43 |
46 } // namespace blink | 44 } // namespace blink |
47 | 45 |
48 #endif | 46 #endif |
OLD | NEW |