< prev index next >

src/java.desktop/windows/native/libawt/java2d/d3d/D3DContext.cpp

Print this page

        

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 2007, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.  Oracle designates this

@@ -34,10 +34,11 @@
 #include "D3DRenderQueue.h"
 #include "D3DShaders.h"
 #include "D3DTextRenderer.h"
 #include "D3DPipelineManager.h"
 #include "D3DGlyphCache.h"
+#include "Devices.h"
 
 typedef struct {
     D3DBLEND src;
     D3DBLEND dst;
 } D3DBlendRule;

@@ -210,15 +211,22 @@
     return res;
 }
 
 D3DContext::D3DContext(IDirect3D9 *pd3d, UINT adapter)
 {
+    HMONITOR hMon;
     J2dTraceLn(J2D_TRACE_INFO, "D3DContext::D3DContext");
     J2dTraceLn1(J2D_TRACE_VERBOSE, "  pd3d=0x%x", pd3d);
     pd3dObject = pd3d;
     pd3dDevice = NULL;
     adapterOrdinal = adapter;
+    hMon = pd3d->GetAdapterMonitor(adapter);
+    if (hMon && Devices::GetInstance()) {
+        screen = AwtWin32GraphicsDevice::GetScreenFromHMONITOR(hMon);
+    } else {
+        screen = -1;
+    }
 
     pResourceMgr = NULL;
     pMaskCache = NULL;
     pVCacher = NULL;
 

@@ -252,11 +260,11 @@
     J2dTraceLn(J2D_TRACE_INFO, "D3DContext::ReleaseDefPoolResources");
 
     EndScene();
 
     D3DPipelineManager::NotifyAdapterEventListeners(devCaps.AdapterOrdinal,
-                                                    DEVICE_RESET);
+                                                    DEVICE_RESET, screen);
 
     contextCaps = CAPS_EMPTY;
 
     SAFE_RELEASE(pSyncQuery);
     SAFE_RELEASE(pStateBlock);

@@ -291,11 +299,11 @@
                 pd3dDevice);
 
     ReleaseDefPoolResources();
 
     D3DPipelineManager::NotifyAdapterEventListeners(devCaps.AdapterOrdinal,
-                                                    DEVICE_DISPOSED);
+                                                    DEVICE_DISPOSED, screen);
 
     // dispose shader lists
     ShaderList_Dispose(&convolvePrograms);
     ShaderList_Dispose(&rescalePrograms);
     ShaderList_Dispose(&lookupPrograms);
< prev index next >