sun.java2d.pipe.hw.AccelSurface Java Examples

The following examples show how to use sun.java2d.pipe.hw.AccelSurface. 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: WGLGraphicsConfig.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * {@inheritDoc}
 *
 * @see sun.java2d.pipe.hw.AccelGraphicsConfig#createCompatibleVolatileImage
 */
@Override
public VolatileImage
    createCompatibleVolatileImage(int width, int height,
                                  int transparency, int type)
{
    if ((type != FBOBJECT && type != TEXTURE)
            || transparency == Transparency.BITMASK
            || type == FBOBJECT && !isCapPresent(CAPS_EXT_FBOBJECT)) {
        return null;
    }
    SunVolatileImage vi = new AccelTypedVolatileImage(this, width, height,
                                                      transparency, type);
    Surface sd = vi.getDestSurface();
    if (!(sd instanceof AccelSurface) ||
        ((AccelSurface)sd).getType() != type)
    {
        vi.flush();
        vi = null;
    }

    return vi;
}
 
Example #2
Source File: GLXGraphicsConfig.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * {@inheritDoc}
 *
 * @see sun.java2d.pipe.hw.AccelGraphicsConfig#createCompatibleVolatileImage
 */
@Override
public VolatileImage
    createCompatibleVolatileImage(int width, int height,
                                  int transparency, int type)
{
    if ((type != FBOBJECT && type != TEXTURE)
            || transparency == Transparency.BITMASK
            || type == FBOBJECT && !isCapPresent(CAPS_EXT_FBOBJECT)) {
        return null;
    }
    SunVolatileImage vi = new AccelTypedVolatileImage(this, width, height,
                                                      transparency, type);
    Surface sd = vi.getDestSurface();
    if (!(sd instanceof AccelSurface) ||
        ((AccelSurface)sd).getType() != type)
    {
        vi.flush();
        vi = null;
    }

    return vi;
}
 
Example #3
Source File: RSLAPITest.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
private static void testGC(GraphicsConfiguration gc) {
    if (!(gc instanceof AccelGraphicsConfig)) {
        System.out.println("Test passed: no hw accelerated configs found.");
        return;
    }
    System.out.println("AccelGraphicsConfig exists, testing.");
    AccelGraphicsConfig agc = (AccelGraphicsConfig) gc;
    printAGC(agc);

    testContext(agc);

    VolatileImage vi = gc.createCompatibleVolatileImage(10, 10);
    vi.validate(gc);
    if (vi instanceof DestSurfaceProvider) {
        System.out.println("Passed: VI is DestSurfaceProvider");
        Surface s = ((DestSurfaceProvider) vi).getDestSurface();
        if (s instanceof AccelSurface) {
            System.out.println("Passed: Obtained Accel Surface");
            printSurface((AccelSurface) s);
        }
        Graphics g = vi.getGraphics();
        if (g instanceof DestSurfaceProvider) {
            System.out.println("Passed: VI graphics is " +
                               "DestSurfaceProvider");
            printSurface(((DestSurfaceProvider) g).getDestSurface());
        }
    } else {
        System.out.println("VI is not DestSurfaceProvider");
    }
    testVICreation(agc, CAPS_RT_TEXTURE_ALPHA, TRANSLUCENT, RT_TEXTURE);
    testVICreation(agc, CAPS_RT_TEXTURE_OPAQUE, OPAQUE, RT_TEXTURE);
    testVICreation(agc, CAPS_RT_PLAIN_ALPHA, TRANSLUCENT, RT_PLAIN);
    testVICreation(agc, agc.getContextCapabilities().getCaps(), OPAQUE,
                   TEXTURE);
    testForNPEDuringCreation(agc);
}
 
Example #4
Source File: WGLGraphicsConfig.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 *
 * @see sun.java2d.pipe.hw.AccelGraphicsConfig#createCompatibleVolatileImage
 */
@Override
public VolatileImage
    createCompatibleVolatileImage(int width, int height,
                                  int transparency, int type)
{
    if (type == FLIP_BACKBUFFER || type == WINDOW || type == UNDEFINED ||
        transparency == Transparency.BITMASK)
    {
        return null;
    }

    if (type == FBOBJECT) {
        if (!isCapPresent(CAPS_EXT_FBOBJECT)) {
            return null;
        }
    } else if (type == PBUFFER) {
        boolean isOpaque = transparency == Transparency.OPAQUE;
        if (!isOpaque && !isCapPresent(CAPS_STORED_ALPHA)) {
            return null;
        }
    }

    SunVolatileImage vi = new AccelTypedVolatileImage(this, width, height,
                                                      transparency, type);
    Surface sd = vi.getDestSurface();
    if (!(sd instanceof AccelSurface) ||
        ((AccelSurface)sd).getType() != type)
    {
        vi.flush();
        vi = null;
    }

    return vi;
}
 
Example #5
Source File: CGLGraphicsConfig.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
@Override
public VolatileImage createCompatibleVolatileImage(int width, int height,
                                                   int transparency,
                                                   int type) {
    if (type == FLIP_BACKBUFFER || type == WINDOW || type == UNDEFINED ||
        transparency == Transparency.BITMASK)
    {
        return null;
    }

    if (type == FBOBJECT) {
        if (!isCapPresent(CAPS_EXT_FBOBJECT)) {
            return null;
        }
    } else if (type == PBUFFER) {
        boolean isOpaque = transparency == Transparency.OPAQUE;
        if (!isOpaque && !isCapPresent(CAPS_STORED_ALPHA)) {
            return null;
        }
    }

    SunVolatileImage vi = new AccelTypedVolatileImage(this, width, height,
                                                      transparency, type);
    Surface sd = vi.getDestSurface();
    if (!(sd instanceof AccelSurface) ||
        ((AccelSurface)sd).getType() != type)
    {
        vi.flush();
        vi = null;
    }

    return vi;
}
 
Example #6
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 #7
Source File: RSLAPITest.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
private static void testInvalidType(AccelSurface surface, int type) {
    long ret = surface.getNativeResource(type);
    System.out.printf("  getNativeResource(%d)=0x%x\n", type, ret);
    if (ret != 0l) {
        System.err.printf(
                "FAILED: surface.getNativeResource(%d) returned" +
                " 0x%s. It should have have returned 0L\n",
                type, ret);
        failed = true;
    }
}
 
Example #8
Source File: D3DGraphicsConfig.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 *
 * @see sun.java2d.pipe.hw.AccelGraphicsConfig#createCompatibleVolatileImage
 */
@Override
public VolatileImage
    createCompatibleVolatileImage(int width, int height,
                                  int transparency, int type)
{
    if (type == FLIP_BACKBUFFER || type == WINDOW || type == UNDEFINED ||
        transparency == Transparency.BITMASK)
    {
        return null;
    }
    boolean isOpaque = transparency == Transparency.OPAQUE;
    if (type == RT_TEXTURE) {
        int cap = isOpaque ? CAPS_RT_TEXTURE_OPAQUE : CAPS_RT_TEXTURE_ALPHA;
        if (!device.isCapPresent(cap)) {
            return null;
        }
    } else if (type == RT_PLAIN) {
        if (!isOpaque && !device.isCapPresent(CAPS_RT_PLAIN_ALPHA)) {
            return null;
        }
    }

    SunVolatileImage vi = new AccelTypedVolatileImage(this, width, height,
                                                      transparency, type);
    Surface sd = vi.getDestSurface();
    if (!(sd instanceof AccelSurface) ||
        ((AccelSurface)sd).getType() != type)
    {
        vi.flush();
        vi = null;
    }

    return vi;
}
 
Example #9
Source File: RSLAPITest.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
private static void testGC(GraphicsConfiguration gc) {
    if (!(gc instanceof AccelGraphicsConfig)) {
        System.out.println("Test passed: no hw accelerated configs found.");
        return;
    }
    System.out.println("AccelGraphicsConfig exists, testing.");
    AccelGraphicsConfig agc = (AccelGraphicsConfig) gc;
    printAGC(agc);

    testContext(agc);

    VolatileImage vi = gc.createCompatibleVolatileImage(10, 10);
    vi.validate(gc);
    if (vi instanceof DestSurfaceProvider) {
        System.out.println("Passed: VI is DestSurfaceProvider");
        Surface s = ((DestSurfaceProvider) vi).getDestSurface();
        if (s instanceof AccelSurface) {
            System.out.println("Passed: Obtained Accel Surface");
            printSurface((AccelSurface) s);
        }
        Graphics g = vi.getGraphics();
        if (g instanceof DestSurfaceProvider) {
            System.out.println("Passed: VI graphics is " +
                               "DestSurfaceProvider");
            printSurface(((DestSurfaceProvider) g).getDestSurface());
        }
    } else {
        System.out.println("VI is not DestSurfaceProvider");
    }
    testVICreation(agc, CAPS_RT_TEXTURE_ALPHA, TRANSLUCENT, RT_TEXTURE);
    testVICreation(agc, CAPS_RT_TEXTURE_OPAQUE, OPAQUE, RT_TEXTURE);
    testVICreation(agc, CAPS_RT_PLAIN_ALPHA, TRANSLUCENT, RT_PLAIN);
    testVICreation(agc, agc.getContextCapabilities().getCaps(), OPAQUE,
                   TEXTURE);
    testForNPEDuringCreation(agc);
}
 
Example #10
Source File: RSLAPITest.java    From openjdk-jdk8u-backup 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 #11
Source File: RSLAPITest.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
private static void testGC(GraphicsConfiguration gc) {
    if (!(gc instanceof AccelGraphicsConfig)) {
        System.out.println("Test passed: no hw accelerated configs found.");
        return;
    }
    System.out.println("AccelGraphicsConfig exists, testing.");
    AccelGraphicsConfig agc = (AccelGraphicsConfig) gc;
    printAGC(agc);

    testContext(agc);

    VolatileImage vi = gc.createCompatibleVolatileImage(10, 10);
    vi.validate(gc);
    if (vi instanceof DestSurfaceProvider) {
        System.out.println("Passed: VI is DestSurfaceProvider");
        Surface s = ((DestSurfaceProvider) vi).getDestSurface();
        if (s instanceof AccelSurface) {
            System.out.println("Passed: Obtained Accel Surface");
            printSurface((AccelSurface) s);
        }
        Graphics g = vi.getGraphics();
        if (g instanceof DestSurfaceProvider) {
            System.out.println("Passed: VI graphics is " +
                               "DestSurfaceProvider");
            printSurface(((DestSurfaceProvider) g).getDestSurface());
        }
    } else {
        System.out.println("VI is not DestSurfaceProvider");
    }
    testVICreation(agc, CAPS_RT_TEXTURE_ALPHA, TRANSLUCENT, RT_TEXTURE);
    testVICreation(agc, CAPS_RT_TEXTURE_OPAQUE, OPAQUE, RT_TEXTURE);
    testVICreation(agc, CAPS_RT_PLAIN_ALPHA, TRANSLUCENT, RT_PLAIN);
    testVICreation(agc, agc.getContextCapabilities().getCaps(), OPAQUE,
                   TEXTURE);
    testForNPEDuringCreation(agc);
}
 
Example #12
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 #13
Source File: GLXGraphicsConfig.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 *
 * @see sun.java2d.pipe.hw.AccelGraphicsConfig#createCompatibleVolatileImage
 */
@Override
public VolatileImage
    createCompatibleVolatileImage(int width, int height,
                                  int transparency, int type)
{
    if (type == FLIP_BACKBUFFER || type == WINDOW || type == UNDEFINED ||
        transparency == Transparency.BITMASK)
    {
        return null;
    }

    if (type == FBOBJECT) {
        if (!isCapPresent(CAPS_EXT_FBOBJECT)) {
            return null;
        }
    } else if (type == PBUFFER) {
        boolean isOpaque = transparency == Transparency.OPAQUE;
        if (!isOpaque && !isCapPresent(CAPS_STORED_ALPHA)) {
            return null;
        }
    }

    SunVolatileImage vi = new AccelTypedVolatileImage(this, width, height,
                                                      transparency, type);
    Surface sd = vi.getDestSurface();
    if (!(sd instanceof AccelSurface) ||
        ((AccelSurface)sd).getType() != type)
    {
        vi.flush();
        vi = null;
    }

    return vi;
}
 
Example #14
Source File: BufferedContext.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
private void setSurfaces(AccelSurface srcData,
                         AccelSurface dstData)
{
    // assert rq.lock.isHeldByCurrentThread();
    rq.ensureCapacityAndAlignment(20, 4);
    buf.putInt(SET_SURFACES);
    buf.putLong(srcData.getNativeOps());
    buf.putLong(dstData.getNativeOps());
}
 
Example #15
Source File: BufferedContext.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private void setSurfaces(AccelSurface srcData,
                         AccelSurface dstData)
{
    // assert rq.lock.isHeldByCurrentThread();
    rq.ensureCapacityAndAlignment(20, 4);
    buf.putInt(SET_SURFACES);
    buf.putLong(srcData.getNativeOps());
    buf.putLong(dstData.getNativeOps());
}
 
Example #16
Source File: GLXGraphicsConfig.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 *
 * @see sun.java2d.pipe.hw.AccelGraphicsConfig#createCompatibleVolatileImage
 */
@Override
public VolatileImage
    createCompatibleVolatileImage(int width, int height,
                                  int transparency, int type)
{
    if (type == FLIP_BACKBUFFER || type == WINDOW || type == UNDEFINED ||
        transparency == Transparency.BITMASK)
    {
        return null;
    }

    if (type == FBOBJECT) {
        if (!isCapPresent(CAPS_EXT_FBOBJECT)) {
            return null;
        }
    } else if (type == PBUFFER) {
        boolean isOpaque = transparency == Transparency.OPAQUE;
        if (!isOpaque && !isCapPresent(CAPS_STORED_ALPHA)) {
            return null;
        }
    }

    SunVolatileImage vi = new AccelTypedVolatileImage(this, width, height,
                                                      transparency, type);
    Surface sd = vi.getDestSurface();
    if (!(sd instanceof AccelSurface) ||
        ((AccelSurface)sd).getType() != type)
    {
        vi.flush();
        vi = null;
    }

    return vi;
}
 
Example #17
Source File: D3DGraphicsConfig.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 *
 * @see sun.java2d.pipe.hw.AccelGraphicsConfig#createCompatibleVolatileImage
 */
@Override
public VolatileImage
    createCompatibleVolatileImage(int width, int height,
                                  int transparency, int type)
{
    if (type == FLIP_BACKBUFFER || type == WINDOW || type == UNDEFINED ||
        transparency == Transparency.BITMASK)
    {
        return null;
    }
    boolean isOpaque = transparency == Transparency.OPAQUE;
    if (type == RT_TEXTURE) {
        int cap = isOpaque ? CAPS_RT_TEXTURE_OPAQUE : CAPS_RT_TEXTURE_ALPHA;
        if (!device.isCapPresent(cap)) {
            return null;
        }
    } else if (type == RT_PLAIN) {
        if (!isOpaque && !device.isCapPresent(CAPS_RT_PLAIN_ALPHA)) {
            return null;
        }
    }

    SunVolatileImage vi = new AccelTypedVolatileImage(this, width, height,
                                                      transparency, type);
    Surface sd = vi.getDestSurface();
    if (!(sd instanceof AccelSurface) ||
        ((AccelSurface)sd).getType() != type)
    {
        vi.flush();
        vi = null;
    }

    return vi;
}
 
Example #18
Source File: D3DGraphicsConfig.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 *
 * @see sun.java2d.pipe.hw.AccelGraphicsConfig#createCompatibleVolatileImage
 */
@Override
public VolatileImage
    createCompatibleVolatileImage(int width, int height,
                                  int transparency, int type)
{
    if (type == FLIP_BACKBUFFER || type == WINDOW || type == UNDEFINED ||
        transparency == Transparency.BITMASK)
    {
        return null;
    }
    boolean isOpaque = transparency == Transparency.OPAQUE;
    if (type == RT_TEXTURE) {
        int cap = isOpaque ? CAPS_RT_TEXTURE_OPAQUE : CAPS_RT_TEXTURE_ALPHA;
        if (!device.isCapPresent(cap)) {
            return null;
        }
    } else if (type == RT_PLAIN) {
        if (!isOpaque && !device.isCapPresent(CAPS_RT_PLAIN_ALPHA)) {
            return null;
        }
    }

    SunVolatileImage vi = new AccelTypedVolatileImage(this, width, height,
                                                      transparency, type);
    Surface sd = vi.getDestSurface();
    if (!(sd instanceof AccelSurface) ||
        ((AccelSurface)sd).getType() != type)
    {
        vi.flush();
        vi = null;
    }

    return vi;
}
 
Example #19
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 #20
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 #21
Source File: GLXGraphicsConfig.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 *
 * @see sun.java2d.pipe.hw.AccelGraphicsConfig#createCompatibleVolatileImage
 */
@Override
public VolatileImage
    createCompatibleVolatileImage(int width, int height,
                                  int transparency, int type)
{
    if (type == FLIP_BACKBUFFER || type == WINDOW || type == UNDEFINED ||
        transparency == Transparency.BITMASK)
    {
        return null;
    }

    if (type == FBOBJECT) {
        if (!isCapPresent(CAPS_EXT_FBOBJECT)) {
            return null;
        }
    } else if (type == PBUFFER) {
        boolean isOpaque = transparency == Transparency.OPAQUE;
        if (!isOpaque && !isCapPresent(CAPS_STORED_ALPHA)) {
            return null;
        }
    }

    SunVolatileImage vi = new AccelTypedVolatileImage(this, width, height,
                                                      transparency, type);
    Surface sd = vi.getDestSurface();
    if (!(sd instanceof AccelSurface) ||
        ((AccelSurface)sd).getType() != type)
    {
        vi.flush();
        vi = null;
    }

    return vi;
}
 
Example #22
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 #23
Source File: WGLGraphicsConfig.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 *
 * @see sun.java2d.pipe.hw.AccelGraphicsConfig#createCompatibleVolatileImage
 */
@Override
public VolatileImage
    createCompatibleVolatileImage(int width, int height,
                                  int transparency, int type)
{
    if (type == FLIP_BACKBUFFER || type == WINDOW || type == UNDEFINED ||
        transparency == Transparency.BITMASK)
    {
        return null;
    }

    if (type == FBOBJECT) {
        if (!isCapPresent(CAPS_EXT_FBOBJECT)) {
            return null;
        }
    } else if (type == PBUFFER) {
        boolean isOpaque = transparency == Transparency.OPAQUE;
        if (!isOpaque && !isCapPresent(CAPS_STORED_ALPHA)) {
            return null;
        }
    }

    SunVolatileImage vi = new AccelTypedVolatileImage(this, width, height,
                                                      transparency, type);
    Surface sd = vi.getDestSurface();
    if (!(sd instanceof AccelSurface) ||
        ((AccelSurface)sd).getType() != type)
    {
        vi.flush();
        vi = null;
    }

    return vi;
}
 
Example #24
Source File: D3DGraphicsConfig.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 *
 * @see sun.java2d.pipe.hw.AccelGraphicsConfig#createCompatibleVolatileImage
 */
@Override
public VolatileImage
    createCompatibleVolatileImage(int width, int height,
                                  int transparency, int type)
{
    if (type == FLIP_BACKBUFFER || type == WINDOW || type == UNDEFINED ||
        transparency == Transparency.BITMASK)
    {
        return null;
    }
    boolean isOpaque = transparency == Transparency.OPAQUE;
    if (type == RT_TEXTURE) {
        int cap = isOpaque ? CAPS_RT_TEXTURE_OPAQUE : CAPS_RT_TEXTURE_ALPHA;
        if (!device.isCapPresent(cap)) {
            return null;
        }
    } else if (type == RT_PLAIN) {
        if (!isOpaque && !device.isCapPresent(CAPS_RT_PLAIN_ALPHA)) {
            return null;
        }
    }

    SunVolatileImage vi = new AccelTypedVolatileImage(this, width, height,
                                                      transparency, type);
    Surface sd = vi.getDestSurface();
    if (!(sd instanceof AccelSurface) ||
        ((AccelSurface)sd).getType() != type)
    {
        vi.flush();
        vi = null;
    }

    return vi;
}
 
Example #25
Source File: CGLGraphicsConfig.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
@Override
public VolatileImage createCompatibleVolatileImage(int width, int height,
                                                   int transparency,
                                                   int type) {
    if (type == FLIP_BACKBUFFER || type == WINDOW || type == UNDEFINED ||
        transparency == Transparency.BITMASK)
    {
        return null;
    }

    if (type == FBOBJECT) {
        if (!isCapPresent(CAPS_EXT_FBOBJECT)) {
            return null;
        }
    } else if (type == PBUFFER) {
        boolean isOpaque = transparency == Transparency.OPAQUE;
        if (!isOpaque && !isCapPresent(CAPS_STORED_ALPHA)) {
            return null;
        }
    }

    SunVolatileImage vi = new AccelTypedVolatileImage(this, width, height,
                                                      transparency, type);
    Surface sd = vi.getDestSurface();
    if (!(sd instanceof AccelSurface) ||
        ((AccelSurface)sd).getType() != type)
    {
        vi.flush();
        vi = null;
    }

    return vi;
}
 
Example #26
Source File: WGLGraphicsConfig.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 *
 * @see sun.java2d.pipe.hw.AccelGraphicsConfig#createCompatibleVolatileImage
 */
@Override
public VolatileImage
    createCompatibleVolatileImage(int width, int height,
                                  int transparency, int type)
{
    if (type == FLIP_BACKBUFFER || type == WINDOW || type == UNDEFINED ||
        transparency == Transparency.BITMASK)
    {
        return null;
    }

    if (type == FBOBJECT) {
        if (!isCapPresent(CAPS_EXT_FBOBJECT)) {
            return null;
        }
    } else if (type == PBUFFER) {
        boolean isOpaque = transparency == Transparency.OPAQUE;
        if (!isOpaque && !isCapPresent(CAPS_STORED_ALPHA)) {
            return null;
        }
    }

    SunVolatileImage vi = new AccelTypedVolatileImage(this, width, height,
                                                      transparency, type);
    Surface sd = vi.getDestSurface();
    if (!(sd instanceof AccelSurface) ||
        ((AccelSurface)sd).getType() != type)
    {
        vi.flush();
        vi = null;
    }

    return vi;
}
 
Example #27
Source File: CGLGraphicsConfig.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
@Override
public VolatileImage createCompatibleVolatileImage(int width, int height,
                                                   int transparency,
                                                   int type) {
    if (type == FLIP_BACKBUFFER || type == WINDOW || type == UNDEFINED ||
        transparency == Transparency.BITMASK)
    {
        return null;
    }

    if (type == FBOBJECT) {
        if (!isCapPresent(CAPS_EXT_FBOBJECT)) {
            return null;
        }
    } else if (type == PBUFFER) {
        boolean isOpaque = transparency == Transparency.OPAQUE;
        if (!isOpaque && !isCapPresent(CAPS_STORED_ALPHA)) {
            return null;
        }
    }

    SunVolatileImage vi = new AccelTypedVolatileImage(this, width, height,
                                                      transparency, type);
    Surface sd = vi.getDestSurface();
    if (!(sd instanceof AccelSurface) ||
        ((AccelSurface)sd).getType() != type)
    {
        vi.flush();
        vi = null;
    }

    return vi;
}
 
Example #28
Source File: BufferedContext.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
private void setSurfaces(AccelSurface srcData,
                         AccelSurface dstData)
{
    // assert rq.lock.isHeldByCurrentThread();
    rq.ensureCapacityAndAlignment(20, 4);
    buf.putInt(SET_SURFACES);
    buf.putLong(srcData.getNativeOps());
    buf.putLong(dstData.getNativeOps());
}
 
Example #29
Source File: RSLAPITest.java    From openjdk-8-source 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 #30
Source File: RSLAPITest.java    From jdk8u60 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");
    }
}