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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 virtual void endCommentGroup() SK_OVERRIDE; | 64 virtual void endCommentGroup() SK_OVERRIDE; |
65 virtual bool isDrawingToLayer() const SK_OVERRIDE; | 65 virtual bool isDrawingToLayer() const SK_OVERRIDE; |
66 | 66 |
67 void addFontMetricsTopBottom(const SkPaint& paint, const SkFlatData&, | 67 void addFontMetricsTopBottom(const SkPaint& paint, const SkFlatData&, |
68 SkScalar minY, SkScalar maxY); | 68 SkScalar minY, SkScalar maxY); |
69 | 69 |
70 const SkTDArray<const SkPicture* >& getPictureRefs() const { | 70 const SkTDArray<const SkPicture* >& getPictureRefs() const { |
71 return fPictureRefs; | 71 return fPictureRefs; |
72 } | 72 } |
73 | 73 |
| 74 const SkTDArray<const SkTextBlob* >& getTextBlobRefs() const { |
| 75 return fTextBlobRefs; |
| 76 } |
| 77 |
74 SkData* opData(bool deepCopy) const { | 78 SkData* opData(bool deepCopy) const { |
75 this->validate(fWriter.bytesWritten(), 0); | 79 this->validate(fWriter.bytesWritten(), 0); |
76 | 80 |
77 if (fWriter.bytesWritten() == 0) { | 81 if (fWriter.bytesWritten() == 0) { |
78 return SkData::NewEmpty(); | 82 return SkData::NewEmpty(); |
79 } | 83 } |
80 | 84 |
81 if (deepCopy) { | 85 if (deepCopy) { |
82 return SkData::NewWithCopy(fWriter.contiguousArray(), fWriter.bytesW
ritten()); | 86 return SkData::NewWithCopy(fWriter.contiguousArray(), fWriter.bytesW
ritten()); |
83 } | 87 } |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 void addPicture(const SkPicture* picture); | 178 void addPicture(const SkPicture* picture); |
175 void addPoint(const SkPoint& point); | 179 void addPoint(const SkPoint& point); |
176 void addPoints(const SkPoint pts[], int count); | 180 void addPoints(const SkPoint pts[], int count); |
177 void addRect(const SkRect& rect); | 181 void addRect(const SkRect& rect); |
178 void addRectPtr(const SkRect* rect); | 182 void addRectPtr(const SkRect* rect); |
179 void addIRect(const SkIRect& rect); | 183 void addIRect(const SkIRect& rect); |
180 void addIRectPtr(const SkIRect* rect); | 184 void addIRectPtr(const SkIRect* rect); |
181 void addRRect(const SkRRect&); | 185 void addRRect(const SkRRect&); |
182 void addRegion(const SkRegion& region); | 186 void addRegion(const SkRegion& region); |
183 void addText(const void* text, size_t byteLength); | 187 void addText(const void* text, size_t byteLength); |
| 188 void addTextBlob(const SkTextBlob* blob); |
184 | 189 |
185 int find(const SkBitmap& bitmap); | 190 int find(const SkBitmap& bitmap); |
186 | 191 |
187 protected: | 192 protected: |
188 void validate(size_t initialOffset, size_t size) const { | 193 void validate(size_t initialOffset, size_t size) const { |
189 SkASSERT(fWriter.bytesWritten() == initialOffset + size); | 194 SkASSERT(fWriter.bytesWritten() == initialOffset + size); |
190 } | 195 } |
191 | 196 |
192 virtual SkSurface* onNewSurface(const SkImageInfo&) SK_OVERRIDE; | 197 virtual SkSurface* onNewSurface(const SkImageInfo&) SK_OVERRIDE; |
193 const void* onPeekPixels(SkImageInfo*, size_t*) SK_OVERRIDE { | 198 const void* onPeekPixels(SkImageInfo*, size_t*) SK_OVERRIDE { |
(...skipping 12 matching lines...) Expand all Loading... |
206 virtual void onPopCull() SK_OVERRIDE; | 211 virtual void onPopCull() SK_OVERRIDE; |
207 | 212 |
208 virtual void onDrawText(const void* text, size_t byteLength, SkScalar x, SkS
calar y, | 213 virtual void onDrawText(const void* text, size_t byteLength, SkScalar x, SkS
calar y, |
209 const SkPaint&) SK_OVERRIDE; | 214 const SkPaint&) SK_OVERRIDE; |
210 virtual void onDrawPosText(const void* text, size_t byteLength, const SkPoin
t pos[], | 215 virtual void onDrawPosText(const void* text, size_t byteLength, const SkPoin
t pos[], |
211 const SkPaint&) SK_OVERRIDE; | 216 const SkPaint&) SK_OVERRIDE; |
212 virtual void onDrawPosTextH(const void* text, size_t byteLength, const SkSca
lar xpos[], | 217 virtual void onDrawPosTextH(const void* text, size_t byteLength, const SkSca
lar xpos[], |
213 SkScalar constY, const SkPaint&) SK_OVERRIDE; | 218 SkScalar constY, const SkPaint&) SK_OVERRIDE; |
214 virtual void onDrawTextOnPath(const void* text, size_t byteLength, const SkP
ath& path, | 219 virtual void onDrawTextOnPath(const void* text, size_t byteLength, const SkP
ath& path, |
215 const SkMatrix* matrix, const SkPaint&) SK_OVE
RRIDE; | 220 const SkMatrix* matrix, const SkPaint&) SK_OVE
RRIDE; |
| 221 virtual void onDrawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y, |
| 222 const SkPaint& paint) SK_OVERRIDE; |
216 | 223 |
217 virtual void onDrawPatch(const SkPoint cubics[12], const SkColor colors[4], | 224 virtual void onDrawPatch(const SkPoint cubics[12], const SkColor colors[4], |
218 const SkPoint texCoords[4], SkXfermode* xmode, | 225 const SkPoint texCoords[4], SkXfermode* xmode, |
219 const SkPaint& paint) SK_OVERRIDE; | 226 const SkPaint& paint) SK_OVERRIDE; |
220 | 227 |
221 virtual void onClipRect(const SkRect&, SkRegion::Op, ClipEdgeStyle) SK_OVERR
IDE; | 228 virtual void onClipRect(const SkRect&, SkRegion::Op, ClipEdgeStyle) SK_OVERR
IDE; |
222 virtual void onClipRRect(const SkRRect&, SkRegion::Op, ClipEdgeStyle) SK_OVE
RRIDE; | 229 virtual void onClipRRect(const SkRRect&, SkRegion::Op, ClipEdgeStyle) SK_OVE
RRIDE; |
223 virtual void onClipPath(const SkPath&, SkRegion::Op, ClipEdgeStyle) SK_OVERR
IDE; | 230 virtual void onClipPath(const SkPath&, SkRegion::Op, ClipEdgeStyle) SK_OVERR
IDE; |
224 virtual void onClipRegion(const SkRegion&, SkRegion::Op) SK_OVERRIDE; | 231 virtual void onClipRegion(const SkRegion&, SkRegion::Op) SK_OVERRIDE; |
225 | 232 |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 SkPictureContentInfo fContentInfo; | 281 SkPictureContentInfo fContentInfo; |
275 SkAutoTUnref<SkPathHeap> fPathHeap; | 282 SkAutoTUnref<SkPathHeap> fPathHeap; |
276 | 283 |
277 SkChunkFlatController fFlattenableHeap; | 284 SkChunkFlatController fFlattenableHeap; |
278 | 285 |
279 SkPaintDictionary fPaints; | 286 SkPaintDictionary fPaints; |
280 | 287 |
281 SkWriter32 fWriter; | 288 SkWriter32 fWriter; |
282 | 289 |
283 // we ref each item in these arrays | 290 // we ref each item in these arrays |
284 SkTDArray<const SkPicture*> fPictureRefs; | 291 SkTDArray<const SkPicture*> fPictureRefs; |
| 292 SkTDArray<const SkTextBlob*> fTextBlobRefs; |
285 | 293 |
286 uint32_t fRecordFlags; | 294 uint32_t fRecordFlags; |
287 bool fOptsEnabled; | 295 bool fOptsEnabled; |
288 int fInitialSaveCount; | 296 int fInitialSaveCount; |
289 | 297 |
290 friend class SkPictureData; // for SkPictureData's SkPictureRecord-based c
onstructor | 298 friend class SkPictureData; // for SkPictureData's SkPictureRecord-based c
onstructor |
291 friend class SkPictureTester; // for unit testing | 299 friend class SkPictureTester; // for unit testing |
292 | 300 |
293 typedef SkCanvas INHERITED; | 301 typedef SkCanvas INHERITED; |
294 }; | 302 }; |
295 | 303 |
296 #endif | 304 #endif |
OLD | NEW |