| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Google, Inc. | 2 * Copyright (C) 2012 Google, Inc. |
| 3 * All rights reserved. | 3 * All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 m_fillBoundingBox = FloatRect(m_center.x() - m_radii.width(), m_center.y() -
m_radii.height(), 2 * m_radii.width(), 2 * m_radii.height()); | 70 m_fillBoundingBox = FloatRect(m_center.x() - m_radii.width(), m_center.y() -
m_radii.height(), 2 * m_radii.width(), 2 * m_radii.height()); |
| 71 m_strokeBoundingBox = m_fillBoundingBox; | 71 m_strokeBoundingBox = m_fillBoundingBox; |
| 72 if (style()->svgStyle()->hasStroke()) | 72 if (style()->svgStyle()->hasStroke()) |
| 73 m_strokeBoundingBox.inflate(strokeWidth() / 2); | 73 m_strokeBoundingBox.inflate(strokeWidth() / 2); |
| 74 } | 74 } |
| 75 | 75 |
| 76 void RenderSVGEllipse::calculateRadiiAndCenter() | 76 void RenderSVGEllipse::calculateRadiiAndCenter() |
| 77 { | 77 { |
| 78 ASSERT(node()); | 78 ASSERT(node()); |
| 79 if (node()->hasTagName(SVGNames::circleTag)) { | 79 if (node()->hasTagName(SVGNames::circleTag)) { |
| 80 | 80 SVGCircleElement* circle = toSVGCircleElement(node()); |
| 81 SVGCircleElement* circle = static_cast<SVGCircleElement*>(node()); | |
| 82 | 81 |
| 83 SVGLengthContext lengthContext(circle); | 82 SVGLengthContext lengthContext(circle); |
| 84 float radius = circle->rCurrentValue().value(lengthContext); | 83 float radius = circle->rCurrentValue().value(lengthContext); |
| 85 m_radii = FloatSize(radius, radius); | 84 m_radii = FloatSize(radius, radius); |
| 86 m_center = FloatPoint(circle->cxCurrentValue().value(lengthContext), cir
cle->cyCurrentValue().value(lengthContext)); | 85 m_center = FloatPoint(circle->cxCurrentValue().value(lengthContext), cir
cle->cyCurrentValue().value(lengthContext)); |
| 87 return; | 86 return; |
| 88 } | 87 } |
| 89 | 88 |
| 90 ASSERT(node()->hasTagName(SVGNames::ellipseTag)); | 89 ASSERT(node()->hasTagName(SVGNames::ellipseTag)); |
| 91 SVGEllipseElement* ellipse = static_cast<SVGEllipseElement*>(node()); | 90 SVGEllipseElement* ellipse = static_cast<SVGEllipseElement*>(node()); |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 FloatPoint center = FloatPoint(m_center.x() - point.x(), m_center.y() - poin
t.y()); | 147 FloatPoint center = FloatPoint(m_center.x() - point.x(), m_center.y() - poin
t.y()); |
| 149 | 148 |
| 150 // This works by checking if the point satisfies the ellipse equation. | 149 // This works by checking if the point satisfies the ellipse equation. |
| 151 // (x/rX)^2 + (y/rY)^2 <= 1 | 150 // (x/rX)^2 + (y/rY)^2 <= 1 |
| 152 float xrX = center.x() / m_radii.width(); | 151 float xrX = center.x() / m_radii.width(); |
| 153 float yrY = center.y() / m_radii.height(); | 152 float yrY = center.y() / m_radii.height(); |
| 154 return xrX * xrX + yrY * yrY <= 1.0; | 153 return xrX * xrX + yrY * yrY <= 1.0; |
| 155 } | 154 } |
| 156 | 155 |
| 157 } | 156 } |
| OLD | NEW |