Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "sky/engine/core/painting/PaintingNode.h" | |
| 6 #include "sky/engine/core/painting/Picture.h" | |
| 7 | |
| 8 namespace blink { | |
| 9 | |
| 10 // static | |
| 11 PassRefPtr<PaintingNodeDrawable> PaintingNodeDrawable::create() | |
| 12 { | |
| 13 return adoptRef(new PaintingNodeDrawable()); | |
| 14 } | |
| 15 | |
| 16 PassRefPtr<PaintingNodeDrawable> PaintingNodeDrawable::create(PassRefPtr<SkDrawa ble> skDrawable) | |
| 17 { | |
| 18 return adoptRef(new PaintingNodeDrawable(skDrawable)); | |
| 19 } | |
| 20 | |
| 21 PaintingNodeDrawable::PaintingNodeDrawable() | |
| 22 : m_drawable(nullptr) | |
| 23 { | |
| 24 } | |
| 25 | |
| 26 PaintingNodeDrawable::PaintingNodeDrawable(PassRefPtr<SkDrawable> skDrawable) | |
| 27 : m_drawable(skDrawable) | |
| 28 { | |
| 29 } | |
|
abarth-chromium
2015/07/06 20:50:57
Rather than having two constructors, we could just
iansf
2015/07/07 21:11:22
Done.
| |
| 30 | |
| 31 SkPicture* PaintingNodeDrawable::onNewPictureSnapshot() | |
| 32 { | |
| 33 if (!m_drawable) | |
| 34 return nullptr; | |
| 35 return m_drawable->newPictureSnapshot(); | |
| 36 } | |
| 37 | |
| 38 SkRect PaintingNodeDrawable::onGetBounds() | |
| 39 { | |
| 40 if (!m_drawable) | |
| 41 return SkRect::MakeEmpty(); | |
| 42 return m_drawable->getBounds(); | |
| 43 } | |
| 44 | |
| 45 void PaintingNodeDrawable::onDraw(SkCanvas* canvas) | |
| 46 { | |
| 47 if (!m_drawable) | |
| 48 return; | |
| 49 return m_drawable->draw(canvas); | |
| 50 } | |
| 51 | |
| 52 | |
| 53 | |
| 54 | |
| 55 PassRefPtr<PaintingNode> PaintingNode::create() | |
| 56 { | |
| 57 return adoptRef(new PaintingNode()); | |
| 58 } | |
| 59 | |
| 60 PaintingNode::PaintingNode() | |
| 61 : m_paintingNodeDrawable(PaintingNodeDrawable::create()) | |
| 62 { | |
| 63 } | |
| 64 | |
| 65 PassRefPtr<Picture> PaintingNode::newPictureSnapshot() | |
| 66 { | |
| 67 assert(m_paintingNodeDrawable); | |
|
abarth-chromium
2015/07/06 20:50:57
s/assert/ASSERT/
ASSERT is a macro we define that
iansf
2015/07/07 20:36:47
Done.
| |
| 68 return Picture::create( | |
| 69 adoptRef(m_paintingNodeDrawable->newPictureSnapshot())); | |
| 70 } | |
| 71 | |
| 72 PaintingNode::~PaintingNode() | |
| 73 { | |
| 74 } | |
| 75 | |
| 76 } // namespace blink | |
| OLD | NEW |