Use at least 1x1 pixel canvas for groups.

This commit is contained in:
Brendan Dahl 2013-04-11 11:19:42 -07:00
parent 985307907b
commit ecb04c8bbe

View File

@ -1422,9 +1422,10 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {
group.bbox, group.bbox,
currentCtx.mozCurrentTransform); currentCtx.mozCurrentTransform);
// Use ceil in case we're between sizes so we don't create canvas that is // Use ceil in case we're between sizes so we don't create canvas that is
// too small. // too small and make the canvas at least 1x1 pixels.
var drawnWidth = Math.ceil(bounds[2] - bounds[0]); var drawnWidth = Math.max(Math.ceil(bounds[2] - bounds[0]), 1);
var drawnHeight = Math.ceil(bounds[3] - bounds[1]); var drawnHeight = Math.max(Math.ceil(bounds[3] - bounds[1]), 1);
var scratchCanvas = createScratchCanvas(drawnWidth, drawnHeight); var scratchCanvas = createScratchCanvas(drawnWidth, drawnHeight);
var groupCtx = scratchCanvas.getContext('2d'); var groupCtx = scratchCanvas.getContext('2d');
addContextCurrentTransform(groupCtx); addContextCurrentTransform(groupCtx);