OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 SkPictureRecord_DEFINED | 8 #ifndef SkPictureRecord_DEFINED |
9 #define SkPictureRecord_DEFINED | 9 #define SkPictureRecord_DEFINED |
10 | 10 |
(...skipping 19 matching lines...) Expand all Loading... |
30 virtual ~SkPictureRecord(); | 30 virtual ~SkPictureRecord(); |
31 | 31 |
32 const SkTDArray<const SkPicture* >& getPictureRefs() const { | 32 const SkTDArray<const SkPicture* >& getPictureRefs() const { |
33 return fPictureRefs; | 33 return fPictureRefs; |
34 } | 34 } |
35 | 35 |
36 const SkTDArray<const SkTextBlob* >& getTextBlobRefs() const { | 36 const SkTDArray<const SkTextBlob* >& getTextBlobRefs() const { |
37 return fTextBlobRefs; | 37 return fTextBlobRefs; |
38 } | 38 } |
39 | 39 |
| 40 const SkTDArray<const SkImage* >& getImageRefs() const { |
| 41 return fImageRefs; |
| 42 } |
| 43 |
40 SkData* opData(bool deepCopy) const { | 44 SkData* opData(bool deepCopy) const { |
41 this->validate(fWriter.bytesWritten(), 0); | 45 this->validate(fWriter.bytesWritten(), 0); |
42 | 46 |
43 if (fWriter.bytesWritten() == 0) { | 47 if (fWriter.bytesWritten() == 0) { |
44 return SkData::NewEmpty(); | 48 return SkData::NewEmpty(); |
45 } | 49 } |
46 | 50 |
47 if (deepCopy) { | 51 if (deepCopy) { |
48 return SkData::NewWithCopy(fWriter.contiguousArray(), fWriter.bytesW
ritten()); | 52 return SkData::NewWithCopy(fWriter.contiguousArray(), fWriter.bytesW
ritten()); |
49 } | 53 } |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 } | 115 } |
112 | 116 |
113 void addInt(int value) { | 117 void addInt(int value) { |
114 fWriter.writeInt(value); | 118 fWriter.writeInt(value); |
115 } | 119 } |
116 void addScalar(SkScalar scalar) { | 120 void addScalar(SkScalar scalar) { |
117 fWriter.writeScalar(scalar); | 121 fWriter.writeScalar(scalar); |
118 } | 122 } |
119 | 123 |
120 void addBitmap(const SkBitmap& bitmap); | 124 void addBitmap(const SkBitmap& bitmap); |
| 125 void addImage(const SkImage*); |
121 void addMatrix(const SkMatrix& matrix); | 126 void addMatrix(const SkMatrix& matrix); |
122 void addPaint(const SkPaint& paint) { this->addPaintPtr(&paint); } | 127 void addPaint(const SkPaint& paint) { this->addPaintPtr(&paint); } |
123 void addPaintPtr(const SkPaint* paint); | 128 void addPaintPtr(const SkPaint* paint); |
124 void addPatch(const SkPoint cubics[12]); | 129 void addPatch(const SkPoint cubics[12]); |
125 void addPath(const SkPath& path); | 130 void addPath(const SkPath& path); |
126 void addPicture(const SkPicture* picture); | 131 void addPicture(const SkPicture* picture); |
127 void addPoint(const SkPoint& point); | 132 void addPoint(const SkPoint& point); |
128 void addPoints(const SkPoint pts[], int count); | 133 void addPoints(const SkPoint pts[], int count); |
129 void addRect(const SkRect& rect); | 134 void addRect(const SkRect& rect); |
130 void addRectPtr(const SkRect* rect); | 135 void addRectPtr(const SkRect* rect); |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 private: | 221 private: |
217 SkPictureContentInfo fContentInfo; | 222 SkPictureContentInfo fContentInfo; |
218 | 223 |
219 SkTArray<SkBitmap> fBitmaps; | 224 SkTArray<SkBitmap> fBitmaps; |
220 SkTArray<SkPaint> fPaints; | 225 SkTArray<SkPaint> fPaints; |
221 SkTArray<SkPath> fPaths; | 226 SkTArray<SkPath> fPaths; |
222 | 227 |
223 SkWriter32 fWriter; | 228 SkWriter32 fWriter; |
224 | 229 |
225 // we ref each item in these arrays | 230 // we ref each item in these arrays |
| 231 SkTDArray<const SkImage*> fImageRefs; |
226 SkTDArray<const SkPicture*> fPictureRefs; | 232 SkTDArray<const SkPicture*> fPictureRefs; |
227 SkTDArray<const SkTextBlob*> fTextBlobRefs; | 233 SkTDArray<const SkTextBlob*> fTextBlobRefs; |
228 | 234 |
229 uint32_t fRecordFlags; | 235 uint32_t fRecordFlags; |
230 int fInitialSaveCount; | 236 int fInitialSaveCount; |
231 | 237 |
232 friend class SkPictureData; // for SkPictureData's SkPictureRecord-based c
onstructor | 238 friend class SkPictureData; // for SkPictureData's SkPictureRecord-based c
onstructor |
233 | 239 |
234 typedef SkCanvas INHERITED; | 240 typedef SkCanvas INHERITED; |
235 }; | 241 }; |
236 | 242 |
237 #endif | 243 #endif |
OLD | NEW |