mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
canvas: Respect FillRule (#38294)
We just need to pass user provided FillRule via IPC to canvas paint thread, then pass it all down to backend, which will handle it. Testing: Added WPT tests. --------- Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
This commit is contained in:
parent
4188852963
commit
bc71fb8c0d
22 changed files with 693 additions and 32 deletions
86
tests/wpt/meta/MANIFEST.json
vendored
86
tests/wpt/meta/MANIFEST.json
vendored
|
@ -479233,7 +479233,7 @@
|
|||
[]
|
||||
],
|
||||
"path-objects.yaml": [
|
||||
"cf218829598c1ee4275ceefd025974590fbe1cd8",
|
||||
"ccb3d79b93a44d36fec6abebc9a95621c2913b6c",
|
||||
[]
|
||||
],
|
||||
"pixel-manipulation.yaml": [
|
||||
|
@ -706232,6 +706232,20 @@
|
|||
{}
|
||||
]
|
||||
],
|
||||
"2d.path.clip.winding.evenodd.1.html": [
|
||||
"a1922011e4ac937605a42e0b14a0de63b05ded73",
|
||||
[
|
||||
null,
|
||||
{}
|
||||
]
|
||||
],
|
||||
"2d.path.clip.winding.evenodd.2.html": [
|
||||
"e5aeba44b008e76000af1db74a756becf27ecadc",
|
||||
[
|
||||
null,
|
||||
{}
|
||||
]
|
||||
],
|
||||
"2d.path.closePath.empty.html": [
|
||||
"837f5a76dc9701748f4d485c102cc93f6d410ce9",
|
||||
[
|
||||
|
@ -706295,6 +706309,20 @@
|
|||
{}
|
||||
]
|
||||
],
|
||||
"2d.path.fill.winding.evenodd.1.html": [
|
||||
"d030b93239c310a76a1423fe13c1adcf9fe399ce",
|
||||
[
|
||||
null,
|
||||
{}
|
||||
]
|
||||
],
|
||||
"2d.path.fill.winding.evenodd.2.html": [
|
||||
"4553f29d1e4b245fe231eeeb75973b5eba69c15d",
|
||||
[
|
||||
null,
|
||||
{}
|
||||
]
|
||||
],
|
||||
"2d.path.fill.winding.subtract.1.html": [
|
||||
"fa1232e8d0ff59c5d283dc01641b1075372f0a77",
|
||||
[
|
||||
|
@ -717826,6 +717854,34 @@
|
|||
{}
|
||||
]
|
||||
],
|
||||
"2d.path.clip.winding.evenodd.1.html": [
|
||||
"4cf680f62f2b6328d838929f64ebe50729b5b270",
|
||||
[
|
||||
null,
|
||||
{}
|
||||
]
|
||||
],
|
||||
"2d.path.clip.winding.evenodd.1.worker.js": [
|
||||
"da772ea73d00beb9ae3332e4bf9d19fda68fdd70",
|
||||
[
|
||||
"html/canvas/offscreen/path-objects/2d.path.clip.winding.evenodd.1.worker.html",
|
||||
{}
|
||||
]
|
||||
],
|
||||
"2d.path.clip.winding.evenodd.2.html": [
|
||||
"6d47707e5ec00a8a9302c3a2caea1e9e8f25350b",
|
||||
[
|
||||
null,
|
||||
{}
|
||||
]
|
||||
],
|
||||
"2d.path.clip.winding.evenodd.2.worker.js": [
|
||||
"23f626e7d7293c7559baa66793264685876e7c0d",
|
||||
[
|
||||
"html/canvas/offscreen/path-objects/2d.path.clip.winding.evenodd.2.worker.html",
|
||||
{}
|
||||
]
|
||||
],
|
||||
"2d.path.closePath.empty.html": [
|
||||
"a14a036b253d90462d5f4d1881a0d947b869c5dd",
|
||||
[
|
||||
|
@ -717952,6 +718008,34 @@
|
|||
{}
|
||||
]
|
||||
],
|
||||
"2d.path.fill.winding.evenodd.1.html": [
|
||||
"fc839c9f58b19a4be7a0e43fe661799902ee257e",
|
||||
[
|
||||
null,
|
||||
{}
|
||||
]
|
||||
],
|
||||
"2d.path.fill.winding.evenodd.1.worker.js": [
|
||||
"64e1aa1099370dc955bf79e0f05642a53609b2c9",
|
||||
[
|
||||
"html/canvas/offscreen/path-objects/2d.path.fill.winding.evenodd.1.worker.html",
|
||||
{}
|
||||
]
|
||||
],
|
||||
"2d.path.fill.winding.evenodd.2.html": [
|
||||
"acb70538fd946bd7a6bbb561eae0e93724161b8b",
|
||||
[
|
||||
null,
|
||||
{}
|
||||
]
|
||||
],
|
||||
"2d.path.fill.winding.evenodd.2.worker.js": [
|
||||
"1a69f4639d0c8b9a67d3e6b16fd764ea7e5f6683",
|
||||
[
|
||||
"html/canvas/offscreen/path-objects/2d.path.fill.winding.evenodd.2.worker.html",
|
||||
{}
|
||||
]
|
||||
],
|
||||
"2d.path.fill.winding.subtract.1.html": [
|
||||
"814f3c3a9e76b711e1fc2f3dac373afc0ab07f0a",
|
||||
[
|
||||
|
|
38
tests/wpt/tests/html/canvas/element/path-objects/2d.path.clip.winding.evenodd.1.html
vendored
Normal file
38
tests/wpt/tests/html/canvas/element/path-objects/2d.path.clip.winding.evenodd.1.html
vendored
Normal file
|
@ -0,0 +1,38 @@
|
|||
<!DOCTYPE html>
|
||||
<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
|
||||
<meta charset="UTF-8">
|
||||
<title>Canvas test: 2d.path.clip.winding.evenodd.1</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/html/canvas/resources/canvas-tests.js"></script>
|
||||
<link rel="stylesheet" href="/html/canvas/resources/canvas-tests.css">
|
||||
<body class="show_output">
|
||||
|
||||
<h1>2d.path.clip.winding.evenodd.1</h1>
|
||||
<p class="desc">evenodd winding number rule works in clip</p>
|
||||
|
||||
|
||||
<p class="output">Actual output:</p>
|
||||
<canvas id="c" class="output" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
|
||||
|
||||
<ul id="d"></ul>
|
||||
<script>
|
||||
var t = async_test("evenodd winding number rule works in clip");
|
||||
_addTest(function(canvas, ctx) {
|
||||
|
||||
ctx.fillStyle = '#0f0';
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
|
||||
ctx.beginPath();
|
||||
ctx.rect(0, 0, 100, 50);
|
||||
ctx.rect(0, 0, 100, 50);
|
||||
|
||||
ctx.fillStyle = "#f00";
|
||||
ctx.clip("evenodd");
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
|
||||
_assertPixel(canvas, 50,25, 0,255,0,255);
|
||||
|
||||
});
|
||||
</script>
|
||||
|
39
tests/wpt/tests/html/canvas/element/path-objects/2d.path.clip.winding.evenodd.2.html
vendored
Normal file
39
tests/wpt/tests/html/canvas/element/path-objects/2d.path.clip.winding.evenodd.2.html
vendored
Normal file
|
@ -0,0 +1,39 @@
|
|||
<!DOCTYPE html>
|
||||
<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
|
||||
<meta charset="UTF-8">
|
||||
<title>Canvas test: 2d.path.clip.winding.evenodd.2</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/html/canvas/resources/canvas-tests.js"></script>
|
||||
<link rel="stylesheet" href="/html/canvas/resources/canvas-tests.css">
|
||||
<body class="show_output">
|
||||
|
||||
<h1>2d.path.clip.winding.evenodd.2</h1>
|
||||
<p class="desc">evenodd winding number rule works in clip</p>
|
||||
|
||||
|
||||
<p class="output">Actual output:</p>
|
||||
<canvas id="c" class="output" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
|
||||
|
||||
<ul id="d"></ul>
|
||||
<script>
|
||||
var t = async_test("evenodd winding number rule works in clip");
|
||||
_addTest(function(canvas, ctx) {
|
||||
|
||||
ctx.fillStyle = '#0f0';
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
|
||||
let path = new Path2D();
|
||||
path.rect(0, 0, 100, 50);
|
||||
path.rect(0, 0, 100, 50);
|
||||
path.closePath();
|
||||
|
||||
ctx.fillStyle = "#f00";
|
||||
ctx.clip(path, "evenodd");
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
|
||||
_assertPixel(canvas, 50,25, 0,255,0,255);
|
||||
|
||||
});
|
||||
</script>
|
||||
|
37
tests/wpt/tests/html/canvas/element/path-objects/2d.path.fill.winding.evenodd.1.html
vendored
Normal file
37
tests/wpt/tests/html/canvas/element/path-objects/2d.path.fill.winding.evenodd.1.html
vendored
Normal file
|
@ -0,0 +1,37 @@
|
|||
<!DOCTYPE html>
|
||||
<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
|
||||
<meta charset="UTF-8">
|
||||
<title>Canvas test: 2d.path.fill.winding.evenodd.1</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/html/canvas/resources/canvas-tests.js"></script>
|
||||
<link rel="stylesheet" href="/html/canvas/resources/canvas-tests.css">
|
||||
<body class="show_output">
|
||||
|
||||
<h1>2d.path.fill.winding.evenodd.1</h1>
|
||||
<p class="desc">evenodd winding number rule works in fill</p>
|
||||
|
||||
|
||||
<p class="output">Actual output:</p>
|
||||
<canvas id="c" class="output" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
|
||||
|
||||
<ul id="d"></ul>
|
||||
<script>
|
||||
var t = async_test("evenodd winding number rule works in fill");
|
||||
_addTest(function(canvas, ctx) {
|
||||
|
||||
ctx.fillStyle = '#0f0';
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
|
||||
ctx.beginPath();
|
||||
ctx.rect(0, 0, 100, 50);
|
||||
ctx.rect(0, 0, 100, 50);
|
||||
|
||||
ctx.fillStyle = "#f00";
|
||||
ctx.fill("evenodd");
|
||||
|
||||
_assertPixel(canvas, 50,25, 0,255,0,255);
|
||||
|
||||
});
|
||||
</script>
|
||||
|
38
tests/wpt/tests/html/canvas/element/path-objects/2d.path.fill.winding.evenodd.2.html
vendored
Normal file
38
tests/wpt/tests/html/canvas/element/path-objects/2d.path.fill.winding.evenodd.2.html
vendored
Normal file
|
@ -0,0 +1,38 @@
|
|||
<!DOCTYPE html>
|
||||
<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
|
||||
<meta charset="UTF-8">
|
||||
<title>Canvas test: 2d.path.fill.winding.evenodd.2</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/html/canvas/resources/canvas-tests.js"></script>
|
||||
<link rel="stylesheet" href="/html/canvas/resources/canvas-tests.css">
|
||||
<body class="show_output">
|
||||
|
||||
<h1>2d.path.fill.winding.evenodd.2</h1>
|
||||
<p class="desc">evenodd winding number rule works in fill</p>
|
||||
|
||||
|
||||
<p class="output">Actual output:</p>
|
||||
<canvas id="c" class="output" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
|
||||
|
||||
<ul id="d"></ul>
|
||||
<script>
|
||||
var t = async_test("evenodd winding number rule works in fill");
|
||||
_addTest(function(canvas, ctx) {
|
||||
|
||||
ctx.fillStyle = '#0f0';
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
|
||||
let path = new Path2D();
|
||||
path.rect(0, 0, 100, 50);
|
||||
path.rect(0, 0, 100, 50);
|
||||
path.closePath();
|
||||
|
||||
ctx.fillStyle = "#f00";
|
||||
ctx.fill(path, "evenodd");
|
||||
|
||||
_assertPixel(canvas, 50,25, 0,255,0,255);
|
||||
|
||||
});
|
||||
</script>
|
||||
|
39
tests/wpt/tests/html/canvas/offscreen/path-objects/2d.path.clip.winding.evenodd.1.html
vendored
Normal file
39
tests/wpt/tests/html/canvas/offscreen/path-objects/2d.path.clip.winding.evenodd.1.html
vendored
Normal file
|
@ -0,0 +1,39 @@
|
|||
<!DOCTYPE html>
|
||||
<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
|
||||
<meta charset="UTF-8">
|
||||
<title>OffscreenCanvas test: 2d.path.clip.winding.evenodd.1</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/html/canvas/resources/canvas-tests.js"></script>
|
||||
|
||||
<h1>2d.path.clip.winding.evenodd.1</h1>
|
||||
<p class="desc">evenodd winding number rule works in clip</p>
|
||||
|
||||
|
||||
<script>
|
||||
var t = async_test("evenodd winding number rule works in clip");
|
||||
var t_pass = t.done.bind(t);
|
||||
var t_fail = t.step_func(function(reason) {
|
||||
throw reason;
|
||||
});
|
||||
t.step(function() {
|
||||
|
||||
var canvas = new OffscreenCanvas(100, 50);
|
||||
var ctx = canvas.getContext('2d');
|
||||
|
||||
ctx.fillStyle = '#0f0';
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
|
||||
ctx.beginPath();
|
||||
ctx.rect(0, 0, 100, 50);
|
||||
ctx.rect(0, 0, 100, 50);
|
||||
|
||||
ctx.fillStyle = "#f00";
|
||||
ctx.clip("evenodd");
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
|
||||
_assertPixel(canvas, 50,25, 0,255,0,255);
|
||||
t.done();
|
||||
|
||||
});
|
||||
</script>
|
33
tests/wpt/tests/html/canvas/offscreen/path-objects/2d.path.clip.winding.evenodd.1.worker.js
vendored
Normal file
33
tests/wpt/tests/html/canvas/offscreen/path-objects/2d.path.clip.winding.evenodd.1.worker.js
vendored
Normal file
|
@ -0,0 +1,33 @@
|
|||
// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py.
|
||||
// OffscreenCanvas test in a worker:2d.path.clip.winding.evenodd.1
|
||||
// Description:evenodd winding number rule works in clip
|
||||
// Note:
|
||||
|
||||
importScripts("/resources/testharness.js");
|
||||
importScripts("/html/canvas/resources/canvas-tests.js");
|
||||
|
||||
var t = async_test("evenodd winding number rule works in clip");
|
||||
var t_pass = t.done.bind(t);
|
||||
var t_fail = t.step_func(function(reason) {
|
||||
throw reason;
|
||||
});
|
||||
t.step(function() {
|
||||
|
||||
var canvas = new OffscreenCanvas(100, 50);
|
||||
var ctx = canvas.getContext('2d');
|
||||
|
||||
ctx.fillStyle = '#0f0';
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
|
||||
ctx.beginPath();
|
||||
ctx.rect(0, 0, 100, 50);
|
||||
ctx.rect(0, 0, 100, 50);
|
||||
|
||||
ctx.fillStyle = "#f00";
|
||||
ctx.clip("evenodd");
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
|
||||
_assertPixel(canvas, 50,25, 0,255,0,255);
|
||||
t.done();
|
||||
});
|
||||
done();
|
40
tests/wpt/tests/html/canvas/offscreen/path-objects/2d.path.clip.winding.evenodd.2.html
vendored
Normal file
40
tests/wpt/tests/html/canvas/offscreen/path-objects/2d.path.clip.winding.evenodd.2.html
vendored
Normal file
|
@ -0,0 +1,40 @@
|
|||
<!DOCTYPE html>
|
||||
<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
|
||||
<meta charset="UTF-8">
|
||||
<title>OffscreenCanvas test: 2d.path.clip.winding.evenodd.2</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/html/canvas/resources/canvas-tests.js"></script>
|
||||
|
||||
<h1>2d.path.clip.winding.evenodd.2</h1>
|
||||
<p class="desc">evenodd winding number rule works in clip</p>
|
||||
|
||||
|
||||
<script>
|
||||
var t = async_test("evenodd winding number rule works in clip");
|
||||
var t_pass = t.done.bind(t);
|
||||
var t_fail = t.step_func(function(reason) {
|
||||
throw reason;
|
||||
});
|
||||
t.step(function() {
|
||||
|
||||
var canvas = new OffscreenCanvas(100, 50);
|
||||
var ctx = canvas.getContext('2d');
|
||||
|
||||
ctx.fillStyle = '#0f0';
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
|
||||
let path = new Path2D();
|
||||
path.rect(0, 0, 100, 50);
|
||||
path.rect(0, 0, 100, 50);
|
||||
path.closePath();
|
||||
|
||||
ctx.fillStyle = "#f00";
|
||||
ctx.clip(path, "evenodd");
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
|
||||
_assertPixel(canvas, 50,25, 0,255,0,255);
|
||||
t.done();
|
||||
|
||||
});
|
||||
</script>
|
34
tests/wpt/tests/html/canvas/offscreen/path-objects/2d.path.clip.winding.evenodd.2.worker.js
vendored
Normal file
34
tests/wpt/tests/html/canvas/offscreen/path-objects/2d.path.clip.winding.evenodd.2.worker.js
vendored
Normal file
|
@ -0,0 +1,34 @@
|
|||
// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py.
|
||||
// OffscreenCanvas test in a worker:2d.path.clip.winding.evenodd.2
|
||||
// Description:evenodd winding number rule works in clip
|
||||
// Note:
|
||||
|
||||
importScripts("/resources/testharness.js");
|
||||
importScripts("/html/canvas/resources/canvas-tests.js");
|
||||
|
||||
var t = async_test("evenodd winding number rule works in clip");
|
||||
var t_pass = t.done.bind(t);
|
||||
var t_fail = t.step_func(function(reason) {
|
||||
throw reason;
|
||||
});
|
||||
t.step(function() {
|
||||
|
||||
var canvas = new OffscreenCanvas(100, 50);
|
||||
var ctx = canvas.getContext('2d');
|
||||
|
||||
ctx.fillStyle = '#0f0';
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
|
||||
let path = new Path2D();
|
||||
path.rect(0, 0, 100, 50);
|
||||
path.rect(0, 0, 100, 50);
|
||||
path.closePath();
|
||||
|
||||
ctx.fillStyle = "#f00";
|
||||
ctx.clip(path, "evenodd");
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
|
||||
_assertPixel(canvas, 50,25, 0,255,0,255);
|
||||
t.done();
|
||||
});
|
||||
done();
|
38
tests/wpt/tests/html/canvas/offscreen/path-objects/2d.path.fill.winding.evenodd.1.html
vendored
Normal file
38
tests/wpt/tests/html/canvas/offscreen/path-objects/2d.path.fill.winding.evenodd.1.html
vendored
Normal file
|
@ -0,0 +1,38 @@
|
|||
<!DOCTYPE html>
|
||||
<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
|
||||
<meta charset="UTF-8">
|
||||
<title>OffscreenCanvas test: 2d.path.fill.winding.evenodd.1</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/html/canvas/resources/canvas-tests.js"></script>
|
||||
|
||||
<h1>2d.path.fill.winding.evenodd.1</h1>
|
||||
<p class="desc">evenodd winding number rule works in fill</p>
|
||||
|
||||
|
||||
<script>
|
||||
var t = async_test("evenodd winding number rule works in fill");
|
||||
var t_pass = t.done.bind(t);
|
||||
var t_fail = t.step_func(function(reason) {
|
||||
throw reason;
|
||||
});
|
||||
t.step(function() {
|
||||
|
||||
var canvas = new OffscreenCanvas(100, 50);
|
||||
var ctx = canvas.getContext('2d');
|
||||
|
||||
ctx.fillStyle = '#0f0';
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
|
||||
ctx.beginPath();
|
||||
ctx.rect(0, 0, 100, 50);
|
||||
ctx.rect(0, 0, 100, 50);
|
||||
|
||||
ctx.fillStyle = "#f00";
|
||||
ctx.fill("evenodd");
|
||||
|
||||
_assertPixel(canvas, 50,25, 0,255,0,255);
|
||||
t.done();
|
||||
|
||||
});
|
||||
</script>
|
32
tests/wpt/tests/html/canvas/offscreen/path-objects/2d.path.fill.winding.evenodd.1.worker.js
vendored
Normal file
32
tests/wpt/tests/html/canvas/offscreen/path-objects/2d.path.fill.winding.evenodd.1.worker.js
vendored
Normal file
|
@ -0,0 +1,32 @@
|
|||
// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py.
|
||||
// OffscreenCanvas test in a worker:2d.path.fill.winding.evenodd.1
|
||||
// Description:evenodd winding number rule works in fill
|
||||
// Note:
|
||||
|
||||
importScripts("/resources/testharness.js");
|
||||
importScripts("/html/canvas/resources/canvas-tests.js");
|
||||
|
||||
var t = async_test("evenodd winding number rule works in fill");
|
||||
var t_pass = t.done.bind(t);
|
||||
var t_fail = t.step_func(function(reason) {
|
||||
throw reason;
|
||||
});
|
||||
t.step(function() {
|
||||
|
||||
var canvas = new OffscreenCanvas(100, 50);
|
||||
var ctx = canvas.getContext('2d');
|
||||
|
||||
ctx.fillStyle = '#0f0';
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
|
||||
ctx.beginPath();
|
||||
ctx.rect(0, 0, 100, 50);
|
||||
ctx.rect(0, 0, 100, 50);
|
||||
|
||||
ctx.fillStyle = "#f00";
|
||||
ctx.fill("evenodd");
|
||||
|
||||
_assertPixel(canvas, 50,25, 0,255,0,255);
|
||||
t.done();
|
||||
});
|
||||
done();
|
39
tests/wpt/tests/html/canvas/offscreen/path-objects/2d.path.fill.winding.evenodd.2.html
vendored
Normal file
39
tests/wpt/tests/html/canvas/offscreen/path-objects/2d.path.fill.winding.evenodd.2.html
vendored
Normal file
|
@ -0,0 +1,39 @@
|
|||
<!DOCTYPE html>
|
||||
<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
|
||||
<meta charset="UTF-8">
|
||||
<title>OffscreenCanvas test: 2d.path.fill.winding.evenodd.2</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/html/canvas/resources/canvas-tests.js"></script>
|
||||
|
||||
<h1>2d.path.fill.winding.evenodd.2</h1>
|
||||
<p class="desc">evenodd winding number rule works in fill</p>
|
||||
|
||||
|
||||
<script>
|
||||
var t = async_test("evenodd winding number rule works in fill");
|
||||
var t_pass = t.done.bind(t);
|
||||
var t_fail = t.step_func(function(reason) {
|
||||
throw reason;
|
||||
});
|
||||
t.step(function() {
|
||||
|
||||
var canvas = new OffscreenCanvas(100, 50);
|
||||
var ctx = canvas.getContext('2d');
|
||||
|
||||
ctx.fillStyle = '#0f0';
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
|
||||
let path = new Path2D();
|
||||
path.rect(0, 0, 100, 50);
|
||||
path.rect(0, 0, 100, 50);
|
||||
path.closePath();
|
||||
|
||||
ctx.fillStyle = "#f00";
|
||||
ctx.fill(path, "evenodd");
|
||||
|
||||
_assertPixel(canvas, 50,25, 0,255,0,255);
|
||||
t.done();
|
||||
|
||||
});
|
||||
</script>
|
33
tests/wpt/tests/html/canvas/offscreen/path-objects/2d.path.fill.winding.evenodd.2.worker.js
vendored
Normal file
33
tests/wpt/tests/html/canvas/offscreen/path-objects/2d.path.fill.winding.evenodd.2.worker.js
vendored
Normal file
|
@ -0,0 +1,33 @@
|
|||
// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py.
|
||||
// OffscreenCanvas test in a worker:2d.path.fill.winding.evenodd.2
|
||||
// Description:evenodd winding number rule works in fill
|
||||
// Note:
|
||||
|
||||
importScripts("/resources/testharness.js");
|
||||
importScripts("/html/canvas/resources/canvas-tests.js");
|
||||
|
||||
var t = async_test("evenodd winding number rule works in fill");
|
||||
var t_pass = t.done.bind(t);
|
||||
var t_fail = t.step_func(function(reason) {
|
||||
throw reason;
|
||||
});
|
||||
t.step(function() {
|
||||
|
||||
var canvas = new OffscreenCanvas(100, 50);
|
||||
var ctx = canvas.getContext('2d');
|
||||
|
||||
ctx.fillStyle = '#0f0';
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
|
||||
let path = new Path2D();
|
||||
path.rect(0, 0, 100, 50);
|
||||
path.rect(0, 0, 100, 50);
|
||||
path.closePath();
|
||||
|
||||
ctx.fillStyle = "#f00";
|
||||
ctx.fill(path, "evenodd");
|
||||
|
||||
_assertPixel(canvas, 50,25, 0,255,0,255);
|
||||
t.done();
|
||||
});
|
||||
done();
|
|
@ -2479,6 +2479,37 @@
|
|||
cr.rectangle(0, 0, 100, 50)
|
||||
cr.fill()
|
||||
|
||||
- name: 2d.path.fill.winding.evenodd.1
|
||||
desc: evenodd winding number rule works in fill
|
||||
code: |
|
||||
ctx.fillStyle = '#0f0';
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
|
||||
ctx.beginPath();
|
||||
ctx.rect(0, 0, 100, 50);
|
||||
ctx.rect(0, 0, 100, 50);
|
||||
|
||||
ctx.fillStyle = "#f00";
|
||||
ctx.fill("evenodd");
|
||||
|
||||
@assert pixel 50,25 == 0,255,0,255;
|
||||
|
||||
- name: 2d.path.fill.winding.evenodd.2
|
||||
desc: evenodd winding number rule works in fill
|
||||
code: |
|
||||
ctx.fillStyle = '#0f0';
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
|
||||
let path = new Path2D();
|
||||
path.rect(0, 0, 100, 50);
|
||||
path.rect(0, 0, 100, 50);
|
||||
path.closePath();
|
||||
|
||||
ctx.fillStyle = "#f00";
|
||||
ctx.fill(path, "evenodd");
|
||||
|
||||
@assert pixel 50,25 == 0,255,0,255;
|
||||
|
||||
- name: 2d.path.fill.winding.add
|
||||
code: |
|
||||
ctx.fillStyle = '#f00';
|
||||
|
@ -3046,6 +3077,39 @@
|
|||
@assert pixel 50,25 == 0,255,0,255;
|
||||
expected: green
|
||||
|
||||
- name: 2d.path.clip.winding.evenodd.1
|
||||
desc: evenodd winding number rule works in clip
|
||||
code: |
|
||||
ctx.fillStyle = '#0f0';
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
|
||||
ctx.beginPath();
|
||||
ctx.rect(0, 0, 100, 50);
|
||||
ctx.rect(0, 0, 100, 50);
|
||||
|
||||
ctx.fillStyle = "#f00";
|
||||
ctx.clip("evenodd");
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
|
||||
@assert pixel 50,25 == 0,255,0,255;
|
||||
|
||||
- name: 2d.path.clip.winding.evenodd.2
|
||||
desc: evenodd winding number rule works in clip
|
||||
code: |
|
||||
ctx.fillStyle = '#0f0';
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
|
||||
let path = new Path2D();
|
||||
path.rect(0, 0, 100, 50);
|
||||
path.rect(0, 0, 100, 50);
|
||||
path.closePath();
|
||||
|
||||
ctx.fillStyle = "#f00";
|
||||
ctx.clip(path, "evenodd");
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
|
||||
@assert pixel 50,25 == 0,255,0,255;
|
||||
|
||||
- name: 2d.path.clip.winding.1
|
||||
code: |
|
||||
ctx.fillStyle = '#0f0';
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue