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 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
398 return false; | 398 return false; |
399 } | 399 } |
400 fFactoryPlayback->base()[i] = SkFlattenable::NameToFactory(str.c
_str()); | 400 fFactoryPlayback->base()[i] = SkFlattenable::NameToFactory(str.c
_str()); |
401 } | 401 } |
402 } break; | 402 } break; |
403 case SK_PICT_TYPEFACE_TAG: { | 403 case SK_PICT_TYPEFACE_TAG: { |
404 SkASSERT(!haveBuffer); | 404 SkASSERT(!haveBuffer); |
405 const int count = SkToInt(size); | 405 const int count = SkToInt(size); |
406 fTFPlayback.setCount(count); | 406 fTFPlayback.setCount(count); |
407 for (int i = 0; i < count; i++) { | 407 for (int i = 0; i < count; i++) { |
408 SkAutoTUnref<SkTypeface> tf(SkTypeface::Deserialize(stream)); | 408 sk_sp<SkTypeface> tf(SkTypeface::MakeDeserialize(stream)); |
409 if (!tf.get()) { // failed to deserialize | 409 if (!tf.get()) { // failed to deserialize |
410 // fTFPlayback asserts it never has a null, so we plop in | 410 // fTFPlayback asserts it never has a null, so we plop in |
411 // the default here. | 411 // the default here. |
412 tf.reset(SkTypeface::RefDefault()); | 412 tf = SkTypeface::MakeDefault(); |
413 } | 413 } |
414 fTFPlayback.set(i, tf); | 414 fTFPlayback.set(i, tf.get()); |
415 } | 415 } |
416 } break; | 416 } break; |
417 case SK_PICT_PICTURE_TAG: { | 417 case SK_PICT_PICTURE_TAG: { |
418 fPictureCount = 0; | 418 fPictureCount = 0; |
419 fPictureRefs = new const SkPicture* [size]; | 419 fPictureRefs = new const SkPicture* [size]; |
420 for (uint32_t i = 0; i < size; i++) { | 420 for (uint32_t i = 0; i < size; i++) { |
421 fPictureRefs[i] = SkPicture::MakeFromStream(stream, proc, topLev
elTFPlayback).release(); | 421 fPictureRefs[i] = SkPicture::MakeFromStream(stream, proc, topLev
elTFPlayback).release(); |
422 if (!fPictureRefs[i]) { | 422 if (!fPictureRefs[i]) { |
423 return false; | 423 return false; |
424 } | 424 } |
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
659 } else { | 659 } else { |
660 return this->suitableForGpuRasterization(nullptr, reason); | 660 return this->suitableForGpuRasterization(nullptr, reason); |
661 } | 661 } |
662 } | 662 } |
663 | 663 |
664 bool SkPictureData::suitableForLayerOptimization() const { | 664 bool SkPictureData::suitableForLayerOptimization() const { |
665 return fContentInfo.numLayers() > 0; | 665 return fContentInfo.numLayers() > 0; |
666 } | 666 } |
667 #endif | 667 #endif |
668 /////////////////////////////////////////////////////////////////////////////// | 668 /////////////////////////////////////////////////////////////////////////////// |
OLD | NEW |