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 17 matching lines...) Expand all Loading... |
28 | 28 |
29 class SkPictureRecord : public SkCanvas { | 29 class SkPictureRecord : public SkCanvas { |
30 public: | 30 public: |
31 SkPictureRecord(const SkISize& dimensions, uint32_t recordFlags); | 31 SkPictureRecord(const SkISize& dimensions, uint32_t recordFlags); |
32 virtual ~SkPictureRecord(); | 32 virtual ~SkPictureRecord(); |
33 | 33 |
34 const SkTDArray<const SkPicture* >& getPictureRefs() const { | 34 const SkTDArray<const SkPicture* >& getPictureRefs() const { |
35 return fPictureRefs; | 35 return fPictureRefs; |
36 } | 36 } |
37 | 37 |
38 const SkTDArray<SkDrawable* >& getDrawableRefs() const { | |
39 return fDrawableRefs; | |
40 } | |
41 | |
42 const SkTDArray<const SkTextBlob* >& getTextBlobRefs() const { | 38 const SkTDArray<const SkTextBlob* >& getTextBlobRefs() const { |
43 return fTextBlobRefs; | 39 return fTextBlobRefs; |
44 } | 40 } |
45 | 41 |
46 const SkTDArray<const SkImage* >& getImageRefs() const { | 42 const SkTDArray<const SkImage* >& getImageRefs() const { |
47 return fImageRefs; | 43 return fImageRefs; |
48 } | 44 } |
49 | 45 |
50 sk_sp<SkData> opData(bool deepCopy) const { | 46 sk_sp<SkData> opData(bool deepCopy) const { |
51 this->validate(fWriter.bytesWritten(), 0); | 47 this->validate(fWriter.bytesWritten(), 0); |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 } | 124 } |
129 | 125 |
130 void addBitmap(const SkBitmap& bitmap); | 126 void addBitmap(const SkBitmap& bitmap); |
131 void addImage(const SkImage*); | 127 void addImage(const SkImage*); |
132 void addMatrix(const SkMatrix& matrix); | 128 void addMatrix(const SkMatrix& matrix); |
133 void addPaint(const SkPaint& paint) { this->addPaintPtr(&paint); } | 129 void addPaint(const SkPaint& paint) { this->addPaintPtr(&paint); } |
134 void addPaintPtr(const SkPaint* paint); | 130 void addPaintPtr(const SkPaint* paint); |
135 void addPatch(const SkPoint cubics[12]); | 131 void addPatch(const SkPoint cubics[12]); |
136 void addPath(const SkPath& path); | 132 void addPath(const SkPath& path); |
137 void addPicture(const SkPicture* picture); | 133 void addPicture(const SkPicture* picture); |
138 void addDrawable(SkDrawable* picture); | |
139 void addPoint(const SkPoint& point); | 134 void addPoint(const SkPoint& point); |
140 void addPoints(const SkPoint pts[], int count); | 135 void addPoints(const SkPoint pts[], int count); |
141 void addRect(const SkRect& rect); | 136 void addRect(const SkRect& rect); |
142 void addRectPtr(const SkRect* rect); | 137 void addRectPtr(const SkRect* rect); |
143 void addIRect(const SkIRect& rect); | 138 void addIRect(const SkIRect& rect); |
144 void addIRectPtr(const SkIRect* rect); | 139 void addIRectPtr(const SkIRect* rect); |
145 void addRRect(const SkRRect&); | 140 void addRRect(const SkRRect&); |
146 void addRegion(const SkRegion& region); | 141 void addRegion(const SkRegion& region); |
147 void addText(const void* text, size_t byteLength); | 142 void addText(const void* text, size_t byteLength); |
148 void addTextBlob(const SkTextBlob* blob); | 143 void addTextBlob(const SkTextBlob* blob); |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 const SkColor colors[], SkXfermode* xmode, | 197 const SkColor colors[], SkXfermode* xmode, |
203 const uint16_t indices[], int indexCount, | 198 const uint16_t indices[], int indexCount, |
204 const SkPaint&) override; | 199 const SkPaint&) override; |
205 | 200 |
206 void onClipRect(const SkRect&, SkRegion::Op, ClipEdgeStyle) override; | 201 void onClipRect(const SkRect&, SkRegion::Op, ClipEdgeStyle) override; |
207 void onClipRRect(const SkRRect&, SkRegion::Op, ClipEdgeStyle) override; | 202 void onClipRRect(const SkRRect&, SkRegion::Op, ClipEdgeStyle) override; |
208 void onClipPath(const SkPath&, SkRegion::Op, ClipEdgeStyle) override; | 203 void onClipPath(const SkPath&, SkRegion::Op, ClipEdgeStyle) override; |
209 void onClipRegion(const SkRegion&, SkRegion::Op) override; | 204 void onClipRegion(const SkRegion&, SkRegion::Op) override; |
210 | 205 |
211 void onDrawPicture(const SkPicture*, const SkMatrix*, const SkPaint*) overri
de; | 206 void onDrawPicture(const SkPicture*, const SkMatrix*, const SkPaint*) overri
de; |
212 void onDrawDrawable(SkDrawable*, const SkMatrix*) override; | |
213 void onDrawAnnotation(const SkRect&, const char[], SkData*) override; | 207 void onDrawAnnotation(const SkRect&, const char[], SkData*) override; |
214 | 208 |
215 int addPathToHeap(const SkPath& path); // does not write to ops stream | 209 int addPathToHeap(const SkPath& path); // does not write to ops stream |
216 | 210 |
217 // These entry points allow the writing of matrices, clips, saves & | 211 // These entry points allow the writing of matrices, clips, saves & |
218 // restores to be deferred (e.g., if the MC state is being collapsed and | 212 // restores to be deferred (e.g., if the MC state is being collapsed and |
219 // only written out as needed). | 213 // only written out as needed). |
220 void recordConcat(const SkMatrix& matrix); | 214 void recordConcat(const SkMatrix& matrix); |
221 void recordTranslate(const SkMatrix& matrix); | 215 void recordTranslate(const SkMatrix& matrix); |
222 void recordScale(const SkMatrix& matrix); | 216 void recordScale(const SkMatrix& matrix); |
(...skipping 14 matching lines...) Expand all Loading... |
237 struct PathHash { | 231 struct PathHash { |
238 uint32_t operator()(const SkPath& p) { return p.getGenerationID(); } | 232 uint32_t operator()(const SkPath& p) { return p.getGenerationID(); } |
239 }; | 233 }; |
240 SkTHashMap<SkPath, int, PathHash> fPaths; | 234 SkTHashMap<SkPath, int, PathHash> fPaths; |
241 | 235 |
242 SkWriter32 fWriter; | 236 SkWriter32 fWriter; |
243 | 237 |
244 // we ref each item in these arrays | 238 // we ref each item in these arrays |
245 SkTDArray<const SkImage*> fImageRefs; | 239 SkTDArray<const SkImage*> fImageRefs; |
246 SkTDArray<const SkPicture*> fPictureRefs; | 240 SkTDArray<const SkPicture*> fPictureRefs; |
247 SkTDArray<SkDrawable*> fDrawableRefs; | |
248 SkTDArray<const SkTextBlob*> fTextBlobRefs; | 241 SkTDArray<const SkTextBlob*> fTextBlobRefs; |
249 | 242 |
250 uint32_t fRecordFlags; | 243 uint32_t fRecordFlags; |
251 int fInitialSaveCount; | 244 int fInitialSaveCount; |
252 | 245 |
253 friend class SkPictureData; // for SkPictureData's SkPictureRecord-based c
onstructor | 246 friend class SkPictureData; // for SkPictureData's SkPictureRecord-based c
onstructor |
254 | 247 |
255 typedef SkCanvas INHERITED; | 248 typedef SkCanvas INHERITED; |
256 }; | 249 }; |
257 | 250 |
258 #endif | 251 #endif |
OLD | NEW |