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

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

Issue 1221583003: Add APIs for dynamic display lists, using SkDrawable and SkPictureRecorder::endRecordingAsDrawable. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: 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/Picture.h" 7 #include "sky/engine/core/painting/Picture.h"
7 #include "sky/engine/core/painting/PictureRecorder.h" 8 #include "sky/engine/core/painting/PictureRecorder.h"
8 9
9 namespace blink { 10 namespace blink {
10 11
11 PictureRecorder::PictureRecorder() 12 PictureRecorder::PictureRecorder()
12 : m_pictureRecorder(adoptPtr(new SkPictureRecorder())) 13 : m_pictureRecorder(adoptPtr(new SkPictureRecorder()))
13 { 14 {
14 } 15 }
15 16
(...skipping 14 matching lines...) Expand all
30 { 31 {
31 if (!isRecording()) 32 if (!isRecording())
32 return nullptr; 33 return nullptr;
33 RefPtr<Picture> picture = Picture::create( 34 RefPtr<Picture> picture = Picture::create(
34 adoptRef(m_pictureRecorder->endRecording())); 35 adoptRef(m_pictureRecorder->endRecording()));
35 m_canvas->clearSkCanvas(); 36 m_canvas->clearSkCanvas();
36 m_canvas = nullptr; 37 m_canvas = nullptr;
37 return picture.release(); 38 return picture.release();
38 } 39 }
39 40
41 PassRefPtr<Drawable> PictureRecorder::endRecordingAsDrawable()
42 {
43 if (!isRecording())
44 return nullptr;
45 RefPtr<Drawable> drawable = Drawable::create(
46 adoptRef(m_pictureRecorder->endRecordingAsDrawable()));
47 m_canvas->clearSkCanvas();
48 m_canvas = nullptr;
49 return drawable.release();
50 }
51
40 void PictureRecorder::set_canvas(PassRefPtr<Canvas> canvas) { m_canvas = canvas; } 52 void PictureRecorder::set_canvas(PassRefPtr<Canvas> canvas) { m_canvas = canvas; }
41 53
42 } // namespace blink 54 } // namespace blink
OLDNEW
« no previous file with comments | « sky/engine/core/painting/PictureRecorder.h ('k') | sky/engine/core/painting/PictureRecorder.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698