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

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

Issue 540963002: Change SkPicture::draw to playback (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
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 309 matching lines...) Expand 10 before | Expand all | Expand 10 after
320 SkASSERT(index < fOps.count()); 320 SkASSERT(index < fOps.count());
321 return ((SkPictureStateTree::Draw*)fOps[index])->fOffset; 321 return ((SkPictureStateTree::Draw*)fOps[index])->fOffset;
322 } 322 }
323 323
324 const SkMatrix& SkPicture::OperationList::matrix(int index) const { 324 const SkMatrix& SkPicture::OperationList::matrix(int index) const {
325 SkASSERT(index < fOps.count()); 325 SkASSERT(index < fOps.count());
326 return *((SkPictureStateTree::Draw*)fOps[index])->fMatrix; 326 return *((SkPictureStateTree::Draw*)fOps[index])->fMatrix;
327 } 327 }
328 328
329 // fRecord OK 329 // fRecord OK
330 void SkPicture::draw(SkCanvas* canvas, SkDrawPictureCallback* callback) const { 330 void SkPicture::playback(SkCanvas* canvas, SkDrawPictureCallback* callback) cons t {
331 SkASSERT(NULL != canvas); 331 SkASSERT(NULL != canvas);
332 SkASSERT(NULL != fData.get() || NULL != fRecord.get()); 332 SkASSERT(NULL != fData.get() || NULL != fRecord.get());
333 333
334 // If the query contains the whole picture, don't bother with the BBH. 334 // If the query contains the whole picture, don't bother with the BBH.
335 SkRect clipBounds = { 0, 0, 0, 0 }; 335 SkRect clipBounds = { 0, 0, 0, 0 };
336 (void)canvas->getClipBounds(&clipBounds); 336 (void)canvas->getClipBounds(&clipBounds);
337 const bool useBBH = !clipBounds.contains(this->cullRect()); 337 const bool useBBH = !clipBounds.contains(this->cullRect());
338 338
339 if (NULL != fData.get()) { 339 if (NULL != fData.get()) {
340 SkPicturePlayback playback(this); 340 SkPicturePlayback playback(this);
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
452 : fData(data) 452 : fData(data)
453 , fCullWidth(width) 453 , fCullWidth(width)
454 , fCullHeight(height) 454 , fCullHeight(height)
455 , fAnalysis() { 455 , fAnalysis() {
456 this->needsNewGenID(); 456 this->needsNewGenID();
457 } 457 }
458 458
459 SkPicture* SkPicture::Forwardport(const SkPicture& src) { 459 SkPicture* SkPicture::Forwardport(const SkPicture& src) {
460 SkAutoTDelete<SkRecord> record(SkNEW(SkRecord)); 460 SkAutoTDelete<SkRecord> record(SkNEW(SkRecord));
461 SkRecorder canvas(record.get(), src.cullRect().width(), src.cullRect().heigh t()); 461 SkRecorder canvas(record.get(), src.cullRect().width(), src.cullRect().heigh t());
462 src.draw(&canvas); 462 src.playback(&canvas);
463 return SkNEW_ARGS(SkPicture, (src.cullRect().width(), src.cullRect().height( ), 463 return SkNEW_ARGS(SkPicture, (src.cullRect().width(), src.cullRect().height( ),
464 record.detach(), NULL/*bbh*/)); 464 record.detach(), NULL/*bbh*/));
465 } 465 }
466 466
467 // fRecord OK 467 // fRecord OK
468 SkPicture* SkPicture::CreateFromStream(SkStream* stream, InstallPixelRefProc pro c) { 468 SkPicture* SkPicture::CreateFromStream(SkStream* stream, InstallPixelRefProc pro c) {
469 SkPictInfo info; 469 SkPictInfo info;
470 470
471 if (!InternalOnly_StreamIsSKP(stream, &info)) { 471 if (!InternalOnly_StreamIsSKP(stream, &info)) {
472 return NULL; 472 return NULL;
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
674 int SkPicture::approximateOpCount() const { 674 int SkPicture::approximateOpCount() const {
675 SkASSERT(fRecord.get() || fData.get()); 675 SkASSERT(fRecord.get() || fData.get());
676 if (fRecord.get()) { 676 if (fRecord.get()) {
677 return fRecord->count(); 677 return fRecord->count();
678 } 678 }
679 if (fData.get()) { 679 if (fData.get()) {
680 return fData->opCount(); 680 return fData->opCount();
681 } 681 }
682 return 0; 682 return 0;
683 } 683 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698