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

Side by Side Diff: third_party/WebKit/LayoutTests/svg/canvas/canvas-default-object-sizing-expected.html

Issue 2203093003: Fix SVGImage::imageForCurrentFrameForContainer() sizing (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: updated canvas-default-object-sizing ref Created 4 years, 4 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
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <title>Sizing SVG image when drawn to canvas</title> 2 <title>Sizing SVG image when drawn to canvas</title>
3 <script> 3 <script>
4 function createCircle(x, y, r, sx, sy) 4 function createCanvas(drawFunc)
5 { 5 {
6 var canvas = document.createElement('canvas'); 6 var canvas = document.createElement('canvas');
7 canvas.width = 100; 7 canvas.width = 100;
8 canvas.height = 100; 8 canvas.height = 100;
9 document.documentElement.appendChild(canvas); 9 document.documentElement.appendChild(canvas);
10 10
11 var ctx = canvas.getContext('2d'); 11 drawFunc(canvas.getContext('2d'));
12 }
13
14 function drawCircle(ctx, x, y, r, sx, sy)
15 {
12 ctx.fillStyle = "blue"; 16 ctx.fillStyle = "blue";
13 17
14 ctx.translate(50, 50);
15 ctx.scale(sx || 1, sy || 1); 18 ctx.scale(sx || 1, sy || 1);
16 ctx.beginPath(); 19 ctx.beginPath();
17 ctx.arc(x, y, r, 0, 2*Math.PI); 20 ctx.arc(x, y, r, 0, 2*Math.PI);
18 ctx.fill(); 21 ctx.fill();
19 } 22 }
20 createCircle(0, 0, 50); 23
21 createCircle(0, -25, 25); 24 createCanvas(function (ctx) { drawCircle(ctx, 50, 50, 50); });
22 createCircle(-25, 0, 25); 25 createCanvas(function (ctx) { drawCircle(ctx, 50, 25, 25); });
23 createCircle(0, 0, 25, 1, 2); 26 createCanvas(function (ctx) { drawCircle(ctx, 25, 50, 25); });
24 createCircle(0, 0, 25, 2, 1); 27 createCanvas(function (ctx) { drawCircle(ctx, 50, 25, 25, 1, 2); });
25 createCircle(-25, 0, 25); 28 createCanvas(function (ctx) { drawCircle(ctx, 25, 50, 25, 2, 1); });
26 createCircle(0, -25, 25); 29 createCanvas(function (ctx) { drawCircle(ctx, 25, 50, 25); });
27 createCircle(0, -25, 25); 30 createCanvas(function (ctx) { drawCircle(ctx, 50, 25, 25); });
28 createCircle(0, 0, 50); 31 createCanvas(function (ctx) { drawCircle(ctx, 50, 25, 25); });
29 createCircle(0, 0, 50); 32 createCanvas(function (ctx) { drawCircle(ctx, 50, 50, 50); });
30 createCircle(0, -25, 25); 33 createCanvas(function (ctx) { drawCircle(ctx, 50, 50, 50); });
31 createCircle(0, 0, 50); 34 createCanvas(function (ctx) { drawCircle(ctx, 50, 25, 25); drawCircle(ctx, 50, 7 5, 25); });
35 createCanvas(function (ctx) { drawCircle(ctx, 50, 50, 50); });
36
32 </script> 37 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698