Search in sources :

Example 1 with Win32GraphicsConfig

use of sun.awt.Win32GraphicsConfig in project jdk8u_jdk by JetBrains.

the class WComponentPeer method createBuffers.

/**
     * The following multibuffering-related methods delegate to our
     * associated GraphicsConfig (Win or WGL) to handle the appropriate
     * native windowing system specific actions.
     */
@Override
public void createBuffers(int numBuffers, BufferCapabilities caps) throws AWTException {
    Win32GraphicsConfig gc = (Win32GraphicsConfig) getGraphicsConfiguration();
    gc.assertOperationSupported((Component) target, numBuffers, caps);
    // Re-create the primary surface with the new number of back buffers
    try {
        replaceSurfaceData(numBuffers - 1, caps);
    } catch (InvalidPipeException e) {
        throw new AWTException(e.getMessage());
    }
}
Also used : InvalidPipeException(sun.java2d.InvalidPipeException) Win32GraphicsConfig(sun.awt.Win32GraphicsConfig)

Example 2 with Win32GraphicsConfig

use of sun.awt.Win32GraphicsConfig in project jdk8u_jdk by JetBrains.

the class WComponentPeer method replaceSurfaceData.

/**
     * Multi-buffer version of replaceSurfaceData.  This version is called
     * by createBuffers(), which needs to acquire the same locks in the same
     * order, but also needs to perform additional functions inside the
     * locks.
     */
public void replaceSurfaceData(int newNumBackBuffers, BufferCapabilities caps) {
    SurfaceData oldData = null;
    VolatileImage oldBB = null;
    synchronized (((Component) target).getTreeLock()) {
        synchronized (this) {
            if (pData == 0) {
                return;
            }
            numBackBuffers = newNumBackBuffers;
            ScreenUpdateManager mgr = ScreenUpdateManager.getInstance();
            oldData = surfaceData;
            mgr.dropScreenSurface(oldData);
            createScreenSurface(true);
            if (oldData != null) {
                oldData.invalidate();
            }
            oldBB = backBuffer;
            if (numBackBuffers > 0) {
                // set the caps first, they're used when creating the bb
                backBufferCaps = caps;
                Win32GraphicsConfig gc = (Win32GraphicsConfig) getGraphicsConfiguration();
                backBuffer = gc.createBackBuffer(this);
            } else if (backBuffer != null) {
                backBufferCaps = null;
                backBuffer = null;
            }
        }
    }
    // but then we'd run into deadlock issues
    if (oldData != null) {
        oldData.flush();
        // null out the old data to make it collected faster
        oldData = null;
    }
    if (oldBB != null) {
        oldBB.flush();
        // null out the old data to make it collected faster
        oldData = null;
    }
}
Also used : Win32GraphicsConfig(sun.awt.Win32GraphicsConfig) D3DSurfaceData(sun.java2d.d3d.D3DSurfaceData) SurfaceData(sun.java2d.SurfaceData) OGLSurfaceData(sun.java2d.opengl.OGLSurfaceData) SunVolatileImage(sun.awt.image.SunVolatileImage) VolatileImage(java.awt.image.VolatileImage) ScreenUpdateManager(sun.java2d.ScreenUpdateManager)

Example 3 with Win32GraphicsConfig

use of sun.awt.Win32GraphicsConfig in project jdk8u_jdk by JetBrains.

the class WComponentPeer method flip.

@Override
public void flip(int x1, int y1, int x2, int y2, BufferCapabilities.FlipContents flipAction) {
    VolatileImage backBuffer = this.backBuffer;
    if (backBuffer == null) {
        throw new IllegalStateException("Buffers have not been created");
    }
    Win32GraphicsConfig gc = (Win32GraphicsConfig) getGraphicsConfiguration();
    gc.flip(this, (Component) target, backBuffer, x1, y1, x2, y2, flipAction);
}
Also used : Win32GraphicsConfig(sun.awt.Win32GraphicsConfig) SunVolatileImage(sun.awt.image.SunVolatileImage) VolatileImage(java.awt.image.VolatileImage)

Example 4 with Win32GraphicsConfig

use of sun.awt.Win32GraphicsConfig in project jdk8u_jdk by JetBrains.

the class WComponentPeer method createScreenSurface.

public void createScreenSurface(boolean isResize) {
    Win32GraphicsConfig gc = (Win32GraphicsConfig) getGraphicsConfiguration();
    ScreenUpdateManager mgr = ScreenUpdateManager.getInstance();
    surfaceData = mgr.createScreenSurface(gc, this, numBackBuffers, isResize);
}
Also used : Win32GraphicsConfig(sun.awt.Win32GraphicsConfig) ScreenUpdateManager(sun.java2d.ScreenUpdateManager)

Aggregations

Win32GraphicsConfig (sun.awt.Win32GraphicsConfig)4 VolatileImage (java.awt.image.VolatileImage)2 SunVolatileImage (sun.awt.image.SunVolatileImage)2 ScreenUpdateManager (sun.java2d.ScreenUpdateManager)2 InvalidPipeException (sun.java2d.InvalidPipeException)1 SurfaceData (sun.java2d.SurfaceData)1 D3DSurfaceData (sun.java2d.d3d.D3DSurfaceData)1 OGLSurfaceData (sun.java2d.opengl.OGLSurfaceData)1