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

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

Issue 1090943004: O(1) SkPictureUtils::ApproxBytesUsed() (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: working? Created 5 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 | « no previous file | src/core/SkPicture.cpp » ('j') | src/core/SkPictureRecorder.cpp » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2007 The Android Open Source Project 2 * Copyright 2007 The Android Open Source Project
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 8
9 #ifndef SkPicture_DEFINED 9 #ifndef SkPicture_DEFINED
10 #define SkPicture_DEFINED 10 #define SkPicture_DEFINED
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 // steps to generate new SKPs in (only accessible to Googlers): http://goo.g l/qATVcw 250 // steps to generate new SKPs in (only accessible to Googlers): http://goo.g l/qATVcw
251 251
252 // Only SKPs within the min/current picture version range (inclusive) can be read. 252 // Only SKPs within the min/current picture version range (inclusive) can be read.
253 static const uint32_t MIN_PICTURE_VERSION = 35; // Produced by Chrome M3 9. 253 static const uint32_t MIN_PICTURE_VERSION = 35; // Produced by Chrome M3 9.
254 static const uint32_t CURRENT_PICTURE_VERSION = 41; 254 static const uint32_t CURRENT_PICTURE_VERSION = 41;
255 255
256 void createHeader(SkPictInfo* info) const; 256 void createHeader(SkPictInfo* info) const;
257 static bool IsValidPictInfo(const SkPictInfo& info); 257 static bool IsValidPictInfo(const SkPictInfo& info);
258 258
259 // Takes ownership of the SkRecord and (optional) SnapshotArray, refs the (o ptional) BBH. 259 // Takes ownership of the SkRecord and (optional) SnapshotArray, refs the (o ptional) BBH.
260 SkPicture(const SkRect& cullRect, SkRecord*, SnapshotArray*, SkBBoxHierarchy *); 260 SkPicture(const SkRect& cullRect,
261 SkRecord*,
262 SnapshotArray*,
263 SkBBoxHierarchy*,
264 size_t approxBytesUsedBySubPictures);
261 265
262 static SkPicture* Forwardport(const SkPictInfo&, const SkPictureData*); 266 static SkPicture* Forwardport(const SkPictInfo&, const SkPictureData*);
263 static SkPictureData* Backport(const SkRecord&, const SkPictInfo&, 267 static SkPictureData* Backport(const SkRecord&, const SkPictInfo&,
264 SkPicture const* const drawablePics[], int dr awableCount); 268 SkPicture const* const drawablePics[], int dr awableCount);
265 269
266 // uint32_t fRefCnt; from SkNVRefCnt<SkPicture> 270 // uint32_t fRefCnt; from SkNVRefCnt<SkPicture>
267 mutable uint32_t fUniqueID; 271 mutable uint32_t fUniqueID;
268 const SkRect fCullRect; 272 const SkRect fCullRect;
269 mutable SkAutoTUnref<const AccelData> fAccelData; 273 mutable SkAutoTUnref<const AccelData> fAccelData;
270 SkAutoTUnref<const SkRecord> fRecord; 274 SkAutoTUnref<const SkRecord> fRecord;
271 SkAutoTUnref<const SkBBoxHierarchy> fBBH; 275 SkAutoTUnref<const SkBBoxHierarchy> fBBH;
272 SkAutoTDelete<const SnapshotArray> fDrawablePicts; 276 SkAutoTDelete<const SnapshotArray> fDrawablePicts;
277 size_t fApproxBytesUsedBySubPictures;
reed1 2015/04/21 22:13:04 can this field be const?
mtklein 2015/04/21 22:18:31 Yes, done.
273 278
274 // helpers for fDrawablePicts 279 // helpers for fDrawablePicts
275 int drawableCount() const; 280 int drawableCount() const;
276 // will return NULL if drawableCount() returns 0 281 // will return NULL if drawableCount() returns 0
277 SkPicture const* const* drawablePicts() const; 282 SkPicture const* const* drawablePicts() const;
278 283
279 struct PathCounter; 284 struct PathCounter;
280 285
281 struct Analysis { 286 struct Analysis {
282 Analysis() {} // Only used by SkPictureData codepath. 287 Analysis() {} // Only used by SkPictureData codepath.
283 explicit Analysis(const SkRecord&); 288 explicit Analysis(const SkRecord&);
284 289
285 bool suitableForGpuRasterization(const char** reason, int sampleCount) c onst; 290 bool suitableForGpuRasterization(const char** reason, int sampleCount) c onst;
286 291
287 bool fWillPlaybackBitmaps; 292 bool fWillPlaybackBitmaps;
288 bool fHasText; 293 bool fHasText;
289 int fNumPaintWithPathEffectUses; 294 int fNumPaintWithPathEffectUses;
290 int fNumFastPathDashEffects; 295 int fNumFastPathDashEffects;
291 int fNumAAConcavePaths; 296 int fNumAAConcavePaths;
292 int fNumAAHairlineConcavePaths; 297 int fNumAAHairlineConcavePaths;
293 int fNumAADFEligibleConcavePaths; 298 int fNumAADFEligibleConcavePaths;
294 } fAnalysis; 299 } fAnalysis;
295 300
296 friend class SkPictureRecorder; // SkRecord-based constructor. 301 friend class SkPictureRecorder; // SkRecord-based constructor.
297 friend class GrLayerHoister; // access to fRecord 302 friend class GrLayerHoister; // access to fRecord
298 friend class ReplaceDraw; 303 friend class ReplaceDraw;
299 friend class SkPictureUtils; 304 friend class SkPictureUtils;
300 friend class SkRecordedDrawable; 305 friend class SkRecordedDrawable;
301 }; 306 };
302 SK_COMPILE_ASSERT(sizeof(SkPicture) <= 96, SkPictureSize); 307 SK_COMPILE_ASSERT(sizeof(SkPicture) <= 104, SkPictureSize);
303 308
304 #endif 309 #endif
OLDNEW
« no previous file with comments | « no previous file | src/core/SkPicture.cpp » ('j') | src/core/SkPictureRecorder.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698