Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 <!DOCTYPE html> | |
| 2 <style> | |
| 3 canvas { | |
| 4 border: black 1px solid; | |
| 5 background-color: gray; | |
| 6 width: 200px; | |
| 7 height: 200px; | |
| 8 object-fit: contain; | |
|
Justin Novosad
2015/06/09 19:24:10
Test would be more effective if the reference did
changseok
2015/06/11 05:46:47
I updated the test. Please check it again if it ma
| |
| 9 } | |
| 10 </style> | |
| 11 <p>Test passes if a green square inside a orange rectanlge is shown up without a distortion. | |
| 12 <div> | |
| 13 <canvas width="100" height="200"></canvas> | |
| 14 </div> | |
| 15 <script> | |
| 16 function paintCanvas(canvas) | |
| 17 { | |
| 18 var ctx = canvas.getContext('2d'); | |
| 19 ctx.fillStyle = 'orange'; | |
| 20 ctx.fillRect(0, 0, canvas.width, canvas.height); | |
| 21 | |
| 22 ctx.beginPath(); | |
|
Justin Novosad
2015/06/09 19:20:43
Not necessary
changseok
2015/06/11 05:46:46
Done.
| |
| 23 ctx.fillStyle = 'green'; | |
| 24 var squarWidth = canvas.width / 2; | |
| 25 var squarHalfWidth = squarWidth / 2; | |
| 26 ctx.fillRect(canvas.width / 2 - squarHalfWidth, canvas.height / 2 - squarHalfW idth , squarWidth, squarWidth); | |
| 27 ctx.fill(); | |
|
Justin Novosad
2015/06/09 19:20:43
not necessary
changseok
2015/06/11 05:46:47
Done.
| |
| 28 } | |
| 29 | |
| 30 paintCanvas(document.querySelector('canvas')); | |
| 31 </script> | |
| OLD | NEW |