Java Code Examples for sun.java2d.pipe.RenderBuffer#putLong()

The following examples show how to use sun.java2d.pipe.RenderBuffer#putLong() . 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: OGLSurfaceData.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Disposes the native resources associated with the given OGLSurfaceData
 * (referenced by the pData parameter).  This method is invoked from
 * the native Dispose() method from the Disposer thread when the
 * Java-level OGLSurfaceData object is about to go away.  Note that we
 * also pass a reference to the native GLX/WGLGraphicsConfigInfo
 * (pConfigInfo) for the purposes of making a context current.
 */
static void dispose(long pData, long pConfigInfo) {
    OGLRenderQueue rq = OGLRenderQueue.getInstance();
    rq.lock();
    try {
        // make sure we have a current context before
        // disposing the native resources (e.g. texture object)
        OGLContext.setScratchSurface(pConfigInfo);

        RenderBuffer buf = rq.getBuffer();
        rq.ensureCapacityAndAlignment(12, 4);
        buf.putInt(DISPOSE_SURFACE);
        buf.putLong(pData);

        // this call is expected to complete synchronously, so flush now
        rq.flushNow();
    } finally {
        rq.unlock();
    }
}
 
Example 2
Source File: OGLSurfaceData.java    From Bytecoder with Apache License 2.0 6 votes vote down vote up
public void flush() {
    invalidate();
    OGLRenderQueue rq = OGLRenderQueue.getInstance();
    rq.lock();
    try {
        // make sure we have a current context before
        // disposing the native resources (e.g. texture object)
        OGLContext.setScratchSurface(graphicsConfig);

        RenderBuffer buf = rq.getBuffer();
        rq.ensureCapacityAndAlignment(12, 4);
        buf.putInt(FLUSH_SURFACE);
        buf.putLong(getNativeOps());

        // this call is expected to complete synchronously, so flush now
        rq.flushNow();
    } finally {
        rq.unlock();
    }
}
 
Example 3
Source File: D3DRenderQueue.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Disposes the native memory associated with the given native
 * graphics config info pointer on the single queue flushing thread.
 */
public static void disposeGraphicsConfig(long pConfigInfo) {
    D3DRenderQueue rq = getInstance();
    rq.lock();
    try {

        RenderBuffer buf = rq.getBuffer();
        rq.ensureCapacityAndAlignment(12, 4);
        buf.putInt(DISPOSE_CONFIG);
        buf.putLong(pConfigInfo);

        // this call is expected to complete synchronously, so flush now
        rq.flushNow();
    } finally {
        rq.unlock();
    }
}
 
Example 4
Source File: OGLSurfaceData.java    From Bytecoder with Apache License 2.0 6 votes vote down vote up
/**
 * Disposes the native resources associated with the given OGLSurfaceData
 * (referenced by the pData parameter).  This method is invoked from
 * the native Dispose() method from the Disposer thread when the
 * Java-level OGLSurfaceData object is about to go away.  Note that we
 * also pass a reference to the OGLGraphicsConfig
 * for the purposes of making a context current.
 */
static void dispose(long pData, OGLGraphicsConfig gc) {
    OGLRenderQueue rq = OGLRenderQueue.getInstance();
    rq.lock();
    try {
        // make sure we have a current context before
        // disposing the native resources (e.g. texture object)
        OGLContext.setScratchSurface(gc);

        RenderBuffer buf = rq.getBuffer();
        rq.ensureCapacityAndAlignment(12, 4);
        buf.putInt(DISPOSE_SURFACE);
        buf.putLong(pData);

        // this call is expected to complete synchronously, so flush now
        rq.flushNow();
    } finally {
        rq.unlock();
    }
}
 
Example 5
Source File: OGLRenderQueue.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Disposes the native memory associated with the given native
 * graphics config info pointer on the single queue flushing thread.
 */
public static void disposeGraphicsConfig(long pConfigInfo) {
    OGLRenderQueue rq = getInstance();
    rq.lock();
    try {
        // make sure we make the context associated with the given
        // GraphicsConfig current before disposing the native resources
        OGLContext.setScratchSurface(pConfigInfo);

        RenderBuffer buf = rq.getBuffer();
        rq.ensureCapacityAndAlignment(12, 4);
        buf.putInt(DISPOSE_CONFIG);
        buf.putLong(pConfigInfo);

        // this call is expected to complete synchronously, so flush now
        rq.flushNow();
    } finally {
        rq.unlock();
    }
}
 
Example 6
Source File: D3DSurfaceData.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Disposes the native resources associated with the given D3DSurfaceData
 * (referenced by the pData parameter).  This method is invoked from
 * the native Dispose() method from the Disposer thread when the
 * Java-level D3DSurfaceData object is about to go away.
 */
static void dispose(long pData) {
    D3DRenderQueue rq = D3DRenderQueue.getInstance();
    rq.lock();
    try {
        RenderBuffer buf = rq.getBuffer();
        rq.ensureCapacityAndAlignment(12, 4);
        buf.putInt(DISPOSE_SURFACE);
        buf.putLong(pData);

        // this call is expected to complete synchronously, so flush now
        rq.flushNow();
    } finally {
        rq.unlock();
    }
}
 
Example 7
Source File: D3DRenderQueue.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Disposes the native memory associated with the given native
 * graphics config info pointer on the single queue flushing thread.
 */
public static void disposeGraphicsConfig(long pConfigInfo) {
    D3DRenderQueue rq = getInstance();
    rq.lock();
    try {

        RenderBuffer buf = rq.getBuffer();
        rq.ensureCapacityAndAlignment(12, 4);
        buf.putInt(DISPOSE_CONFIG);
        buf.putLong(pConfigInfo);

        // this call is expected to complete synchronously, so flush now
        rq.flushNow();
    } finally {
        rq.unlock();
    }
}
 
Example 8
Source File: D3DBlitLoops.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 9
Source File: OGLBlitLoops.java    From TencentKona-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 10
Source File: D3DSurfaceData.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void flush() {
    D3DRenderQueue rq = D3DRenderQueue.getInstance();
    rq.lock();
    try {
        RenderBuffer buf = rq.getBuffer();
        rq.ensureCapacityAndAlignment(12, 4);
        buf.putInt(FLUSH_SURFACE);
        buf.putLong(getNativeOps());

        // this call is expected to complete synchronously, so flush now
        rq.flushNow();
    } finally {
        rq.unlock();
    }
}
 
Example 11
Source File: D3DBlitLoops.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 12
Source File: D3DSurfaceData.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Disposes the native resources associated with the given D3DSurfaceData
 * (referenced by the pData parameter).  This method is invoked from
 * the native Dispose() method from the Disposer thread when the
 * Java-level D3DSurfaceData object is about to go away.
 */
static void dispose(long pData) {
    D3DRenderQueue rq = D3DRenderQueue.getInstance();
    rq.lock();
    try {
        RenderBuffer buf = rq.getBuffer();
        rq.ensureCapacityAndAlignment(12, 4);
        buf.putInt(DISPOSE_SURFACE);
        buf.putLong(pData);

        // this call is expected to complete synchronously, so flush now
        rq.flushNow();
    } finally {
        rq.unlock();
    }
}
 
Example 13
Source File: D3DSurfaceData.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Disposes the native resources associated with the given D3DSurfaceData
 * (referenced by the pData parameter).  This method is invoked from
 * the native Dispose() method from the Disposer thread when the
 * Java-level D3DSurfaceData object is about to go away.
 */
static void dispose(long pData) {
    D3DRenderQueue rq = D3DRenderQueue.getInstance();
    rq.lock();
    try {
        RenderBuffer buf = rq.getBuffer();
        rq.ensureCapacityAndAlignment(12, 4);
        buf.putInt(DISPOSE_SURFACE);
        buf.putLong(pData);

        // this call is expected to complete synchronously, so flush now
        rq.flushNow();
    } finally {
        rq.unlock();
    }
}
 
Example 14
Source File: OGLSurfaceData.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Disposes the native resources associated with the given OGLSurfaceData
 * (referenced by the pData parameter).  This method is invoked from
 * the native Dispose() method from the Disposer thread when the
 * Java-level OGLSurfaceData object is about to go away.  Note that we
 * also pass a reference to the OGLGraphicsConfig
 * for the purposes of making a context current.
 */
static void dispose(long pData, OGLGraphicsConfig gc) {
    OGLRenderQueue rq = OGLRenderQueue.getInstance();
    rq.lock();
    try {
        // make sure we have a current context before
        // disposing the native resources (e.g. texture object)
        OGLContext.setScratchSurface(gc);

        RenderBuffer buf = rq.getBuffer();
        rq.ensureCapacityAndAlignment(12, 4);
        buf.putInt(DISPOSE_SURFACE);
        buf.putLong(pData);

        // this call is expected to complete synchronously, so flush now
        rq.flushNow();
    } finally {
        rq.unlock();
    }
}
 
Example 15
Source File: D3DBlitLoops.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public void Blit(SurfaceData src, SurfaceData dst,
                 Composite comp, Region clip,
                 int sx, int sy, int dx, int dy,
                 int w, int h)
{
    D3DRenderQueue rq = D3DRenderQueue.getInstance();
    rq.lock();
    try {
        // make sure the RenderQueue keeps a hard reference to the
        // destination (sysmem) SurfaceData to prevent it from being
        // disposed while the operation is processed on the QFT
        rq.addReference(dst);

        RenderBuffer buf = rq.getBuffer();
        D3DContext.setScratchSurface(((D3DSurfaceData)src).getContext());

        rq.ensureCapacityAndAlignment(48, 32);
        buf.putInt(SURFACE_TO_SW_BLIT);
        buf.putInt(sx).putInt(sy);
        buf.putInt(dx).putInt(dy);
        buf.putInt(w).putInt(h);
        buf.putInt(typeval);
        buf.putLong(src.getNativeOps());
        buf.putLong(dst.getNativeOps());

        // always flush immediately
        rq.flushNow();
    } finally {
        rq.unlock();
    }
}
 
Example 16
Source File: D3DBlitLoops.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public void Blit(SurfaceData src, SurfaceData dst,
                 Composite comp, Region clip,
                 int sx, int sy, int dx, int dy,
                 int w, int h)
{
    D3DRenderQueue rq = D3DRenderQueue.getInstance();
    rq.lock();
    try {
        // make sure the RenderQueue keeps a hard reference to the
        // destination (sysmem) SurfaceData to prevent it from being
        // disposed while the operation is processed on the QFT
        rq.addReference(dst);

        RenderBuffer buf = rq.getBuffer();
        D3DContext.setScratchSurface(((D3DSurfaceData)src).getContext());

        rq.ensureCapacityAndAlignment(48, 32);
        buf.putInt(SURFACE_TO_SW_BLIT);
        buf.putInt(sx).putInt(sy);
        buf.putInt(dx).putInt(dy);
        buf.putInt(w).putInt(h);
        buf.putInt(typeval);
        buf.putLong(src.getNativeOps());
        buf.putLong(dst.getNativeOps());

        // always flush immediately
        rq.flushNow();
    } finally {
        rq.unlock();
    }
}
 
Example 17
Source File: D3DSurfaceData.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
static void swapBuffers(D3DSurfaceData sd,
                        final int x1, final int y1,
                        final int x2, final int y2)
{
    long pData = sd.getNativeOps();
    D3DRenderQueue rq = D3DRenderQueue.getInstance();
    // swapBuffers can be called from the toolkit thread by swing, we
    // should detect this and prevent the deadlocks
    if (rq.isRenderQueueThread()) {
        if (!rq.tryLock()) {
            // if we could not obtain the lock, repaint the area
            // that was supposed to be swapped, and no-op this swap
            final Component target = (Component)sd.getPeer().getTarget();
            SunToolkit.executeOnEventHandlerThread(target, new Runnable() {
                public void run() {
                    target.repaint(x1, y1, x2, y2);
                }
            });
            return;
        }
    } else {
        rq.lock();
    }
    try {
        RenderBuffer buf = rq.getBuffer();
        rq.ensureCapacityAndAlignment(28, 4);
        buf.putInt(SWAP_BUFFERS);
        buf.putLong(pData);
        buf.putInt(x1);
        buf.putInt(y1);
        buf.putInt(x2);
        buf.putInt(y2);
        rq.flushNow();
    } finally {
        rq.unlock();
    }
}
 
Example 18
Source File: OGLBlitLoops.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
public void Blit(SurfaceData src, SurfaceData dst,
                 Composite comp, Region clip,
                 int sx, int sy, int dx, int dy,
                 int w, int h)
{
    if (clip != null) {
        clip = clip.getIntersectionXYWH(dx, dy, w, h);
        // At the end this method will flush the RenderQueue, we should exit
        // from it as soon as possible.
        if (clip.isEmpty()) {
            return;
        }
        sx += clip.getLoX() - dx;
        sy += clip.getLoY() - dy;
        dx = clip.getLoX();
        dy = clip.getLoY();
        w = clip.getWidth();
        h = clip.getHeight();

        if (!clip.isRectangular()) {
            complexClipBlit(src, dst, comp, clip, sx, sy, dx, dy, w, h);
            return;
        }
    }

    OGLRenderQueue rq = OGLRenderQueue.getInstance();
    rq.lock();
    try {
        // make sure the RenderQueue keeps a hard reference to the
        // destination (sysmem) SurfaceData to prevent it from being
        // disposed while the operation is processed on the QFT
        rq.addReference(dst);

        RenderBuffer buf = rq.getBuffer();
        OGLContext.validateContext((OGLSurfaceData)src);

        rq.ensureCapacityAndAlignment(48, 32);
        buf.putInt(SURFACE_TO_SW_BLIT);
        buf.putInt(sx).putInt(sy);
        buf.putInt(dx).putInt(dy);
        buf.putInt(w).putInt(h);
        buf.putInt(typeval);
        buf.putLong(src.getNativeOps());
        buf.putLong(dst.getNativeOps());

        // always flush immediately
        rq.flushNow();
    } finally {
        rq.unlock();
    }
}
 
Example 19
Source File: D3DBlitLoops.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
public void Blit(SurfaceData src, SurfaceData dst,
                 Composite comp, Region clip,
                 int sx, int sy, int dx, int dy,
                 int w, int h)
{
    if (clip != null) {
        clip = clip.getIntersectionXYWH(dx, dy, w, h);
        // At the end this method will flush the RenderQueue, we should exit
        // from it as soon as possible.
        if (clip.isEmpty()) {
            return;
        }

        // Adjust final dst(x,y) and src(x,y) based on the clip. The
        // logic is that, when clip limits drawing on the destination,
        // corresponding pixels from the src should be skipped.
        sx += clip.getLoX() - dx;
        sy += clip.getLoY() - dy;
        dx = clip.getLoX();
        dy = clip.getLoY();
        w = clip.getWidth();
        h = clip.getHeight();

        // Check if the clip is Rectangular. For non-rectangular clips
        // complexClipBlit will convert Surface To Sysmem and perform
        // regular Blit.
        if (!clip.isRectangular()) {
            complexClipBlit(src, dst, comp, clip,
                            sx, sy, dx, dy,
                            w, h);
            return;
        }
    }

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

        RenderBuffer buf = rq.getBuffer();
        D3DContext.setScratchSurface(((D3DSurfaceData)src).getContext());

        rq.ensureCapacityAndAlignment(48, 32);
        buf.putInt(SURFACE_TO_SW_BLIT);
        buf.putInt(sx).putInt(sy);
        buf.putInt(dx).putInt(dy);
        buf.putInt(w).putInt(h);
        buf.putInt(typeval);
        buf.putLong(src.getNativeOps());
        buf.putLong(dst.getNativeOps());

        // always flush immediately
        rq.flushNow();
    } finally {
        rq.unlock();
    }
}
 
Example 20
Source File: OGLContext.java    From jdk8u-jdk with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Makes the given GraphicsConfig's context current to its associated
 * "scratch surface".  Each GraphicsConfig maintains a native context
 * (GLXContext on Unix, HGLRC on Windows) as well as a native pbuffer
 * known as the "scratch surface".  By making the context current to the
 * scratch surface, we are assured that we have a current context for
 * the relevant GraphicsConfig, and can therefore perform operations
 * depending on the capabilities of that GraphicsConfig.  For example,
 * if the GraphicsConfig supports the GL_ARB_texture_non_power_of_two
 * extension, then we should be able to make a non-pow2 texture for this
 * GraphicsConfig once we make the context current to the scratch surface.
 *
 * This method should be used for operations with an OpenGL texture
 * as the destination surface (e.g. a sw->texture blit loop), or in those
 * situations where we may not otherwise have a current context (e.g.
 * when disposing a texture-based surface).
 */
static void setScratchSurface(long pConfigInfo) {
    // assert OGLRenderQueue.getInstance().lock.isHeldByCurrentThread();

    // invalidate the current context
    currentContext = null;

    // set the scratch context
    OGLRenderQueue rq = OGLRenderQueue.getInstance();
    RenderBuffer buf = rq.getBuffer();
    rq.ensureCapacityAndAlignment(12, 4);
    buf.putInt(SET_SCRATCH_SURFACE);
    buf.putLong(pConfigInfo);
}