Changeset 191617 in webkit
- Timestamp:
- Oct 26, 2015, 9:03:38 PM (10 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r191610 r191617 1 2015-10-26 Simon Fraser <simon.fraser@apple.com> 2 3 Remove redundant GraphicsContext::clip(const Path&, WindRule) 4 https://bugs.webkit.org/show_bug.cgi?id=150584 5 6 Reviewed by Tim Horton. 7 8 GraphicsContext had both clipPath(const Path&, WindRule) and clip(const Path&, WindRule), 9 which were mostly the same other than GraphicsContext::clipPath() not clipping if the path 10 was empty (added, I think by mistake, in r72926), and not calling m_data->clip(). 11 12 Make clipPath() be the winner, and have it behave like clip() with empty paths, and call m_data->clip(). 13 14 * platform/graphics/GraphicsContext.cpp: 15 (WebCore::GraphicsContext::clipRoundedRect): 16 * platform/graphics/GraphicsContext.h: 17 * platform/graphics/cairo/GraphicsContextCairo.cpp: 18 (WebCore::GraphicsContext::clipPath): 19 (WebCore::GraphicsContext::clip): Deleted. 20 * platform/graphics/cg/GraphicsContextCG.cpp: 21 (WebCore::GraphicsContext::clipPath): 22 (WebCore::GraphicsContext::canvasClip): 23 (WebCore::GraphicsContext::clip): Deleted. 24 * rendering/RenderBoxModelObject.cpp: 25 (WebCore::RenderBoxModelObject::paintBoxShadow): Making a path, calling addRoundedRect() and then clipping 26 to the path is the same as context.clipRoundedRect(). 27 * rendering/mathml/RenderMathMLRadicalOperator.cpp: 28 (WebCore::RenderMathMLRadicalOperator::paint): 29 1 30 2015-10-26 Zalan Bujtas <zalan@apple.com> 2 31 -
trunk/Source/WebCore/platform/graphics/GraphicsContext.cpp
r191330 r191617 462 462 Path path; 463 463 path.addRoundedRect(rect); 464 clip (path);464 clipPath(path); 465 465 } 466 466 -
trunk/Source/WebCore/platform/graphics/GraphicsContext.h
r191330 r191617 332 332 void clipOut(const FloatRect&); 333 333 void clipOutRoundedRect(const FloatRoundedRect&); 334 void clipPath(const Path&, WindRule );334 void clipPath(const Path&, WindRule = RULE_EVENODD); 335 335 void clipConvexPolygon(size_t numPoints, const FloatPoint*, bool antialias = true); 336 336 void clipToImageBuffer(ImageBuffer&, const FloatRect&); … … 413 413 void setDrawLuminanceMask(bool drawLuminanceMask) { m_state.drawLuminanceMask = drawLuminanceMask; } 414 414 bool drawLuminanceMask() const { return m_state.drawLuminanceMask; } 415 416 WEBCORE_EXPORT void clip(const Path&, WindRule = RULE_EVENODD);417 415 418 416 // This clip function is used only by <canvas> code. It allows -
trunk/Source/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp
r191330 r191617 495 495 if (!path.isNull()) 496 496 setPathOnCairoContext(cr, path.platformPath()->context()); 497 498 cairo_fill_rule_t savedFillRule = cairo_get_fill_rule(cr); 497 499 cairo_set_fill_rule(cr, clipRule == RULE_EVENODD ? CAIRO_FILL_RULE_EVEN_ODD : CAIRO_FILL_RULE_WINDING); 498 500 cairo_clip(cr); 501 cairo_set_fill_rule(cr, savedFillRule); 502 503 m_data->clip(path); 499 504 } 500 505 … … 961 966 } 962 967 963 void GraphicsContext::clip(const Path& path, WindRule windRule)964 {965 if (paintingDisabled())966 return;967 968 cairo_t* cr = platformContext()->cr();969 if (!path.isNull()) {970 cairo_path_t* pathCopy = cairo_copy_path(path.platformPath()->context());971 cairo_append_path(cr, pathCopy);972 cairo_path_destroy(pathCopy);973 }974 cairo_fill_rule_t savedFillRule = cairo_get_fill_rule(cr);975 if (windRule == RULE_NONZERO)976 cairo_set_fill_rule(cr, CAIRO_FILL_RULE_WINDING);977 else978 cairo_set_fill_rule(cr, CAIRO_FILL_RULE_EVEN_ODD);979 cairo_clip(cr);980 cairo_set_fill_rule(cr, savedFillRule);981 m_data->clip(path);982 }983 984 968 void GraphicsContext::canvasClip(const Path& path, WindRule windRule) 985 969 { 986 clip (path, windRule);970 clipPath(path, windRule); 987 971 } 988 972 -
trunk/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp
r191590 r191617 983 983 return; 984 984 985 // Why does clipping to an empty path do nothing? 986 // Why is this different from GraphicsContext::clip(const Path&). 985 CGContextRef context = platformContext(); 987 986 if (path.isEmpty()) 988 return; 989 990 CGContextRef context = platformContext(); 991 992 CGContextBeginPath(platformContext()); 993 CGContextAddPath(platformContext(), path.platformPath()); 994 995 if (clipRule == RULE_EVENODD) 996 CGContextEOClip(context); 997 else 998 CGContextClip(context); 987 CGContextClipToRect(context, CGRectZero); 988 else { 989 CGContextBeginPath(platformContext()); 990 CGContextAddPath(platformContext(), path.platformPath()); 991 992 if (clipRule == RULE_EVENODD) 993 CGContextEOClip(context); 994 else 995 CGContextClip(context); 996 } 997 998 m_data->clip(path); 999 999 } 1000 1000 … … 1235 1235 } 1236 1236 1237 void GraphicsContext::clip(const Path& path, WindRule fillRule)1238 {1239 if (paintingDisabled())1240 return;1241 CGContextRef context = platformContext();1242 1243 // CGContextClip does nothing if the path is empty, so in this case, we1244 // instead clip against a zero rect to reduce the clipping region to1245 // nothing - which is the intended behavior of clip() if the path is empty.1246 if (path.isEmpty())1247 CGContextClipToRect(context, CGRectZero);1248 else {1249 CGContextBeginPath(context);1250 CGContextAddPath(context, path.platformPath());1251 if (fillRule == RULE_NONZERO)1252 CGContextClip(context);1253 else1254 CGContextEOClip(context);1255 }1256 m_data->clip(path);1257 }1258 1259 1237 void GraphicsContext::canvasClip(const Path& path, WindRule fillRule) 1260 1238 { 1261 clip (path, fillRule);1239 clipPath(path, fillRule); 1262 1240 } 1263 1241 -
trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp
r191049 r191617 2347 2347 GraphicsContextStateSaver stateSaver(context); 2348 2348 if (hasBorderRadius) { 2349 Path path; 2350 path.addRoundedRect(pixelSnappedBorderRect); 2351 context.clip(path); 2349 context.clipRoundedRect(pixelSnappedBorderRect); 2352 2350 pixelSnappedRoundedHole.shrinkRadii(shadowSpread); 2353 2351 } else -
trunk/Source/WebCore/rendering/mathml/RenderMathMLRadicalOperator.cpp
r189144 r191617 153 153 154 154 // Build a mask to draw the thick part of the root. 155 Path mask ;155 Path maskPath; 156 156 157 mask .moveTo(overbarLeftPoint);158 mask .addLineTo(bottomPoint);159 mask .addLineTo(dipLeftPoint);160 mask .addLineTo(FloatPoint(2 * dipLeftPoint.x() - leftEnd.x(), 2 * dipLeftPoint.y() - leftEnd.y()));157 maskPath.moveTo(overbarLeftPoint); 158 maskPath.addLineTo(bottomPoint); 159 maskPath.addLineTo(dipLeftPoint); 160 maskPath.addLineTo(FloatPoint(2 * dipLeftPoint.x() - leftEnd.x(), 2 * dipLeftPoint.y() - leftEnd.y())); 161 161 162 info.context().clip (mask);162 info.context().clipPath(maskPath); 163 163 164 164 // Draw the thick part of the root.
Note:
See TracChangeset
for help on using the changeset viewer.