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