Java Code Examples for sun.java2d.ScreenUpdateManager#getInstance()

The following examples show how to use sun.java2d.ScreenUpdateManager#getInstance() . 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: D3DRenderQueue.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Flushes the single D3DRenderQueue instance synchronously.  If an
 * D3DRenderQueue has not yet been instantiated, this method is a no-op.
 * This method is useful in the case of Toolkit.sync(), in which we want
 * to flush the D3D pipeline, but only if the D3D pipeline is currently
 * enabled.  Since this class has few external dependencies, callers need
 * not be concerned that calling this method will trigger initialization
 * of the D3D pipeline and related classes.
 */
public static void sync() {
    if (theInstance != null) {
        // need to make sure any/all screen surfaces are presented prior
        // to completing the sync operation
        D3DScreenUpdateManager mgr =
            (D3DScreenUpdateManager)ScreenUpdateManager.getInstance();
        mgr.runUpdateNow();

        theInstance.lock();
        try {
            theInstance.ensureCapacity(4);
            theInstance.getBuffer().putInt(SYNC);
            theInstance.flushNow();
        } finally {
            theInstance.unlock();
        }
    }
}
 
Example 2
Source File: D3DRenderQueue.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Flushes the single D3DRenderQueue instance synchronously.  If an
 * D3DRenderQueue has not yet been instantiated, this method is a no-op.
 * This method is useful in the case of Toolkit.sync(), in which we want
 * to flush the D3D pipeline, but only if the D3D pipeline is currently
 * enabled.  Since this class has few external dependencies, callers need
 * not be concerned that calling this method will trigger initialization
 * of the D3D pipeline and related classes.
 */
public static void sync() {
    if (theInstance != null) {
        // need to make sure any/all screen surfaces are presented prior
        // to completing the sync operation
        D3DScreenUpdateManager mgr =
            (D3DScreenUpdateManager)ScreenUpdateManager.getInstance();
        mgr.runUpdateNow();

        theInstance.lock();
        try {
            theInstance.ensureCapacity(4);
            theInstance.getBuffer().putInt(SYNC);
            theInstance.flushNow();
        } finally {
            theInstance.unlock();
        }
    }
}
 
Example 3
Source File: D3DRenderQueue.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Flushes the single D3DRenderQueue instance synchronously.  If an
 * D3DRenderQueue has not yet been instantiated, this method is a no-op.
 * This method is useful in the case of Toolkit.sync(), in which we want
 * to flush the D3D pipeline, but only if the D3D pipeline is currently
 * enabled.  Since this class has few external dependencies, callers need
 * not be concerned that calling this method will trigger initialization
 * of the D3D pipeline and related classes.
 */
public static void sync() {
    if (theInstance != null) {
        // need to make sure any/all screen surfaces are presented prior
        // to completing the sync operation
        D3DScreenUpdateManager mgr =
            (D3DScreenUpdateManager)ScreenUpdateManager.getInstance();
        mgr.runUpdateNow();

        theInstance.lock();
        try {
            theInstance.ensureCapacity(4);
            theInstance.getBuffer().putInt(SYNC);
            theInstance.flushNow();
        } finally {
            theInstance.unlock();
        }
    }
}
 
Example 4
Source File: D3DRenderQueue.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Flushes the single D3DRenderQueue instance synchronously.  If an
 * D3DRenderQueue has not yet been instantiated, this method is a no-op.
 * This method is useful in the case of Toolkit.sync(), in which we want
 * to flush the D3D pipeline, but only if the D3D pipeline is currently
 * enabled.  Since this class has few external dependencies, callers need
 * not be concerned that calling this method will trigger initialization
 * of the D3D pipeline and related classes.
 */
public static void sync() {
    if (theInstance != null) {
        // need to make sure any/all screen surfaces are presented prior
        // to completing the sync operation
        D3DScreenUpdateManager mgr =
            (D3DScreenUpdateManager)ScreenUpdateManager.getInstance();
        mgr.runUpdateNow();

        theInstance.lock();
        try {
            theInstance.ensureCapacity(4);
            theInstance.getBuffer().putInt(SYNC);
            theInstance.flushNow();
        } finally {
            theInstance.unlock();
        }
    }
}
 
Example 5
Source File: D3DBlitLoops.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Note: The srcImg and biop parameters are only used when invoked
 * from the D3DBufImgOps.renderImageWithOp() method; in all other cases,
 * this method can be called with null values for those two parameters,
 * and they will be effectively ignored.
 */
static void IsoBlit(SurfaceData srcData, SurfaceData dstData,
                    BufferedImage srcImg, BufferedImageOp biop,
                    Composite comp, Region clip,
                    AffineTransform xform, int hint,
                    int sx1, int sy1,
                    int sx2, int sy2,
                    double dx1, double dy1,
                    double dx2, double dy2,
                    boolean texture)
{
    int ctxflags = 0;
    if (srcData.getTransparency() == Transparency.OPAQUE) {
        ctxflags |= D3DContext.SRC_IS_OPAQUE;
    }

    D3DSurfaceData d3dDst = (D3DSurfaceData)dstData;
    D3DRenderQueue rq = D3DRenderQueue.getInstance();
    boolean rtt = false;
    rq.lock();
    try {
        D3DSurfaceData d3dSrc = (D3DSurfaceData)srcData;
        int srctype = d3dSrc.getType();
        D3DSurfaceData srcCtxData = d3dSrc;
        if (srctype == D3DSurfaceData.TEXTURE) {
            rtt = false;
        } else {
            // the source is a backbuffer, or render-to-texture
            // surface; we set rtt to true to differentiate this kind
            // of surface from a regular texture object
            rtt = true;
        }

        D3DContext.validateContext(srcCtxData, d3dDst,
                                   clip, comp, xform, null, null,
                                   ctxflags);

        if (biop != null) {
            D3DBufImgOps.enableBufImgOp(rq, d3dSrc, srcImg, biop);
        }

        int packedParams = createPackedParams(true, texture,
                                              rtt, xform != null,
                                              hint, 0 /*unused*/);
        enqueueBlit(rq, srcData, dstData,
                    packedParams,
                    sx1, sy1, sx2, sy2,
                    dx1, dy1, dx2, dy2);

        if (biop != null) {
            D3DBufImgOps.disableBufImgOp(rq, biop);
        }
    } finally {
        rq.unlock();
    }

    if (rtt && (d3dDst.getType() == D3DSurfaceData.WINDOW)) {
        // we only have to flush immediately when copying from a
        // (non-texture) surface to the screen; otherwise Swing apps
        // might appear unresponsive until the auto-flush completes
        D3DScreenUpdateManager mgr =
            (D3DScreenUpdateManager)ScreenUpdateManager.getInstance();
        mgr.runUpdateNow();
    }
}
 
Example 6
Source File: D3DBlitLoops.java    From jdk8u-dev-jdk with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Note: The srcImg and biop parameters are only used when invoked
 * from the D3DBufImgOps.renderImageWithOp() method; in all other cases,
 * this method can be called with null values for those two parameters,
 * and they will be effectively ignored.
 */
static void IsoBlit(SurfaceData srcData, SurfaceData dstData,
                    BufferedImage srcImg, BufferedImageOp biop,
                    Composite comp, Region clip,
                    AffineTransform xform, int hint,
                    int sx1, int sy1,
                    int sx2, int sy2,
                    double dx1, double dy1,
                    double dx2, double dy2,
                    boolean texture)
{
    int ctxflags = 0;
    if (srcData.getTransparency() == Transparency.OPAQUE) {
        ctxflags |= D3DContext.SRC_IS_OPAQUE;
    }

    D3DSurfaceData d3dDst = (D3DSurfaceData)dstData;
    D3DRenderQueue rq = D3DRenderQueue.getInstance();
    boolean rtt = false;
    rq.lock();
    try {
        D3DSurfaceData d3dSrc = (D3DSurfaceData)srcData;
        int srctype = d3dSrc.getType();
        D3DSurfaceData srcCtxData = d3dSrc;
        if (srctype == D3DSurfaceData.TEXTURE) {
            rtt = false;
        } else {
            // the source is a backbuffer, or render-to-texture
            // surface; we set rtt to true to differentiate this kind
            // of surface from a regular texture object
            rtt = true;
        }

        D3DContext.validateContext(srcCtxData, d3dDst,
                                   clip, comp, xform, null, null,
                                   ctxflags);

        if (biop != null) {
            D3DBufImgOps.enableBufImgOp(rq, d3dSrc, srcImg, biop);
        }

        int packedParams = createPackedParams(true, texture,
                                              rtt, xform != null,
                                              hint, 0 /*unused*/);
        enqueueBlit(rq, srcData, dstData,
                    packedParams,
                    sx1, sy1, sx2, sy2,
                    dx1, dy1, dx2, dy2);

        if (biop != null) {
            D3DBufImgOps.disableBufImgOp(rq, biop);
        }
    } finally {
        rq.unlock();
    }

    if (rtt && (d3dDst.getType() == D3DSurfaceData.WINDOW)) {
        // we only have to flush immediately when copying from a
        // (non-texture) surface to the screen; otherwise Swing apps
        // might appear unresponsive until the auto-flush completes
        D3DScreenUpdateManager mgr =
            (D3DScreenUpdateManager)ScreenUpdateManager.getInstance();
        mgr.runUpdateNow();
    }
}
 
Example 7
Source File: D3DBlitLoops.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Note: The srcImg and biop parameters are only used when invoked
 * from the D3DBufImgOps.renderImageWithOp() method; in all other cases,
 * this method can be called with null values for those two parameters,
 * and they will be effectively ignored.
 */
static void IsoBlit(SurfaceData srcData, SurfaceData dstData,
                    BufferedImage srcImg, BufferedImageOp biop,
                    Composite comp, Region clip,
                    AffineTransform xform, int hint,
                    int sx1, int sy1,
                    int sx2, int sy2,
                    double dx1, double dy1,
                    double dx2, double dy2,
                    boolean texture)
{
    int ctxflags = 0;
    if (srcData.getTransparency() == Transparency.OPAQUE) {
        ctxflags |= D3DContext.SRC_IS_OPAQUE;
    }

    D3DSurfaceData d3dDst = (D3DSurfaceData)dstData;
    D3DRenderQueue rq = D3DRenderQueue.getInstance();
    boolean rtt = false;
    rq.lock();
    try {
        D3DSurfaceData d3dSrc = (D3DSurfaceData)srcData;
        int srctype = d3dSrc.getType();
        D3DSurfaceData srcCtxData = d3dSrc;
        if (srctype == D3DSurfaceData.TEXTURE) {
            rtt = false;
        } else {
            // the source is a backbuffer, or render-to-texture
            // surface; we set rtt to true to differentiate this kind
            // of surface from a regular texture object
            rtt = true;
        }

        D3DContext.validateContext(srcCtxData, d3dDst,
                                   clip, comp, xform, null, null,
                                   ctxflags);

        if (biop != null) {
            D3DBufImgOps.enableBufImgOp(rq, d3dSrc, srcImg, biop);
        }

        int packedParams = createPackedParams(true, texture,
                                              rtt, xform != null,
                                              hint, 0 /*unused*/);
        enqueueBlit(rq, srcData, dstData,
                    packedParams,
                    sx1, sy1, sx2, sy2,
                    dx1, dy1, dx2, dy2);

        if (biop != null) {
            D3DBufImgOps.disableBufImgOp(rq, biop);
        }
    } finally {
        rq.unlock();
    }

    if (rtt && (d3dDst.getType() == D3DSurfaceData.WINDOW)) {
        // we only have to flush immediately when copying from a
        // (non-texture) surface to the screen; otherwise Swing apps
        // might appear unresponsive until the auto-flush completes
        D3DScreenUpdateManager mgr =
            (D3DScreenUpdateManager)ScreenUpdateManager.getInstance();
        mgr.runUpdateNow();
    }
}
 
Example 8
Source File: D3DBlitLoops.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Note: The srcImg and biop parameters are only used when invoked
 * from the D3DBufImgOps.renderImageWithOp() method; in all other cases,
 * this method can be called with null values for those two parameters,
 * and they will be effectively ignored.
 */
static void IsoBlit(SurfaceData srcData, SurfaceData dstData,
                    BufferedImage srcImg, BufferedImageOp biop,
                    Composite comp, Region clip,
                    AffineTransform xform, int hint,
                    int sx1, int sy1,
                    int sx2, int sy2,
                    double dx1, double dy1,
                    double dx2, double dy2,
                    boolean texture)
{
    int ctxflags = 0;
    if (srcData.getTransparency() == Transparency.OPAQUE) {
        ctxflags |= D3DContext.SRC_IS_OPAQUE;
    }

    D3DSurfaceData d3dDst = (D3DSurfaceData)dstData;
    D3DRenderQueue rq = D3DRenderQueue.getInstance();
    boolean rtt = false;
    rq.lock();
    try {
        D3DSurfaceData d3dSrc = (D3DSurfaceData)srcData;
        int srctype = d3dSrc.getType();
        D3DSurfaceData srcCtxData = d3dSrc;
        if (srctype == D3DSurfaceData.TEXTURE) {
            rtt = false;
        } else {
            // the source is a backbuffer, or render-to-texture
            // surface; we set rtt to true to differentiate this kind
            // of surface from a regular texture object
            rtt = true;
        }

        D3DContext.validateContext(srcCtxData, d3dDst,
                                   clip, comp, xform, null, null,
                                   ctxflags);

        if (biop != null) {
            D3DBufImgOps.enableBufImgOp(rq, d3dSrc, srcImg, biop);
        }

        int packedParams = createPackedParams(true, texture,
                                              rtt, xform != null,
                                              hint, 0 /*unused*/);
        enqueueBlit(rq, srcData, dstData,
                    packedParams,
                    sx1, sy1, sx2, sy2,
                    dx1, dy1, dx2, dy2);

        if (biop != null) {
            D3DBufImgOps.disableBufImgOp(rq, biop);
        }
    } finally {
        rq.unlock();
    }

    if (rtt && (d3dDst.getType() == D3DSurfaceData.WINDOW)) {
        // we only have to flush immediately when copying from a
        // (non-texture) surface to the screen; otherwise Swing apps
        // might appear unresponsive until the auto-flush completes
        D3DScreenUpdateManager mgr =
            (D3DScreenUpdateManager)ScreenUpdateManager.getInstance();
        mgr.runUpdateNow();
    }
}
 
Example 9
Source File: WComponentPeer.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
/**
 * 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;
            }
        }
    }
    // it would be better to do this before we create new ones,
    // 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;
    }
}
 
Example 10
Source File: D3DBlitLoops.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Note: The srcImg and biop parameters are only used when invoked
 * from the D3DBufImgOps.renderImageWithOp() method; in all other cases,
 * this method can be called with null values for those two parameters,
 * and they will be effectively ignored.
 */
static void IsoBlit(SurfaceData srcData, SurfaceData dstData,
                    BufferedImage srcImg, BufferedImageOp biop,
                    Composite comp, Region clip,
                    AffineTransform xform, int hint,
                    int sx1, int sy1,
                    int sx2, int sy2,
                    double dx1, double dy1,
                    double dx2, double dy2,
                    boolean texture)
{
    int ctxflags = 0;
    if (srcData.getTransparency() == Transparency.OPAQUE) {
        ctxflags |= D3DContext.SRC_IS_OPAQUE;
    }

    D3DSurfaceData d3dDst = (D3DSurfaceData)dstData;
    D3DRenderQueue rq = D3DRenderQueue.getInstance();
    boolean rtt = false;
    rq.lock();
    try {
        D3DSurfaceData d3dSrc = (D3DSurfaceData)srcData;
        int srctype = d3dSrc.getType();
        D3DSurfaceData srcCtxData = d3dSrc;
        if (srctype == D3DSurfaceData.TEXTURE) {
            rtt = false;
        } else {
            // the source is a backbuffer, or render-to-texture
            // surface; we set rtt to true to differentiate this kind
            // of surface from a regular texture object
            rtt = true;
        }

        D3DContext.validateContext(srcCtxData, d3dDst,
                                   clip, comp, xform, null, null,
                                   ctxflags);

        if (biop != null) {
            D3DBufImgOps.enableBufImgOp(rq, d3dSrc, srcImg, biop);
        }

        int packedParams = createPackedParams(true, texture,
                                              rtt, xform != null,
                                              hint, 0 /*unused*/);
        enqueueBlit(rq, srcData, dstData,
                    packedParams,
                    sx1, sy1, sx2, sy2,
                    dx1, dy1, dx2, dy2);

        if (biop != null) {
            D3DBufImgOps.disableBufImgOp(rq, biop);
        }
    } finally {
        rq.unlock();
    }

    if (rtt && (d3dDst.getType() == D3DSurfaceData.WINDOW)) {
        // we only have to flush immediately when copying from a
        // (non-texture) surface to the screen; otherwise Swing apps
        // might appear unresponsive until the auto-flush completes
        D3DScreenUpdateManager mgr =
            (D3DScreenUpdateManager)ScreenUpdateManager.getInstance();
        mgr.runUpdateNow();
    }
}
 
Example 11
Source File: D3DBlitLoops.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
static void Blit(SurfaceData srcData, SurfaceData dstData,
                 Composite comp, Region clip,
                 AffineTransform xform, int hint,
                 int sx1, int sy1,
                 int sx2, int sy2,
                 double dx1, double dy1,
                 double dx2, double dy2,
                 int srctype, boolean texture)
{
    int ctxflags = 0;
    if (srcData.getTransparency() == Transparency.OPAQUE) {
        ctxflags |= D3DContext.SRC_IS_OPAQUE;
    }

    D3DSurfaceData d3dDst = (D3DSurfaceData)dstData;
    D3DRenderQueue rq = D3DRenderQueue.getInstance();
    rq.lock();
    try {
        // make sure the RenderQueue keeps a hard reference to the
        // source (sysmem) SurfaceData to prevent it from being
        // disposed while the operation is processed on the QFT
        rq.addReference(srcData);

        if (texture) {
            // make sure we have a current context before uploading
            // the sysmem data to the texture object
            D3DContext.setScratchSurface(d3dDst.getContext());
        } else {
            D3DContext.validateContext(d3dDst, d3dDst,
                                       clip, comp, xform, null, null,
                                       ctxflags);
        }

        int packedParams = createPackedParams(false, texture,
                                              false, xform != null,
                                              hint, srctype);
        enqueueBlit(rq, srcData, dstData,
                    packedParams,
                    sx1, sy1, sx2, sy2,
                    dx1, dy1, dx2, dy2);

        // always flush immediately, since we (currently) have no means
        // of tracking changes to the system memory surface
        rq.flushNow();
    } finally {
        rq.unlock();
    }

    if (d3dDst.getType() == D3DSurfaceData.WINDOW) {
        // flush immediately when copying to the screen to improve
        // responsiveness of applications using VI or BI backbuffers
        D3DScreenUpdateManager mgr =
            (D3DScreenUpdateManager)ScreenUpdateManager.getInstance();
        mgr.runUpdateNow();
    }
}
 
Example 12
Source File: WComponentPeer.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
@Override
@SuppressWarnings("deprecation")
public Graphics getGraphics() {
    if (isDisposed()) {
        return null;
    }

    Component target = (Component)getTarget();
    Window window = SunToolkit.getContainingWindow(target);
    if (window != null) {
        Graphics g =
            ((WWindowPeer)window.getPeer()).getTranslucentGraphics();
        // getTranslucentGraphics() returns non-null value for non-opaque windows only
        if (g != null) {
            // Non-opaque windows do not support heavyweight children.
            // Redirect all painting to the Window's Graphics instead.
            // The caller is responsible for calling the
            // WindowPeer.updateWindow() after painting has finished.
            int x = 0, y = 0;
            for (Component c = target; c != window; c = c.getParent()) {
                x += c.getX();
                y += c.getY();
            }

            g.translate(x, y);
            g.clipRect(0, 0, target.getWidth(), target.getHeight());

            return g;
        }
    }

    SurfaceData surfaceData = this.surfaceData;
    if (surfaceData != null) {
        /* Fix for bug 4746122. Color and Font shouldn't be null */
        Color bgColor = background;
        if (bgColor == null) {
            bgColor = SystemColor.window;
        }
        Color fgColor = foreground;
        if (fgColor == null) {
            fgColor = SystemColor.windowText;
        }
        Font font = this.font;
        if (font == null) {
            font = defaultFont;
        }
        ScreenUpdateManager mgr =
            ScreenUpdateManager.getInstance();
        return mgr.createGraphics(surfaceData, this, fgColor,
                                  bgColor, font);
    }
    return null;
}
 
Example 13
Source File: D3DBlitLoops.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
static void Blit(SurfaceData srcData, SurfaceData dstData,
                 Composite comp, Region clip,
                 AffineTransform xform, int hint,
                 int sx1, int sy1,
                 int sx2, int sy2,
                 double dx1, double dy1,
                 double dx2, double dy2,
                 int srctype, boolean texture)
{
    int ctxflags = 0;
    if (srcData.getTransparency() == Transparency.OPAQUE) {
        ctxflags |= D3DContext.SRC_IS_OPAQUE;
    }

    D3DSurfaceData d3dDst = (D3DSurfaceData)dstData;
    D3DRenderQueue rq = D3DRenderQueue.getInstance();
    rq.lock();
    try {
        // make sure the RenderQueue keeps a hard reference to the
        // source (sysmem) SurfaceData to prevent it from being
        // disposed while the operation is processed on the QFT
        rq.addReference(srcData);

        if (texture) {
            // make sure we have a current context before uploading
            // the sysmem data to the texture object
            D3DContext.setScratchSurface(d3dDst.getContext());
        } else {
            D3DContext.validateContext(d3dDst, d3dDst,
                                       clip, comp, xform, null, null,
                                       ctxflags);
        }

        int packedParams = createPackedParams(false, texture,
                                              false, xform != null,
                                              hint, srctype);
        enqueueBlit(rq, srcData, dstData,
                    packedParams,
                    sx1, sy1, sx2, sy2,
                    dx1, dy1, dx2, dy2);

        // always flush immediately, since we (currently) have no means
        // of tracking changes to the system memory surface
        rq.flushNow();
    } finally {
        rq.unlock();
    }

    if (d3dDst.getType() == D3DSurfaceData.WINDOW) {
        // flush immediately when copying to the screen to improve
        // responsiveness of applications using VI or BI backbuffers
        D3DScreenUpdateManager mgr =
            (D3DScreenUpdateManager)ScreenUpdateManager.getInstance();
        mgr.runUpdateNow();
    }
}
 
Example 14
Source File: D3DBlitLoops.java    From dragonwell8_jdk with GNU General Public License v2.0 4 votes vote down vote up
static void Blit(SurfaceData srcData, SurfaceData dstData,
                 Composite comp, Region clip,
                 AffineTransform xform, int hint,
                 int sx1, int sy1,
                 int sx2, int sy2,
                 double dx1, double dy1,
                 double dx2, double dy2,
                 int srctype, boolean texture)
{
    int ctxflags = 0;
    if (srcData.getTransparency() == Transparency.OPAQUE) {
        ctxflags |= D3DContext.SRC_IS_OPAQUE;
    }

    D3DSurfaceData d3dDst = (D3DSurfaceData)dstData;
    D3DRenderQueue rq = D3DRenderQueue.getInstance();
    rq.lock();
    try {
        // make sure the RenderQueue keeps a hard reference to the
        // source (sysmem) SurfaceData to prevent it from being
        // disposed while the operation is processed on the QFT
        rq.addReference(srcData);

        if (texture) {
            // make sure we have a current context before uploading
            // the sysmem data to the texture object
            D3DContext.setScratchSurface(d3dDst.getContext());
        } else {
            D3DContext.validateContext(d3dDst, d3dDst,
                                       clip, comp, xform, null, null,
                                       ctxflags);
        }

        int packedParams = createPackedParams(false, texture,
                                              false, xform != null,
                                              hint, srctype);
        enqueueBlit(rq, srcData, dstData,
                    packedParams,
                    sx1, sy1, sx2, sy2,
                    dx1, dy1, dx2, dy2);

        // always flush immediately, since we (currently) have no means
        // of tracking changes to the system memory surface
        rq.flushNow();
    } finally {
        rq.unlock();
    }

    if (d3dDst.getType() == D3DSurfaceData.WINDOW) {
        // flush immediately when copying to the screen to improve
        // responsiveness of applications using VI or BI backbuffers
        D3DScreenUpdateManager mgr =
            (D3DScreenUpdateManager)ScreenUpdateManager.getInstance();
        mgr.runUpdateNow();
    }
}
 
Example 15
Source File: D3DSurfaceData.java    From TencentKona-8 with GNU General Public License v2.0 2 votes vote down vote up
/**
 * {@inheritDoc}
 *
 * Overridden to use ScreenUpdateManager to obtain the replacement
 * surface.
 *
 * @see sun.java2d.ScreenUpdateManager#getReplacementScreenSurface
 */
@Override
public SurfaceData getReplacement() {
    ScreenUpdateManager mgr = ScreenUpdateManager.getInstance();
    return mgr.getReplacementScreenSurface(peer, this);
}
 
Example 16
Source File: D3DSurfaceData.java    From hottub with GNU General Public License v2.0 2 votes vote down vote up
/**
 * {@inheritDoc}
 *
 * Overridden to use ScreenUpdateManager to obtain the replacement
 * surface.
 *
 * @see sun.java2d.ScreenUpdateManager#getReplacementScreenSurface
 */
@Override
public SurfaceData getReplacement() {
    ScreenUpdateManager mgr = ScreenUpdateManager.getInstance();
    return mgr.getReplacementScreenSurface(peer, this);
}
 
Example 17
Source File: GDIWindowSurfaceData.java    From openjdk-jdk8u with GNU General Public License v2.0 2 votes vote down vote up
/**
 * {@inheritDoc}
 *
 * Overridden to use ScreenUpdateManager to obtain the replacement surface.
 *
 * @see sun.java2d.ScreenUpdateManager#getReplacementScreenSurface
 */
@Override
public SurfaceData getReplacement() {
    ScreenUpdateManager mgr = ScreenUpdateManager.getInstance();
    return mgr.getReplacementScreenSurface(peer, this);
}
 
Example 18
Source File: D3DSurfaceData.java    From openjdk-8-source with GNU General Public License v2.0 2 votes vote down vote up
/**
 * {@inheritDoc}
 *
 * Overridden to use ScreenUpdateManager to obtain the replacement
 * surface.
 *
 * @see sun.java2d.ScreenUpdateManager#getReplacementScreenSurface
 */
@Override
public SurfaceData getReplacement() {
    ScreenUpdateManager mgr = ScreenUpdateManager.getInstance();
    return mgr.getReplacementScreenSurface(peer, this);
}
 
Example 19
Source File: D3DSurfaceData.java    From openjdk-jdk8u with GNU General Public License v2.0 2 votes vote down vote up
/**
 * {@inheritDoc}
 *
 * Overridden to use ScreenUpdateManager to obtain the replacement
 * surface.
 *
 * @see sun.java2d.ScreenUpdateManager#getReplacementScreenSurface
 */
@Override
public SurfaceData getReplacement() {
    ScreenUpdateManager mgr = ScreenUpdateManager.getInstance();
    return mgr.getReplacementScreenSurface(peer, this);
}
 
Example 20
Source File: D3DSurfaceData.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 2 votes vote down vote up
/**
 * {@inheritDoc}
 *
 * Overridden to use ScreenUpdateManager to obtain the replacement
 * surface.
 *
 * @see sun.java2d.ScreenUpdateManager#getReplacementScreenSurface
 */
@Override
public SurfaceData getReplacement() {
    ScreenUpdateManager mgr = ScreenUpdateManager.getInstance();
    return mgr.getReplacementScreenSurface(peer, this);
}