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

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

Issue 573833002: SkPicture::PathCounter is O(N^2) for pictures nested N deep. Fix that. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 3 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 | no next file » | 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 #include "SkPictureFlat.h" 10 #include "SkPictureFlat.h"
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 135
136 PathCounter() 136 PathCounter()
137 : numPaintWithPathEffectUses (0) 137 : numPaintWithPathEffectUses (0)
138 , numFastPathDashEffects (0) 138 , numFastPathDashEffects (0)
139 , numAAConcavePaths (0) 139 , numAAConcavePaths (0)
140 , numAAHairlineConcavePaths (0) { 140 , numAAHairlineConcavePaths (0) {
141 } 141 }
142 142
143 // Recurse into nested pictures. 143 // Recurse into nested pictures.
144 void operator()(const SkRecords::DrawPicture& op) { 144 void operator()(const SkRecords::DrawPicture& op) {
145 // If you're not also SkRecord-backed, tough luck. Get on the bandwagon . 145 const SkPicture::Analysis& analysis = op.picture->fAnalysis;
146 if (op.picture->fRecord.get() == NULL) { 146 numPaintWithPathEffectUses += analysis.fNumPaintWithPathEffectUses;
147 return; 147 numFastPathDashEffects += analysis.fNumFastPathDashEffects;
148 } 148 numAAConcavePaths += analysis.fNumAAConcavePaths;
149 const SkRecord& nested = *op.picture->fRecord; 149 numAAHairlineConcavePaths += analysis.fNumAAHairlineConcavePaths;
150 for (unsigned i = 0; i < nested.count(); i++) {
151 nested.visit<void>(i, *this);
152 }
153 } 150 }
154 151
155 void checkPaint(const SkPaint* paint) { 152 void checkPaint(const SkPaint* paint) {
156 if (paint && paint->getPathEffect()) { 153 if (paint && paint->getPathEffect()) {
157 numPaintWithPathEffectUses++; 154 numPaintWithPathEffectUses++;
158 } 155 }
159 } 156 }
160 157
161 void operator()(const SkRecords::DrawPoints& op) { 158 void operator()(const SkRecords::DrawPoints& op) {
162 this->checkPaint(&op.paint); 159 this->checkPaint(&op.paint);
(...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after
683 int SkPicture::approximateOpCount() const { 680 int SkPicture::approximateOpCount() const {
684 SkASSERT(fRecord.get() || fData.get()); 681 SkASSERT(fRecord.get() || fData.get());
685 if (fRecord.get()) { 682 if (fRecord.get()) {
686 return fRecord->count(); 683 return fRecord->count();
687 } 684 }
688 if (fData.get()) { 685 if (fData.get()) {
689 return fData->opCount(); 686 return fData->opCount();
690 } 687 }
691 return 0; 688 return 0;
692 } 689 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698