/** * Construct this device. Store the screen (index into the devices * array of this object), the array (used in static references via * particular device indices), the monitor/pMonitorInfo (which other * classes will inquire of this device), the bits per pixel of this * device, and information on whether the primary device is palettized. */ AwtWin32GraphicsDevice::AwtWin32GraphicsDevice(int screen, MTSafeArray *arr) { this->screen = screen; this->devicesArray = arr; javaDevice = NULL; colorData = new ImgColorData; colorData->grayscale = GS_NOTGRAY; palette = NULL; cData = NULL; gpBitmapInfo = NULL; monitor = getMHNDFromScreen(screen); pMonitorInfo = (PMONITOR_INFO)new MONITOR_INFO_EXTENDED; pMonitorInfo->dwSize = sizeof(MONITOR_INFO_EXTENDED); ::GetMonitorInfo(monitor, pMonitorInfo); // Set primary device info: other devices will need to know // whether the primary is palettized during the initialization // process HDC hDC = this->GetDC(); colorData->bitsperpixel = ::GetDeviceCaps(hDC, BITSPIXEL); this->ReleaseDC(hDC); if (MONITOR_INFO_FLAG_PRIMARY & pMonitorInfo->dwFlags) { primaryIndex = screen; if (colorData->bitsperpixel > 8) { primaryPalettized = FALSE; } else { primaryPalettized = TRUE; } } }
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(); }