| Index: sky/engine/core/painting/PaintingNode.cpp
|
| diff --git a/sky/engine/core/painting/PaintingNode.cpp b/sky/engine/core/painting/PaintingNode.cpp
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..2c7d7c57929d0a3dd910c741d3d77d97d3494eb7
|
| --- /dev/null
|
| +++ b/sky/engine/core/painting/PaintingNode.cpp
|
| @@ -0,0 +1,66 @@
|
| +// Copyright 2015 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#include "sky/engine/core/painting/PaintingNode.h"
|
| +#include "sky/engine/core/painting/Picture.h"
|
| +
|
| +namespace blink {
|
| +
|
| +// static
|
| +PassRefPtr<PaintingNodeDrawable> PaintingNodeDrawable::create(PassRefPtr<SkDrawable> skDrawable)
|
| +{
|
| + return adoptRef(new PaintingNodeDrawable(skDrawable));
|
| +}
|
| +
|
| +PaintingNodeDrawable::PaintingNodeDrawable(PassRefPtr<SkDrawable> skDrawable)
|
| + : m_drawable(skDrawable)
|
| +{
|
| +}
|
| +
|
| +SkPicture* PaintingNodeDrawable::onNewPictureSnapshot()
|
| +{
|
| + if (!m_drawable)
|
| + return nullptr;
|
| + return m_drawable->newPictureSnapshot();
|
| +}
|
| +
|
| +SkRect PaintingNodeDrawable::onGetBounds()
|
| +{
|
| + if (!m_drawable)
|
| + return SkRect::MakeEmpty();
|
| + return m_drawable->getBounds();
|
| +}
|
| +
|
| +void PaintingNodeDrawable::onDraw(SkCanvas* canvas)
|
| +{
|
| + if (!m_drawable)
|
| + return;
|
| + return m_drawable->draw(canvas);
|
| +}
|
| +
|
| +
|
| +
|
| +
|
| +PassRefPtr<PaintingNode> PaintingNode::create()
|
| +{
|
| + return adoptRef(new PaintingNode());
|
| +}
|
| +
|
| +PaintingNode::PaintingNode()
|
| + : m_paintingNodeDrawable(PaintingNodeDrawable::create())
|
| +{
|
| +}
|
| +
|
| +PassRefPtr<Picture> PaintingNode::newPictureSnapshot()
|
| +{
|
| + ASSERT(m_paintingNodeDrawable);
|
| + return Picture::create(
|
| + adoptRef(m_paintingNodeDrawable->newPictureSnapshot()));
|
| +}
|
| +
|
| +PaintingNode::~PaintingNode()
|
| +{
|
| +}
|
| +
|
| +} // namespace blink
|
|
|