| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 | 7 |
| 8 #include "SkBuffer.h" | 8 #include "SkBuffer.h" |
| 9 #include "SkOnce.h" | 9 #include "SkOnce.h" |
| 10 #include "SkPath.h" | 10 #include "SkPath.h" |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 } | 98 } |
| 99 | 99 |
| 100 (*dst)->fSegmentMask = src.fSegmentMask; | 100 (*dst)->fSegmentMask = src.fSegmentMask; |
| 101 | 101 |
| 102 // It's an oval only if it stays a rect. | 102 // It's an oval only if it stays a rect. |
| 103 (*dst)->fIsOval = src.fIsOval && matrix.rectStaysRect(); | 103 (*dst)->fIsOval = src.fIsOval && matrix.rectStaysRect(); |
| 104 | 104 |
| 105 SkDEBUGCODE((*dst)->validate();) | 105 SkDEBUGCODE((*dst)->validate();) |
| 106 } | 106 } |
| 107 | 107 |
| 108 SkPathRef* SkPathRef::CreateFromBuffer(SkRBuffer* buffer | 108 SkPathRef* SkPathRef::CreateFromBuffer(SkRBuffer* buffer) { |
| 109 #ifndef DELETE_THIS_CODE_WHEN_SKPS_ARE_REBUILT_AT_V16_AND_ALL_OTHER_INSTANCES_TO
O | |
| 110 , bool newFormat, int32_t oldPacked | |
| 111 #endif | |
| 112 ) { | |
| 113 SkPathRef* ref = SkNEW(SkPathRef); | 109 SkPathRef* ref = SkNEW(SkPathRef); |
| 114 bool isOval; | 110 bool isOval; |
| 115 uint8_t segmentMask; | 111 uint8_t segmentMask; |
| 116 | 112 |
| 117 int32_t packed; | 113 int32_t packed; |
| 118 if (!buffer->readS32(&packed)) { | 114 if (!buffer->readS32(&packed)) { |
| 119 SkDELETE(ref); | 115 SkDELETE(ref); |
| 120 return NULL; | 116 return NULL; |
| 121 } | 117 } |
| 122 | 118 |
| 123 ref->fIsFinite = (packed >> kIsFinite_SerializationShift) & 1; | 119 ref->fIsFinite = (packed >> kIsFinite_SerializationShift) & 1; |
| 124 | 120 segmentMask = (packed >> kSegmentMask_SerializationShift) & 0xF; |
| 125 #ifndef DELETE_THIS_CODE_WHEN_SKPS_ARE_REBUILT_AT_V16_AND_ALL_OTHER_INSTANCES_TO
O | 121 isOval = (packed >> kIsOval_SerializationShift) & 1; |
| 126 if (newFormat) { | |
| 127 #endif | |
| 128 segmentMask = (packed >> kSegmentMask_SerializationShift) & 0xF; | |
| 129 isOval = (packed >> kIsOval_SerializationShift) & 1; | |
| 130 #ifndef DELETE_THIS_CODE_WHEN_SKPS_ARE_REBUILT_AT_V16_AND_ALL_OTHER_INSTANCES_TO
O | |
| 131 } else { | |
| 132 segmentMask = (oldPacked >> SkPath::kOldSegmentMask_SerializationShift)
& 0xF; | |
| 133 isOval = (oldPacked >> SkPath::kOldIsOval_SerializationShift) & 1; | |
| 134 } | |
| 135 #endif | |
| 136 | 122 |
| 137 int32_t verbCount, pointCount, conicCount; | 123 int32_t verbCount, pointCount, conicCount; |
| 138 if (!buffer->readU32(&(ref->fGenerationID)) || | 124 if (!buffer->readU32(&(ref->fGenerationID)) || |
| 139 !buffer->readS32(&verbCount) || | 125 !buffer->readS32(&verbCount) || |
| 140 !buffer->readS32(&pointCount) || | 126 !buffer->readS32(&pointCount) || |
| 141 !buffer->readS32(&conicCount)) { | 127 !buffer->readS32(&conicCount)) { |
| 142 SkDELETE(ref); | 128 SkDELETE(ref); |
| 143 return NULL; | 129 return NULL; |
| 144 } | 130 } |
| 145 | 131 |
| (...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 495 break; | 481 break; |
| 496 default: | 482 default: |
| 497 SkDEBUGFAIL("Unknown Verb"); | 483 SkDEBUGFAIL("Unknown Verb"); |
| 498 break; | 484 break; |
| 499 } | 485 } |
| 500 } | 486 } |
| 501 SkASSERT(mask == fSegmentMask); | 487 SkASSERT(mask == fSegmentMask); |
| 502 #endif // SK_DEBUG_PATH | 488 #endif // SK_DEBUG_PATH |
| 503 } | 489 } |
| 504 #endif | 490 #endif |
| OLD | NEW |