diff options
author | Shimeng (Simon) Wang <swang@google.com> | 2010-12-07 17:22:45 -0800 |
---|---|---|
committer | Shimeng (Simon) Wang <swang@google.com> | 2010-12-22 14:15:40 -0800 |
commit | 4576aa36e9a9671459299c7963ac95aa94beaea9 (patch) | |
tree | 3863574e050f168c0126ecb47c83319fab0972d8 /WebCore/platform/graphics/cairo | |
parent | 55323ac613cc31553107b68603cb627264d22bb0 (diff) | |
download | external_webkit-4576aa36e9a9671459299c7963ac95aa94beaea9.zip external_webkit-4576aa36e9a9671459299c7963ac95aa94beaea9.tar.gz external_webkit-4576aa36e9a9671459299c7963ac95aa94beaea9.tar.bz2 |
Merge WebKit at r73109: Initial merge by git.
Change-Id: I61f1a66d9642e3d8405d3ac6ccab2a53421c75d8
Diffstat (limited to 'WebCore/platform/graphics/cairo')
3 files changed, 22 insertions, 46 deletions
diff --git a/WebCore/platform/graphics/cairo/ContextShadowCairo.cpp b/WebCore/platform/graphics/cairo/ContextShadowCairo.cpp index 8299b6a..699edf7 100644 --- a/WebCore/platform/graphics/cairo/ContextShadowCairo.cpp +++ b/WebCore/platform/graphics/cairo/ContextShadowCairo.cpp @@ -84,6 +84,8 @@ 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)); @@ -120,7 +122,19 @@ void ContextShadow::endShadowLayer(cairo_t* cr) cairo_save(cr); setSourceRGBAFromColor(cr, m_color); - cairo_mask_surface(cr, m_layerImage, m_layerRect.x(), m_layerRect.y()); + + 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_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 755adff..9c2ff82 100644 --- a/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp +++ b/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp @@ -531,44 +531,26 @@ void GraphicsContext::clipConvexPolygon(size_t numPoints, const FloatPoint* poin cairo_set_fill_rule(cr, savedFillRule); } -void GraphicsContext::fillPath() +void GraphicsContext::fillPath(const Path& path) { if (paintingDisabled()) return; cairo_t* cr = m_data->cr; - - setPathOnCairoContext(cr, m_data->m_pendingPath.context()); + setPathOnCairoContext(cr, path.platformPath()->context()); fillCurrentCairoPath(this, m_common, cr); } -void GraphicsContext::strokePath() +void GraphicsContext::strokePath(const Path& path) { if (paintingDisabled()) return; cairo_t* cr = m_data->cr; - setPathOnCairoContext(cr, m_data->m_pendingPath.context()); + setPathOnCairoContext(cr, path.platformPath()->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()) @@ -607,17 +589,18 @@ void GraphicsContext::clip(const FloatRect& rect) m_data->clip(rect); } -void GraphicsContext::clipPath(WindRule clipRule) +void GraphicsContext::clipPath(const Path& path, 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); } -void GraphicsContext::drawFocusRing(const Vector<Path>& paths, int width, int offset, const Color& color) +void GraphicsContext::drawFocusRing(const Path& path, int width, int offset, const Color& color) { // FIXME: implement } @@ -994,25 +977,6 @@ 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 527cb72..494b40d 100644 --- a/WebCore/platform/graphics/cairo/GraphicsContextPlatformPrivateCairo.h +++ b/WebCore/platform/graphics/cairo/GraphicsContextPlatformPrivateCairo.h @@ -27,7 +27,6 @@ #include "GraphicsContext.h" -#include "CairoPath.h" #include "ContextShadow.h" #include <cairo.h> #include <math.h> @@ -97,7 +96,6 @@ public: cairo_t* cr; Vector<float> layers; - CairoPath m_pendingPath; ContextShadow shadow; Vector<ContextShadow> shadowStack; |