| 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 kComputeSaveLayerInfo_RecordFlag = 0x01 | 43 kComputeSaveLayerInfo_RecordFlag = 0x01 |
| 44 }; | 44 }; |
| 45 | 45 |
| 46 /** Returns the canvas that records the drawing commands. | 46 /** Returns the canvas that records the drawing commands. |
| 47 @param width the width of the cull rect used when recording this picture
. | 47 @param width the width of the cull rect used when recording this picture
. |
| 48 @param height the height of the cull rect used when recording this pictu
re. | 48 @param height the height of the cull rect used when recording this pictu
re. |
| 49 @param bbhFactory factory to create desired acceleration structure | 49 @param bbhFactory factory to create desired acceleration structure |
| 50 @param recordFlags optional flags that control recording. | 50 @param recordFlags optional flags that control recording. |
| 51 @return the canvas. | 51 @return the canvas. |
| 52 */ | 52 */ |
| 53 SkCanvas* beginRecording(const SkRect& bounds, | 53 SkCanvas* beginRecording(SkScalar width, SkScalar height, |
| 54 SkBBHFactory* bbhFactory = NULL, | 54 SkBBHFactory* bbhFactory = NULL, |
| 55 uint32_t recordFlags = 0); | 55 uint32_t recordFlags = 0); |
| 56 | 56 |
| 57 SkCanvas* beginRecording(SkScalar width, SkScalar height, | |
| 58 SkBBHFactory* bbhFactory = NULL, | |
| 59 uint32_t recordFlags = 0) { | |
| 60 return this->beginRecording(SkRect::MakeWH(width, height), bbhFactory, r
ecordFlags); | |
| 61 } | |
| 62 | |
| 63 /** Returns the recording canvas if one is active, or NULL if recording is | 57 /** 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). | 58 not active. This does not alter the refcnt on the canvas (if present). |
| 65 */ | 59 */ |
| 66 SkCanvas* getRecordingCanvas(); | 60 SkCanvas* getRecordingCanvas(); |
| 67 | 61 |
| 68 /** Signal that the caller is done recording. This invalidates the canvas | 62 /** Signal that the caller is done recording. This invalidates the canvas |
| 69 returned by beginRecording/getRecordingCanvas, and returns the | 63 returned by beginRecording/getRecordingCanvas, and returns the |
| 70 created SkPicture. Note that the returned picture has its creation | 64 created SkPicture. Note that the returned picture has its creation |
| 71 ref which the caller must take ownership of. | 65 ref which the caller must take ownership of. |
| 72 */ | 66 */ |
| 73 SkPicture* endRecording(); | 67 SkPicture* endRecording(); |
| 74 | 68 |
| 75 private: | 69 private: |
| 76 void reset(); | 70 void reset(); |
| 77 | 71 |
| 78 /** Replay the current (partially recorded) operation stream into | 72 /** Replay the current (partially recorded) operation stream into |
| 79 canvas. This call doesn't close the current recording. | 73 canvas. This call doesn't close the current recording. |
| 80 */ | 74 */ |
| 81 #ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK | 75 #ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK |
| 82 friend class android::Picture; | 76 friend class android::Picture; |
| 83 #endif | 77 #endif |
| 84 friend class SkPictureRecorderReplayTester; // for unit testing | 78 friend class SkPictureRecorderReplayTester; // for unit testing |
| 85 void partialReplay(SkCanvas* canvas) const; | 79 void partialReplay(SkCanvas* canvas) const; |
| 86 | 80 |
| 87 uint32_t fFlags; | 81 uint32_t fFlags; |
| 88 SkRect fCullRect; | 82 SkScalar fCullWidth; |
| 83 SkScalar fCullHeight; |
| 89 SkAutoTUnref<SkBBoxHierarchy> fBBH; | 84 SkAutoTUnref<SkBBoxHierarchy> fBBH; |
| 90 SkAutoTUnref<SkRecorder> fRecorder; | 85 SkAutoTUnref<SkRecorder> fRecorder; |
| 91 SkAutoTDelete<SkRecord> fRecord; | 86 SkAutoTDelete<SkRecord> fRecord; |
| 92 | 87 |
| 93 typedef SkNoncopyable INHERITED; | 88 typedef SkNoncopyable INHERITED; |
| 94 }; | 89 }; |
| 95 | 90 |
| 96 #endif | 91 #endif |
| OLD | NEW |