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 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 std::max<float>(boundingBox.width() - left - floatValueForLength(m_r
ight, boundingBox.width()), 0), | 234 std::max<float>(boundingBox.width() - left - floatValueForLength(m_r
ight, boundingBox.width()), 0), |
235 std::max<float>(boundingBox.height() - top - floatValueForLength(m_b
ottom, boundingBox.height()), 0) | 235 std::max<float>(boundingBox.height() - top - floatValueForLength(m_b
ottom, boundingBox.height()), 0) |
236 ), | 236 ), |
237 floatSizeForLengthSize(m_topLeftRadius, boundingBox), | 237 floatSizeForLengthSize(m_topLeftRadius, boundingBox), |
238 floatSizeForLengthSize(m_topRightRadius, boundingBox), | 238 floatSizeForLengthSize(m_topRightRadius, boundingBox), |
239 floatSizeForLengthSize(m_bottomLeftRadius, boundingBox), | 239 floatSizeForLengthSize(m_bottomLeftRadius, boundingBox), |
240 floatSizeForLengthSize(m_bottomRightRadius, boundingBox) | 240 floatSizeForLengthSize(m_bottomRightRadius, boundingBox) |
241 ); | 241 ); |
242 } | 242 } |
243 | 243 |
244 PassRefPtr<BasicShape> BasicShapeInset::blend(const BasicShape* other, double) c
onst | 244 static inline LengthSize blendLengthSize(const LengthSize& to, const LengthSize&
from, double progress) |
245 { | 245 { |
246 ASSERT(type() == other->type()); | 246 return LengthSize(to.width().blend(from.width(), progress, ValueRangeAll), |
247 // FIXME: Implement blend for BasicShapeInset (see: crbug.com/448295). | 247 to.height().blend(from.height(), progress, ValueRangeAll)); |
248 return nullptr; | 248 } |
| 249 |
| 250 PassRefPtr<BasicShape> BasicShapeInset::blend(const BasicShape* other, double pr
ogress) const |
| 251 { |
| 252 ASSERT(other && isSameType(*other)); |
| 253 |
| 254 const BasicShapeInset& otherInset = toBasicShapeInset(*other); |
| 255 RefPtr<BasicShapeInset> result = BasicShapeInset::create(); |
| 256 result->setTop(m_top.blend(otherInset.top(), progress, ValueRangeAll)); |
| 257 result->setRight(m_right.blend(otherInset.right(), progress, ValueRangeAll))
; |
| 258 result->setBottom(m_bottom.blend(otherInset.bottom(), progress, ValueRangeAl
l)); |
| 259 result->setLeft(m_left.blend(otherInset.left(), progress, ValueRangeAll)); |
| 260 |
| 261 result->setTopLeftRadius(blendLengthSize(m_topLeftRadius, otherInset.topLeft
Radius(), progress)); |
| 262 result->setTopRightRadius(blendLengthSize(m_topRightRadius, otherInset.topRi
ghtRadius(), progress)); |
| 263 result->setBottomRightRadius(blendLengthSize(m_bottomRightRadius, otherInset
.bottomRightRadius(), progress)); |
| 264 result->setBottomLeftRadius(blendLengthSize(m_bottomLeftRadius, otherInset.b
ottomLeftRadius(), progress)); |
| 265 |
| 266 return result.release(); |
249 } | 267 } |
250 | 268 |
251 bool BasicShapeInset::operator==(const BasicShape& o) const | 269 bool BasicShapeInset::operator==(const BasicShape& o) const |
252 { | 270 { |
253 if (!isSameType(o)) | 271 if (!isSameType(o)) |
254 return false; | 272 return false; |
255 const BasicShapeInset& other = toBasicShapeInset(o); | 273 const BasicShapeInset& other = toBasicShapeInset(o); |
256 return m_right == other.m_right | 274 return m_right == other.m_right |
257 && m_top == other.m_top | 275 && m_top == other.m_top |
258 && m_bottom == other.m_bottom | 276 && m_bottom == other.m_bottom |
259 && m_left == other.m_left | 277 && m_left == other.m_left |
260 && m_topLeftRadius == other.m_topLeftRadius | 278 && m_topLeftRadius == other.m_topLeftRadius |
261 && m_topRightRadius == other.m_topRightRadius | 279 && m_topRightRadius == other.m_topRightRadius |
262 && m_bottomRightRadius == other.m_bottomRightRadius | 280 && m_bottomRightRadius == other.m_bottomRightRadius |
263 && m_bottomLeftRadius == other.m_bottomLeftRadius; | 281 && m_bottomLeftRadius == other.m_bottomLeftRadius; |
264 } | 282 } |
265 | 283 |
266 } | 284 } |
OLD | NEW |