| 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 "platform/graphics/paint/DisplayItemClient.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 // rely on PaintController here. | 24 // rely on PaintController here. |
| 25 class PLATFORM_EXPORT SkPictureBuilder final : public DisplayItemClient { | 25 class PLATFORM_EXPORT SkPictureBuilder final : public DisplayItemClient { |
| 26 WTF_MAKE_NONCOPYABLE(SkPictureBuilder); | 26 WTF_MAKE_NONCOPYABLE(SkPictureBuilder); |
| 27 | 27 |
| 28 public: | 28 public: |
| 29 // Constructs a new builder with the given bounds for the resulting recorded | 29 // Constructs a new builder with the given bounds for the resulting recorded |
| 30 // picture. If |metadata| is specified, that metadata is propagated to the | 30 // picture. If |metadata| is specified, that metadata is propagated to the |
| 31 // builder's internal canvas. If |containingContext| is specified, the device | 31 // builder's internal canvas. If |containingContext| is specified, the device |
| 32 // scale factor, printing, and disabled state are propagated to the builder's | 32 // scale factor, printing, and disabled state are propagated to the builder's |
| 33 // internal context. | 33 // internal context. |
| 34 // If a PaintController is passed, it is used as the PaintController for |
| 35 // painting the picture (and hence we can use its cache). Otherwise, a new |
| 36 // PaintController is used for the duration of the picture building, which |
| 37 // therefore has no caching. |
| 34 SkPictureBuilder(const FloatRect& bounds, | 38 SkPictureBuilder(const FloatRect& bounds, |
| 35 SkMetaData* = nullptr, | 39 SkMetaData* = nullptr, |
| 36 GraphicsContext* containingContext = nullptr); | 40 GraphicsContext* containingContext = nullptr, |
| 41 PaintController* = nullptr); |
| 37 ~SkPictureBuilder(); | 42 ~SkPictureBuilder(); |
| 38 | 43 |
| 39 GraphicsContext& context() { return *m_context; } | 44 GraphicsContext& context() { return *m_context; } |
| 40 | 45 |
| 41 // Returns a picture capturing all drawing performed on the builder's context | 46 // Returns a picture capturing all drawing performed on the builder's context |
| 42 // since construction. | 47 // since construction. |
| 43 sk_sp<SkPicture> endRecording(); | 48 sk_sp<SkPicture> endRecording(); |
| 44 | 49 |
| 45 // DisplayItemClient methods | 50 // DisplayItemClient methods |
| 46 String debugName() const final { return "SkPictureBuilder"; } | 51 String debugName() const final { return "SkPictureBuilder"; } |
| 47 LayoutRect visualRect() const final { return LayoutRect(); } | 52 LayoutRect visualRect() const final { return LayoutRect(); } |
| 48 | 53 |
| 49 private: | 54 private: |
| 50 std::unique_ptr<PaintController> m_paintController; | 55 PaintController* m_paintController; |
| 56 std::unique_ptr<PaintController> m_paintControllerPtr; |
| 51 std::unique_ptr<GraphicsContext> m_context; | 57 std::unique_ptr<GraphicsContext> m_context; |
| 52 FloatRect m_bounds; | 58 FloatRect m_bounds; |
| 53 }; | 59 }; |
| 54 | 60 |
| 55 } // namespace blink | 61 } // namespace blink |
| 56 | 62 |
| 57 #endif // SkPictureBuilder_h | 63 #endif // SkPictureBuilder_h |
| OLD | NEW |