summaryrefslogtreecommitdiffstats
path: root/Source/WebCore/platform/graphics/android/context
diff options
context:
space:
mode:
authorJohn Reck <jreck@google.com>2012-07-20 17:40:29 -0700
committerJohn Reck <jreck@google.com>2012-07-20 17:40:29 -0700
commit839203b35a55ec16675b15767cb242038b9a5132 (patch)
tree0769056cceeb9e13981d6615fea5ab79daeabc68 /Source/WebCore/platform/graphics/android/context
parent7e79b26827775cb4bb330bd70d2a2a2ee4c9412b (diff)
downloadexternal_webkit-839203b35a55ec16675b15767cb242038b9a5132.zip
external_webkit-839203b35a55ec16675b15767cb242038b9a5132.tar.gz
external_webkit-839203b35a55ec16675b15767cb242038b9a5132.tar.bz2
Implement missing recording draws
Change-Id: I15a9c63d7aed9f54095763499d3ffff2e17872b7
Diffstat (limited to 'Source/WebCore/platform/graphics/android/context')
-rw-r--r--Source/WebCore/platform/graphics/android/context/GraphicsOperation.h41
-rw-r--r--Source/WebCore/platform/graphics/android/context/PlatformGraphicsContextRecording.cpp19
2 files changed, 57 insertions, 3 deletions
diff --git a/Source/WebCore/platform/graphics/android/context/GraphicsOperation.h b/Source/WebCore/platform/graphics/android/context/GraphicsOperation.h
index fc3b8bc..1cfb094 100644
--- a/Source/WebCore/platform/graphics/android/context/GraphicsOperation.h
+++ b/Source/WebCore/platform/graphics/android/context/GraphicsOperation.h
@@ -82,7 +82,9 @@ public:
// Drawing
, DrawBitmapPatternOperation
, DrawBitmapRectOperation
+ , DrawConvexPolygonQuadOperation
, DrawEllipseOperation
+ , DrawFocusRingOperation
, DrawLineOperation
, DrawLineForTextOperation
, DrawLineForTextCheckingOperation
@@ -153,7 +155,9 @@ public:
// Drawing
TYPE_CASE(DrawBitmapPatternOperation)
TYPE_CASE(DrawBitmapRectOperation)
+ TYPE_CASE(DrawConvexPolygonQuadOperation)
TYPE_CASE(DrawEllipseOperation)
+ TYPE_CASE(DrawFocusRingOperation)
TYPE_CASE(DrawLineOperation)
TYPE_CASE(DrawLineForTextOperation)
TYPE_CASE(DrawLineForTextCheckingOperation)
@@ -577,6 +581,23 @@ private:
CompositeOperator m_operator;
};
+class DrawConvexPolygonQuad : public Operation {
+public:
+ DrawConvexPolygonQuad(const FloatPoint* points, bool shouldAntiAlias)
+ : m_shouldAntiAlias(shouldAntiAlias)
+ {
+ memcpy(m_points, points, 4 * sizeof(FloatPoint));
+ }
+ virtual bool applyImpl(PlatformGraphicsContext* context) {
+ context->drawConvexPolygon(4, m_points, m_shouldAntiAlias);
+ return true;
+ }
+ virtual OperationType type() { return DrawConvexPolygonQuadOperation; }
+private:
+ bool m_shouldAntiAlias;
+ FloatPoint m_points[4];
+};
+
class DrawEllipse : public Operation {
public:
DrawEllipse(const IntRect& rect) : m_rect(rect) {}
@@ -589,6 +610,26 @@ private:
IntRect m_rect;
};
+class DrawFocusRing : public Operation {
+public:
+ DrawFocusRing(const Vector<IntRect>& rects, int width, int offset, const Color& color)
+ : m_rects(rects)
+ , m_width(width)
+ , m_offset(offset)
+ , m_color(color)
+ {}
+ virtual bool applyImpl(PlatformGraphicsContext* context) {
+ context->drawFocusRing(m_rects, m_width, m_offset, m_color);
+ return true;
+ }
+ virtual OperationType type() { return DrawFocusRingOperation; }
+private:
+ Vector<IntRect> m_rects;
+ int m_width;
+ int m_offset;
+ Color m_color;
+};
+
class DrawLine : public Operation {
public:
DrawLine(const IntPoint& point1, const IntPoint& point2)
diff --git a/Source/WebCore/platform/graphics/android/context/PlatformGraphicsContextRecording.cpp b/Source/WebCore/platform/graphics/android/context/PlatformGraphicsContextRecording.cpp
index 6b9d27f..4a14513 100644
--- a/Source/WebCore/platform/graphics/android/context/PlatformGraphicsContextRecording.cpp
+++ b/Source/WebCore/platform/graphics/android/context/PlatformGraphicsContextRecording.cpp
@@ -449,7 +449,15 @@ void PlatformGraphicsContextRecording::drawConvexPolygon(size_t numPoints,
const FloatPoint* points,
bool shouldAntialias)
{
- // TODO
+ if (numPoints < 1) return;
+ if (numPoints != 4) {
+ // TODO: Build a path and call draw on that (webkit currently never calls this)
+ ALOGW("drawConvexPolygon with numPoints != 4 is not supported!");
+ return;
+ }
+ FloatRect bounds;
+ bounds.fitToPoints(points[0], points[1], points[2], points[3]);
+ appendDrawingOperation(new GraphicsOperation::DrawConvexPolygonQuad(points, shouldAntialias), bounds);
}
void PlatformGraphicsContextRecording::drawEllipse(const IntRect& rect)
@@ -458,10 +466,15 @@ void PlatformGraphicsContextRecording::drawEllipse(const IntRect& rect)
}
void PlatformGraphicsContextRecording::drawFocusRing(const Vector<IntRect>& rects,
- int /* width */, int /* offset */,
+ int width, int offset,
const Color& color)
{
- // TODO
+ if (!rects.size())
+ return;
+ IntRect bounds = rects[0];
+ for (size_t i = 1; i < rects.size(); i++)
+ bounds.unite(rects[i]);
+ appendDrawingOperation(new GraphicsOperation::DrawFocusRing(rects, width, offset, color), bounds);
}
void PlatformGraphicsContextRecording::drawHighlightForText(