summaryrefslogtreecommitdiffstats
path: root/WebCore/platform/graphics/openvg
diff options
context:
space:
mode:
authorBen Murdoch <benm@google.com>2011-05-05 14:36:32 +0100
committerBen Murdoch <benm@google.com>2011-05-10 15:38:30 +0100
commitf05b935882198ccf7d81675736e3aeb089c5113a (patch)
tree4ea0ca838d9ef1b15cf17ddb3928efb427c7e5a1 /WebCore/platform/graphics/openvg
parent60fbdcc62bced8db2cb1fd233cc4d1e4ea17db1b (diff)
downloadexternal_webkit-f05b935882198ccf7d81675736e3aeb089c5113a.zip
external_webkit-f05b935882198ccf7d81675736e3aeb089c5113a.tar.gz
external_webkit-f05b935882198ccf7d81675736e3aeb089c5113a.tar.bz2
Merge WebKit at r74534: Initial merge by git.
Change-Id: I6ccd1154fa1b19c2ec2a66878eb675738735f1eb
Diffstat (limited to 'WebCore/platform/graphics/openvg')
-rw-r--r--WebCore/platform/graphics/openvg/GraphicsContextOpenVG.cpp55
-rw-r--r--WebCore/platform/graphics/openvg/PainterOpenVG.cpp40
-rw-r--r--WebCore/platform/graphics/openvg/PainterOpenVG.h6
3 files changed, 24 insertions, 77 deletions
diff --git a/WebCore/platform/graphics/openvg/GraphicsContextOpenVG.cpp b/WebCore/platform/graphics/openvg/GraphicsContextOpenVG.cpp
index 0d16d4d..633ca75 100644
--- a/WebCore/platform/graphics/openvg/GraphicsContextOpenVG.cpp
+++ b/WebCore/platform/graphics/openvg/GraphicsContextOpenVG.cpp
@@ -21,7 +21,6 @@
#include "GraphicsContext.h"
#include "AffineTransform.h"
-#include "GraphicsContextPrivate.h"
#include "KURL.h"
#include "NotImplemented.h"
#include "PainterOpenVG.h"
@@ -49,16 +48,14 @@ public:
}
};
-GraphicsContext::GraphicsContext(SurfaceOpenVG* surface)
- : m_common(createGraphicsContextPrivate())
- , m_data(surface ? new GraphicsContextPlatformPrivate(surface) : 0)
+void GraphicsContext::platformInit(SurfaceOpenVG* surface)
{
+ m_data = surface ? new GraphicsContextPlatformPrivate(surface) : 0;
setPaintingDisabled(!surface);
}
-GraphicsContext::~GraphicsContext()
+void GraphicsContext::platformDestroy()
{
- destroyGraphicsContextPrivate(m_common);
delete m_data;
}
@@ -139,28 +136,20 @@ void GraphicsContext::drawConvexPolygon(size_t numPoints, const FloatPoint* poin
UNUSED_PARAM(shouldAntialias); // FIXME
}
-void GraphicsContext::fillPath()
+void GraphicsContext::fillPath(const Path& path)
{
if (paintingDisabled())
return;
- m_data->drawPath(VG_FILL_PATH, m_common->state.fillRule);
+ m_data->drawPath(path, VG_FILL_PATH, m_state.fillRule);
}
-void GraphicsContext::strokePath()
+void GraphicsContext::strokePath(const Path& path)
{
if (paintingDisabled())
return;
- m_data->drawPath(VG_STROKE_PATH, m_common->state.fillRule);
-}
-
-void GraphicsContext::drawPath()
-{
- if (paintingDisabled())
- return;
-
- m_data->drawPath(VG_FILL_PATH | VG_STROKE_PATH, m_common->state.fillRule);
+ m_data->drawPath(path, VG_STROKE_PATH, m_state.fillRule);
}
void GraphicsContext::fillRect(const FloatRect& rect)
@@ -197,22 +186,6 @@ void GraphicsContext::fillRoundedRect(const IntRect& rect, const IntSize& topLef
UNUSED_PARAM(colorSpace); // FIXME
}
-void GraphicsContext::beginPath()
-{
- if (paintingDisabled())
- return;
-
- m_data->beginPath();
-}
-
-void GraphicsContext::addPath(const Path& path)
-{
- if (paintingDisabled())
- return;
-
- m_data->addPath(path);
-}
-
void GraphicsContext::clip(const FloatRect& rect)
{
if (paintingDisabled())
@@ -221,12 +194,12 @@ void GraphicsContext::clip(const FloatRect& rect)
m_data->intersectClipRect(rect);
}
-void GraphicsContext::clipPath(WindRule clipRule)
+void GraphicsContext::clipPath(const Path& path, WindRule clipRule)
{
if (paintingDisabled())
return;
- m_data->clipPath(*(m_data->currentPath()), PainterOpenVG::IntersectClip, clipRule);
+ m_data->clipPath(path, PainterOpenVG::IntersectClip, clipRule);
}
void GraphicsContext::drawFocusRing(const Vector<IntRect>& rects, int width, int offset, const Color& color)
@@ -391,7 +364,7 @@ void GraphicsContext::setAlpha(float opacity)
m_data->setOpacity(opacity);
}
-void GraphicsContext::setCompositeOperation(CompositeOperator op)
+void GraphicsContext::setPlatformCompositeOperation(CompositeOperator op)
{
if (paintingDisabled())
return;
@@ -404,7 +377,7 @@ void GraphicsContext::clip(const Path& path)
if (paintingDisabled())
return;
- m_data->clipPath(path, PainterOpenVG::IntersectClip, m_common->state.fillRule);
+ m_data->clipPath(path, PainterOpenVG::IntersectClip, m_state.fillRule);
}
void GraphicsContext::canvasClip(const Path& path)
@@ -417,7 +390,7 @@ void GraphicsContext::clipOut(const Path& path)
if (paintingDisabled())
return;
- m_data->clipPath(path, PainterOpenVG::SubtractClip, m_common->state.fillRule);
+ m_data->clipPath(path, PainterOpenVG::SubtractClip, m_state.fillRule);
}
void GraphicsContext::scale(const FloatSize& scaleFactors)
@@ -451,7 +424,7 @@ void GraphicsContext::clipOut(const IntRect& rect)
Path path;
path.addRect(rect);
- m_data->clipPath(path, PainterOpenVG::SubtractClip, m_common->state.fillRule);
+ m_data->clipPath(path, PainterOpenVG::SubtractClip, m_state.fillRule);
}
void GraphicsContext::clipToImageBuffer(const FloatRect& rect, const ImageBuffer* imageBuffer)
@@ -474,7 +447,7 @@ void GraphicsContext::addInnerRoundedRectClip(const IntRect& rect, int thickness
path.addEllipse(FloatRect(rect.x() + thickness, rect.y() + thickness,
rect.width() - (thickness * 2), rect.height() - (thickness * 2)));
- m_data->clipPath(path, PainterOpenVG::IntersectClip, m_common->state.fillRule);
+ m_data->clipPath(path, PainterOpenVG::IntersectClip, m_state.fillRule);
}
void GraphicsContext::concatCTM(const AffineTransform& transformation)
diff --git a/WebCore/platform/graphics/openvg/PainterOpenVG.cpp b/WebCore/platform/graphics/openvg/PainterOpenVG.cpp
index b2f2302..54937a4 100644
--- a/WebCore/platform/graphics/openvg/PainterOpenVG.cpp
+++ b/WebCore/platform/graphics/openvg/PainterOpenVG.cpp
@@ -123,7 +123,7 @@ struct PlatformPainterState {
DashArray strokeDashArray;
float strokeDashOffset;
- int textDrawingMode;
+ TextDrawingModeFlags textDrawingMode;
bool antialiasingEnabled;
PlatformPainterState()
@@ -141,7 +141,7 @@ struct PlatformPainterState {
, strokeLineJoin(MiterJoin)
, strokeMiterLimit(4.0)
, strokeDashOffset(0.0)
- , textDrawingMode(cTextFill)
+ , textDrawingMode(TextModeFill)
, antialiasingEnabled(true)
{
}
@@ -399,14 +399,12 @@ struct PlatformPainterState {
PainterOpenVG::PainterOpenVG()
: m_state(0)
, m_surface(0)
- , m_currentPath(0)
{
}
PainterOpenVG::PainterOpenVG(SurfaceOpenVG* surface)
: m_state(0)
, m_surface(0)
- , m_currentPath(0)
{
ASSERT(surface);
begin(surface);
@@ -415,7 +413,6 @@ PainterOpenVG::PainterOpenVG(SurfaceOpenVG* surface)
PainterOpenVG::~PainterOpenVG()
{
end();
- delete m_currentPath;
}
void PainterOpenVG::begin(SurfaceOpenVG* surface)
@@ -656,13 +653,13 @@ void PainterOpenVG::setFillColor(const Color& color)
setVGSolidColor(VG_FILL_PATH, color);
}
-int PainterOpenVG::textDrawingMode() const
+TextDrawingModeFlags PainterOpenVG::textDrawingMode() const
{
ASSERT(m_state);
return m_state->textDrawingMode;
}
-void PainterOpenVG::setTextDrawingMode(int mode)
+void PainterOpenVG::setTextDrawingMode(TextDrawingModeFlags mode)
{
ASSERT(m_state);
m_state->textDrawingMode = mode;
@@ -717,26 +714,7 @@ void PainterOpenVG::translate(float dx, float dy)
setTransformation(transformation);
}
-void PainterOpenVG::beginPath()
-{
- delete m_currentPath;
- m_currentPath = new Path();
-}
-
-void PainterOpenVG::addPath(const Path& path)
-{
- m_currentPath->platformPath()->makeCompatibleContextCurrent();
-
- vgAppendPath(m_currentPath->platformPath()->vgPath(), path.platformPath()->vgPath());
- ASSERT_VG_NO_ERROR();
-}
-
-Path* PainterOpenVG::currentPath() const
-{
- return m_currentPath;
-}
-
-void PainterOpenVG::drawPath(VGbitfield specifiedPaintModes, WindRule fillRule)
+void PainterOpenVG::drawPath(const Path& path, VGbitfield specifiedPaintModes, WindRule fillRule)
{
ASSERT(m_state);
@@ -754,7 +732,7 @@ void PainterOpenVG::drawPath(VGbitfield specifiedPaintModes, WindRule fillRule)
m_surface->makeCurrent();
vgSeti(VG_FILL_RULE, toVGFillRule(fillRule));
- vgDrawPath(m_currentPath->platformPath()->vgPath(), paintModes);
+ vgDrawPath(path.platformPath()->vgPath(), paintModes);
ASSERT_VG_NO_ERROR();
}
@@ -1136,11 +1114,11 @@ void PainterOpenVG::drawText(VGFont vgFont, Vector<VGuint>& characters, VGfloat*
VGbitfield paintModes = 0;
- if (m_state->textDrawingMode & cTextClip)
+ if (m_state->textDrawingMode & TextModeClip)
return; // unsupported for every port except CG at the time of writing
- if (m_state->textDrawingMode & cTextFill && !m_state->fillDisabled())
+ if (m_state->textDrawingMode & TextModeFill && !m_state->fillDisabled())
paintModes |= VG_FILL_PATH;
- if (m_state->textDrawingMode & cTextStroke && !m_state->strokeDisabled())
+ if (m_state->textDrawingMode & TextModeStroke && !m_state->strokeDisabled())
paintModes |= VG_STROKE_PATH;
m_surface->makeCurrent();
diff --git a/WebCore/platform/graphics/openvg/PainterOpenVG.h b/WebCore/platform/graphics/openvg/PainterOpenVG.h
index e4c6688..24fd8a0 100644
--- a/WebCore/platform/graphics/openvg/PainterOpenVG.h
+++ b/WebCore/platform/graphics/openvg/PainterOpenVG.h
@@ -111,10 +111,7 @@ public:
void rotate(float radians);
void translate(float dx, float dy);
- void beginPath();
- void addPath(const Path&);
- Path* currentPath() const;
- void drawPath(VGbitfield paintModes = (VG_STROKE_PATH | VG_FILL_PATH), WindRule fillRule = RULE_NONZERO);
+ void drawPath(const Path&, VGbitfield paintModes = (VG_STROKE_PATH | VG_FILL_PATH), WindRule fillRule = RULE_NONZERO);
void intersectClipRect(const FloatRect&);
void clipPath(const Path&, PainterOpenVG::ClipOperation, WindRule clipRule = RULE_NONZERO);
@@ -137,7 +134,6 @@ private:
Vector<PlatformPainterState*> m_stateStack;
PlatformPainterState* m_state;
SurfaceOpenVG* m_surface;
- Path* m_currentPath;
};
}