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

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

Issue 1216833003: Make rendering use PaintingNodes for increased efficiency. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Different approach to calling markNeedsPaint with unattached nodes 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
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 #include "sky/engine/core/painting/Canvas.h" 5 #include "sky/engine/core/painting/Canvas.h"
6 #include "sky/engine/core/painting/Drawable.h" 6 #include "sky/engine/core/painting/Drawable.h"
7 #include "sky/engine/core/painting/Picture.h" 7 #include "sky/engine/core/painting/Picture.h"
8 #include "sky/engine/core/painting/PictureRecorder.h" 8 #include "sky/engine/core/painting/PictureRecorder.h"
9 9
10 namespace blink { 10 namespace blink {
11 11
12 PictureRecorder::PictureRecorder() 12 PictureRecorder::PictureRecorder()
13 : m_pictureRecorder(adoptPtr(new SkPictureRecorder())) 13 : m_pictureRecorder(adoptPtr(new SkPictureRecorder()))
14 { 14 {
15 } 15 }
16 16
17 PictureRecorder::~PictureRecorder() 17 PictureRecorder::~PictureRecorder()
18 { 18 {
19 } 19 }
20 20
21 bool PictureRecorder::isRecording() { 21 bool PictureRecorder::isRecording() {
22 return m_canvas && m_canvas->isRecording(); 22 return m_canvas && m_canvas->isRecording();
23 } 23 }
24 24
25 SkCanvas* PictureRecorder::beginRecording(double width, double height) 25 SkCanvas* PictureRecorder::beginRecording(Rect bounds)
26 { 26 {
27 return m_pictureRecorder->beginRecording(width, height); 27 return m_pictureRecorder->beginRecording(bounds.sk_rect);
28 } 28 }
29 29
30 PassRefPtr<Picture> PictureRecorder::endRecording() 30 PassRefPtr<Picture> PictureRecorder::endRecording()
31 { 31 {
32 if (!isRecording()) 32 if (!isRecording())
33 return nullptr; 33 return nullptr;
34 RefPtr<Picture> picture = Picture::create( 34 RefPtr<Picture> picture = Picture::create(
35 adoptRef(m_pictureRecorder->endRecording())); 35 adoptRef(m_pictureRecorder->endRecording()));
36 m_canvas->clearSkCanvas(); 36 m_canvas->clearSkCanvas();
37 m_canvas = nullptr; 37 m_canvas = nullptr;
38 return picture.release(); 38 return picture.release();
39 } 39 }
40 40
41 PassRefPtr<Drawable> PictureRecorder::endRecordingAsDrawable() 41 PassRefPtr<Drawable> PictureRecorder::endRecordingAsDrawable()
42 { 42 {
43 if (!isRecording()) 43 if (!isRecording())
44 return nullptr; 44 return nullptr;
45 RefPtr<Drawable> drawable = Drawable::create( 45 RefPtr<Drawable> drawable = Drawable::create(
46 adoptRef(m_pictureRecorder->endRecordingAsDrawable())); 46 adoptRef(m_pictureRecorder->endRecordingAsDrawable()));
47 m_canvas->clearSkCanvas(); 47 m_canvas->clearSkCanvas();
48 m_canvas = nullptr; 48 m_canvas = nullptr;
49 return drawable.release(); 49 return drawable.release();
50 } 50 }
51 51
52 void PictureRecorder::set_canvas(PassRefPtr<Canvas> canvas) { m_canvas = canvas; } 52 void PictureRecorder::set_canvas(PassRefPtr<Canvas> canvas) { m_canvas = canvas; }
53 53
54 } // namespace blink 54 } // namespace blink
OLDNEW
« no previous file with comments | « sky/engine/core/painting/PictureRecorder.h ('k') | sky/engine/platform/graphics/DecodingImageGenerator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698