Ignore:
Timestamp:
2016-08-12T03:16:58+02:00 (10 years ago)
Author:
Don-vip
Message:

fix #13291 - upgrade to svgSalamander v1.1.0 (patched)

now detects two invalid SVG files: presets/sport/volleyball.svg and presets/shop/diy_store.svg

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/com/kitfox/svg/SVGRoot.java

    r8084 r10787  
    263263        prepareViewport();
    264264
     265        Rectangle targetViewport = g.getClipBounds();
     266
     267        Rectangle deviceViewport = diagram.getDeviceViewport();
     268        if (width != null && height != null)
     269        {
     270            float xx, yy, ww, hh;
     271           
     272            xx = (x == null) ? 0 : StyleAttribute.convertUnitsToPixels(x.getUnits(), x.getValue());
     273            if (width.getUnits() == NumberWithUnits.UT_PERCENT)
     274            {
     275                ww = width.getValue() * deviceViewport.width;
     276            }
     277            else
     278            {
     279                ww = StyleAttribute.convertUnitsToPixels(width.getUnits(), width.getValue());
     280            }
     281           
     282            yy = (y == null) ? 0 : StyleAttribute.convertUnitsToPixels(y.getUnits(), y.getValue());
     283            if (height.getUnits() == NumberWithUnits.UT_PERCENT)
     284            {
     285                hh = height.getValue() * deviceViewport.height;
     286            }
     287            else
     288            {
     289                hh = StyleAttribute.convertUnitsToPixels(height.getUnits(), height.getValue());
     290            }
     291           
     292            targetViewport = new Rectangle((int)xx, (int)yy, (int)ww, (int)hh);
     293        }
     294        else
     295        {
     296            targetViewport = new Rectangle(deviceViewport);
     297        }
     298        clipRect.setRect(targetViewport);
     299
    265300        if (viewBox == null)
    266301        {
     
    269304        else
    270305        {
    271             Rectangle deviceViewport = g.getClipBounds();
    272             //If viewport window is set, we are drawing to entire viewport
    273             clipRect.setRect(deviceViewport);
    274            
    275306            viewXform.setToIdentity();
    276             viewXform.setToTranslation(deviceViewport.x, deviceViewport.y);
    277             viewXform.scale(deviceViewport.width, deviceViewport.height);
     307            viewXform.setToTranslation(targetViewport.x, targetViewport.y);
     308            viewXform.scale(targetViewport.width, targetViewport.height);
    278309            viewXform.scale(1 / viewBox.width, 1 / viewBox.height);
    279310            viewXform.translate(-viewBox.x, -viewBox.y);
Note: See TracChangeset for help on using the changeset viewer.