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

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

Issue 291913004: formalize named picture versions (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 6 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « src/core/SkPaint.cpp ('k') | src/core/SkReadBuffer.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 * Copyright 2011 Google Inc. 2 * Copyright 2011 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 #include <new> 7 #include <new>
8 #include "SkBBoxHierarchy.h" 8 #include "SkBBoxHierarchy.h"
9 #include "SkPicturePlayback.h" 9 #include "SkPicturePlayback.h"
10 #include "SkPictureRecord.h" 10 #include "SkPictureRecord.h"
(...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after
527 } 527 }
528 } break; 528 } break;
529 case SK_PICT_BUFFER_SIZE_TAG: { 529 case SK_PICT_BUFFER_SIZE_TAG: {
530 SkAutoMalloc storage(size); 530 SkAutoMalloc storage(size);
531 if (stream->read(storage.get(), size) != size) { 531 if (stream->read(storage.get(), size) != size) {
532 return false; 532 return false;
533 } 533 }
534 534
535 SkReadBuffer buffer(storage.get(), size); 535 SkReadBuffer buffer(storage.get(), size);
536 buffer.setFlags(pictInfoFlagsToReadBufferFlags(fInfo.fFlags)); 536 buffer.setFlags(pictInfoFlagsToReadBufferFlags(fInfo.fFlags));
537 buffer.setPictureVersion(fInfo.fVersion); 537 buffer.setVersion(fInfo.fVersion);
538 538
539 fFactoryPlayback->setupBuffer(buffer); 539 fFactoryPlayback->setupBuffer(buffer);
540 fTFPlayback.setupBuffer(buffer); 540 fTFPlayback.setupBuffer(buffer);
541 buffer.setBitmapDecoder(proc); 541 buffer.setBitmapDecoder(proc);
542 542
543 while (!buffer.eof()) { 543 while (!buffer.eof()) {
544 tag = buffer.readUInt(); 544 tag = buffer.readUInt();
545 size = buffer.readUInt(); 545 size = buffer.readUInt();
546 if (!this->parseBufferTag(picture, buffer, tag, size)) { 546 if (!this->parseBufferTag(picture, buffer, tag, size)) {
547 return false; 547 return false;
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
627 if (!playback->parseStream(picture, stream, proc)) { 627 if (!playback->parseStream(picture, stream, proc)) {
628 return NULL; 628 return NULL;
629 } 629 }
630 return playback.detach(); 630 return playback.detach();
631 } 631 }
632 632
633 SkPicturePlayback* SkPicturePlayback::CreateFromBuffer(SkPicture* picture, 633 SkPicturePlayback* SkPicturePlayback::CreateFromBuffer(SkPicture* picture,
634 SkReadBuffer& buffer, 634 SkReadBuffer& buffer,
635 const SkPictInfo& info) { 635 const SkPictInfo& info) {
636 SkAutoTDelete<SkPicturePlayback> playback(SkNEW_ARGS(SkPicturePlayback, (pic ture, info))); 636 SkAutoTDelete<SkPicturePlayback> playback(SkNEW_ARGS(SkPicturePlayback, (pic ture, info)));
637 buffer.setPictureVersion(info.fVersion); 637 buffer.setVersion(info.fVersion);
638 638
639 if (!playback->parseBuffer(picture, buffer)) { 639 if (!playback->parseBuffer(picture, buffer)) {
640 return NULL; 640 return NULL;
641 } 641 }
642 return playback.detach(); 642 return playback.detach();
643 } 643 }
644 644
645 bool SkPicturePlayback::parseStream(SkPicture* picture, 645 bool SkPicturePlayback::parseStream(SkPicture* picture,
646 SkStream* stream, 646 SkStream* stream,
647 SkPicture::InstallPixelRefProc proc) { 647 SkPicture::InstallPixelRefProc proc) {
(...skipping 1190 matching lines...) Expand 10 before | Expand all | Expand 10 after
1838 for (index = 0; index < fPictureCount; index++) 1838 for (index = 0; index < fPictureCount; index++)
1839 bufferPtr += snprintf(bufferPtr, DUMP_BUFFER_SIZE - (bufferPtr - pBuffer ), 1839 bufferPtr += snprintf(bufferPtr, DUMP_BUFFER_SIZE - (bufferPtr - pBuffer ),
1840 "picture%p, ", fPictureRefs[index]); 1840 "picture%p, ", fPictureRefs[index]);
1841 if (fPictureCount > 0) 1841 if (fPictureCount > 0)
1842 SkDebugf("%s0};\n", pBuffer); 1842 SkDebugf("%s0};\n", pBuffer);
1843 1843
1844 const_cast<SkPicturePlayback*>(this)->dumpStream(); 1844 const_cast<SkPicturePlayback*>(this)->dumpStream();
1845 } 1845 }
1846 1846
1847 #endif 1847 #endif
OLDNEW
« no previous file with comments | « src/core/SkPaint.cpp ('k') | src/core/SkReadBuffer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698