static void dc_Init_ScreenDC (void) { __mg_screen_dc.DataType = TYPE_HDC; __mg_screen_dc.DCType = TYPE_SCRDC; __mg_screen_dc.hwnd = 0; __mg_screen_dc.gc = PHYSICALGC; __mg_screen_dc.bkcolor = PIXEL_lightwhite; __mg_screen_dc.bkmode = 0; __mg_screen_dc.brushtype = BT_SOLID; __mg_screen_dc.brushcolor = PIXEL_lightwhite; __mg_screen_dc.BrushOrig.x = __mg_screen_dc.BrushOrig.y = 0; __mg_screen_dc.pentype = PT_SOLID; __mg_screen_dc.pencolor = PIXEL_black; __mg_screen_dc.CurPenPos.x = __mg_screen_dc.CurPenPos.y = 0; __mg_screen_dc.textcolor = PIXEL_black; __mg_screen_dc.pLogFont = GetSystemFont (SYSLOGFONT_WCHAR_DEF); __mg_screen_dc.tabstop = 8; __mg_screen_dc.CurTextPos.x = __mg_screen_dc.CurTextPos.y = 0; __mg_screen_dc.cExtra = __mg_screen_dc.alExtra = __mg_screen_dc.blExtra = 0; __mg_screen_dc.ViewOrig.x = __mg_screen_dc.ViewOrig.y = 0; __mg_screen_dc.ViewExtent.x = __mg_screen_dc.ViewExtent.y = 1; __mg_screen_dc.WindowOrig.x = __mg_screen_dc.WindowOrig.y = 0; __mg_screen_dc.WindowExtent.x = __mg_screen_dc.WindowExtent.y = 1; __mg_screen_dc.bIsClient = FALSE; // init local clip region InitClipRgn (&__mg_screen_dc.lcrgn, &sg_FreeClipRectList); // init effective clip region InitClipRgn (&__mg_screen_dc.ecrgn, &sg_FreeClipRectList); // init global clip region information __mg_screen_dc.pGCRInfo = NULL; __mg_screen_dc.oldage = 0; __mg_screen_dc.DevRC.left = 0; __mg_screen_dc.DevRC.top = 0; __mg_screen_dc.DevRC.right = WIDTHOFPHYGC - 1; __mg_screen_dc.DevRC.bottom = HEIGHTOFPHYGC - 1; // Set local clip region and effetive clip region to the screen. SetClipRgn (&__mg_screen_dc.lcrgn, &__mg_screen_dc.DevRC); SetClipRgn (&__mg_screen_dc.ecrgn, &__mg_screen_dc.DevRC); }
HDC GUIAPI CreatePrivateClientDC(HWND hwnd) { PDC pdc; if (!(pdc = malloc (sizeof(DC)))) return HDC_INVALID; InitClipRgn (&pdc->lcrgn, &sg_FreeClipRectList); InitClipRgn (&pdc->ecrgn, &sg_FreeClipRectList); pdc->inuse = TRUE; pdc->DataType = TYPE_HDC; pdc->DCType = TYPE_GENDC; dc_InitDC(pdc, hwnd, TRUE); return (HDC)(pdc); }
// This function init clip region in all DC slots. static void dc_InitClipRgnInfo(void) { int i; for (i=0; i<DCSLOTNUMBER; i++) { // Local clip region InitClipRgn(&DCSlot[i].lcrgn, &sg_FreeClipRectList); // Global clip region info DCSlot[i].pGCRInfo = NULL; DCSlot[i].oldage = 0; // Effective clip region InitClipRgn(&DCSlot[i].ecrgn, &sg_FreeClipRectList); } }
/* * Function: HDC GUIAPI CreateCompatibleDC (HDC hdc) * This function create a memory dc, which is compatible * with specified hdc. * Parameters: * HDC hdc: the specified DC handle. * Return: * None. */ HDC GUIAPI CreateCompatibleDC(HDC hdc) { GAL_GC gc; PDC pdc; PDC pMemDC = NULL; pdc = dc_HDC2PDC(hdc); if (!(pMemDC = malloc (sizeof(DC)))) return HDC_INVALID; pthread_mutex_lock (&__mg_gdilock); if (GAL_AllocateGC (pdc->gc, RECTW (pdc->DevRC), RECTH (pdc->DevRC), GAL_BytesPerPixel (pdc->gc), &gc) != 0) { pthread_mutex_unlock (&__mg_gdilock); return HDC_INVALID; } pthread_mutex_unlock (&__mg_gdilock); memcpy (pMemDC, pdc, sizeof(DC)); pMemDC->DataType = TYPE_HDC; pMemDC->DCType = TYPE_MEMDC; pMemDC->inuse = TRUE; pMemDC->gc = gc; // clip region info InitClipRgn (&pMemDC->lcrgn, &sg_FreeClipRectList); InitClipRgn (&pMemDC->ecrgn, &sg_FreeClipRectList); pMemDC->pGCRInfo = NULL; pMemDC->oldage = 0; pMemDC->DevRC.left = 0; pMemDC->DevRC.top = 0; pMemDC->DevRC.right = RECTW(pdc->DevRC); pMemDC->DevRC.bottom = RECTH(pdc->DevRC); SetClipRgn (&pMemDC->ecrgn, &pMemDC->DevRC); return (HDC)pMemDC; }
static BOOL InitWndManagementInfo (void) { if (!InitMainWinMetrics()) return FALSE; __mg_capture_wnd = 0; __mg_active_mainwnd = NULL; __mg_ptmi = NULL; __mg_ime_wnd = 0; sg_hCaretWnd = 0; g_rcScr.left = g_rcScr.top = 0; g_rcScr.right = GetGDCapability (HDC_SCREEN, GDCAP_MAXX) + 1; g_rcScr.bottom = GetGDCapability (HDC_SCREEN, GDCAP_MAXY) + 1; InitClipRgn (&sg_ScrGCRInfo.crgn, &sg_FreeClipRectList); SetClipRgn (&sg_ScrGCRInfo.crgn, &g_rcScr); pthread_mutex_init (&sg_ScrGCRInfo.lock, NULL); sg_ScrGCRInfo.age = 0; return TRUE; }