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

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

Issue 496173002: Revert of Revert back to SkPictureData pictures. Huge perf regression. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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 | « no previous file | no next file » | 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 413 matching lines...) Expand 10 before | Expand all | Expand 10 after
424 if (!InternalOnly_StreamIsSKP(stream, &info)) { 424 if (!InternalOnly_StreamIsSKP(stream, &info)) {
425 return NULL; 425 return NULL;
426 } 426 }
427 427
428 // Check to see if there is a playback to recreate. 428 // Check to see if there is a playback to recreate.
429 if (stream->readBool()) { 429 if (stream->readBool()) {
430 SkPictureData* data = SkPictureData::CreateFromStream(stream, info, proc ); 430 SkPictureData* data = SkPictureData::CreateFromStream(stream, info, proc );
431 if (NULL == data) { 431 if (NULL == data) {
432 return NULL; 432 return NULL;
433 } 433 }
434 #if 0
435 const SkPicture src(data, info.fWidth, info.fHeight); 434 const SkPicture src(data, info.fWidth, info.fHeight);
436 return Forwardport(src); 435 return Forwardport(src);
437 #else
438 return SkNEW_ARGS(SkPicture, (data, info.fWidth, info.fHeight));
439 #endif
440 } 436 }
441 437
442 return NULL; 438 return NULL;
443 } 439 }
444 440
445 // fRecord OK 441 // fRecord OK
446 SkPicture* SkPicture::CreateFromBuffer(SkReadBuffer& buffer) { 442 SkPicture* SkPicture::CreateFromBuffer(SkReadBuffer& buffer) {
447 SkPictInfo info; 443 SkPictInfo info;
448 444
449 if (!InternalOnly_BufferIsSKP(buffer, &info)) { 445 if (!InternalOnly_BufferIsSKP(buffer, &info)) {
450 return NULL; 446 return NULL;
451 } 447 }
452 448
453 // Check to see if there is a playback to recreate. 449 // Check to see if there is a playback to recreate.
454 if (buffer.readBool()) { 450 if (buffer.readBool()) {
455 SkPictureData* data = SkPictureData::CreateFromBuffer(buffer, info); 451 SkPictureData* data = SkPictureData::CreateFromBuffer(buffer, info);
456 if (NULL == data) { 452 if (NULL == data) {
457 return NULL; 453 return NULL;
458 } 454 }
459 #if 0
460 const SkPicture src(data, info.fWidth, info.fHeight); 455 const SkPicture src(data, info.fWidth, info.fHeight);
461 return Forwardport(src); 456 return Forwardport(src);
462 #else
463 return SkNEW_ARGS(SkPicture, (data, info.fWidth, info.fHeight));
464 #endif
465 } 457 }
466 458
467 return NULL; 459 return NULL;
468 } 460 }
469 461
470 // fRecord OK 462 // fRecord OK
471 void SkPicture::createHeader(SkPictInfo* info) const { 463 void SkPicture::createHeader(SkPictInfo* info) const {
472 // Copy magic bytes at the beginning of the header 464 // Copy magic bytes at the beginning of the header
473 SkASSERT(sizeof(kMagic) == 8); 465 SkASSERT(sizeof(kMagic) == 8);
474 SkASSERT(sizeof(kMagic) == sizeof(info->fMagic)); 466 SkASSERT(sizeof(kMagic) == sizeof(info->fMagic));
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
632 int SkPicture::approximateOpCount() const { 624 int SkPicture::approximateOpCount() const {
633 SkASSERT(fRecord.get() || fData.get()); 625 SkASSERT(fRecord.get() || fData.get());
634 if (fRecord.get()) { 626 if (fRecord.get()) {
635 return fRecord->count(); 627 return fRecord->count();
636 } 628 }
637 if (fData.get()) { 629 if (fData.get()) {
638 return fData->opCount(); 630 return fData->opCount();
639 } 631 }
640 return 0; 632 return 0;
641 } 633 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698