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

Side by Side Diff: include/core/SkPictureRecorder.h

Issue 344253005: Use smart pointers to make SkPictureRecorder lifetimes less manual. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: record Created 6 years, 6 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
« no previous file with comments | « no previous file | src/core/SkPictureRecorder.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2014 Google Inc. 2 * Copyright 2014 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #ifndef SkPictureRecorder_DEFINED 8 #ifndef SkPictureRecorder_DEFINED
9 #define SkPictureRecorder_DEFINED 9 #define SkPictureRecorder_DEFINED
10 10
11 #include "SkBBHFactory.h" 11 #include "SkBBHFactory.h"
12 #include "SkPicture.h" 12 #include "SkPicture.h"
13 #include "SkRefCnt.h" 13 #include "SkRefCnt.h"
14 14
15 #ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK 15 #ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK
16 namespace android { 16 namespace android {
17 class Picture; 17 class Picture;
18 }; 18 };
19 #endif 19 #endif
20 20
21 class SkCanvas; 21 class SkCanvas;
22 class SkPictureRecord; 22 class SkPictureRecord;
23 class SkRecord; 23 class SkRecord;
24 class SkRecorder; 24 class SkRecorder;
25 25
26 class SK_API SkPictureRecorder : SkNoncopyable { 26 class SK_API SkPictureRecorder : SkNoncopyable {
27 public: 27 public:
28 SkPictureRecorder() : fPictureRecord(NULL), fRecorder(NULL), fRecord(NULL) { } 28 SkPictureRecorder();
29 ~SkPictureRecorder(); 29 ~SkPictureRecorder();
30 30
31 /** Returns the canvas that records the drawing commands. 31 /** Returns the canvas that records the drawing commands.
32 @param width the base width for the picture, as if the recording 32 @param width the base width for the picture, as if the recording
33 canvas' bitmap had this width. 33 canvas' bitmap had this width.
34 @param height the base width for the picture, as if the recording 34 @param height the base width for the picture, as if the recording
35 canvas' bitmap had this height. 35 canvas' bitmap had this height.
36 @param bbhFactory factory to create desired acceleration structure 36 @param bbhFactory factory to create desired acceleration structure
37 @param recordFlags optional flags that control recording. 37 @param recordFlags optional flags that control recording.
38 @return the canvas. 38 @return the canvas.
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 70
71 /** Replay the current (partially recorded) operation stream into 71 /** Replay the current (partially recorded) operation stream into
72 canvas. This call doesn't close the current recording. 72 canvas. This call doesn't close the current recording.
73 */ 73 */
74 #ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK 74 #ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK
75 friend class android::Picture; 75 friend class android::Picture;
76 #endif 76 #endif
77 friend class SkPictureRecorderReplayTester; // for unit testing 77 friend class SkPictureRecorderReplayTester; // for unit testing
78 void partialReplay(SkCanvas* canvas) const; 78 void partialReplay(SkCanvas* canvas) const;
79 79
80 int fWidth; 80 int fWidth;
81 int fHeight; 81 int fHeight;
82 82
83 // Both ref counted. One of these two will be non-null: 83 // One of these two canvases will be non-NULL.
84 SkPictureRecord* fPictureRecord; // beginRecording() 84 SkAutoTUnref<SkPictureRecord> fPictureRecord; // beginRecording()
85 SkRecorder* fRecorder; // EXPERIMENTAL_beginRecording() 85 SkAutoTUnref<SkRecorder> fRecorder; // EXPERIMENTAL_beginRecordin g()
86 86
87 // Not refcounted. Used by EXPERIMENTAL_beginRecording(). 87 // Used by EXPERIMENTAL_beginRecording().
88 SkRecord* fRecord; 88 SkAutoTDelete<SkRecord> fRecord;
89 89
90 typedef SkNoncopyable INHERITED; 90 typedef SkNoncopyable INHERITED;
91 }; 91 };
92 92
93 #endif 93 #endif
OLDNEW
« no previous file with comments | « no previous file | src/core/SkPictureRecorder.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698