| 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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 ASSERT(radius >= 0); | 63 ASSERT(radius >= 0); |
| 64 return adoptPtr(new RectangleShape(FloatRect(center.x() - radius, center.y()
- radius, radius*2, radius*2), FloatSize(radius, radius))); | 64 return adoptPtr(new RectangleShape(FloatRect(center.x() - radius, center.y()
- radius, radius*2, radius*2), FloatSize(radius, radius))); |
| 65 } | 65 } |
| 66 | 66 |
| 67 static PassOwnPtr<Shape> createEllipseShape(const FloatPoint& center, const Floa
tSize& radii) | 67 static PassOwnPtr<Shape> createEllipseShape(const FloatPoint& center, const Floa
tSize& radii) |
| 68 { | 68 { |
| 69 ASSERT(radii.width() >= 0 && radii.height() >= 0); | 69 ASSERT(radii.width() >= 0 && radii.height() >= 0); |
| 70 return adoptPtr(new RectangleShape(FloatRect(center.x() - radii.width(), cen
ter.y() - radii.height(), radii.width()*2, radii.height()*2), radii)); | 70 return adoptPtr(new RectangleShape(FloatRect(center.x() - radii.width(), cen
ter.y() - radii.height(), radii.width()*2, radii.height()*2), radii)); |
| 71 } | 71 } |
| 72 | 72 |
| 73 static PassOwnPtr<Shape> createPolygonShape(PassOwnPtr<Vector<FloatPoint> > vert
ices, WindRule fillRule) | 73 static PassOwnPtr<Shape> createPolygonShape(PassOwnPtr<Vector<FloatPoint>> verti
ces, WindRule fillRule) |
| 74 { | 74 { |
| 75 return adoptPtr(new PolygonShape(vertices, fillRule)); | 75 return adoptPtr(new PolygonShape(vertices, fillRule)); |
| 76 } | 76 } |
| 77 | 77 |
| 78 static inline FloatRect physicalRectToLogical(const FloatRect& rect, float logic
alBoxHeight, WritingMode writingMode) | 78 static inline FloatRect physicalRectToLogical(const FloatRect& rect, float logic
alBoxHeight, WritingMode writingMode) |
| 79 { | 79 { |
| 80 if (isHorizontalWritingMode(writingMode)) | 80 if (isHorizontalWritingMode(writingMode)) |
| 81 return rect; | 81 return rect; |
| 82 if (isFlippedBlocksWritingMode(writingMode)) | 82 if (isFlippedBlocksWritingMode(writingMode)) |
| 83 return FloatRect(rect.y(), logicalBoxHeight - rect.maxX(), rect.height()
, rect.width()); | 83 return FloatRect(rect.y(), logicalBoxHeight - rect.maxX(), rect.height()
, rect.width()); |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 | 130 |
| 131 shape = createEllipseShape(logicalCenter, FloatSize(radiusX, radiusY)); | 131 shape = createEllipseShape(logicalCenter, FloatSize(radiusX, radiusY)); |
| 132 break; | 132 break; |
| 133 } | 133 } |
| 134 | 134 |
| 135 case BasicShape::BasicShapePolygonType: { | 135 case BasicShape::BasicShapePolygonType: { |
| 136 const BasicShapePolygon* polygon = toBasicShapePolygon(basicShape); | 136 const BasicShapePolygon* polygon = toBasicShapePolygon(basicShape); |
| 137 const Vector<Length>& values = polygon->values(); | 137 const Vector<Length>& values = polygon->values(); |
| 138 size_t valuesSize = values.size(); | 138 size_t valuesSize = values.size(); |
| 139 ASSERT(!(valuesSize % 2)); | 139 ASSERT(!(valuesSize % 2)); |
| 140 OwnPtr<Vector<FloatPoint> > vertices = adoptPtr(new Vector<FloatPoint>(v
aluesSize / 2)); | 140 OwnPtr<Vector<FloatPoint>> vertices = adoptPtr(new Vector<FloatPoint>(va
luesSize / 2)); |
| 141 for (unsigned i = 0; i < valuesSize; i += 2) { | 141 for (unsigned i = 0; i < valuesSize; i += 2) { |
| 142 FloatPoint vertex( | 142 FloatPoint vertex( |
| 143 floatValueForLength(values.at(i), boxWidth), | 143 floatValueForLength(values.at(i), boxWidth), |
| 144 floatValueForLength(values.at(i + 1), boxHeight)); | 144 floatValueForLength(values.at(i + 1), boxHeight)); |
| 145 (*vertices)[i / 2] = physicalPointToLogical(vertex, logicalBoxSize.h
eight().toFloat(), writingMode); | 145 (*vertices)[i / 2] = physicalPointToLogical(vertex, logicalBoxSize.h
eight().toFloat(), writingMode); |
| 146 } | 146 } |
| 147 shape = createPolygonShape(vertices.release(), polygon->windRule()); | 147 shape = createPolygonShape(vertices.release(), polygon->windRule()); |
| 148 break; | 148 break; |
| 149 } | 149 } |
| 150 | 150 |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 245 FloatRect rect(0, 0, roundedRect.rect().width(), roundedRect.rect().height()
); | 245 FloatRect rect(0, 0, roundedRect.rect().width(), roundedRect.rect().height()
); |
| 246 FloatRoundedRect bounds(rect, roundedRect.radii()); | 246 FloatRoundedRect bounds(rect, roundedRect.radii()); |
| 247 OwnPtr<Shape> shape = createInsetShape(bounds); | 247 OwnPtr<Shape> shape = createInsetShape(bounds); |
| 248 shape->m_writingMode = writingMode; | 248 shape->m_writingMode = writingMode; |
| 249 shape->m_margin = margin; | 249 shape->m_margin = margin; |
| 250 | 250 |
| 251 return shape.release(); | 251 return shape.release(); |
| 252 } | 252 } |
| 253 | 253 |
| 254 } // namespace blink | 254 } // namespace blink |
| OLD | NEW |