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 |
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 class SkCanvas; | 15 class SkCanvas; |
16 | 16 |
17 class SK_API SkPictureRecorder : SkNoncopyable { | 17 class SK_API SkPictureRecorder : SkNoncopyable { |
18 public: | 18 public: |
19 /** Returns the canvas that records the drawing commands. | 19 /** Returns the canvas that records the drawing commands. |
20 @param width the base width for the picture, as if the recording | 20 @param width the base width for the picture, as if the recording |
21 canvas' bitmap had this width. | 21 canvas' bitmap had this width. |
22 @param height the base width for the picture, as if the recording | 22 @param height the base width for the picture, as if the recording |
23 canvas' bitmap had this height. | 23 canvas' bitmap had this height. |
24 @param bbhFactory factory to create desired acceleration structure | 24 @param bbhFactory factory to create desired acceleration structure |
25 @param recordFlags optional flags that control recording. | 25 @param recordFlags optional flags that control recording. |
26 @return the canvas. | 26 @return the canvas. |
27 */ | 27 */ |
28 // TODO: allow default parameters once the other beginRecoding entry point i
s gone | |
29 SkCanvas* beginRecording(int width, int height, | 28 SkCanvas* beginRecording(int width, int height, |
30 SkBBHFactory* bbhFactory /* = NULL */, | 29 SkBBHFactory* bbhFactory = NULL, |
31 uint32_t recordFlags /* = 0 */); | 30 uint32_t recordFlags = 0); |
32 | 31 |
33 /** Returns the recording canvas if one is active, or NULL if recording is | 32 /** Returns the recording canvas if one is active, or NULL if recording is |
34 not active. This does not alter the refcnt on the canvas (if present). | 33 not active. This does not alter the refcnt on the canvas (if present). |
35 */ | 34 */ |
36 SkCanvas* getRecordingCanvas() { | 35 SkCanvas* getRecordingCanvas() { |
37 if (NULL != fPicture.get()) { | 36 if (NULL != fPicture.get()) { |
38 return fPicture->getRecordingCanvas(); | 37 return fPicture->getRecordingCanvas(); |
39 } | 38 } |
40 return NULL; | 39 return NULL; |
41 } | 40 } |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 friend class SkPictureRecorderReplayTester; // for unit testing | 73 friend class SkPictureRecorderReplayTester; // for unit testing |
75 void partialReplay(SkCanvas* canvas) const; | 74 void partialReplay(SkCanvas* canvas) const; |
76 #endif | 75 #endif |
77 | 76 |
78 SkAutoTUnref<SkPicture> fPicture; | 77 SkAutoTUnref<SkPicture> fPicture; |
79 | 78 |
80 typedef SkNoncopyable INHERITED; | 79 typedef SkNoncopyable INHERITED; |
81 }; | 80 }; |
82 | 81 |
83 #endif | 82 #endif |
OLD | NEW |