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

Side by Side Diff: third_party/WebKit/PerformanceTests/Canvas/draw-hw-accelerated-canvas-2d-to-sw-canvas-2d.html

Issue 2625093003: Adding 2d canvas benchmark for GPU to non-GPU drawImage calls. (Closed)
Patch Set: fixing comment Created 3 years, 11 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <html>
3 <body>
4 <script src="../resources/runner.js"></script>
5 <script src="resources/canvas_runner.js"></script>
6 <script>
7 var sourceCanvas2D = document.createElement("canvas");
8 var sourceCtx2D = sourceCanvas2D.getContext("2d");
9 var destCanvas2D = document.createElement("canvas");
10 var destCtx2D = destCanvas2D.getContext("2d");
11 var dummyCanvas2D = document.createElement("canvas");
12 var dummyCtx2D = dummyCanvas2D.getContext("2d");
13
14 function setSize(sourceWidth, sourceHeight, destWidth, destHeight) {
15 sourceCanvas2D.width = sourceWidth;
16 sourceCanvas2D.height = sourceHeight;
17 destCanvas2D.width = destWidth;
18 destCanvas2D.height = destHeight;
19 dummyCanvas2D.width = destWidth;
20 dummyCanvas2D.height = destHeight;
21 }
22
23 function rand(range) {
24 return Math.floor(Math.random() * range);
25 }
26
27 function fillCanvas(ctx2d, canvas2d) {
28 ctx2d.fillStyle = "rgba(" + rand(255) + "," + rand(255) + "," + rand(255) + "," + rand(255) + ")";
29 ctx2d.fillRect(0, 0, canvas2d.width, canvas2d.height);
30 }
31
32 function doRun() {
33 // draw static Canvas
34 destCtx2D.drawImage(sourceCanvas2D, 0, 0);
35 }
36
37 function ensureComplete() {
38 // Using destCanvas2D as a source image is just to flush out the content whe n
39 // accelerated 2D canvas is in use.
40 dummyCtx2D.drawImage(destCanvas2D, 0, 0, 1, 1, 0, 0, 1, 1);
41 }
42
43 window.onload = function () {
44 // It should use setMinimumAccelerated2dCanvasSize() to enable accelerated C anvas for a specified size
45 // but this API is not available in JS or WebPage. Assume the threshold size is 256x257
46 // and the dest canvas is not HW accelerated Canvas when setting its size to 200x200.
47 setSize(1024, 1024, 200, 200);
48 fillCanvas(sourceCtx2D, sourceCanvas2D);
49 CanvasRunner.start({
50 description: "This bench test checks the speed on drawing static 2d Canv as(1024x1024) to a canvas that is initially not accelerated (200x200).",
51 doRun: doRun,
52 ensureComplete: ensureComplete});
53 }
54
55 </script>
56 </body>
57 </html>
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698