Java Code Examples for sun.java2d.SunGraphics2D#COMP_XOR

The following examples show how to use sun.java2d.SunGraphics2D#COMP_XOR . 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: CGLSurfaceData.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
@Override
public boolean copyArea(SunGraphics2D sg2d, int x, int y, int w, int h,
                        int dx, int dy) {
    final int state = sg2d.transformState;
    if (state > SunGraphics2D.TRANSFORM_TRANSLATESCALE
        || sg2d.compositeState >= SunGraphics2D.COMP_XOR) {
        return false;
    }
    if (state <= SunGraphics2D.TRANSFORM_ANY_TRANSLATE) {
        x += sg2d.transX;
        y += sg2d.transY;
    } else if (state == SunGraphics2D.TRANSFORM_TRANSLATESCALE) {
        final double[] coords = {x, y, x + w, y + h, x + dx, y + dy};
        sg2d.transform.transform(coords, 0, coords, 0, 3);
        x = (int) Math.ceil(coords[0] - 0.5);
        y = (int) Math.ceil(coords[1] - 0.5);
        w = ((int) Math.ceil(coords[2] - 0.5)) - x;
        h = ((int) Math.ceil(coords[3] - 0.5)) - y;
        dx = ((int) Math.ceil(coords[4] - 0.5)) - x;
        dy = ((int) Math.ceil(coords[5] - 0.5)) - y;
    }
    oglRenderPipe.copyArea(sg2d, x, y, w, h, dx, dy);
    return true;
}
 
Example 2
Source File: CGLSurfaceData.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
@Override
public boolean copyArea(SunGraphics2D sg2d, int x, int y, int w, int h,
                        int dx, int dy) {
    final int state = sg2d.transformState;
    if (state > SunGraphics2D.TRANSFORM_TRANSLATESCALE
        || sg2d.compositeState >= SunGraphics2D.COMP_XOR) {
        return false;
    }
    if (state <= SunGraphics2D.TRANSFORM_ANY_TRANSLATE) {
        x += sg2d.transX;
        y += sg2d.transY;
    } else if (state == SunGraphics2D.TRANSFORM_TRANSLATESCALE) {
        final double[] coords = {x, y, x + w, y + h, x + dx, y + dy};
        sg2d.transform.transform(coords, 0, coords, 0, 3);
        x = (int) Math.ceil(coords[0] - 0.5);
        y = (int) Math.ceil(coords[1] - 0.5);
        w = ((int) Math.ceil(coords[2] - 0.5)) - x;
        h = ((int) Math.ceil(coords[3] - 0.5)) - y;
        dx = ((int) Math.ceil(coords[4] - 0.5)) - x;
        dy = ((int) Math.ceil(coords[5] - 0.5)) - y;
    }
    oglRenderPipe.copyArea(sg2d, x, y, w, h, dx, dy);
    return true;
}
 
Example 3
Source File: CGLSurfaceData.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
@Override
public boolean copyArea(SunGraphics2D sg2d, int x, int y, int w, int h,
                        int dx, int dy) {
    final int state = sg2d.transformState;
    if (state > SunGraphics2D.TRANSFORM_TRANSLATESCALE
        || sg2d.compositeState >= SunGraphics2D.COMP_XOR) {
        return false;
    }
    if (state <= SunGraphics2D.TRANSFORM_ANY_TRANSLATE) {
        x += sg2d.transX;
        y += sg2d.transY;
    } else if (state == SunGraphics2D.TRANSFORM_TRANSLATESCALE) {
        final double[] coords = {x, y, x + w, y + h, x + dx, y + dy};
        sg2d.transform.transform(coords, 0, coords, 0, 3);
        x = (int) Math.ceil(coords[0] - 0.5);
        y = (int) Math.ceil(coords[1] - 0.5);
        w = ((int) Math.ceil(coords[2] - 0.5)) - x;
        h = ((int) Math.ceil(coords[3] - 0.5)) - y;
        dx = ((int) Math.ceil(coords[4] - 0.5)) - x;
        dy = ((int) Math.ceil(coords[5] - 0.5)) - y;
    }
    oglRenderPipe.copyArea(sg2d, x, y, w, h, dx, dy);
    return true;
}
 
Example 4
Source File: CGLSurfaceData.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
@Override
public boolean copyArea(SunGraphics2D sg2d, int x, int y, int w, int h,
                        int dx, int dy) {
    final int state = sg2d.transformState;
    if (state > SunGraphics2D.TRANSFORM_TRANSLATESCALE
        || sg2d.compositeState >= SunGraphics2D.COMP_XOR) {
        return false;
    }
    if (state <= SunGraphics2D.TRANSFORM_ANY_TRANSLATE) {
        x += sg2d.transX;
        y += sg2d.transY;
    } else if (state == SunGraphics2D.TRANSFORM_TRANSLATESCALE) {
        final double[] coords = {x, y, x + w, y + h, x + dx, y + dy};
        sg2d.transform.transform(coords, 0, coords, 0, 3);
        x = (int) Math.ceil(coords[0] - 0.5);
        y = (int) Math.ceil(coords[1] - 0.5);
        w = ((int) Math.ceil(coords[2] - 0.5)) - x;
        h = ((int) Math.ceil(coords[3] - 0.5)) - y;
        dx = ((int) Math.ceil(coords[4] - 0.5)) - x;
        dy = ((int) Math.ceil(coords[5] - 0.5)) - y;
    }
    oglRenderPipe.copyArea(sg2d, x, y, w, h, dx, dy);
    return true;
}
 
Example 5
Source File: CGLSurfaceData.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
@Override
public boolean copyArea(SunGraphics2D sg2d, int x, int y, int w, int h,
                        int dx, int dy) {
    final int state = sg2d.transformState;
    if (state > SunGraphics2D.TRANSFORM_TRANSLATESCALE
        || sg2d.compositeState >= SunGraphics2D.COMP_XOR) {
        return false;
    }
    if (state <= SunGraphics2D.TRANSFORM_ANY_TRANSLATE) {
        x += sg2d.transX;
        y += sg2d.transY;
    } else if (state == SunGraphics2D.TRANSFORM_TRANSLATESCALE) {
        final double[] coords = {x, y, x + w, y + h, x + dx, y + dy};
        sg2d.transform.transform(coords, 0, coords, 0, 3);
        x = (int) Math.ceil(coords[0] - 0.5);
        y = (int) Math.ceil(coords[1] - 0.5);
        w = ((int) Math.ceil(coords[2] - 0.5)) - x;
        h = ((int) Math.ceil(coords[3] - 0.5)) - y;
        dx = ((int) Math.ceil(coords[4] - 0.5)) - x;
        dy = ((int) Math.ceil(coords[5] - 0.5)) - y;
    }
    oglRenderPipe.copyArea(sg2d, x, y, w, h, dx, dy);
    return true;
}
 
Example 6
Source File: CGLSurfaceData.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
@Override
public boolean copyArea(SunGraphics2D sg2d, int x, int y, int w, int h,
                        int dx, int dy) {
    final int state = sg2d.transformState;
    if (state > SunGraphics2D.TRANSFORM_TRANSLATESCALE
        || sg2d.compositeState >= SunGraphics2D.COMP_XOR) {
        return false;
    }
    if (state <= SunGraphics2D.TRANSFORM_ANY_TRANSLATE) {
        x += sg2d.transX;
        y += sg2d.transY;
    } else if (state == SunGraphics2D.TRANSFORM_TRANSLATESCALE) {
        final double[] coords = {x, y, x + w, y + h, x + dx, y + dy};
        sg2d.transform.transform(coords, 0, coords, 0, 3);
        x = (int) Math.ceil(coords[0] - 0.5);
        y = (int) Math.ceil(coords[1] - 0.5);
        w = ((int) Math.ceil(coords[2] - 0.5)) - x;
        h = ((int) Math.ceil(coords[3] - 0.5)) - y;
        dx = ((int) Math.ceil(coords[4] - 0.5)) - x;
        dy = ((int) Math.ceil(coords[5] - 0.5)) - y;
    }
    oglRenderPipe.copyArea(sg2d, x, y, w, h, dx, dy);
    return true;
}
 
Example 7
Source File: XRSurfaceData.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Validates the Surface when used as destination.
 */
public void validateAsDestination(SunGraphics2D sg2d, Region clip) {
    if (!isValid()) {
        throw new InvalidPipeException("bounds changed");
    }

    boolean updateGCClip = false;
    if (clip != validatedClip) {
        renderQueue.setClipRectangles(picture, clip);
        validatedClip = clip;
        updateGCClip = true;
    }

    if (sg2d != null && sg2d.compositeState == SunGraphics2D.COMP_XOR) {
        if (validatedXorComp != sg2d.getComposite()) {
            validatedXorComp = (XORComposite) sg2d.getComposite();
            renderQueue.setGCMode(xgc, false);
        }

        // validate pixel
        int pixel = sg2d.pixel;
        if (validatedGCForegroundPixel != pixel) {
            int xorpixelmod = validatedXorComp.getXorPixel();
            renderQueue.setGCForeground(xgc, pixel ^ xorpixelmod);
            validatedGCForegroundPixel = pixel;
        }

        if (updateGCClip) {
            renderQueue.setGCClipRectangles(xgc, clip);
        }
    }
}
 
Example 8
Source File: XRSurfaceData.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Validates the Surface when used as destination.
 */
public void validateAsDestination(SunGraphics2D sg2d, Region clip) {
    if (!isValid()) {
        throw new InvalidPipeException("bounds changed");
    }

    boolean updateGCClip = false;
    if (clip != validatedClip) {
        renderQueue.setClipRectangles(picture, clip);
        validatedClip = clip;
        updateGCClip = true;
    }

    if (sg2d != null && sg2d.compositeState == SunGraphics2D.COMP_XOR) {
        if (validatedXorComp != sg2d.getComposite()) {
            validatedXorComp = (XORComposite) sg2d.getComposite();
            renderQueue.setGCMode(xgc, false);
        }

        // validate pixel
        int pixel = sg2d.pixel;
        if (validatedGCForegroundPixel != pixel) {
            int xorpixelmod = validatedXorComp.getXorPixel();
            renderQueue.setGCForeground(xgc, pixel ^ xorpixelmod);
            validatedGCForegroundPixel = pixel;
        }

        if (updateGCClip) {
            renderQueue.setGCClipRectangles(xgc, clip);
        }
    }
}
 
Example 9
Source File: XRSurfaceData.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Validates the Surface when used as destination.
 */
public void validateAsDestination(SunGraphics2D sg2d, Region clip) {
    if (!isValid()) {
        throw new InvalidPipeException("bounds changed");
    }

    boolean updateGCClip = false;
    if (clip != validatedClip) {
        renderQueue.setClipRectangles(picture, clip);
        validatedClip = clip;
        updateGCClip = true;
    }

    if (sg2d != null && sg2d.compositeState == SunGraphics2D.COMP_XOR) {
        if (validatedXorComp != sg2d.getComposite()) {
            validatedXorComp = (XORComposite) sg2d.getComposite();
            renderQueue.setGCMode(xgc, false);
        }

        // validate pixel
        int pixel = sg2d.pixel;
        if (validatedGCForegroundPixel != pixel) {
            int xorpixelmod = validatedXorComp.getXorPixel();
            renderQueue.setGCForeground(xgc, pixel ^ xorpixelmod);
            validatedGCForegroundPixel = pixel;
        }

        if (updateGCClip) {
            renderQueue.setGCClipRectangles(xgc, clip);
        }
    }
}
 
Example 10
Source File: OGLSurfaceData.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
public boolean copyArea(SunGraphics2D sg2d,
                        int x, int y, int w, int h, int dx, int dy)
{
    if (sg2d.transformState < SunGraphics2D.TRANSFORM_TRANSLATESCALE &&
        sg2d.compositeState < SunGraphics2D.COMP_XOR)
    {
        x += sg2d.transX;
        y += sg2d.transY;

        oglRenderPipe.copyArea(sg2d, x, y, w, h, dx, dy);

        return true;
    }
    return false;
}
 
Example 11
Source File: OGLSurfaceData.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public boolean copyArea(SunGraphics2D sg2d, int x, int y, int w, int h,
                        int dx, int dy) {
    if (sg2d.compositeState >= SunGraphics2D.COMP_XOR) {
        return false;
    }
    oglRenderPipe.copyArea(sg2d, x, y, w, h, dx, dy);
    return true;
}
 
Example 12
Source File: OGLSurfaceData.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public boolean copyArea(SunGraphics2D sg2d,
                        int x, int y, int w, int h, int dx, int dy)
{
    if (sg2d.transformState < SunGraphics2D.TRANSFORM_TRANSLATESCALE &&
        sg2d.compositeState < SunGraphics2D.COMP_XOR)
    {
        x += sg2d.transX;
        y += sg2d.transY;

        oglRenderPipe.copyArea(sg2d, x, y, w, h, dx, dy);

        return true;
    }
    return false;
}
 
Example 13
Source File: OGLSurfaceData.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
public boolean copyArea(SunGraphics2D sg2d,
                        int x, int y, int w, int h, int dx, int dy)
{
    if (sg2d.transformState < SunGraphics2D.TRANSFORM_TRANSLATESCALE &&
        sg2d.compositeState < SunGraphics2D.COMP_XOR)
    {
        x += sg2d.transX;
        y += sg2d.transY;

        oglRenderPipe.copyArea(sg2d, x, y, w, h, dx, dy);

        return true;
    }
    return false;
}
 
Example 14
Source File: XRSurfaceData.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Validates the Surface when used as destination.
 */
public void validateAsDestination(SunGraphics2D sg2d, Region clip) {
    if (!isValid()) {
        throw new InvalidPipeException("bounds changed");
    }

    boolean updateGCClip = false;
    if (clip != validatedClip) {
        renderQueue.setClipRectangles(picture, clip);
        validatedClip = clip;
        updateGCClip = true;
    }

    if (sg2d != null && sg2d.compositeState == SunGraphics2D.COMP_XOR) {
        if (validatedXorComp != sg2d.getComposite()) {
            validatedXorComp = (XORComposite) sg2d.getComposite();
            renderQueue.setGCMode(xgc, false);
        }

        // validate pixel
        int pixel = sg2d.pixel;
        if (validatedGCForegroundPixel != pixel) {
            int xorpixelmod = validatedXorComp.getXorPixel();
            renderQueue.setGCForeground(xgc, pixel ^ xorpixelmod);
            validatedGCForegroundPixel = pixel;
        }

        if (updateGCClip) {
            renderQueue.setGCClipRectangles(xgc, clip);
        }
    }
}
 
Example 15
Source File: XRSurfaceData.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void validatePipe(SunGraphics2D sg2d) {
    TextPipe textpipe;
    boolean validated = false;

    /*
     * The textpipe for now can't handle TexturePaint when extra-alpha is
     * specified nore XOR mode
     */
    if ((textpipe = getTextPipe(sg2d)) == null)
    {
        super.validatePipe(sg2d);
        textpipe = sg2d.textpipe;
        validated = true;
    }

    PixelToShapeConverter txPipe = null;
    XRRenderer nonTxPipe = null;

    /*
     * TODO: Can we rely on the GC for ARGB32 surfaces?
     */
    if (sg2d.antialiasHint != SunHints.INTVAL_ANTIALIAS_ON) {
        if (sg2d.paintState <= SunGraphics2D.PAINT_ALPHACOLOR) {
            if (sg2d.compositeState <= SunGraphics2D.COMP_XOR) {
                txPipe = xrtxpipe;
                nonTxPipe = xrpipe;
            }
        } else if (sg2d.compositeState <= SunGraphics2D.COMP_ALPHA) {
            if (XRPaints.isValid(sg2d)) {
                txPipe = xrtxpipe;
                nonTxPipe = xrpipe;
            }
            // custom paints handled by super.validatePipe() below
        }
    }

    if (sg2d.antialiasHint == SunHints.INTVAL_ANTIALIAS_ON &&
        JulesPathBuf.isCairoAvailable())
    {
        sg2d.shapepipe = aaShapePipe;
        sg2d.drawpipe = aaPixelToShapeConv;
        sg2d.fillpipe = aaPixelToShapeConv;
    } else {
        if (txPipe != null) {
            if (sg2d.transformState >= SunGraphics2D.TRANSFORM_TRANSLATESCALE) {
                sg2d.drawpipe = txPipe;
                sg2d.fillpipe = txPipe;
            } else if (sg2d.strokeState != SunGraphics2D.STROKE_THIN) {
                sg2d.drawpipe = txPipe;
                sg2d.fillpipe = nonTxPipe;
            } else {
                sg2d.drawpipe = nonTxPipe;
                sg2d.fillpipe = nonTxPipe;
            }
            sg2d.shapepipe = nonTxPipe;
        } else {
            if (!validated) {
                super.validatePipe(sg2d);
            }
        }
    }

    // install the text pipe based on our earlier decision
    sg2d.textpipe = textpipe;

    // always override the image pipe with the specialized XRender pipe
    sg2d.imagepipe = xrDrawImage;
}
 
Example 16
Source File: XRSurfaceData.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void validatePipe(SunGraphics2D sg2d) {
    TextPipe textpipe;
    boolean validated = false;

    /*
     * The textpipe for now can't handle TexturePaint when extra-alpha is
     * specified nore XOR mode
     */
    if ((textpipe = getTextPipe(sg2d)) == null)
    {
        super.validatePipe(sg2d);
        textpipe = sg2d.textpipe;
        validated = true;
    }

    PixelToShapeConverter txPipe = null;
    XRRenderer nonTxPipe = null;

    /*
     * TODO: Can we rely on the GC for ARGB32 surfaces?
     */
    if (sg2d.antialiasHint != SunHints.INTVAL_ANTIALIAS_ON) {
        if (sg2d.paintState <= SunGraphics2D.PAINT_ALPHACOLOR) {
            if (sg2d.compositeState <= SunGraphics2D.COMP_XOR) {
                txPipe = xrtxpipe;
                nonTxPipe = xrpipe;
            }
        } else if (sg2d.compositeState <= SunGraphics2D.COMP_ALPHA) {
            if (XRPaints.isValid(sg2d)) {
                txPipe = xrtxpipe;
                nonTxPipe = xrpipe;
            }
            // custom paints handled by super.validatePipe() below
        }
    }

    if (sg2d.antialiasHint == SunHints.INTVAL_ANTIALIAS_ON &&
        JulesPathBuf.isCairoAvailable())
    {
        sg2d.shapepipe = aaShapePipe;
        sg2d.drawpipe = aaPixelToShapeConv;
        sg2d.fillpipe = aaPixelToShapeConv;
    } else {
        if (txPipe != null) {
            if (sg2d.transformState >= SunGraphics2D.TRANSFORM_TRANSLATESCALE) {
                sg2d.drawpipe = txPipe;
                sg2d.fillpipe = txPipe;
            } else if (sg2d.strokeState != SunGraphics2D.STROKE_THIN) {
                sg2d.drawpipe = txPipe;
                sg2d.fillpipe = nonTxPipe;
            } else {
                sg2d.drawpipe = nonTxPipe;
                sg2d.fillpipe = nonTxPipe;
            }
            sg2d.shapepipe = nonTxPipe;
        } else {
            if (!validated) {
                super.validatePipe(sg2d);
            }
        }
    }

    // install the text pipe based on our earlier decision
    sg2d.textpipe = textpipe;

    // always override the image pipe with the specialized XRender pipe
    sg2d.imagepipe = xrDrawImage;
}
 
Example 17
Source File: XRSurfaceData.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void validatePipe(SunGraphics2D sg2d) {
    TextPipe textpipe;
    boolean validated = false;

    /*
     * The textpipe for now can't handle TexturePaint when extra-alpha is
     * specified nore XOR mode
     */
    if ((textpipe = getTextPipe(sg2d)) == null)
    {
        super.validatePipe(sg2d);
        textpipe = sg2d.textpipe;
        validated = true;
    }

    PixelToShapeConverter txPipe = null;
    XRRenderer nonTxPipe = null;

    /*
     * TODO: Can we rely on the GC for ARGB32 surfaces?
     */
    if (sg2d.antialiasHint != SunHints.INTVAL_ANTIALIAS_ON) {
        if (sg2d.paintState <= SunGraphics2D.PAINT_ALPHACOLOR) {
            if (sg2d.compositeState <= SunGraphics2D.COMP_XOR) {
                txPipe = xrtxpipe;
                nonTxPipe = xrpipe;
            }
        } else if (sg2d.compositeState <= SunGraphics2D.COMP_ALPHA) {
            if (XRPaints.isValid(sg2d)) {
                txPipe = xrtxpipe;
                nonTxPipe = xrpipe;
            }
            // custom paints handled by super.validatePipe() below
        }
    }

    if (sg2d.antialiasHint == SunHints.INTVAL_ANTIALIAS_ON &&
        JulesPathBuf.isCairoAvailable())
    {
        sg2d.shapepipe = aaShapePipe;
        sg2d.drawpipe = aaPixelToShapeConv;
        sg2d.fillpipe = aaPixelToShapeConv;
    } else {
        if (txPipe != null) {
            if (sg2d.transformState >= SunGraphics2D.TRANSFORM_TRANSLATESCALE) {
                sg2d.drawpipe = txPipe;
                sg2d.fillpipe = txPipe;
            } else if (sg2d.strokeState != SunGraphics2D.STROKE_THIN) {
                sg2d.drawpipe = txPipe;
                sg2d.fillpipe = nonTxPipe;
            } else {
                sg2d.drawpipe = nonTxPipe;
                sg2d.fillpipe = nonTxPipe;
            }
            sg2d.shapepipe = nonTxPipe;
        } else {
            if (!validated) {
                super.validatePipe(sg2d);
            }
        }
    }

    // install the text pipe based on our earlier decision
    sg2d.textpipe = textpipe;

    // always override the image pipe with the specialized XRender pipe
    sg2d.imagepipe = xrDrawImage;
}
 
Example 18
Source File: XRSurfaceData.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void validatePipe(SunGraphics2D sg2d) {
    TextPipe textpipe;
    boolean validated = false;

    /*
     * The textpipe for now can't handle TexturePaint when extra-alpha is
     * specified nore XOR mode
     */
    if ((textpipe = getTextPipe(sg2d)) == null)
    {
        super.validatePipe(sg2d);
        textpipe = sg2d.textpipe;
        validated = true;
    }

    PixelToShapeConverter txPipe = null;
    XRRenderer nonTxPipe = null;

    /*
     * TODO: Can we rely on the GC for ARGB32 surfaces?
     */
    if (sg2d.antialiasHint != SunHints.INTVAL_ANTIALIAS_ON) {
        if (sg2d.paintState <= SunGraphics2D.PAINT_ALPHACOLOR) {
            if (sg2d.compositeState <= SunGraphics2D.COMP_XOR) {
                txPipe = xrtxpipe;
                nonTxPipe = xrpipe;
            }
        } else if (sg2d.compositeState <= SunGraphics2D.COMP_ALPHA) {
            if (XRPaints.isValid(sg2d)) {
                txPipe = xrtxpipe;
                nonTxPipe = xrpipe;
            }
            // custom paints handled by super.validatePipe() below
        }
    }

    if (sg2d.antialiasHint == SunHints.INTVAL_ANTIALIAS_ON &&
        JulesPathBuf.isCairoAvailable())
    {
        sg2d.shapepipe = aaShapePipe;
        sg2d.drawpipe = aaPixelToShapeConv;
        sg2d.fillpipe = aaPixelToShapeConv;
    } else {
        if (txPipe != null) {
            if (sg2d.transformState >= SunGraphics2D.TRANSFORM_TRANSLATESCALE) {
                sg2d.drawpipe = txPipe;
                sg2d.fillpipe = txPipe;
            } else if (sg2d.strokeState != SunGraphics2D.STROKE_THIN) {
                sg2d.drawpipe = txPipe;
                sg2d.fillpipe = nonTxPipe;
            } else {
                sg2d.drawpipe = nonTxPipe;
                sg2d.fillpipe = nonTxPipe;
            }
            sg2d.shapepipe = nonTxPipe;
        } else {
            if (!validated) {
                super.validatePipe(sg2d);
            }
        }
    }

    // install the text pipe based on our earlier decision
    sg2d.textpipe = textpipe;

    // always override the image pipe with the specialized XRender pipe
    sg2d.imagepipe = xrDrawImage;
}
 
Example 19
Source File: XRSurfaceData.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void validatePipe(SunGraphics2D sg2d) {
    TextPipe textpipe;
    boolean validated = false;

    /*
     * The textpipe for now can't handle TexturePaint when extra-alpha is
     * specified nore XOR mode
     */
    if ((textpipe = getTextPipe(sg2d)) == null)
    {
        super.validatePipe(sg2d);
        textpipe = sg2d.textpipe;
        validated = true;
    }

    PixelToShapeConverter txPipe = null;
    XRRenderer nonTxPipe = null;

    /*
     * TODO: Can we rely on the GC for ARGB32 surfaces?
     */
    if (sg2d.antialiasHint != SunHints.INTVAL_ANTIALIAS_ON) {
        if (sg2d.paintState <= SunGraphics2D.PAINT_ALPHACOLOR) {
            if (sg2d.compositeState <= SunGraphics2D.COMP_XOR) {
                txPipe = xrtxpipe;
                nonTxPipe = xrpipe;
            }
        } else if (sg2d.compositeState <= SunGraphics2D.COMP_ALPHA) {
            if (XRPaints.isValid(sg2d)) {
                txPipe = xrtxpipe;
                nonTxPipe = xrpipe;
            }
            // custom paints handled by super.validatePipe() below
        }
    }

    if (sg2d.antialiasHint == SunHints.INTVAL_ANTIALIAS_ON &&
        JulesPathBuf.isCairoAvailable())
    {
        sg2d.shapepipe = aaShapePipe;
        sg2d.drawpipe = aaPixelToShapeConv;
        sg2d.fillpipe = aaPixelToShapeConv;
    } else {
        if (txPipe != null) {
            if (sg2d.transformState >= SunGraphics2D.TRANSFORM_TRANSLATESCALE) {
                sg2d.drawpipe = txPipe;
                sg2d.fillpipe = txPipe;
            } else if (sg2d.strokeState != SunGraphics2D.STROKE_THIN) {
                sg2d.drawpipe = txPipe;
                sg2d.fillpipe = nonTxPipe;
            } else {
                sg2d.drawpipe = nonTxPipe;
                sg2d.fillpipe = nonTxPipe;
            }
            sg2d.shapepipe = nonTxPipe;
        } else {
            if (!validated) {
                super.validatePipe(sg2d);
            }
        }
    }

    // install the text pipe based on our earlier decision
    sg2d.textpipe = textpipe;

    // always override the image pipe with the specialized XRender pipe
    sg2d.imagepipe = xrDrawImage;
}
 
Example 20
Source File: XRSurfaceData.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void validatePipe(SunGraphics2D sg2d) {
    TextPipe textpipe;
    boolean validated = false;

    /*
     * The textpipe for now can't handle TexturePaint when extra-alpha is
     * specified nore XOR mode
     */
    if ((textpipe = getTextPipe(sg2d)) == null)
    {
        super.validatePipe(sg2d);
        textpipe = sg2d.textpipe;
        validated = true;
    }

    PixelToShapeConverter txPipe = null;
    XRRenderer nonTxPipe = null;

    /*
     * TODO: Can we rely on the GC for ARGB32 surfaces?
     */
    if (sg2d.antialiasHint != SunHints.INTVAL_ANTIALIAS_ON) {
        if (sg2d.paintState <= SunGraphics2D.PAINT_ALPHACOLOR) {
            if (sg2d.compositeState <= SunGraphics2D.COMP_XOR) {
                txPipe = xrtxpipe;
                nonTxPipe = xrpipe;
            }
        } else if (sg2d.compositeState <= SunGraphics2D.COMP_ALPHA) {
            if (XRPaints.isValid(sg2d)) {
                txPipe = xrtxpipe;
                nonTxPipe = xrpipe;
            }
            // custom paints handled by super.validatePipe() below
        }
    }

    if (sg2d.antialiasHint == SunHints.INTVAL_ANTIALIAS_ON &&
        JulesPathBuf.isCairoAvailable())
    {
        sg2d.shapepipe = aaShapePipe;
        sg2d.drawpipe = aaPixelToShapeConv;
        sg2d.fillpipe = aaPixelToShapeConv;
    } else {
        if (txPipe != null) {
            if (sg2d.transformState >= SunGraphics2D.TRANSFORM_TRANSLATESCALE) {
                sg2d.drawpipe = txPipe;
                sg2d.fillpipe = txPipe;
            } else if (sg2d.strokeState != SunGraphics2D.STROKE_THIN) {
                sg2d.drawpipe = txPipe;
                sg2d.fillpipe = nonTxPipe;
            } else {
                sg2d.drawpipe = nonTxPipe;
                sg2d.fillpipe = nonTxPipe;
            }
            sg2d.shapepipe = nonTxPipe;
        } else {
            if (!validated) {
                super.validatePipe(sg2d);
            }
        }
    }

    // install the text pipe based on our earlier decision
    sg2d.textpipe = textpipe;

    // always override the image pipe with the specialized XRender pipe
    sg2d.imagepipe = xrDrawImage;
}