| Index: Source/core/html/canvas/CanvasRenderingContext2D.cpp
|
| diff --git a/Source/core/html/canvas/CanvasRenderingContext2D.cpp b/Source/core/html/canvas/CanvasRenderingContext2D.cpp
|
| index 2cd9089ad9828e9810c7662a74b118c34507b769..45c9f4dd579f97d4a79c4c7ceb83d3be101b10bc 100644
|
| --- a/Source/core/html/canvas/CanvasRenderingContext2D.cpp
|
| +++ b/Source/core/html/canvas/CanvasRenderingContext2D.cpp
|
| @@ -870,86 +870,129 @@ static bool parseWinding(const String& windingRuleString, WindRule& windRule)
|
| return true;
|
| }
|
|
|
| -void CanvasRenderingContext2D::fill(const String& windingRuleString)
|
| +void CanvasRenderingContext2D::fillInternal(const Path& path, const String& windingRuleString)
|
| {
|
| + if (path.isEmpty()) {
|
| + return;
|
| + }
|
| GraphicsContext* c = drawingContext();
|
| - if (!c)
|
| + if (!c) {
|
| return;
|
| - if (!state().m_invertibleCTM)
|
| + }
|
| + if (!state().m_invertibleCTM) {
|
| return;
|
| + }
|
| FloatRect clipBounds;
|
| - if (!drawingContext()->getTransformedClipBounds(&clipBounds))
|
| + if (!drawingContext()->getTransformedClipBounds(&clipBounds)) {
|
| return;
|
| + }
|
|
|
| // If gradient size is zero, then paint nothing.
|
| Gradient* gradient = c->fillGradient();
|
| - if (gradient && gradient->isZeroSize())
|
| + if (gradient && gradient->isZeroSize()) {
|
| return;
|
| + }
|
|
|
| - if (!m_path.isEmpty()) {
|
| - WindRule windRule = c->fillRule();
|
| - WindRule newWindRule = RULE_NONZERO;
|
| - if (!parseWinding(windingRuleString, newWindRule))
|
| - return;
|
| - c->setFillRule(newWindRule);
|
| -
|
| - if (isFullCanvasCompositeMode(state().m_globalComposite)) {
|
| - fullCanvasCompositedFill(m_path);
|
| - didDraw(clipBounds);
|
| - } else if (state().m_globalComposite == CompositeCopy) {
|
| - clearCanvas();
|
| - c->fillPath(m_path);
|
| - didDraw(clipBounds);
|
| - } else {
|
| - FloatRect dirtyRect;
|
| - if (computeDirtyRect(m_path.boundingRect(), clipBounds, &dirtyRect)) {
|
| - c->fillPath(m_path);
|
| - didDraw(dirtyRect);
|
| - }
|
| - }
|
| + WindRule windRule = c->fillRule();
|
| + WindRule newWindRule = RULE_NONZERO;
|
| + if (!parseWinding(windingRuleString, newWindRule)) {
|
| + return;
|
| + }
|
| + c->setFillRule(newWindRule);
|
|
|
| - c->setFillRule(windRule);
|
| + if (isFullCanvasCompositeMode(state().m_globalComposite)) {
|
| + fullCanvasCompositedFill(path);
|
| + didDraw(clipBounds);
|
| + } else if (state().m_globalComposite == CompositeCopy) {
|
| + clearCanvas();
|
| + c->fillPath(path);
|
| + didDraw(clipBounds);
|
| + } else {
|
| + FloatRect dirtyRect;
|
| + if (computeDirtyRect(path.boundingRect(), clipBounds, &dirtyRect)) {
|
| + c->fillPath(path);
|
| + didDraw(dirtyRect);
|
| + }
|
| }
|
| +
|
| + c->setFillRule(windRule);
|
| }
|
|
|
| -void CanvasRenderingContext2D::stroke()
|
| +void CanvasRenderingContext2D::fill(const String& windingRuleString)
|
| +{
|
| + fillInternal(m_path, windingRuleString);
|
| +}
|
| +
|
| +void CanvasRenderingContext2D::fill(DOMPath* domPath, const String& windingRuleString)
|
| +{
|
| + fillInternal(domPath->path(), windingRuleString);
|
| +}
|
| +
|
| +void CanvasRenderingContext2D::strokeInternal(const Path& path)
|
| {
|
| + if (path.isEmpty()) {
|
| + return;
|
| + }
|
| GraphicsContext* c = drawingContext();
|
| - if (!c)
|
| + if (!c) {
|
| return;
|
| - if (!state().m_invertibleCTM)
|
| + }
|
| + if (!state().m_invertibleCTM) {
|
| return;
|
| + }
|
|
|
| // If gradient size is zero, then paint nothing.
|
| Gradient* gradient = c->strokeGradient();
|
| - if (gradient && gradient->isZeroSize())
|
| + if (gradient && gradient->isZeroSize()) {
|
| return;
|
| + }
|
|
|
| - if (!m_path.isEmpty()) {
|
| - FloatRect bounds = m_path.boundingRect();
|
| - inflateStrokeRect(bounds);
|
| - FloatRect dirtyRect;
|
| - if (computeDirtyRect(bounds, &dirtyRect)) {
|
| - c->strokePath(m_path);
|
| - didDraw(dirtyRect);
|
| - }
|
| + FloatRect bounds = path.boundingRect();
|
| + inflateStrokeRect(bounds);
|
| + FloatRect dirtyRect;
|
| + if (computeDirtyRect(bounds, &dirtyRect)) {
|
| + c->strokePath(path);
|
| + didDraw(dirtyRect);
|
| }
|
| }
|
|
|
| -void CanvasRenderingContext2D::clip(const String& windingRuleString)
|
| +void CanvasRenderingContext2D::stroke()
|
| +{
|
| + strokeInternal(m_path);
|
| +}
|
| +
|
| +void CanvasRenderingContext2D::stroke(DOMPath* domPath)
|
| +{
|
| + strokeInternal(domPath->path());
|
| +}
|
| +
|
| +void CanvasRenderingContext2D::clipInternal(const Path& path, const String& windingRuleString)
|
| {
|
| GraphicsContext* c = drawingContext();
|
| - if (!c)
|
| + if (!c) {
|
| return;
|
| - if (!state().m_invertibleCTM)
|
| + }
|
| + if (!state().m_invertibleCTM) {
|
| return;
|
| + }
|
|
|
| WindRule newWindRule = RULE_NONZERO;
|
| - if (!parseWinding(windingRuleString, newWindRule))
|
| + if (!parseWinding(windingRuleString, newWindRule)) {
|
| return;
|
| + }
|
|
|
| realizeSaves();
|
| - c->canvasClip(m_path, newWindRule);
|
| + c->canvasClip(path, newWindRule);
|
| +}
|
| +
|
| +void CanvasRenderingContext2D::clip(const String& windingRuleString)
|
| +{
|
| + clipInternal(m_path, windingRuleString);
|
| +}
|
| +
|
| +void CanvasRenderingContext2D::clip(DOMPath* domPath, const String& windingRuleString)
|
| +{
|
| + clipInternal(domPath->path(), windingRuleString);
|
| }
|
|
|
| bool CanvasRenderingContext2D::isPointInPath(const float x, const float y, const String& windingRuleString)
|
|
|