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

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

Issue 750723002: add endRecordingAsDrawable experiment (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: seems to work, TODO around immediate mode drawing 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
« no previous file with comments | « src/core/SkCanvasDrawable.cpp ('k') | src/core/SkPictureRecorder.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 /* 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 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 int SkPicture::drawableCount() const { 272 int SkPicture::drawableCount() const {
273 return fDrawablePicts.get() ? fDrawablePicts->count() : 0; 273 return fDrawablePicts.get() ? fDrawablePicts->count() : 0;
274 } 274 }
275 275
276 SkPicture const* const* SkPicture::drawablePicts() const { 276 SkPicture const* const* SkPicture::drawablePicts() const {
277 return fDrawablePicts.get() ? fDrawablePicts->begin() : NULL; 277 return fDrawablePicts.get() ? fDrawablePicts->begin() : NULL;
278 } 278 }
279 279
280 SkPicture::~SkPicture() { 280 SkPicture::~SkPicture() {
281 this->callDeletionListeners(); 281 this->callDeletionListeners();
282 fRecord.reset(NULL);
282 } 283 }
283 284
284 void SkPicture::EXPERIMENTAL_addAccelData(const SkPicture::AccelData* data) cons t { 285 void SkPicture::EXPERIMENTAL_addAccelData(const SkPicture::AccelData* data) cons t {
285 fAccelData.reset(SkRef(data)); 286 fAccelData.reset(SkRef(data));
286 } 287 }
287 288
288 const SkPicture::AccelData* SkPicture::EXPERIMENTAL_getAccelData( 289 const SkPicture::AccelData* SkPicture::EXPERIMENTAL_getAccelData(
289 SkPicture::AccelData::Key key) const { 290 SkPicture::AccelData::Key key) const {
290 if (fAccelData.get() && fAccelData->getKey() == key) { 291 if (fAccelData.get() && fAccelData->getKey() == key) {
291 return fAccelData.get(); 292 return fAccelData.get();
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
514 #endif 515 #endif
515 516
516 bool SkPicture::hasText() const { return fAnalysis.fHasText; } 517 bool SkPicture::hasText() const { return fAnalysis.fHasText; }
517 bool SkPicture::willPlayBackBitmaps() const { return fAnalysis.fWillPlaybackBitm aps; } 518 bool SkPicture::willPlayBackBitmaps() const { return fAnalysis.fWillPlaybackBitm aps; }
518 int SkPicture::approximateOpCount() const { return fRecord->count(); } 519 int SkPicture::approximateOpCount() const { return fRecord->count(); }
519 520
520 SkPicture::SkPicture(const SkRect& cullRect, SkRecord* record, SnapshotArray* dr awablePicts, 521 SkPicture::SkPicture(const SkRect& cullRect, SkRecord* record, SnapshotArray* dr awablePicts,
521 SkBBoxHierarchy* bbh) 522 SkBBoxHierarchy* bbh)
522 : fUniqueID(next_picture_generation_id()) 523 : fUniqueID(next_picture_generation_id())
523 , fCullRect(cullRect) 524 , fCullRect(cullRect)
524 , fRecord(record) 525 , fRecord(SkRef(record))
525 , fBBH(SkSafeRef(bbh)) 526 , fBBH(SkSafeRef(bbh))
526 , fDrawablePicts(drawablePicts) 527 , fDrawablePicts(drawablePicts) // take ownership
527 , fAnalysis(*fRecord) 528 , fAnalysis(*fRecord)
528 {} 529 {}
529 530
530 // Note that we are assuming that this entry point will only be called from 531 // Note that we are assuming that this entry point will only be called from
531 // one thread. Currently the only client of this method is 532 // one thread. Currently the only client of this method is
532 // SkGpuDevice::EXPERIMENTAL_optimize which should be only called from a single 533 // SkGpuDevice::EXPERIMENTAL_optimize which should be only called from a single
533 // thread. 534 // thread.
534 void SkPicture::addDeletionListener(DeletionListener* listener) const { 535 void SkPicture::addDeletionListener(DeletionListener* listener) const {
535 SkASSERT(listener); 536 SkASSERT(listener);
536 537
537 *fDeletionListeners.append() = SkRef(listener); 538 *fDeletionListeners.append() = SkRef(listener);
538 } 539 }
539 540
540 void SkPicture::callDeletionListeners() { 541 void SkPicture::callDeletionListeners() {
541 for (int i = 0; i < fDeletionListeners.count(); ++i) { 542 for (int i = 0; i < fDeletionListeners.count(); ++i) {
542 fDeletionListeners[i]->onDeletion(this->uniqueID()); 543 fDeletionListeners[i]->onDeletion(this->uniqueID());
543 } 544 }
544 545
545 fDeletionListeners.unrefAll(); 546 fDeletionListeners.unrefAll();
546 } 547 }
OLDNEW
« no previous file with comments | « src/core/SkCanvasDrawable.cpp ('k') | src/core/SkPictureRecorder.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698