| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 } |
| OLD | NEW |