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