diff options
Diffstat (limited to 'WebCore/platform/graphics/cairo')
3 files changed, 45 insertions, 21 deletions
diff --git a/WebCore/platform/graphics/cairo/ContextShadowCairo.cpp b/WebCore/platform/graphics/cairo/ContextShadowCairo.cpp index 699edf7..8299b6a 100644 --- a/WebCore/platform/graphics/cairo/ContextShadowCairo.cpp +++ b/WebCore/platform/graphics/cairo/ContextShadowCairo.cpp @@ -84,8 +84,6 @@ static cairo_surface_t* getScratchBuffer(const IntSize& size) PlatformContext ContextShadow::beginShadowLayer(PlatformContext context, const FloatRect& layerArea) { - m_unscaledLayerRect = layerArea; - double x1, x2, y1, y2; cairo_clip_extents(context, &x1, &y1, &x2, &y2); calculateLayerBoundingRect(layerArea, IntRect(x1, y1, x2 - x1, y2 - y1)); @@ -122,19 +120,7 @@ void ContextShadow::endShadowLayer(cairo_t* cr) cairo_save(cr); setSourceRGBAFromColor(cr, m_color); - - cairo_matrix_t transform; - cairo_get_matrix(cr, &transform); - double x = m_layerRect.x(); - double y = m_layerRect.y(); - - double xScale = sqrt(transform.xx * transform.xx + transform.yx * transform.yx); - double yScale = sqrt(transform.xy * transform.xy + transform.yy * transform.yy); - if (xScale != 1 || yScale != 1) { - x = m_unscaledLayerRect.x() + m_offset.width() / transform.xx - m_blurDistance; - y = m_unscaledLayerRect.y() + m_offset.height() / transform.yy - m_blurDistance; - } - cairo_mask_surface(cr, m_layerImage, x, y); + cairo_mask_surface(cr, m_layerImage, m_layerRect.x(), m_layerRect.y()); cairo_restore(cr); // Schedule a purge of the scratch buffer. We do not need to destroy the surface. diff --git a/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp b/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp index 9c2ff82..1032dc2 100644 --- a/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp +++ b/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp @@ -531,26 +531,44 @@ void GraphicsContext::clipConvexPolygon(size_t numPoints, const FloatPoint* poin cairo_set_fill_rule(cr, savedFillRule); } -void GraphicsContext::fillPath(const Path& path) +void GraphicsContext::fillPath() { if (paintingDisabled()) return; cairo_t* cr = m_data->cr; - setPathOnCairoContext(cr, path.platformPath()->context()); + + setPathOnCairoContext(cr, m_data->m_pendingPath.context()); fillCurrentCairoPath(this, m_common, cr); } -void GraphicsContext::strokePath(const Path& path) +void GraphicsContext::strokePath() { if (paintingDisabled()) return; cairo_t* cr = m_data->cr; - setPathOnCairoContext(cr, path.platformPath()->context()); + setPathOnCairoContext(cr, m_data->m_pendingPath.context()); strokeCurrentCairoPath(this, m_common, cr); } +void GraphicsContext::drawPath() +{ + if (paintingDisabled()) + return; + + cairo_t* cr = m_data->cr; + + setPathOnCairoContext(cr, m_data->m_pendingPath.context()); + + cairo_set_fill_rule(cr, fillRule() == RULE_EVENODD ? CAIRO_FILL_RULE_EVEN_ODD : CAIRO_FILL_RULE_WINDING); + drawPathShadow(this, m_common, FillAndStroke); + + setPlatformFill(this, cr, m_common); + setPlatformStroke(this, cr, m_common); + cairo_new_path(cr); +} + void GraphicsContext::fillRect(const FloatRect& rect) { if (paintingDisabled()) @@ -589,13 +607,12 @@ void GraphicsContext::clip(const FloatRect& rect) m_data->clip(rect); } -void GraphicsContext::clipPath(const Path& path, WindRule clipRule) +void GraphicsContext::clipPath(WindRule clipRule) { if (paintingDisabled()) return; cairo_t* cr = m_data->cr; - setPathOnCairoContext(cr, path.platformPath()->context()); cairo_set_fill_rule(cr, clipRule == RULE_EVENODD ? CAIRO_FILL_RULE_EVEN_ODD : CAIRO_FILL_RULE_WINDING); cairo_clip(cr); } @@ -977,6 +994,25 @@ void GraphicsContext::setCompositeOperation(CompositeOperator op) cairo_set_operator(m_data->cr, toCairoOperator(op)); } +void GraphicsContext::beginPath() +{ + if (paintingDisabled()) + return; + + cairo_new_path(m_data->m_pendingPath.context()); +} + +void GraphicsContext::addPath(const Path& path) +{ + if (paintingDisabled()) + return; + + cairo_matrix_t currentMatrix; + cairo_get_matrix(m_data->cr, ¤tMatrix); + cairo_set_matrix(m_data->m_pendingPath.context(), ¤tMatrix); + appendWebCorePathToCairoContext(m_data->m_pendingPath.context(), path); +} + void GraphicsContext::clip(const Path& path) { if (paintingDisabled()) diff --git a/WebCore/platform/graphics/cairo/GraphicsContextPlatformPrivateCairo.h b/WebCore/platform/graphics/cairo/GraphicsContextPlatformPrivateCairo.h index 494b40d..527cb72 100644 --- a/WebCore/platform/graphics/cairo/GraphicsContextPlatformPrivateCairo.h +++ b/WebCore/platform/graphics/cairo/GraphicsContextPlatformPrivateCairo.h @@ -27,6 +27,7 @@ #include "GraphicsContext.h" +#include "CairoPath.h" #include "ContextShadow.h" #include <cairo.h> #include <math.h> @@ -96,6 +97,7 @@ public: cairo_t* cr; Vector<float> layers; + CairoPath m_pendingPath; ContextShadow shadow; Vector<ContextShadow> shadowStack; |