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

Side by Side Diff: include/record/SkRecording.h

Issue 233053005: Add a focused public API for src/record. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: wrap in EXPERIMENTAL Created 6 years, 8 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 #ifndef SkRecording_DEFINED
robertphillips 2014/04/11 13:28:08 Header?
2 #define SkRecording_DEFINED
3
4 #include "SkCanvas.h" // SkCanvas
5 #include "SkTypes.h" // SkNoncopyable
6
7 // These are intentionally left opaque.
8 class SkRecord;
9 class SkRecorder;
10
11 namespace EXPERIMENTAL {
12
13 /** Easy mode interface to SkRecord-based SkCanvas recording.
14 *
15 * SkRecording* recording = SkRecording::Create(1920, 1080);
16 *
17 * SkCanvas* canvas = recording->canvas();
18 * canvas->drawThis();
19 * canvas->clipThat();
20 * ...
21 *
22 * scoped_ptr<const SkPlayback> playback(SkRecording::Delete(recording));
23 * playback->draw(&someCanvas);
24 * playback->draw(&someOtherCanvas);
25 *
26 * SkPlayback is thread safe; SkRecording is not.
27 */
28
29 class SkPlayback : SkNoncopyable {
30 public:
31 // Remember, if you've got an SkPlayback*, you probably own it. Don't forge t to delete it!
32 ~SkPlayback();
33
34 // Draw recorded commands into a canvas.
35 void draw(SkCanvas*) const;
36
37 private:
38 explicit SkPlayback(const SkRecord*);
39
40 const SkRecord* fRecord;
41
42 friend class SkRecording;
43 };
44
45 class SkRecording : SkNoncopyable {
46 public:
47 // Result must be returned via SkRecording::Delete.
48 static SkRecording* Create(int width, int height);
49
50 // Caller takes ownership of SkPlayback.
51 static const SkPlayback* Delete(SkRecording*);
52
53 // Draws issued to this canvas will be replayed by SkPlayback::draw().
54 // This pointer is owned by the SkRecording; the caller must not take owners hip.
55 SkCanvas* canvas();
56
57 private:
58 SkRecording(int width, int height);
59 ~SkRecording();
60
61 SkRecorder* fRecorder;
62 const SkRecord* fRecord;
63 };
64
65 } // namespace EXPERIMENTAL
66
67 #endif//SkRecording_DEFINED
OLDNEW
« no previous file with comments | « gyp/tests.gypi ('k') | src/record/SkRecording.cpp » ('j') | src/record/SkRecording.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698