mirror of
https://github.com/Kozea/WeasyPrint.git
synced 2024-09-11 20:47:56 +03:00
Clean code for SVG patterns
This commit is contained in:
parent
7d45356603
commit
981ed5843c
@ -422,18 +422,10 @@ def draw_pattern(svg, node, pattern, font_size, opacity, stroke):
|
||||
x, y = bounding_box[0], bounding_box[1]
|
||||
matrix = Matrix(e=x, f=y)
|
||||
if pattern.get('patternUnits') == 'userSpaceOnUse':
|
||||
width, height = svg.inner_width, svg.inner_height
|
||||
else:
|
||||
width, height = bounding_box[2], bounding_box[3]
|
||||
|
||||
if pattern.get('patternUnits') == 'userSpaceOnUse':
|
||||
x = size(pattern.get('x'), font_size, 1)
|
||||
y = size(pattern.get('y'), font_size, 1)
|
||||
pattern_width = size(pattern.get('width', 0), font_size, 1)
|
||||
pattern_height = size(pattern.get('height', 0), font_size, 1)
|
||||
else:
|
||||
x = size(pattern.get('x'), font_size, 1) * width
|
||||
y = size(pattern.get('y'), font_size, 1) * height
|
||||
width, height = bounding_box[2], bounding_box[3]
|
||||
pattern_width = (
|
||||
size(pattern.attrib.pop('width', '1'), font_size, 1) * width)
|
||||
pattern_height = (
|
||||
|
Loading…
Reference in New Issue
Block a user