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

Side by Side Diff: include/core/SkPicture.h

Issue 746553002: SkData -> SkPicture::SnapshotArray (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: ctor 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 | « no previous file | src/core/SkPicture.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 2007 The Android Open Source Project 3 * Copyright 2007 The Android Open Source Project
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 8
9 9
10 #ifndef SkPicture_DEFINED 10 #ifndef SkPicture_DEFINED
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 * number may be greater or less than the number of SkCanvas calls 192 * number may be greater or less than the number of SkCanvas calls
193 * recorded: some calls may be recorded as more than one operation, or some 193 * recorded: some calls may be recorded as more than one operation, or some
194 * calls may be optimized away. 194 * calls may be optimized away.
195 */ 195 */
196 int approximateOpCount() const; 196 int approximateOpCount() const;
197 197
198 /** Return true if this picture contains text. 198 /** Return true if this picture contains text.
199 */ 199 */
200 bool hasText() const; 200 bool hasText() const;
201 201
202 // A refcounted array of refcounted const SkPicture pointers.
203 struct SnapshotArray : public SkNVRefCnt {
204 SnapshotArray(const SkPicture* pics[], size_t count) : fPics(pics), fCou nt(count) {}
205 ~SnapshotArray() { for (size_t i = 0; i < fCount; i++) { fPics[i]->unref (); } }
206
207 const SkPicture* const* begin() const { return fPics; }
208 size_t count() const { return fCount; }
209 private:
210 SkAutoTMalloc<const SkPicture*> fPics;
211 size_t fCount;
212 };
213
202 private: 214 private:
203 // V2 : adds SkPixelRef's generation ID. 215 // V2 : adds SkPixelRef's generation ID.
204 // V3 : PictInfo tag at beginning, and EOF tag at the end 216 // V3 : PictInfo tag at beginning, and EOF tag at the end
205 // V4 : move SkPictInfo to be the header 217 // V4 : move SkPictInfo to be the header
206 // V5 : don't read/write FunctionPtr on cross-process (we can detect that) 218 // V5 : don't read/write FunctionPtr on cross-process (we can detect that)
207 // V6 : added serialization of SkPath's bounds (and packed its flags tighter ) 219 // V6 : added serialization of SkPath's bounds (and packed its flags tighter )
208 // V7 : changed drawBitmapRect(IRect) to drawBitmapRectToRect(Rect) 220 // V7 : changed drawBitmapRect(IRect) to drawBitmapRectToRect(Rect)
209 // V8 : Add an option for encoding bitmaps 221 // V8 : Add an option for encoding bitmaps
210 // V9 : Allow the reader and writer of an SKP disagree on whether to support 222 // V9 : Allow the reader and writer of an SKP disagree on whether to support
211 // SK_SUPPORT_HINTING_SCALE_FACTOR 223 // SK_SUPPORT_HINTING_SCALE_FACTOR
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 256
245 // Only SKPs within the min/current picture version range (inclusive) can be read. 257 // Only SKPs within the min/current picture version range (inclusive) can be read.
246 static const uint32_t MIN_PICTURE_VERSION = 19; 258 static const uint32_t MIN_PICTURE_VERSION = 19;
247 static const uint32_t CURRENT_PICTURE_VERSION = 37; 259 static const uint32_t CURRENT_PICTURE_VERSION = 37;
248 260
249 void callDeletionListeners(); 261 void callDeletionListeners();
250 262
251 void createHeader(SkPictInfo* info) const; 263 void createHeader(SkPictInfo* info) const;
252 static bool IsValidPictInfo(const SkPictInfo& info); 264 static bool IsValidPictInfo(const SkPictInfo& info);
253 265
254 // Takes ownership of the SkRecord, refs the (optional) drawablePicts and BB H. 266 // Takes ownership of the SkRecord, refs the (optional) SnapshotArray and BB H.
255 SkPicture(const SkRect& cullRect, SkRecord*, SkData* drawablePicts, 267 SkPicture(const SkRect& cullRect, SkRecord*, SnapshotArray*, SkBBoxHierarchy *);
256 SkBBoxHierarchy*);
257 268
258 static SkPicture* Forwardport(const SkPictInfo&, const SkPictureData*); 269 static SkPicture* Forwardport(const SkPictInfo&, const SkPictureData*);
259 static SkPictureData* Backport(const SkRecord&, const SkPictInfo&, 270 static SkPictureData* Backport(const SkRecord&, const SkPictInfo&,
260 SkPicture const* const drawablePics[], int dr awableCount); 271 SkPicture const* const drawablePics[], int dr awableCount);
261 272
262 // uint32_t fRefCnt; from SkNVRefCnt<SkPicture> 273 // uint32_t fRefCnt; from SkNVRefCnt<SkPicture>
263 const uint32_t fUniqueID; 274 const uint32_t fUniqueID;
264 const SkRect fCullRect; 275 const SkRect fCullRect;
265 mutable SkAutoTUnref<const AccelData> fAccelData; 276 mutable SkAutoTUnref<const AccelData> fAccelData;
266 mutable SkTDArray<DeletionListener*> fDeletionListeners; // pointers are re fed 277 mutable SkTDArray<DeletionListener*> fDeletionListeners; // pointers are re fed
267 SkAutoTDelete<const SkRecord> fRecord; 278 SkAutoTDelete<const SkRecord> fRecord;
268 SkAutoTUnref<const SkBBoxHierarchy> fBBH; 279 SkAutoTUnref<const SkBBoxHierarchy> fBBH;
269 SkAutoTUnref<SkData> fDrawablePicts; 280 SkAutoTUnref<const SnapshotArray> fDrawablePicts;
270 281
271 // helpers for fDrawablePicts 282 // helpers for fDrawablePicts
272 int drawableCount() const; 283 int drawableCount() const;
273 // will return NULL if drawableCount() returns 0 284 // will return NULL if drawableCount() returns 0
274 SkPicture const* const* drawablePicts() const; 285 SkPicture const* const* drawablePicts() const;
275 286
276 struct PathCounter; 287 struct PathCounter;
277 288
278 struct Analysis { 289 struct Analysis {
279 Analysis() {} // Only used by SkPictureData codepath. 290 Analysis() {} // Only used by SkPictureData codepath.
(...skipping 11 matching lines...) Expand all
291 } fAnalysis; 302 } fAnalysis;
292 303
293 friend class SkPictureRecorder; // SkRecord-based constructor. 304 friend class SkPictureRecorder; // SkRecord-based constructor.
294 friend class GrLayerHoister; // access to fRecord 305 friend class GrLayerHoister; // access to fRecord
295 friend class ReplaceDraw; 306 friend class ReplaceDraw;
296 friend class SkPictureUtils; 307 friend class SkPictureUtils;
297 }; 308 };
298 SK_COMPILE_ASSERT(sizeof(SkPicture) <= 96, SkPictureSize); 309 SK_COMPILE_ASSERT(sizeof(SkPicture) <= 96, SkPictureSize);
299 310
300 #endif 311 #endif
OLDNEW
« no previous file with comments | « no previous file | src/core/SkPicture.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698