| 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 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 385 // the default here. | 385 // the default here. |
| 386 tf.reset(SkTypeface::RefDefault()); | 386 tf.reset(SkTypeface::RefDefault()); |
| 387 } | 387 } |
| 388 fTFPlayback.set(i, tf); | 388 fTFPlayback.set(i, tf); |
| 389 } | 389 } |
| 390 } break; | 390 } break; |
| 391 case SK_PICT_PICTURE_TAG: { | 391 case SK_PICT_PICTURE_TAG: { |
| 392 fPictureCount = 0; | 392 fPictureCount = 0; |
| 393 fPictureRefs = new const SkPicture* [size]; | 393 fPictureRefs = new const SkPicture* [size]; |
| 394 for (uint32_t i = 0; i < size; i++) { | 394 for (uint32_t i = 0; i < size; i++) { |
| 395 fPictureRefs[i] = SkPicture::CreateFromStream(stream, proc, topL
evelTFPlayback); | 395 fPictureRefs[i] = SkPicture::MakeFromStream(stream, proc, topLev
elTFPlayback).release(); |
| 396 if (!fPictureRefs[i]) { | 396 if (!fPictureRefs[i]) { |
| 397 return false; | 397 return false; |
| 398 } | 398 } |
| 399 fPictureCount++; | 399 fPictureCount++; |
| 400 } | 400 } |
| 401 } break; | 401 } break; |
| 402 case SK_PICT_BUFFER_SIZE_TAG: { | 402 case SK_PICT_BUFFER_SIZE_TAG: { |
| 403 SkAutoMalloc storage(size); | 403 SkAutoMalloc storage(size); |
| 404 if (stream->read(storage.get(), size) != size) { | 404 if (stream->read(storage.get(), size) != size) { |
| 405 return false; | 405 return false; |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 440 return true; // success | 440 return true; // success |
| 441 } | 441 } |
| 442 | 442 |
| 443 static const SkImage* create_image_from_buffer(SkReadBuffer& buffer) { | 443 static const SkImage* create_image_from_buffer(SkReadBuffer& buffer) { |
| 444 return buffer.readImage(); | 444 return buffer.readImage(); |
| 445 } | 445 } |
| 446 | 446 |
| 447 // Need a shallow wrapper to return const SkPicture* to match the other factorie
s, | 447 // Need a shallow wrapper to return const SkPicture* to match the other factorie
s, |
| 448 // as SkPicture::CreateFromBuffer() returns SkPicture* | 448 // as SkPicture::CreateFromBuffer() returns SkPicture* |
| 449 static const SkPicture* create_picture_from_buffer(SkReadBuffer& buffer) { | 449 static const SkPicture* create_picture_from_buffer(SkReadBuffer& buffer) { |
| 450 return SkPicture::CreateFromBuffer(buffer); | 450 return SkPicture::MakeFromBuffer(buffer).release(); |
| 451 } | 451 } |
| 452 | 452 |
| 453 template <typename T> | 453 template <typename T> |
| 454 bool new_array_from_buffer(SkReadBuffer& buffer, uint32_t inCount, | 454 bool new_array_from_buffer(SkReadBuffer& buffer, uint32_t inCount, |
| 455 const T*** array, int* outCount, const T* (*factory)(
SkReadBuffer&)) { | 455 const T*** array, int* outCount, const T* (*factory)(
SkReadBuffer&)) { |
| 456 if (!buffer.validate((0 == *outCount) && (nullptr == *array))) { | 456 if (!buffer.validate((0 == *outCount) && (nullptr == *array))) { |
| 457 return false; | 457 return false; |
| 458 } | 458 } |
| 459 if (0 == inCount) { | 459 if (0 == inCount) { |
| 460 return true; | 460 return true; |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 625 } | 625 } |
| 626 } | 626 } |
| 627 | 627 |
| 628 bool SkPictureData::suitableForLayerOptimization() const { | 628 bool SkPictureData::suitableForLayerOptimization() const { |
| 629 return fContentInfo.numLayers() > 0; | 629 return fContentInfo.numLayers() > 0; |
| 630 } | 630 } |
| 631 #endif | 631 #endif |
| 632 /////////////////////////////////////////////////////////////////////////////// | 632 /////////////////////////////////////////////////////////////////////////////// |
| 633 | 633 |
| 634 | 634 |
| OLD | NEW |