@@ -109,26 +109,6 @@ vips_foreign_load_svg_dispose( GObject *gobject )
109
109
dispose ( gobject );
110
110
}
111
111
112
- static int
113
- vips_foreign_load_svg_build ( VipsObject * object )
114
- {
115
- VipsForeignLoadSvg * svg = (VipsForeignLoadSvg * ) object ;
116
-
117
- if ( !vips_object_argument_isset ( object , "scale" ) )
118
- svg -> scale = svg -> dpi / 72.0 ;
119
-
120
- /* librsvg defaults to 90 DPI, but vips defaults to 72. We need to
121
- * adjust the scale down.
122
- */
123
- svg -> scale *= 72.0 / 90.0 ;
124
-
125
- if ( VIPS_OBJECT_CLASS ( vips_foreign_load_svg_parent_class )->
126
- build ( object ) )
127
- return ( -1 );
128
-
129
- return ( 0 );
130
- }
131
-
132
112
static VipsForeignFlags
133
113
vips_foreign_load_svg_get_flags_filename ( const char * filename )
134
114
{
@@ -150,14 +130,15 @@ vips_foreign_load_svg_parse( VipsForeignLoadSvg *svg,
150
130
RsvgDimensionData dimensions ;
151
131
double res ;
152
132
133
+ rsvg_handle_set_dpi ( svg -> page , svg -> dpi * svg -> scale );
153
134
rsvg_handle_get_dimensions ( svg -> page , & dimensions );
154
135
155
136
/* We need pixels/mm for vips.
156
137
*/
157
138
res = svg -> dpi / 25.4 ;
158
139
159
140
vips_image_init_fields ( out ,
160
- dimensions .width * svg -> scale , dimensions .height * svg -> scale ,
141
+ dimensions .width , dimensions .height ,
161
142
4 , VIPS_FORMAT_UCHAR ,
162
143
VIPS_CODING_NONE , VIPS_INTERPRETATION_sRGB , res , res );
163
144
@@ -201,9 +182,7 @@ vips_foreign_load_svg_generate( VipsRegion *or,
201
182
cr = cairo_create ( surface );
202
183
cairo_surface_destroy ( surface );
203
184
204
- cairo_scale ( cr , svg -> scale , svg -> scale );
205
- cairo_translate ( cr ,
206
- - r -> left / svg -> scale , - r -> top / svg -> scale );
185
+ cairo_translate ( cr , - r -> left , - r -> top );
207
186
208
187
/* rsvg is single-threaded, but we don't need to lock since we're
209
188
* running inside a non-threaded tilecache.
@@ -279,7 +258,6 @@ vips_foreign_load_svg_class_init( VipsForeignLoadSvgClass *class )
279
258
280
259
object_class -> nickname = "svgload" ;
281
260
object_class -> description = _ ( "load SVG with rsvg" );
282
- object_class -> build = vips_foreign_load_svg_build ;
283
261
284
262
load_class -> get_flags_filename =
285
263
vips_foreign_load_svg_get_flags_filename ;
@@ -564,8 +542,8 @@ vips_foreign_load_svg_buffer_init( VipsForeignLoadSvgBuffer *buffer )
564
542
* Render a SVG file into a VIPS image. Rendering uses the librsvg library
565
543
* and should be fast.
566
544
*
567
- * Use @dpi to set the rendering resolution. The default is 72. Alternatively,
568
- * you can scale the rendering from the default 1 point == 1 pixel by @scale.
545
+ * Use @dpi to set the rendering resolution. The default is 72. You can also
546
+ * scale the rendering by @scale.
569
547
*
570
548
* This function only reads the image header and does not render any pixel
571
549
* data. Rendering occurs when pixels are accessed.
0 commit comments