Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
mat2
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Monitor
Service Desk
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
jvoisin
mat2
Commits
12582ba2
Commit
12582ba2
authored
3 years ago
by
Julien (jvoisin) Voisin
Browse files
Options
Downloads
Patches
Plain Diff
Try to use modern rsvg functions when we can
parent
35092562
No related branches found
No related tags found
1 merge request
!97
Try to use modern rsvg functions when we can
Pipeline
#83335
failed
3 years ago
Stage: linting
Stage: test
Changes
1
Pipelines
4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
libmat2/images.py
+16
-5
16 additions, 5 deletions
libmat2/images.py
with
16 additions
and
5 deletions
libmat2/images.py
+
16
−
5
View file @
12582ba2
...
...
@@ -30,12 +30,23 @@ class SVGParser(exiftool.ExiftoolParser):
svg
=
Rsvg
.
Handle
.
new_from_file
(
self
.
filename
)
except
GLib
.
GError
:
raise
ValueError
dimensions
=
svg
.
get_dimensions
()
surface
=
cairo
.
SVGSurface
(
self
.
output_filename
,
dimensions
.
height
,
dimensions
.
width
)
try
:
_
,
_
,
_
,
_
,
has_viewbox
,
viewbox
=
svg
.
get_intrinsic_dimensions
()
if
has_viewbox
is
False
:
raise
ValueError
_
,
width
,
height
=
svg
.
get_intrinsic_size_in_pixels
()
except
AttributeError
:
dimensions
=
svg
.
get_dimensions
()
height
,
width
=
dimensions
.
height
,
dimensions
.
width
surface
=
cairo
.
SVGSurface
(
self
.
output_filename
,
height
,
width
)
context
=
cairo
.
Context
(
surface
)
svg
.
render_cairo
(
context
)
try
:
svg
.
render_document
(
context
,
viewbox
)
except
AttributeError
:
svg
.
render_cairo
(
context
)
surface
.
finish
()
return
True
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment