OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012 Adobe Systems Incorporated. All rights reserved. | 2 * Copyright (C) 2012 Adobe Systems Incorporated. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above | 8 * 1. Redistributions of source code must retain the above |
9 * copyright notice, this list of conditions and the following | 9 * copyright notice, this list of conditions and the following |
10 * disclaimer. | 10 * disclaimer. |
(...skipping 29 matching lines...) Expand all Loading... |
40 | 40 |
41 bool BasicShape::canBlend(const BasicShape* other) const | 41 bool BasicShape::canBlend(const BasicShape* other) const |
42 { | 42 { |
43 // FIXME: Support animations between different shapes in the future. | 43 // FIXME: Support animations between different shapes in the future. |
44 if (!other || !isSameType(*other)) | 44 if (!other || !isSameType(*other)) |
45 return false; | 45 return false; |
46 | 46 |
47 // Just polygons with same number of vertices can be animated. | 47 // Just polygons with same number of vertices can be animated. |
48 if (type() == BasicShape::BasicShapePolygonType | 48 if (type() == BasicShape::BasicShapePolygonType |
49 && (toBasicShapePolygon(this)->values().size() != toBasicShapePolygon(ot
her)->values().size() | 49 && (toBasicShapePolygon(this)->values().size() != toBasicShapePolygon(ot
her)->values().size() |
50 || toBasicShapePolygon(this)->windRule() != toBasicShapePolygon(other)->
windRule())) | 50 || toBasicShapePolygon(this)->getWindRule() != toBasicShapePolygon(other
)->getWindRule())) |
51 return false; | 51 return false; |
52 | 52 |
53 // Circles with keywords for radii or center coordinates cannot be animated. | 53 // Circles with keywords for radii or center coordinates cannot be animated. |
54 if (type() == BasicShape::BasicShapeCircleType) { | 54 if (type() == BasicShape::BasicShapeCircleType) { |
55 if (!toBasicShapeCircle(this)->radius().canBlend(toBasicShapeCircle(othe
r)->radius())) | 55 if (!toBasicShapeCircle(this)->radius().canBlend(toBasicShapeCircle(othe
r)->radius())) |
56 return false; | 56 return false; |
57 } | 57 } |
58 | 58 |
59 // Ellipses with keywords for radii or center coordinates cannot be animated
. | 59 // Ellipses with keywords for radii or center coordinates cannot be animated
. |
60 if (type() != BasicShape::BasicShapeEllipseType) | 60 if (type() != BasicShape::BasicShapeEllipseType) |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 | 194 |
195 const BasicShapePolygon* o = toBasicShapePolygon(other); | 195 const BasicShapePolygon* o = toBasicShapePolygon(other); |
196 ASSERT(m_values.size() == o->values().size()); | 196 ASSERT(m_values.size() == o->values().size()); |
197 ASSERT(!(m_values.size() % 2)); | 197 ASSERT(!(m_values.size() % 2)); |
198 | 198 |
199 size_t length = m_values.size(); | 199 size_t length = m_values.size(); |
200 RefPtr<BasicShapePolygon> result = BasicShapePolygon::create(); | 200 RefPtr<BasicShapePolygon> result = BasicShapePolygon::create(); |
201 if (!length) | 201 if (!length) |
202 return result.release(); | 202 return result.release(); |
203 | 203 |
204 result->setWindRule(o->windRule()); | 204 result->setWindRule(o->getWindRule()); |
205 | 205 |
206 for (size_t i = 0; i < length; i = i + 2) { | 206 for (size_t i = 0; i < length; i = i + 2) { |
207 result->appendPoint(m_values.at(i).blend(o->values().at(i), progress, Va
lueRangeAll), | 207 result->appendPoint(m_values.at(i).blend(o->values().at(i), progress, Va
lueRangeAll), |
208 m_values.at(i + 1).blend(o->values().at(i + 1), progress, ValueRange
All)); | 208 m_values.at(i + 1).blend(o->values().at(i + 1), progress, ValueRange
All)); |
209 } | 209 } |
210 | 210 |
211 return result.release(); | 211 return result.release(); |
212 } | 212 } |
213 | 213 |
214 bool BasicShapePolygon::operator==(const BasicShape& o) const | 214 bool BasicShapePolygon::operator==(const BasicShape& o) const |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 && m_top == other.m_top | 277 && m_top == other.m_top |
278 && m_bottom == other.m_bottom | 278 && m_bottom == other.m_bottom |
279 && m_left == other.m_left | 279 && m_left == other.m_left |
280 && m_topLeftRadius == other.m_topLeftRadius | 280 && m_topLeftRadius == other.m_topLeftRadius |
281 && m_topRightRadius == other.m_topRightRadius | 281 && m_topRightRadius == other.m_topRightRadius |
282 && m_bottomRightRadius == other.m_bottomRightRadius | 282 && m_bottomRightRadius == other.m_bottomRightRadius |
283 && m_bottomLeftRadius == other.m_bottomLeftRadius; | 283 && m_bottomLeftRadius == other.m_bottomLeftRadius; |
284 } | 284 } |
285 | 285 |
286 } // namespace blink | 286 } // namespace blink |
OLD | NEW |