Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
michael@0 | 1 | <!-- Any copyright is dedicated to the Public Domain. |
michael@0 | 2 | http://creativecommons.org/publicdomain/zero/1.0/ --> |
michael@0 | 3 | <!doctype html> |
michael@0 | 4 | |
michael@0 | 5 | <html> |
michael@0 | 6 | <head> |
michael@0 | 7 | <meta charset="utf-8"/> |
michael@0 | 8 | <title>Canvas inspector test page</title> |
michael@0 | 9 | </head> |
michael@0 | 10 | |
michael@0 | 11 | <body> |
michael@0 | 12 | <canvas width="128" height="128"></canvas> |
michael@0 | 13 | |
michael@0 | 14 | <script type="text/javascript;version=1.8"> |
michael@0 | 15 | "use strict"; |
michael@0 | 16 | |
michael@0 | 17 | var ctx = document.querySelector("canvas").getContext("2d"); |
michael@0 | 18 | |
michael@0 | 19 | function drawRect(fill, size) { |
michael@0 | 20 | function A() { |
michael@0 | 21 | function B() { |
michael@0 | 22 | function C() { |
michael@0 | 23 | ctx.fillStyle = fill; |
michael@0 | 24 | ctx.fillRect(size[0], size[1], size[2], size[3]); |
michael@0 | 25 | } |
michael@0 | 26 | C(); |
michael@0 | 27 | } |
michael@0 | 28 | B(); |
michael@0 | 29 | } |
michael@0 | 30 | A(); |
michael@0 | 31 | } |
michael@0 | 32 | |
michael@0 | 33 | function drawScene() { |
michael@0 | 34 | ctx.clearRect(0, 0, 128, 128); |
michael@0 | 35 | drawRect("rgb(192, 192, 192)", [0, 0, 128, 128]); |
michael@0 | 36 | drawRect("rgba(0, 0, 192, 0.5)", [30, 30, 55, 50]); |
michael@0 | 37 | drawRect("rgba(192, 0, 0, 0.5)", [10, 10, 55, 50]); |
michael@0 | 38 | |
michael@0 | 39 | window.requestAnimationFrame(drawScene); |
michael@0 | 40 | } |
michael@0 | 41 | |
michael@0 | 42 | drawScene(); |
michael@0 | 43 | </script> |
michael@0 | 44 | </body> |
michael@0 | 45 | |
michael@0 | 46 | </html> |