| 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 "SkBBoxHierarchy.h" | 8 #include "SkBBoxHierarchy.h" |
| 9 #include "SkDrawPictureCallback.h" | 9 #include "SkDrawPictureCallback.h" |
| 10 #include "SkPictureData.h" | 10 #include "SkPictureData.h" |
| (...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 314 switch (tag) { | 314 switch (tag) { |
| 315 case SK_PICT_READER_TAG: | 315 case SK_PICT_READER_TAG: |
| 316 SkASSERT(NULL == fOpData); | 316 SkASSERT(NULL == fOpData); |
| 317 fOpData = SkData::NewFromStream(stream, size); | 317 fOpData = SkData::NewFromStream(stream, size); |
| 318 if (!fOpData) { | 318 if (!fOpData) { |
| 319 return false; | 319 return false; |
| 320 } | 320 } |
| 321 break; | 321 break; |
| 322 case SK_PICT_FACTORY_TAG: { | 322 case SK_PICT_FACTORY_TAG: { |
| 323 SkASSERT(!haveBuffer); | 323 SkASSERT(!haveBuffer); |
| 324 // Remove this code when v21 and below are no longer supported. At the | 324 size = stream->readU32(); |
| 325 // same time add a new 'count' variable and use it rather then reusing '
size'. | |
| 326 #ifndef DISABLE_V21_COMPATIBILITY_CODE | |
| 327 if (fInfo.fVersion >= 22) { | |
| 328 // in v22 this tag's size represents the size of the chunk in by
tes | |
| 329 // and the number of factory strings is written out separately | |
| 330 #endif | |
| 331 size = stream->readU32(); | |
| 332 #ifndef DISABLE_V21_COMPATIBILITY_CODE | |
| 333 } | |
| 334 #endif | |
| 335 fFactoryPlayback = SkNEW_ARGS(SkFactoryPlayback, (size)); | 325 fFactoryPlayback = SkNEW_ARGS(SkFactoryPlayback, (size)); |
| 336 for (size_t i = 0; i < size; i++) { | 326 for (size_t i = 0; i < size; i++) { |
| 337 SkString str; | 327 SkString str; |
| 338 const size_t len = stream->readPackedUInt(); | 328 const size_t len = stream->readPackedUInt(); |
| 339 str.resize(len); | 329 str.resize(len); |
| 340 if (stream->read(str.writable_str(), len) != len) { | 330 if (stream->read(str.writable_str(), len) != len) { |
| 341 return false; | 331 return false; |
| 342 } | 332 } |
| 343 fFactoryPlayback->base()[i] = SkFlattenable::NameToFactory(str.c
_str()); | 333 fFactoryPlayback->base()[i] = SkFlattenable::NameToFactory(str.c
_str()); |
| 344 } | 334 } |
| (...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 583 } | 573 } |
| 584 } | 574 } |
| 585 | 575 |
| 586 bool SkPictureData::suitableForLayerOptimization() const { | 576 bool SkPictureData::suitableForLayerOptimization() const { |
| 587 return fContentInfo.numLayers() > 0; | 577 return fContentInfo.numLayers() > 0; |
| 588 } | 578 } |
| 589 #endif | 579 #endif |
| 590 /////////////////////////////////////////////////////////////////////////////// | 580 /////////////////////////////////////////////////////////////////////////////// |
| 591 | 581 |
| 592 | 582 |
| OLD | NEW |