< prev index next >

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

Print this page


   1 /*
   2  * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


 154 {
 155     J2dTraceLn(J2D_TRACE_INFO, "D3DPPLM::ReleaseAdapters()");
 156 
 157     D3DRQ_ResetCurrentContextAndDestination();
 158     if (pAdapters != NULL) {
 159         for (UINT i = 0; i < adapterCount; i++) {
 160             if (pAdapters[i].pd3dContext != NULL) {
 161                 delete pAdapters[i].pd3dContext;
 162             }
 163         }
 164         delete[] pAdapters;
 165         pAdapters = NULL;
 166     }
 167     if (defaultFocusWindow != 0) {
 168         DestroyWindow(defaultFocusWindow);
 169         UnregisterClass(L"D3DFocusWindow", GetModuleHandle(NULL));
 170         defaultFocusWindow = 0;
 171     }
 172     currentFSFocusAdapter = -1;
 173     return S_OK;
 174 }
 175 
 176 // static
 177 void D3DPipelineManager::NotifyAdapterEventListeners(UINT adapter,
 178                                                      jint eventType)
 179 {
 180     HMONITOR hMon;
 181     int gdiScreen;
 182     D3DPipelineManager *pMgr;
 183 
 184     // fix for 6946559: if d3d preloading fails jmv may be NULL
 185     if (jvm == NULL) {
 186         return;
 187     }
 188 
 189     JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
 190     RETURN_IF_NULL(env);
 191 
 192     pMgr = D3DPipelineManager::GetInstance();
 193     RETURN_IF_NULL(pMgr);
 194     hMon = pMgr->pd3d9->GetAdapterMonitor(adapter);
 195 
 196     /*
 197      * If we don't have devices initialized yet, no sense to clear them.
 198      */
 199     if (!Devices::GetInstance()){
 200          return;
 201     }
 202 
 203     gdiScreen = AwtWin32GraphicsDevice::GetScreenFromHMONITOR(hMon);
 204 
 205     JNU_CallStaticMethodByName(env, NULL,
 206         "sun/java2d/pipe/hw/AccelDeviceEventNotifier",
 207         "eventOccured", "(II)V",
 208         gdiScreen, eventType);
 209 }
 210 
 211 UINT D3DPipelineManager::GetAdapterOrdinalForScreen(jint gdiScreen)
 212 {
 213     HMONITOR mHnd = AwtWin32GraphicsDevice::GetMonitor(gdiScreen);
 214     if (mHnd == (HMONITOR)0) {
 215         return D3DADAPTER_DEFAULT;
 216     }
 217     return GetAdapterOrdinalByHmon((HMONITOR)mHnd);
 218 }
 219 
 220 // static
 221 HRESULT D3DPipelineManager::HandleAdaptersChange(HMONITOR *pHMONITORs, UINT monNum)
 222 {
 223     HRESULT res = S_OK;
 224     BOOL bResetD3D = FALSE, bFound;
 225 
 226     D3DPipelineManager *pMgr = D3DPipelineManager::GetInstance();
 227     RETURN_STATUS_IF_NULL(pHMONITORs, E_FAIL);
 228     if (pMgr == NULL) {


   1 /*
   2  * Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


 154 {
 155     J2dTraceLn(J2D_TRACE_INFO, "D3DPPLM::ReleaseAdapters()");
 156 
 157     D3DRQ_ResetCurrentContextAndDestination();
 158     if (pAdapters != NULL) {
 159         for (UINT i = 0; i < adapterCount; i++) {
 160             if (pAdapters[i].pd3dContext != NULL) {
 161                 delete pAdapters[i].pd3dContext;
 162             }
 163         }
 164         delete[] pAdapters;
 165         pAdapters = NULL;
 166     }
 167     if (defaultFocusWindow != 0) {
 168         DestroyWindow(defaultFocusWindow);
 169         UnregisterClass(L"D3DFocusWindow", GetModuleHandle(NULL));
 170         defaultFocusWindow = 0;
 171     }
 172     currentFSFocusAdapter = -1;
 173     return S_OK;



































 174 }
 175 
 176 UINT D3DPipelineManager::GetAdapterOrdinalForScreen(jint gdiScreen)
 177 {
 178     HMONITOR mHnd = AwtWin32GraphicsDevice::GetMonitor(gdiScreen);
 179     if (mHnd == (HMONITOR)0) {
 180         return D3DADAPTER_DEFAULT;
 181     }
 182     return GetAdapterOrdinalByHmon((HMONITOR)mHnd);
 183 }
 184 
 185 // static
 186 HRESULT D3DPipelineManager::HandleAdaptersChange(HMONITOR *pHMONITORs, UINT monNum)
 187 {
 188     HRESULT res = S_OK;
 189     BOOL bResetD3D = FALSE, bFound;
 190 
 191     D3DPipelineManager *pMgr = D3DPipelineManager::GetInstance();
 192     RETURN_STATUS_IF_NULL(pHMONITORs, E_FAIL);
 193     if (pMgr == NULL) {


< prev index next >