| Index: sky/engine/core/painting/Canvas.h
|
| diff --git a/sky/engine/core/painting/Canvas.h b/sky/engine/core/painting/Canvas.h
|
| index abd325643ec8188ffcf6a0feb467d3ef19f0d020..d76e3f412b6b933ee629d1c1d980f81b8f19e40d 100644
|
| --- a/sky/engine/core/painting/Canvas.h
|
| +++ b/sky/engine/core/painting/Canvas.h
|
| @@ -15,21 +15,20 @@
|
| #include "sky/engine/tonic/float32_list.h"
|
| #include "sky/engine/wtf/PassRefPtr.h"
|
| #include "sky/engine/wtf/RefCounted.h"
|
| +#include "third_party/skia/include/core/SkCanvas.h"
|
|
|
| namespace blink {
|
| -class Element;
|
| class CanvasImage;
|
|
|
| class Canvas : public RefCounted<Canvas>, public DartWrappable {
|
| DEFINE_WRAPPERTYPEINFO();
|
| public:
|
| - Canvas(const FloatSize& size);
|
| - ~Canvas() override;
|
| + static PassRefPtr<Canvas> create(SkCanvas* skCanvas) {
|
| + ASSERT(skCanvas);
|
| + return adoptRef(new Canvas(skCanvas));
|
| + }
|
|
|
| - // Width/Height define a culling rect which Skia may use for optimizing
|
| - // out draw calls issued outside the rect.
|
| - float width() const { return m_size.width(); }
|
| - float height() const { return m_size.height(); }
|
| + ~Canvas() override;
|
|
|
| void save();
|
| void saveLayer(const Rect& bounds, const Paint* paint = nullptr);
|
| @@ -59,15 +58,16 @@ public:
|
| const Paint* paint);
|
|
|
| SkCanvas* skCanvas() { return m_canvas; }
|
| + void clearSkCanvas() { m_canvas = nullptr; }
|
|
|
| protected:
|
| - PassRefPtr<DisplayList> finishRecording();
|
| -
|
| bool isRecording() const { return m_canvas; }
|
| + Canvas(SkCanvas* skCanvas);
|
|
|
| private:
|
| - FloatSize m_size;
|
| - RefPtr<DisplayList> m_displayList;
|
| + // The SkCanvas is supplied by a call to SkPictureRecorder::beginRecording,
|
| + // which does not transfer ownership. For this reason, we hold a raw
|
| + // pointer and manually set the SkCanvas to null in clearSkCanvas.
|
| SkCanvas* m_canvas;
|
| };
|
|
|
|
|