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

Side by Side Diff: src/core/SkBigPicture.cpp

Issue 1939503002: remove non-static uses of SkOncePtr (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: leave it Created 4 years, 7 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 | « src/core/SkBigPicture.h ('k') | src/core/SkColorTable.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 2015 Google Inc. 2 * Copyright 2015 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 #include "SkBBoxHierarchy.h" 8 #include "SkBBoxHierarchy.h"
9 #include "SkBigPicture.h" 9 #include "SkBigPicture.h"
10 #include "SkPictureCommon.h" 10 #include "SkPictureCommon.h"
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 SkRecordPartialDraw(*fRecord, 51 SkRecordPartialDraw(*fRecord,
52 canvas, 52 canvas,
53 this->drawablePicts(), 53 this->drawablePicts(),
54 this->drawableCount(), 54 this->drawableCount(),
55 start, 55 start,
56 stop, 56 stop,
57 initialCTM); 57 initialCTM);
58 } 58 }
59 59
60 const SkBigPicture::Analysis& SkBigPicture::analysis() const { 60 const SkBigPicture::Analysis& SkBigPicture::analysis() const {
61 return *fAnalysis.get([&]{ return new Analysis(*fRecord); }); 61 fAnalysisOnce([this] { fAnalysis.init(*fRecord); });
62 return fAnalysis;
62 } 63 }
63 64
64 SkRect SkBigPicture::cullRect() const { return fCullRect; } 65 SkRect SkBigPicture::cullRect() const { return fCullRect; }
65 bool SkBigPicture::hasText() const { return this->analysis().fHasT ext; } 66 bool SkBigPicture::hasText() const { return this->analysis().fHasT ext; }
66 bool SkBigPicture::willPlayBackBitmaps() const { return this->analysis().fWill PlaybackBitmaps; } 67 bool SkBigPicture::willPlayBackBitmaps() const { return this->analysis().fWill PlaybackBitmaps; }
67 int SkBigPicture::numSlowPaths() const { return this->analysis().fNumSlowPath sAndDashEffects; } 68 int SkBigPicture::numSlowPaths() const { return this->analysis().fNumSlowPath sAndDashEffects; }
68 int SkBigPicture::approximateOpCount() const { return fRecord->count(); } 69 int SkBigPicture::approximateOpCount() const { return fRecord->count(); }
69 size_t SkBigPicture::approximateBytesUsed() const { 70 size_t SkBigPicture::approximateBytesUsed() const {
70 size_t bytes = sizeof(*this) + fRecord->bytesUsed() + fApproxBytesUsedBySubP ictures; 71 size_t bytes = sizeof(*this) + fRecord->bytesUsed() + fApproxBytesUsedBySubP ictures;
71 if (fBBH) { bytes += fBBH->bytesUsed(); } 72 if (fBBH) { bytes += fBBH->bytesUsed(); }
72 return bytes; 73 return bytes;
73 } 74 }
74 75
75 int SkBigPicture::drawableCount() const { 76 int SkBigPicture::drawableCount() const {
76 return fDrawablePicts ? fDrawablePicts->count() : 0; 77 return fDrawablePicts ? fDrawablePicts->count() : 0;
77 } 78 }
78 79
79 SkPicture const* const* SkBigPicture::drawablePicts() const { 80 SkPicture const* const* SkBigPicture::drawablePicts() const {
80 return fDrawablePicts ? fDrawablePicts->begin() : nullptr; 81 return fDrawablePicts ? fDrawablePicts->begin() : nullptr;
81 } 82 }
82 83
83 SkBigPicture::Analysis::Analysis(const SkRecord& record) { 84 void SkBigPicture::Analysis::init(const SkRecord& record) {
84 TRACE_EVENT0("disabled-by-default-skia", "SkBigPicture::Analysis::Analysis() "); 85 TRACE_EVENT0("disabled-by-default-skia", "SkBigPicture::Analysis::init()");
85 SkTextHunter text; 86 SkTextHunter text;
86 SkBitmapHunter bitmap; 87 SkBitmapHunter bitmap;
87 SkPathCounter path; 88 SkPathCounter path;
88 89
89 bool hasText = false, hasBitmap = false; 90 bool hasText = false, hasBitmap = false;
90 for (int i = 0; i < record.count(); i++) { 91 for (int i = 0; i < record.count(); i++) {
91 hasText = hasText || record.visit(i, text); 92 hasText = hasText || record.visit(i, text);
92 hasBitmap = hasBitmap || record.visit(i, bitmap); 93 hasBitmap = hasBitmap || record.visit(i, bitmap);
93 record.visit(i, path); 94 record.visit(i, path);
94 } 95 }
95 96
96 fHasText = hasText; 97 fHasText = hasText;
97 fWillPlaybackBitmaps = hasBitmap; 98 fWillPlaybackBitmaps = hasBitmap;
98 fNumSlowPathsAndDashEffects = SkTMin<int>(path.fNumSlowPathsAndDashEffects, 255); 99 fNumSlowPathsAndDashEffects = SkTMin<int>(path.fNumSlowPathsAndDashEffects, 255);
99 } 100 }
OLDNEW
« no previous file with comments | « src/core/SkBigPicture.h ('k') | src/core/SkColorTable.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698