Fixed SVG viewbox

pull/199/head
M66B 4 years ago
parent 5ed136917d
commit 73ea92e4a5

@ -57,6 +57,7 @@ import androidx.core.graphics.ColorUtils;
import androidx.exifinterface.media.ExifInterface; import androidx.exifinterface.media.ExifInterface;
import androidx.preference.PreferenceManager; import androidx.preference.PreferenceManager;
import com.caverock.androidsvg.RenderOptions;
import com.caverock.androidsvg.SVG; import com.caverock.androidsvg.SVG;
import java.io.BufferedInputStream; import java.io.BufferedInputStream;
@ -251,13 +252,11 @@ class ImageHelper {
float w = svg.getDocumentWidth(); float w = svg.getDocumentWidth();
float h = svg.getDocumentHeight(); float h = svg.getDocumentHeight();
if (w < 0 || h < 0) { if (w < 0 || h < 0) {
w = 1; w = scaleToPixels;
h = 1; h = scaleToPixels;
} }
Bitmap bm = Bitmap.createBitmap(
scaleToPixels, Bitmap bm = Bitmap.createBitmap((int) w, (int) h, Bitmap.Config.ARGB_8888);
Math.round(scaleToPixels * h / w),
Bitmap.Config.ARGB_8888);
bm.eraseColor(fillColor); bm.eraseColor(fillColor);
Canvas canvas = new Canvas(bm); Canvas canvas = new Canvas(bm);
svg.renderToCanvas(canvas); svg.renderToCanvas(canvas);

Loading…
Cancel
Save