Java Code Examples for sun.java2d.loops.Blit#locate()

The following examples show how to use sun.java2d.loops.Blit#locate() . 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: LWWindowPeer.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
private void blitSurfaceData(final SurfaceData src, final SurfaceData dst) {
    //TODO blit. proof-of-concept
    if (src != dst && src != null && dst != null
        && !(dst instanceof NullSurfaceData)
        && !(src instanceof NullSurfaceData)
        && src.getSurfaceType().equals(dst.getSurfaceType())
        && src.getDefaultScale() == dst.getDefaultScale()) {
        final Rectangle size = src.getBounds();
        final Blit blit = Blit.locate(src.getSurfaceType(),
                                      CompositeType.Src,
                                      dst.getSurfaceType());
        if (blit != null) {
            blit.Blit(src, dst, AlphaComposite.Src, null, 0, 0, 0, 0,
                      size.width, size.height);
        }
    }
}
 
Example 2
Source File: LWWindowPeer.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
private void blitSurfaceData(final SurfaceData src, final SurfaceData dst) {
    //TODO blit. proof-of-concept
    if (src != dst && src != null && dst != null
        && !(dst instanceof NullSurfaceData)
        && !(src instanceof NullSurfaceData)
        && src.getSurfaceType().equals(dst.getSurfaceType())
        && src.getDefaultScaleX() == dst.getDefaultScaleX()
        && src.getDefaultScaleY() == dst.getDefaultScaleY())
    {
        final Rectangle size = src.getBounds();
        final Blit blit = Blit.locate(src.getSurfaceType(),
                                      CompositeType.Src,
                                      dst.getSurfaceType());
        if (blit != null) {
            blit.Blit(src, dst, AlphaComposite.Src, null, 0, 0, 0, 0,
                      size.width, size.height);
        }
    }
}
 
Example 3
Source File: LWWindowPeer.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
private void blitSurfaceData(final SurfaceData src, final SurfaceData dst) {
    //TODO blit. proof-of-concept
    if (src != dst && src != null && dst != null
        && !(dst instanceof NullSurfaceData)
        && !(src instanceof NullSurfaceData)
        && src.getSurfaceType().equals(dst.getSurfaceType())
        && src.getDefaultScale() == dst.getDefaultScale()) {
        final Rectangle size = src.getBounds();
        final Blit blit = Blit.locate(src.getSurfaceType(),
                                      CompositeType.Src,
                                      dst.getSurfaceType());
        if (blit != null) {
            blit.Blit(src, dst, AlphaComposite.Src, null, 0, 0, 0, 0,
                      size.width, size.height);
        }
    }
}
 
Example 4
Source File: LWWindowPeer.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
private void blitSurfaceData(final SurfaceData src, final SurfaceData dst) {
    //TODO blit. proof-of-concept
    if (src != dst && src != null && dst != null
        && !(dst instanceof NullSurfaceData)
        && !(src instanceof NullSurfaceData)
        && src.getSurfaceType().equals(dst.getSurfaceType())
        && src.getDefaultScale() == dst.getDefaultScale()) {
        final Rectangle size = src.getBounds();
        final Blit blit = Blit.locate(src.getSurfaceType(),
                                      CompositeType.Src,
                                      dst.getSurfaceType());
        if (blit != null) {
            blit.Blit(src, dst, AlphaComposite.Src, null, 0, 0, 0, 0,
                      size.width, size.height);
        }
    }
}
 
Example 5
Source File: LWWindowPeer.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
private void blitSurfaceData(final SurfaceData src, final SurfaceData dst) {
    //TODO blit. proof-of-concept
    if (src != dst && src != null && dst != null
        && !(dst instanceof NullSurfaceData)
        && !(src instanceof NullSurfaceData)
        && src.getSurfaceType().equals(dst.getSurfaceType())
        && src.getDefaultScale() == dst.getDefaultScale()) {
        final Rectangle size = src.getBounds();
        final Blit blit = Blit.locate(src.getSurfaceType(),
                                      CompositeType.Src,
                                      dst.getSurfaceType());
        if (blit != null) {
            blit.Blit(src, dst, AlphaComposite.Src, null, 0, 0, 0, 0,
                      size.width, size.height);
        }
    }
}
 
Example 6
Source File: LWWindowPeer.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
private void blitSurfaceData(final SurfaceData src, final SurfaceData dst) {
    //TODO blit. proof-of-concept
    if (src != dst && src != null && dst != null
        && !(dst instanceof NullSurfaceData)
        && !(src instanceof NullSurfaceData)
        && src.getSurfaceType().equals(dst.getSurfaceType())
        && src.getDefaultScale() == dst.getDefaultScale()) {
        final Rectangle size = src.getBounds();
        final Blit blit = Blit.locate(src.getSurfaceType(),
                                      CompositeType.Src,
                                      dst.getSurfaceType());
        if (blit != null) {
            blit.Blit(src, dst, AlphaComposite.Src, null, 0, 0, 0, 0,
                      size.width, size.height);
        }
    }
}
 
Example 7
Source File: LWWindowPeer.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
private void blitSurfaceData(final SurfaceData src, final SurfaceData dst) {
    //TODO blit. proof-of-concept
    if (src != dst && src != null && dst != null
        && !(dst instanceof NullSurfaceData)
        && !(src instanceof NullSurfaceData)
        && src.getSurfaceType().equals(dst.getSurfaceType())
        && src.getDefaultScale() == dst.getDefaultScale()) {
        final Rectangle size = src.getBounds();
        final Blit blit = Blit.locate(src.getSurfaceType(),
                                      CompositeType.Src,
                                      dst.getSurfaceType());
        if (blit != null) {
            blit.Blit(src, dst, AlphaComposite.Src, null, 0, 0, 0, 0,
                      size.width, size.height);
        }
    }
}
 
Example 8
Source File: LWWindowPeer.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
private void blitSurfaceData(final SurfaceData src, final SurfaceData dst) {
    //TODO blit. proof-of-concept
    if (src != dst && src != null && dst != null
        && !(dst instanceof NullSurfaceData)
        && !(src instanceof NullSurfaceData)
        && src.getSurfaceType().equals(dst.getSurfaceType())
        && src.getDefaultScale() == dst.getDefaultScale()) {
        final Rectangle size = src.getBounds();
        final Blit blit = Blit.locate(src.getSurfaceType(),
                                      CompositeType.Src,
                                      dst.getSurfaceType());
        if (blit != null) {
            blit.Blit(src, dst, AlphaComposite.Src, null, 0, 0, 0, 0,
                      size.width, size.height);
        }
    }
}
 
Example 9
Source File: LWWindowPeer.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
private void blitSurfaceData(final SurfaceData src, final SurfaceData dst) {
    //TODO blit. proof-of-concept
    if (src != dst && src != null && dst != null
        && !(dst instanceof NullSurfaceData)
        && !(src instanceof NullSurfaceData)
        && src.getSurfaceType().equals(dst.getSurfaceType())
        && src.getDefaultScale() == dst.getDefaultScale()) {
        final Rectangle size = src.getBounds();
        final Blit blit = Blit.locate(src.getSurfaceType(),
                                      CompositeType.Src,
                                      dst.getSurfaceType());
        if (blit != null) {
            blit.Blit(src, dst, AlphaComposite.Src, null, 0, 0, 0, 0,
                      size.width, size.height);
        }
    }
}
 
Example 10
Source File: LWWindowPeer.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
private void blitSurfaceData(final SurfaceData src, final SurfaceData dst) {
    //TODO blit. proof-of-concept
    if (src != dst && src != null && dst != null
        && !(dst instanceof NullSurfaceData)
        && !(src instanceof NullSurfaceData)
        && src.getSurfaceType().equals(dst.getSurfaceType())
        && src.getDefaultScale() == dst.getDefaultScale()) {
        final Rectangle size = src.getBounds();
        final Blit blit = Blit.locate(src.getSurfaceType(),
                                      CompositeType.Src,
                                      dst.getSurfaceType());
        if (blit != null) {
            blit.Blit(src, dst, AlphaComposite.Src, null, 0, 0, 0, 0,
                      size.width, size.height);
        }
    }
}
 
Example 11
Source File: SunGraphics2D.java    From jdk8u_jdk with GNU General Public License v2.0 4 votes vote down vote up
private void doCopyArea(int x, int y, int w, int h, int dx, int dy) {
    if (w <= 0 || h <= 0) {
        return;
    }

    if (transformState == SunGraphics2D.TRANSFORM_ISIDENT) {
        // do nothing
    } else if (transformState <= SunGraphics2D.TRANSFORM_ANY_TRANSLATE) {
        x += transX;
        y += transY;
    } else if (transformState == SunGraphics2D.TRANSFORM_TRANSLATESCALE) {
        final double[] coords = {x, y, x + w, y + h, x + dx, y + dy};
        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;
        // In case of negative scale transform, reflect the rect coords.
        if (w < 0) {
            w = -w;
            x -= w;
        }
        if (h < 0) {
            h = -h;
            y -= h;
        }
    } else {
        throw new InternalError("transformed copyArea not implemented yet");
    }

    SurfaceData theData = surfaceData;
    if (theData.copyArea(this, x, y, w, h, dx, dy)) {
        return;
    }

    // REMIND: This method does not deal with missing data from the
    // source object (i.e. it does not send exposure events...)

    Region clip = getCompClip();

    Composite comp = composite;
    if (lastCAcomp != comp) {
        SurfaceType dsttype = theData.getSurfaceType();
        CompositeType comptype = imageComp;
        if (CompositeType.SrcOverNoEa.equals(comptype) &&
            theData.getTransparency() == Transparency.OPAQUE)
        {
            comptype = CompositeType.SrcNoEa;
        }
        lastCAblit = Blit.locate(dsttype, comptype, dsttype);
        lastCAcomp = comp;
    }

    Blit ob = lastCAblit;
    if (dy == 0 && dx > 0 && dx < w) {
        while (w > 0) {
            int partW = Math.min(w, dx);
            w -= partW;
            int sx = x + w;
            ob.Blit(theData, theData, comp, clip,
                    sx, y, sx+dx, y+dy, partW, h);
        }
        return;
    }
    if (dy > 0 && dy < h && dx > -w && dx < w) {
        while (h > 0) {
            int partH = Math.min(h, dy);
            h -= partH;
            int sy = y + h;
            ob.Blit(theData, theData, comp, clip,
                    x, sy, x+dx, sy+dy, w, partH);
        }
        return;
    }
        ob.Blit(theData, theData, comp, clip, x, y, x+dx, y+dy, w, h);
}
 
Example 12
Source File: SunGraphics2D.java    From dragonwell8_jdk with GNU General Public License v2.0 4 votes vote down vote up
private void doCopyArea(int x, int y, int w, int h, int dx, int dy) {
    if (w <= 0 || h <= 0) {
        return;
    }
    SurfaceData theData = surfaceData;
    if (theData.copyArea(this, x, y, w, h, dx, dy)) {
        return;
    }
    if (transformState > TRANSFORM_TRANSLATESCALE) {
        throw new InternalError("transformed copyArea not implemented yet");
    }
    // REMIND: This method does not deal with missing data from the
    // source object (i.e. it does not send exposure events...)

    Region clip = getCompClip();

    Composite comp = composite;
    if (lastCAcomp != comp) {
        SurfaceType dsttype = theData.getSurfaceType();
        CompositeType comptype = imageComp;
        if (CompositeType.SrcOverNoEa.equals(comptype) &&
            theData.getTransparency() == Transparency.OPAQUE)
        {
            comptype = CompositeType.SrcNoEa;
        }
        lastCAblit = Blit.locate(dsttype, comptype, dsttype);
        lastCAcomp = comp;
    }

    double[] coords = {x, y, x + w, y + h, x + dx, y + dy};
    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;

    // In case of negative scale transform, reflect the rect coords.
    if (w < 0) {
        w *= -1;
        x -= w;
    }
    if (h < 0) {
        h *= -1;
        y -= h;
    }

    Blit ob = lastCAblit;
    if (dy == 0 && dx > 0 && dx < w) {
        while (w > 0) {
            int partW = Math.min(w, dx);
            w -= partW;
            int sx = x + w;
            ob.Blit(theData, theData, comp, clip,
                    sx, y, sx+dx, y+dy, partW, h);
        }
        return;
    }
    if (dy > 0 && dy < h && dx > -w && dx < w) {
        while (h > 0) {
            int partH = Math.min(h, dy);
            h -= partH;
            int sy = y + h;
            ob.Blit(theData, theData, comp, clip,
                    x, sy, x+dx, sy+dy, w, partH);
        }
        return;
    }
    ob.Blit(theData, theData, comp, clip, x, y, x+dx, y+dy, w, h);
}
 
Example 13
Source File: SunGraphics2D.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
private void doCopyArea(int x, int y, int w, int h, int dx, int dy) {
    if (w <= 0 || h <= 0) {
        return;
    }
    SurfaceData theData = surfaceData;
    if (theData.copyArea(this, x, y, w, h, dx, dy)) {
        return;
    }
    if (transformState >= TRANSFORM_TRANSLATESCALE) {
        throw new InternalError("transformed copyArea not implemented yet");
    }
    // REMIND: This method does not deal with missing data from the
    // source object (i.e. it does not send exposure events...)

    Region clip = getCompClip();

    Composite comp = composite;
    if (lastCAcomp != comp) {
        SurfaceType dsttype = theData.getSurfaceType();
        CompositeType comptype = imageComp;
        if (CompositeType.SrcOverNoEa.equals(comptype) &&
            theData.getTransparency() == Transparency.OPAQUE)
        {
            comptype = CompositeType.SrcNoEa;
        }
        lastCAblit = Blit.locate(dsttype, comptype, dsttype);
        lastCAcomp = comp;
    }

    x += transX;
    y += transY;

    Blit ob = lastCAblit;
    if (dy == 0 && dx > 0 && dx < w) {
        while (w > 0) {
            int partW = Math.min(w, dx);
            w -= partW;
            int sx = x + w;
            ob.Blit(theData, theData, comp, clip,
                    sx, y, sx+dx, y+dy, partW, h);
        }
        return;
    }
    if (dy > 0 && dy < h && dx > -w && dx < w) {
        while (h > 0) {
            int partH = Math.min(h, dy);
            h -= partH;
            int sy = y + h;
            ob.Blit(theData, theData, comp, clip,
                    x, sy, x+dx, sy+dy, w, partH);
        }
        return;
    }
    ob.Blit(theData, theData, comp, clip, x, y, x+dx, y+dy, w, h);
}
 
Example 14
Source File: SunGraphics2D.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
private void doCopyArea(int x, int y, int w, int h, int dx, int dy) {
    if (w <= 0 || h <= 0) {
        return;
    }
    SurfaceData theData = surfaceData;
    if (theData.copyArea(this, x, y, w, h, dx, dy)) {
        return;
    }
    if (transformState > TRANSFORM_TRANSLATESCALE) {
        throw new InternalError("transformed copyArea not implemented yet");
    }
    // REMIND: This method does not deal with missing data from the
    // source object (i.e. it does not send exposure events...)

    Region clip = getCompClip();

    Composite comp = composite;
    if (lastCAcomp != comp) {
        SurfaceType dsttype = theData.getSurfaceType();
        CompositeType comptype = imageComp;
        if (CompositeType.SrcOverNoEa.equals(comptype) &&
            theData.getTransparency() == Transparency.OPAQUE)
        {
            comptype = CompositeType.SrcNoEa;
        }
        lastCAblit = Blit.locate(dsttype, comptype, dsttype);
        lastCAcomp = comp;
    }

    double[] coords = {x, y, x + w, y + h, x + dx, y + dy};
    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;

    // In case of negative scale transform, reflect the rect coords.
    if (w < 0) {
        w *= -1;
        x -= w;
    }
    if (h < 0) {
        h *= -1;
        y -= h;
    }

    Blit ob = lastCAblit;
    if (dy == 0 && dx > 0 && dx < w) {
        while (w > 0) {
            int partW = Math.min(w, dx);
            w -= partW;
            int sx = x + w;
            ob.Blit(theData, theData, comp, clip,
                    sx, y, sx+dx, y+dy, partW, h);
        }
        return;
    }
    if (dy > 0 && dy < h && dx > -w && dx < w) {
        while (h > 0) {
            int partH = Math.min(h, dy);
            h -= partH;
            int sy = y + h;
            ob.Blit(theData, theData, comp, clip,
                    x, sy, x+dx, sy+dy, w, partH);
        }
        return;
    }
    ob.Blit(theData, theData, comp, clip, x, y, x+dx, y+dy, w, h);
}
 
Example 15
Source File: SunGraphics2D.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
private void doCopyArea(int x, int y, int w, int h, int dx, int dy) {
    if (w <= 0 || h <= 0) {
        return;
    }
    SurfaceData theData = surfaceData;
    if (theData.copyArea(this, x, y, w, h, dx, dy)) {
        return;
    }
    if (transformState > TRANSFORM_TRANSLATESCALE) {
        throw new InternalError("transformed copyArea not implemented yet");
    }
    // REMIND: This method does not deal with missing data from the
    // source object (i.e. it does not send exposure events...)

    Region clip = getCompClip();

    Composite comp = composite;
    if (lastCAcomp != comp) {
        SurfaceType dsttype = theData.getSurfaceType();
        CompositeType comptype = imageComp;
        if (CompositeType.SrcOverNoEa.equals(comptype) &&
            theData.getTransparency() == Transparency.OPAQUE)
        {
            comptype = CompositeType.SrcNoEa;
        }
        lastCAblit = Blit.locate(dsttype, comptype, dsttype);
        lastCAcomp = comp;
    }

    double[] coords = {x, y, x + w, y + h, x + dx, y + dy};
    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;

    // In case of negative scale transform, reflect the rect coords.
    if (w < 0) {
        w *= -1;
        x -= w;
    }
    if (h < 0) {
        h *= -1;
        y -= h;
    }

    Blit ob = lastCAblit;
    if (dy == 0 && dx > 0 && dx < w) {
        while (w > 0) {
            int partW = Math.min(w, dx);
            w -= partW;
            int sx = x + w;
            ob.Blit(theData, theData, comp, clip,
                    sx, y, sx+dx, y+dy, partW, h);
        }
        return;
    }
    if (dy > 0 && dy < h && dx > -w && dx < w) {
        while (h > 0) {
            int partH = Math.min(h, dy);
            h -= partH;
            int sy = y + h;
            ob.Blit(theData, theData, comp, clip,
                    x, sy, x+dx, sy+dy, w, partH);
        }
        return;
    }
    ob.Blit(theData, theData, comp, clip, x, y, x+dx, y+dy, w, h);
}
 
Example 16
Source File: SunGraphics2D.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
private void doCopyArea(int x, int y, int w, int h, int dx, int dy) {
    if (w <= 0 || h <= 0) {
        return;
    }

    if (transformState == SunGraphics2D.TRANSFORM_ISIDENT) {
        // do nothing
    } else if (transformState <= SunGraphics2D.TRANSFORM_ANY_TRANSLATE) {
        x += transX;
        y += transY;
    } else if (transformState == SunGraphics2D.TRANSFORM_TRANSLATESCALE) {
        final double[] coords = {x, y, x + w, y + h, x + dx, y + dy};
        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;
        // In case of negative scale transform, reflect the rect coords.
        if (w < 0) {
            w = -w;
            x -= w;
        }
        if (h < 0) {
            h = -h;
            y -= h;
        }
    } else {
        throw new InternalError("transformed copyArea not implemented yet");
    }

    SurfaceData theData = surfaceData;
    if (theData.copyArea(this, x, y, w, h, dx, dy)) {
        return;
    }

    // REMIND: This method does not deal with missing data from the
    // source object (i.e. it does not send exposure events...)

    Region clip = getCompClip();

    Composite comp = composite;
    if (lastCAcomp != comp) {
        SurfaceType dsttype = theData.getSurfaceType();
        CompositeType comptype = imageComp;
        if (CompositeType.SrcOverNoEa.equals(comptype) &&
            theData.getTransparency() == Transparency.OPAQUE)
        {
            comptype = CompositeType.SrcNoEa;
        }
        lastCAblit = Blit.locate(dsttype, comptype, dsttype);
        lastCAcomp = comp;
    }

    Blit ob = lastCAblit;
    if (dy == 0 && dx > 0 && dx < w) {
        while (w > 0) {
            int partW = Math.min(w, dx);
            w -= partW;
            int sx = x + w;
            ob.Blit(theData, theData, comp, clip,
                    sx, y, sx+dx, y+dy, partW, h);
        }
        return;
    }
    if (dy > 0 && dy < h && dx > -w && dx < w) {
        while (h > 0) {
            int partH = Math.min(h, dy);
            h -= partH;
            int sy = y + h;
            ob.Blit(theData, theData, comp, clip,
                    x, sy, x+dx, sy+dy, w, partH);
        }
        return;
    }
        ob.Blit(theData, theData, comp, clip, x, y, x+dx, y+dy, w, h);
}
 
Example 17
Source File: SunGraphics2D.java    From Bytecoder with Apache License 2.0 4 votes vote down vote up
private void doCopyArea(int x, int y, int w, int h, int dx, int dy) {
    if (w <= 0 || h <= 0) {
        return;
    }

    if (transformState == SunGraphics2D.TRANSFORM_ISIDENT) {
        // do nothing
    } else if (transformState <= SunGraphics2D.TRANSFORM_ANY_TRANSLATE) {
        x += transX;
        y += transY;
    } else if (transformState == SunGraphics2D.TRANSFORM_TRANSLATESCALE) {
        final double[] coords = {x, y, x + w, y + h, x + dx, y + dy};
        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;
        // In case of negative scale transform, reflect the rect coords.
        if (w < 0) {
            w = -w;
            x -= w;
        }
        if (h < 0) {
            h = -h;
            y -= h;
        }
    } else {
        throw new InternalError("transformed copyArea not implemented yet");
    }

    SurfaceData theData = surfaceData;
    if (theData.copyArea(this, x, y, w, h, dx, dy)) {
        return;
    }

    // REMIND: This method does not deal with missing data from the
    // source object (i.e. it does not send exposure events...)

    Region clip = getCompClip();

    Composite comp = composite;
    if (lastCAcomp != comp) {
        SurfaceType dsttype = theData.getSurfaceType();
        CompositeType comptype = imageComp;
        if (CompositeType.SrcOverNoEa.equals(comptype) &&
            theData.getTransparency() == Transparency.OPAQUE)
        {
            comptype = CompositeType.SrcNoEa;
        }
        lastCAblit = Blit.locate(dsttype, comptype, dsttype);
        lastCAcomp = comp;
    }

    Blit ob = lastCAblit;
    if (dy == 0 && dx > 0 && dx < w) {
        while (w > 0) {
            int partW = Math.min(w, dx);
            w -= partW;
            int sx = x + w;
            ob.Blit(theData, theData, comp, clip,
                    sx, y, sx+dx, y+dy, partW, h);
        }
        return;
    }
    if (dy > 0 && dy < h && dx > -w && dx < w) {
        while (h > 0) {
            int partH = Math.min(h, dy);
            h -= partH;
            int sy = y + h;
            ob.Blit(theData, theData, comp, clip,
                    x, sy, x+dx, sy+dy, w, partH);
        }
        return;
    }
        ob.Blit(theData, theData, comp, clip, x, y, x+dx, y+dy, w, h);
}
 
Example 18
Source File: SunGraphics2D.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
private void doCopyArea(int x, int y, int w, int h, int dx, int dy) {
    if (w <= 0 || h <= 0) {
        return;
    }
    SurfaceData theData = surfaceData;
    if (theData.copyArea(this, x, y, w, h, dx, dy)) {
        return;
    }
    if (transformState > TRANSFORM_TRANSLATESCALE) {
        throw new InternalError("transformed copyArea not implemented yet");
    }
    // REMIND: This method does not deal with missing data from the
    // source object (i.e. it does not send exposure events...)

    Region clip = getCompClip();

    Composite comp = composite;
    if (lastCAcomp != comp) {
        SurfaceType dsttype = theData.getSurfaceType();
        CompositeType comptype = imageComp;
        if (CompositeType.SrcOverNoEa.equals(comptype) &&
            theData.getTransparency() == Transparency.OPAQUE)
        {
            comptype = CompositeType.SrcNoEa;
        }
        lastCAblit = Blit.locate(dsttype, comptype, dsttype);
        lastCAcomp = comp;
    }

    double[] coords = {x, y, x + w, y + h, x + dx, y + dy};
    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;

    // In case of negative scale transform, reflect the rect coords.
    if (w < 0) {
        w *= -1;
        x -= w;
    }
    if (h < 0) {
        h *= -1;
        y -= h;
    }

    Blit ob = lastCAblit;
    if (dy == 0 && dx > 0 && dx < w) {
        while (w > 0) {
            int partW = Math.min(w, dx);
            w -= partW;
            int sx = x + w;
            ob.Blit(theData, theData, comp, clip,
                    sx, y, sx+dx, y+dy, partW, h);
        }
        return;
    }
    if (dy > 0 && dy < h && dx > -w && dx < w) {
        while (h > 0) {
            int partH = Math.min(h, dy);
            h -= partH;
            int sy = y + h;
            ob.Blit(theData, theData, comp, clip,
                    x, sy, x+dx, sy+dy, w, partH);
        }
        return;
    }
    ob.Blit(theData, theData, comp, clip, x, y, x+dx, y+dy, w, h);
}
 
Example 19
Source File: SunGraphics2D.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
private void doCopyArea(int x, int y, int w, int h, int dx, int dy) {
    if (w <= 0 || h <= 0) {
        return;
    }
    SurfaceData theData = surfaceData;
    if (theData.copyArea(this, x, y, w, h, dx, dy)) {
        return;
    }
    if (transformState > TRANSFORM_TRANSLATESCALE) {
        throw new InternalError("transformed copyArea not implemented yet");
    }
    // REMIND: This method does not deal with missing data from the
    // source object (i.e. it does not send exposure events...)

    Region clip = getCompClip();

    Composite comp = composite;
    if (lastCAcomp != comp) {
        SurfaceType dsttype = theData.getSurfaceType();
        CompositeType comptype = imageComp;
        if (CompositeType.SrcOverNoEa.equals(comptype) &&
            theData.getTransparency() == Transparency.OPAQUE)
        {
            comptype = CompositeType.SrcNoEa;
        }
        lastCAblit = Blit.locate(dsttype, comptype, dsttype);
        lastCAcomp = comp;
    }

    double[] coords = {x, y, x + w, y + h, x + dx, y + dy};
    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;

    // In case of negative scale transform, reflect the rect coords.
    if (w < 0) {
        w *= -1;
        x -= w;
    }
    if (h < 0) {
        h *= -1;
        y -= h;
    }

    Blit ob = lastCAblit;
    if (dy == 0 && dx > 0 && dx < w) {
        while (w > 0) {
            int partW = Math.min(w, dx);
            w -= partW;
            int sx = x + w;
            ob.Blit(theData, theData, comp, clip,
                    sx, y, sx+dx, y+dy, partW, h);
        }
        return;
    }
    if (dy > 0 && dy < h && dx > -w && dx < w) {
        while (h > 0) {
            int partH = Math.min(h, dy);
            h -= partH;
            int sy = y + h;
            ob.Blit(theData, theData, comp, clip,
                    x, sy, x+dx, sy+dy, w, partH);
        }
        return;
    }
    ob.Blit(theData, theData, comp, clip, x, y, x+dx, y+dy, w, h);
}
 
Example 20
Source File: SunGraphics2D.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
private void doCopyArea(int x, int y, int w, int h, int dx, int dy) {
    if (w <= 0 || h <= 0) {
        return;
    }
    SurfaceData theData = surfaceData;
    if (theData.copyArea(this, x, y, w, h, dx, dy)) {
        return;
    }
    if (transformState > TRANSFORM_TRANSLATESCALE) {
        throw new InternalError("transformed copyArea not implemented yet");
    }
    // REMIND: This method does not deal with missing data from the
    // source object (i.e. it does not send exposure events...)

    Region clip = getCompClip();

    Composite comp = composite;
    if (lastCAcomp != comp) {
        SurfaceType dsttype = theData.getSurfaceType();
        CompositeType comptype = imageComp;
        if (CompositeType.SrcOverNoEa.equals(comptype) &&
            theData.getTransparency() == Transparency.OPAQUE)
        {
            comptype = CompositeType.SrcNoEa;
        }
        lastCAblit = Blit.locate(dsttype, comptype, dsttype);
        lastCAcomp = comp;
    }

    double[] coords = {x, y, x + w, y + h, x + dx, y + dy};
    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;

    // In case of negative scale transform, reflect the rect coords.
    if (w < 0) {
        w *= -1;
        x -= w;
    }
    if (h < 0) {
        h *= -1;
        y -= h;
    }

    Blit ob = lastCAblit;
    if (dy == 0 && dx > 0 && dx < w) {
        while (w > 0) {
            int partW = Math.min(w, dx);
            w -= partW;
            int sx = x + w;
            ob.Blit(theData, theData, comp, clip,
                    sx, y, sx+dx, y+dy, partW, h);
        }
        return;
    }
    if (dy > 0 && dy < h && dx > -w && dx < w) {
        while (h > 0) {
            int partH = Math.min(h, dy);
            h -= partH;
            int sy = y + h;
            ob.Blit(theData, theData, comp, clip,
                    x, sy, x+dx, sy+dy, w, partH);
        }
        return;
    }
    ob.Blit(theData, theData, comp, clip, x, y, x+dx, y+dy, w, h);
}