OLD | NEW |
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 |
(...skipping 30 matching lines...) Expand all Loading... |
41 @param width the width of the cull rect used when recording this picture
. | 41 @param width the width of the cull rect used when recording this picture
. |
42 @param height the height of the cull rect used when recording this pictu
re. | 42 @param height the height of the cull rect used when recording this pictu
re. |
43 @param bbhFactory factory to create desired acceleration structure | 43 @param bbhFactory factory to create desired acceleration structure |
44 @param recordFlags optional flags that control recording. | 44 @param recordFlags optional flags that control recording. |
45 @return the canvas. | 45 @return the canvas. |
46 */ | 46 */ |
47 SkCanvas* beginRecording(SkScalar width, SkScalar height, | 47 SkCanvas* beginRecording(SkScalar width, SkScalar height, |
48 SkBBHFactory* bbhFactory = NULL, | 48 SkBBHFactory* bbhFactory = NULL, |
49 uint32_t recordFlags = 0); | 49 uint32_t recordFlags = 0); |
50 | 50 |
51 // As usual, we have a deprecated old version and a maybe almost working | |
52 // new version. We currently point beginRecording() to EXPERIMENTAL_beginRe
cording(). | |
53 | |
54 // Old slower backend. | |
55 SkCanvas* DEPRECATED_beginRecording(SkScalar width, SkScalar height, | |
56 SkBBHFactory* bbhFactory = NULL, | |
57 uint32_t recordFlags = 0); | |
58 | |
59 // New faster backend. | |
60 SkCanvas* EXPERIMENTAL_beginRecording(SkScalar width, SkScalar height, | |
61 SkBBHFactory* bbhFactory = NULL); | |
62 | |
63 /** Returns the recording canvas if one is active, or NULL if recording is | 51 /** Returns the recording canvas if one is active, or NULL if recording is |
64 not active. This does not alter the refcnt on the canvas (if present). | 52 not active. This does not alter the refcnt on the canvas (if present). |
65 */ | 53 */ |
66 SkCanvas* getRecordingCanvas(); | 54 SkCanvas* getRecordingCanvas(); |
67 | 55 |
68 /** Signal that the caller is done recording. This invalidates the canvas | 56 /** Signal that the caller is done recording. This invalidates the canvas |
69 returned by beginRecording/getRecordingCanvas, and returns the | 57 returned by beginRecording/getRecordingCanvas, and returns the |
70 created SkPicture. Note that the returned picture has its creation | 58 created SkPicture. Note that the returned picture has its creation |
71 ref which the caller must take ownership of. | 59 ref which the caller must take ownership of. |
72 */ | 60 */ |
73 SkPicture* endRecording(); | 61 SkPicture* endRecording(); |
74 | 62 |
75 private: | 63 private: |
76 void reset(); | 64 void reset(); |
77 | 65 |
78 /** Replay the current (partially recorded) operation stream into | 66 /** Replay the current (partially recorded) operation stream into |
79 canvas. This call doesn't close the current recording. | 67 canvas. This call doesn't close the current recording. |
80 */ | 68 */ |
81 #ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK | 69 #ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK |
82 friend class android::Picture; | 70 friend class android::Picture; |
83 #endif | 71 #endif |
84 friend class SkPictureRecorderReplayTester; // for unit testing | 72 friend class SkPictureRecorderReplayTester; // for unit testing |
85 void partialReplay(SkCanvas* canvas) const; | 73 void partialReplay(SkCanvas* canvas) const; |
86 | 74 |
87 SkScalar fCullWidth; | 75 SkScalar fCullWidth; |
88 SkScalar fCullHeight; | 76 SkScalar fCullHeight; |
89 SkAutoTUnref<SkBBoxHierarchy> fBBH; | 77 SkAutoTUnref<SkBBoxHierarchy> fBBH; |
90 | 78 SkAutoTUnref<SkRecorder> fRecorder; |
91 // One of these two canvases will be non-NULL. | 79 SkAutoTDelete<SkRecord> fRecord; |
92 SkAutoTUnref<SkPictureRecord> fPictureRecord; // beginRecording() | |
93 SkAutoTUnref<SkRecorder> fRecorder; // EXPERIMENTAL_beginRecordin
g() | |
94 | |
95 // Used by EXPERIMENTAL_beginRecording(). | |
96 SkAutoTDelete<SkRecord> fRecord; | |
97 | 80 |
98 typedef SkNoncopyable INHERITED; | 81 typedef SkNoncopyable INHERITED; |
99 }; | 82 }; |
100 | 83 |
101 #endif | 84 #endif |
OLD | NEW |