コード例 #1
0
ファイル: awt_Robot.c プロジェクト: ChenYao/jdk7u-jdk
static int32_t isXTestAvailable() {
    int32_t major_opcode, first_event, first_error;
    int32_t  event_basep, error_basep, majorp, minorp;
    int32_t isXTestAvailable;

    /* check if XTest is available */
    isXTestAvailable = XQueryExtension(awt_display, XTestExtensionName, &major_opcode, &first_event, &first_error);
    DTRACE_PRINTLN3("RobotPeer: XQueryExtension(XTEST) returns major_opcode = %d, first_event = %d, first_error = %d",
                    major_opcode, first_event, first_error);
    if (isXTestAvailable) {
        /* check if XTest version is OK */
        XTestQueryExtension(awt_display, &event_basep, &error_basep, &majorp, &minorp);
        DTRACE_PRINTLN4("RobotPeer: XTestQueryExtension returns event_basep = %d, error_basep = %d, majorp = %d, minorp = %d",
                        event_basep, error_basep, majorp, minorp);
        if (majorp < 2 || (majorp == 2 && minorp < 2)) {
            /* bad version*/
            DTRACE_PRINTLN2("XRobotPeer: XTEST version is %d.%d \n", majorp, minorp);
            if (majorp == 2 && minorp == 1) {
                DTRACE_PRINTLN("XRobotPeer: XTEST is 2.1 - no grab is available\n");
            } else {
                isXTestAvailable = False;
            }
        } else {
            /* allow XTest calls even if someone else has the grab; e.g. during
             * a window resize operation. Works only with XTEST2.2*/
            XTestGrabControl(awt_display, True);
        }
    } else {
        DTRACE_PRINTLN("RobotPeer: XTEST extension is unavailable");
    }

    return isXTestAvailable;
}
コード例 #2
0
static int
awt_mgrsel_managed(XClientMessageEvent *mgrown)
{
    Display *dpy = awt_display;
    struct AwtMgrsel *mgrsel;
    int scr;

    long timestamp;
    Atom selection;
    Window owner;
    long *data;

    if (mgrown->message_type != XA_MANAGER) {
	DTRACE_PRINTLN("MG: ClientMessage type != MANAGER, ignoring");
	return (0);
    }

    scr = awt_mgrsel_screen(mgrown->window);

#ifdef DEBUG
    awt_mgrsel_dtraceManaged(mgrown);
#endif

    if (scr < 0) {
	DTRACE_PRINTLN("MG: MANAGER ClientMessage with a non-root window!");
	return (0);
    }

    timestamp = mgrown->data.l[0];
    selection = mgrown->data.l[1];
    owner     = mgrown->data.l[2];
    data      = &mgrown->data.l[3]; /* long[2], selection specific */

    /* is this a selection we are intrested in? */
    for (mgrsel = mgrsel_list; mgrsel != NULL; mgrsel = mgrsel->next) {
	if (selection == mgrsel->per_scr_atoms[scr])
	    break;
    }

    if (mgrsel == NULL) {
	DTRACE_PRINTLN("MG: not interested in this selection, ignoring");
	return (0);
    }


    mgrsel->per_scr_owners[scr] = owner;

    XSelectInput(dpy, owner, StructureNotifyMask | mgrsel->extra_mask);

    /* notify the listener */
    if (mgrsel->callback_owner != NULL) {
	(*mgrsel->callback_owner)(scr, owner, data, mgrsel->cookie);
    }

    return (1);
}
コード例 #3
0
JNIEXPORT void JNICALL Java_sun_awt_motif_MRobotPeer_setup(JNIEnv * env, jclass cls) {
    RCmdSetup cmd;
    RResultSetup result;

    DTRACE_PRINTLN("MRobotPeer.setup()");
    cmd.code = RCMD_SETUP;
    robot_writeChildCommand((RCmdBase *)&cmd);
    DTRACE_PRINTLN("PARENT: Waiting for setup result ...");
    robot_getChildResult((char *)&result, sizeof result);
    DTRACE_PRINTLN1("PARENT: XTest available = %d", result.isXTestAvailable);

    if (!result.isXTestAvailable) {
	JNU_ThrowByName(env, "java/awt/AWTException", "java.awt.Robot requires your X server support the XTEST extension version 2.2");
    }
}
コード例 #4
0
static void Win32OSSD_GetRasInfo(JNIEnv *env,
			       SurfaceDataOps *ops,
			       SurfaceDataRasInfo *pRasInfo)
{
    Win32SDOps *wsdo = (Win32SDOps *) ops;
    jint lockflags = wsdo->lockFlags;

    DTRACE_PRINTLN("WOSD::Win32OSSD_GetRasInfo");

    if (wsdo->lockType == WIN32SD_LOCK_UNLOCKED) {
	DTRACE_PRINTLN("  lockType == UNLOCKED");
	memset(pRasInfo, 0, sizeof(*pRasInfo));
	return;
    }

    if (wsdo->lockType != WIN32SD_LOCK_BY_DDRAW) {
	/* They didn't lock for anything - we won't give them anything */
	pRasInfo->rasBase = NULL;
	pRasInfo->pixelStride = 0;
	pRasInfo->scanStride = 0;
    }
    if (wsdo->lockFlags & SD_LOCK_LUT) {
	pRasInfo->lutBase = 
	    (long *) wsdo->device->GetSystemPaletteEntries();
	pRasInfo->lutSize = 256;
    } else {
	pRasInfo->lutBase = NULL;
	pRasInfo->lutSize = 0;
    }
    if (wsdo->lockFlags & SD_LOCK_INVCOLOR) {
	pRasInfo->invColorTable = wsdo->device->GetSystemInverseLUT();
	ColorData *cData = wsdo->device->GetColorData();
	pRasInfo->redErrTable = cData->img_oda_red;
	pRasInfo->grnErrTable = cData->img_oda_green;
	pRasInfo->bluErrTable = cData->img_oda_blue;
    } else {
	pRasInfo->invColorTable = NULL;
	pRasInfo->redErrTable = NULL;
	pRasInfo->grnErrTable = NULL;
	pRasInfo->bluErrTable = NULL;
    }
    if (wsdo->lockFlags & SD_LOCK_INVGRAY) {
	pRasInfo->invGrayTable = 
	    wsdo->device->GetColorData()->pGrayInverseLutData;
    } else {
	pRasInfo->invGrayTable = NULL;
    }
}
コード例 #5
0
ファイル: awt_Robot.c プロジェクト: ChenYao/jdk7u-jdk
// this should be called from XRobotPeer constructor
JNIEXPORT void JNICALL
Java_sun_awt_X11_XRobotPeer_setup (JNIEnv * env, jclass cls, jint numberOfButtons, jintArray buttonDownMasks)
{
    int32_t xtestAvailable;
    jint *tmp;
    int i;

    DTRACE_PRINTLN("RobotPeer: setup()");

    num_buttons = numberOfButtons;
    tmp = (*env)->GetIntArrayElements(env, buttonDownMasks, JNI_FALSE);
    masks = (jint *)malloc(sizeof(jint) * num_buttons);
    if (masks == (jint *) NULL) {
        JNU_ThrowOutOfMemoryError((JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2), NULL);
        (*env)->ReleaseIntArrayElements(env, buttonDownMasks, tmp, 0);
        return;
    }
    for (i = 0; i < num_buttons; i++) {
        masks[i] = tmp[i];
    }
    (*env)->ReleaseIntArrayElements(env, buttonDownMasks, tmp, 0);

    AWT_LOCK();
    xtestAvailable = isXTestAvailable();
    DTRACE_PRINTLN1("RobotPeer: XTest available = %d", xtestAvailable);
    if (!xtestAvailable) {
        JNU_ThrowByName(env, "java/awt/AWTException", "java.awt.Robot requires your X server support the XTEST extension version 2.2");
    }

    AWT_UNLOCK();
}
コード例 #6
0
/*
 * Hook to be called from toolkit event loop.
 */
int
awt_mgrsel_processEvent(XEvent *ev)
{
    Display *dpy = awt_display;
    struct AwtMgrsel *mgrsel;
    int scr;

    if (ev->type == ClientMessage) { /* new manager announces ownership? */
	if (awt_mgrsel_managed(&ev->xclient))
	    return (1);
    }

    if (ev->type == DestroyNotify) { /* manager gives up selection? */
	if (awt_mgrsel_unmanaged(&ev->xdestroywindow))
	    return (1);	
    }

    /* is this an event selected on one of selection owners? */
    for (mgrsel = mgrsel_list; mgrsel != NULL; mgrsel = mgrsel->next) {
	for (scr = 0; scr < ScreenCount(dpy); ++scr) {
	    if (ev->xany.window == mgrsel->per_scr_owners[scr]) {
		/* can one window own selections for more than one screen? */
		goto out;	/* XXX??? */
	    }
	}
    }
  out:
    DTRACE_PRINT2("MG: screen %d, event %d ...  ",
		  scr, ev->xany.type);
    if (mgrsel == NULL) {
	DTRACE_PRINTLN("ignored");
	return (0);		/* not interested */
    }

    DTRACE_PRINT1("%s ...  ", mgrsel->selname);
    if (mgrsel->callback_event != NULL) {
	DTRACE_PRINTLN("dispatching");
	(*mgrsel->callback_event)(scr, ev, mgrsel->cookie);
    }
#ifdef DEBUG
    else {
	DTRACE_PRINTLN("no callback");
    }
#endif

    return (1);
}
コード例 #7
0
DDraw::~DDraw() {
    DTRACE_PRINTLN("DDraw::~DDraw");
    if (dxObject) {
	delete dxObject;
    }
    if (d3dContext) {
	delete d3dContext;
    }
}
コード例 #8
0
ファイル: awt_util.c プロジェクト: AllenWeb/openjdk-1
void awt_util_delEmbeddedFrame(Widget embeddedFrame)
{
    EmbeddedFrame *ef = theEmbeddedFrameList;
    Window frameContainer;
    XWindowAttributes win_attributes;
    Boolean needToDeselect;

    while (ef != NULL) {
        if (ef->embeddedFrame == embeddedFrame) {
            break;
        }
        ef = ef->next;
    }
    if (ef == NULL) { /* cannot find specified embedded frame */
        return;
    }
    /* remove ef from link list EmbeddedFrameList */
    if (ef->prev) {
        ef->prev->next = ef->next;
    }
    if (ef->next) {
        ef->next->prev = ef->prev;
    }
    if (theEmbeddedFrameList == ef) {
        theEmbeddedFrameList = ef->next;
    }

    frameContainer = ef->frameContainer;
    needToDeselect = ef->eventSelectedPreviously ? False : True;
    free(ef);
    if (!needToDeselect) {
        return;
    }
    /*
     * now decide whether we need to stop listenning event for
     * frameContainer
     */
    ef = theEmbeddedFrameList;
    while (ef != NULL) {
        if (ef->frameContainer == frameContainer) {
            break;
        }
        ef = ef->next;
    }
    if (ef == NULL)  {
        /*
         * if we get here, no one is interested in this frame
         * and StructureNotify was not selected by anyone else
         * so we deselect it
         */
        DTRACE_PRINTLN("remove event from frame");
        XGetWindowAttributes(awt_display, frameContainer, &win_attributes);
        XSelectInput(awt_display, frameContainer,
            win_attributes.your_event_mask &
                (~FocusChangeMask));
    }
}
コード例 #9
0
ファイル: awt_Cursor.cpp プロジェクト: frohoff/jdk6
/*
 * Class:     sun_awt_windows_WCustomCursor
 * Method:    getCursorHeight
 * Signature: ()I
 */
JNIEXPORT jint JNICALL
Java_sun_awt_windows_WCustomCursor_getCursorHeight(JNIEnv *, jclass)
{
    TRY;

    DTRACE_PRINTLN("WCustomCursor.getCursorHeight()");
    return (jint)::GetSystemMetrics(SM_CYCURSOR);

    CATCH_BAD_ALLOC_RET(0);
}
コード例 #10
0
/*
 * Class:     sun_awt_windows_Win32OffScreenSurfaceData
 * Method:    invalidateSD
 * Signature: ()V
 */
JNIEXPORT void JNICALL 
Java_sun_awt_windows_Win32OffScreenSurfaceData_nativeInvalidate(JNIEnv *env, 
								jobject wsd)
{
    Win32SDOps *wsdo = (Win32SDOps *)SurfaceData_GetOps(env, wsd);
    DTRACE_PRINTLN("Win32OffScreenSurfaceData_nativeInvalidate");
    if (wsdo != NULL) {
	wsdo->InvalidateSD(env, wsdo);
    }
}
コード例 #11
0
/*
 * Class:     sun_awt_windows_Win32OffScreenSurfaceData
 * Method:    initIDs
 * Signature: ()V
 */
JNIEXPORT void JNICALL
Java_sun_awt_windows_Win32OffScreenSurfaceData_initIDs(JNIEnv *env, jclass wsd)
{
    DTRACE_PRINTLN("Java_sun_awt_windows_Win32OffScreenSurfaceData_initIDs");
    localD3dEnabledID = env->GetFieldID(wsd, "localD3dEnabled", "Z");
    d3dClippingEnabledID = env->GetFieldID(wsd, "d3dClippingEnabled", "Z");
    ddSurfacePuntedID = env->GetFieldID(wsd, "ddSurfacePunted", "Z");
    markSurfaceLostMID = env->GetMethodID(wsd, "markSurfaceLost", "()V");
    nullbrush = (HBRUSH) ::GetStockObject(NULL_BRUSH);
    nullpen = (HPEN) ::GetStockObject(NULL_PEN);
}
コード例 #12
0
static void Win32OSSD_Unlock(JNIEnv *env,
			     SurfaceDataOps *ops,
			     SurfaceDataRasInfo *pRasInfo)
{
    Win32SDOps *wsdo = (Win32SDOps *) ops;

    DTRACE_PRINTLN("WOSD::Win32OSSD_Unlock");

    if (wsdo->lockType == WIN32SD_LOCK_UNLOCKED) {
	JNU_ThrowInternalError(env, "Unmatched unlock on Win32OS SurfaceData");
	return;
    }

    if (wsdo->lockType == WIN32SD_LOCK_BY_DDRAW) {
	DTRACE_PRINTLN("Unlocking ddraw surface");
	DDUnlock(env, wsdo);
    }
    wsdo->lockType = WIN32SD_LOCK_UNLOCKED;
    wsdo->surfaceLock->Leave();
}
コード例 #13
0
int getScreenFromMHND(MHND mon) {
    DASSERT(mon != NULL);

    for (int i = 0; i < awt_numScreens; i++) {
        if (areSameMonitors(mon, getMHNDFromScreen(i))) {
            return i;
        }
    }
    DTRACE_PRINTLN("getScreenFromMHND(): couldn't find screen, return default");
    return AwtWin32GraphicsDevice::GetDefaultDeviceIndex();
}
コード例 #14
0
void Win32OSSD_RestoreSurface(JNIEnv *env, Win32SDOps *wsdo) 
{
    DTRACE_PRINTLN("Win32OSSD_RestoreSurface: throwing exception");
    wsdo->surfaceLost = TRUE;
    jobject sdObject = env->NewLocalRef(wsdo->sdOps.sdObject);
    if (sdObject != NULL) {
	// markSurfaceLost will end up throwing an InvalidPipeException
	// if this surface belongs to a managed image.
        env->CallVoidMethod(sdObject, markSurfaceLostMID);
        env->DeleteLocalRef(sdObject);
    }
}
コード例 #15
0
ファイル: debug_mem.c プロジェクト: sakeinntojiu/openjdk8-jdk
static void DMem_DumpHeader(MemoryBlockHeader * header) {
    char        report[FILENAME_MAX+MAX_DECIMAL_DIGITS*3+1];
    static const char * reportFormat =
        "file:  %s, line %d\n"
        "size:  %d bytes\n"
        "order: %d\n"
        "-------";

    DMem_VerifyHeader(header);
    sprintf(report, reportFormat, header->filename, header->linenumber, header->size, header->order);
    DTRACE_PRINTLN(report);
}
コード例 #16
0
extern "C" JNIEXPORT void JNICALL DSFreeDrawingSurface
    (JAWT_DrawingSurface* ds)
{
    TRY_NO_VERIFY;

    if (ds == NULL) {
        DTRACE_PRINTLN("Drawing Surface is NULL");
    }
    delete static_cast<JAWTDrawingSurface*>(ds);

    CATCH_BAD_ALLOC;
}
コード例 #17
0
/*
 * Class:     sun_awt_windows_Win32OffScreenSurfaceData
 * Method:    flush
 * Signature: ()V
 */
JNIEXPORT void JNICALL 
Java_sun_awt_windows_Win32OffScreenSurfaceData_flush(JNIEnv *env, 
						     jobject wsd)
{
    DTRACE_PRINTLN("Win32OffScreenSurfaceData_flush");
    Win32SDOps *wsdo = (Win32SDOps *)SurfaceData_GetOps(env, wsd);
    if (wsdo != NULL) {
	// Note that wsdo may be null if there was some error during
	// construction, such as a surface depth we could not handle
	DDReleaseSurfaceMemory(wsdo->surfacePuntData.lpSurfaceSystem);
	DDReleaseSurfaceMemory(wsdo->surfacePuntData.lpSurfaceVram);
    }
}
コード例 #18
0
ファイル: debug_mem.c プロジェクト: sakeinntojiu/openjdk8-jdk
/*
 * Call this function at shutdown time to report any leaked blocks
 */
void DMem_ReportLeaks() {
    MemoryListLink *    link;

    DMutex_Enter(DMemMutex);

    /* Force memory leaks to be output regardless of trace settings */
    DTrace_EnableFile(THIS_FILE, TRUE);
    DTRACE_PRINTLN("--------------------------");
    DTRACE_PRINTLN("Debug Memory Manager Leaks");
    DTRACE_PRINTLN("--------------------------");

    /* walk through allocated list and dump any blocks not marked as freed */
    link = MemoryList.next;
    while (link != NULL) {
        if ( !link->freed ) {
            DMem_DumpHeader(link->header);
        }
        link = link->next;
    }

    DMutex_Exit(DMemMutex);
}
コード例 #19
0
jint JAWTDrawingSurfaceInfo::Init(JAWTDrawingSurface* parent)
{
    TRY;

    JNIEnv* env = parent->env;
    jobject target = parent->target;
    if (JNU_IsNull(env, target)) {
        DTRACE_PRINTLN("NULL target");
        return JAWT_LOCK_ERROR;
    }
    HWND newHwnd = AwtComponent::GetHWnd(env, target);
    if (!::IsWindow(newHwnd)) {
        DTRACE_PRINTLN("Bad HWND");
        return JAWT_LOCK_ERROR;
    }
    jint retval = 0;
    platformInfo = this;
    ds = parent;
    bounds.x = env->GetIntField(target, AwtComponent::xID);
    bounds.y = env->GetIntField(target, AwtComponent::yID);
    bounds.width = env->GetIntField(target, AwtComponent::widthID);
    bounds.height = env->GetIntField(target, AwtComponent::heightID);
    if (hwnd != newHwnd) {
        if (hwnd != NULL) {
            ::ReleaseDC(hwnd, hdc);
            retval = JAWT_LOCK_SURFACE_CHANGED;
        }
        hwnd = newHwnd;
        hdc = ::GetDCEx(hwnd, NULL, DCX_CACHE|DCX_CLIPCHILDREN|DCX_CLIPSIBLINGS);
    }
    clipSize = 1;
    clip = &bounds;
    int screen = AwtWin32GraphicsDevice::DeviceIndexForWindow(hwnd);
    hpalette = AwtWin32GraphicsDevice::GetPalette(screen);

    return retval;

    CATCH_BAD_ALLOC_RET(JAWT_LOCK_ERROR);
}
コード例 #20
0
void JNICALL JAWTDrawingSurface::UnlockSurface
    (JAWT_DrawingSurface* ds)
{
    TRY_NO_VERIFY;

    if (ds == NULL) {
        DTRACE_PRINTLN("Drawing Surface is NULL");
        return;
    }
    JAWTDrawingSurface* pds = static_cast<JAWTDrawingSurface*>(ds);

    CATCH_BAD_ALLOC;
}
コード例 #21
0
/*
 * Class:     sun_awt_windows_Win32OffScreenSurfaceData
 * Method:    restoreSurface
 * Signature: ()V
 */
JNIEXPORT void JNICALL
Java_sun_awt_windows_Win32OffScreenSurfaceData_restoreSurface(JNIEnv *env, 
							      jobject sData)
{
    DTRACE_PRINTLN("native method Win32OSSD_RestoreSurface: restoring offscreen");
    Win32SDOps *wsdo = (Win32SDOps *)SurfaceData_GetOps(env, sData);

    // Might have gotten here by some default action.  Make sure that the
    // surface is marked as lost before bothering to try to restore it.
    if (!wsdo->surfaceLost) {
	return;
    }

    // Attempt to restore and lock the surface (to make sure the restore worked)
    if (DDRestoreSurface(wsdo) && DDLock(env, wsdo, NULL, NULL)) {
	DDUnlock(env, wsdo);
	wsdo->surfaceLost = FALSE;
    } else {
	// Failure - throw exception
	DTRACE_PRINTLN("Win32OSSD_restoreSurface: problems restoring");
	SurfaceData_ThrowInvalidPipeException(env, "RestoreSurface failure");
    }
}
コード例 #22
0
JAWT_DrawingSurfaceInfo* JNICALL JAWTDrawingSurface::GetDSI
    (JAWT_DrawingSurface* ds)
{
    TRY;

    if (ds == NULL) {
        DTRACE_PRINTLN("Drawing Surface is NULL");
        return NULL;
    }
    JAWTDrawingSurface* pds = static_cast<JAWTDrawingSurface*>(ds);
    return &(pds->info);

    CATCH_BAD_ALLOC_RET(NULL);
}
コード例 #23
0
/*
 * Class:     sun_awt_windows_Win32D3DRenderer
 * Method:    doDrawRectD3D
 * Signature: (Lsun/java2d/SurfaceData;IIIII)Z
 */
JNIEXPORT jboolean JNICALL
Java_sun_awt_windows_Win32D3DRenderer_doDrawRectD3D
    (JNIEnv *env, jobject wr,
     jobject sData,
     jint color,
     jint x, jint y, jint w, jint h,
     jint clipX1, jint clipY1, jint clipX2, jint clipY2)
{
    Win32SDOps	    *wsdo = Win32SurfaceData_GetOpsNoSetup(env, sData);

    DTRACE_PRINTLN("Win32D3DRenderer_doDrawRectD3D");

    return D3DRect(env, wsdo, x, y, w, h, clipX1, clipY1, clipX2, clipY2, color);
}
コード例 #24
0
extern "C" JNIEXPORT JAWT_DrawingSurface* JNICALL DSGetDrawingSurface
    (JNIEnv* env, jobject target)
{
    TRY;

    // See if the target component is a java.awt.Component
    if (env->IsInstanceOf(target, jawtComponentClass)) {
        return new JAWTDrawingSurface(env, target);
    }

    DTRACE_PRINTLN("GetDrawingSurface target must be a Component");
    return NULL;

    CATCH_BAD_ALLOC_RET(NULL);
}
コード例 #25
0
ファイル: awt_util.c プロジェクト: AllenWeb/openjdk-1
static void awt_util_updateXtCoordinatesForEmbeddedFrame(Widget ef)
{
    Window ef_window;
    Window win;
    int32_t x, y;
    ef_window = XtWindow(ef);
    if (ef_window != None) {
        if (XTranslateCoordinates(awt_display, ef_window,
            RootWindowOfScreen(XtScreen(ef)),
            0, 0, &x, &y, &win)) {
            DTRACE_PRINTLN("correcting coordinates");
            ef->core.x = x;
            ef->core.y = y;
        }
    }
}
コード例 #26
0
JNIEXPORT void JNICALL 
Java_sun_awt_windows_Win32OffScreenSurfaceData_initSurface(JNIEnv *env, 
							   jobject sData, 
							   jint depth, 
							   jint width,
							   jint height,
							   jint screen,
							   jboolean isVolatile,
                                                           jint transparency)
{
    Win32SDOps *wsdo = (Win32SDOps *)SurfaceData_GetOps(env, sData);

    DTRACE_PRINTLN("Win32OSSD_initSurface");
    initOSSD_WSDO(env, wsdo, width, height, screen, transparency);
    if (!DDCreateSurface(wsdo, isVolatile /* d3d caps desired, if possible */)) {
	DTRACE_PRINTLN1("Win32OSD.initSurface: Can't create offsc surf tr=%d\n",
			transparency);
	SurfaceData_ThrowInvalidPipeException(env, 
					      "Can't create offscreen surf");
    } else {
	wsdo->surfacePuntData.lpSurfaceVram = wsdo->lpSurface;
	if (!D3DEnabled(wsdo)) {
	    // d3d enabled by default for each surface - disable if necessary
	    env->SetBooleanField(sData, localD3dEnabledID, JNI_FALSE);
	} else {
	    env->SetBooleanField(sData, d3dClippingEnabledID, 
	    			 (DDINSTANCE_USABLE(wsdo->ddInstance) && 
	    			  wsdo->ddInstance->canClipD3dLines));
	}
    }
    // 8 is somewhat arbitrary; we want the threshhold to represent a
    // significant portion of the surface area in order to avoid
    // punting for occasional, small reads
    wsdo->surfacePuntData.pixelsReadThreshold = width * height / 8;
    /**
     * Only enable our punt-to-sysmem-surface scheme for surfaces that are:
     *   - non-transparent (we really only intended this workaround for
     *     back buffers, which are usually opaque)
     *   - volatile (non-volatile images should not even get into the punt
     *     situation since they should not be a rendering destination, but
     *     we check this just to make sure)
     * And only do so if the user did not specify that punting be disabled
     */
    wsdo->surfacePuntData.disablePunts = (transparency != TR_OPAQUE) ||
                                         !isVolatile                 ||
					 ddVramForced;
}
コード例 #27
0
jint JNICALL JAWTDrawingSurface::LockSurface
    (JAWT_DrawingSurface* ds)
{
    TRY;

    if (ds == NULL) {
        DTRACE_PRINTLN("Drawing Surface is NULL");
        return JAWT_LOCK_ERROR;
    }
    JAWTDrawingSurface* pds = static_cast<JAWTDrawingSurface*>(ds);
    jint val = pds->info.Init(pds);
    if ((val & JAWT_LOCK_ERROR) != 0) {
        return val;
    }
    val = AwtComponent::GetDrawState(pds->info.hwnd);
    AwtComponent::SetDrawState(pds->info.hwnd, 0);
    return val;

    CATCH_BAD_ALLOC_RET(JAWT_LOCK_ERROR);
}
コード例 #28
0
/*
 * Method:    Win32OSSD_Dispose
 */
static void
Win32OSSD_Dispose(JNIEnv *env, SurfaceDataOps *ops)
{
    DTRACE_PRINTLN("Win32OSSD_Dispose");
    // REMIND: Need to delete a lot of other things here as well, starting
    // with the offscreen surface

    // ops is assumed non-null as it is checked in SurfaceData_DisposeOps
    Win32SDOps *wsdo = (Win32SDOps*)ops;
    if (wsdo->surfacePuntData.lpSurfaceVram) {
	delete wsdo->surfacePuntData.lpSurfaceVram;
    }
    if (wsdo->surfacePuntData.lpSurfaceSystem) {
	delete wsdo->surfacePuntData.lpSurfaceSystem;
    }
    if (wsdo->brush != NULL) {
	wsdo->brush->Release();
    }
    if (wsdo->pen != NULL) {
	wsdo->pen->Release();
    }
    wsdo->lpSurface = NULL;
    disposeOSSD_WSDO(env, wsdo);
}
コード例 #29
0
ファイル: ThemeReader.cpp プロジェクト: netroby/jdk9-dev
BOOL InitThemes() {
    static HMODULE hModThemes = NULL;
    hModThemes = JDK_LoadSystemLibrary("UXTHEME.DLL");
    DTRACE_PRINTLN1("InitThemes hModThemes = %x\n", hModThemes);
    if(hModThemes) {
        DTRACE_PRINTLN("Loaded UxTheme.dll\n");
        OpenThemeData = (PFNOPENTHEMEDATA)GetProcAddress(hModThemes,
                                                        "OpenThemeData");
        DrawThemeBackground = (PFNDRAWTHEMEBACKGROUND)GetProcAddress(
                                        hModThemes, "DrawThemeBackground");
        CloseThemeData = (PFNCLOSETHEMEDATA)GetProcAddress(
                                                hModThemes, "CloseThemeData");
        DrawThemeText = (PFNDRAWTHEMETEXT)GetProcAddress(
                                        hModThemes, "DrawThemeText");
        GetThemeBackgroundContentRect = (PFNGETTHEMEBACKGROUNDCONTENTRECT)
                GetProcAddress(hModThemes, "GetThemeBackgroundContentRect");
        GetThemeMargins = (PFNGETTHEMEMARGINS)GetProcAddress(
                                        hModThemes, "GetThemeMargins");
        IsThemePartDefined = (PFNISTHEMEPARTDEFINED)GetProcAddress(
                                        hModThemes, "IsThemePartDefined");
        GetThemeBool = (PFNGETTHEMEBOOL)GetProcAddress(
                                        hModThemes, "GetThemeBool");
        GetThemeSysBool = (PFNGETTHEMESYSBOOL)GetProcAddress(hModThemes,
                                                        "GetThemeSysBool");
        GetThemeColor = (PFNGETTHEMECOLOR)GetProcAddress(hModThemes,
                                                        "GetThemeColor");
        GetThemeEnumValue = (PFNGETTHEMEENUMVALUE)GetProcAddress(hModThemes,
                                                "GetThemeEnumValue");
        GetThemeInt = (PFNGETTHEMEINT)GetProcAddress(hModThemes, "GetThemeInt");
        GetThemePosition = (PFNGETTHEMEPOSITION)GetProcAddress(hModThemes,
                                                        "GetThemePosition");
        GetThemePartSize = (PFNGETTHEMEPARTSIZE)GetProcAddress(hModThemes,
                                                         "GetThemePartSize");
        SetWindowTheme = (PFNSETWINDOWTHEME)GetProcAddress(hModThemes,
                                                        "SetWindowTheme");
        IsThemeBackgroundPartiallyTransparent =
            (PFNISTHEMEBACKGROUNDPARTIALLYTRANSPARENT)GetProcAddress(hModThemes,
                                       "IsThemeBackgroundPartiallyTransparent");
        //this function might not exist
        GetThemeTransitionDuration =
            (PFNGETTHEMETRANSITIONDURATION)GetProcAddress(hModThemes,
                                        "GetThemeTransitionDuration");

        if(OpenThemeData
           && DrawThemeBackground
           && CloseThemeData
           && DrawThemeText
           && GetThemeBackgroundContentRect
           && GetThemeMargins
           && IsThemePartDefined
           && GetThemeBool
           && GetThemeSysBool
           && GetThemeColor
           && GetThemeEnumValue
           && GetThemeInt
           && GetThemePartSize
           && GetThemePosition
           && SetWindowTheme
           && IsThemeBackgroundPartiallyTransparent
          ) {
              DTRACE_PRINTLN("Loaded function pointers.\n");
              // We need to make sure we can load the Theme. This may not be
              // the case on a WinXP machine with classic mode enabled.
              HTHEME hTheme = OpenThemeData(AwtToolkit::GetInstance().GetHWnd(), L"Button");
              if(hTheme) {
                  DTRACE_PRINTLN("Loaded Theme data.\n");
                  CloseThemeData(hTheme);
                  return TRUE;
              }
            } else {
               FreeLibrary(hModThemes);
               hModThemes = NULL;
            }
    }
    return FALSE;
}
コード例 #30
0
static void Win32OSSD_InvalidateSD(JNIEnv *env, Win32SDOps *wsdo)
{
    DTRACE_PRINTLN("Win32OSSD_InvalidateSD");
    wsdo->invalid = JNI_TRUE;
}