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

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

Issue 464263004: expose api to count the number of ops in a picture (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: move to SkPicture.h Created 6 years, 4 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 | « include/core/SkPicture.h ('k') | src/core/SkPictureData.h » ('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 #include "SkPictureFlat.h" 10 #include "SkPictureFlat.h"
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 int32_t id = sk_atomic_inc(&gNextID); 166 int32_t id = sk_atomic_inc(&gNextID);
167 if (id >= 1 << (8 * sizeof(Domain))) { 167 if (id >= 1 << (8 * sizeof(Domain))) {
168 SK_CRASH(); 168 SK_CRASH();
169 } 169 }
170 170
171 return static_cast<Domain>(id); 171 return static_cast<Domain>(id);
172 } 172 }
173 173
174 /////////////////////////////////////////////////////////////////////////////// 174 ///////////////////////////////////////////////////////////////////////////////
175 175
176 int SkPicture::countOps() const {
177 if (fRecord.get()) {
178 return fRecord->count();
179 } else if (fData.get()) {
180 return fData->countOps();
181 } else {
182 return 0;
183 }
184 }
185
176 uint32_t SkPicture::OperationList::offset(int index) const { 186 uint32_t SkPicture::OperationList::offset(int index) const {
177 SkASSERT(index < fOps.count()); 187 SkASSERT(index < fOps.count());
178 return ((SkPictureStateTree::Draw*)fOps[index])->fOffset; 188 return ((SkPictureStateTree::Draw*)fOps[index])->fOffset;
179 } 189 }
180 190
181 const SkMatrix& SkPicture::OperationList::matrix(int index) const { 191 const SkMatrix& SkPicture::OperationList::matrix(int index) const {
182 SkASSERT(index < fOps.count()); 192 SkASSERT(index < fOps.count());
183 return *((SkPictureStateTree::Draw*)fOps[index])->fMatrix; 193 return *((SkPictureStateTree::Draw*)fOps[index])->fMatrix;
184 } 194 }
185 195
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
448 *fDeletionListeners.append() = SkRef(listener); 458 *fDeletionListeners.append() = SkRef(listener);
449 } 459 }
450 460
451 void SkPicture::callDeletionListeners() { 461 void SkPicture::callDeletionListeners() {
452 for (int i = 0; i < fDeletionListeners.count(); ++i) { 462 for (int i = 0; i < fDeletionListeners.count(); ++i) {
453 fDeletionListeners[i]->onDeletion(this->uniqueID()); 463 fDeletionListeners[i]->onDeletion(this->uniqueID());
454 } 464 }
455 465
456 fDeletionListeners.unrefAll(); 466 fDeletionListeners.unrefAll();
457 } 467 }
OLDNEW
« no previous file with comments | « include/core/SkPicture.h ('k') | src/core/SkPictureData.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698