@@ -63,24 +63,22 @@ public ImageData rasterizeSVG(byte[] bytes, float scalingFactor) throws IOExcept
63
63
svgLoader = new SVGLoader ();
64
64
}
65
65
SVGDocument svgDocument = null ;
66
- if (isSVGFile (bytes )) {
67
- try (InputStream stream = new ByteArrayInputStream (bytes )) {
68
- svgDocument = svgLoader .load (stream , null , LoaderContext .createDefault ());
69
- }
70
- if (svgDocument != null ) {
71
- FloatSize size = svgDocument .size ();
72
- double originalWidth = size .getWidth ();
73
- double originalHeight = size .getHeight ();
74
- int scaledWidth = (int ) Math .round (originalWidth * scalingFactor );
75
- int scaledHeight = (int ) Math .round (originalHeight * scalingFactor );
76
- BufferedImage image = new BufferedImage (scaledWidth , scaledHeight , BufferedImage .TYPE_INT_ARGB );
77
- Graphics2D g = image .createGraphics ();
78
- g .setRenderingHints (RENDERING_HINTS );
79
- g .scale (scalingFactor , scalingFactor );
80
- svgDocument .render (null , g );
81
- g .dispose ();
82
- return convertToSWT (image );
83
- }
66
+ try (InputStream stream = new ByteArrayInputStream (bytes )) {
67
+ svgDocument = svgLoader .load (stream , null , LoaderContext .createDefault ());
68
+ }
69
+ if (svgDocument != null ) {
70
+ FloatSize size = svgDocument .size ();
71
+ double originalWidth = size .getWidth ();
72
+ double originalHeight = size .getHeight ();
73
+ int scaledWidth = (int ) Math .round (originalWidth * scalingFactor );
74
+ int scaledHeight = (int ) Math .round (originalHeight * scalingFactor );
75
+ BufferedImage image = new BufferedImage (scaledWidth , scaledHeight , BufferedImage .TYPE_INT_ARGB );
76
+ Graphics2D g = image .createGraphics ();
77
+ g .setRenderingHints (RENDERING_HINTS );
78
+ g .scale (scalingFactor , scalingFactor );
79
+ svgDocument .render (null , g );
80
+ g .dispose ();
81
+ return convertToSWT (image );
84
82
}
85
83
return null ;
86
84
}
0 commit comments