Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(513)

Side by Side Diff: src/core/SkPictureRecord.h

Issue 1837913003: Add support for serializing/deserializing of SkDrawable (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Rebase Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/core/SkPicturePlayback.cpp ('k') | src/core/SkPictureRecord.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
38 const SkTDArray<const SkTextBlob* >& getTextBlobRefs() const { 42 const SkTDArray<const SkTextBlob* >& getTextBlobRefs() const {
39 return fTextBlobRefs; 43 return fTextBlobRefs;
40 } 44 }
41 45
42 const SkTDArray<const SkImage* >& getImageRefs() const { 46 const SkTDArray<const SkImage* >& getImageRefs() const {
43 return fImageRefs; 47 return fImageRefs;
44 } 48 }
45 49
46 sk_sp<SkData> opData(bool deepCopy) const { 50 sk_sp<SkData> opData(bool deepCopy) const {
47 this->validate(fWriter.bytesWritten(), 0); 51 this->validate(fWriter.bytesWritten(), 0);
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 } 128 }
125 129
126 void addBitmap(const SkBitmap& bitmap); 130 void addBitmap(const SkBitmap& bitmap);
127 void addImage(const SkImage*); 131 void addImage(const SkImage*);
128 void addMatrix(const SkMatrix& matrix); 132 void addMatrix(const SkMatrix& matrix);
129 void addPaint(const SkPaint& paint) { this->addPaintPtr(&paint); } 133 void addPaint(const SkPaint& paint) { this->addPaintPtr(&paint); }
130 void addPaintPtr(const SkPaint* paint); 134 void addPaintPtr(const SkPaint* paint);
131 void addPatch(const SkPoint cubics[12]); 135 void addPatch(const SkPoint cubics[12]);
132 void addPath(const SkPath& path); 136 void addPath(const SkPath& path);
133 void addPicture(const SkPicture* picture); 137 void addPicture(const SkPicture* picture);
138 void addDrawable(SkDrawable* picture);
134 void addPoint(const SkPoint& point); 139 void addPoint(const SkPoint& point);
135 void addPoints(const SkPoint pts[], int count); 140 void addPoints(const SkPoint pts[], int count);
136 void addRect(const SkRect& rect); 141 void addRect(const SkRect& rect);
137 void addRectPtr(const SkRect* rect); 142 void addRectPtr(const SkRect* rect);
138 void addIRect(const SkIRect& rect); 143 void addIRect(const SkIRect& rect);
139 void addIRectPtr(const SkIRect* rect); 144 void addIRectPtr(const SkIRect* rect);
140 void addRRect(const SkRRect&); 145 void addRRect(const SkRRect&);
141 void addRegion(const SkRegion& region); 146 void addRegion(const SkRegion& region);
142 void addText(const void* text, size_t byteLength); 147 void addText(const void* text, size_t byteLength);
143 void addTextBlob(const SkTextBlob* blob); 148 void addTextBlob(const SkTextBlob* blob);
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 const SkColor colors[], SkXfermode* xmode, 202 const SkColor colors[], SkXfermode* xmode,
198 const uint16_t indices[], int indexCount, 203 const uint16_t indices[], int indexCount,
199 const SkPaint&) override; 204 const SkPaint&) override;
200 205
201 void onClipRect(const SkRect&, SkRegion::Op, ClipEdgeStyle) override; 206 void onClipRect(const SkRect&, SkRegion::Op, ClipEdgeStyle) override;
202 void onClipRRect(const SkRRect&, SkRegion::Op, ClipEdgeStyle) override; 207 void onClipRRect(const SkRRect&, SkRegion::Op, ClipEdgeStyle) override;
203 void onClipPath(const SkPath&, SkRegion::Op, ClipEdgeStyle) override; 208 void onClipPath(const SkPath&, SkRegion::Op, ClipEdgeStyle) override;
204 void onClipRegion(const SkRegion&, SkRegion::Op) override; 209 void onClipRegion(const SkRegion&, SkRegion::Op) override;
205 210
206 void onDrawPicture(const SkPicture*, const SkMatrix*, const SkPaint*) overri de; 211 void onDrawPicture(const SkPicture*, const SkMatrix*, const SkPaint*) overri de;
212 void onDrawDrawable(SkDrawable*, const SkMatrix*) override;
207 void onDrawAnnotation(const SkRect&, const char[], SkData*) override; 213 void onDrawAnnotation(const SkRect&, const char[], SkData*) override;
208 214
209 int addPathToHeap(const SkPath& path); // does not write to ops stream 215 int addPathToHeap(const SkPath& path); // does not write to ops stream
210 216
211 // These entry points allow the writing of matrices, clips, saves & 217 // These entry points allow the writing of matrices, clips, saves &
212 // restores to be deferred (e.g., if the MC state is being collapsed and 218 // restores to be deferred (e.g., if the MC state is being collapsed and
213 // only written out as needed). 219 // only written out as needed).
214 void recordConcat(const SkMatrix& matrix); 220 void recordConcat(const SkMatrix& matrix);
215 void recordTranslate(const SkMatrix& matrix); 221 void recordTranslate(const SkMatrix& matrix);
216 void recordScale(const SkMatrix& matrix); 222 void recordScale(const SkMatrix& matrix);
(...skipping 14 matching lines...) Expand all
231 struct PathHash { 237 struct PathHash {
232 uint32_t operator()(const SkPath& p) { return p.getGenerationID(); } 238 uint32_t operator()(const SkPath& p) { return p.getGenerationID(); }
233 }; 239 };
234 SkTHashMap<SkPath, int, PathHash> fPaths; 240 SkTHashMap<SkPath, int, PathHash> fPaths;
235 241
236 SkWriter32 fWriter; 242 SkWriter32 fWriter;
237 243
238 // we ref each item in these arrays 244 // we ref each item in these arrays
239 SkTDArray<const SkImage*> fImageRefs; 245 SkTDArray<const SkImage*> fImageRefs;
240 SkTDArray<const SkPicture*> fPictureRefs; 246 SkTDArray<const SkPicture*> fPictureRefs;
247 SkTDArray<SkDrawable*> fDrawableRefs;
241 SkTDArray<const SkTextBlob*> fTextBlobRefs; 248 SkTDArray<const SkTextBlob*> fTextBlobRefs;
242 249
243 uint32_t fRecordFlags; 250 uint32_t fRecordFlags;
244 int fInitialSaveCount; 251 int fInitialSaveCount;
245 252
246 friend class SkPictureData; // for SkPictureData's SkPictureRecord-based c onstructor 253 friend class SkPictureData; // for SkPictureData's SkPictureRecord-based c onstructor
247 254
248 typedef SkCanvas INHERITED; 255 typedef SkCanvas INHERITED;
249 }; 256 };
250 257
251 #endif 258 #endif
OLDNEW
« no previous file with comments | « src/core/SkPicturePlayback.cpp ('k') | src/core/SkPictureRecord.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698