- commit 1f2c0aadab8c573c4f0072cad09171f2dd7cffeb
- Author: Martin Robinson <mrobinson@igalia.com>
- Date: Sat Jul 10 16:07:32 2010 -0700
- convex clip
- diff --git a/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp b/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp
- index 3226fe0..2f55f56 100644
- --- a/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp
- +++ b/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp
- @@ -66,6 +66,14 @@
- namespace WebCore {
- +static void addConvexPolygonToContext(cairo_t* context, size_t numPoints, const FloatPoint* points)
- +{
- + cairo_move_to(context, points[0].x(), points[0].y());
- + for (size_t i = 1; i < numPoints; i++)
- + cairo_line_to(context, points[i].x(), points[i].y());
- + cairo_close_path(context);
- +}
- +
- static inline void setColor(cairo_t* cr, const Color& col)
- {
- float red, green, blue, alpha;
- @@ -510,10 +518,7 @@ void GraphicsContext::drawConvexPolygon(size_t npoints, const FloatPoint* points
- m_data->saveCairoPath();
- cairo_set_antialias(cr, shouldAntialias ? CAIRO_ANTIALIAS_DEFAULT : CAIRO_ANTIALIAS_NONE);
- - cairo_move_to(cr, points[0].x(), points[0].y());
- - for (size_t i = 1; i < npoints; i++)
- - cairo_line_to(cr, points[i].x(), points[i].y());
- - cairo_close_path(cr);
- + addConvexPolygonToContext(cr, npoints, points);
- if (fillColor().alpha()) {
- setColor(cr, fillColor());
- @@ -539,8 +544,21 @@ void GraphicsContext::clipConvexPolygon(size_t numPoints, const FloatPoint* poin
- if (numPoints <= 1)
- return;
- -
- - // FIXME: IMPLEMENT!
- +
- + cairo_t* cr = m_data->cr;
- + m_data->saveCairoPath();
- +
- + cairo_fill_rule_t savedFillRule = cairo_get_fill_rule(cr);
- + cairo_antialias_t savedAntialiasRule = cairo_get_antialias(cr);
- + cairo_set_antialias(cr, CAIRO_ANTIALIAS_DEFAULT);
- + cairo_set_fill_rule(cr, CAIRO_FILL_RULE_WINDING);
- +
- + addConvexPolygonToContext(cr, numPoints, points);
- + cairo_clip(cr);
- +
- + cairo_set_antialias(cr, savedAntialiasRule);
- + cairo_set_fill_rule(cr, savedFillRule);
- + m_data->restoreCairoPath();
- }
- void GraphicsContext::fillPath()
- diff --git a/WebCore/rendering/RenderObject.h b/WebCore/rendering/RenderObject.h
- index 33271df..f3bb7a1 100644
- --- a/WebCore/rendering/RenderObject.h
- +++ b/WebCore/rendering/RenderObject.h
- @@ -38,7 +38,7 @@
- #include "TransformationMatrix.h"
- #include <wtf/UnusedParam.h>
- -#if PLATFORM(CG)
- +#if PLATFORM(CG) || PLATFORM(GTK)
- #define HAVE_PATH_BASED_BORDER_RADIUS_DRAWING 1
- #endif