Changeset 72926 in webkit
- Timestamp:
- Nov 30, 2010 10:13:59 AM (13 years ago)
- Location:
- trunk
- Files:
-
- 37 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r72924 r72926 1 2010-11-30 Andreas Kling <kling@webkit.org> 2 3 Reviewed by Dirk Schulze. 4 5 GraphicsContext: Remove "current path" and have strokePath, fillPath and clipPath take a Path argument. 6 https://bugs.webkit.org/show_bug.cgi?id=48516 7 8 No new tests, this is refactoring only. 9 10 fillPath() -> fillPath(const Path&) 11 strokePath() -> strokePath(const Path&) 12 clipPath(WindRule) -> clipPath(const Path&, WindRule) 13 14 drawPath() was only used by CG, so made it PLATFORM(CG) specific. 15 16 The Qt, CG and Cairo implementations are best-effort. 17 For the rest, I've put beginPath/addPath and FIXMEs in the three affected methods. 18 19 * WebCore.exp.in: 20 * html/canvas/CanvasRenderingContext2D.cpp: 21 (WebCore::CanvasRenderingContext2D::fill): 22 (WebCore::CanvasRenderingContext2D::stroke): 23 * inspector/InspectorController.cpp: 24 (WebCore::drawOutlinedQuad): 25 * mathml/RenderMathMLRoot.cpp: 26 (WebCore::RenderMathMLRoot::paint): 27 * mathml/RenderMathMLSquareRoot.cpp: 28 (WebCore::RenderMathMLSquareRoot::paint): 29 * platform/graphics/GraphicsContext.h: 30 * platform/graphics/GraphicsContextPrivate.h: 31 * platform/graphics/cairo/GraphicsContextCairo.cpp: 32 (WebCore::GraphicsContext::fillPath): 33 (WebCore::GraphicsContext::strokePath): 34 (WebCore::GraphicsContext::clipPath): 35 * platform/graphics/cairo/GraphicsContextPlatformPrivateCairo.h: 36 * platform/graphics/cg/GraphicsContextCG.cpp: 37 (WebCore::GraphicsContext::drawEllipse): 38 (WebCore::addConvexPolygonToPath): 39 (WebCore::GraphicsContext::drawConvexPolygon): 40 (WebCore::GraphicsContext::clipConvexPolygon): 41 (WebCore::GraphicsContext::drawPath): 42 (WebCore::GraphicsContext::fillPath): 43 (WebCore::GraphicsContext::strokePath): 44 (WebCore::GraphicsContext::fillRoundedRect): 45 (WebCore::GraphicsContext::clipPath): 46 * platform/graphics/haiku/GraphicsContextHaiku.cpp: 47 (WebCore::GraphicsContext::strokePath): 48 (WebCore::GraphicsContext::fillPath): 49 * platform/graphics/openvg/GraphicsContextOpenVG.cpp: 50 (WebCore::GraphicsContext::fillPath): 51 (WebCore::GraphicsContext::strokePath): 52 (WebCore::GraphicsContext::clipPath): 53 * platform/graphics/qt/GraphicsContextQt.cpp: 54 (WebCore::GraphicsContext::restorePlatformState): 55 (WebCore::GraphicsContext::fillPath): 56 (WebCore::GraphicsContext::strokePath): 57 (WebCore::GraphicsContext::clipPath): 58 (WebCore::GraphicsContext::strokeRect): 59 (WebCore::GraphicsContext::translate): 60 (WebCore::GraphicsContext::rotate): 61 (WebCore::GraphicsContext::scale): 62 (WebCore::GraphicsContext::concatCTM): 63 * platform/graphics/skia/GraphicsContextSkia.cpp: 64 (WebCore::GraphicsContext::clipPath): 65 (WebCore::GraphicsContext::fillPath): 66 (WebCore::GraphicsContext::strokePath): 67 * platform/graphics/wince/GraphicsContextWinCE.cpp: 68 (WebCore::GraphicsContext::fillPath): 69 (WebCore::GraphicsContext::strokePath): 70 (WebCore::GraphicsContext::clipPath): 71 * platform/graphics/wx/GraphicsContextWx.cpp: 72 (WebCore::GraphicsContext::clipPath): 73 (WebCore::GraphicsContext::fillPath): 74 (WebCore::GraphicsContext::strokePath): 75 * rendering/RenderBoxModelObject.cpp: 76 (WebCore::RenderBoxModelObject::paintBorder): 77 (WebCore::RenderBoxModelObject::paintBoxShadow): 78 * rendering/RenderEmbeddedObject.cpp: 79 (WebCore::RenderEmbeddedObject::paintReplaced): 80 * rendering/RenderObject.cpp: 81 (WebCore::RenderObject::drawBoxSideFromPath): 82 * rendering/RenderSVGResource.h: 83 (WebCore::RenderSVGResource::postApplyResource): 84 * rendering/RenderSVGResourceClipper.cpp: 85 (WebCore::RenderSVGResourceClipper::pathOnlyClipping): 86 * rendering/RenderSVGResourceFilter.cpp: 87 (WebCore::RenderSVGResourceFilter::postApplyResource): 88 * rendering/RenderSVGResourceFilter.h: 89 * rendering/RenderSVGResourceGradient.cpp: 90 (WebCore::RenderSVGResourceGradient::applyResource): 91 * rendering/RenderSVGResourceGradient.h: 92 * rendering/RenderSVGResourcePattern.cpp: 93 (WebCore::RenderSVGResourcePattern::postApplyResource): 94 * rendering/RenderSVGResourcePattern.h: 95 * rendering/RenderSVGResourceSolidColor.cpp: 96 (WebCore::RenderSVGResourceSolidColor::postApplyResource): 97 * rendering/RenderSVGResourceSolidColor.h: 98 * rendering/SVGRenderSupport.cpp: 99 (WebCore::SVGRenderSupport::finishRenderSVGContent): 100 * rendering/svg/RenderSVGPath.cpp: 101 (WebCore::RenderSVGPath::fillAndStrokePath): 102 * rendering/svg/SVGInlineTextBox.cpp: 103 (WebCore::SVGInlineTextBox::releasePaintingResource): 104 (WebCore::SVGInlineTextBox::restoreGraphicsContextAfterTextPainting): 105 (WebCore::SVGInlineTextBox::paintDecorationWithStyle): 106 * rendering/svg/SVGInlineTextBox.h: 107 * svg/SVGFont.cpp: 108 (WebCore::Font::drawTextUsingSVGFont): 109 1 110 2010-11-30 Alexey Proskuryakov <ap@apple.com> 2 111 -
trunk/WebCore/WebCore.exp.in
r72887 r72926 359 359 __ZN7WebCore15GraphicsContext4saveEv 360 360 __ZN7WebCore15GraphicsContext5scaleERKNS_9FloatSizeE 361 __ZN7WebCore15GraphicsContext7addPathERKNS_4PathE362 361 __ZN7WebCore15GraphicsContext7restoreEv 363 __ZN7WebCore15GraphicsContext8fillPathE v362 __ZN7WebCore15GraphicsContext8fillPathERKNS_4PathE 364 363 __ZN7WebCore15GraphicsContext8fillRectERKNS_9FloatRectE 365 364 __ZN7WebCore15GraphicsContext8fillRectERKNS_9FloatRectERKNS_5ColorENS_10ColorSpaceE -
trunk/WebCore/html/canvas/CanvasRenderingContext2D.cpp
r71716 r72926 814 814 815 815 if (!m_path.isEmpty()) { 816 c->beginPath(); 817 c->addPath(m_path); 818 c->fillPath(); 816 c->fillPath(m_path); 819 817 didDraw(m_path.boundingRect()); 820 818 } … … 834 832 835 833 if (!m_path.isEmpty()) { 836 c->beginPath();837 c->addPath(m_path);838 839 834 #if PLATFORM(QT) 840 835 // Fast approximation of the stroke's bounding rect. … … 847 842 FloatRect boundingRect = m_path.strokeBoundingRect(&strokeApplier); 848 843 #endif 849 c->strokePath( );844 c->strokePath(m_path); 850 845 didDraw(boundingRect); 851 846 } -
trunk/WebCore/inspector/InspectorController.cpp
r72895 r72926 1538 1538 { 1539 1539 context.save(); 1540 context.addPath(quadPath);1541 1540 context.clipOut(quadPath); 1542 1541 1543 context.addPath(quadPath);1544 1542 context.setStrokeThickness(outlineThickness); 1545 1543 context.setStrokeColor(outlineColor, ColorSpaceDeviceRGB); 1546 context.strokePath( );1544 context.strokePath(quadPath); 1547 1545 1548 1546 context.restore(); … … 1550 1548 1551 1549 // Now do the fill 1552 context.addPath(quadPath);1553 1550 context.setFillColor(fillColor, ColorSpaceDeviceRGB); 1554 context.fillPath( );1551 context.fillPath(quadPath); 1555 1552 } 1556 1553 -
trunk/WebCore/mathml/RenderMathMLRoot.cpp
r70221 r72926 168 168 root.addLineTo(leftEnd); 169 169 170 info.context->beginPath(); 171 info.context->addPath(root); 172 info.context->strokePath(); 170 info.context->strokePath(root); 173 171 174 172 info.context->save(); … … 182 180 mask.addLineTo(FloatPoint(2 * topLeft.x() - leftEnd.x(), 2 * topLeft.y() - leftEnd.y())); 183 181 184 info.context->beginPath();185 info.context->addPath(mask);186 182 info.context->clip(mask); 187 183 … … 194 190 line.addLineTo(topLeft); 195 191 196 info.context->beginPath(); 197 info.context->addPath(line); 198 info.context->strokePath(); 192 info.context->strokePath(line); 199 193 200 194 info.context->restore(); -
trunk/WebCore/mathml/RenderMathMLSquareRoot.cpp
r70143 r72926 133 133 // draw to end 134 134 root.addLineTo(leftEnd); 135 136 info.context->beginPath(); 137 info.context->addPath(root); 138 info.context->strokePath(); 135 136 info.context->strokePath(root); 139 137 140 138 info.context->save(); … … 148 146 mask.addLineTo(FloatPoint(2 * topLeft.x() - leftEnd.x(), 2 * topLeft.y() - leftEnd.y())); 149 147 150 info.context->beginPath();151 info.context->addPath(mask);152 148 info.context->clip(mask); 153 149 … … 160 156 line.addLineTo(topLeft); 161 157 162 info.context->beginPath(); 163 info.context->addPath(line); 164 info.context->strokePath(); 158 info.context->strokePath(line); 165 159 166 160 info.context->restore(); -
trunk/WebCore/platform/graphics/GraphicsContext.h
r72528 r72926 128 128 class ImageBuffer; 129 129 class KURL; 130 class Path;131 130 class Pattern; 132 131 class SharedGraphicsContext3D; … … 197 196 void applyStrokePattern(); 198 197 void applyFillPattern(); 198 void drawPath(const Path&); 199 199 #endif 200 200 … … 211 211 void drawConvexPolygon(size_t numPoints, const FloatPoint*, bool shouldAntialias = false); 212 212 213 void drawPath(); 214 void fillPath(); 215 void strokePath(); 213 void fillPath(const Path&); 214 void strokePath(const Path&); 216 215 217 216 // Arc drawing (used by border-radius in CSS) just supports stroking at the moment. … … 254 253 void clipOut(const IntRect&); 255 254 void clipOutRoundedRect(const IntRect&, const IntSize& topLeft, const IntSize& topRight, const IntSize& bottomLeft, const IntSize& bottomRight); 256 void clipPath( WindRule);255 void clipPath(const Path&, WindRule); 257 256 void clipConvexPolygon(size_t numPoints, const FloatPoint*, bool antialias = true); 258 257 void clipToImageBuffer(ImageBuffer*, const FloatRect&); … … 303 302 void setCompositeOperation(CompositeOperator); 304 303 304 #if PLATFORM(SKIA) || PLATFORM(WX) || PLATFORM(OPENVG) || OS(WINCE) 305 305 void beginPath(); 306 306 void addPath(const Path&); 307 #endif 307 308 308 309 void clip(const Path&); … … 394 395 #if PLATFORM(QT) 395 396 bool inTransparencyLayer() const; 396 PlatformPath* currentPath();397 397 void pushTransparencyLayerInternal(const QRect &rect, qreal opacity, QPixmap& alphaMask); 398 398 void takeOwnershipOfPlatformContext(); -
trunk/WebCore/platform/graphics/GraphicsContextPrivate.h
r70143 r72926 30 30 #include "GraphicsContext.h" 31 31 #include "Pattern.h" 32 #include "TransformationMatrix.h"33 32 34 33 namespace WebCore { … … 80 79 #if PLATFORM(CAIRO) 81 80 float globalAlpha; 82 #elif PLATFORM(QT)83 TransformationMatrix pathTransform;84 81 #endif 85 82 }; -
trunk/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp
r72528 r72926 532 532 } 533 533 534 void GraphicsContext::fillPath() 535 { 536 if (paintingDisabled()) 537 return; 538 539 cairo_t* cr = m_data->cr; 540 541 setPathOnCairoContext(cr, m_data->m_pendingPath.context()); 534 void GraphicsContext::fillPath(const Path& path) 535 { 536 if (paintingDisabled()) 537 return; 538 539 cairo_t* cr = m_data->cr; 540 setPathOnCairoContext(cr, path.platformPath()->context()); 542 541 fillCurrentCairoPath(this, m_common, cr); 543 542 } 544 543 545 void GraphicsContext::strokePath( )546 { 547 if (paintingDisabled()) 548 return; 549 550 cairo_t* cr = m_data->cr; 551 setPathOnCairoContext(cr, m_data->m_pendingPath.context());544 void GraphicsContext::strokePath(const Path& path) 545 { 546 if (paintingDisabled()) 547 return; 548 549 cairo_t* cr = m_data->cr; 550 setPathOnCairoContext(cr, path.platformPath()->context()); 552 551 strokeCurrentCairoPath(this, m_common, cr); 553 }554 555 void GraphicsContext::drawPath()556 {557 if (paintingDisabled())558 return;559 560 cairo_t* cr = m_data->cr;561 562 setPathOnCairoContext(cr, m_data->m_pendingPath.context());563 564 cairo_set_fill_rule(cr, fillRule() == RULE_EVENODD ? CAIRO_FILL_RULE_EVEN_ODD : CAIRO_FILL_RULE_WINDING);565 drawPathShadow(this, m_common, FillAndStroke);566 567 setPlatformFill(this, cr, m_common);568 setPlatformStroke(this, cr, m_common);569 cairo_new_path(cr);570 552 } 571 553 … … 608 590 } 609 591 610 void GraphicsContext::clipPath(WindRule clipRule) 611 { 612 if (paintingDisabled()) 613 return; 614 615 cairo_t* cr = m_data->cr; 592 void GraphicsContext::clipPath(const Path& path, WindRule clipRule) 593 { 594 if (paintingDisabled()) 595 return; 596 597 cairo_t* cr = m_data->cr; 598 setPathOnCairoContext(cr, path.platformPath()->context()); 616 599 cairo_set_fill_rule(cr, clipRule == RULE_EVENODD ? CAIRO_FILL_RULE_EVEN_ODD : CAIRO_FILL_RULE_WINDING); 617 600 cairo_clip(cr); … … 995 978 } 996 979 997 void GraphicsContext::beginPath()998 {999 if (paintingDisabled())1000 return;1001 1002 cairo_new_path(m_data->m_pendingPath.context());1003 }1004 1005 void GraphicsContext::addPath(const Path& path)1006 {1007 if (paintingDisabled())1008 return;1009 1010 cairo_matrix_t currentMatrix;1011 cairo_get_matrix(m_data->cr, ¤tMatrix);1012 cairo_set_matrix(m_data->m_pendingPath.context(), ¤tMatrix);1013 appendWebCorePathToCairoContext(m_data->m_pendingPath.context(), path);1014 }1015 1016 980 void GraphicsContext::clip(const Path& path) 1017 981 { -
trunk/WebCore/platform/graphics/cairo/GraphicsContextPlatformPrivateCairo.h
r69699 r72926 28 28 #include "GraphicsContext.h" 29 29 30 #include "CairoPath.h"31 30 #include "ContextShadow.h" 32 31 #include <cairo.h> … … 98 97 cairo_t* cr; 99 98 Vector<float> layers; 100 CairoPath m_pendingPath;101 99 102 100 ContextShadow shadow; -
trunk/WebCore/platform/graphics/cg/GraphicsContextCG.cpp
r70996 r72926 300 300 void GraphicsContext::drawEllipse(const IntRect& rect) 301 301 { 302 // FIXME: CG added CGContextAddEllipseinRect in Tiger, so we should be able to quite easily draw an ellipse. 303 // This code can only handle circles, not ellipses. But khtml only 304 // uses it for circles. 305 ASSERT(rect.width() == rect.height()); 306 307 if (paintingDisabled()) 308 return; 309 310 CGContextRef context = platformContext(); 311 CGContextBeginPath(context); 312 float r = (float)rect.width() / 2; 313 CGContextAddArc(context, rect.x() + r, rect.y() + r, r, 0.0f, 2.0f * piFloat, 0); 314 CGContextClosePath(context); 315 316 drawPath(); 302 if (paintingDisabled()) 303 return; 304 305 Path path; 306 path.addEllipse(rect); 307 drawPath(path); 317 308 } 318 309 … … 406 397 } 407 398 408 static void addConvexPolygonToContext(CGContextRef context, size_t numPoints, const FloatPoint* points) 409 { 410 CGContextBeginPath(context); 411 CGContextMoveToPoint(context, points[0].x(), points[0].y()); 412 for (size_t i = 1; i < numPoints; i++) 413 CGContextAddLineToPoint(context, points[i].x(), points[i].y()); 414 CGContextClosePath(context); 415 } 416 417 void GraphicsContext::drawConvexPolygon(size_t npoints, const FloatPoint* points, bool antialiased) 418 { 419 if (paintingDisabled()) 420 return; 421 422 if (npoints <= 1) 399 static void addConvexPolygonToPath(Path& path, size_t numberOfPoints, const FloatPoint* points) 400 { 401 ASSERT(numberOfPoints > 0); 402 403 path.moveTo(points[0]); 404 for (size_t i = 1; i < numberOfPoints; ++i) 405 path.addLineTo(points[i]); 406 path.closeSubpath(); 407 } 408 409 void GraphicsContext::drawConvexPolygon(size_t numberOfPoints, const FloatPoint* points, bool antialiased) 410 { 411 if (paintingDisabled()) 412 return; 413 414 if (numberOfPoints <= 1) 423 415 return; 424 416 … … 428 420 CGContextSetShouldAntialias(context, antialiased); 429 421 430 addConvexPolygonToContext(context, npoints, points); 431 drawPath(); 422 Path path; 423 addConvexPolygonToPath(path, numberOfPoints, points); 424 drawPath(path); 432 425 433 426 if (antialiased != shouldAntialias()) … … 435 428 } 436 429 437 void GraphicsContext::clipConvexPolygon(size_t num Points, const FloatPoint* points, bool antialias)438 { 439 if (paintingDisabled()) 440 return; 441 442 if (num Points <= 1)430 void GraphicsContext::clipConvexPolygon(size_t numberOfPoints, const FloatPoint* points, bool antialias) 431 { 432 if (paintingDisabled()) 433 return; 434 435 if (numberOfPoints <= 1) 443 436 return; 444 437 … … 447 440 if (antialias != shouldAntialias()) 448 441 CGContextSetShouldAntialias(context, antialias); 449 450 addConvexPolygonToContext(context, numPoints, points); 451 clipPath(RULE_NONZERO); 442 443 Path path; 444 addConvexPolygonToPath(path, numberOfPoints, points); 445 clipPath(path, RULE_NONZERO); 452 446 453 447 if (antialias != shouldAntialias()) … … 512 506 } 513 507 514 void GraphicsContext::drawPath( )508 void GraphicsContext::drawPath(const Path& path) 515 509 { 516 510 if (paintingDisabled()) … … 522 516 if (state.fillGradient || state.strokeGradient) { 523 517 // We don't have any optimized way to fill & stroke a path using gradients 524 fillPath(); 525 strokePath(); 526 return; 527 } 518 // FIXME: Be smarter about this. 519 fillPath(path); 520 strokePath(path); 521 return; 522 } 523 524 CGContextBeginPath(context); 525 CGContextAddPath(context, path.platformPath()); 528 526 529 527 if (state.fillPattern) … … 545 543 } 546 544 547 void GraphicsContext::fillPath() 548 { 549 if (paintingDisabled()) 550 return; 551 552 CGContextRef context = platformContext(); 545 void GraphicsContext::fillPath(const Path& path) 546 { 547 if (paintingDisabled()) 548 return; 549 550 CGContextRef context = platformContext(); 551 552 CGContextBeginPath(context); 553 CGContextAddPath(context, path.platformPath()); 553 554 554 555 if (m_common->state.fillGradient) { … … 569 570 } 570 571 571 void GraphicsContext::strokePath() 572 { 573 if (paintingDisabled()) 574 return; 575 576 CGContextRef context = platformContext(); 572 void GraphicsContext::strokePath(const Path& path) 573 { 574 if (paintingDisabled()) 575 return; 576 577 CGContextRef context = platformContext(); 578 579 CGContextBeginPath(context); 580 CGContextAddPath(context, path.platformPath()); 577 581 578 582 if (m_common->state.strokeGradient) { … … 644 648 Path path; 645 649 path.addRoundedRect(rect, topLeft, topRight, bottomLeft, bottomRight); 646 addPath(path); 647 fillPath(); 650 fillPath(path); 648 651 649 652 if (oldFillColor != color || oldColorSpace != colorSpace) … … 670 673 } 671 674 672 void GraphicsContext::clipPath(WindRule clipRule) 673 { 674 if (paintingDisabled()) 675 return; 676 677 CGContextRef context = platformContext(); 678 679 if (!CGContextIsPathEmpty(context)) { 680 if (clipRule == RULE_EVENODD) 681 CGContextEOClip(context); 682 else 683 CGContextClip(context); 684 } 675 void GraphicsContext::clipPath(const Path& path, WindRule clipRule) 676 { 677 if (paintingDisabled()) 678 return; 679 680 if (path.isEmpty()) 681 return; 682 683 CGContextRef context = platformContext(); 684 685 CGContextBeginPath(platformContext()); 686 CGContextAddPath(platformContext(), path.platformPath()); 687 688 if (clipRule == RULE_EVENODD) 689 CGContextEOClip(context); 690 else 691 CGContextClip(context); 685 692 } 686 693 … … 862 869 break; 863 870 } 864 }865 866 void GraphicsContext::beginPath()867 {868 CGContextBeginPath(platformContext());869 }870 871 void GraphicsContext::addPath(const Path& path)872 {873 CGContextAddPath(platformContext(), path.platformPath());874 871 } 875 872 -
trunk/WebCore/platform/graphics/haiku/GraphicsContextHaiku.cpp
r72528 r72926 133 133 } 134 134 135 void GraphicsContext::strokePath( )135 void GraphicsContext::strokePath(const Path&) 136 136 { 137 137 notImplemented(); … … 192 192 } 193 193 194 void GraphicsContext::fillPath() 195 { 196 notImplemented(); 197 } 198 199 void GraphicsContext::beginPath() 200 { 201 notImplemented(); 202 } 203 204 void GraphicsContext::addPath(const Path& path) 194 void GraphicsContext::fillPath(const Path&) 205 195 { 206 196 notImplemented(); -
trunk/WebCore/platform/graphics/openvg/GraphicsContextOpenVG.cpp
r70996 r72926 140 140 } 141 141 142 void GraphicsContext::fillPath() 143 { 144 if (paintingDisabled()) 145 return; 142 void GraphicsContext::fillPath(const Path& path) 143 { 144 if (paintingDisabled()) 145 return; 146 147 // FIXME: Be smarter about this. 148 beginPath(); 149 addPath(path); 146 150 147 151 m_data->drawPath(VG_FILL_PATH, m_common->state.fillRule); 148 152 } 149 153 150 void GraphicsContext::strokePath() 151 { 152 if (paintingDisabled()) 153 return; 154 void GraphicsContext::strokePath(const Path& path) 155 { 156 if (paintingDisabled()) 157 return; 158 159 // FIXME: Be smarter about this. 160 beginPath(); 161 addPath(path); 154 162 155 163 m_data->drawPath(VG_STROKE_PATH, m_common->state.fillRule); 156 }157 158 void GraphicsContext::drawPath()159 {160 if (paintingDisabled())161 return;162 163 m_data->drawPath(VG_FILL_PATH | VG_STROKE_PATH, m_common->state.fillRule);164 164 } 165 165 … … 222 222 } 223 223 224 void GraphicsContext::clipPath(WindRule clipRule) 225 { 226 if (paintingDisabled()) 227 return; 224 void GraphicsContext::clipPath(const Path& path, WindRule clipRule) 225 { 226 if (paintingDisabled()) 227 return; 228 229 // FIXME: Be smarter about this. 230 beginPath(); 231 addPath(path); 228 232 229 233 m_data->clipPath(*(m_data->currentPath()), PainterOpenVG::IntersectClip, clipRule); -
trunk/WebCore/platform/graphics/qt/GraphicsContextQt.cpp
r72907 r72926 52 52 #include "Path.h" 53 53 #include "Pattern.h" 54 #include "Pen.h"55 54 #include "TransparencyLayer.h" 56 55 … … 202 201 InterpolationQuality imageInterpolationQuality; 203 202 204 // Only used by SVG for now.205 QPainterPath currentPath;206 207 203 ContextShadow shadow; 208 204 QStack<ContextShadow> shadowStack; … … 211 207 { 212 208 return shadow.m_type != ContextShadow::NoShadow; 213 }214 215 inline void clearCurrentPath()216 {217 if (!currentPath.elementCount())218 return;219 currentPath = QPainterPath();220 209 } 221 210 … … 319 308 320 309 m_data->p()->restore(); 321 322 if (!m_data->currentPath.isEmpty() && m_common->state.pathTransform.isInvertible()) {323 QTransform matrix = m_common->state.pathTransform;324 m_data->currentPath = m_data->currentPath * matrix;325 }326 310 327 311 if (m_data->shadowStack.isEmpty()) … … 515 499 } 516 500 517 void GraphicsContext::fillPath( )518 { 519 if (paintingDisabled()) 520 return; 521 522 QPainter* p = m_data->p(); 523 QPainterPath & path = m_data->currentPath; // Avoid detaching the QPainterPath524 p ath.setFillRule(toQtFillRule(fillRule()));501 void GraphicsContext::fillPath(const Path& path) 502 { 503 if (paintingDisabled()) 504 return; 505 506 QPainter* p = m_data->p(); 507 QPainterPath platformPath = path.platformPath(); 508 platformPath.setFillRule(toQtFillRule(fillRule())); 525 509 526 510 if (m_data->hasShadow()) { … … 536 520 QPointF translatedOffset(offset.x() / transform.m11(), 537 521 offset.y() / transform.m22()); 538 p ath.translate(translatedOffset);539 p->fillPath(p ath, QColor(shadow->m_color));540 p ath.translate(-translatedOffset);522 platformPath.translate(translatedOffset); 523 p->fillPath(platformPath, QColor(shadow->m_color)); 524 platformPath.translate(-translatedOffset); 541 525 } else { 542 526 p->translate(offset); 543 p->fillPath(p ath, QColor(shadow->m_color));527 p->fillPath(platformPath, QColor(shadow->m_color)); 544 528 p->translate(-offset); 545 529 } 546 530 } else { 547 QPainter* shadowPainter = shadow->beginShadowLayer(p, p ath.controlPointRect());531 QPainter* shadowPainter = shadow->beginShadowLayer(p, platformPath.controlPointRect()); 548 532 if (shadowPainter) { 549 533 shadowPainter->setCompositionMode(QPainter::CompositionMode_Source); 550 shadowPainter->fillPath(p ath, QColor(m_data->shadow.m_color));534 shadowPainter->fillPath(platformPath, QColor(m_data->shadow.m_color)); 551 535 shadow->endShadowLayer(p); 552 536 } … … 556 540 if (m_common->state.fillPattern) { 557 541 AffineTransform affine; 558 p->fillPath(p ath, QBrush(m_common->state.fillPattern->createPlatformPattern(affine)));542 p->fillPath(platformPath, QBrush(m_common->state.fillPattern->createPlatformPattern(affine))); 559 543 } else if (m_common->state.fillGradient) { 560 544 QBrush brush(*m_common->state.fillGradient->platformGradient()); 561 545 brush.setTransform(m_common->state.fillGradient->gradientSpaceTransform()); 562 p->fillPath(p ath, brush);546 p->fillPath(platformPath, brush); 563 547 } else 564 p->fillPath(path, p->brush()); 565 566 m_data->clearCurrentPath(); 567 } 568 569 void GraphicsContext::strokePath() 548 p->fillPath(platformPath, p->brush()); 549 } 550 551 void GraphicsContext::strokePath(const Path& path) 570 552 { 571 553 if (paintingDisabled()) … … 574 556 QPainter* p = m_data->p(); 575 557 QPen pen(p->pen()); 576 QPainterPath & path = m_data->currentPath; // Avoid detaching the QPainterPath577 p ath.setFillRule(toQtFillRule(fillRule()));558 QPainterPath platformPath = path.platformPath(); 559 platformPath.setFillRule(toQtFillRule(fillRule())); 578 560 579 561 if (m_data->hasShadow()) { … … 592 574 QPointF translatedOffset(offset.x() / transform.m11(), 593 575 offset.y() / transform.m22()); 594 p ath.translate(translatedOffset);595 p->strokePath(p ath, shadowPen);596 p ath.translate(-translatedOffset);576 platformPath.translate(translatedOffset); 577 p->strokePath(platformPath, shadowPen); 578 platformPath.translate(-translatedOffset); 597 579 } else { 598 580 p->translate(offset); 599 p->strokePath(p ath, shadowPen);581 p->strokePath(platformPath, shadowPen); 600 582 p->translate(-offset); 601 583 } 602 584 } else { 603 FloatRect boundingRect = p ath.controlPointRect();585 FloatRect boundingRect = platformPath.controlPointRect(); 604 586 boundingRect.inflate(pen.miterLimit() + pen.widthF()); 605 587 QPainter* shadowPainter = shadow->beginShadowLayer(p, boundingRect); 606 588 if (shadowPainter) { 607 589 shadowPainter->setOpacity(static_cast<qreal>(m_data->shadow.m_color.alpha()) / 255); 608 shadowPainter->strokePath(p ath, pen);590 shadowPainter->strokePath(platformPath, pen); 609 591 shadow->endShadowLayer(p); 610 592 } … … 616 598 pen.setBrush(QBrush(m_common->state.strokePattern->createPlatformPattern(affine))); 617 599 p->setPen(pen); 618 p->strokePath(p ath, pen);600 p->strokePath(platformPath, pen); 619 601 } else if (m_common->state.strokeGradient) { 620 602 QBrush brush(*m_common->state.strokeGradient->platformGradient()); … … 622 604 pen.setBrush(brush); 623 605 p->setPen(pen); 624 p->strokePath(p ath, pen);606 p->strokePath(platformPath, pen); 625 607 } else 626 p->strokePath(path, pen); 627 m_data->clearCurrentPath(); 608 p->strokePath(platformPath, pen); 628 609 } 629 610 … … 812 793 } 813 794 814 void GraphicsContext::beginPath()815 {816 m_data->clearCurrentPath();817 }818 819 void GraphicsContext::addPath(const Path& path)820 {821 if (!m_data->currentPath.elementCount()) {822 m_data->currentPath = path.platformPath();823 return;824 }825 m_data->currentPath.addPath(path.platformPath());826 }827 828 795 bool GraphicsContext::inTransparencyLayer() const 829 796 { … … 831 798 } 832 799 833 PlatformPath* GraphicsContext::currentPath()834 {835 return &m_data->currentPath;836 }837 838 800 ContextShadow* GraphicsContext::contextShadow() 839 801 { … … 849 811 } 850 812 851 void GraphicsContext::clipPath( WindRule clipRule)852 { 853 if (paintingDisabled()) 854 return; 855 856 QPainter* p = m_data->p(); 857 QPainterPath newPath = m_data->currentPath;858 newPath.setFillRule(clipRule == RULE_EVENODD ? Qt::OddEvenFill : Qt::WindingFill);859 p->setClipPath( newPath, Qt::IntersectClip);813 void GraphicsContext::clipPath(const Path& path, WindRule clipRule) 814 { 815 if (paintingDisabled()) 816 return; 817 818 QPainter* p = m_data->p(); 819 QPainterPath platformPath = path.platformPath(); 820 platformPath.setFillRule(clipRule == RULE_EVENODD ? Qt::OddEvenFill : Qt::WindingFill); 821 p->setClipPath(platformPath, Qt::IntersectClip); 860 822 } 861 823 … … 1086 1048 return; 1087 1049 1088 QPainterPath path;1050 Path path; 1089 1051 path.addRect(rect); 1090 1052 setStrokeThickness(width); 1091 m_data->currentPath = path; 1092 1093 strokePath(); 1053 strokePath(path); 1094 1054 } 1095 1055 … … 1211 1171 1212 1172 m_data->p()->translate(x, y); 1213 1214 if (!m_data->currentPath.isEmpty()) {1215 QTransform matrix;1216 m_data->currentPath = m_data->currentPath * matrix.translate(-x, -y);1217 m_common->state.pathTransform.translate(x, y);1218 }1219 1173 } 1220 1174 … … 1225 1179 1226 1180 m_data->p()->rotate(180 / M_PI*radians); 1227 1228 if (!m_data->currentPath.isEmpty()) {1229 QTransform matrix;1230 m_data->currentPath = m_data->currentPath * matrix.rotate(-180 / M_PI*radians);1231 m_common->state.pathTransform.rotate(radians);1232 }1233 1181 } 1234 1182 … … 1239 1187 1240 1188 m_data->p()->scale(s.width(), s.height()); 1241 1242 if (!m_data->currentPath.isEmpty()) {1243 QTransform matrix;1244 m_data->currentPath = m_data->currentPath * matrix.scale(1 / s.width(), 1 / s.height());1245 m_common->state.pathTransform.scaleNonUniform(s.width(), s.height());1246 }1247 1189 } 1248 1190 … … 1301 1243 1302 1244 m_data->p()->setWorldTransform(transform, true); 1303 1304 // Transformations to the context shouldn't transform the currentPath.1305 // We have to undo every change made to the context from the currentPath1306 // to avoid wrong drawings.1307 if (!m_data->currentPath.isEmpty() && transform.isInvertible()) {1308 QTransform matrix = transform.inverse();1309 m_data->currentPath = m_data->currentPath * matrix;1310 m_common->state.pathTransform.multiply(transform.toTransformationMatrix());1311 }1312 1245 } 1313 1246 -
trunk/WebCore/platform/graphics/skia/GraphicsContextSkia.cpp
r72528 r72926 421 421 } 422 422 423 void GraphicsContext::clipPath(WindRule clipRule) 424 { 425 if (paintingDisabled()) 426 return; 423 void GraphicsContext::clipPath(const Path& pathToClip, WindRule clipRule) 424 { 425 if (paintingDisabled()) 426 return; 427 428 // FIXME: Be smarter about this. 429 beginPath(); 430 addPath(pathToClip); 427 431 428 432 SkPath path = platformContext()->currentPathInLocalCoordinates(); … … 724 728 } 725 729 726 void GraphicsContext::fillPath() 727 { 728 if (paintingDisabled()) 729 return; 730 void GraphicsContext::fillPath(const Path& pathToFill) 731 { 732 if (paintingDisabled()) 733 return; 734 735 // FIXME: Be smarter about this. 736 beginPath(); 737 addPath(pathToFill); 730 738 731 739 SkPath path = platformContext()->currentPathInLocalCoordinates(); … … 1178 1186 } 1179 1187 1180 void GraphicsContext::strokePath() 1181 { 1182 if (paintingDisabled()) 1183 return; 1188 void GraphicsContext::strokePath(const Path& pathToStroke) 1189 { 1190 if (paintingDisabled()) 1191 return; 1192 1193 // FIXME: Be smarter about this. 1194 beginPath(); 1195 addPath(pathToStroke); 1184 1196 1185 1197 SkPath path = platformContext()->currentPathInLocalCoordinates(); -
trunk/WebCore/platform/graphics/wince/GraphicsContextWinCE.cpp
r72528 r72926 1326 1326 } 1327 1327 1328 void GraphicsContext::fillPath() 1329 { 1328 void GraphicsContext::fillPath(const Path& path) 1329 { 1330 // FIXME: Be smarter about this. 1331 beginPath(); 1332 addPath(path); 1333 1330 1334 Color c = m_common->state.fillGradient 1331 1335 ? gradientAverageColor(m_common->state.fillGradient.get()) … … 1376 1380 if (!m_data->m_dc) 1377 1381 return; 1382 1383 // FIXME: Be smarter about this. 1384 beginPath(); 1385 addPath(path); 1378 1386 1379 1387 OwnPtr<HPEN> pen = createPen(strokeColor(), strokeThickness(), strokeStyle()); … … 1901 1909 } 1902 1910 1903 void GraphicsContext::clipPath( WindRule)1911 void GraphicsContext::clipPath(const Path&, WindRule) 1904 1912 { 1905 1913 notImplemented(); -
trunk/WebCore/platform/graphics/wx/GraphicsContextWx.cpp
r72528 r72926 338 338 } 339 339 340 void GraphicsContext::clipPath( WindRule)340 void GraphicsContext::clipPath(const Path&, WindRule) 341 341 { 342 342 notImplemented(); … … 534 534 } 535 535 536 void GraphicsContext::fillPath() 537 { 538 #if USE(WXGC) 536 void GraphicsContext::fillPath(const Path& path) 537 { 538 #if USE(WXGC) 539 // FIXME: Be smarter about this. 540 beginPath(); 541 addPath(path); 542 539 543 wxGraphicsContext* gc = m_data->context->GetGraphicsContext(); 540 544 if (gc) … … 543 547 } 544 548 545 void GraphicsContext::strokePath() 546 { 547 #if USE(WXGC) 549 void GraphicsContext::strokePath(const Path& path) 550 { 551 #if USE(WXGC) 552 // FIXME: Be smarter about this. 553 beginPath(); 554 addPath(path); 555 548 556 wxGraphicsContext* gc = m_data->context->GetGraphicsContext(); 549 557 if (gc) 550 558 gc->StrokePath(m_data->currentPath); 551 559 #endif 552 }553 554 void GraphicsContext::drawPath()555 {556 fillPath();557 strokePath();558 560 } 559 561 -
trunk/WebCore/rendering/RenderBoxModelObject.cpp
r72282 r72926 1065 1065 graphicsContext->clipOutRoundedRect(innerBorderRect, innerTopLeft, innerTopRight, innerBottomLeft, innerBottomRight); 1066 1066 roundedPath.addRoundedRect(borderRect, topLeft, topRight, bottomLeft, bottomRight); 1067 graphicsContext->addPath(roundedPath);1068 1067 } 1069 1068 } … … 1806 1805 path.addRect(holeRect); 1807 1806 1808 context->beginPath();1809 context->addPath(path);1810 1811 1807 context->setFillRule(RULE_EVENODD); 1812 1808 context->setFillColor(fillColor, s->colorSpace()); 1813 1809 context->setShadow(shadowOffset, shadowBlur, shadowColor, s->colorSpace()); 1814 context->fillPath( );1810 context->fillPath(path); 1815 1811 1816 1812 context->restore(); -
trunk/WebCore/rendering/RenderEmbeddedObject.cpp
r72839 r72926 167 167 context->save(); 168 168 context->clip(contentRect); 169 context->beginPath();170 context->addPath(path);171 169 context->setAlpha(m_missingPluginIndicatorIsPressed ? replacementTextPressedRoundedRectOpacity : replacementTextRoundedRectOpacity); 172 170 context->setFillColor(m_missingPluginIndicatorIsPressed ? replacementTextRoundedRectPressedColor() : Color::white, style()->colorSpace()); 173 context->fillPath( );171 context->fillPath(path); 174 172 175 173 float labelX = roundf(replacementTextRect.location().x() + (replacementTextRect.size().width() - textWidth) / 2); -
trunk/WebCore/rendering/RenderObject.cpp
r72777 r72926 957 957 lineDash.append(whiteSpaceWidth); 958 958 graphicsContext->setLineDash(lineDash, patWidth); 959 graphicsContext->addPath(borderPath); 960 graphicsContext->strokePath(); 959 graphicsContext->strokePath(borderPath); 961 960 return; 962 961 } -
trunk/WebCore/rendering/RenderSVGResource.h
r69413 r72926 49 49 class FloatRect; 50 50 class GraphicsContext; 51 class Path; 51 52 class RenderObject; 52 53 class RenderStyle; … … 62 63 63 64 virtual bool applyResource(RenderObject*, RenderStyle*, GraphicsContext*&, unsigned short resourceMode) = 0; 64 virtual void postApplyResource(RenderObject*, GraphicsContext*&, unsigned short ) { }65 virtual void postApplyResource(RenderObject*, GraphicsContext*&, unsigned short, const Path*) { } 65 66 virtual FloatRect resourceBoundingBox(RenderObject*) = 0; 66 67 -
trunk/WebCore/rendering/RenderSVGResourceClipper.cpp
r70143 r72926 152 152 if (clipPath.isEmpty()) 153 153 clipPath.addRect(FloatRect()); 154 context->beginPath(); 155 context->addPath(clipPath); 156 context->clipPath(clipRule); 154 context->clipPath(clipPath, clipRule); 157 155 return true; 158 156 } -
trunk/WebCore/rendering/RenderSVGResourceFilter.cpp
r72474 r72926 255 255 } 256 256 257 void RenderSVGResourceFilter::postApplyResource(RenderObject* object, GraphicsContext*& context, unsigned short resourceMode )257 void RenderSVGResourceFilter::postApplyResource(RenderObject* object, GraphicsContext*& context, unsigned short resourceMode, const Path*) 258 258 { 259 259 ASSERT(object); -
trunk/WebCore/rendering/RenderSVGResourceFilter.h
r72474 r72926 71 71 72 72 virtual bool applyResource(RenderObject*, RenderStyle*, GraphicsContext*&, unsigned short resourceMode); 73 virtual void postApplyResource(RenderObject*, GraphicsContext*&, unsigned short resourceMode );73 virtual void postApplyResource(RenderObject*, GraphicsContext*&, unsigned short resourceMode, const Path*); 74 74 75 75 virtual FloatRect resourceBoundingBox(RenderObject*); -
trunk/WebCore/rendering/RenderSVGResourceGradient.cpp
r70143 r72926 231 231 } 232 232 233 void RenderSVGResourceGradient::postApplyResource(RenderObject* object, GraphicsContext*& context, unsigned short resourceMode )233 void RenderSVGResourceGradient::postApplyResource(RenderObject* object, GraphicsContext*& context, unsigned short resourceMode, const Path* path) 234 234 { 235 235 ASSERT(context); … … 259 259 UNUSED_PARAM(object); 260 260 #endif 261 } else {261 } else if (path) { 262 262 if (resourceMode & ApplyToFillMode) 263 context->fillPath( );263 context->fillPath(*path); 264 264 else if (resourceMode & ApplyToStrokeMode) 265 context->strokePath( );265 context->strokePath(*path); 266 266 } 267 267 -
trunk/WebCore/rendering/RenderSVGResourceGradient.h
r69413 r72926 52 52 53 53 virtual bool applyResource(RenderObject*, RenderStyle*, GraphicsContext*&, unsigned short resourceMode); 54 virtual void postApplyResource(RenderObject*, GraphicsContext*&, unsigned short resourceMode );54 virtual void postApplyResource(RenderObject*, GraphicsContext*&, unsigned short resourceMode, const Path*); 55 55 virtual FloatRect resourceBoundingBox(RenderObject*) { return FloatRect(); } 56 56 -
trunk/WebCore/rendering/RenderSVGResourcePattern.cpp
r70143 r72926 183 183 } 184 184 185 void RenderSVGResourcePattern::postApplyResource(RenderObject*, GraphicsContext*& context, unsigned short resourceMode )185 void RenderSVGResourcePattern::postApplyResource(RenderObject*, GraphicsContext*& context, unsigned short resourceMode, const Path* path) 186 186 { 187 187 ASSERT(context); 188 188 ASSERT(resourceMode != ApplyToDefaultMode); 189 189 190 if ( !(resourceMode & ApplyToTextMode)) {190 if (path && !(resourceMode & ApplyToTextMode)) { 191 191 if (resourceMode & ApplyToFillMode) 192 context->fillPath( );192 context->fillPath(*path); 193 193 else if (resourceMode & ApplyToStrokeMode) 194 context->strokePath( );194 context->strokePath(*path); 195 195 } 196 196 -
trunk/WebCore/rendering/RenderSVGResourcePattern.h
r69413 r72926 54 54 55 55 virtual bool applyResource(RenderObject*, RenderStyle*, GraphicsContext*&, unsigned short resourceMode); 56 virtual void postApplyResource(RenderObject*, GraphicsContext*&, unsigned short resourceMode );56 virtual void postApplyResource(RenderObject*, GraphicsContext*&, unsigned short resourceMode, const Path*); 57 57 virtual FloatRect resourceBoundingBox(RenderObject*) { return FloatRect(); } 58 58 -
trunk/WebCore/rendering/RenderSVGResourceSolidColor.cpp
r70143 r72926 76 76 } 77 77 78 void RenderSVGResourceSolidColor::postApplyResource(RenderObject*, GraphicsContext*& context, unsigned short resourceMode )78 void RenderSVGResourceSolidColor::postApplyResource(RenderObject*, GraphicsContext*& context, unsigned short resourceMode, const Path* path) 79 79 { 80 80 ASSERT(context); 81 81 ASSERT(resourceMode != ApplyToDefaultMode); 82 82 83 if ( !(resourceMode & ApplyToTextMode)) {83 if (path && !(resourceMode & ApplyToTextMode)) { 84 84 if (resourceMode & ApplyToFillMode) 85 context->fillPath( );85 context->fillPath(*path); 86 86 else if (resourceMode & ApplyToStrokeMode) 87 context->strokePath( );87 context->strokePath(*path); 88 88 } 89 90 #if PLATFORM(SKIA)91 // FIXME: Move this into the GraphicsContext92 // WebKit implicitly expects us to reset the path.93 // For example in fillAndStrokePath() of RenderSVGPath.cpp the path is94 // added back to the context after filling. This is because internally it95 // calls CGContextFillPath() which closes the path.96 context->beginPath();97 context->platformContext()->setFillShader(0);98 context->platformContext()->setStrokeShader(0);99 #endif100 89 } 101 90 -
trunk/WebCore/rendering/RenderSVGResourceSolidColor.h
r65310 r72926 38 38 39 39 virtual bool applyResource(RenderObject*, RenderStyle*, GraphicsContext*&, unsigned short resourceMode); 40 virtual void postApplyResource(RenderObject*, GraphicsContext*&, unsigned short resourceMode );40 virtual void postApplyResource(RenderObject*, GraphicsContext*&, unsigned short resourceMode, const Path*); 41 41 virtual FloatRect resourceBoundingBox(RenderObject*) { return FloatRect(); } 42 42 -
trunk/WebCore/rendering/SVGRenderSupport.cpp
r69279 r72926 149 149 if (resources) { 150 150 if (RenderSVGResourceFilter* filter = resources->filter()) { 151 filter->postApplyResource(object, paintInfo.context, ApplyToDefaultMode );151 filter->postApplyResource(object, paintInfo.context, ApplyToDefaultMode, /* path */0); 152 152 paintInfo.context = savedContext; 153 153 } -
trunk/WebCore/rendering/svg/RenderSVGPath.cpp
r69517 r72926 149 149 void RenderSVGPath::fillAndStrokePath(GraphicsContext* context) 150 150 { 151 context->beginPath();152 151 RenderStyle* style = this->style(); 153 152 154 153 Color fallbackColor; 155 154 if (RenderSVGResource* fillPaintingResource = RenderSVGResource::fillPaintingResource(this, style, fallbackColor)) { 156 context->addPath(m_path);157 155 if (fillPaintingResource->applyResource(this, style, context, ApplyToFillMode)) 158 fillPaintingResource->postApplyResource(this, context, ApplyToFillMode );156 fillPaintingResource->postApplyResource(this, context, ApplyToFillMode, &m_path); 159 157 else if (fallbackColor.isValid()) { 160 158 RenderSVGResourceSolidColor* fallbackResource = RenderSVGResource::sharedSolidPaintingResource(); 161 159 fallbackResource->setColor(fallbackColor); 162 160 if (fallbackResource->applyResource(this, style, context, ApplyToFillMode)) 163 fallbackResource->postApplyResource(this, context, ApplyToFillMode );161 fallbackResource->postApplyResource(this, context, ApplyToFillMode, &m_path); 164 162 } 165 163 } … … 170 168 return; 171 169 170 Path path; 171 172 bool nonScalingStroke = style->svgStyle()->vectorEffect() == VE_NON_SCALING_STROKE; 172 173 bool restoreContext = false; 173 if ( style->svgStyle()->vectorEffect() == VE_NON_SCALING_STROKE) {174 if (nonScalingStroke) { 174 175 SVGStyledTransformableElement* element = static_cast<SVGStyledTransformableElement*>(node()); 175 176 AffineTransform nonScalingStrokeTransform = element->getScreenCTM(SVGLocatable::DisallowStyleUpdate); … … 177 178 return; 178 179 179 Path transformedPath = m_path;180 transformedPath.transform(nonScalingStrokeTransform);180 path = m_path; 181 path.transform(nonScalingStrokeTransform); 181 182 182 183 context->save(); 183 184 context->concatCTM(nonScalingStrokeTransform.inverse()); 184 context->addPath(transformedPath);185 185 restoreContext = true; 186 } else 187 context->addPath(m_path); 186 } 188 187 189 188 if (strokePaintingResource->applyResource(this, style, context, ApplyToStrokeMode)) 190 strokePaintingResource->postApplyResource(this, context, ApplyToStrokeMode );189 strokePaintingResource->postApplyResource(this, context, ApplyToStrokeMode, nonScalingStroke ? &path : &m_path); 191 190 else if (fallbackColor.isValid()) { 192 191 RenderSVGResourceSolidColor* fallbackResource = RenderSVGResource::sharedSolidPaintingResource(); 193 192 fallbackResource->setColor(fallbackColor); 194 193 if (fallbackResource->applyResource(this, style, context, ApplyToStrokeMode)) 195 fallbackResource->postApplyResource(this, context, ApplyToStrokeMode );194 fallbackResource->postApplyResource(this, context, ApplyToStrokeMode, nonScalingStroke ? &path : &m_path); 196 195 } 197 196 -
trunk/WebCore/rendering/svg/SVGInlineTextBox.cpp
r72235 r72926 319 319 } 320 320 321 void SVGInlineTextBox::releasePaintingResource(GraphicsContext*& context )321 void SVGInlineTextBox::releasePaintingResource(GraphicsContext*& context, const Path* path) 322 322 { 323 323 ASSERT(m_paintingResource); … … 326 326 ASSERT(parentRenderer); 327 327 328 m_paintingResource->postApplyResource(parentRenderer, context, m_paintingResourceMode );328 m_paintingResource->postApplyResource(parentRenderer, context, m_paintingResourceMode, path); 329 329 m_paintingResource = 0; 330 330 } … … 345 345 void SVGInlineTextBox::restoreGraphicsContextAfterTextPainting(GraphicsContext*& context, TextRun& textRun) 346 346 { 347 releasePaintingResource(context );347 releasePaintingResource(context, /* path */0); 348 348 349 349 #if ENABLE(SVG_FONTS) … … 501 501 502 502 context->save(); 503 context->beginPath();504 context->addPath(path);505 503 506 504 if (acquirePaintingResource(context, decorationRenderer, decorationStyle)) 507 releasePaintingResource(context );505 releasePaintingResource(context, &path); 508 506 509 507 context->restore(); -
trunk/WebCore/rendering/svg/SVGInlineTextBox.h
r68976 r72926 69 69 70 70 bool acquirePaintingResource(GraphicsContext*&, RenderObject*, RenderStyle*); 71 void releasePaintingResource(GraphicsContext*& );71 void releasePaintingResource(GraphicsContext*&, const Path*); 72 72 73 73 bool prepareGraphicsContextForTextPainting(GraphicsContext*&, TextRun&, RenderStyle*); -
trunk/WebCore/svg/SVGFont.cpp
r65468 r72926 535 535 glyphPath.transform(glyphPathTransform); 536 536 537 context->beginPath();538 context->addPath(glyphPath);539 540 537 RenderStyle* style = run.referencingRenderObject() ? run.referencingRenderObject()->style() : 0; 541 538 if (activePaintingResource->applyResource(run.referencingRenderObject(), style, context, resourceMode)) 542 activePaintingResource->postApplyResource(run.referencingRenderObject(), context, resourceMode );539 activePaintingResource->postApplyResource(run.referencingRenderObject(), context, resourceMode, &glyphPath); 543 540 544 541 context->restore(); -
trunk/WebKit2/ChangeLog
r72923 r72926 1 2010-11-30 Andreas Kling <kling@webkit.org> 2 3 Reviewed by Dirk Schulze. 4 5 GraphicsContext: Remove "current path" and have strokePath, fillPath and clipPath take a Path argument 6 https://bugs.webkit.org/show_bug.cgi?id=48516 7 8 * UIProcess/FindIndicator.cpp: 9 (WebKit::FindIndicator::draw): 10 1 11 2010-11-30 Steve Falkenburg <sfalken@apple.com> 2 12 -
trunk/WebKit2/UIProcess/FindIndicator.cpp
r71640 r72926 150 150 FloatRect outerPathRect = inflateRect(textRect, horizontalOutsetToCenterOfLightBorder, verticalOutsetToCenterOfLightBorder); 151 151 graphicsContext.setShadow(FloatSize(shadowOffsetX, shadowOffsetY), shadowBlurRadius, shadowColor(), ColorSpaceSRGB); 152 graphicsContext.addPath(pathWithRoundedRect(outerPathRect, cornerRadius));153 152 graphicsContext.setFillColor(lightBorderColor(), ColorSpaceDeviceRGB); 154 graphicsContext.fillPath( );153 graphicsContext.fillPath(pathWithRoundedRect(outerPathRect, cornerRadius)); 155 154 graphicsContext.restore(); 156 155
Note: See TracChangeset
for help on using the changeset viewer.