Java Code Examples for sun.java2d.pipe.ShapeSpanIterator#appendPath()

The following examples show how to use sun.java2d.pipe.ShapeSpanIterator#appendPath() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SunGraphics2D.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
protected void validateCompClip() {
    int origClipState = clipState;
    if (usrClip == null) {
        clipState = CLIP_DEVICE;
        clipRegion = devClip;
    } else if (usrClip instanceof Rectangle2D) {
        clipState = CLIP_RECTANGULAR;
        if (usrClip instanceof Rectangle) {
            clipRegion = devClip.getIntersection((Rectangle)usrClip);
        } else {
            clipRegion = devClip.getIntersection(usrClip.getBounds());
        }
    } else {
        PathIterator cpi = usrClip.getPathIterator(null);
        int box[] = new int[4];
        ShapeSpanIterator sr = LoopPipe.getFillSSI(this);
        try {
            sr.setOutputArea(devClip);
            sr.appendPath(cpi);
            sr.getPathBox(box);
            Region r = Region.getInstance(box);
            r.appendSpans(sr);
            clipRegion = r;
            clipState =
                r.isRectangular() ? CLIP_RECTANGULAR : CLIP_SHAPE;
        } finally {
            sr.dispose();
        }
    }
    if (origClipState != clipState &&
        (clipState == CLIP_SHAPE || origClipState == CLIP_SHAPE))
    {
        validFontInfo = false;
        invalidatePipe();
    }
}
 
Example 2
Source File: SunGraphics2D.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
protected void validateCompClip() {
    int origClipState = clipState;
    if (usrClip == null) {
        clipState = CLIP_DEVICE;
        clipRegion = devClip;
    } else if (usrClip instanceof Rectangle2D) {
        clipState = CLIP_RECTANGULAR;
        if (usrClip instanceof Rectangle) {
            clipRegion = devClip.getIntersection((Rectangle)usrClip);
        } else {
            clipRegion = devClip.getIntersection(usrClip.getBounds());
        }
    } else {
        PathIterator cpi = usrClip.getPathIterator(null);
        int box[] = new int[4];
        ShapeSpanIterator sr = LoopPipe.getFillSSI(this);
        try {
            sr.setOutputArea(devClip);
            sr.appendPath(cpi);
            sr.getPathBox(box);
            Region r = Region.getInstance(box);
            r.appendSpans(sr);
            clipRegion = r;
            clipState =
                r.isRectangular() ? CLIP_RECTANGULAR : CLIP_SHAPE;
        } finally {
            sr.dispose();
        }
    }
    if (origClipState != clipState &&
        (clipState == CLIP_SHAPE || origClipState == CLIP_SHAPE))
    {
        validFontInfo = false;
        invalidatePipe();
    }
}
 
Example 3
Source File: SunGraphics2D.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
protected void validateCompClip() {
    int origClipState = clipState;
    if (usrClip == null) {
        clipState = CLIP_DEVICE;
        clipRegion = devClip;
    } else if (usrClip instanceof Rectangle2D) {
        clipState = CLIP_RECTANGULAR;
        clipRegion = devClip.getIntersection((Rectangle2D) usrClip);
    } else {
        PathIterator cpi = usrClip.getPathIterator(null);
        int[] box = new int[4];
        ShapeSpanIterator sr = LoopPipe.getFillSSI(this);
        try {
            sr.setOutputArea(devClip);
            sr.appendPath(cpi);
            sr.getPathBox(box);
            Region r = Region.getInstance(box, sr);
            clipRegion = r;
            clipState =
                r.isRectangular() ? CLIP_RECTANGULAR : CLIP_SHAPE;
        } finally {
            sr.dispose();
        }
    }
    if (origClipState != clipState &&
        (clipState == CLIP_SHAPE || origClipState == CLIP_SHAPE))
    {
        validFontInfo = false;
        invalidatePipe();
    }
}
 
Example 4
Source File: SunGraphics2D.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
protected void validateCompClip() {
    int origClipState = clipState;
    if (usrClip == null) {
        clipState = CLIP_DEVICE;
        clipRegion = devClip;
    } else if (usrClip instanceof Rectangle2D) {
        clipState = CLIP_RECTANGULAR;
        clipRegion = devClip.getIntersection((Rectangle2D) usrClip);
    } else {
        PathIterator cpi = usrClip.getPathIterator(null);
        int box[] = new int[4];
        ShapeSpanIterator sr = LoopPipe.getFillSSI(this);
        try {
            sr.setOutputArea(devClip);
            sr.appendPath(cpi);
            sr.getPathBox(box);
            Region r = Region.getInstance(box);
            r.appendSpans(sr);
            clipRegion = r;
            clipState =
                r.isRectangular() ? CLIP_RECTANGULAR : CLIP_SHAPE;
        } finally {
            sr.dispose();
        }
    }
    if (origClipState != clipState &&
        (clipState == CLIP_SHAPE || origClipState == CLIP_SHAPE))
    {
        validFontInfo = false;
        invalidatePipe();
    }
}
 
Example 5
Source File: SunGraphics2D.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
protected void validateCompClip() {
    int origClipState = clipState;
    if (usrClip == null) {
        clipState = CLIP_DEVICE;
        clipRegion = devClip;
    } else if (usrClip instanceof Rectangle2D) {
        clipState = CLIP_RECTANGULAR;
        if (usrClip instanceof Rectangle) {
            clipRegion = devClip.getIntersection((Rectangle)usrClip);
        } else {
            clipRegion = devClip.getIntersection(usrClip.getBounds());
        }
    } else {
        PathIterator cpi = usrClip.getPathIterator(null);
        int box[] = new int[4];
        ShapeSpanIterator sr = LoopPipe.getFillSSI(this);
        try {
            sr.setOutputArea(devClip);
            sr.appendPath(cpi);
            sr.getPathBox(box);
            Region r = Region.getInstance(box);
            r.appendSpans(sr);
            clipRegion = r;
            clipState =
                r.isRectangular() ? CLIP_RECTANGULAR : CLIP_SHAPE;
        } finally {
            sr.dispose();
        }
    }
    if (origClipState != clipState &&
        (clipState == CLIP_SHAPE || origClipState == CLIP_SHAPE))
    {
        validFontInfo = false;
        invalidatePipe();
    }
}
 
Example 6
Source File: XRRenderer.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
public void fill(SunGraphics2D sg2d, Shape s) {
    int transx, transy;

    if (sg2d.strokeState == SunGraphics2D.STROKE_THIN) {
        // Here we are able to use fillPath() for
        // high-quality fills.
        Path2D.Float p2df;
        if (sg2d.transformState <= SunGraphics2D.TRANSFORM_INT_TRANSLATE) {
            if (s instanceof Path2D.Float) {
                p2df = (Path2D.Float) s;
            } else {
                p2df = new Path2D.Float(s);
            }
            transx = sg2d.transX;
            transy = sg2d.transY;
        } else {
            p2df = new Path2D.Float(s, sg2d.transform);
            transx = 0;
            transy = 0;
        }
        fillPath(sg2d, p2df, transx, transy);
        return;
    }

    AffineTransform at;
    if (sg2d.transformState <= SunGraphics2D.TRANSFORM_INT_TRANSLATE) {
        // Transform (translation) will be done by FillSpans
        at = null;
        transx = sg2d.transX;
        transy = sg2d.transY;
    } else {
        // Transform will be done by the PathIterator
        at = sg2d.transform;
        transx = transy = 0;
    }

    ShapeSpanIterator ssi = LoopPipe.getFillSSI(sg2d);
    try {
        // Subtract transx/y from the SSI clip to match the
        // (potentially untranslated) geometry fed to it
        Region clip = sg2d.getCompClip();
        ssi.setOutputAreaXYXY(clip.getLoX() - transx,
                              clip.getLoY() - transy,
                              clip.getHiX() - transx,
                              clip.getHiY() - transy);
        ssi.appendPath(s.getPathIterator(at));
        fillSpans(sg2d, ssi, transx, transy);
    } finally {
        ssi.dispose();
    }
}
 
Example 7
Source File: XRRenderer.java    From jdk8u-dev-jdk with GNU General Public License v2.0 4 votes vote down vote up
public void fill(SunGraphics2D sg2d, Shape s) {
    int transx, transy;

    if (sg2d.strokeState == SunGraphics2D.STROKE_THIN) {
        // Here we are able to use fillPath() for
        // high-quality fills.
        Path2D.Float p2df;
        if (sg2d.transformState <= SunGraphics2D.TRANSFORM_INT_TRANSLATE) {
            if (s instanceof Path2D.Float) {
                p2df = (Path2D.Float) s;
            } else {
                p2df = new Path2D.Float(s);
            }
            transx = sg2d.transX;
            transy = sg2d.transY;
        } else {
            p2df = new Path2D.Float(s, sg2d.transform);
            transx = 0;
            transy = 0;
        }
        fillPath(sg2d, p2df, transx, transy);
        return;
    }

    AffineTransform at;
    if (sg2d.transformState <= SunGraphics2D.TRANSFORM_INT_TRANSLATE) {
        // Transform (translation) will be done by FillSpans
        at = null;
        transx = sg2d.transX;
        transy = sg2d.transY;
    } else {
        // Transform will be done by the PathIterator
        at = sg2d.transform;
        transx = transy = 0;
    }

    ShapeSpanIterator ssi = LoopPipe.getFillSSI(sg2d);
    try {
        // Subtract transx/y from the SSI clip to match the
        // (potentially untranslated) geometry fed to it
        Region clip = sg2d.getCompClip();
        ssi.setOutputAreaXYXY(clip.getLoX() - transx,
                              clip.getLoY() - transy,
                              clip.getHiX() - transx,
                              clip.getHiY() - transy);
        ssi.appendPath(s.getPathIterator(at));
        fillSpans(sg2d, ssi, transx, transy);
    } finally {
        ssi.dispose();
    }
}
 
Example 8
Source File: X11Renderer.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
public void fill(SunGraphics2D sg2d, Shape s) {
    if (sg2d.strokeState == SunGraphics2D.STROKE_THIN) {
        // Delegate to fillPolygon() if possible...
        if (s instanceof Polygon &&
            sg2d.transformState < SunGraphics2D.TRANSFORM_TRANSLATESCALE)
        {
            Polygon p = (Polygon) s;
            fillPolygon(sg2d, p.xpoints, p.ypoints, p.npoints);
            return;
        }

        // Otherwise we will use fillPath() for
        // high-quality fills.
        doPath(sg2d, s, true);
        return;
    }

    AffineTransform at;
    int transx, transy;
    if (sg2d.transformState < SunGraphics2D.TRANSFORM_TRANSLATESCALE) {
        // Transform (translation) will be done by XFillSpans
        at = null;
        transx = sg2d.transX;
        transy = sg2d.transY;
    } else {
        // Transform will be done by the PathIterator
        at = sg2d.transform;
        transx = transy = 0;
    }

    ShapeSpanIterator ssi = LoopPipe.getFillSSI(sg2d);
    try {
        // Subtract transx/y from the SSI clip to match the
        // (potentially untranslated) geometry fed to it
        Region clip = sg2d.getCompClip();
        ssi.setOutputAreaXYXY(clip.getLoX() - transx,
                              clip.getLoY() - transy,
                              clip.getHiX() - transx,
                              clip.getHiY() - transy);
        ssi.appendPath(s.getPathIterator(at));
        SunToolkit.awtLock();
        try {
            long xgc = validate(sg2d);
            XFillSpans(sg2d.surfaceData.getNativeOps(), xgc,
                       ssi, ssi.getNativeIterator(),
                       transx, transy);
        } finally {
            SunToolkit.awtUnlock();
        }
    } finally {
        ssi.dispose();
    }
}
 
Example 9
Source File: XRRenderer.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
public void fill(SunGraphics2D sg2d, Shape s) {
    int transx, transy;

    if (sg2d.strokeState == SunGraphics2D.STROKE_THIN) {
        // Here we are able to use fillPath() for
        // high-quality fills.
        Path2D.Float p2df;
        if (sg2d.transformState <= SunGraphics2D.TRANSFORM_INT_TRANSLATE) {
            if (s instanceof Path2D.Float) {
                p2df = (Path2D.Float) s;
            } else {
                p2df = new Path2D.Float(s);
            }
            transx = sg2d.transX;
            transy = sg2d.transY;
        } else {
            p2df = new Path2D.Float(s, sg2d.transform);
            transx = 0;
            transy = 0;
        }
        fillPath(sg2d, p2df, transx, transy);
        return;
    }

    AffineTransform at;
    if (sg2d.transformState <= SunGraphics2D.TRANSFORM_INT_TRANSLATE) {
        // Transform (translation) will be done by FillSpans
        at = null;
        transx = sg2d.transX;
        transy = sg2d.transY;
    } else {
        // Transform will be done by the PathIterator
        at = sg2d.transform;
        transx = transy = 0;
    }

    ShapeSpanIterator ssi = LoopPipe.getFillSSI(sg2d);
    try {
        // Subtract transx/y from the SSI clip to match the
        // (potentially untranslated) geometry fed to it
        Region clip = sg2d.getCompClip();
        ssi.setOutputAreaXYXY(clip.getLoX() - transx,
                              clip.getLoY() - transy,
                              clip.getHiX() - transx,
                              clip.getHiY() - transy);
        ssi.appendPath(s.getPathIterator(at));
        fillSpans(sg2d, ssi, transx, transy);
    } finally {
        ssi.dispose();
    }
}
 
Example 10
Source File: XRRenderer.java    From jdk8u_jdk with GNU General Public License v2.0 4 votes vote down vote up
public void fill(SunGraphics2D sg2d, Shape s) {
    int transx, transy;

    if (sg2d.strokeState == SunGraphics2D.STROKE_THIN) {
        // Here we are able to use fillPath() for
        // high-quality fills.
        Path2D.Float p2df;
        if (sg2d.transformState <= SunGraphics2D.TRANSFORM_INT_TRANSLATE) {
            if (s instanceof Path2D.Float) {
                p2df = (Path2D.Float) s;
            } else {
                p2df = new Path2D.Float(s);
            }
            transx = sg2d.transX;
            transy = sg2d.transY;
        } else {
            p2df = new Path2D.Float(s, sg2d.transform);
            transx = 0;
            transy = 0;
        }
        fillPath(sg2d, p2df, transx, transy);
        return;
    }

    AffineTransform at;
    if (sg2d.transformState <= SunGraphics2D.TRANSFORM_INT_TRANSLATE) {
        // Transform (translation) will be done by FillSpans
        at = null;
        transx = sg2d.transX;
        transy = sg2d.transY;
    } else {
        // Transform will be done by the PathIterator
        at = sg2d.transform;
        transx = transy = 0;
    }

    ShapeSpanIterator ssi = LoopPipe.getFillSSI(sg2d);
    try {
        // Subtract transx/y from the SSI clip to match the
        // (potentially untranslated) geometry fed to it
        Region clip = sg2d.getCompClip();
        ssi.setOutputAreaXYXY(clip.getLoX() - transx,
                              clip.getLoY() - transy,
                              clip.getHiX() - transx,
                              clip.getHiY() - transy);
        ssi.appendPath(s.getPathIterator(at));
        fillSpans(sg2d, ssi, transx, transy);
    } finally {
        ssi.dispose();
    }
}
 
Example 11
Source File: X11Renderer.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
public void fill(SunGraphics2D sg2d, Shape s) {
    if (sg2d.strokeState == SunGraphics2D.STROKE_THIN) {
        // Delegate to fillPolygon() if possible...
        if (s instanceof Polygon &&
            sg2d.transformState < SunGraphics2D.TRANSFORM_TRANSLATESCALE)
        {
            Polygon p = (Polygon) s;
            fillPolygon(sg2d, p.xpoints, p.ypoints, p.npoints);
            return;
        }

        // Otherwise we will use fillPath() for
        // high-quality fills.
        doPath(sg2d, s, true);
        return;
    }

    AffineTransform at;
    int transx, transy;
    if (sg2d.transformState < SunGraphics2D.TRANSFORM_TRANSLATESCALE) {
        // Transform (translation) will be done by XFillSpans
        at = null;
        transx = sg2d.transX;
        transy = sg2d.transY;
    } else {
        // Transform will be done by the PathIterator
        at = sg2d.transform;
        transx = transy = 0;
    }

    ShapeSpanIterator ssi = LoopPipe.getFillSSI(sg2d);
    try {
        // Subtract transx/y from the SSI clip to match the
        // (potentially untranslated) geometry fed to it
        Region clip = sg2d.getCompClip();
        ssi.setOutputAreaXYXY(clip.getLoX() - transx,
                              clip.getLoY() - transy,
                              clip.getHiX() - transx,
                              clip.getHiY() - transy);
        ssi.appendPath(s.getPathIterator(at));
        SunToolkit.awtLock();
        try {
            long xgc = validate(sg2d);
            XFillSpans(sg2d.surfaceData.getNativeOps(), xgc,
                       ssi, ssi.getNativeIterator(),
                       transx, transy);
        } finally {
            SunToolkit.awtUnlock();
        }
    } finally {
        ssi.dispose();
    }
}
 
Example 12
Source File: XRRenderer.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
public void fill(SunGraphics2D sg2d, Shape s) {
    int transx, transy;

    if (sg2d.strokeState == SunGraphics2D.STROKE_THIN) {
        // Here we are able to use fillPath() for
        // high-quality fills.
        Path2D.Float p2df;
        if (sg2d.transformState <= SunGraphics2D.TRANSFORM_INT_TRANSLATE) {
            if (s instanceof Path2D.Float) {
                p2df = (Path2D.Float) s;
            } else {
                p2df = new Path2D.Float(s);
            }
            transx = sg2d.transX;
            transy = sg2d.transY;
        } else {
            p2df = new Path2D.Float(s, sg2d.transform);
            transx = 0;
            transy = 0;
        }
        fillPath(sg2d, p2df, transx, transy);
        return;
    }

    AffineTransform at;
    if (sg2d.transformState <= SunGraphics2D.TRANSFORM_INT_TRANSLATE) {
        // Transform (translation) will be done by FillSpans
        at = null;
        transx = sg2d.transX;
        transy = sg2d.transY;
    } else {
        // Transform will be done by the PathIterator
        at = sg2d.transform;
        transx = transy = 0;
    }

    ShapeSpanIterator ssi = LoopPipe.getFillSSI(sg2d);
    try {
        // Subtract transx/y from the SSI clip to match the
        // (potentially untranslated) geometry fed to it
        Region clip = sg2d.getCompClip();
        ssi.setOutputAreaXYXY(clip.getLoX() - transx,
                              clip.getLoY() - transy,
                              clip.getHiX() - transx,
                              clip.getHiY() - transy);
        ssi.appendPath(s.getPathIterator(at));
        fillSpans(sg2d, ssi, transx, transy);
    } finally {
        ssi.dispose();
    }
}
 
Example 13
Source File: X11Renderer.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
public void fill(SunGraphics2D sg2d, Shape s) {
    if (sg2d.strokeState == SunGraphics2D.STROKE_THIN) {
        // Delegate to fillPolygon() if possible...
        if (s instanceof Polygon &&
            sg2d.transformState < SunGraphics2D.TRANSFORM_TRANSLATESCALE)
        {
            Polygon p = (Polygon) s;
            fillPolygon(sg2d, p.xpoints, p.ypoints, p.npoints);
            return;
        }

        // Otherwise we will use fillPath() for
        // high-quality fills.
        doPath(sg2d, s, true);
        return;
    }

    AffineTransform at;
    int transx, transy;
    if (sg2d.transformState < SunGraphics2D.TRANSFORM_TRANSLATESCALE) {
        // Transform (translation) will be done by XFillSpans
        at = null;
        transx = sg2d.transX;
        transy = sg2d.transY;
    } else {
        // Transform will be done by the PathIterator
        at = sg2d.transform;
        transx = transy = 0;
    }

    ShapeSpanIterator ssi = LoopPipe.getFillSSI(sg2d);
    try {
        // Subtract transx/y from the SSI clip to match the
        // (potentially untranslated) geometry fed to it
        Region clip = sg2d.getCompClip();
        ssi.setOutputAreaXYXY(clip.getLoX() - transx,
                              clip.getLoY() - transy,
                              clip.getHiX() - transx,
                              clip.getHiY() - transy);
        ssi.appendPath(s.getPathIterator(at));
        SunToolkit.awtLock();
        try {
            long xgc = validate(sg2d);
            XFillSpans(sg2d.surfaceData.getNativeOps(), xgc,
                       ssi, ssi.getNativeIterator(),
                       transx, transy);
        } finally {
            SunToolkit.awtUnlock();
        }
    } finally {
        ssi.dispose();
    }
}
 
Example 14
Source File: X11Renderer.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
public void fill(SunGraphics2D sg2d, Shape s) {
    if (sg2d.strokeState == SunGraphics2D.STROKE_THIN) {
        // Delegate to fillPolygon() if possible...
        if (s instanceof Polygon &&
            sg2d.transformState < SunGraphics2D.TRANSFORM_TRANSLATESCALE)
        {
            Polygon p = (Polygon) s;
            fillPolygon(sg2d, p.xpoints, p.ypoints, p.npoints);
            return;
        }

        // Otherwise we will use fillPath() for
        // high-quality fills.
        doPath(sg2d, s, true);
        return;
    }

    AffineTransform at;
    int transx, transy;
    if (sg2d.transformState < SunGraphics2D.TRANSFORM_TRANSLATESCALE) {
        // Transform (translation) will be done by XFillSpans
        at = null;
        transx = sg2d.transX;
        transy = sg2d.transY;
    } else {
        // Transform will be done by the PathIterator
        at = sg2d.transform;
        transx = transy = 0;
    }

    ShapeSpanIterator ssi = LoopPipe.getFillSSI(sg2d);
    try {
        // Subtract transx/y from the SSI clip to match the
        // (potentially untranslated) geometry fed to it
        Region clip = sg2d.getCompClip();
        ssi.setOutputAreaXYXY(clip.getLoX() - transx,
                              clip.getLoY() - transy,
                              clip.getHiX() - transx,
                              clip.getHiY() - transy);
        ssi.appendPath(s.getPathIterator(at));
        SunToolkit.awtLock();
        try {
            long xgc = validate(sg2d);
            XFillSpans(sg2d.surfaceData.getNativeOps(), xgc,
                       ssi, ssi.getNativeIterator(),
                       transx, transy);
        } finally {
            SunToolkit.awtUnlock();
        }
    } finally {
        ssi.dispose();
    }
}
 
Example 15
Source File: XRRenderer.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
public void fill(SunGraphics2D sg2d, Shape s) {
    int transx, transy;

    if (sg2d.strokeState == SunGraphics2D.STROKE_THIN) {
        // Here we are able to use fillPath() for
        // high-quality fills.
        Path2D.Float p2df;
        if (sg2d.transformState <= SunGraphics2D.TRANSFORM_INT_TRANSLATE) {
            if (s instanceof Path2D.Float) {
                p2df = (Path2D.Float) s;
            } else {
                p2df = new Path2D.Float(s);
            }
            transx = sg2d.transX;
            transy = sg2d.transY;
        } else {
            p2df = new Path2D.Float(s, sg2d.transform);
            transx = 0;
            transy = 0;
        }
        fillPath(sg2d, p2df, transx, transy);
        return;
    }

    AffineTransform at;
    if (sg2d.transformState <= SunGraphics2D.TRANSFORM_INT_TRANSLATE) {
        // Transform (translation) will be done by FillSpans
        at = null;
        transx = sg2d.transX;
        transy = sg2d.transY;
    } else {
        // Transform will be done by the PathIterator
        at = sg2d.transform;
        transx = transy = 0;
    }

    ShapeSpanIterator ssi = LoopPipe.getFillSSI(sg2d);
    try {
        // Subtract transx/y from the SSI clip to match the
        // (potentially untranslated) geometry fed to it
        Region clip = sg2d.getCompClip();
        ssi.setOutputAreaXYXY(clip.getLoX() - transx,
                              clip.getLoY() - transy,
                              clip.getHiX() - transx,
                              clip.getHiY() - transy);
        ssi.appendPath(s.getPathIterator(at));
        fillSpans(sg2d, ssi, transx, transy);
    } finally {
        ssi.dispose();
    }
}
 
Example 16
Source File: X11Renderer.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
public void fill(SunGraphics2D sg2d, Shape s) {
    if (sg2d.strokeState == SunGraphics2D.STROKE_THIN) {
        // Delegate to fillPolygon() if possible...
        if (s instanceof Polygon &&
            sg2d.transformState < SunGraphics2D.TRANSFORM_TRANSLATESCALE)
        {
            Polygon p = (Polygon) s;
            fillPolygon(sg2d, p.xpoints, p.ypoints, p.npoints);
            return;
        }

        // Otherwise we will use fillPath() for
        // high-quality fills.
        doPath(sg2d, s, true);
        return;
    }

    AffineTransform at;
    int transx, transy;
    if (sg2d.transformState < SunGraphics2D.TRANSFORM_TRANSLATESCALE) {
        // Transform (translation) will be done by XFillSpans
        at = null;
        transx = sg2d.transX;
        transy = sg2d.transY;
    } else {
        // Transform will be done by the PathIterator
        at = sg2d.transform;
        transx = transy = 0;
    }

    ShapeSpanIterator ssi = LoopPipe.getFillSSI(sg2d);
    try {
        // Subtract transx/y from the SSI clip to match the
        // (potentially untranslated) geometry fed to it
        Region clip = sg2d.getCompClip();
        ssi.setOutputAreaXYXY(clip.getLoX() - transx,
                              clip.getLoY() - transy,
                              clip.getHiX() - transx,
                              clip.getHiY() - transy);
        ssi.appendPath(s.getPathIterator(at));
        SunToolkit.awtLock();
        try {
            long xgc = validate(sg2d);
            XFillSpans(sg2d.surfaceData.getNativeOps(), xgc,
                       ssi, ssi.getNativeIterator(),
                       transx, transy);
        } finally {
            SunToolkit.awtUnlock();
        }
    } finally {
        ssi.dispose();
    }
}
 
Example 17
Source File: XRRenderer.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
public void fill(SunGraphics2D sg2d, Shape s) {
    int transx, transy;

    if (sg2d.strokeState == SunGraphics2D.STROKE_THIN) {
        // Here we are able to use fillPath() for
        // high-quality fills.
        Path2D.Float p2df;
        if (sg2d.transformState <= SunGraphics2D.TRANSFORM_INT_TRANSLATE) {
            if (s instanceof Path2D.Float) {
                p2df = (Path2D.Float) s;
            } else {
                p2df = new Path2D.Float(s);
            }
            transx = sg2d.transX;
            transy = sg2d.transY;
        } else {
            p2df = new Path2D.Float(s, sg2d.transform);
            transx = 0;
            transy = 0;
        }
        fillPath(sg2d, p2df, transx, transy);
        return;
    }

    AffineTransform at;
    if (sg2d.transformState <= SunGraphics2D.TRANSFORM_INT_TRANSLATE) {
        // Transform (translation) will be done by FillSpans
        at = null;
        transx = sg2d.transX;
        transy = sg2d.transY;
    } else {
        // Transform will be done by the PathIterator
        at = sg2d.transform;
        transx = transy = 0;
    }

    ShapeSpanIterator ssi = LoopPipe.getFillSSI(sg2d);
    try {
        // Subtract transx/y from the SSI clip to match the
        // (potentially untranslated) geometry fed to it
        Region clip = sg2d.getCompClip();
        ssi.setOutputAreaXYXY(clip.getLoX() - transx,
                              clip.getLoY() - transy,
                              clip.getHiX() - transx,
                              clip.getHiY() - transy);
        ssi.appendPath(s.getPathIterator(at));
        fillSpans(sg2d, ssi, transx, transy);
    } finally {
        ssi.dispose();
    }
}
 
Example 18
Source File: XRRenderer.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
public void fill(SunGraphics2D sg2d, Shape s) {
    int transx, transy;

    if (sg2d.strokeState == SunGraphics2D.STROKE_THIN) {
        // Here we are able to use fillPath() for
        // high-quality fills.
        Path2D.Float p2df;
        if (sg2d.transformState <= SunGraphics2D.TRANSFORM_INT_TRANSLATE) {
            if (s instanceof Path2D.Float) {
                p2df = (Path2D.Float) s;
            } else {
                p2df = new Path2D.Float(s);
            }
            transx = sg2d.transX;
            transy = sg2d.transY;
        } else {
            p2df = new Path2D.Float(s, sg2d.transform);
            transx = 0;
            transy = 0;
        }
        fillPath(sg2d, p2df, transx, transy);
        return;
    }

    AffineTransform at;
    if (sg2d.transformState <= SunGraphics2D.TRANSFORM_INT_TRANSLATE) {
        // Transform (translation) will be done by FillSpans
        at = null;
        transx = sg2d.transX;
        transy = sg2d.transY;
    } else {
        // Transform will be done by the PathIterator
        at = sg2d.transform;
        transx = transy = 0;
    }

    ShapeSpanIterator ssi = LoopPipe.getFillSSI(sg2d);
    try {
        // Subtract transx/y from the SSI clip to match the
        // (potentially untranslated) geometry fed to it
        Region clip = sg2d.getCompClip();
        ssi.setOutputAreaXYXY(clip.getLoX() - transx,
                              clip.getLoY() - transy,
                              clip.getHiX() - transx,
                              clip.getHiY() - transy);
        ssi.appendPath(s.getPathIterator(at));
        fillSpans(sg2d, ssi, transx, transy);
    } finally {
        ssi.dispose();
    }
}
 
Example 19
Source File: X11Renderer.java    From dragonwell8_jdk with GNU General Public License v2.0 4 votes vote down vote up
public void fill(SunGraphics2D sg2d, Shape s) {
    if (sg2d.strokeState == SunGraphics2D.STROKE_THIN) {
        // Delegate to fillPolygon() if possible...
        if (s instanceof Polygon &&
            sg2d.transformState < SunGraphics2D.TRANSFORM_TRANSLATESCALE)
        {
            Polygon p = (Polygon) s;
            fillPolygon(sg2d, p.xpoints, p.ypoints, p.npoints);
            return;
        }

        // Otherwise we will use fillPath() for
        // high-quality fills.
        doPath(sg2d, s, true);
        return;
    }

    AffineTransform at;
    int transx, transy;
    if (sg2d.transformState < SunGraphics2D.TRANSFORM_TRANSLATESCALE) {
        // Transform (translation) will be done by XFillSpans
        at = null;
        transx = sg2d.transX;
        transy = sg2d.transY;
    } else {
        // Transform will be done by the PathIterator
        at = sg2d.transform;
        transx = transy = 0;
    }

    ShapeSpanIterator ssi = LoopPipe.getFillSSI(sg2d);
    try {
        // Subtract transx/y from the SSI clip to match the
        // (potentially untranslated) geometry fed to it
        Region clip = sg2d.getCompClip();
        ssi.setOutputAreaXYXY(clip.getLoX() - transx,
                              clip.getLoY() - transy,
                              clip.getHiX() - transx,
                              clip.getHiY() - transy);
        ssi.appendPath(s.getPathIterator(at));
        SunToolkit.awtLock();
        try {
            long xgc = validate(sg2d);
            XFillSpans(sg2d.surfaceData.getNativeOps(), xgc,
                       ssi, ssi.getNativeIterator(),
                       transx, transy);
        } finally {
            SunToolkit.awtUnlock();
        }
    } finally {
        ssi.dispose();
    }
}
 
Example 20
Source File: XRRenderer.java    From dragonwell8_jdk with GNU General Public License v2.0 4 votes vote down vote up
public void fill(SunGraphics2D sg2d, Shape s) {
    int transx, transy;

    if (sg2d.strokeState == SunGraphics2D.STROKE_THIN) {
        // Here we are able to use fillPath() for
        // high-quality fills.
        Path2D.Float p2df;
        if (sg2d.transformState <= SunGraphics2D.TRANSFORM_INT_TRANSLATE) {
            if (s instanceof Path2D.Float) {
                p2df = (Path2D.Float) s;
            } else {
                p2df = new Path2D.Float(s);
            }
            transx = sg2d.transX;
            transy = sg2d.transY;
        } else {
            p2df = new Path2D.Float(s, sg2d.transform);
            transx = 0;
            transy = 0;
        }
        fillPath(sg2d, p2df, transx, transy);
        return;
    }

    AffineTransform at;
    if (sg2d.transformState <= SunGraphics2D.TRANSFORM_INT_TRANSLATE) {
        // Transform (translation) will be done by FillSpans
        at = null;
        transx = sg2d.transX;
        transy = sg2d.transY;
    } else {
        // Transform will be done by the PathIterator
        at = sg2d.transform;
        transx = transy = 0;
    }

    ShapeSpanIterator ssi = LoopPipe.getFillSSI(sg2d);
    try {
        // Subtract transx/y from the SSI clip to match the
        // (potentially untranslated) geometry fed to it
        Region clip = sg2d.getCompClip();
        ssi.setOutputAreaXYXY(clip.getLoX() - transx,
                              clip.getLoY() - transy,
                              clip.getHiX() - transx,
                              clip.getHiY() - transy);
        ssi.appendPath(s.getPathIterator(at));
        fillSpans(sg2d, ssi, transx, transy);
    } finally {
        ssi.dispose();
    }
}