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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 (*dst)->fIsFinite = false; | 96 (*dst)->fIsFinite = false; |
97 (*dst)->fBounds.setEmpty(); | 97 (*dst)->fBounds.setEmpty(); |
98 } | 98 } |
99 } else { | 99 } else { |
100 (*dst)->fBoundsIsDirty = true; | 100 (*dst)->fBoundsIsDirty = true; |
101 } | 101 } |
102 | 102 |
103 SkDEBUGCODE((*dst)->validate();) | 103 SkDEBUGCODE((*dst)->validate();) |
104 } | 104 } |
105 | 105 |
106 SkPathRef* SkPathRef::CreateFromBuffer(SkRBuffer* buffer | 106 SkPathRef* SkPathRef::CreateFromBuffer(SkRBuffer* buffer) { |
107 #ifndef DELETE_THIS_CODE_WHEN_SKPS_ARE_REBUILT_AT_V14_AND_ALL_OTHER_INSTANCES_TO
O | |
108 , bool newFormat, int32_t oldPacked | |
109 #endif | |
110 ) { | |
111 SkPathRef* ref = SkNEW(SkPathRef); | 107 SkPathRef* ref = SkNEW(SkPathRef); |
112 #ifndef DELETE_THIS_CODE_WHEN_SKPS_ARE_REBUILT_AT_V14_AND_ALL_OTHER_INSTANCES_TO
O | |
113 if (newFormat) { | |
114 #endif | |
115 int32_t packed; | |
116 if (!buffer->readS32(&packed)) { | |
117 SkDELETE(ref); | |
118 return NULL; | |
119 } | |
120 | 108 |
121 ref->fIsFinite = (packed >> kIsFinite_SerializationShift) & 1; | 109 int32_t packed; |
122 #ifndef DELETE_THIS_CODE_WHEN_SKPS_ARE_REBUILT_AT_V14_AND_ALL_OTHER_INSTANCES_TO
O | 110 if (!buffer->readS32(&packed)) { |
123 } else { | 111 SkDELETE(ref); |
124 ref->fIsFinite = (oldPacked >> SkPath::kOldIsFinite_SerializationShift)
& 1; | 112 return NULL; |
125 } | 113 } |
126 #endif | 114 |
| 115 ref->fIsFinite = (packed >> kIsFinite_SerializationShift) & 1; |
127 | 116 |
128 int32_t verbCount, pointCount, conicCount; | 117 int32_t verbCount, pointCount, conicCount; |
129 if (!buffer->readU32(&(ref->fGenerationID)) || | 118 if (!buffer->readU32(&(ref->fGenerationID)) || |
130 !buffer->readS32(&verbCount) || | 119 !buffer->readS32(&verbCount) || |
131 !buffer->readS32(&pointCount) || | 120 !buffer->readS32(&pointCount) || |
132 !buffer->readS32(&conicCount)) { | 121 !buffer->readS32(&conicCount)) { |
133 SkDELETE(ref); | 122 SkDELETE(ref); |
134 return NULL; | 123 return NULL; |
135 } | 124 } |
136 | 125 |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
341 fBounds.fTop - fPoints[i].fY < SK_ScalarNearlyZero && | 330 fBounds.fTop - fPoints[i].fY < SK_ScalarNearlyZero && |
342 fPoints[i].fY - fBounds.fBottom < SK_ScalarNearlyZero)); | 331 fPoints[i].fY - fBounds.fBottom < SK_ScalarNearlyZero)); |
343 if (!fPoints[i].isFinite()) { | 332 if (!fPoints[i].isFinite()) { |
344 isFinite = false; | 333 isFinite = false; |
345 } | 334 } |
346 } | 335 } |
347 SkASSERT(SkToBool(fIsFinite) == isFinite); | 336 SkASSERT(SkToBool(fIsFinite) == isFinite); |
348 } | 337 } |
349 } | 338 } |
350 #endif | 339 #endif |
OLD | NEW |