diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/image.c | 33 |
1 files changed, 12 insertions, 21 deletions
diff --git a/src/image.c b/src/image.c index 3858f3c41f3..fdb7ef874d7 100644 --- a/src/image.c +++ b/src/image.c | |||
| @@ -9903,30 +9903,21 @@ svg_load_image (struct frame *f, struct image *img, char *contents, | |||
| 9903 | viewbox_width = viewbox.x + viewbox.width; | 9903 | viewbox_width = viewbox.x + viewbox.width; |
| 9904 | viewbox_height = viewbox.y + viewbox.height; | 9904 | viewbox_height = viewbox.y + viewbox.height; |
| 9905 | } | 9905 | } |
| 9906 | #else | ||
| 9907 | /* The function used above to get the geometry of the visible area | ||
| 9908 | of the SVG are only available in librsvg 2.46 and above, so in | ||
| 9909 | certain circumstances this code path can result in some parts of | ||
| 9910 | the SVG being cropped. */ | ||
| 9911 | RsvgDimensionData dimension_data; | ||
| 9912 | |||
| 9913 | rsvg_handle_get_dimensions (rsvg_handle, &dimension_data); | ||
| 9914 | 9906 | ||
| 9915 | viewbox_width = dimension_data.width; | 9907 | if (viewbox_width == 0 || viewbox_height == 0) |
| 9916 | viewbox_height = dimension_data.height; | ||
| 9917 | #endif | 9908 | #endif |
| 9909 | { | ||
| 9910 | /* The functions used above to get the geometry of the visible | ||
| 9911 | area of the SVG are only available in librsvg 2.46 and above, | ||
| 9912 | so in certain circumstances this code path can result in some | ||
| 9913 | parts of the SVG being cropped. */ | ||
| 9914 | RsvgDimensionData dimension_data; | ||
| 9918 | 9915 | ||
| 9919 | if (viewbox_width == 0 || viewbox_height == 0) | 9916 | rsvg_handle_get_dimensions (rsvg_handle, &dimension_data); |
| 9920 | { | 9917 | |
| 9921 | /* We do not have any usable dimensions, so make some up. The | 9918 | viewbox_width = dimension_data.width; |
| 9922 | values below are supposedly the default values most web | 9919 | viewbox_height = dimension_data.height; |
| 9923 | browsers use for SVGs with no set size. */ | 9920 | } |
| 9924 | /* FIXME: At this stage we should perhaps consider rendering the | ||
| 9925 | image out to a bitmap and getting the dimensions from | ||
| 9926 | that. */ | ||
| 9927 | viewbox_width = 300; | ||
| 9928 | viewbox_height = 150; | ||
| 9929 | } | ||
| 9930 | 9921 | ||
| 9931 | compute_image_size (viewbox_width, viewbox_height, img->spec, | 9922 | compute_image_size (viewbox_width, viewbox_height, img->spec, |
| 9932 | &width, &height); | 9923 | &width, &height); |