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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
75 RefPtr<BasicShapeRectangle> result = BasicShapeRectangle::create(); | 75 RefPtr<BasicShapeRectangle> result = BasicShapeRectangle::create(); |
76 result->setX(m_x.blend(o->x(), progress, ValueRangeAll)); | 76 result->setX(m_x.blend(o->x(), progress, ValueRangeAll)); |
77 result->setY(m_y.blend(o->y(), progress, ValueRangeAll)); | 77 result->setY(m_y.blend(o->y(), progress, ValueRangeAll)); |
78 result->setWidth(m_width.blend(o->width(), progress, ValueRangeNonNegative)) ; | 78 result->setWidth(m_width.blend(o->width(), progress, ValueRangeNonNegative)) ; |
79 result->setHeight(m_height.blend(o->height(), progress, ValueRangeNonNegativ e)); | 79 result->setHeight(m_height.blend(o->height(), progress, ValueRangeNonNegativ e)); |
80 result->setCornerRadiusX(m_cornerRadiusX.blend(o->cornerRadiusX(), progress, ValueRangeNonNegative)); | 80 result->setCornerRadiusX(m_cornerRadiusX.blend(o->cornerRadiusX(), progress, ValueRangeNonNegative)); |
81 result->setCornerRadiusY(m_cornerRadiusY.blend(o->cornerRadiusY(), progress, ValueRangeNonNegative)); | 81 result->setCornerRadiusY(m_cornerRadiusY.blend(o->cornerRadiusY(), progress, ValueRangeNonNegative)); |
82 return result.release(); | 82 return result.release(); |
83 } | 83 } |
84 | 84 |
85 void BasicShapeCircle::path(Path& path, const FloatRect& boundingBox) | 85 void DeprecatedBasicShapeCircle::path(Path& path, const FloatRect& boundingBox) |
86 { | 86 { |
87 ASSERT(path.isEmpty()); | 87 ASSERT(path.isEmpty()); |
88 float diagonal = sqrtf((boundingBox.width() * boundingBox.width() + bounding Box.height() * boundingBox.height()) / 2); | 88 float diagonal = sqrtf((boundingBox.width() * boundingBox.width() + bounding Box.height() * boundingBox.height()) / 2); |
89 float centerX = floatValueForLength(m_centerX, boundingBox.width()); | 89 float centerX = floatValueForLength(m_centerX, boundingBox.width()); |
90 float centerY = floatValueForLength(m_centerY, boundingBox.height()); | 90 float centerY = floatValueForLength(m_centerY, boundingBox.height()); |
91 float radius = floatValueForLength(m_radius, diagonal); | 91 float radius = floatValueForLength(m_radius, diagonal); |
92 path.addEllipse(FloatRect( | 92 path.addEllipse(FloatRect( |
93 centerX - radius + boundingBox.x(), | 93 centerX - radius + boundingBox.x(), |
94 centerY - radius + boundingBox.y(), | 94 centerY - radius + boundingBox.y(), |
95 radius * 2, | 95 radius * 2, |
96 radius * 2 | 96 radius * 2 |
97 )); | 97 )); |
98 } | 98 } |
99 | 99 |
100 PassRefPtr<BasicShape> DeprecatedBasicShapeCircle::blend(const BasicShape* other , double progress) const | |
101 { | |
102 ASSERT(type() == other->type()); | |
103 | |
104 const DeprecatedBasicShapeCircle* o = static_cast<const DeprecatedBasicShape Circle*>(other); | |
105 RefPtr<DeprecatedBasicShapeCircle> result = DeprecatedBasicShapeCircle::cre ate(); | |
106 result->setCenterX(m_centerX.blend(o->centerX(), progress, ValueRangeAll)); | |
107 result->setCenterY(m_centerY.blend(o->centerY(), progress, ValueRangeAll)); | |
108 result->setRadius(m_radius.blend(o->radius(), progress, ValueRangeNonNegativ e)); | |
109 return result.release(); | |
110 } | |
111 | |
112 void BasicShapeCircle::path(Path& path, const FloatRect& boundingBox) | |
113 { | |
114 ASSERT(path.isEmpty()); | |
115 // FIXME Complete implementation of path. Bug 124619. | |
bemjb
2013/12/07 00:05:32
Again, replace webkit bug with Blink bug #.
| |
116 // Compute closest-side and farthest-side from boundingBox. | |
117 // Compute top, left, bottom, right from boundingBox. | |
118 if (m_radius.type() != BasicShapeRadius::Value) | |
119 return; | |
120 if (m_centerX.keyword() != BasicShapeCenterCoordinate::None || m_centerY.key word() != BasicShapeCenterCoordinate::None) | |
121 return; | |
122 | |
123 float diagonal = sqrtf((boundingBox.width() * boundingBox.width() + bounding Box.height() * boundingBox.height()) / 2); | |
124 float centerX = floatValueForLength(m_centerX.length(), boundingBox.width()) ; | |
125 float centerY = floatValueForLength(m_centerY.length(), boundingBox.height() ); | |
126 float radius = floatValueForLength(m_radius.value(), diagonal); | |
127 path.addEllipse(FloatRect( | |
128 centerX - radius + boundingBox.x(), | |
129 centerY - radius + boundingBox.y(), | |
130 radius * 2, | |
131 radius * 2 | |
132 )); | |
133 } | |
134 | |
100 PassRefPtr<BasicShape> BasicShapeCircle::blend(const BasicShape* other, double p rogress) const | 135 PassRefPtr<BasicShape> BasicShapeCircle::blend(const BasicShape* other, double p rogress) const |
101 { | 136 { |
102 ASSERT(type() == other->type()); | 137 ASSERT(type() == other->type()); |
103 | |
104 const BasicShapeCircle* o = static_cast<const BasicShapeCircle*>(other); | 138 const BasicShapeCircle* o = static_cast<const BasicShapeCircle*>(other); |
105 RefPtr<BasicShapeCircle> result = BasicShapeCircle::create(); | 139 RefPtr<BasicShapeCircle> result = BasicShapeCircle::create(); |
106 result->setCenterX(m_centerX.blend(o->centerX(), progress, ValueRangeAll)); | 140 |
107 result->setCenterY(m_centerY.blend(o->centerY(), progress, ValueRangeAll)); | 141 if (m_radius.type() != BasicShapeRadius::Value || o->radius().type() != Basi cShapeRadius::Value) { |
108 result->setRadius(m_radius.blend(o->radius(), progress, ValueRangeNonNegativ e)); | 142 result->setCenterX(o->centerX()); |
143 result->setCenterY(o->centerY()); | |
144 result->setRadius(o->radius()); | |
145 return result; | |
146 } | |
147 | |
148 result->setCenterX(m_centerX.blend(o->centerX(), progress)); | |
149 result->setCenterY(m_centerY.blend(o->centerY(), progress)); | |
150 result->setRadius(m_radius.blend(o->radius(), progress)); | |
109 return result.release(); | 151 return result.release(); |
110 } | 152 } |
111 | 153 |
112 void BasicShapeEllipse::path(Path& path, const FloatRect& boundingBox) | 154 void DeprecatedBasicShapeEllipse::path(Path& path, const FloatRect& boundingBox) |
113 { | 155 { |
114 ASSERT(path.isEmpty()); | 156 ASSERT(path.isEmpty()); |
115 float centerX = floatValueForLength(m_centerX, boundingBox.width()); | 157 float centerX = floatValueForLength(m_centerX, boundingBox.width()); |
116 float centerY = floatValueForLength(m_centerY, boundingBox.height()); | 158 float centerY = floatValueForLength(m_centerY, boundingBox.height()); |
117 float radiusX = floatValueForLength(m_radiusX, boundingBox.width()); | 159 float radiusX = floatValueForLength(m_radiusX, boundingBox.width()); |
118 float radiusY = floatValueForLength(m_radiusY, boundingBox.height()); | 160 float radiusY = floatValueForLength(m_radiusY, boundingBox.height()); |
119 path.addEllipse(FloatRect( | 161 path.addEllipse(FloatRect( |
120 centerX - radiusX + boundingBox.x(), | 162 centerX - radiusX + boundingBox.x(), |
121 centerY - radiusY + boundingBox.y(), | 163 centerY - radiusY + boundingBox.y(), |
122 radiusX * 2, | 164 radiusX * 2, |
123 radiusY * 2 | 165 radiusY * 2 |
124 )); | 166 )); |
125 } | 167 } |
126 | 168 |
127 PassRefPtr<BasicShape> BasicShapeEllipse::blend(const BasicShape* other, double progress) const | 169 PassRefPtr<BasicShape> DeprecatedBasicShapeEllipse::blend(const BasicShape* othe r, double progress) const |
128 { | 170 { |
129 ASSERT(type() == other->type()); | 171 ASSERT(type() == other->type()); |
130 | 172 |
131 const BasicShapeEllipse* o = static_cast<const BasicShapeEllipse*>(other); | 173 const DeprecatedBasicShapeEllipse* o = static_cast<const DeprecatedBasicShap eEllipse*>(other); |
132 RefPtr<BasicShapeEllipse> result = BasicShapeEllipse::create(); | 174 RefPtr<DeprecatedBasicShapeEllipse> result = DeprecatedBasicShapeEllipse::cr eate(); |
133 result->setCenterX(m_centerX.blend(o->centerX(), progress, ValueRangeAll)); | 175 result->setCenterX(m_centerX.blend(o->centerX(), progress, ValueRangeAll)); |
134 result->setCenterY(m_centerY.blend(o->centerY(), progress, ValueRangeAll)); | 176 result->setCenterY(m_centerY.blend(o->centerY(), progress, ValueRangeAll)); |
135 result->setRadiusX(m_radiusX.blend(o->radiusX(), progress, ValueRangeNonNega tive)); | 177 result->setRadiusX(m_radiusX.blend(o->radiusX(), progress, ValueRangeNonNega tive)); |
136 result->setRadiusY(m_radiusY.blend(o->radiusY(), progress, ValueRangeNonNega tive)); | 178 result->setRadiusY(m_radiusY.blend(o->radiusY(), progress, ValueRangeNonNega tive)); |
137 return result.release(); | 179 return result.release(); |
138 } | 180 } |
139 | 181 |
182 void BasicShapeEllipse::path(Path& path, const FloatRect& boundingBox) | |
183 { | |
184 ASSERT(path.isEmpty()); | |
185 // FIXME Complete implementation of path. Bug 124619. | |
bemjb
2013/12/07 00:05:32
Ditto.
| |
186 // Compute closest-side and farthest-side from boundingBox. | |
187 // Compute top, left, bottom, right from boundingBox. | |
188 if (m_radiusX.type() != BasicShapeRadius::Value || m_radiusY.type() != Basic ShapeRadius::Value) | |
189 return; | |
190 if (m_centerX.keyword() != BasicShapeCenterCoordinate::None || m_centerY.key word() != BasicShapeCenterCoordinate::None) | |
191 return; | |
192 | |
193 float diagonal = sqrtf((boundingBox.width() * boundingBox.width() + bounding Box.height() * boundingBox.height()) / 2); | |
194 float centerX = floatValueForLength(m_centerX.length(), boundingBox.width()) ; | |
195 float centerY = floatValueForLength(m_centerY.length(), boundingBox.height() ); | |
196 float radiusX = floatValueForLength(m_radiusX.value(), diagonal); | |
197 float radiusY = floatValueForLength(m_radiusY.value(), diagonal); | |
198 path.addEllipse(FloatRect( | |
199 centerX - radiusX + boundingBox.x(), | |
200 centerY - radiusY + boundingBox.y(), | |
201 radiusX * 2, | |
202 radiusY * 2 | |
203 )); | |
204 } | |
205 | |
206 PassRefPtr<BasicShape> BasicShapeEllipse::blend(const BasicShape* other, double progress) const | |
207 { | |
208 ASSERT(type() == other->type()); | |
209 const BasicShapeEllipse* o = static_cast<const BasicShapeEllipse*>(other); | |
210 RefPtr<BasicShapeEllipse> result = BasicShapeEllipse::create(); | |
211 | |
212 if (m_radiusX.type() != BasicShapeRadius::Value || o->radiusX().type() != Ba sicShapeRadius::Value | |
213 || m_radiusY.type() != BasicShapeRadius::Value || o->radiusY().type() != BasicShapeRadius::Value) { | |
214 result->setCenterX(o->centerX()); | |
215 result->setCenterY(o->centerY()); | |
216 result->setRadiusX(o->radiusX()); | |
217 result->setRadiusY(o->radiusY()); | |
218 return result; | |
219 } | |
220 | |
221 result->setCenterX(m_centerX.blend(o->centerX(), progress)); | |
222 result->setCenterY(m_centerY.blend(o->centerY(), progress)); | |
223 result->setRadiusX(m_radiusX.blend(o->radiusX(), progress)); | |
224 result->setRadiusY(m_radiusY.blend(o->radiusY(), progress)); | |
225 return result.release(); | |
226 } | |
227 | |
140 void BasicShapePolygon::path(Path& path, const FloatRect& boundingBox) | 228 void BasicShapePolygon::path(Path& path, const FloatRect& boundingBox) |
141 { | 229 { |
142 ASSERT(path.isEmpty()); | 230 ASSERT(path.isEmpty()); |
143 ASSERT(!(m_values.size() % 2)); | 231 ASSERT(!(m_values.size() % 2)); |
144 size_t length = m_values.size(); | 232 size_t length = m_values.size(); |
145 | 233 |
146 if (!length) | 234 if (!length) |
147 return; | 235 return; |
148 | 236 |
149 path.moveTo(FloatPoint(floatValueForLength(m_values.at(0), boundingBox.width ()) + boundingBox.x(), | 237 path.moveTo(FloatPoint(floatValueForLength(m_values.at(0), boundingBox.width ()) + boundingBox.x(), |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
205 RefPtr<BasicShapeInsetRectangle> result = BasicShapeInsetRectangle::create( ); | 293 RefPtr<BasicShapeInsetRectangle> result = BasicShapeInsetRectangle::create( ); |
206 result->setTop(m_top.blend(o->top(), progress, ValueRangeNonNegative)); | 294 result->setTop(m_top.blend(o->top(), progress, ValueRangeNonNegative)); |
207 result->setRight(m_right.blend(o->right(), progress, ValueRangeNonNegative)) ; | 295 result->setRight(m_right.blend(o->right(), progress, ValueRangeNonNegative)) ; |
208 result->setBottom(m_bottom.blend(o->bottom(), progress, ValueRangeNonNegativ e)); | 296 result->setBottom(m_bottom.blend(o->bottom(), progress, ValueRangeNonNegativ e)); |
209 result->setLeft(m_left.blend(o->left(), progress, ValueRangeNonNegative)); | 297 result->setLeft(m_left.blend(o->left(), progress, ValueRangeNonNegative)); |
210 result->setCornerRadiusX(m_cornerRadiusX.blend(o->cornerRadiusX(), progress, ValueRangeNonNegative)); | 298 result->setCornerRadiusX(m_cornerRadiusX.blend(o->cornerRadiusX(), progress, ValueRangeNonNegative)); |
211 result->setCornerRadiusY(m_cornerRadiusY.blend(o->cornerRadiusY(), progress, ValueRangeNonNegative)); | 299 result->setCornerRadiusY(m_cornerRadiusY.blend(o->cornerRadiusY(), progress, ValueRangeNonNegative)); |
212 return result.release(); | 300 return result.release(); |
213 } | 301 } |
214 } | 302 } |
OLD | NEW |