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 SkPictureBuilder_h | 5 #ifndef SkPictureBuilder_h |
6 #define SkPictureBuilder_h | 6 #define SkPictureBuilder_h |
7 | 7 |
8 #include "platform/PlatformExport.h" | 8 #include "platform/PlatformExport.h" |
9 #include "platform/geometry/FloatRect.h" | 9 #include "platform/geometry/FloatRect.h" |
10 #include "platform/graphics/paint/DisplayItemClient.h" | |
10 #include "wtf/Noncopyable.h" | 11 #include "wtf/Noncopyable.h" |
11 #include "wtf/OwnPtr.h" | 12 #include "wtf/OwnPtr.h" |
12 #include "wtf/PassRefPtr.h" | 13 #include "wtf/PassRefPtr.h" |
13 | 14 |
14 class SkMetaData; | 15 class SkMetaData; |
15 class SkPicture; | 16 class SkPicture; |
16 | 17 |
17 namespace blink { | 18 namespace blink { |
18 | 19 |
19 class GraphicsContext; | 20 class GraphicsContext; |
20 class PaintController; | 21 class PaintController; |
21 | 22 |
22 // When slimming paint ships we can remove this SkPicture abstraction and | 23 // When slimming paint ships we can remove this SkPicture abstraction and |
23 // rely on PaintController here. | 24 // rely on PaintController here. |
24 class PLATFORM_EXPORT SkPictureBuilder final { | 25 class PLATFORM_EXPORT SkPictureBuilder final : public DisplayItemClient { |
25 WTF_MAKE_NONCOPYABLE(SkPictureBuilder); | 26 WTF_MAKE_NONCOPYABLE(SkPictureBuilder); |
26 public: | 27 public: |
27 // Constructs a new builder with the given bounds for the resulting recorded picture. If | 28 // Constructs a new builder with the given bounds for the resulting recorded picture. If |
28 // |metadata| is specified, that metadata is propagated to the builder's int ernal canvas. If | 29 // |metadata| is specified, that metadata is propagated to the builder's int ernal canvas. If |
29 // |containingContext| is specified, the device scale factor, printing, and disabled state are | 30 // |containingContext| is specified, the device scale factor, printing, and disabled state are |
30 // propagated to the builder's internal context. | 31 // propagated to the builder's internal context. |
31 SkPictureBuilder(const FloatRect& bounds, SkMetaData* = nullptr, GraphicsCon text* containingContext = nullptr); | 32 SkPictureBuilder(const FloatRect& bounds, SkMetaData* = nullptr, GraphicsCon text* containingContext = nullptr); |
32 ~SkPictureBuilder(); | 33 ~SkPictureBuilder(); |
33 | 34 |
34 GraphicsContext& context() { return *m_context; } | 35 GraphicsContext& context() { return *m_context; } |
35 | 36 |
36 // Returns a picture capturing all drawing performed on the builder's contex t since | 37 // Returns a picture capturing all drawing performed on the builder's contex t since |
37 // construction. | 38 // construction. |
38 PassRefPtr<SkPicture> endRecording(); | 39 PassRefPtr<SkPicture> endRecording(); |
39 | 40 |
41 // DisplayItemClient methods | |
42 String debugName() const final { return "SkPictureBuilder"; } | |
43 LayoutRect visualRect() const final { return LayoutRect(); } | |
chrishtr
2016/04/29 00:17:00
ASSERT_NOT_REACHED
Xianzhu
2016/04/29 00:39:40
For now this is still reached during endRecording(
| |
44 | |
40 private: | 45 private: |
41 OwnPtr<PaintController> m_paintController; | 46 OwnPtr<PaintController> m_paintController; |
42 OwnPtr<GraphicsContext> m_context; | 47 OwnPtr<GraphicsContext> m_context; |
43 FloatRect m_bounds; | 48 FloatRect m_bounds; |
44 }; | 49 }; |
45 | 50 |
46 } // namespace blink | 51 } // namespace blink |
47 | 52 |
48 #endif // SkPictureBuilder_h | 53 #endif // SkPictureBuilder_h |
OLD | NEW |