src/windows/native/sun/java2d/d3d/D3DSurfaceData.cpp

Print this page

        

@@ -31,13 +31,20 @@
 #include "awt_Toolkit.h"
 #include "awt_Window.h"
 #include "awt_BitmapUtil.h"
 #include "D3DRenderQueue.h"
 
+
 // REMIND: move to awt_Component.h
 extern "C" HWND AwtComponent_GetHWnd(JNIEnv *env, jlong pData);
 
+/* This looks weird. but since some AWT headers need to be included,
+ * we end up with AWT's alloc.h macro definition of ExceptionOccurred.
+ * The reasons for that re-defintion do not apply to this code, so undef it.
+ */
+#undef ExceptionOccurred
+
 /**
  * Initializes nativeWidth/Height fields of the SurfaceData object with
  * dimensions on the native surface.
  */
 void D3DSD_SetNativeDimensions(JNIEnv *env, D3DSDOps *d3dsdo) {

@@ -53,11 +60,13 @@
         width = d3dsdo->width;
         height = d3dsdo->height;
     }
 
     JNU_SetFieldByName(env, NULL, sdObject, "nativeWidth", "I", width);
+    if (!(env->ExceptionOccurred())) {
     JNU_SetFieldByName(env, NULL, sdObject, "nativeHeight", "I", height);
+    }
 
     env->DeleteLocalRef(sdObject);
 }
 
 void D3DSD_Flush(void *pData)