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

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: renamed restoreImpl to recordRestore 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);
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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 // Will return a cached version when possible. 229 // Will return a cached version when possible.
231 const SkFlatData* getFlatPaintData(const SkPaint& paint); 230 const SkFlatData* getFlatPaintData(const SkPaint& paint);
232 /** 231 /**
233 * SkBBoxRecord::drawPosTextH gets a flat paint and uses it, 232 * SkBBoxRecord::drawPosTextH gets a flat paint and uses it,
234 * then it calls this, using the extra parameter, to avoid duplication. 233 * then it calls this, using the extra parameter, to avoid duplication.
235 */ 234 */
236 void drawPosTextHImpl(const void* text, size_t byteLength, 235 void drawPosTextHImpl(const void* text, size_t byteLength,
237 const SkScalar xpos[], SkScalar constY, 236 const SkScalar xpos[], SkScalar constY,
238 const SkPaint& paint, const SkFlatData* flatPaintData) ; 237 const SkPaint& paint, const SkFlatData* flatPaintData) ;
239 238
239 int addPathToHeap(const SkPath& path); // does not write to ops stream
240
241 // These entry points allow the writing of matrices, clips, saves &
242 // restores to be deferred (e.g., if the MC state is being collapsed and
243 // only written out as needed).
244 void recordConcat(const SkMatrix& matrix);
245 int recordClipRect(const SkRect& rect, SkRegion::Op op, bool doAA);
246 int recordClipRRect(const SkRRect& rrect, SkRegion::Op op, bool doAA);
247 int recordClipPath(int pathID, SkRegion::Op op, bool doAA);
248 int recordClipRegion(const SkRegion& region, SkRegion::Op op);
249 void recordSave(SaveFlags flags);
250 void recordSaveLayer(const SkRect* bounds, const SkPaint* paint, SaveFlags f lags);
251 void recordRestore();
252
240 // These are set to NULL in our constructor, but may be changed by 253 // 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. 254 // subclasses, in which case they will be SkSafeUnref'd in our destructor.
242 SkBBoxHierarchy* fBoundingHierarchy; 255 SkBBoxHierarchy* fBoundingHierarchy;
243 SkPictureStateTree* fStateTree; 256 SkPictureStateTree* fStateTree;
244 257
245 // Allocated in the constructor and managed by this class. 258 // Allocated in the constructor and managed by this class.
246 SkBitmapHeap* fBitmapHeap; 259 SkBitmapHeap* fBitmapHeap;
247 260
248 private: 261 private:
249 SkChunkFlatController fFlattenableHeap; 262 SkChunkFlatController fFlattenableHeap;
250 263
251 SkPaintDictionary fPaints; 264 SkPaintDictionary fPaints;
252 265
253 SkPathHeap* fPathHeap; // reference counted 266 SkPathHeap* fPathHeap; // reference counted
254 SkWriter32 fWriter; 267 SkWriter32 fWriter;
255 268
256 // we ref each item in these arrays 269 // we ref each item in these arrays
257 SkTDArray<SkPicture*> fPictureRefs; 270 SkTDArray<SkPicture*> fPictureRefs;
258 271
259 uint32_t fRecordFlags; 272 uint32_t fRecordFlags;
260 int fInitialSaveCount; 273 int fInitialSaveCount;
261 274
262 friend class SkPicturePlayback; 275 friend class SkPicturePlayback;
263 friend class SkPictureTester; // for unit testing 276 friend class SkPictureTester; // for unit testing
264 277
265 typedef SkCanvas INHERITED; 278 typedef SkCanvas INHERITED;
266 }; 279 };
267 280
268 #endif 281 #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