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

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

Issue 746553002: SkData -> SkPicture::SnapshotArray (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: or ref'd Created 6 years, 1 month 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
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 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 *reason = "Too many anti-aliased concave paths."; 251 *reason = "Too many anti-aliased concave paths.";
252 else 252 else
253 *reason = "Unknown reason for GPU unsuitability."; 253 *reason = "Unknown reason for GPU unsuitability.";
254 } 254 }
255 return ret; 255 return ret;
256 } 256 }
257 257
258 /////////////////////////////////////////////////////////////////////////////// 258 ///////////////////////////////////////////////////////////////////////////////
259 259
260 int SkPicture::drawableCount() const { 260 int SkPicture::drawableCount() const {
261 if (fDrawablePicts.get()) { 261 return fDrawablePicts.get() ? fDrawablePicts->count() : 0;
262 return SkToInt(fDrawablePicts->size() / sizeof(SkPicture*));
263 } else {
264 return 0;
265 }
266 } 262 }
267 263
268 SkPicture const* const* SkPicture::drawablePicts() const { 264 SkPicture const* const* SkPicture::drawablePicts() const {
269 if (fDrawablePicts) { 265 return fDrawablePicts.get() ? fDrawablePicts->begin() : NULL;
270 return reinterpret_cast<SkPicture* const*>(fDrawablePicts->data());
271 }
272 return NULL;
273 } 266 }
274 267
275 SkPicture::~SkPicture() { 268 SkPicture::~SkPicture() {
276 this->callDeletionListeners(); 269 this->callDeletionListeners();
277 } 270 }
278 271
279 void SkPicture::EXPERIMENTAL_addAccelData(const SkPicture::AccelData* data) cons t { 272 void SkPicture::EXPERIMENTAL_addAccelData(const SkPicture::AccelData* data) cons t {
280 fAccelData.reset(SkRef(data)); 273 fAccelData.reset(SkRef(data));
281 } 274 }
282 275
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
523 return genID; 516 return genID;
524 } 517 }
525 518
526 uint32_t SkPicture::uniqueID() const { 519 uint32_t SkPicture::uniqueID() const {
527 if (SK_InvalidGenID == fUniqueID) { 520 if (SK_InvalidGenID == fUniqueID) {
528 fUniqueID = next_picture_generation_id(); 521 fUniqueID = next_picture_generation_id();
529 } 522 }
530 return fUniqueID; 523 return fUniqueID;
531 } 524 }
532 525
533 SkPicture::SkPicture(const SkRect& cullRect, SkRecord* record, SkData* drawableP icts, 526 SkPicture::SkPicture(const SkRect& cullRect, SkRecord* record, SnapshotArray* dr awablePicts,
534 SkBBoxHierarchy* bbh) 527 SkBBoxHierarchy* bbh)
535 : fCullRect(cullRect) 528 : fCullRect(cullRect)
536 , fRecord(record) 529 , fRecord(record)
537 , fBBH(SkSafeRef(bbh)) 530 , fBBH(SkSafeRef(bbh))
538 , fDrawablePicts(SkSafeRef(drawablePicts)) 531 , fDrawablePicts(SkSafeRef(drawablePicts))
539 , fAnalysis(*fRecord) { 532 , fAnalysis(*fRecord) {
540 this->needsNewGenID(); 533 this->needsNewGenID();
541 } 534 }
542 535
543 // Note that we are assuming that this entry point will only be called from 536 // Note that we are assuming that this entry point will only be called from
544 // one thread. Currently the only client of this method is 537 // one thread. Currently the only client of this method is
545 // SkGpuDevice::EXPERIMENTAL_optimize which should be only called from a single 538 // SkGpuDevice::EXPERIMENTAL_optimize which should be only called from a single
546 // thread. 539 // thread.
547 void SkPicture::addDeletionListener(DeletionListener* listener) const { 540 void SkPicture::addDeletionListener(DeletionListener* listener) const {
548 SkASSERT(listener); 541 SkASSERT(listener);
549 542
550 *fDeletionListeners.append() = SkRef(listener); 543 *fDeletionListeners.append() = SkRef(listener);
551 } 544 }
552 545
553 void SkPicture::callDeletionListeners() { 546 void SkPicture::callDeletionListeners() {
554 for (int i = 0; i < fDeletionListeners.count(); ++i) { 547 for (int i = 0; i < fDeletionListeners.count(); ++i) {
555 fDeletionListeners[i]->onDeletion(this->uniqueID()); 548 fDeletionListeners[i]->onDeletion(this->uniqueID());
556 } 549 }
557 550
558 fDeletionListeners.unrefAll(); 551 fDeletionListeners.unrefAll();
559 } 552 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698