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 SkRecorder_DEFINED | 8 #ifndef SkRecorder_DEFINED |
9 #define SkRecorder_DEFINED | 9 #define SkRecorder_DEFINED |
10 | 10 |
11 #include "SkCanvas.h" | 11 #include "SkCanvas.h" |
12 #include "SkRecord.h" | 12 #include "SkRecord.h" |
13 #include "SkRecords.h" | 13 #include "SkRecords.h" |
14 #include "SkTDArray.h" | 14 #include "SkTDArray.h" |
15 | 15 |
| 16 class SkBBHFactory; |
| 17 |
| 18 class SkCanvasDrawableList : SkNoncopyable { |
| 19 public: |
| 20 ~SkCanvasDrawableList(); |
| 21 |
| 22 int count() const { return fArray.count(); } |
| 23 SkCanvasDrawable* const* begin() const { return fArray.begin(); } |
| 24 |
| 25 void append(SkCanvasDrawable* drawable); |
| 26 |
| 27 // Return a new or ref'd array of pictures that were snapped from our drawab
les. |
| 28 SkPicture::SnapshotArray* newDrawableSnapshot(); |
| 29 |
| 30 private: |
| 31 SkTDArray<SkCanvasDrawable*> fArray; |
| 32 }; |
| 33 |
16 // SkRecorder provides an SkCanvas interface for recording into an SkRecord. | 34 // SkRecorder provides an SkCanvas interface for recording into an SkRecord. |
17 | 35 |
18 class SkRecorder : public SkCanvas { | 36 class SkRecorder : public SkCanvas { |
19 public: | 37 public: |
20 // Does not take ownership of the SkRecord. | 38 // Does not take ownership of the SkRecord. |
21 SkRecorder(SkRecord*, int width, int height); // legacy version | 39 SkRecorder(SkRecord*, int width, int height); // legacy version |
22 SkRecorder(SkRecord*, const SkRect& bounds); | 40 SkRecorder(SkRecord*, const SkRect& bounds); |
23 virtual ~SkRecorder() SK_OVERRIDE; | |
24 | 41 |
25 // Return a new or ref'd array of pictures that were snapped from our drawab
les. | 42 SkCanvasDrawableList* getDrawableList() const { return fDrawableList.get();
} |
26 SkPicture::SnapshotArray* newDrawableSnapshot(SkBBHFactory*, uint32_t record
Flags); | 43 SkCanvasDrawableList* detachDrawableList() { return fDrawableList.detach();
} |
27 | 44 |
28 // Make SkRecorder forget entirely about its SkRecord*; all calls to SkRecor
der will fail. | 45 // Make SkRecorder forget entirely about its SkRecord*; all calls to SkRecor
der will fail. |
29 void forgetRecord(); | 46 void forgetRecord(); |
30 | 47 |
31 void clear(SkColor) SK_OVERRIDE; | 48 void clear(SkColor) SK_OVERRIDE; |
32 void drawPaint(const SkPaint& paint) SK_OVERRIDE; | 49 void drawPaint(const SkPaint& paint) SK_OVERRIDE; |
33 void drawPoints(PointMode mode, | 50 void drawPoints(PointMode mode, |
34 size_t count, | 51 size_t count, |
35 const SkPoint pts[], | 52 const SkPoint pts[], |
36 const SkPaint& paint) SK_OVERRIDE; | 53 const SkPaint& paint) SK_OVERRIDE; |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 SkIRect devBounds() const { | 155 SkIRect devBounds() const { |
139 SkIRect devBounds; | 156 SkIRect devBounds; |
140 this->getClipDeviceBounds(&devBounds); | 157 this->getClipDeviceBounds(&devBounds); |
141 return devBounds; | 158 return devBounds; |
142 } | 159 } |
143 | 160 |
144 SkRecord* fRecord; | 161 SkRecord* fRecord; |
145 | 162 |
146 int fSaveLayerCount; | 163 int fSaveLayerCount; |
147 SkTDArray<SkBool8> fSaveIsSaveLayer; | 164 SkTDArray<SkBool8> fSaveIsSaveLayer; |
148 SkTDArray<SkCanvasDrawable*> fDrawableList; | 165 SkAutoTDelete<SkCanvasDrawableList> fDrawableList; |
149 }; | 166 }; |
150 | 167 |
151 #endif//SkRecorder_DEFINED | 168 #endif//SkRecorder_DEFINED |
OLD | NEW |