VOID FASTCALL co_IntDrawCaret(PWND pWnd, PTHRDCARETINFO CaretInfo) { HDC hdc, hdcMem; HBITMAP hbmOld; BOOL bDone = FALSE; hdc = UserGetDCEx(pWnd, 0, DCX_USESTYLE | DCX_WINDOW); if (!hdc) { ERR("GetDC failed\n"); return; } if (pWnd->hrgnUpdate) { NtGdiSaveDC(hdc); } if(CaretInfo->Bitmap && NtGdiGetBitmapDimension(CaretInfo->Bitmap, &CaretInfo->Size)) { hdcMem = NtGdiCreateCompatibleDC(hdc); if (hdcMem) { hbmOld = NtGdiSelectBitmap(hdcMem, CaretInfo->Bitmap); bDone = NtGdiBitBlt(hdc, CaretInfo->Pos.x, CaretInfo->Pos.y, CaretInfo->Size.cx, CaretInfo->Size.cy, hdcMem, 0, 0, SRCINVERT, 0, 0); NtGdiSelectBitmap(hdcMem, hbmOld); GreDeleteObject(hdcMem); } } if (!bDone) { NtGdiPatBlt(hdc, CaretInfo->Pos.x, CaretInfo->Pos.y, CaretInfo->Size.cx, CaretInfo->Size.cy, DSTINVERT); } if (pWnd->hrgnUpdate) { NtGdiRestoreDC(hdc, -1); } UserReleaseDC(pWnd, hdc, FALSE); }
INT WINAPI FillRect(HDC hDC, CONST RECT *lprc, HBRUSH hbr) { BOOL Ret; HBRUSH prevhbr = NULL; /* Select brush if specified */ if (hbr) { /* Handle system colors */ if (hbr <= (HBRUSH)(COLOR_MENUBAR + 1)) hbr = IntGetSysColorBrush(PtrToUlong(hbr) - 1); prevhbr = NtGdiSelectBrush(hDC, hbr); if (prevhbr == NULL) return (INT)FALSE; } Ret = NtGdiPatBlt(hDC, lprc->left, lprc->top, lprc->right - lprc->left, lprc->bottom - lprc->top, PATCOPY); /* Select old brush */ if (prevhbr) NtGdiSelectBrush(hDC, prevhbr); return (INT)Ret; }
INT WINAPI FrameRect(HDC hDC, CONST RECT *lprc, HBRUSH hbr) { HBRUSH oldbrush; RECT r = *lprc; if ((r.right <= r.left) || (r.bottom <= r.top)) return 0; if (!(oldbrush = NtGdiSelectBrush(hDC, hbr))) return 0; NtGdiPatBlt(hDC, r.left, r.top, 1, r.bottom - r.top, PATCOPY); NtGdiPatBlt(hDC, r.right - 1, r.top, 1, r.bottom - r.top, PATCOPY); NtGdiPatBlt(hDC, r.left, r.top, r.right - r.left, 1, PATCOPY); NtGdiPatBlt(hDC, r.left, r.bottom - 1, r.right - r.left, 1, PATCOPY); NtGdiSelectBrush(hDC, oldbrush); return TRUE; }
BOOL WINAPI PatBlt(HDC hdc, int nXLeft, int nYLeft, int nWidth, int nHeight, DWORD dwRop) { /* FIXME some part need be done in user mode */ return NtGdiPatBlt( hdc, nXLeft, nYLeft, nWidth, nHeight, dwRop); }
/* Ported from WINE20020904 */ void FASTCALL UITOOLS_DrawCheckedRect( HDC dc, LPRECT rect ) { if(IntGetSysColor(COLOR_BTNHIGHLIGHT) == RGB(255, 255, 255)) { HBRUSH hbsave; COLORREF bg; FillRect(dc, rect, IntGetSysColorBrush(COLOR_BTNFACE)); bg = IntGdiSetBkColor(dc, RGB(255, 255, 255)); hbsave = NtGdiSelectBrush(dc, gpsi->hbrGray); NtGdiPatBlt(dc, rect->left, rect->top, rect->right-rect->left, rect->bottom-rect->top, 0x00FA0089); NtGdiSelectBrush(dc, hbsave); IntGdiSetBkColor(dc, bg); } else { FillRect(dc, rect, IntGetSysColorBrush(COLOR_BTNHIGHLIGHT)); } }
static void IntDrawScrollInterior(PWND pWnd, HDC hDC, INT nBar, BOOL Vertical, PSCROLLBARINFO ScrollBarInfo) { INT ThumbSize = ScrollBarInfo->xyThumbBottom - ScrollBarInfo->xyThumbTop; INT ThumbTop = ScrollBarInfo->xyThumbTop; RECT Rect; HBRUSH hSaveBrush, hBrush; BOOL TopSelected = FALSE, BottomSelected = FALSE; if (ScrollBarInfo->rgstate[SCROLL_TOP_RECT] & STATE_SYSTEM_PRESSED) TopSelected = TRUE; if (ScrollBarInfo->rgstate[SCROLL_BOTTOM_RECT] & STATE_SYSTEM_PRESSED) BottomSelected = TRUE; /* * Only scrollbar controls send WM_CTLCOLORSCROLLBAR. * The window-owned scrollbars need to call DefWndControlColor * to correctly setup default scrollbar colors */ if (nBar == SB_CTL) { hBrush = GetControlBrush( pWnd, hDC, WM_CTLCOLORSCROLLBAR); if (!hBrush) hBrush = IntGetSysColorBrush(COLOR_SCROLLBAR); } else { hBrush = DefWndControlColor(hDC, CTLCOLOR_SCROLLBAR); } hSaveBrush = NtGdiSelectBrush(hDC, hBrush); /* Calculate the scroll rectangle */ if (Vertical) { Rect.top = ScrollBarInfo->rcScrollBar.top + ScrollBarInfo->dxyLineButton; Rect.bottom = ScrollBarInfo->rcScrollBar.bottom - ScrollBarInfo->dxyLineButton; Rect.left = ScrollBarInfo->rcScrollBar.left; Rect.right = ScrollBarInfo->rcScrollBar.right; } else { Rect.top = ScrollBarInfo->rcScrollBar.top; Rect.bottom = ScrollBarInfo->rcScrollBar.bottom; Rect.left = ScrollBarInfo->rcScrollBar.left + ScrollBarInfo->dxyLineButton; Rect.right = ScrollBarInfo->rcScrollBar.right - ScrollBarInfo->dxyLineButton; } /* Draw the scroll rectangles and thumb */ if (!ScrollBarInfo->xyThumbBottom) { NtGdiPatBlt(hDC, Rect.left, Rect.top, Rect.right - Rect.left, Rect.bottom - Rect.top, PATCOPY); /* Cleanup and return */ NtGdiSelectBrush(hDC, hSaveBrush); return; } ThumbTop -= ScrollBarInfo->dxyLineButton; if (ScrollBarInfo->dxyLineButton) { if (Vertical) { if (ThumbSize) { NtGdiPatBlt(hDC, Rect.left, Rect.top, Rect.right - Rect.left, ThumbTop, TopSelected ? BLACKNESS : PATCOPY); Rect.top += ThumbTop; NtGdiPatBlt(hDC, Rect.left, Rect.top + ThumbSize, Rect.right - Rect.left, Rect.bottom - Rect.top - ThumbSize, BottomSelected ? BLACKNESS : PATCOPY); Rect.bottom = Rect.top + ThumbSize; } else { if (ThumbTop) { NtGdiPatBlt(hDC, Rect.left, ScrollBarInfo->dxyLineButton, Rect.right - Rect.left, Rect.bottom - Rect.top, PATCOPY); } } } else { if (ThumbSize) { NtGdiPatBlt(hDC, Rect.left, Rect.top, ThumbTop, Rect.bottom - Rect.top, TopSelected ? BLACKNESS : PATCOPY); Rect.left += ThumbTop; NtGdiPatBlt(hDC, Rect.left + ThumbSize, Rect.top, Rect.right - Rect.left - ThumbSize, Rect.bottom - Rect.top, BottomSelected ? BLACKNESS : PATCOPY); Rect.right = Rect.left + ThumbSize; } else { if (ThumbTop) { NtGdiPatBlt(hDC, ScrollBarInfo->dxyLineButton, Rect.top, Rect.right - Rect.left, Rect.bottom - Rect.top, PATCOPY); } } } } /* Draw the thumb */ if (ThumbSize) DrawEdge(hDC, &Rect, EDGE_RAISED, BF_RECT | BF_MIDDLE); /* Cleanup */ NtGdiSelectBrush(hDC, hSaveBrush); }