| 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 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 strokePaintingResource->postApplyResource(this, context, ApplyToStro
keMode, 0, this); | 241 strokePaintingResource->postApplyResource(this, context, ApplyToStro
keMode, 0, this); |
| 242 else if (fallbackColor.isValid()) { | 242 else if (fallbackColor.isValid()) { |
| 243 RenderSVGResourceSolidColor* fallbackResource = RenderSVGResource::s
haredSolidPaintingResource(); | 243 RenderSVGResourceSolidColor* fallbackResource = RenderSVGResource::s
haredSolidPaintingResource(); |
| 244 fallbackResource->setColor(fallbackColor); | 244 fallbackResource->setColor(fallbackColor); |
| 245 if (fallbackResource->applyResource(this, style, context, ApplyToStr
okeMode)) | 245 if (fallbackResource->applyResource(this, style, context, ApplyToStr
okeMode)) |
| 246 fallbackResource->postApplyResource(this, context, ApplyToStroke
Mode, 0, this); | 246 fallbackResource->postApplyResource(this, context, ApplyToStroke
Mode, 0, this); |
| 247 } | 247 } |
| 248 } | 248 } |
| 249 } | 249 } |
| 250 | 250 |
| 251 void RenderSVGShape::fillAndStrokeShape(GraphicsContext* context) | |
| 252 { | |
| 253 RenderStyle* style = this->style(); | |
| 254 | |
| 255 fillShape(style, context); | |
| 256 | |
| 257 if (!style->svgStyle()->hasVisibleStroke()) | |
| 258 return; | |
| 259 | |
| 260 GraphicsContextStateSaver stateSaver(*context, false); | |
| 261 | |
| 262 if (hasNonScalingStroke()) { | |
| 263 AffineTransform nonScalingTransform = nonScalingStrokeTransform(); | |
| 264 if (!setupNonScalingStrokeContext(nonScalingTransform, stateSaver)) | |
| 265 return; | |
| 266 } | |
| 267 | |
| 268 strokeShape(style, context); | |
| 269 } | |
| 270 | |
| 271 void RenderSVGShape::paint(PaintInfo& paintInfo, const LayoutPoint&) | 251 void RenderSVGShape::paint(PaintInfo& paintInfo, const LayoutPoint&) |
| 272 { | 252 { |
| 273 if (paintInfo.context->paintingDisabled() || style()->visibility() == HIDDEN
|| isEmpty()) | 253 if (paintInfo.context->paintingDisabled() || style()->visibility() == HIDDEN
|| isEmpty()) |
| 274 return; | 254 return; |
| 275 FloatRect boundingBox = repaintRectInLocalCoordinates(); | 255 FloatRect boundingBox = repaintRectInLocalCoordinates(); |
| 276 if (!SVGRenderSupport::paintInfoIntersectsRepaintRect(boundingBox, m_localTr
ansform, paintInfo)) | 256 if (!SVGRenderSupport::paintInfoIntersectsRepaintRect(boundingBox, m_localTr
ansform, paintInfo)) |
| 277 return; | 257 return; |
| 278 | 258 |
| 279 PaintInfo childPaintInfo(paintInfo); | 259 PaintInfo childPaintInfo(paintInfo); |
| 280 bool drawsOutline = style()->outlineWidth() && (childPaintInfo.phase == Pain
tPhaseOutline || childPaintInfo.phase == PaintPhaseSelfOutline); | 260 bool drawsOutline = style()->outlineWidth() && (childPaintInfo.phase == Pain
tPhaseOutline || childPaintInfo.phase == PaintPhaseSelfOutline); |
| 281 if (drawsOutline || childPaintInfo.phase == PaintPhaseForeground) { | 261 if (drawsOutline || childPaintInfo.phase == PaintPhaseForeground) { |
| 282 GraphicsContextStateSaver stateSaver(*childPaintInfo.context); | 262 GraphicsContextStateSaver stateSaver(*childPaintInfo.context); |
| 283 childPaintInfo.applyTransform(m_localTransform); | 263 childPaintInfo.applyTransform(m_localTransform); |
| 284 | 264 |
| 285 if (childPaintInfo.phase == PaintPhaseForeground) { | 265 if (childPaintInfo.phase == PaintPhaseForeground) { |
| 286 SVGRenderingContext renderingContext(this, childPaintInfo); | 266 SVGRenderingContext renderingContext(this, childPaintInfo); |
| 287 | 267 |
| 288 if (renderingContext.isRenderingPrepared()) { | 268 if (renderingContext.isRenderingPrepared()) { |
| 289 const SVGRenderStyle* svgStyle = style()->svgStyle(); | 269 const SVGRenderStyle* svgStyle = style()->svgStyle(); |
| 290 if (svgStyle->shapeRendering() == SR_CRISPEDGES) | 270 if (svgStyle->shapeRendering() == SR_CRISPEDGES) |
| 291 childPaintInfo.context->setShouldAntialias(false); | 271 childPaintInfo.context->setShouldAntialias(false); |
| 292 | 272 |
| 293 fillAndStrokeShape(childPaintInfo.context); | 273 for (int i = 0; i < 3; i++) { |
| 294 if (!m_markerPositions.isEmpty()) | 274 switch(svgStyle->paintOrder(i)) { |
| 295 drawMarkers(childPaintInfo); | 275 case PO_FILL: |
| 276 fillShape(this->style(), childPaintInfo.context); |
| 277 break; |
| 278 case PO_STROKE: |
| 279 if (svgStyle->hasVisibleStroke()) { |
| 280 GraphicsContextStateSaver stateSaver(*childPaint
Info.context, false); |
| 281 AffineTransform nonScalingTransform; |
| 282 |
| 283 if (hasNonScalingStroke()) { |
| 284 AffineTransform nonScalingTransform = nonSca
lingStrokeTransform(); |
| 285 if (!setupNonScalingStrokeContext(nonScaling
Transform, stateSaver)) |
| 286 return; |
| 287 } |
| 288 |
| 289 strokeShape(this->style(), childPaintInfo.contex
t); |
| 290 } |
| 291 break; |
| 292 case PO_MARKERS: |
| 293 if (!m_markerPositions.isEmpty()) |
| 294 drawMarkers(childPaintInfo); |
| 295 break; |
| 296 default: |
| 297 ASSERT_NOT_REACHED(); |
| 298 break; |
| 299 } |
| 300 } |
| 296 } | 301 } |
| 297 } | 302 } |
| 298 | 303 |
| 299 if (drawsOutline) | 304 if (drawsOutline) |
| 300 paintOutline(childPaintInfo, IntRect(boundingBox)); | 305 paintOutline(childPaintInfo, IntRect(boundingBox)); |
| 301 } | 306 } |
| 302 } | 307 } |
| 303 | 308 |
| 304 // This method is called from inside paintOutline() since we call paintOutline() | 309 // This method is called from inside paintOutline() since we call paintOutline() |
| 305 // while transformed to our coord system, return local coords | 310 // while transformed to our coord system, return local coords |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 461 ASSERT(m_path); | 466 ASSERT(m_path); |
| 462 | 467 |
| 463 SVGMarkerData markerData(m_markerPositions); | 468 SVGMarkerData markerData(m_markerPositions); |
| 464 m_path->apply(&markerData, SVGMarkerData::updateFromPathElement); | 469 m_path->apply(&markerData, SVGMarkerData::updateFromPathElement); |
| 465 markerData.pathIsDone(); | 470 markerData.pathIsDone(); |
| 466 } | 471 } |
| 467 | 472 |
| 468 } | 473 } |
| 469 | 474 |
| 470 #endif // ENABLE(SVG) | 475 #endif // ENABLE(SVG) |
| OLD | NEW |