Skip to content

Commit

Permalink
fix: Apply defaults for cx, cy, rx, ry in EllipseRenderer (#210)
Browse files Browse the repository at this point in the history
Fixed default ellipse properties according to SVG specification https://www.w3.org/TR/SVG2/geometry.html
  • Loading branch information
kuzmaka authored Nov 17, 2023
1 parent d586efb commit bf0a110
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/Rasterization/Renderers/EllipseRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ class EllipseRenderer extends MultiPassRenderer
*/
protected function prepareRenderParams(array $options, Transform $transform, ?FontRegistry $fontRegistry): ?array
{
$cx = $options['cx'];
$cy = $options['cy'];
$cx = $options['cx'] ?? 0;
$cy = $options['cy'] ?? 0;
$transform->map($cx, $cy);

$width = $options['rx'] * 2;
$height = $options['ry'] * 2;
$width = ($options['rx'] ?? $options['ry'] ?? 0) * 2;
$height = ($options['ry'] ?? $options['rx'] ?? 0) * 2;
$transform->resize($width, $height);

return [
Expand Down

0 comments on commit bf0a110

Please sign in to comment.