[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.15.1-1414-gc69ee75
senorblanco at chromium.org
senorblanco at chromium.org
Thu Oct 29 20:47:51 UTC 2009
The following commit has been merged in the webkit-1.1 branch:
commit 0c8bd2584e29ff51616789700c1009f36c815834
Author: senorblanco at chromium.org <senorblanco at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Mon Oct 19 18:38:23 2009 +0000
WebCore: Fix for chromium/skia canvas arc start/end positions, when the arc is
>= 360 degrees.
https://bugs.webkit.org/show_bug.cgi?id=30449
Reviewed by Adam Barth.
Covered by new test:
LayoutTests/fast/canvas/arc360.html
* platform/graphics/skia/PathSkia.cpp:
(WebCore::Path::addArc):
LayoutTests: New test for 360 degree arc endpoints, and expected results.
http://bugs.webkit.org/show_bug.cgi?id=30449
Reviewed by Adam Barth.
* fast/canvas/arc360.html: Added.
* platform/mac/fast/canvas/arc360-expected.checksum: Added.
* platform/mac/fast/canvas/arc360-expected.png: Added.
* platform/mac/fast/canvas/arc360-expected.txt: Added.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@49794 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 7e0bf28..e36ab24 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,15 @@
+2009-10-16 Stephen White <senorblanco at chromium.org>
+
+ Reviewed by Adam Barth.
+
+ New test for 360 degree arc endpoints, and expected results.
+ http://bugs.webkit.org/show_bug.cgi?id=30449
+
+ * fast/canvas/arc360.html: Added.
+ * platform/mac/fast/canvas/arc360-expected.checksum: Added.
+ * platform/mac/fast/canvas/arc360-expected.png: Added.
+ * platform/mac/fast/canvas/arc360-expected.txt: Added.
+
2009-10-19 Brian Weinstein <bweinstein at apple.com>
Rubber-stamped by Adam Roben.
diff --git a/LayoutTests/fast/canvas/arc360.html b/LayoutTests/fast/canvas/arc360.html
new file mode 100644
index 0000000..51438e5
--- /dev/null
+++ b/LayoutTests/fast/canvas/arc360.html
@@ -0,0 +1,18 @@
+<body>
+<p>Test canvas arc() start / end points when the arc is >= 360 degrees. The result should be a circle with two line segments connected to the left hand side, towards the top left and bottom left corners.
+<canvas id="mycanvas" width="400" height="400"></canvas>
+<script>
+var canvas = document.getElementById('mycanvas');
+var ctx = canvas.getContext('2d');
+var cx = 200, cy = 200, radius = 100;
+function deg2rad(x) {
+ return x * 3.141592653589 / 180;
+}
+ctx.lineWidth = 10;
+ctx.beginPath();
+ctx.moveTo(0, 100);
+ctx.arc(cx, cy, radius, deg2rad(-180), deg2rad(180), false);
+ctx.lineTo(0, 300);
+ctx.stroke();
+</script>
+</body>
diff --git a/LayoutTests/platform/mac/fast/canvas/arc360-expected.checksum b/LayoutTests/platform/mac/fast/canvas/arc360-expected.checksum
new file mode 100644
index 0000000..2e034a5
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/canvas/arc360-expected.checksum
@@ -0,0 +1 @@
+fc6f98a0d8250b6e57c12b849fb2c808
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/fast/canvas/arc360-expected.png b/LayoutTests/platform/mac/fast/canvas/arc360-expected.png
new file mode 100644
index 0000000..4ff4db9
Binary files /dev/null and b/LayoutTests/platform/mac/fast/canvas/arc360-expected.png differ
diff --git a/LayoutTests/platform/mac/fast/canvas/arc360-expected.txt b/LayoutTests/platform/mac/fast/canvas/arc360-expected.txt
new file mode 100644
index 0000000..4a0cb05
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/canvas/arc360-expected.txt
@@ -0,0 +1,13 @@
+layer at (0,0) size 800x600
+ RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+ RenderBlock {HTML} at (0,0) size 800x600
+ RenderBody {BODY} at (8,8) size 784x576
+ RenderBlock {P} at (0,0) size 784x436
+ RenderText {#text} at (0,0) size 749x36
+ text run at (0,0) width 749: "Test canvas arc() start / end points when the arc is >= 360 degrees. The result should be a circle with two line segments"
+ text run at (0,18) width 477: "connected to the left hand side, towards the top left and bottom left corners. "
+ RenderHTMLCanvas {CANVAS} at (0,36) size 400x400
+ RenderText {#text} at (0,0) size 0x0
+ RenderText {#text} at (0,0) size 0x0
+ RenderText {#text} at (0,0) size 0x0
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 2b9c9fa..307fa54 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,17 @@
+2009-10-16 Stephen White <senorblanco at chromium.org>
+
+ Reviewed by Adam Barth.
+
+ Fix for chromium/skia canvas arc start/end positions, when the arc is
+ >= 360 degrees.
+ https://bugs.webkit.org/show_bug.cgi?id=30449
+
+ Covered by new test:
+ LayoutTests/fast/canvas/arc360.html
+
+ * platform/graphics/skia/PathSkia.cpp:
+ (WebCore::Path::addArc):
+
2009-10-19 Kent Tamura <tkent at chromium.org>
Reviewed by Alexey Proskuryakov.
diff --git a/WebCore/platform/graphics/skia/PathSkia.cpp b/WebCore/platform/graphics/skia/PathSkia.cpp
index 5ac14b9..2cbb759 100644
--- a/WebCore/platform/graphics/skia/PathSkia.cpp
+++ b/WebCore/platform/graphics/skia/PathSkia.cpp
@@ -123,26 +123,31 @@ void Path::addArc(const FloatPoint& p, float r, float sa, float ea, bool anticlo
SkScalar cx = WebCoreFloatToSkScalar(p.x());
SkScalar cy = WebCoreFloatToSkScalar(p.y());
SkScalar radius = WebCoreFloatToSkScalar(r);
+ SkScalar s360 = SkIntToScalar(360);
SkRect oval;
oval.set(cx - radius, cy - radius, cx + radius, cy + radius);
float sweep = ea - sa;
- // check for a circle
- if (sweep >= 2 * piFloat || sweep <= -2 * piFloat)
+ SkScalar startDegrees = WebCoreFloatToSkScalar(sa * 180 / piFloat);
+ SkScalar sweepDegrees = WebCoreFloatToSkScalar(sweep * 180 / piFloat);
+ // Check for a circle.
+ if (sweepDegrees >= s360 || sweepDegrees <= -s360) {
+ // Move to the start position (0 sweep means we add a single point).
+ m_path->arcTo(oval, startDegrees, 0, false);
+ // Draw the circle.
m_path->addOval(oval);
- else {
- SkScalar startDegrees = WebCoreFloatToSkScalar(sa * 180 / piFloat);
- SkScalar sweepDegrees = WebCoreFloatToSkScalar(sweep * 180 / piFloat);
-
+ // Force a moveTo the end position.
+ m_path->arcTo(oval, startDegrees + sweepDegrees, 0, true);
+ } else {
// Counterclockwise arcs should be drawn with negative sweeps, while
// clockwise arcs should be drawn with positive sweeps. Check to see
// if the situation is reversed and correct it by adding or subtracting
// a full circle
if (anticlockwise && sweepDegrees > 0) {
- sweepDegrees -= SkIntToScalar(360);
+ sweepDegrees -= s360;
} else if (!anticlockwise && sweepDegrees < 0) {
- sweepDegrees += SkIntToScalar(360);
+ sweepDegrees += s360;
}
m_path->arcTo(oval, startDegrees, sweepDegrees, false);
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list