OLD | NEW |
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 "SkImageGenerator.h" | 8 #include "SkImageGenerator.h" |
9 #include "SkPictureData.h" | 9 #include "SkPictureData.h" |
10 #include "SkPictureRecord.h" | 10 #include "SkPictureRecord.h" |
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
406 SkAutoMalloc storage(size); | 406 SkAutoMalloc storage(size); |
407 if (stream->read(storage.get(), size) != size) { | 407 if (stream->read(storage.get(), size) != size) { |
408 return false; | 408 return false; |
409 } | 409 } |
410 | 410 |
411 /* Should we use SkValidatingReadBuffer instead? */ | 411 /* Should we use SkValidatingReadBuffer instead? */ |
412 SkReadBuffer buffer(storage.get(), size); | 412 SkReadBuffer buffer(storage.get(), size); |
413 buffer.setFlags(pictInfoFlagsToReadBufferFlags(fInfo.fFlags)); | 413 buffer.setFlags(pictInfoFlagsToReadBufferFlags(fInfo.fFlags)); |
414 buffer.setVersion(fInfo.fVersion); | 414 buffer.setVersion(fInfo.fVersion); |
415 | 415 |
| 416 if (!fFactoryPlayback) { |
| 417 return false; |
| 418 } |
416 fFactoryPlayback->setupBuffer(buffer); | 419 fFactoryPlayback->setupBuffer(buffer); |
417 buffer.setBitmapDecoder(proc); | 420 buffer.setBitmapDecoder(proc); |
418 | 421 |
419 if (fTFPlayback.count() > 0) { | 422 if (fTFPlayback.count() > 0) { |
420 // .skp files <= v43 have typefaces serialized with each sub pic
ture. | 423 // .skp files <= v43 have typefaces serialized with each sub pic
ture. |
421 fTFPlayback.setupBuffer(buffer); | 424 fTFPlayback.setupBuffer(buffer); |
422 } else { | 425 } else { |
423 // Newer .skp files serialize all typefaces with the top picture
. | 426 // Newer .skp files serialize all typefaces with the top picture
. |
424 topLevelTFPlayback->setupBuffer(buffer); | 427 topLevelTFPlayback->setupBuffer(buffer); |
425 } | 428 } |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
625 } | 628 } |
626 } | 629 } |
627 | 630 |
628 bool SkPictureData::suitableForLayerOptimization() const { | 631 bool SkPictureData::suitableForLayerOptimization() const { |
629 return fContentInfo.numLayers() > 0; | 632 return fContentInfo.numLayers() > 0; |
630 } | 633 } |
631 #endif | 634 #endif |
632 /////////////////////////////////////////////////////////////////////////////// | 635 /////////////////////////////////////////////////////////////////////////////// |
633 | 636 |
634 | 637 |
OLD | NEW |