Skip to content

Commit 2a7f6d6

Browse files
committed
Merge pull request mozilla#3082 from brendandahl/min-canvas-width
Use at least 1x1 pixel canvas for groups.
2 parents ff616c8 + ecb04c8 commit 2a7f6d6

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/canvas.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1422,9 +1422,10 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {
14221422
group.bbox,
14231423
currentCtx.mozCurrentTransform);
14241424
// Use ceil in case we're between sizes so we don't create canvas that is
1425-
// too small.
1426-
var drawnWidth = Math.ceil(bounds[2] - bounds[0]);
1427-
var drawnHeight = Math.ceil(bounds[3] - bounds[1]);
1425+
// too small and make the canvas at least 1x1 pixels.
1426+
var drawnWidth = Math.max(Math.ceil(bounds[2] - bounds[0]), 1);
1427+
var drawnHeight = Math.max(Math.ceil(bounds[3] - bounds[1]), 1);
1428+
14281429
var scratchCanvas = createScratchCanvas(drawnWidth, drawnHeight);
14291430
var groupCtx = scratchCanvas.getContext('2d');
14301431
addContextCurrentTransform(groupCtx);

0 commit comments

Comments
 (0)