Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(497)

Unified Diff: content/test/data/gpu/pixel_acceleratedOffscreen2d_commit_worker.html

Issue 2359723003: Implement OffscreenCanvas Accelerated 2D commit() (Closed)
Patch Set: Fix rebase error Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/test/data/gpu/pixel_acceleratedOffscreen2d_commit_worker.html
diff --git a/content/test/data/gpu/pixel_offscreenCanvas_webgl_commit_worker.html b/content/test/data/gpu/pixel_acceleratedOffscreen2d_commit_worker.html
similarity index 65%
copy from content/test/data/gpu/pixel_offscreenCanvas_webgl_commit_worker.html
copy to content/test/data/gpu/pixel_acceleratedOffscreen2d_commit_worker.html
index 2af3576125e3730a6d81b72c04324963504518f1..410a78accf686fa6e94c110bbecca65da4899a2f 100644
--- a/content/test/data/gpu/pixel_offscreenCanvas_webgl_commit_worker.html
+++ b/content/test/data/gpu/pixel_acceleratedOffscreen2d_commit_worker.html
@@ -8,7 +8,7 @@ that the baseline images are regenerated on the next run.
<html>
<head>
-<title>OffscreenCanvas commit flow on worker thread: red square on white background.</title>
+<title>OffscreenCanvas 2d commit flow on worker thread: blue square on white background.</title>
<style type="text/css">
.nomargin {
margin: 0px auto;
@@ -16,38 +16,23 @@ that the baseline images are regenerated on the next run.
</style>
<script id="myWorker" type="text/worker">
self.onmessage = function(e) {
- var transferredOffscreenCanvas = e.data;
- var gl = transferredOffscreenCanvas.getContext("webgl");
- gl.clearColor(1.0, 0.0, 0.0, 1.0);
- gl.clear(gl.COLOR_BUFFER_BIT);
- gl.commit();
- self.postMessage("");
+ var transferredCanvas = e.data;
+ var offscreen2d = transferredCanvas.getContext("2d");
+ offscreen2d.fillStyle = "blue";
+ offscreen2d.fillRect(0, 0, transferredCanvas.width, transferredCanvas.height);
+ offscreen2d.commit();
+ self.postMessage("");
};
</script>
<script>
var g_swapsBeforeAck = 15;
-function makeWorker(script) {
+function makeWorker(script)
+{
var blob = new Blob([script]);
return new Worker(URL.createObjectURL(blob));
}
-function main()
-{
- draw();
-}
-
-function draw()
-{
- var canvas = document.getElementById("c");
- var offscreenCanvas = canvas.transferControlToOffscreen();
- var worker = makeWorker(document.getElementById("myWorker").textContent);
- worker.postMessage(offscreenCanvas, [offscreenCanvas]);
- worker.onmessage = function (e) {
- waitForFinish();
- }
-}
-
function waitForFinish()
{
if (g_swapsBeforeAck == 0) {
@@ -59,13 +44,24 @@ function waitForFinish()
window.webkitRequestAnimationFrame(waitForFinish);
}
}
+
+function main()
+{
+ var canvas2D = document.getElementById("c");
+ var offscreenCanvas = canvas2D.transferControlToOffscreen();
+ var worker = makeWorker(document.getElementById("myWorker").textContent);
+ worker.postMessage(offscreenCanvas, [offscreenCanvas]);
+ worker.onmessage = function (e) {
+ waitForFinish();
+ };
+}
</script>
</head>
<body onload="main()">
-<div style="position:relative; width:200px; height:200px; background-color:white">
+<div style="position:relative; width:350px; height:350px; background-color:white">
</div>
<div id="container" style="position:absolute; top:0px; left:0px">
-<canvas id="c" width="200" height="200" class="nomargin"></canvas>
+<canvas id="c" width="320" height="320" class="nomargin"></canvas>
</div>
</body>
</html>
« no previous file with comments | « content/test/data/gpu/pixel_acceleratedOffscreen2d_commit_main.html ('k') | content/test/gpu/gpu_tests/pixel_expectations.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698