Chromium Code Reviews| 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 24 matching lines...) Expand all Loading... | |
| 35 return this->beginRecording(SkIntToScalar(width), SkIntToScalar(height), | 35 return this->beginRecording(SkIntToScalar(width), SkIntToScalar(height), |
| 36 bbhFactory, recordFlags); | 36 bbhFactory, recordFlags); |
| 37 } | 37 } |
| 38 #endif | 38 #endif |
| 39 | 39 |
| 40 enum RecordFlags { | 40 enum RecordFlags { |
| 41 // This flag indicates that, if some BHH is being computed, saveLayer | 41 // This flag indicates that, if some BHH is being computed, saveLayer |
| 42 // information should also be extracted at the same time. | 42 // information should also be extracted at the same time. |
| 43 kComputeSaveLayerInfo_RecordFlag = 0x01 | 43 kComputeSaveLayerInfo_RecordFlag = 0x01 |
| 44 }; | 44 }; |
| 45 | 45 |
|
robertphillips
2014/11/19 14:57:21
comment change needed ?
| |
| 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, | |
| 54 SkBBHFactory* bbhFactory = NULL, | |
| 55 uint32_t recordFlags = 0); | |
| 56 | |
| 53 SkCanvas* beginRecording(SkScalar width, SkScalar height, | 57 SkCanvas* beginRecording(SkScalar width, SkScalar height, |
| 54 SkBBHFactory* bbhFactory = NULL, | 58 SkBBHFactory* bbhFactory = NULL, |
| 55 uint32_t recordFlags = 0); | 59 uint32_t recordFlags = 0) { |
| 60 return this->beginRecording(SkRect::MakeWH(width, height), bbhFactory, r ecordFlags); | |
| 61 } | |
| 56 | 62 |
| 57 /** Returns the recording canvas if one is active, or NULL if recording is | 63 /** Returns the recording canvas if one is active, or NULL if recording is |
| 58 not active. This does not alter the refcnt on the canvas (if present). | 64 not active. This does not alter the refcnt on the canvas (if present). |
| 59 */ | 65 */ |
| 60 SkCanvas* getRecordingCanvas(); | 66 SkCanvas* getRecordingCanvas(); |
| 61 | 67 |
| 62 /** Signal that the caller is done recording. This invalidates the canvas | 68 /** Signal that the caller is done recording. This invalidates the canvas |
| 63 returned by beginRecording/getRecordingCanvas, and returns the | 69 returned by beginRecording/getRecordingCanvas, and returns the |
| 64 created SkPicture. Note that the returned picture has its creation | 70 created SkPicture. Note that the returned picture has its creation |
| 65 ref which the caller must take ownership of. | 71 ref which the caller must take ownership of. |
| 66 */ | 72 */ |
| 67 SkPicture* endRecording(); | 73 SkPicture* endRecording(); |
| 68 | 74 |
| 69 private: | 75 private: |
| 70 void reset(); | 76 void reset(); |
| 71 | 77 |
| 72 /** Replay the current (partially recorded) operation stream into | 78 /** Replay the current (partially recorded) operation stream into |
| 73 canvas. This call doesn't close the current recording. | 79 canvas. This call doesn't close the current recording. |
| 74 */ | 80 */ |
| 75 #ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK | 81 #ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK |
| 76 friend class android::Picture; | 82 friend class android::Picture; |
| 77 #endif | 83 #endif |
| 78 friend class SkPictureRecorderReplayTester; // for unit testing | 84 friend class SkPictureRecorderReplayTester; // for unit testing |
| 79 void partialReplay(SkCanvas* canvas) const; | 85 void partialReplay(SkCanvas* canvas) const; |
| 80 | 86 |
| 81 uint32_t fFlags; | 87 uint32_t fFlags; |
| 82 SkScalar fCullWidth; | 88 SkRect fCullRect; |
| 83 SkScalar fCullHeight; | |
| 84 SkAutoTUnref<SkBBoxHierarchy> fBBH; | 89 SkAutoTUnref<SkBBoxHierarchy> fBBH; |
| 85 SkAutoTUnref<SkRecorder> fRecorder; | 90 SkAutoTUnref<SkRecorder> fRecorder; |
| 86 SkAutoTDelete<SkRecord> fRecord; | 91 SkAutoTDelete<SkRecord> fRecord; |
| 87 | 92 |
| 88 typedef SkNoncopyable INHERITED; | 93 typedef SkNoncopyable INHERITED; |
| 89 }; | 94 }; |
| 90 | 95 |
| 91 #endif | 96 #endif |
| OLD | NEW |