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

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

Issue 715413002: More cleanup: streamline paths and bitmaps. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase Created 6 years, 1 month 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/SkPictureData.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
11 #include "SkCanvas.h" 11 #include "SkCanvas.h"
12 #include "SkFlattenable.h" 12 #include "SkFlattenable.h"
13 #include "SkPathHeap.h"
14 #include "SkPicture.h" 13 #include "SkPicture.h"
15 #include "SkPictureData.h" 14 #include "SkPictureData.h"
16 #include "SkTemplates.h" 15 #include "SkTemplates.h"
17 #include "SkWriter32.h" 16 #include "SkWriter32.h"
18 17
19 // These macros help with packing and unpacking a single byte value and 18 // These macros help with packing and unpacking a single byte value and
20 // a 3 byte value into/out of a uint32_t 19 // a 3 byte value into/out of a uint32_t
21 #define MASK_24 0x00FFFFFF 20 #define MASK_24 0x00FFFFFF
22 #define UNPACK_8_24(combined, small, large) \ 21 #define UNPACK_8_24(combined, small, large) \
23 small = (combined >> 24) & 0xFF; \ 22 small = (combined >> 24) & 0xFF; \
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 return SkData::NewEmpty(); 74 return SkData::NewEmpty();
76 } 75 }
77 76
78 if (deepCopy) { 77 if (deepCopy) {
79 return SkData::NewWithCopy(fWriter.contiguousArray(), fWriter.bytesW ritten()); 78 return SkData::NewWithCopy(fWriter.contiguousArray(), fWriter.bytesW ritten());
80 } 79 }
81 80
82 return fWriter.snapshotAsData(); 81 return fWriter.snapshotAsData();
83 } 82 }
84 83
85 const SkPathHeap* pathHeap() const {
86 return fPathHeap.get();
87 }
88
89 const SkPictureContentInfo& contentInfo() const { 84 const SkPictureContentInfo& contentInfo() const {
90 return fContentInfo; 85 return fContentInfo;
91 } 86 }
92 87
93 void setFlags(uint32_t recordFlags) { 88 void setFlags(uint32_t recordFlags) {
94 fRecordFlags = recordFlags; 89 fRecordFlags = recordFlags;
95 } 90 }
96 91
97 const SkWriter32& writeStream() const { 92 const SkWriter32& writeStream() const {
98 return fWriter; 93 return fWriter;
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 void recordTranslate(const SkMatrix& matrix); 224 void recordTranslate(const SkMatrix& matrix);
230 void recordScale(const SkMatrix& matrix); 225 void recordScale(const SkMatrix& matrix);
231 size_t recordClipRect(const SkRect& rect, SkRegion::Op op, bool doAA); 226 size_t recordClipRect(const SkRect& rect, SkRegion::Op op, bool doAA);
232 size_t recordClipRRect(const SkRRect& rrect, SkRegion::Op op, bool doAA); 227 size_t recordClipRRect(const SkRRect& rrect, SkRegion::Op op, bool doAA);
233 size_t recordClipPath(int pathID, SkRegion::Op op, bool doAA); 228 size_t recordClipPath(int pathID, SkRegion::Op op, bool doAA);
234 size_t recordClipRegion(const SkRegion& region, SkRegion::Op op); 229 size_t recordClipRegion(const SkRegion& region, SkRegion::Op op);
235 void recordSave(); 230 void recordSave();
236 void recordSaveLayer(const SkRect* bounds, const SkPaint* paint, SaveFlags f lags); 231 void recordSaveLayer(const SkRect* bounds, const SkPaint* paint, SaveFlags f lags);
237 void recordRestore(bool fillInSkips = true); 232 void recordRestore(bool fillInSkips = true);
238 233
239 // Allocated in the constructor and managed by this class.
240 SkBitmapHeap* fBitmapHeap;
241
242 private: 234 private:
243 SkPictureContentInfo fContentInfo; 235 SkPictureContentInfo fContentInfo;
244 SkAutoTUnref<SkPathHeap> fPathHeap;
245 236
246 SkTArray<SkPaint> fPaints; 237 SkTArray<SkBitmap> fBitmaps;
238 SkTArray<SkPaint> fPaints;
239 SkTArray<SkPath> fPaths;
247 240
248 SkWriter32 fWriter; 241 SkWriter32 fWriter;
249 242
250 // we ref each item in these arrays 243 // we ref each item in these arrays
251 SkTDArray<const SkPicture*> fPictureRefs; 244 SkTDArray<const SkPicture*> fPictureRefs;
252 SkTDArray<const SkTextBlob*> fTextBlobRefs; 245 SkTDArray<const SkTextBlob*> fTextBlobRefs;
253 246
254 uint32_t fRecordFlags; 247 uint32_t fRecordFlags;
255 int fInitialSaveCount; 248 int fInitialSaveCount;
256 249
257 friend class SkPictureData; // for SkPictureData's SkPictureRecord-based c onstructor 250 friend class SkPictureData; // for SkPictureData's SkPictureRecord-based c onstructor
258 251
259 typedef SkCanvas INHERITED; 252 typedef SkCanvas INHERITED;
260 }; 253 };
261 254
262 #endif 255 #endif
OLDNEW
« no previous file with comments | « src/core/SkPictureData.cpp ('k') | src/core/SkPictureRecord.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698