OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 Google Inc. |
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 #include "SkPicturePlayback.h" | 8 #include "SkPicturePlayback.h" |
9 #include "SkPictureRecord.h" | 9 #include "SkPictureRecord.h" |
10 #include "SkTypeface.h" | 10 #include "SkTypeface.h" |
(...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
513 // fTFPlayback asserts it never has a null, so we plop in | 513 // fTFPlayback asserts it never has a null, so we plop in |
514 // the default here. | 514 // the default here. |
515 tf.reset(SkTypeface::RefDefault()); | 515 tf.reset(SkTypeface::RefDefault()); |
516 } | 516 } |
517 fTFPlayback.set(i, tf); | 517 fTFPlayback.set(i, tf); |
518 } | 518 } |
519 } break; | 519 } break; |
520 case PICT_PICTURE_TAG: { | 520 case PICT_PICTURE_TAG: { |
521 fPictureCount = size; | 521 fPictureCount = size; |
522 fPictureRefs = SkNEW_ARRAY(SkPicture*, fPictureCount); | 522 fPictureRefs = SkNEW_ARRAY(SkPicture*, fPictureCount); |
523 bool success; | |
524 for (int i = 0; i < fPictureCount; i++) { | 523 for (int i = 0; i < fPictureCount; i++) { |
525 fPictureRefs[i] = SkNEW_ARGS(SkPicture, (stream, &success, proc)
); | 524 fPictureRefs[i] = SkPicture::CreateFromStream(stream, proc); |
526 // Success can only be false if PICTURE_VERSION does not match | 525 // CreateFromStream can only fail if PICTURE_VERSION does not ma
tch |
527 // (which should never happen from here, since a sub picture wil
l | 526 // (which should never happen from here, since a sub picture wil
l |
528 // have the same PICTURE_VERSION as its parent) or if stream->re
ad | 527 // have the same PICTURE_VERSION as its parent) or if stream->re
ad |
529 // returns 0. In the latter case, we have a bug when writing the | 528 // returns 0. In the latter case, we have a bug when writing the |
530 // picture to begin with, which will be alerted to here. | 529 // picture to begin with, which will be alerted to here. |
531 SkASSERT(success); | 530 SkASSERT(fPictureRefs[i] != NULL); |
532 } | 531 } |
533 } break; | 532 } break; |
534 case PICT_BUFFER_SIZE_TAG: { | 533 case PICT_BUFFER_SIZE_TAG: { |
535 SkAutoMalloc storage(size); | 534 SkAutoMalloc storage(size); |
536 stream->read(storage.get(), size); | 535 stream->read(storage.get(), size); |
537 | 536 |
538 SkOrderedReadBuffer buffer(storage.get(), size); | 537 SkOrderedReadBuffer buffer(storage.get(), size); |
539 buffer.setFlags(pictInfoFlagsToReadBufferFlags(info.fFlags)); | 538 buffer.setFlags(pictInfoFlagsToReadBufferFlags(info.fFlags)); |
540 | 539 |
541 fFactoryPlayback->setupBuffer(buffer); | 540 fFactoryPlayback->setupBuffer(buffer); |
(...skipping 1068 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1610 for (index = 0; index < fRegionCount; index++) | 1609 for (index = 0; index < fRegionCount; index++) |
1611 bufferPtr += snprintf(bufferPtr, DUMP_BUFFER_SIZE - (bufferPtr - pBuffer
), | 1610 bufferPtr += snprintf(bufferPtr, DUMP_BUFFER_SIZE - (bufferPtr - pBuffer
), |
1612 "region%p, ", &fRegions[index]); | 1611 "region%p, ", &fRegions[index]); |
1613 if (fRegionCount > 0) | 1612 if (fRegionCount > 0) |
1614 SkDebugf("%s0};\n", pBuffer); | 1613 SkDebugf("%s0};\n", pBuffer); |
1615 | 1614 |
1616 const_cast<SkPicturePlayback*>(this)->dumpStream(); | 1615 const_cast<SkPicturePlayback*>(this)->dumpStream(); |
1617 } | 1616 } |
1618 | 1617 |
1619 #endif | 1618 #endif |
OLD | NEW |