Search in sources :

Example 6 with AccelSurface

use of sun.java2d.pipe.hw.AccelSurface in project jdk8u_jdk by JetBrains.

the class CGLGraphicsConfig method 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;
}
Also used : AccelSurface(sun.java2d.pipe.hw.AccelSurface) SunVolatileImage(sun.awt.image.SunVolatileImage) AccelTypedVolatileImage(sun.java2d.pipe.hw.AccelTypedVolatileImage) Surface(sun.java2d.Surface) AccelSurface(sun.java2d.pipe.hw.AccelSurface)

Example 7 with AccelSurface

use of sun.java2d.pipe.hw.AccelSurface in project jdk8u_jdk by JetBrains.

the class WGLGraphicsConfig method createCompatibleVolatileImage.

/**
     * {@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;
}
Also used : AccelSurface(sun.java2d.pipe.hw.AccelSurface) SunVolatileImage(sun.awt.image.SunVolatileImage) AccelTypedVolatileImage(sun.java2d.pipe.hw.AccelTypedVolatileImage) Surface(sun.java2d.Surface) AccelSurface(sun.java2d.pipe.hw.AccelSurface)

Example 8 with AccelSurface

use of sun.java2d.pipe.hw.AccelSurface in project jdk8u_jdk by JetBrains.

the class RSLAPITest method printSurface.

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");
    }
}
Also used : AccelSurface(sun.java2d.pipe.hw.AccelSurface) RenderQueue(sun.java2d.pipe.RenderQueue)

Aggregations

AccelSurface (sun.java2d.pipe.hw.AccelSurface)8 Surface (sun.java2d.Surface)6 SunVolatileImage (sun.awt.image.SunVolatileImage)4 AccelTypedVolatileImage (sun.java2d.pipe.hw.AccelTypedVolatileImage)4 Graphics (java.awt.Graphics)2 VolatileImage (java.awt.image.VolatileImage)2 DestSurfaceProvider (sun.java2d.DestSurfaceProvider)2 Color (java.awt.Color)1 Paint (java.awt.Paint)1 AffineTransform (java.awt.geom.AffineTransform)1 InvalidPipeException (sun.java2d.InvalidPipeException)1 RenderQueue (sun.java2d.pipe.RenderQueue)1 AccelGraphicsConfig (sun.java2d.pipe.hw.AccelGraphicsConfig)1