Java Code Examples for sun.java2d.pipe.Region#isEmpty()

The following examples show how to use sun.java2d.pipe.Region#isEmpty() . 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: GeneralRenderer.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public static void doDrawRect(PixelWriter pw,
                              SunGraphics2D sg2d, SurfaceData sData,
                              int x, int y, int w, int h)
{
    if (w < 0 || h < 0) {
        return;
    }
    int x2 = Region.dimAdd(Region.dimAdd(x, w), 1);
    int y2 = Region.dimAdd(Region.dimAdd(y, h), 1);
    Region r = sg2d.getCompClip().getBoundsIntersectionXYXY(x, y, x2, y2);
    if (r.isEmpty()) {
        return;
    }
    int cx1 = r.getLoX();
    int cy1 = r.getLoY();
    int cx2 = r.getHiX();
    int cy2 = r.getHiY();

    if (w < 2 || h < 2) {
        doSetRect(sData, pw, cx1, cy1, cx2, cy2);
        return;
    }


    if (cy1 == y) {
        doSetRect(sData, pw,   cx1,   cy1,   cx2, cy1+1);
    }
    if (cx1 == x) {
        doSetRect(sData, pw,   cx1, cy1+1, cx1+1, cy2-1);
    }
    if (cx2 == x2) {
        doSetRect(sData, pw, cx2-1, cy1+1,   cx2, cy2-1);
    }
    if (cy2 == y2) {
        doSetRect(sData, pw,   cx1, cy2-1,   cx2,   cy2);
    }
}
 
Example 2
Source File: Container.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
final void recursiveSubtractAndApplyShape(Region shape, int fromZorder, int toZorder) {
    checkTreeLock();
    if (mixingLog.isLoggable(PlatformLogger.Level.FINE)) {
        mixingLog.fine("this = " + this +
            "; shape=" + shape + "; fromZ=" + fromZorder + "; toZ=" + toZorder);
    }
    if (fromZorder == -1) {
        return;
    }
    if (shape.isEmpty()) {
        return;
    }
    // An invalid container with not-null layout should be ignored
    // by the mixing code, the container will be validated later
    // and the mixing code will be executed later.
    if (getLayout() != null && !isValid()) {
        return;
    }
    for (int index = fromZorder; index <= toZorder; index++) {
        Component comp = getComponent(index);
        if (!comp.isLightweight()) {
            comp.subtractAndApplyShape(shape);
        } else if (comp instanceof Container &&
                ((Container)comp).hasHeavyweightDescendants() && comp.isShowing()) {
            ((Container)comp).recursiveSubtractAndApplyShape(shape);
        }
    }
}
 
Example 3
Source File: Container.java    From Java8CN with Apache License 2.0 5 votes vote down vote up
final void recursiveSubtractAndApplyShape(Region shape, int fromZorder, int toZorder) {
    checkTreeLock();
    if (mixingLog.isLoggable(PlatformLogger.Level.FINE)) {
        mixingLog.fine("this = " + this +
            "; shape=" + shape + "; fromZ=" + fromZorder + "; toZ=" + toZorder);
    }
    if (fromZorder == -1) {
        return;
    }
    if (shape.isEmpty()) {
        return;
    }
    // An invalid container with not-null layout should be ignored
    // by the mixing code, the container will be validated later
    // and the mixing code will be executed later.
    if (getLayout() != null && !isValid()) {
        return;
    }
    for (int index = fromZorder; index <= toZorder; index++) {
        Component comp = getComponent(index);
        if (!comp.isLightweight()) {
            comp.subtractAndApplyShape(shape);
        } else if (comp instanceof Container &&
                ((Container)comp).hasHeavyweightDescendants() && comp.isShowing()) {
            ((Container)comp).recursiveSubtractAndApplyShape(shape);
        }
    }
}
 
Example 4
Source File: Container.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
final void recursiveSubtractAndApplyShape(Region shape, int fromZorder, int toZorder) {
    checkTreeLock();
    if (mixingLog.isLoggable(PlatformLogger.Level.FINE)) {
        mixingLog.fine("this = " + this +
            "; shape=" + shape + "; fromZ=" + fromZorder + "; toZ=" + toZorder);
    }
    if (fromZorder == -1) {
        return;
    }
    if (shape.isEmpty()) {
        return;
    }
    // An invalid container with not-null layout should be ignored
    // by the mixing code, the container will be validated later
    // and the mixing code will be executed later.
    if (getLayout() != null && !isValid()) {
        return;
    }
    for (int index = fromZorder; index <= toZorder; index++) {
        Component comp = getComponent(index);
        if (!comp.isLightweight()) {
            comp.subtractAndApplyShape(shape);
        } else if (comp instanceof Container &&
                ((Container)comp).hasHeavyweightDescendants() && comp.isShowing()) {
            ((Container)comp).recursiveSubtractAndApplyShape(shape);
        }
    }
}
 
Example 5
Source File: Container.java    From jdk-1.7-annotated with Apache License 2.0 5 votes vote down vote up
final void recursiveSubtractAndApplyShape(Region shape, int fromZorder, int toZorder) {
    checkTreeLock();
    if (mixingLog.isLoggable(PlatformLogger.FINE)) {
        mixingLog.fine("this = " + this +
            "; shape=" + shape + "; fromZ=" + fromZorder + "; toZ=" + toZorder);
    }
    if (fromZorder == -1) {
        return;
    }
    if (shape.isEmpty()) {
        return;
    }
    // An invalid container with not-null layout should be ignored
    // by the mixing code, the container will be validated later
    // and the mixing code will be executed later.
    if (getLayout() != null && !isValid()) {
        return;
    }
    for (int index = fromZorder; index <= toZorder; index++) {
        Component comp = getComponent(index);
        if (!comp.isLightweight()) {
            comp.subtractAndApplyShape(shape);
        } else if (comp instanceof Container &&
                ((Container)comp).hasHeavyweightDescendants() && comp.isShowing()) {
            ((Container)comp).recursiveSubtractAndApplyShape(shape);
        }
    }
}
 
Example 6
Source File: GeneralRenderer.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public static void doDrawRect(PixelWriter pw,
                              SunGraphics2D sg2d, SurfaceData sData,
                              int x, int y, int w, int h)
{
    if (w < 0 || h < 0) {
        return;
    }
    int x2 = Region.dimAdd(Region.dimAdd(x, w), 1);
    int y2 = Region.dimAdd(Region.dimAdd(y, h), 1);
    Region r = sg2d.getCompClip().getBoundsIntersectionXYXY(x, y, x2, y2);
    if (r.isEmpty()) {
        return;
    }
    int cx1 = r.getLoX();
    int cy1 = r.getLoY();
    int cx2 = r.getHiX();
    int cy2 = r.getHiY();

    if (w < 2 || h < 2) {
        doSetRect(sData, pw, cx1, cy1, cx2, cy2);
        return;
    }


    if (cy1 == y) {
        doSetRect(sData, pw,   cx1,   cy1,   cx2, cy1+1);
    }
    if (cx1 == x) {
        doSetRect(sData, pw,   cx1, cy1+1, cx1+1, cy2-1);
    }
    if (cx2 == x2) {
        doSetRect(sData, pw, cx2-1, cy1+1,   cx2, cy2-1);
    }
    if (cy2 == y2) {
        doSetRect(sData, pw,   cx1, cy2-1,   cx2,   cy2);
    }
}
 
Example 7
Source File: GeneralRenderer.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public static void doDrawRect(PixelWriter pw,
                              SunGraphics2D sg2d, SurfaceData sData,
                              int x, int y, int w, int h)
{
    if (w < 0 || h < 0) {
        return;
    }
    int x2 = Region.dimAdd(Region.dimAdd(x, w), 1);
    int y2 = Region.dimAdd(Region.dimAdd(y, h), 1);
    Region r = sg2d.getCompClip().getBoundsIntersectionXYXY(x, y, x2, y2);
    if (r.isEmpty()) {
        return;
    }
    int cx1 = r.getLoX();
    int cy1 = r.getLoY();
    int cx2 = r.getHiX();
    int cy2 = r.getHiY();

    if (w < 2 || h < 2) {
        doSetRect(sData, pw, cx1, cy1, cx2, cy2);
        return;
    }


    if (cy1 == y) {
        doSetRect(sData, pw,   cx1,   cy1,   cx2, cy1+1);
    }
    if (cx1 == x) {
        doSetRect(sData, pw,   cx1, cy1+1, cx1+1, cy2-1);
    }
    if (cx2 == x2) {
        doSetRect(sData, pw, cx2-1, cy1+1,   cx2, cy2-1);
    }
    if (cy2 == y2) {
        doSetRect(sData, pw,   cx1, cy2-1,   cx2,   cy2);
    }
}
 
Example 8
Source File: Container.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
final void recursiveSubtractAndApplyShape(Region shape, int fromZorder, int toZorder) {
    checkTreeLock();
    if (mixingLog.isLoggable(PlatformLogger.Level.FINE)) {
        mixingLog.fine("this = " + this +
            "; shape=" + shape + "; fromZ=" + fromZorder + "; toZ=" + toZorder);
    }
    if (fromZorder == -1) {
        return;
    }
    if (shape.isEmpty()) {
        return;
    }
    // An invalid container with not-null layout should be ignored
    // by the mixing code, the container will be validated later
    // and the mixing code will be executed later.
    if (getLayout() != null && !isValid()) {
        return;
    }
    for (int index = fromZorder; index <= toZorder; index++) {
        Component comp = getComponent(index);
        if (!comp.isLightweight()) {
            comp.subtractAndApplyShape(shape);
        } else if (comp instanceof Container &&
                ((Container)comp).hasHeavyweightDescendants() && comp.isShowing()) {
            ((Container)comp).recursiveSubtractAndApplyShape(shape);
        }
    }
}
 
Example 9
Source File: Container.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
final void recursiveSubtractAndApplyShape(Region shape, int fromZorder, int toZorder) {
    checkTreeLock();
    if (mixingLog.isLoggable(PlatformLogger.Level.FINE)) {
        mixingLog.fine("this = " + this +
            "; shape=" + shape + "; fromZ=" + fromZorder + "; toZ=" + toZorder);
    }
    if (fromZorder == -1) {
        return;
    }
    if (shape.isEmpty()) {
        return;
    }
    // An invalid container with not-null layout should be ignored
    // by the mixing code, the container will be validated later
    // and the mixing code will be executed later.
    if (getLayout() != null && !isValid()) {
        return;
    }
    for (int index = fromZorder; index <= toZorder; index++) {
        Component comp = getComponent(index);
        if (!comp.isLightweight()) {
            comp.subtractAndApplyShape(shape);
        } else if (comp instanceof Container &&
                ((Container)comp).hasHeavyweightDescendants() && comp.isShowing()) {
            ((Container)comp).recursiveSubtractAndApplyShape(shape);
        }
    }
}
 
Example 10
Source File: Container.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
final void recursiveSubtractAndApplyShape(Region shape, int fromZorder, int toZorder) {
    checkTreeLock();
    if (mixingLog.isLoggable(PlatformLogger.Level.FINE)) {
        mixingLog.fine("this = " + this +
            "; shape=" + shape + "; fromZ=" + fromZorder + "; toZ=" + toZorder);
    }
    if (fromZorder == -1) {
        return;
    }
    if (shape.isEmpty()) {
        return;
    }
    // An invalid container with not-null layout should be ignored
    // by the mixing code, the container will be validated later
    // and the mixing code will be executed later.
    if (getLayout() != null && !isValid()) {
        return;
    }
    for (int index = fromZorder; index <= toZorder; index++) {
        Component comp = getComponent(index);
        if (!comp.isLightweight()) {
            comp.subtractAndApplyShape(shape);
        } else if (comp instanceof Container &&
                ((Container)comp).hasHeavyweightDescendants() && comp.isShowing()) {
            ((Container)comp).recursiveSubtractAndApplyShape(shape);
        }
    }
}
 
Example 11
Source File: GeneralRenderer.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public static void doDrawRect(PixelWriter pw,
                              SunGraphics2D sg2d, SurfaceData sData,
                              int x, int y, int w, int h)
{
    if (w < 0 || h < 0) {
        return;
    }
    int x2 = Region.dimAdd(Region.dimAdd(x, w), 1);
    int y2 = Region.dimAdd(Region.dimAdd(y, h), 1);
    Region r = sg2d.getCompClip().getBoundsIntersectionXYXY(x, y, x2, y2);
    if (r.isEmpty()) {
        return;
    }
    int cx1 = r.getLoX();
    int cy1 = r.getLoY();
    int cx2 = r.getHiX();
    int cy2 = r.getHiY();

    if (w < 2 || h < 2) {
        doSetRect(sData, pw, cx1, cy1, cx2, cy2);
        return;
    }


    if (cy1 == y) {
        doSetRect(sData, pw,   cx1,   cy1,   cx2, cy1+1);
    }
    if (cx1 == x) {
        doSetRect(sData, pw,   cx1, cy1+1, cx1+1, cy2-1);
    }
    if (cx2 == x2) {
        doSetRect(sData, pw, cx2-1, cy1+1,   cx2, cy2-1);
    }
    if (cy2 == y2) {
        doSetRect(sData, pw,   cx1, cy2-1,   cx2,   cy2);
    }
}
 
Example 12
Source File: Container.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
final void recursiveSubtractAndApplyShape(Region shape, int fromZorder, int toZorder) {
    checkTreeLock();
    if (mixingLog.isLoggable(PlatformLogger.Level.FINE)) {
        mixingLog.fine("this = " + this +
            "; shape=" + shape + "; fromZ=" + fromZorder + "; toZ=" + toZorder);
    }
    if (fromZorder == -1) {
        return;
    }
    if (shape.isEmpty()) {
        return;
    }
    // An invalid container with not-null layout should be ignored
    // by the mixing code, the container will be validated later
    // and the mixing code will be executed later.
    if (getLayout() != null && !isValid()) {
        return;
    }
    for (int index = fromZorder; index <= toZorder; index++) {
        Component comp = getComponent(index);
        if (!comp.isLightweight()) {
            comp.subtractAndApplyShape(shape);
        } else if (comp instanceof Container &&
                ((Container)comp).hasHeavyweightDescendants() && comp.isShowing()) {
            ((Container)comp).recursiveSubtractAndApplyShape(shape);
        }
    }
}
 
Example 13
Source File: GeneralRenderer.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public static void doDrawRect(PixelWriter pw,
                              SunGraphics2D sg2d, SurfaceData sData,
                              int x, int y, int w, int h)
{
    if (w < 0 || h < 0) {
        return;
    }
    int x2 = Region.dimAdd(Region.dimAdd(x, w), 1);
    int y2 = Region.dimAdd(Region.dimAdd(y, h), 1);
    Region r = sg2d.getCompClip().getBoundsIntersectionXYXY(x, y, x2, y2);
    if (r.isEmpty()) {
        return;
    }
    int cx1 = r.getLoX();
    int cy1 = r.getLoY();
    int cx2 = r.getHiX();
    int cy2 = r.getHiY();

    if (w < 2 || h < 2) {
        doSetRect(sData, pw, cx1, cy1, cx2, cy2);
        return;
    }


    if (cy1 == y) {
        doSetRect(sData, pw,   cx1,   cy1,   cx2, cy1+1);
    }
    if (cx1 == x) {
        doSetRect(sData, pw,   cx1, cy1+1, cx1+1, cy2-1);
    }
    if (cx2 == x2) {
        doSetRect(sData, pw, cx2-1, cy1+1,   cx2, cy2-1);
    }
    if (cy2 == y2) {
        doSetRect(sData, pw,   cx1, cy2-1,   cx2,   cy2);
    }
}
 
Example 14
Source File: Container.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
final void recursiveSubtractAndApplyShape(Region shape, int fromZorder, int toZorder) {
    checkTreeLock();
    if (mixingLog.isLoggable(PlatformLogger.Level.FINE)) {
        mixingLog.fine("this = " + this +
            "; shape=" + shape + "; fromZ=" + fromZorder + "; toZ=" + toZorder);
    }
    if (fromZorder == -1) {
        return;
    }
    if (shape.isEmpty()) {
        return;
    }
    // An invalid container with not-null layout should be ignored
    // by the mixing code, the container will be validated later
    // and the mixing code will be executed later.
    if (getLayout() != null && !isValid()) {
        return;
    }
    for (int index = fromZorder; index <= toZorder; index++) {
        Component comp = getComponent(index);
        if (!comp.isLightweight()) {
            comp.subtractAndApplyShape(shape);
        } else if (comp instanceof Container &&
                ((Container)comp).hasHeavyweightDescendants() && comp.isShowing()) {
            ((Container)comp).recursiveSubtractAndApplyShape(shape);
        }
    }
}
 
Example 15
Source File: GeneralRenderer.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public static void doDrawRect(PixelWriter pw,
                              SunGraphics2D sg2d, SurfaceData sData,
                              int x, int y, int w, int h)
{
    if (w < 0 || h < 0) {
        return;
    }
    int x2 = Region.dimAdd(Region.dimAdd(x, w), 1);
    int y2 = Region.dimAdd(Region.dimAdd(y, h), 1);
    Region r = sg2d.getCompClip().getBoundsIntersectionXYXY(x, y, x2, y2);
    if (r.isEmpty()) {
        return;
    }
    int cx1 = r.getLoX();
    int cy1 = r.getLoY();
    int cx2 = r.getHiX();
    int cy2 = r.getHiY();

    if (w < 2 || h < 2) {
        doSetRect(sData, pw, cx1, cy1, cx2, cy2);
        return;
    }


    if (cy1 == y) {
        doSetRect(sData, pw,   cx1,   cy1,   cx2, cy1+1);
    }
    if (cx1 == x) {
        doSetRect(sData, pw,   cx1, cy1+1, cx1+1, cy2-1);
    }
    if (cx2 == x2) {
        doSetRect(sData, pw, cx2-1, cy1+1,   cx2, cy2-1);
    }
    if (cy2 == y2) {
        doSetRect(sData, pw,   cx1, cy2-1,   cx2,   cy2);
    }
}
 
Example 16
Source File: GeneralRenderer.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
public static void doDrawRect(PixelWriter pw,
                              SunGraphics2D sg2d, SurfaceData sData,
                              int x, int y, int w, int h)
{
    if (w < 0 || h < 0) {
        return;
    }
    int x2 = Region.dimAdd(Region.dimAdd(x, w), 1);
    int y2 = Region.dimAdd(Region.dimAdd(y, h), 1);
    Region r = sg2d.getCompClip().getBoundsIntersectionXYXY(x, y, x2, y2);
    if (r.isEmpty()) {
        return;
    }
    int cx1 = r.getLoX();
    int cy1 = r.getLoY();
    int cx2 = r.getHiX();
    int cy2 = r.getHiY();

    if (w < 2 || h < 2) {
        doSetRect(sData, pw, cx1, cy1, cx2, cy2);
        return;
    }


    if (cy1 == y) {
        doSetRect(sData, pw,   cx1,   cy1,   cx2, cy1+1);
    }
    if (cx1 == x) {
        doSetRect(sData, pw,   cx1, cy1+1, cx1+1, cy2-1);
    }
    if (cx2 == x2) {
        doSetRect(sData, pw, cx2-1, cy1+1,   cx2, cy2-1);
    }
    if (cy2 == y2) {
        doSetRect(sData, pw,   cx1, cy2-1,   cx2,   cy2);
    }
}
 
Example 17
Source File: Container.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
final void recursiveSubtractAndApplyShape(Region shape, int fromZorder, int toZorder) {
    checkTreeLock();
    if (mixingLog.isLoggable(PlatformLogger.Level.FINE)) {
        mixingLog.fine("this = " + this +
            "; shape=" + shape + "; fromZ=" + fromZorder + "; toZ=" + toZorder);
    }
    if (fromZorder == -1) {
        return;
    }
    if (shape.isEmpty()) {
        return;
    }
    // An invalid container with not-null layout should be ignored
    // by the mixing code, the container will be validated later
    // and the mixing code will be executed later.
    if (getLayout() != null && !isValid()) {
        return;
    }
    for (int index = fromZorder; index <= toZorder; index++) {
        Component comp = getComponent(index);
        if (!comp.isLightweight()) {
            comp.subtractAndApplyShape(shape);
        } else if (comp instanceof Container &&
                ((Container)comp).hasHeavyweightDescendants() && comp.isShowing()) {
            ((Container)comp).recursiveSubtractAndApplyShape(shape);
        }
    }
}
 
Example 18
Source File: OGLBlitLoops.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
public void Blit(SurfaceData src, SurfaceData dst,
                 Composite comp, Region clip,
                 int sx, int sy, int dx, int dy,
                 int w, int h)
{
    if (clip != null) {
        clip = clip.getIntersectionXYWH(dx, dy, w, h);
        // At the end this method will flush the RenderQueue, we should exit
        // from it as soon as possible.
        if (clip.isEmpty()) {
            return;
        }
        sx += clip.getLoX() - dx;
        sy += clip.getLoY() - dy;
        dx = clip.getLoX();
        dy = clip.getLoY();
        w = clip.getWidth();
        h = clip.getHeight();

        if (!clip.isRectangular()) {
            complexClipBlit(src, dst, comp, clip, sx, sy, dx, dy, w, h);
            return;
        }
    }

    OGLRenderQueue rq = OGLRenderQueue.getInstance();
    rq.lock();
    try {
        // make sure the RenderQueue keeps a hard reference to the
        // destination (sysmem) SurfaceData to prevent it from being
        // disposed while the operation is processed on the QFT
        rq.addReference(dst);

        RenderBuffer buf = rq.getBuffer();
        OGLContext.validateContext((OGLSurfaceData)src);

        rq.ensureCapacityAndAlignment(48, 32);
        buf.putInt(SURFACE_TO_SW_BLIT);
        buf.putInt(sx).putInt(sy);
        buf.putInt(dx).putInt(dy);
        buf.putInt(w).putInt(h);
        buf.putInt(typeval);
        buf.putLong(src.getNativeOps());
        buf.putLong(dst.getNativeOps());

        // always flush immediately
        rq.flushNow();
    } finally {
        rq.unlock();
    }
}
 
Example 19
Source File: OGLBlitLoops.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
public void Blit(SurfaceData src, SurfaceData dst,
                 Composite comp, Region clip,
                 int sx, int sy, int dx, int dy,
                 int w, int h)
{
    if (clip != null) {
        clip = clip.getIntersectionXYWH(dx, dy, w, h);
        // At the end this method will flush the RenderQueue, we should exit
        // from it as soon as possible.
        if (clip.isEmpty()) {
            return;
        }
        sx += clip.getLoX() - dx;
        sy += clip.getLoY() - dy;
        dx = clip.getLoX();
        dy = clip.getLoY();
        w = clip.getWidth();
        h = clip.getHeight();

        if (!clip.isRectangular()) {
            complexClipBlit(src, dst, comp, clip, sx, sy, dx, dy, w, h);
            return;
        }
    }

    OGLRenderQueue rq = OGLRenderQueue.getInstance();
    rq.lock();
    try {
        // make sure the RenderQueue keeps a hard reference to the
        // destination (sysmem) SurfaceData to prevent it from being
        // disposed while the operation is processed on the QFT
        rq.addReference(dst);

        RenderBuffer buf = rq.getBuffer();
        OGLContext.validateContext((OGLSurfaceData)src);

        rq.ensureCapacityAndAlignment(48, 32);
        buf.putInt(SURFACE_TO_SW_BLIT);
        buf.putInt(sx).putInt(sy);
        buf.putInt(dx).putInt(dy);
        buf.putInt(w).putInt(h);
        buf.putInt(typeval);
        buf.putLong(src.getNativeOps());
        buf.putLong(dst.getNativeOps());

        // always flush immediately
        rq.flushNow();
    } finally {
        rq.unlock();
    }
}
 
Example 20
Source File: OGLBlitLoops.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
public void Blit(SurfaceData src, SurfaceData dst,
                 Composite comp, Region clip,
                 int sx, int sy, int dx, int dy,
                 int w, int h)
{
    if (clip != null) {
        clip = clip.getIntersectionXYWH(dx, dy, w, h);
        // At the end this method will flush the RenderQueue, we should exit
        // from it as soon as possible.
        if (clip.isEmpty()) {
            return;
        }
        sx += clip.getLoX() - dx;
        sy += clip.getLoY() - dy;
        dx = clip.getLoX();
        dy = clip.getLoY();
        w = clip.getWidth();
        h = clip.getHeight();

        if (!clip.isRectangular()) {
            complexClipBlit(src, dst, comp, clip, sx, sy, dx, dy, w, h);
            return;
        }
    }

    OGLRenderQueue rq = OGLRenderQueue.getInstance();
    rq.lock();
    try {
        // make sure the RenderQueue keeps a hard reference to the
        // destination (sysmem) SurfaceData to prevent it from being
        // disposed while the operation is processed on the QFT
        rq.addReference(dst);

        RenderBuffer buf = rq.getBuffer();
        OGLContext.validateContext((OGLSurfaceData)src);

        rq.ensureCapacityAndAlignment(48, 32);
        buf.putInt(SURFACE_TO_SW_BLIT);
        buf.putInt(sx).putInt(sy);
        buf.putInt(dx).putInt(dy);
        buf.putInt(w).putInt(h);
        buf.putInt(typeval);
        buf.putLong(src.getNativeOps());
        buf.putLong(dst.getNativeOps());

        // always flush immediately
        rq.flushNow();
    } finally {
        rq.unlock();
    }
}