OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org> | 2 * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org> |
3 * Copyright (C) 2004, 2005, 2008 Rob Buis <buis@kde.org> | 3 * Copyright (C) 2004, 2005, 2008 Rob Buis <buis@kde.org> |
4 * Copyright (C) 2005, 2007 Eric Seidel <eric@webkit.org> | 4 * Copyright (C) 2005, 2007 Eric Seidel <eric@webkit.org> |
5 * Copyright (C) 2009 Google, Inc. | 5 * Copyright (C) 2009 Google, Inc. |
6 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> | 6 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> |
7 * Copyright (C) Research In Motion Limited 2010. All rights reserved. | 7 * Copyright (C) Research In Motion Limited 2010. All rights reserved. |
8 * Copyright (C) 2009 Jeff Schiller <codedread@gmail.com> | 8 * Copyright (C) 2009 Jeff Schiller <codedread@gmail.com> |
9 * Copyright (C) 2011 Renata Hodovan <reni@webkit.org> | 9 * Copyright (C) 2011 Renata Hodovan <reni@webkit.org> |
10 * Copyright (C) 2011 University of Szeged | 10 * Copyright (C) 2011 University of Szeged |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 } | 56 } |
57 | 57 |
58 RenderSVGShape::~RenderSVGShape() | 58 RenderSVGShape::~RenderSVGShape() |
59 { | 59 { |
60 } | 60 } |
61 | 61 |
62 void RenderSVGShape::updateShapeFromElement() | 62 void RenderSVGShape::updateShapeFromElement() |
63 { | 63 { |
64 m_path.clear(); | 64 m_path.clear(); |
65 m_path = adoptPtr(new Path); | 65 m_path = adoptPtr(new Path); |
66 ASSERT(RenderSVGShape::isEmpty()); | 66 ASSERT(RenderSVGShape::isShapeEmpty()); |
67 | 67 |
68 updatePathFromGraphicsElement(toSVGGraphicsElement(element()), path()); | 68 updatePathFromGraphicsElement(toSVGGraphicsElement(element()), path()); |
69 processMarkerPositions(); | 69 processMarkerPositions(); |
70 | 70 |
71 m_fillBoundingBox = calculateObjectBoundingBox(); | 71 m_fillBoundingBox = calculateObjectBoundingBox(); |
72 m_strokeBoundingBox = calculateStrokeBoundingBox(); | 72 m_strokeBoundingBox = calculateStrokeBoundingBox(); |
73 } | 73 } |
74 | 74 |
75 bool RenderSVGShape::isEmpty() const | |
76 { | |
77 return path().isEmpty(); | |
78 } | |
79 | |
80 void RenderSVGShape::fillShape(GraphicsContext* context) const | 75 void RenderSVGShape::fillShape(GraphicsContext* context) const |
81 { | 76 { |
82 context->fillPath(path()); | 77 context->fillPath(path()); |
83 } | 78 } |
84 | 79 |
85 void RenderSVGShape::strokeShape(GraphicsContext* context) const | 80 void RenderSVGShape::strokeShape(GraphicsContext* context) const |
86 { | 81 { |
87 ASSERT(m_path); | 82 ASSERT(m_path); |
88 Path* usePath = m_path.get(); | 83 Path* usePath = m_path.get(); |
89 | 84 |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 if (fallbackResource->applyResource(this, style, context, ApplyToStr
okeMode)) | 231 if (fallbackResource->applyResource(this, style, context, ApplyToStr
okeMode)) |
237 fallbackResource->postApplyResource(this, context, ApplyToStroke
Mode, 0, this); | 232 fallbackResource->postApplyResource(this, context, ApplyToStroke
Mode, 0, this); |
238 } | 233 } |
239 } | 234 } |
240 } | 235 } |
241 | 236 |
242 void RenderSVGShape::paint(PaintInfo& paintInfo, const LayoutPoint&) | 237 void RenderSVGShape::paint(PaintInfo& paintInfo, const LayoutPoint&) |
243 { | 238 { |
244 ANNOTATE_GRAPHICS_CONTEXT(paintInfo, this); | 239 ANNOTATE_GRAPHICS_CONTEXT(paintInfo, this); |
245 | 240 |
246 if (paintInfo.context->paintingDisabled() || style()->visibility() == HIDDEN
|| isEmpty()) | 241 if (paintInfo.context->paintingDisabled() || style()->visibility() == HIDDEN
|| isShapeEmpty()) |
247 return; | 242 return; |
248 FloatRect boundingBox = repaintRectInLocalCoordinates(); | 243 FloatRect boundingBox = repaintRectInLocalCoordinates(); |
249 if (!SVGRenderSupport::paintInfoIntersectsRepaintRect(boundingBox, m_localTr
ansform, paintInfo)) | 244 if (!SVGRenderSupport::paintInfoIntersectsRepaintRect(boundingBox, m_localTr
ansform, paintInfo)) |
250 return; | 245 return; |
251 | 246 |
252 PaintInfo childPaintInfo(paintInfo); | 247 PaintInfo childPaintInfo(paintInfo); |
253 bool drawsOutline = style()->outlineWidth() && (childPaintInfo.phase == Pain
tPhaseOutline || childPaintInfo.phase == PaintPhaseSelfOutline); | 248 bool drawsOutline = style()->outlineWidth() && (childPaintInfo.phase == Pain
tPhaseOutline || childPaintInfo.phase == PaintPhaseSelfOutline); |
254 if (drawsOutline || childPaintInfo.phase == PaintPhaseForeground) { | 249 if (drawsOutline || childPaintInfo.phase == PaintPhaseForeground) { |
255 GraphicsContextStateSaver stateSaver(*childPaintInfo.context); | 250 GraphicsContextStateSaver stateSaver(*childPaintInfo.context); |
256 childPaintInfo.applyTransform(m_localTransform); | 251 childPaintInfo.applyTransform(m_localTransform); |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
465 return; | 460 return; |
466 | 461 |
467 ASSERT(m_path); | 462 ASSERT(m_path); |
468 | 463 |
469 SVGMarkerData markerData(m_markerPositions); | 464 SVGMarkerData markerData(m_markerPositions); |
470 m_path->apply(&markerData, SVGMarkerData::updateFromPathElement); | 465 m_path->apply(&markerData, SVGMarkerData::updateFromPathElement); |
471 markerData.pathIsDone(); | 466 markerData.pathIsDone(); |
472 } | 467 } |
473 | 468 |
474 } | 469 } |
OLD | NEW |