sun.java2d.pipe.RenderQueue Java Examples

The following examples show how to use sun.java2d.pipe.RenderQueue. 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: RSLAPITest.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
private static void testContext(final AccelGraphicsConfig agc) {
    BufferedContext c = agc.getContext();
    final AccelDeviceEventListener l = new AccelDeviceEventListener() {
        public void onDeviceDispose() {
            System.out.println("onDeviceDispose invoked");
            agc.removeDeviceEventListener(this);
        }
        public void onDeviceReset() {
            System.out.println("onDeviceReset invoked");
        }
    };
    agc.addDeviceEventListener(l);

    RenderQueue rq = c.getRenderQueue();
    rq.lock();
    try {
        c.saveState();
        rq.flushNow();
        c.restoreState();
        rq.flushNow();
        System.out.println("Passed: Save/Restore");
    } finally {
        rq.unlock();
    }
}
 
Example #2
Source File: D3DBlitLoops.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Enqueues a BLIT operation with the given parameters.  Note that the
 * RenderQueue lock must be held before calling this method.
 */
private static void enqueueBlit(RenderQueue rq,
                                SurfaceData src, SurfaceData dst,
                                int packedParams,
                                int sx1, int sy1,
                                int sx2, int sy2,
                                double dx1, double dy1,
                                double dx2, double dy2)
{
    // assert rq.lock.isHeldByCurrentThread();
    RenderBuffer buf = rq.getBuffer();
    rq.ensureCapacityAndAlignment(72, 24);
    buf.putInt(BLIT);
    buf.putInt(packedParams);
    buf.putInt(sx1).putInt(sy1);
    buf.putInt(sx2).putInt(sy2);
    buf.putDouble(dx1).putDouble(dy1);
    buf.putDouble(dx2).putDouble(dy2);
    buf.putLong(src.getNativeOps());
    buf.putLong(dst.getNativeOps());
}
 
Example #3
Source File: OGLBlitLoops.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Enqueues a BLIT operation with the given parameters.  Note that the
 * RenderQueue lock must be held before calling this method.
 */
private static void enqueueBlit(RenderQueue rq,
                                SurfaceData src, SurfaceData dst,
                                int packedParams,
                                int sx1, int sy1,
                                int sx2, int sy2,
                                double dx1, double dy1,
                                double dx2, double dy2)
{
    // assert rq.lock.isHeldByCurrentThread();
    RenderBuffer buf = rq.getBuffer();
    rq.ensureCapacityAndAlignment(72, 24);
    buf.putInt(BLIT);
    buf.putInt(packedParams);
    buf.putInt(sx1).putInt(sy1);
    buf.putInt(sx2).putInt(sy2);
    buf.putDouble(dx1).putDouble(dy1);
    buf.putDouble(dx2).putDouble(dy2);
    buf.putLong(src.getNativeOps());
    buf.putLong(dst.getNativeOps());
}
 
Example #4
Source File: RSLAPITest.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
private static void testContext(final AccelGraphicsConfig agc) {
    BufferedContext c = agc.getContext();
    final AccelDeviceEventListener l = new AccelDeviceEventListener() {
        public void onDeviceDispose() {
            System.out.println("onDeviceDispose invoked");
            agc.removeDeviceEventListener(this);
        }
        public void onDeviceReset() {
            System.out.println("onDeviceReset invoked");
        }
    };
    agc.addDeviceEventListener(l);

    RenderQueue rq = c.getRenderQueue();
    rq.lock();
    try {
        c.saveState();
        rq.flushNow();
        c.restoreState();
        rq.flushNow();
        System.out.println("Passed: Save/Restore");
    } finally {
        rq.unlock();
    }
}
 
Example #5
Source File: D3DBlitLoops.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Enqueues a BLIT operation with the given parameters.  Note that the
 * RenderQueue lock must be held before calling this method.
 */
private static void enqueueBlit(RenderQueue rq,
                                SurfaceData src, SurfaceData dst,
                                int packedParams,
                                int sx1, int sy1,
                                int sx2, int sy2,
                                double dx1, double dy1,
                                double dx2, double dy2)
{
    // assert rq.lock.isHeldByCurrentThread();
    RenderBuffer buf = rq.getBuffer();
    rq.ensureCapacityAndAlignment(72, 24);
    buf.putInt(BLIT);
    buf.putInt(packedParams);
    buf.putInt(sx1).putInt(sy1);
    buf.putInt(sx2).putInt(sy2);
    buf.putDouble(dx1).putDouble(dy1);
    buf.putDouble(dx2).putDouble(dy2);
    buf.putLong(src.getNativeOps());
    buf.putLong(dst.getNativeOps());
}
 
Example #6
Source File: RSLAPITest.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
private static void testContext(final AccelGraphicsConfig agc) {
    BufferedContext c = agc.getContext();
    final AccelDeviceEventListener l = new AccelDeviceEventListener() {
        public void onDeviceDispose() {
            System.out.println("onDeviceDispose invoked");
            agc.removeDeviceEventListener(this);
        }
        public void onDeviceReset() {
            System.out.println("onDeviceReset invoked");
        }
    };
    agc.addDeviceEventListener(l);

    RenderQueue rq = c.getRenderQueue();
    rq.lock();
    try {
        c.saveState();
        rq.flushNow();
        c.restoreState();
        rq.flushNow();
        System.out.println("Passed: Save/Restore");
    } finally {
        rq.unlock();
    }
}
 
Example #7
Source File: RSLAPITest.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
private static void testContext(final AccelGraphicsConfig agc) {
    BufferedContext c = agc.getContext();
    final AccelDeviceEventListener l = new AccelDeviceEventListener() {
        public void onDeviceDispose() {
            System.out.println("onDeviceDispose invoked");
            agc.removeDeviceEventListener(this);
        }
        public void onDeviceReset() {
            System.out.println("onDeviceReset invoked");
        }
    };
    agc.addDeviceEventListener(l);

    RenderQueue rq = c.getRenderQueue();
    rq.lock();
    try {
        c.saveState();
        rq.flushNow();
        c.restoreState();
        rq.flushNow();
        System.out.println("Passed: Save/Restore");
    } finally {
        rq.unlock();
    }
}
 
Example #8
Source File: D3DBlitLoops.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Enqueues a BLIT operation with the given parameters.  Note that the
 * RenderQueue lock must be held before calling this method.
 */
private static void enqueueBlit(RenderQueue rq,
                                SurfaceData src, SurfaceData dst,
                                int packedParams,
                                int sx1, int sy1,
                                int sx2, int sy2,
                                double dx1, double dy1,
                                double dx2, double dy2)
{
    // assert rq.lock.isHeldByCurrentThread();
    RenderBuffer buf = rq.getBuffer();
    rq.ensureCapacityAndAlignment(72, 24);
    buf.putInt(BLIT);
    buf.putInt(packedParams);
    buf.putInt(sx1).putInt(sy1);
    buf.putInt(sx2).putInt(sy2);
    buf.putDouble(dx1).putDouble(dy1);
    buf.putDouble(dx2).putDouble(dy2);
    buf.putLong(src.getNativeOps());
    buf.putLong(dst.getNativeOps());
}
 
Example #9
Source File: D3DBlitLoops.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Enqueues a BLIT operation with the given parameters.  Note that the
 * RenderQueue lock must be held before calling this method.
 */
private static void enqueueBlit(RenderQueue rq,
                                SurfaceData src, SurfaceData dst,
                                int packedParams,
                                int sx1, int sy1,
                                int sx2, int sy2,
                                double dx1, double dy1,
                                double dx2, double dy2)
{
    // assert rq.lock.isHeldByCurrentThread();
    RenderBuffer buf = rq.getBuffer();
    rq.ensureCapacityAndAlignment(72, 24);
    buf.putInt(BLIT);
    buf.putInt(packedParams);
    buf.putInt(sx1).putInt(sy1);
    buf.putInt(sx2).putInt(sy2);
    buf.putDouble(dx1).putDouble(dy1);
    buf.putDouble(dx2).putDouble(dy2);
    buf.putLong(src.getNativeOps());
    buf.putLong(dst.getNativeOps());
}
 
Example #10
Source File: OGLBlitLoops.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Enqueues a BLIT operation with the given parameters.  Note that the
 * RenderQueue lock must be held before calling this method.
 */
private static void enqueueBlit(RenderQueue rq,
                                SurfaceData src, SurfaceData dst,
                                int packedParams,
                                int sx1, int sy1,
                                int sx2, int sy2,
                                double dx1, double dy1,
                                double dx2, double dy2)
{
    // assert rq.lock.isHeldByCurrentThread();
    RenderBuffer buf = rq.getBuffer();
    rq.ensureCapacityAndAlignment(72, 24);
    buf.putInt(BLIT);
    buf.putInt(packedParams);
    buf.putInt(sx1).putInt(sy1);
    buf.putInt(sx2).putInt(sy2);
    buf.putDouble(dx1).putDouble(dy1);
    buf.putDouble(dx2).putDouble(dy2);
    buf.putLong(src.getNativeOps());
    buf.putLong(dst.getNativeOps());
}
 
Example #11
Source File: OGLBlitLoops.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Enqueues a BLIT operation with the given parameters.  Note that the
 * RenderQueue lock must be held before calling this method.
 */
private static void enqueueBlit(RenderQueue rq,
                                SurfaceData src, SurfaceData dst,
                                int packedParams,
                                int sx1, int sy1,
                                int sx2, int sy2,
                                double dx1, double dy1,
                                double dx2, double dy2)
{
    // assert rq.lock.isHeldByCurrentThread();
    RenderBuffer buf = rq.getBuffer();
    rq.ensureCapacityAndAlignment(72, 24);
    buf.putInt(BLIT);
    buf.putInt(packedParams);
    buf.putInt(sx1).putInt(sy1);
    buf.putInt(sx2).putInt(sy2);
    buf.putDouble(dx1).putDouble(dy1);
    buf.putDouble(dx2).putDouble(dy2);
    buf.putLong(src.getNativeOps());
    buf.putLong(dst.getNativeOps());
}
 
Example #12
Source File: RSLAPITest.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
private static void testContext(final AccelGraphicsConfig agc) {
    BufferedContext c = agc.getContext();
    final AccelDeviceEventListener l = new AccelDeviceEventListener() {
        public void onDeviceDispose() {
            System.out.println("onDeviceDispose invoked");
            agc.removeDeviceEventListener(this);
        }
        public void onDeviceReset() {
            System.out.println("onDeviceReset invoked");
        }
    };
    agc.addDeviceEventListener(l);

    RenderQueue rq = c.getRenderQueue();
    rq.lock();
    try {
        c.saveState();
        rq.flushNow();
        c.restoreState();
        rq.flushNow();
        System.out.println("Passed: Save/Restore");
    } finally {
        rq.unlock();
    }
}
 
Example #13
Source File: D3DBlitLoops.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Enqueues a BLIT operation with the given parameters.  Note that the
 * RenderQueue lock must be held before calling this method.
 */
private static void enqueueBlit(RenderQueue rq,
                                SurfaceData src, SurfaceData dst,
                                int packedParams,
                                int sx1, int sy1,
                                int sx2, int sy2,
                                double dx1, double dy1,
                                double dx2, double dy2)
{
    // assert rq.lock.isHeldByCurrentThread();
    RenderBuffer buf = rq.getBuffer();
    rq.ensureCapacityAndAlignment(72, 24);
    buf.putInt(BLIT);
    buf.putInt(packedParams);
    buf.putInt(sx1).putInt(sy1);
    buf.putInt(sx2).putInt(sy2);
    buf.putDouble(dx1).putDouble(dy1);
    buf.putDouble(dx2).putDouble(dy2);
    buf.putLong(src.getNativeOps());
    buf.putLong(dst.getNativeOps());
}
 
Example #14
Source File: RSLAPITest.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
private static void testContext(final AccelGraphicsConfig agc) {
    BufferedContext c = agc.getContext();
    final AccelDeviceEventListener l = new AccelDeviceEventListener() {
        public void onDeviceDispose() {
            System.out.println("onDeviceDispose invoked");
            agc.removeDeviceEventListener(this);
        }
        public void onDeviceReset() {
            System.out.println("onDeviceReset invoked");
        }
    };
    agc.addDeviceEventListener(l);

    RenderQueue rq = c.getRenderQueue();
    rq.lock();
    try {
        c.saveState();
        rq.flushNow();
        c.restoreState();
        rq.flushNow();
        System.out.println("Passed: Save/Restore");
    } finally {
        rq.unlock();
    }
}
 
Example #15
Source File: OGLBlitLoops.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Enqueues a BLIT operation with the given parameters.  Note that the
 * RenderQueue lock must be held before calling this method.
 */
private static void enqueueBlit(RenderQueue rq,
                                SurfaceData src, SurfaceData dst,
                                int packedParams,
                                int sx1, int sy1,
                                int sx2, int sy2,
                                double dx1, double dy1,
                                double dx2, double dy2)
{
    // assert rq.lock.isHeldByCurrentThread();
    RenderBuffer buf = rq.getBuffer();
    rq.ensureCapacityAndAlignment(72, 24);
    buf.putInt(BLIT);
    buf.putInt(packedParams);
    buf.putInt(sx1).putInt(sy1);
    buf.putInt(sx2).putInt(sy2);
    buf.putDouble(dx1).putDouble(dy1);
    buf.putDouble(dx2).putDouble(dy2);
    buf.putLong(src.getNativeOps());
    buf.putLong(dst.getNativeOps());
}
 
Example #16
Source File: RSLAPITest.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
private static void printSurface(Surface s) {
    if (s instanceof AccelSurface) {
        final AccelSurface surface = (AccelSurface) s;
        System.out.println(" Accel Surface: ");
        System.out.println("  type=" + surface.getType());
        System.out.println("  bounds=" + surface.getBounds());
        System.out.println("  nativeBounds=" + surface.getNativeBounds());
        System.out.println("  isSurfaceLost=" + surface.isSurfaceLost());
        System.out.println("  isValid=" + surface.isValid());
        RenderQueue rq = surface.getContext().getRenderQueue();
        rq.lock();
        try {
            rq.flushAndInvokeNow(new Runnable() {
                public void run() {
                    System.out.printf("  getNativeResource(TEXTURE)=0x%x\n",
                        surface.getNativeResource(TEXTURE));
                    System.out.printf("  getNativeResource(RT_TEXTURE)=0x%x\n",
                        surface.getNativeResource(RT_TEXTURE));
                    System.out.printf("  getNativeResource(RT_PLAIN)=0x%x\n",
                        surface.getNativeResource(RT_PLAIN));
                    System.out.printf(
                        "  getNativeResource(FLIP_BACKBUFFER)=0x%x\n",
                        surface.getNativeResource(FLIP_BACKBUFFER));

                    testD3DDeviceResourceField(surface);

                    testInvalidType(surface, -1);
                    testInvalidType(surface, -150);
                    testInvalidType(surface, 300);
                    testInvalidType(surface, Integer.MAX_VALUE);
                    testInvalidType(surface, Integer.MIN_VALUE);
                }
            });
        } finally {
            rq.unlock();
        }
    } else {
        System.out.println("null accelerated surface");
    }
}
 
Example #17
Source File: TranslucentWindowPainter.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected boolean update(Image bb) {
    if (bb instanceof DestSurfaceProvider) {
        Surface s = ((DestSurfaceProvider)bb).getDestSurface();
        if (s instanceof AccelSurface) {
            final int w = bb.getWidth(null);
            final int h = bb.getHeight(null);
            final boolean arr[] = { false };
            final AccelSurface as = (AccelSurface)s;
            RenderQueue rq = as.getContext().getRenderQueue();
            rq.lock();
            try {
                BufferedContext.validateContext(as);
                rq.flushAndInvokeNow(new Runnable() {
                    public void run() {
                        long psdops = as.getNativeOps();
                        arr[0] = updateWindowAccel(psdops, w, h);
                    }
                });
            } catch (InvalidPipeException e) {
                // ignore, false will be returned
            } finally {
                rq.unlock();
            }
            return arr[0];
        }
    }
    return super.update(bb);
}
 
Example #18
Source File: TranslucentWindowPainter.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected boolean update(Image bb) {
    if (bb instanceof DestSurfaceProvider) {
        Surface s = ((DestSurfaceProvider)bb).getDestSurface();
        if (s instanceof AccelSurface) {
            final int w = bb.getWidth(null);
            final int h = bb.getHeight(null);
            final boolean arr[] = { false };
            final AccelSurface as = (AccelSurface)s;
            RenderQueue rq = as.getContext().getRenderQueue();
            rq.lock();
            try {
                BufferedContext.validateContext(as);
                rq.flushAndInvokeNow(new Runnable() {
                    @Override
                    public void run() {
                        long psdops = as.getNativeOps();
                        arr[0] = updateWindowAccel(psdops, w, h);
                    }
                });
            } catch (InvalidPipeException e) {
                // ignore, false will be returned
            } finally {
                rq.unlock();
            }
            return arr[0];
        }
    }
    return super.update(bb);
}
 
Example #19
Source File: TranslucentWindowPainter.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected boolean update(Image bb) {
    if (bb instanceof DestSurfaceProvider) {
        Surface s = ((DestSurfaceProvider)bb).getDestSurface();
        if (s instanceof AccelSurface) {
            final boolean arr[] = { false };
            final AccelSurface as = (AccelSurface)s;
            final int w = as.getBounds().width;
            final int h = as.getBounds().height;
            RenderQueue rq = as.getContext().getRenderQueue();
            rq.lock();
            try {
                BufferedContext.validateContext(as);
                rq.flushAndInvokeNow(new Runnable() {
                    @Override
                    public void run() {
                        long psdops = as.getNativeOps();
                        arr[0] = updateWindowAccel(psdops, w, h);
                    }
                });
            } catch (InvalidPipeException e) {
                // ignore, false will be returned
            } finally {
                rq.unlock();
            }
            return arr[0];
        }
    }
    return super.update(bb);
}
 
Example #20
Source File: TranslucentWindowPainter.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected boolean update(Image bb) {
    if (bb instanceof DestSurfaceProvider) {
        Surface s = ((DestSurfaceProvider)bb).getDestSurface();
        if (s instanceof AccelSurface) {
            final int w = bb.getWidth(null);
            final int h = bb.getHeight(null);
            final boolean arr[] = { false };
            final AccelSurface as = (AccelSurface)s;
            RenderQueue rq = as.getContext().getRenderQueue();
            rq.lock();
            try {
                BufferedContext.validateContext(as);
                rq.flushAndInvokeNow(new Runnable() {
                    @Override
                    public void run() {
                        long psdops = as.getNativeOps();
                        arr[0] = updateWindowAccel(psdops, w, h);
                    }
                });
            } catch (InvalidPipeException e) {
                // ignore, false will be returned
            } finally {
                rq.unlock();
            }
            return arr[0];
        }
    }
    return super.update(bb);
}
 
Example #21
Source File: RSLAPITest.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
private static void printSurface(Surface s) {
    if (s instanceof AccelSurface) {
        final AccelSurface surface = (AccelSurface) s;
        System.out.println(" Accel Surface: ");
        System.out.println("  type=" + surface.getType());
        System.out.println("  bounds=" + surface.getBounds());
        System.out.println("  nativeBounds=" + surface.getNativeBounds());
        System.out.println("  isSurfaceLost=" + surface.isSurfaceLost());
        System.out.println("  isValid=" + surface.isValid());
        RenderQueue rq = surface.getContext().getRenderQueue();
        rq.lock();
        try {
            rq.flushAndInvokeNow(new Runnable() {
                public void run() {
                    System.out.printf("  getNativeResource(TEXTURE)=0x%x\n",
                        surface.getNativeResource(TEXTURE));
                    System.out.printf("  getNativeResource(RT_TEXTURE)=0x%x\n",
                        surface.getNativeResource(RT_TEXTURE));
                    System.out.printf("  getNativeResource(RT_PLAIN)=0x%x\n",
                        surface.getNativeResource(RT_PLAIN));
                    System.out.printf(
                        "  getNativeResource(FLIP_BACKBUFFER)=0x%x\n",
                        surface.getNativeResource(FLIP_BACKBUFFER));

                    testD3DDeviceResourceField(surface);

                    testInvalidType(surface, -1);
                    testInvalidType(surface, -150);
                    testInvalidType(surface, 300);
                    testInvalidType(surface, Integer.MAX_VALUE);
                    testInvalidType(surface, Integer.MIN_VALUE);
                }
            });
        } finally {
            rq.unlock();
        }
    } else {
        System.out.println("null accelerated surface");
    }
}
 
Example #22
Source File: TranslucentWindowPainter.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected boolean update(Image bb) {
    if (bb instanceof DestSurfaceProvider) {
        Surface s = ((DestSurfaceProvider)bb).getDestSurface();
        if (s instanceof AccelSurface) {
            final int w = bb.getWidth(null);
            final int h = bb.getHeight(null);
            final boolean arr[] = { false };
            final AccelSurface as = (AccelSurface)s;
            RenderQueue rq = as.getContext().getRenderQueue();
            rq.lock();
            try {
                BufferedContext.validateContext(as);
                rq.flushAndInvokeNow(new Runnable() {
                    @Override
                    public void run() {
                        long psdops = as.getNativeOps();
                        arr[0] = updateWindowAccel(psdops, w, h);
                    }
                });
            } catch (InvalidPipeException e) {
                // ignore, false will be returned
            } finally {
                rq.unlock();
            }
            return arr[0];
        }
    }
    return super.update(bb);
}
 
Example #23
Source File: RSLAPITest.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
private static void printSurface(Surface s) {
    if (s instanceof AccelSurface) {
        final AccelSurface surface = (AccelSurface) s;
        System.out.println(" Accel Surface: ");
        System.out.println("  type=" + surface.getType());
        System.out.println("  bounds=" + surface.getBounds());
        System.out.println("  nativeBounds=" + surface.getNativeBounds());
        System.out.println("  isSurfaceLost=" + surface.isSurfaceLost());
        System.out.println("  isValid=" + surface.isValid());
        RenderQueue rq = surface.getContext().getRenderQueue();
        rq.lock();
        try {
            rq.flushAndInvokeNow(new Runnable() {
                public void run() {
                    System.out.printf("  getNativeResource(TEXTURE)=0x%x\n",
                        surface.getNativeResource(TEXTURE));
                    System.out.printf("  getNativeResource(RT_TEXTURE)=0x%x\n",
                        surface.getNativeResource(RT_TEXTURE));
                    System.out.printf("  getNativeResource(RT_PLAIN)=0x%x\n",
                        surface.getNativeResource(RT_PLAIN));
                    System.out.printf(
                        "  getNativeResource(FLIP_BACKBUFFER)=0x%x\n",
                        surface.getNativeResource(FLIP_BACKBUFFER));

                    testD3DDeviceResourceField(surface);

                    testInvalidType(surface, -1);
                    testInvalidType(surface, -150);
                    testInvalidType(surface, 300);
                    testInvalidType(surface, Integer.MAX_VALUE);
                    testInvalidType(surface, Integer.MIN_VALUE);
                }
            });
        } finally {
            rq.unlock();
        }
    } else {
        System.out.println("null accelerated surface");
    }
}
 
Example #24
Source File: TranslucentWindowPainter.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected boolean update(Image bb) {
    if (bb instanceof DestSurfaceProvider) {
        Surface s = ((DestSurfaceProvider)bb).getDestSurface();
        if (s instanceof AccelSurface) {
            final int w = bb.getWidth(null);
            final int h = bb.getHeight(null);
            final boolean arr[] = { false };
            final AccelSurface as = (AccelSurface)s;
            RenderQueue rq = as.getContext().getRenderQueue();
            rq.lock();
            try {
                BufferedContext.validateContext(as);
                rq.flushAndInvokeNow(new Runnable() {
                    @Override
                    public void run() {
                        long psdops = as.getNativeOps();
                        arr[0] = updateWindowAccel(psdops, w, h);
                    }
                });
            } catch (InvalidPipeException e) {
                // ignore, false will be returned
            } finally {
                rq.unlock();
            }
            return arr[0];
        }
    }
    return super.update(bb);
}
 
Example #25
Source File: TranslucentWindowPainter.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected boolean update(Image bb) {
    if (bb instanceof DestSurfaceProvider) {
        Surface s = ((DestSurfaceProvider)bb).getDestSurface();
        if (s instanceof AccelSurface) {
            final int w = bb.getWidth(null);
            final int h = bb.getHeight(null);
            final boolean arr[] = { false };
            final AccelSurface as = (AccelSurface)s;
            RenderQueue rq = as.getContext().getRenderQueue();
            rq.lock();
            try {
                BufferedContext.validateContext(as);
                rq.flushAndInvokeNow(new Runnable() {
                    @Override
                    public void run() {
                        long psdops = as.getNativeOps();
                        arr[0] = updateWindowAccel(psdops, w, h);
                    }
                });
            } catch (InvalidPipeException e) {
                // ignore, false will be returned
            } finally {
                rq.unlock();
            }
            return arr[0];
        }
    }
    return super.update(bb);
}
 
Example #26
Source File: TranslucentWindowPainter.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected boolean update(Image bb) {
    if (bb instanceof DestSurfaceProvider) {
        Surface s = ((DestSurfaceProvider)bb).getDestSurface();
        if (s instanceof AccelSurface) {
            final int w = bb.getWidth(null);
            final int h = bb.getHeight(null);
            final boolean arr[] = { false };
            final AccelSurface as = (AccelSurface)s;
            RenderQueue rq = as.getContext().getRenderQueue();
            rq.lock();
            try {
                BufferedContext.validateContext(as);
                rq.flushAndInvokeNow(new Runnable() {
                    @Override
                    public void run() {
                        long psdops = as.getNativeOps();
                        arr[0] = updateWindowAccel(psdops, w, h);
                    }
                });
            } catch (InvalidPipeException e) {
                // ignore, false will be returned
            } finally {
                rq.unlock();
            }
            return arr[0];
        }
    }
    return super.update(bb);
}
 
Example #27
Source File: RSLAPITest.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
private static void printSurface(Surface s) {
    if (s instanceof AccelSurface) {
        final AccelSurface surface = (AccelSurface) s;
        System.out.println(" Accel Surface: ");
        System.out.println("  type=" + surface.getType());
        System.out.println("  bounds=" + surface.getBounds());
        System.out.println("  nativeBounds=" + surface.getNativeBounds());
        System.out.println("  isSurfaceLost=" + surface.isSurfaceLost());
        System.out.println("  isValid=" + surface.isValid());
        RenderQueue rq = surface.getContext().getRenderQueue();
        rq.lock();
        try {
            rq.flushAndInvokeNow(new Runnable() {
                public void run() {
                    System.out.printf("  getNativeResource(TEXTURE)=0x%x\n",
                        surface.getNativeResource(TEXTURE));
                    System.out.printf("  getNativeResource(RT_TEXTURE)=0x%x\n",
                        surface.getNativeResource(RT_TEXTURE));
                    System.out.printf("  getNativeResource(RT_PLAIN)=0x%x\n",
                        surface.getNativeResource(RT_PLAIN));
                    System.out.printf(
                        "  getNativeResource(FLIP_BACKBUFFER)=0x%x\n",
                        surface.getNativeResource(FLIP_BACKBUFFER));

                    testD3DDeviceResourceField(surface);

                    testInvalidType(surface, -1);
                    testInvalidType(surface, -150);
                    testInvalidType(surface, 300);
                    testInvalidType(surface, Integer.MAX_VALUE);
                    testInvalidType(surface, Integer.MIN_VALUE);
                }
            });
        } finally {
            rq.unlock();
        }
    } else {
        System.out.println("null accelerated surface");
    }
}
 
Example #28
Source File: RSLAPITest.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
private static void printSurface(Surface s) {
    if (s instanceof AccelSurface) {
        final AccelSurface surface = (AccelSurface) s;
        System.out.println(" Accel Surface: ");
        System.out.println("  type=" + surface.getType());
        System.out.println("  bounds=" + surface.getBounds());
        System.out.println("  nativeBounds=" + surface.getNativeBounds());
        System.out.println("  isSurfaceLost=" + surface.isSurfaceLost());
        System.out.println("  isValid=" + surface.isValid());
        RenderQueue rq = surface.getContext().getRenderQueue();
        rq.lock();
        try {
            rq.flushAndInvokeNow(new Runnable() {
                public void run() {
                    System.out.printf("  getNativeResource(TEXTURE)=0x%x\n",
                        surface.getNativeResource(TEXTURE));
                    System.out.printf("  getNativeResource(RT_TEXTURE)=0x%x\n",
                        surface.getNativeResource(RT_TEXTURE));
                    System.out.printf("  getNativeResource(RT_PLAIN)=0x%x\n",
                        surface.getNativeResource(RT_PLAIN));
                    System.out.printf(
                        "  getNativeResource(FLIP_BACKBUFFER)=0x%x\n",
                        surface.getNativeResource(FLIP_BACKBUFFER));

                    testD3DDeviceResourceField(surface);

                    testInvalidType(surface, -1);
                    testInvalidType(surface, -150);
                    testInvalidType(surface, 300);
                    testInvalidType(surface, Integer.MAX_VALUE);
                    testInvalidType(surface, Integer.MIN_VALUE);
                }
            });
        } finally {
            rq.unlock();
        }
    } else {
        System.out.println("null accelerated surface");
    }
}
 
Example #29
Source File: RSLContextInvalidationTest.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
public static void main(String[] args) {
    GraphicsEnvironment ge =
        GraphicsEnvironment.getLocalGraphicsEnvironment();
    GraphicsDevice gd = ge.getDefaultScreenDevice();
    GraphicsConfiguration gc = gd.getDefaultConfiguration();
    VolatileImage vi = gc.createCompatibleVolatileImage(100, 100);
    vi.validate(gc);
    VolatileImage vi1 = gc.createCompatibleVolatileImage(100, 100);
    vi1.validate(gc);

    if (!(vi instanceof DestSurfaceProvider)) {
        System.out.println("Test considered PASSED: no HW acceleration");
        return;
    }

    DestSurfaceProvider p = (DestSurfaceProvider)vi;
    Surface s = p.getDestSurface();
    if (!(s instanceof AccelSurface)) {
        System.out.println("Test considered PASSED: no HW acceleration");
        return;
    }
    AccelSurface dst = (AccelSurface)s;

    Graphics g = vi.createGraphics();
    g.drawImage(vi1, 95, 95, null);
    g.setColor(Color.red);
    g.fillRect(0, 0, 100, 100);
    g.setColor(Color.black);
    g.fillRect(0, 0, 100, 100);
    // after this the validated context color is black

    RenderQueue rq = dst.getContext().getRenderQueue();
    rq.lock();
    try {
        dst.getContext().saveState();
        dst.getContext().restoreState();
    } finally {
        rq.unlock();
    }

    // this will cause ResetPaint (it will set color to extended EA=ff,
    // which is ffffffff==Color.white)
    g.drawImage(vi1, 95, 95, null);

    // now try filling with black again, but it will come up as white
    // because this fill rect won't validate the color properly
    g.setColor(Color.black);
    g.fillRect(0, 0, 100, 100);

    BufferedImage bi = vi.getSnapshot();
    if (bi.getRGB(50, 50) != Color.black.getRGB()) {
        throw new RuntimeException("Test FAILED: found color="+
            Integer.toHexString(bi.getRGB(50, 50))+" instead of "+
            Integer.toHexString(Color.black.getRGB()));
    }

    System.out.println("Test PASSED.");
}
 
Example #30
Source File: OGLContext.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
public RenderQueue getRenderQueue() {
    return OGLRenderQueue.getInstance();
}