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/RadialGradient.java

    r8084 r10787  
    44 * All rights reserved.
    55 *
    6  * Redistribution and use in source and binary forms, with or 
     6 * Redistribution and use in source and binary forms, with or
    77 * without modification, are permitted provided that the following
    88 * conditions are met:
    99 *
    10  *   - Redistributions of source code must retain the above 
     10 *   - Redistributions of source code must retain the above
    1111 *     copyright notice, this list of conditions and the following
    1212 *     disclaimer.
    1313 *   - Redistributions in binary form must reproduce the above
    1414 *     copyright notice, this list of conditions and the following
    15  *     disclaimer in the documentation and/or other materials 
     15 *     disclaimer in the documentation and/or other materials
    1616 *     provided with the distribution.
    1717 *
     
    2727 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
    2828 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
    29  * OF THE POSSIBILITY OF SUCH DAMAGE. 
    30  * 
     29 * OF THE POSSIBILITY OF SUCH DAMAGE.
     30 *
    3131 * Mark McKay can be contacted at mark@kitfox.com.  Salamander and other
    3232 * projects can be found at http://www.kitfox.com
     
    3636package com.kitfox.svg;
    3737
    38 import com.kitfox.svg.xml.StyleAttribute;
    39 import java.awt.Color;
     38import java.awt.MultipleGradientPaint;
    4039import java.awt.Paint;
     40import java.awt.RadialGradientPaint;
    4141import java.awt.geom.AffineTransform;
    4242import java.awt.geom.Point2D;
    4343import java.awt.geom.Rectangle2D;
     44import java.util.Arrays;
     45
     46import com.kitfox.svg.xml.StyleAttribute;
    4447
    4548/**
     
    5356    float cx = 0.5f;
    5457    float cy = 0.5f;
    55     float fx = 0.5f;
    56     float fy = 0.5f;
     58    boolean hasFocus = false;
     59    float fx = 0f;
     60    float fy = 0f;
    5761    float r = 0.5f;
    5862
     
    6468    }
    6569
     70    @Override
    6671    public String getTagName()
    6772    {
     
    6974    }
    7075
     76    @Override
    7177    protected void build() throws SVGException
    7278    {
     
    8591        }
    8692
     93        hasFocus = false;
    8794        if (getPres(sty.setName("fx")))
    8895        {
    8996            fx = sty.getFloatValueWithUnits();
     97            hasFocus = true;
    9098        }
    9199
     
    93101        {
    94102            fy = sty.getFloatValueWithUnits();
     103            hasFocus = true;
    95104        }
    96105
     
    101110    }
    102111
     112    @Override
    103113    public Paint getPaint(Rectangle2D bounds, AffineTransform xform)
    104114    {
    105         com.kitfox.svg.batik.MultipleGradientPaint.CycleMethodEnum method;
     115        MultipleGradientPaint.CycleMethod method;
    106116        switch (spreadMethod)
    107117        {
    108118            default:
    109119            case SM_PAD:
    110                 method = com.kitfox.svg.batik.MultipleGradientPaint.NO_CYCLE;
     120                method = MultipleGradientPaint.CycleMethod.NO_CYCLE;
    111121                break;
    112122            case SM_REPEAT:
    113                 method = com.kitfox.svg.batik.MultipleGradientPaint.REPEAT;
     123                method = MultipleGradientPaint.CycleMethod.REPEAT;
    114124                break;
    115125            case SM_REFLECT:
    116                 method = com.kitfox.svg.batik.MultipleGradientPaint.REFLECT;
     126                method = MultipleGradientPaint.CycleMethod.REFLECT;
    117127                break;
    118128        }
     
    120130        Paint paint;
    121131        Point2D.Float pt1 = new Point2D.Float(cx, cy);
    122         Point2D.Float pt2 = new Point2D.Float(fx, fy);
     132        Point2D.Float pt2 = hasFocus ? new Point2D.Float(fx, fy) : pt1;
    123133        if (gradientUnits == GU_USER_SPACE_ON_USE)
    124134        {
    125             paint = new com.kitfox.svg.batik.RadialGradientPaint(
     135            paint = new RadialGradientPaint(
    126136                pt1,
    127137                r,
     
    130140                getStopColors(),
    131141                method,
    132                 com.kitfox.svg.batik.MultipleGradientPaint.SRGB,
     142                MultipleGradientPaint.ColorSpaceType.SRGB,
    133143                gradientTransform);
    134144        } else
     
    140150            viewXform.concatenate(gradientTransform);
    141151
    142             paint = new com.kitfox.svg.batik.RadialGradientPaint(
     152            paint = new RadialGradientPaint(
    143153                pt1,
    144154                r,
     
    147157                getStopColors(),
    148158                method,
    149                 com.kitfox.svg.batik.MultipleGradientPaint.SRGB,
     159                MultipleGradientPaint.ColorSpaceType.SRGB,
    150160                viewXform);
    151161        }
     
    161171     * update
    162172     */
     173    @Override
    163174    public boolean updateTime(double curTime) throws SVGException
    164175    {
Note: See TracChangeset for help on using the changeset viewer.