Closed Bug 293239 Opened 15 years ago Closed 15 years ago
Canvas misdraws content using style
Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.8b2) Gecko/20050506 Firefox/1.0+ 1.open testcase 2.squares should have been drawn, i/o of rectangles <canvas id="canvas" style="width:300px;height:300px;border:#000000 1px solid;"> <canvas id="canvas" style="width:300;height:300;border:#000000 1px solid;"> both draw the right outline, but wrong contentsize (double height) <canvas id="canvas" width="300" height="300" style="border:#000000 1px solid;"> draws the right outline and right content testcase coming
Summary: Canvas misdraws content using style.height → Canvas misdraws content using style.height
Works for me, but the behaviour of this recently changed -- what your testcase will now show is a 300x150 canvas (the default size when no width/height attributes are specified) scaled up to 300x300 for display (specified in the CSS).
I have the feeling this bug was filed before the initial checkin of bug 291216 which fixed some things with regard to this. I do see rectangles in the testcase, but I'm not sure if that is bug. Could you make a more clear testcase if you still think this is a bug?
in both canvas elements the initial height and width are set at 300px by 300px they are drawn quite different though
And that is correct. As 'height' in CSS != 'height' in HTML. In a fresh build the 'height' of the rectangles in the canvas at the top should be twice the height of rectangles in the canvas at the bottom.
Status: NEW → RESOLVED
Closed: 15 years ago
Resolution: --- → WORKSFORME
You can do that already, just use: canvas.height = 300; canvas.width = 300; ...instead.
(In reply to comment #8) > You can do that already, just use: > > canvas.height = 300; > canvas.width = 300; > > ...instead. thanks a lot. (In reply to comment #8) > You can do that already, just use: > > canvas.height = 300; > canvas.width = 300; > > ...instead. yep, except that it scales the image
You need to log in before you can comment on or make changes to this bug.