Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(621)

Side by Side Diff: sky/engine/core/painting/PaintingNode.cpp

Issue 1216833003: Make rendering use PaintingNodes for increased efficiency. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Cleanup and fixes for keeping stocks working Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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(PassRefPtr<SkDrawa ble> skDrawable)
12 {
13 return adoptRef(new PaintingNodeDrawable(skDrawable));
14 }
15
16 PaintingNodeDrawable::PaintingNodeDrawable(PassRefPtr<SkDrawable> skDrawable)
17 : m_drawable(skDrawable)
18 {
19 }
20
21 SkPicture* PaintingNodeDrawable::onNewPictureSnapshot()
22 {
23 if (!m_drawable)
24 return nullptr;
25 return m_drawable->newPictureSnapshot();
26 }
27
28 SkRect PaintingNodeDrawable::onGetBounds()
29 {
30 if (!m_drawable)
31 return SkRect::MakeEmpty();
32 return m_drawable->getBounds();
33 }
34
35 void PaintingNodeDrawable::onDraw(SkCanvas* canvas)
36 {
37 if (!m_drawable)
38 return;
39 return m_drawable->draw(canvas);
40 }
41
42
43
44
45 PassRefPtr<PaintingNode> PaintingNode::create()
46 {
47 return adoptRef(new PaintingNode());
48 }
49
50 PaintingNode::PaintingNode()
51 : m_paintingNodeDrawable(PaintingNodeDrawable::create())
52 {
53 }
54
55 PassRefPtr<Picture> PaintingNode::newPictureSnapshot()
56 {
57 ASSERT(m_paintingNodeDrawable);
58 return Picture::create(
59 adoptRef(m_paintingNodeDrawable->newPictureSnapshot()));
60 }
61
62 PaintingNode::~PaintingNode()
63 {
64 }
65
66 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698