Set a view box for SVG if absent
This commit is contained in:
parent
10fa0047fd
commit
a2095c6fda
1 changed files with 4 additions and 2 deletions
|
@ -2314,8 +2314,6 @@ public class FileBackend {
|
|||
try {
|
||||
SVG svg = SVG.getFromInputStream(mXmppConnectionService.getContentResolver().openInputStream(uri));
|
||||
svg.setDocumentPreserveAspectRatio(com.caverock.androidsvg.PreserveAspectRatio.FULLSCREEN);
|
||||
svg.setDocumentWidth("100%");
|
||||
svg.setDocumentHeight("100%");
|
||||
|
||||
float w = svg.getDocumentWidth();
|
||||
float h = svg.getDocumentHeight();
|
||||
|
@ -2325,6 +2323,9 @@ public class FileBackend {
|
|||
float left = (size - outWidth) / 2;
|
||||
float top = (size - outHeight) / 2;
|
||||
RectF target = new RectF(left, top, left + outWidth, top + outHeight);
|
||||
if (svg.getDocumentViewBox() == null) svg.setDocumentViewBox(0, 0, w, h);
|
||||
svg.setDocumentWidth("100%");
|
||||
svg.setDocumentHeight("100%");
|
||||
|
||||
Bitmap output = Bitmap.createBitmap(size, size, Bitmap.Config.ARGB_8888);
|
||||
Canvas canvas = new Canvas(output);
|
||||
|
@ -2353,6 +2354,7 @@ public class FileBackend {
|
|||
float w = svg.getDocumentWidth();
|
||||
float h = svg.getDocumentHeight();
|
||||
Rect r = rectForSize(w < 1 ? size : (int) w, h < 1 ? size : (int) h, size);
|
||||
if (svg.getDocumentViewBox() == null) svg.setDocumentViewBox(0, 0, w, h);
|
||||
svg.setDocumentWidth("100%");
|
||||
svg.setDocumentHeight("100%");
|
||||
|
||||
|
|
Loading…
Reference in a new issue