Exemplo n.º 1
0
JNIEXPORT void JNICALL
Java_sun_awt_X11PMBlitBgLoops_nativeBlitBg
    (JNIEnv *env, jobject joSelf,
     jobject srcData, jobject dstData,
     jobject composite, jobject clip, jint pixel,
     jint srcx, jint srcy,
     jint dstx, jint dsty,
     jint width, jint height)
{
#ifndef HEADLESS
    X11SDOps *srcXsdo, *dstXsdo;
    GC dstGC;
    Drawable srcDrawable;

    if (width <= 0 || height <= 0) {
	return;
    }

    srcXsdo = X11SurfaceData_GetOps(env, srcData);
    if (srcXsdo == NULL) {
	return;
    }
    dstXsdo = X11SurfaceData_GetOps(env, dstData);
    if (dstXsdo == NULL) {
	return;
    }

    dstGC = dstXsdo->GetGC(env, dstXsdo, clip, NULL, pixel);
    if (dstGC == NULL) {
	return;
    }

#ifdef MITSHM
    if (srcXsdo->isPixmap) {
	X11SD_UnPuntPixmap(srcXsdo);
    }
#endif /* MITSHM */
    
    srcDrawable = srcXsdo->GetPixmapWithBg(env, srcXsdo, pixel);
    if (srcDrawable == 0) {
	dstXsdo->ReleaseGC(env, dstXsdo, dstGC);
	return;
    }

    /* do an unmasked copy as we've already filled transparent 
       pixels of the source image with the desired color */
    XCopyArea(awt_display, srcDrawable, dstXsdo->drawable, dstGC,
	      srcx, srcy, width, height, dstx, dsty);

    srcXsdo->ReleasePixmapWithBg(env, srcXsdo);
    dstXsdo->ReleaseGC(env, dstXsdo, dstGC);
#endif /* !HEADLESS */
}
Exemplo n.º 2
0
JNIEXPORT void JNICALL
Java_sun_java2d_xr_XRSurfaceData_XRInitSurface(JNIEnv *env, jclass xsd,
                                               jint depth,
                                               jint width, jint height,
                                               jlong drawable, jint pictFormat)
{
#ifndef HEADLESS
    X11SDOps *xsdo;

    J2dTraceLn(J2D_TRACE_INFO, "in XRSurfaceData_initSurface");

    xsdo = X11SurfaceData_GetOps(env, xsd);
    if (xsdo == NULL) {
        return;
    }

    XShared_initSurface(env, xsdo, depth, width, height, drawable);
#endif /* !HEADLESS */
}
Exemplo n.º 3
0
JNIEXPORT void JNICALL
Java_sun_java2d_xr_XRSurfaceData_freeXSDOPicture(JNIEnv *env, jobject xsd,
                                                  jlong pXSData)
{
#ifndef HEADLESS
    X11SDOps *xsdo;

    J2dTraceLn(J2D_TRACE_INFO, "in XRSurfaceData_freeXSDOPicture");

    xsdo = X11SurfaceData_GetOps(env, xsd);
    if (xsdo == NULL) {
        return;
    }

    if(xsdo->xrPic != None) {
       XRenderFreePicture(awt_display, xsdo->xrPic);
       xsdo->xrPic = None;
    }
#endif /* !HEADLESS */
}
Exemplo n.º 4
0
JNIEXPORT void JNICALL
Java_sun_awt_X11PMBlitLoops_Blit
    (JNIEnv *env, jobject joSelf,
     jobject srcData, jobject dstData,
     jobject composite, jobject clip,
     jint srcx, jint srcy,
     jint dstx, jint dsty,
     jint width, jint height)
{
#ifndef HEADLESS
    X11SDOps *srcXsdo, *dstXsdo;
    SurfaceDataBounds span;
    RegionData clipInfo;
    GC xgc;

    if (width <= 0 || height <= 0) {
	return;
    }

    srcXsdo = X11SurfaceData_GetOps(env, srcData);
    if (srcXsdo == NULL) {
	return;
    }
    dstXsdo = X11SurfaceData_GetOps(env, dstData);
    if (dstXsdo == NULL) {
	return;
    }
    if (Region_GetInfo(env, clip, &clipInfo)) {
	return;
    }

    xgc = dstXsdo->GetGC(env, dstXsdo, NULL, NULL, dstXsdo->lastpixel);
    if (xgc == NULL) {
	return;
    }

#ifdef MITSHM
    if (srcXsdo->isPixmap) {
	X11SD_UnPuntPixmap(srcXsdo);
    }
#endif /* MITSHM */

    if (srcXsdo->bitmask != 0) {
	XSetClipOrigin(awt_display, xgc, dstx - srcx, dsty - srcy);
	XSetClipMask(awt_display, xgc, srcXsdo->bitmask);
    }
    span.x1 = dstx;
    span.y1 = dsty;
    span.x2 = dstx + width;
    span.y2 = dsty + height;
    Region_IntersectBounds(&clipInfo, &span);
    if (!Region_IsEmpty(&clipInfo)) {
	Region_StartIteration(env, &clipInfo);
	srcx -= dstx;
	srcy -= dsty;
	while (Region_NextIteration(&clipInfo, &span)) {
	    XCopyArea(awt_display, srcXsdo->drawable, dstXsdo->drawable, xgc,
		      srcx + span.x1, srcy + span.y1,
		      span.x2 - span.x1, span.y2 - span.y1,
		      span.x1, span.y1);
	}
	Region_EndIteration(env, &clipInfo);
    }

    if (srcXsdo->bitmask != 0) {
	XSetClipMask(awt_display, xgc, None);
    }

#ifdef MITSHM
    if (srcXsdo->shmPMData.usingShmPixmap) { 
	srcXsdo->shmPMData.xRequestSent = JNI_TRUE;
    }
#endif /* MITSHM */
    dstXsdo->ReleaseGC(env, dstXsdo, xgc);
#endif /* !HEADLESS */
}
Exemplo n.º 5
0
#endif /* !HEADLESS */
}

/*
 * Class:     sun_awt_X11SurfaceData
 * Method:    isDrawableValid
 * Signature: ()Z
 */
JNIEXPORT jboolean JNICALL
Java_sun_awt_X11SurfaceData_isDrawableValid(JNIEnv *env, jobject this)
{
    jboolean ret = JNI_FALSE;

#ifndef HEADLESS
    X11SDOps *xsdo = X11SurfaceData_GetOps(env, this);

    AWT_LOCK();
    if (xsdo->drawable != 0 || X11SD_InitWindow(env, xsdo) == SD_SUCCESS) {
	ret = JNI_TRUE;
    }
    AWT_UNLOCK();
#endif /* !HEADLESS */

    return ret;
}

/*
 * Class:     sun_awt_X11SurfaceData
 * Method:    isDgaAvailable
 * Signature: ()Z