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

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

Issue 153883002: Update SkPictureRecord to allow some ops to be written separately (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Missing base file (reupload) Created 6 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | 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 /* 2 /*
3 * Copyright 2011 Google Inc. 3 * Copyright 2011 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 #ifndef SkPictureRecord_DEFINED 8 #ifndef SkPictureRecord_DEFINED
9 #define SkPictureRecord_DEFINED 9 #define SkPictureRecord_DEFINED
10 10
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 101
102 const SkWriter32& writeStream() const { 102 const SkWriter32& writeStream() const {
103 return fWriter; 103 return fWriter;
104 } 104 }
105 105
106 void beginRecording(); 106 void beginRecording();
107 void endRecording(); 107 void endRecording();
108 108
109 private: 109 private:
110 void handleOptimization(int opt); 110 void handleOptimization(int opt);
111 void recordRestoreOffsetPlaceholder(SkRegion::Op); 111 int recordRestoreOffsetPlaceholder(SkRegion::Op);
reed1 2014/02/04 15:47:17 not new, but soon we should start adding dox to th
robertphillips 2014/02/04 19:08:01 I will keep this in mind. If the collapsing code s
112 void fillRestoreOffsetPlaceholdersForCurrentStackLevel( 112 void fillRestoreOffsetPlaceholdersForCurrentStackLevel(uint32_t restoreOffse t);
113 uint32_t restoreOffset);
114 113
115 SkTDArray<int32_t> fRestoreOffsetStack; 114 SkTDArray<int32_t> fRestoreOffsetStack;
116 int fFirstSavedLayerIndex; 115 int fFirstSavedLayerIndex;
117 enum { 116 enum {
118 kNoSavedLayerIndex = -1 117 kNoSavedLayerIndex = -1
119 }; 118 };
120 119
121 /* 120 /*
122 * Write the 'drawType' operation and chunk size to the skp. 'size' 121 * Write the 'drawType' operation and chunk size to the skp. 'size'
123 * can potentially be increased if the chunk size needs its own storage 122 * can potentially be increased if the chunk size needs its own storage
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 } 157 }
159 void addScalar(SkScalar scalar) { 158 void addScalar(SkScalar scalar) {
160 fWriter.writeScalar(scalar); 159 fWriter.writeScalar(scalar);
161 } 160 }
162 161
163 void addBitmap(const SkBitmap& bitmap); 162 void addBitmap(const SkBitmap& bitmap);
164 void addMatrix(const SkMatrix& matrix); 163 void addMatrix(const SkMatrix& matrix);
165 const SkFlatData* addPaint(const SkPaint& paint) { return this->addPaintPtr( &paint); } 164 const SkFlatData* addPaint(const SkPaint& paint) { return this->addPaintPtr( &paint); }
166 const SkFlatData* addPaintPtr(const SkPaint* paint); 165 const SkFlatData* addPaintPtr(const SkPaint* paint);
167 void addFlatPaint(const SkFlatData* flatPaint); 166 void addFlatPaint(const SkFlatData* flatPaint);
167 int addPathToHeap(const SkPath& path);
168 void addPath(const SkPath& path); 168 void addPath(const SkPath& path);
169 void addPicture(SkPicture& picture); 169 void addPicture(SkPicture& picture);
170 void addPoint(const SkPoint& point); 170 void addPoint(const SkPoint& point);
171 void addPoints(const SkPoint pts[], int count); 171 void addPoints(const SkPoint pts[], int count);
172 void addRect(const SkRect& rect); 172 void addRect(const SkRect& rect);
173 void addRectPtr(const SkRect* rect); 173 void addRectPtr(const SkRect* rect);
174 void addIRect(const SkIRect& rect); 174 void addIRect(const SkIRect& rect);
175 void addIRectPtr(const SkIRect* rect); 175 void addIRectPtr(const SkIRect* rect);
176 void addRRect(const SkRRect&); 176 void addRRect(const SkRRect&);
177 void addRegion(const SkRegion& region); 177 void addRegion(const SkRegion& region);
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 // Will return a cached version when possible. 230 // Will return a cached version when possible.
231 const SkFlatData* getFlatPaintData(const SkPaint& paint); 231 const SkFlatData* getFlatPaintData(const SkPaint& paint);
232 /** 232 /**
233 * SkBBoxRecord::drawPosTextH gets a flat paint and uses it, 233 * SkBBoxRecord::drawPosTextH gets a flat paint and uses it,
234 * then it calls this, using the extra parameter, to avoid duplication. 234 * then it calls this, using the extra parameter, to avoid duplication.
235 */ 235 */
236 void drawPosTextHImpl(const void* text, size_t byteLength, 236 void drawPosTextHImpl(const void* text, size_t byteLength,
237 const SkScalar xpos[], SkScalar constY, 237 const SkScalar xpos[], SkScalar constY,
238 const SkPaint& paint, const SkFlatData* flatPaintData) ; 238 const SkPaint& paint, const SkFlatData* flatPaintData) ;
239 239
240 void concatImpl(const SkMatrix& matrix);
reed1 2014/02/04 15:47:17 block comment as to why we have these "helpers"?
robertphillips 2014/02/04 19:08:01 Done.
241 int clipRectImpl(const SkRect& rect, SkRegion::Op op, bool doAA);
242 int clipRRectImpl(const SkRRect& rrect, SkRegion::Op op, bool doAA);
243 int clipPathImpl(int pathID, SkRegion::Op op, bool doAA);
244 int clipRegionImpl(const SkRegion& region, SkRegion::Op op);
245 void saveImpl(SaveFlags flags);
246 void saveLayerImpl(const SkRect* bounds, const SkPaint* paint,
247 SaveFlags flags);
248 void restoreImpl();
249
240 // These are set to NULL in our constructor, but may be changed by 250 // These are set to NULL in our constructor, but may be changed by
241 // subclasses, in which case they will be SkSafeUnref'd in our destructor. 251 // subclasses, in which case they will be SkSafeUnref'd in our destructor.
242 SkBBoxHierarchy* fBoundingHierarchy; 252 SkBBoxHierarchy* fBoundingHierarchy;
243 SkPictureStateTree* fStateTree; 253 SkPictureStateTree* fStateTree;
244 254
245 // Allocated in the constructor and managed by this class. 255 // Allocated in the constructor and managed by this class.
246 SkBitmapHeap* fBitmapHeap; 256 SkBitmapHeap* fBitmapHeap;
247 257
248 private: 258 private:
249 SkChunkFlatController fFlattenableHeap; 259 SkChunkFlatController fFlattenableHeap;
250 260
251 SkPaintDictionary fPaints; 261 SkPaintDictionary fPaints;
252 262
253 SkPathHeap* fPathHeap; // reference counted 263 SkPathHeap* fPathHeap; // reference counted
254 SkWriter32 fWriter; 264 SkWriter32 fWriter;
255 265
256 // we ref each item in these arrays 266 // we ref each item in these arrays
257 SkTDArray<SkPicture*> fPictureRefs; 267 SkTDArray<SkPicture*> fPictureRefs;
258 268
259 uint32_t fRecordFlags; 269 uint32_t fRecordFlags;
260 int fInitialSaveCount; 270 int fInitialSaveCount;
261 271
262 friend class SkPicturePlayback; 272 friend class SkPicturePlayback;
263 friend class SkPictureTester; // for unit testing 273 friend class SkPictureTester; // for unit testing
264 274
265 typedef SkCanvas INHERITED; 275 typedef SkCanvas INHERITED;
266 }; 276 };
267 277
268 #endif 278 #endif
OLDNEW
« no previous file with comments | « no previous file | src/core/SkPictureRecord.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698