ReactOS 0.4.15-dev-8135-g1bc6c90
bitblt.c File Reference
#include <win32k.h>
#include <debug.h>
Include dependency graph for bitblt.c:

Go to the source code of this file.

Macros

#define NDEBUG
 

Functions

 DBG_DEFAULT_CHANNEL (GdiBlt)
 
BOOL APIENTRY NtGdiAlphaBlend (HDC hDCDest, LONG XOriginDest, LONG YOriginDest, LONG WidthDest, LONG HeightDest, HDC hDCSrc, LONG XOriginSrc, LONG YOriginSrc, LONG WidthSrc, LONG HeightSrc, BLENDFUNCTION BlendFunc, HANDLE hcmXform)
 
BOOL APIENTRY NtGdiBitBlt (HDC hDCDest, INT XDest, INT YDest, INT Width, INT Height, HDC hDCSrc, INT XSrc, INT YSrc, DWORD dwRop, IN DWORD crBackColor, IN FLONG fl)
 
BOOL APIENTRY NtGdiTransparentBlt (HDC hdcDst, INT xDst, INT yDst, INT cxDst, INT cyDst, HDC hdcSrc, INT xSrc, INT ySrc, INT cxSrc, INT cySrc, COLORREF TransColor)
 
BOOL APIENTRY NtGdiMaskBlt (HDC hdcDest, INT nXDest, INT nYDest, INT nWidth, INT nHeight, HDC hdcSrc, INT nXSrc, INT nYSrc, HBITMAP hbmMask, INT xMask, INT yMask, DWORD dwRop4, IN DWORD crBackColor)
 
BOOL APIENTRY NtGdiPlgBlt (IN HDC hdcTrg, IN LPPOINT pptlTrg, IN HDC hdcSrc, IN INT xSrc, IN INT ySrc, IN INT cxSrc, IN INT cySrc, IN HBITMAP hbmMask, IN INT xMask, IN INT yMask, IN DWORD crBackColor)
 
BOOL NTAPI GreStretchBltMask (HDC hDCDest, INT XOriginDest, INT YOriginDest, INT WidthDest, INT HeightDest, HDC hDCSrc, INT XOriginSrc, INT YOriginSrc, INT WidthSrc, INT HeightSrc, DWORD dwRop4, IN DWORD dwBackColor, HDC hDCMask, INT XOriginMask, INT YOriginMask)
 
BOOL APIENTRY NtGdiStretchBlt (HDC hDCDest, INT XOriginDest, INT YOriginDest, INT WidthDest, INT HeightDest, HDC hDCSrc, INT XOriginSrc, INT YOriginSrc, INT WidthSrc, INT HeightSrc, DWORD dwRop3, IN DWORD dwBackColor)
 
BOOL FASTCALL IntPatBlt (PDC pdc, INT XLeft, INT YLeft, INT Width, INT Height, DWORD dwRop3, PEBRUSHOBJ pebo)
 
BOOL FASTCALL IntGdiPolyPatBlt (HDC hDC, DWORD dwRop, PPATRECT pRects, INT cRects, ULONG Reserved)
 
BOOL APIENTRY NtGdiPatBlt (_In_ HDC hdcDest, _In_ INT x, _In_ INT y, _In_ INT cx, _In_ INT cy, _In_ DWORD dwRop)
 
BOOL APIENTRY NtGdiPolyPatBlt (HDC hDC, DWORD dwRop, IN PPOLYPATBLT pRects, IN DWORD cRects, IN DWORD Mode)
 
static BOOL FASTCALL REGION_LPTODP (_In_ PDC pdc, _Inout_ PREGION prgnDest, _In_ PREGION prgnSrc)
 
BOOL APIENTRY IntGdiBitBltRgn (_In_ PDC pdc, _In_ PREGION prgn, _In_opt_ BRUSHOBJ *pbo, _In_opt_ POINTL *pptlBrush, _In_ ROP4 rop4)
 
BOOL IntGdiFillRgn (_In_ PDC pdc, _In_ PREGION prgn, _In_opt_ PBRUSH pbrFill)
 
BOOL FASTCALL IntGdiPaintRgn (_In_ PDC pdc, _In_ PREGION prgn)
 
BOOL APIENTRY NtGdiFillRgn (_In_ HDC hdc, _In_ HRGN hrgn, _In_ HBRUSH hbrush)
 
BOOL APIENTRY NtGdiFrameRgn (_In_ HDC hdc, _In_ HRGN hrgn, _In_ HBRUSH hbrush, _In_ INT xWidth, _In_ INT yHeight)
 
BOOL APIENTRY NtGdiInvertRgn (_In_ HDC hdc, _In_ HRGN hrgn)
 
COLORREF APIENTRY NtGdiSetPixel (_In_ HDC hdc, _In_ INT x, _In_ INT y, _In_ COLORREF crColor)
 
COLORREF APIENTRY NtGdiGetPixel (_In_ HDC hdc, _In_ INT x, _In_ INT y)
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 10 of file bitblt.c.

Function Documentation

◆ DBG_DEFAULT_CHANNEL()

DBG_DEFAULT_CHANNEL ( GdiBlt  )

◆ GreStretchBltMask()

BOOL NTAPI GreStretchBltMask ( HDC  hDCDest,
INT  XOriginDest,
INT  YOriginDest,
INT  WidthDest,
INT  HeightDest,
HDC  hDCSrc,
INT  XOriginSrc,
INT  YOriginSrc,
INT  WidthSrc,
INT  HeightSrc,
DWORD  dwRop4,
IN DWORD  dwBackColor,
HDC  hDCMask,
INT  XOriginMask,
INT  YOriginMask 
)

Definition at line 560 of file bitblt.c.

576{
577 PDC DCDest;
578 PDC DCSrc = NULL;
579 PDC DCMask = NULL;
580 HDC ahDC[3];
581 PGDIOBJ apObj[3];
582 PDC_ATTR pdcattr;
583 SURFACE *BitmapDest, *BitmapSrc = NULL;
584 SURFACE *BitmapMask = NULL;
585 RECTL DestRect;
586 RECTL SourceRect;
587 POINTL MaskPoint;
588 BOOL Status = FALSE;
589 EXLATEOBJ exlo;
590 XLATEOBJ *XlateObj = NULL;
591 POINTL BrushOrigin;
592 BOOL UsesSource;
593 BOOL UsesMask;
594 ROP4 rop4;
595 BOOL Case0000, Case0101, Case1010, CaseExcept;
596
598
599 UsesSource = ROP4_USES_SOURCE(rop4);
600 UsesMask = ROP4_USES_MASK(rop4);
601
602 if (0 == WidthDest || 0 == HeightDest || 0 == WidthSrc || 0 == HeightSrc)
603 {
605 return TRUE;
606 }
607
608 if (!hDCDest || (UsesSource && !hDCSrc) || (UsesMask && !hDCMask))
609 {
611 return FALSE;
612 }
613
614 ahDC[0] = hDCDest;
615 ahDC[1] = UsesSource ? hDCSrc : NULL;
616 ahDC[2] = UsesMask ? hDCMask : NULL;
618 {
619 WARN("Invalid dc handle (dest=0x%p, src=0x%p) passed to GreStretchBltMask\n", hDCDest, hDCSrc);
621 return FALSE;
622 }
623 DCDest = apObj[0];
624 DCSrc = apObj[1];
625 DCMask = apObj[2];
626
627 if (DCDest->dctype == DCTYPE_INFO)
628 {
629 if(DCSrc) GDIOBJ_vUnlockObject(&DCSrc->BaseObject);
630 if(DCMask) GDIOBJ_vUnlockObject(&DCMask->BaseObject);
631 GDIOBJ_vUnlockObject(&DCDest->BaseObject);
632 /* Yes, Windows really returns TRUE in this case */
633 return TRUE;
634 }
635
636 if (UsesSource)
637 {
638 if (DCSrc->dctype == DCTYPE_INFO)
639 {
640 GDIOBJ_vUnlockObject(&DCDest->BaseObject);
641 GDIOBJ_vUnlockObject(&DCSrc->BaseObject);
642 if(DCMask) GDIOBJ_vUnlockObject(&DCMask->BaseObject);
643 /* Yes, Windows really returns TRUE in this case */
644 return TRUE;
645 }
646 }
647
648
649 Case0000 = ((WidthDest < 0) && (HeightDest < 0) && (WidthSrc < 0) && (HeightSrc < 0));
650 Case0101 = ((WidthDest < 0) && (HeightDest > 0) && (WidthSrc < 0) && (HeightSrc > 0));
651 Case1010 = ((WidthDest > 0) && (HeightDest < 0) && (WidthSrc > 0) && (HeightSrc < 0));
652 CaseExcept = (Case0000 || Case0101 || Case1010);
653
654 pdcattr = DCDest->pdcattr;
655
656 DestRect.left = XOriginDest;
657 DestRect.top = YOriginDest;
658 DestRect.right = XOriginDest+WidthDest;
659 DestRect.bottom = YOriginDest+HeightDest;
660
661 /* Account for possible negative span values */
662 if ((WidthDest < 0) && !CaseExcept)
663 {
664 DestRect.left++;
665 DestRect.right++;
666 }
667 if ((HeightDest < 0) && !CaseExcept)
668 {
669 DestRect.top++;
670 DestRect.bottom++;
671 }
672
673 IntLPtoDP(DCDest, (LPPOINT)&DestRect, 2);
674
675 DestRect.left += DCDest->ptlDCOrig.x;
676 DestRect.top += DCDest->ptlDCOrig.y;
677 DestRect.right += DCDest->ptlDCOrig.x;
678 DestRect.bottom += DCDest->ptlDCOrig.y;
679
680 if (DCDest->fs & (DC_ACCUM_APP|DC_ACCUM_WMGR))
681 {
682 IntUpdateBoundsRect(DCDest, &DestRect);
683 }
684
685 SourceRect.left = XOriginSrc;
686 SourceRect.top = YOriginSrc;
687 SourceRect.right = XOriginSrc+WidthSrc;
688 SourceRect.bottom = YOriginSrc+HeightSrc;
689
690 /* Account for possible negative span values */
691 if ((WidthSrc < 0) && !CaseExcept)
692 {
693 SourceRect.left++;
694 SourceRect.right++;
695 }
696 if ((HeightSrc < 0) && !CaseExcept)
697 {
698 SourceRect.top++;
699 SourceRect.bottom++;
700 }
701
702 if (UsesSource)
703 {
704 IntLPtoDP(DCSrc, (LPPOINT)&SourceRect, 2);
705
706 SourceRect.left += DCSrc->ptlDCOrig.x;
707 SourceRect.top += DCSrc->ptlDCOrig.y;
708 SourceRect.right += DCSrc->ptlDCOrig.x;
709 SourceRect.bottom += DCSrc->ptlDCOrig.y;
710 }
711
712 BrushOrigin.x = 0;
713 BrushOrigin.y = 0;
714
715 /* Only prepare Source and Dest, hdcMask represents a DIB */
716 DC_vPrepareDCsForBlit(DCDest, &DestRect, DCSrc, &SourceRect);
717
718 if (pdcattr->ulDirty_ & (DIRTY_FILL | DC_BRUSH_DIRTY))
719 DC_vUpdateFillBrush(DCDest);
720
721 /* Determine surfaces to be used in the bitblt */
722 BitmapDest = DCDest->dclevel.pSurface;
723 if (BitmapDest == NULL)
724 goto failed;
725 if (UsesSource)
726 {
727 BitmapSrc = DCSrc->dclevel.pSurface;
728 if (BitmapSrc == NULL)
729 goto failed;
730
731 /* Create the XLATEOBJ. */
732 EXLATEOBJ_vInitXlateFromDCs(&exlo, DCSrc, DCDest);
733 XlateObj = &exlo.xlo;
734 }
735
736 /* Offset the brush */
737 BrushOrigin.x += DCDest->ptlDCOrig.x;
738 BrushOrigin.y += DCDest->ptlDCOrig.y;
739
740 /* Make mask surface for source surface */
741 if (BitmapSrc && DCMask)
742 {
743 BitmapMask = DCMask->dclevel.pSurface;
744 if (BitmapMask &&
745 (BitmapMask->SurfObj.sizlBitmap.cx < WidthSrc ||
746 BitmapMask->SurfObj.sizlBitmap.cy < HeightSrc))
747 {
748 WARN("%dx%d mask is smaller than %dx%d bitmap\n",
749 BitmapMask->SurfObj.sizlBitmap.cx, BitmapMask->SurfObj.sizlBitmap.cy,
750 WidthSrc, HeightSrc);
751 EXLATEOBJ_vCleanup(&exlo);
752 goto failed;
753 }
754 /* Create mask offset point */
755 MaskPoint.x = XOriginMask;
756 MaskPoint.y = YOriginMask;
757 IntLPtoDP(DCMask, &MaskPoint, 1);
758 MaskPoint.x += DCMask->ptlDCOrig.x;
759 MaskPoint.y += DCMask->ptlDCOrig.y;
760 }
761
762 DPRINT("Calling IntEngStrethBlt SourceRect: (%d,%d)-(%d,%d) and DestRect: (%d,%d)-(%d,%d).\n",
763 SourceRect.left, SourceRect.top, SourceRect.right, SourceRect.bottom,
764 DestRect.left, DestRect.top, DestRect.right, DestRect.bottom);
765
766 /* Perform the bitblt operation */
767 Status = IntEngStretchBlt(&BitmapDest->SurfObj,
768 BitmapSrc ? &BitmapSrc->SurfObj : NULL,
769 BitmapMask ? &BitmapMask->SurfObj : NULL,
770 (CLIPOBJ *)&DCDest->co,
771 XlateObj,
772 &DCDest->dclevel.ca,
773 &DestRect,
774 &SourceRect,
775 BitmapMask ? &MaskPoint : NULL,
776 &DCDest->eboFill.BrushObject,
777 &BrushOrigin,
778 rop4);
779 if (UsesSource)
780 {
781 EXLATEOBJ_vCleanup(&exlo);
782 }
783
784failed:
785 DC_vFinishBlit(DCDest, DCSrc);
786 if (UsesSource)
787 {
788 DC_UnlockDc(DCSrc);
789 }
790 if (DCMask)
791 {
792 DC_UnlockDc(DCMask);
793 }
794 DC_UnlockDc(DCDest);
795
796 return Status;
797}
#define WARN(fmt,...)
Definition: debug.h:115
static BOOLEAN IntLPtoDP(DC *pdc, PPOINTL ppt, UINT count)
Definition: coord.h:182
VOID FASTCALL DC_vPrepareDCsForBlit(PDC pdcDest, const RECT *rcDest, PDC pdcSrc, const RECT *rcSrc)
Definition: dclife.c:505
VOID FASTCALL DC_vFinishBlit(PDC pdc1, PDC pdc2)
Definition: dclife.c:614
FORCEINLINE VOID DC_UnlockDc(PDC pdc)
Definition: dc.h:238
VOID FASTCALL IntUpdateBoundsRect(PDC, PRECTL)
Definition: dcutil.c:694
@ DCTYPE_INFO
Definition: dc.h:43
VOID FASTCALL DC_vUpdateFillBrush(PDC pdc)
Definition: dcobjs.c:16
@ DC_ACCUM_APP
Definition: dc.h:25
@ DC_ACCUM_WMGR
Definition: dc.h:24
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
#define ERROR_INVALID_HANDLE
Definition: compat.h:98
unsigned int BOOL
Definition: ntddk_ex.h:94
Status
Definition: gdiplustypes.h:25
BOOL APIENTRY IntEngStretchBlt(SURFOBJ *DestObj, SURFOBJ *SourceObj, SURFOBJ *Mask, CLIPOBJ *ClipRegion, XLATEOBJ *ColorTranslation, COLORADJUSTMENT *pca, RECTL *DestRect, RECTL *SourceRect, POINTL *pMaskOrigin, BRUSHOBJ *Brush, POINTL *BrushOrigin, ULONG Mode)
#define ROP4_USES_MASK(Rop4)
Definition: inteng.h:47
#define ROP4_USES_SOURCE(Rop4)
Definition: inteng.h:45
#define WIN32_ROP4_TO_ENG_ROP4(dwRop4)
Definition: intgdi.h:5
static HDC
Definition: imagelist.c:92
#define DIRTY_FILL
Definition: ntgdihdl.h:123
#define DC_BRUSH_DIRTY
Definition: ntgdihdl.h:135
@ GDIObjType_DC_TYPE
Definition: ntgdityp.h:121
#define DPRINT
Definition: sndvol32.h:73
Definition: polytest.cpp:41
long bottom
Definition: polytest.cpp:53
long right
Definition: polytest.cpp:53
long top
Definition: polytest.cpp:53
long left
Definition: polytest.cpp:53
ULONG ulDirty_
Definition: ntgdihdl.h:294
XLATEOBJ xlo
Definition: xlateobj.h:21
LONG y
Definition: windef.h:330
LONG x
Definition: windef.h:329
LONG cx
Definition: kdterminal.h:27
LONG cy
Definition: kdterminal.h:28
SURFOBJ SurfObj
Definition: surface.h:8
SIZEL sizlBitmap
Definition: winddi.h:1209
BOOL NTAPI GDIOBJ_bLockMultipleObjects(IN ULONG ulCount, IN HGDIOBJ *ahObj, OUT PGDIOBJ *apObj, IN UCHAR objt)
Definition: gdiobj.c:1031
VOID NTAPI GDIOBJ_vUnlockObject(POBJ pobj)
Definition: gdiobj.c:880
_In_opt_ SURFOBJ _In_opt_ SURFOBJ _In_ CLIPOBJ _In_opt_ XLATEOBJ _In_ RECTL _In_opt_ POINTL _In_opt_ POINTL _In_opt_ BRUSHOBJ _In_opt_ POINTL _In_ ROP4 rop4
Definition: winddi.h:3442
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:22
ULONG ROP4
Definition: winddi.h:128
VOID NTAPI EXLATEOBJ_vCleanup(_Inout_ PEXLATEOBJ pexlo)
Definition: xlateobj.c:649
VOID NTAPI EXLATEOBJ_vInitXlateFromDCs(_Out_ EXLATEOBJ *pexlo, _In_ PDC pdcSrc, _In_ PDC pdcDst)
Definition: xlateobj.c:611

Referenced by NtGdiStretchBlt().

◆ IntGdiBitBltRgn()

BOOL APIENTRY IntGdiBitBltRgn ( _In_ PDC  pdc,
_In_ PREGION  prgn,
_In_opt_ BRUSHOBJ pbo,
_In_opt_ POINTL pptlBrush,
_In_ ROP4  rop4 
)

Definition at line 1101 of file bitblt.c.

1107{
1108 PREGION prgnClip;
1109 XCLIPOBJ xcoClip;
1110 BOOL bResult;
1111 NT_ASSERT((pdc != NULL) && (prgn != NULL));
1112
1113 /* Check if we have a surface */
1114 if (pdc->dclevel.pSurface == NULL)
1115 {
1116 return TRUE;
1117 }
1118
1119 /* Create an empty clip region */
1120 prgnClip = IntSysCreateRectpRgn(0, 0, 0, 0);
1121 if (prgnClip == NULL)
1122 {
1123 return FALSE;
1124 }
1125
1126 /* Transform given region into device coordinates */
1127 if (!REGION_LPTODP(pdc, prgnClip, prgn))
1128 {
1129 REGION_Delete(prgnClip);
1130 return FALSE;
1131 }
1132
1133 /* Intersect with the system or RAO region (these are (atm) without DC-origin) */
1134 if (pdc->prgnRao)
1135 IntGdiCombineRgn(prgnClip, prgnClip, pdc->prgnRao, RGN_AND);
1136 else
1137 IntGdiCombineRgn(prgnClip, prgnClip, pdc->prgnVis, RGN_AND);
1138
1139 /* Now account for the DC-origin */
1140 if (!REGION_bOffsetRgn(prgnClip, pdc->ptlDCOrig.x, pdc->ptlDCOrig.y))
1141 {
1142 REGION_Delete(prgnClip);
1143 return FALSE;
1144 }
1145
1146 if (pdc->fs & (DC_ACCUM_APP|DC_ACCUM_WMGR))
1147 {
1148 RECTL rcrgn;
1149 REGION_GetRgnBox(prgnClip, &rcrgn);
1150 IntUpdateBoundsRect(pdc, &rcrgn);
1151 }
1152
1153 /* Prepare the DC */
1154 DC_vPrepareDCsForBlit(pdc, &prgnClip->rdh.rcBound, NULL, NULL);
1155
1156 /* Initialize a clip object */
1157 IntEngInitClipObj(&xcoClip);
1158 IntEngUpdateClipRegion(&xcoClip,
1159 prgnClip->rdh.nCount,
1160 prgnClip->Buffer,
1161 &prgnClip->rdh.rcBound);
1162
1163 /* Call the Eng or Drv function */
1164 bResult = IntEngBitBlt(&pdc->dclevel.pSurface->SurfObj,
1165 NULL,
1166 NULL,
1167 (CLIPOBJ *)&xcoClip,
1168 NULL,
1169 &prgnClip->rdh.rcBound,
1170 NULL,
1171 NULL,
1172 pbo,
1173 pptlBrush,
1174 rop4);
1175
1176 /* Cleanup */
1177 DC_vFinishBlit(pdc, NULL);
1178 REGION_Delete(prgnClip);
1179 IntEngFreeClipResources(&xcoClip);
1180
1181 /* Return the result */
1182 return bResult;
1183}
Definition: region.h:8
RECTL * Buffer
Definition: region.h:16
RGNDATAHEADER rdh
Definition: region.h:15
BOOL APIENTRY IntEngBitBlt(SURFOBJ *psoTrg, SURFOBJ *psoSrc, SURFOBJ *psoMask, CLIPOBJ *pco, XLATEOBJ *pxlo, RECTL *prclTrg, POINTL *pptlSrc, POINTL *pptlMask, BRUSHOBJ *pbo, POINTL *pptlBrush, ROP4 Rop4)
Definition: bitblt.c:656
VOID FASTCALL IntEngUpdateClipRegion(XCLIPOBJ *Clip, ULONG count, const RECTL *pRect, const RECTL *rcBounds)
Definition: clip.c:173
VOID FASTCALL IntEngFreeClipResources(XCLIPOBJ *Clip)
Definition: clip.c:164
VOID FASTCALL IntEngInitClipObj(XCLIPOBJ *Clip)
Definition: clip.c:158
static BOOL FASTCALL REGION_LPTODP(_In_ PDC pdc, _Inout_ PREGION prgnDest, _In_ PREGION prgnSrc)
Definition: bitblt.c:1088
VOID FASTCALL REGION_Delete(PREGION pRgn)
Definition: region.c:2449
INT FASTCALL REGION_GetRgnBox(PREGION Rgn, PRECTL pRect)
Definition: region.c:2543
PREGION FASTCALL IntSysCreateRectpRgn(INT LeftRect, INT TopRect, INT RightRect, INT BottomRect)
Definition: region.c:2407
BOOL FASTCALL REGION_bOffsetRgn(_Inout_ PREGION prgn, _In_ INT cx, _In_ INT cy)
Definition: region.c:2707
INT FASTCALL IntGdiCombineRgn(PREGION prgnDest, PREGION prgnSrc1, PREGION prgnSrc2, INT iCombineMode)
Definition: region.c:2487
_In_opt_ SURFOBJ _In_opt_ SURFOBJ _In_ CLIPOBJ _In_opt_ XLATEOBJ _In_ RECTL _In_opt_ POINTL _In_opt_ POINTL _In_opt_ BRUSHOBJ _In_opt_ POINTL * pptlBrush
Definition: winddi.h:3441
_In_opt_ SURFOBJ _In_opt_ SURFOBJ _In_ CLIPOBJ _In_opt_ XLATEOBJ _In_ RECTL _In_opt_ POINTL _In_opt_ POINTL _In_opt_ BRUSHOBJ * pbo
Definition: winddi.h:3440
#define RGN_AND
Definition: wingdi.h:356
#define NT_ASSERT
Definition: rtlfuncs.h:3310

Referenced by NtGdiInvertRgn().

◆ IntGdiFillRgn()

BOOL IntGdiFillRgn ( _In_ PDC  pdc,
_In_ PREGION  prgn,
_In_opt_ PBRUSH  pbrFill 
)
Todo:
Check parameters

Definition at line 1186 of file bitblt.c.

1190{
1191 PREGION prgnClip;
1192 XCLIPOBJ xcoClip;
1193 EBRUSHOBJ eboFill;
1194 BRUSHOBJ *pbo;
1195 BOOL bRet;
1196 DWORD rop2Fg;
1197 MIX mix;
1198 NT_ASSERT((pdc != NULL) && (prgn != NULL));
1199
1200 if (pdc->dclevel.pSurface == NULL)
1201 {
1202 return TRUE;
1203 }
1204
1205 prgnClip = IntSysCreateRectpRgn(0, 0, 0, 0);
1206 if (prgnClip == NULL)
1207 {
1208 return FALSE;
1209 }
1210
1211 /* Transform region into device coordinates */
1212 if (!REGION_LPTODP(pdc, prgnClip, prgn))
1213 {
1214 REGION_Delete(prgnClip);
1215 return FALSE;
1216 }
1217
1218 /* Intersect with the system or RAO region (these are (atm) without DC-origin) */
1219 if (pdc->prgnRao)
1220 IntGdiCombineRgn(prgnClip, prgnClip, pdc->prgnRao, RGN_AND);
1221 else
1222 IntGdiCombineRgn(prgnClip, prgnClip, pdc->prgnVis, RGN_AND);
1223
1224 /* Now account for the DC-origin */
1225 if (!REGION_bOffsetRgn(prgnClip, pdc->ptlDCOrig.x, pdc->ptlDCOrig.y))
1226 {
1227 REGION_Delete(prgnClip);
1228 return FALSE;
1229 }
1230
1231 if (pdc->fs & (DC_ACCUM_APP|DC_ACCUM_WMGR))
1232 {
1233 RECTL rcrgn;
1234 REGION_GetRgnBox(prgnClip, &rcrgn);
1235 IntUpdateBoundsRect(pdc, &rcrgn);
1236 }
1237
1238 IntEngInitClipObj(&xcoClip);
1239 IntEngUpdateClipRegion(&xcoClip,
1240 prgnClip->rdh.nCount,
1241 prgnClip->Buffer,
1242 &prgnClip->rdh.rcBound );
1243
1244 /* Get the FG rop and create a MIX based on the BK mode */
1245 rop2Fg = FIXUP_ROP2(pdc->pdcattr->jROP2);
1246 mix = rop2Fg | (pdc->pdcattr->jBkMode == OPAQUE ? rop2Fg : R2_NOP) << 8;
1247
1248 /* Prepare DC for blit */
1249 DC_vPrepareDCsForBlit(pdc, &prgnClip->rdh.rcBound, NULL, NULL);
1250
1251 /* Check if we have a fill brush */
1252 if (pbrFill != NULL)
1253 {
1254 /* Initialize the brush object */
1256 EBRUSHOBJ_vInit(&eboFill, pbrFill, pdc->dclevel.pSurface, 0x00FFFFFF, 0, NULL);
1257 pbo = &eboFill.BrushObject;
1258 }
1259 else
1260 {
1261 /* Update the fill brush if needed */
1262 if (pdc->pdcattr->ulDirty_ & (DIRTY_FILL | DC_BRUSH_DIRTY))
1264
1265 /* Use the DC brush object */
1266 pbo = &pdc->eboFill.BrushObject;
1267 }
1268
1269 /* Call the internal function */
1270 bRet = IntEngPaint(&pdc->dclevel.pSurface->SurfObj,
1271 (CLIPOBJ *)&xcoClip,
1272 pbo,
1273 &pdc->pdcattr->ptlBrushOrigin,
1274 mix);
1275
1276 DC_vFinishBlit(pdc, NULL);
1277 REGION_Delete(prgnClip);
1278 IntEngFreeClipResources(&xcoClip);
1279
1280 // Fill the region
1281 return bRet;
1282}
VOID NTAPI EBRUSHOBJ_vInit(EBRUSHOBJ *pebo, PBRUSH pbrush, PSURFACE psurf, COLORREF crBackgroundClr, COLORREF crForegroundClr, PPALETTE ppalDC)
Definition: engbrush.c:52
unsigned long DWORD
Definition: ntddk_ex.h:95
BOOL APIENTRY IntEngPaint(_In_ SURFOBJ *pso, _In_ CLIPOBJ *pco, _In_ BRUSHOBJ *pbo, _In_ POINTL *pptlBrushOrg, _In_ __in_data_source(USER_MODE) MIX mix)
Definition: paint.c:85
#define FIXUP_ROP2(rop2)
Definition: intgdi.h:10
BRUSHOBJ BrushObject
Definition: brush.h:71
_In_ PATHOBJ _In_ CLIPOBJ _In_ BRUSHOBJ _In_ POINTL _In_ MIX mix
Definition: winddi.h:3595
ULONG MIX
Definition: winddi.h:129
#define R2_NOP
Definition: wingdi.h:346
#define OPAQUE
Definition: wingdi.h:949

Referenced by IntGdiPaintRgn(), NtGdiFillRgn(), and PATH_FillPathEx().

◆ IntGdiPaintRgn()

BOOL FASTCALL IntGdiPaintRgn ( _In_ PDC  pdc,
_In_ PREGION  prgn 
)

Definition at line 1286 of file bitblt.c.

1289{
1290 return IntGdiFillRgn(pdc, prgn, NULL);
1291}
BOOL IntGdiFillRgn(_In_ PDC pdc, _In_ PREGION prgn, _In_opt_ PBRUSH pbrFill)
Definition: bitblt.c:1186

◆ IntGdiPolyPatBlt()

BOOL FASTCALL IntGdiPolyPatBlt ( HDC  hDC,
DWORD  dwRop,
PPATRECT  pRects,
INT  cRects,
ULONG  Reserved 
)

Definition at line 925 of file bitblt.c.

931{
932 INT i;
933 PBRUSH pbrush;
934 PDC pdc;
935 EBRUSHOBJ eboFill;
936
937 pdc = DC_LockDc(hDC);
938 if (!pdc)
939 {
941 return FALSE;
942 }
943
944 if (pdc->dctype == DCTYPE_INFO)
945 {
946 DC_UnlockDc(pdc);
947 /* Yes, Windows really returns TRUE in this case */
948 return TRUE;
949 }
950
951 for (i = 0; i < cRects; i++)
952 {
953 pbrush = BRUSH_ShareLockBrush(pRects->hBrush);
954
955 /* Check if we could lock the brush */
956 if (pbrush != NULL)
957 {
958 /* Initialize a brush object */
959 EBRUSHOBJ_vInitFromDC(&eboFill, pbrush, pdc);
960
961 IntPatBlt(
962 pdc,
963 pRects->r.left,
964 pRects->r.top,
965 pRects->r.right,
966 pRects->r.bottom,
967 dwRop,
968 &eboFill);
969
970 /* Cleanup the brush object and unlock the brush */
971 EBRUSHOBJ_vCleanup(&eboFill);
973 }
974 pRects++;
975 }
976
977 DC_UnlockDc(pdc);
978
979 return TRUE;
980}
static HDC hDC
Definition: 3dtext.c:33
FORCEINLINE PDC DC_LockDc(HDC hdc)
Definition: dc.h:220
VOID NTAPI EBRUSHOBJ_vInitFromDC(EBRUSHOBJ *pebo, PBRUSH pbrush, PDC pdc)
Definition: engbrush.c:112
VOID NTAPI EBRUSHOBJ_vCleanup(EBRUSHOBJ *pebo)
Definition: engbrush.c:153
#define BRUSH_ShareLockBrush(hBrush)
Definition: brush.h:117
#define BRUSH_ShareUnlockBrush(pBrush)
Definition: brush.h:118
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
Definition: types.h:101
RECT r
Definition: ntgdityp.h:484
HBRUSH hBrush
Definition: ntgdityp.h:485
LONG right
Definition: windef.h:308
LONG bottom
Definition: windef.h:309
LONG top
Definition: windef.h:307
LONG left
Definition: windef.h:306
int32_t INT
Definition: typedefs.h:58
BOOL FASTCALL IntPatBlt(PDC pdc, INT XLeft, INT YLeft, INT Width, INT Height, DWORD dwRop3, PEBRUSHOBJ pebo)
Definition: bitblt.c:837

Referenced by NtGdiPolyPatBlt().

◆ IntPatBlt()

BOOL FASTCALL IntPatBlt ( PDC  pdc,
INT  XLeft,
INT  YLeft,
INT  Width,
INT  Height,
DWORD  dwRop3,
PEBRUSHOBJ  pebo 
)

Definition at line 837 of file bitblt.c.

845{
846 RECTL DestRect;
847 SURFACE *psurf;
848 POINTL BrushOrigin;
849 BOOL ret;
850 PBRUSH pbrush;
851
852 ASSERT(pebo);
853 pbrush = pebo->pbrush;
854 ASSERT(pbrush);
855
856 if (pbrush->flAttrs & BR_IS_NULL)
857 {
858 return TRUE;
859 }
860
861 if (Width >= 0)
862 {
863 DestRect.left = XLeft;
864 DestRect.right = XLeft + Width;
865 }
866 else
867 {
868 DestRect.left = XLeft + Width;
869 DestRect.right = XLeft;
870 }
871
872 if (Height >= 0)
873 {
874 DestRect.top = YLeft;
875 DestRect.bottom = YLeft + Height;
876 }
877 else
878 {
879 DestRect.top = YLeft + Height;
880 DestRect.bottom = YLeft;
881 }
882
883 IntLPtoDP(pdc, (LPPOINT)&DestRect, 2);
884
885 DestRect.left += pdc->ptlDCOrig.x;
886 DestRect.top += pdc->ptlDCOrig.y;
887 DestRect.right += pdc->ptlDCOrig.x;
888 DestRect.bottom += pdc->ptlDCOrig.y;
889
890 if (pdc->fs & (DC_ACCUM_APP|DC_ACCUM_WMGR))
891 {
892 IntUpdateBoundsRect(pdc, &DestRect);
893 }
894
895#ifdef _USE_DIBLIB_
896 BrushOrigin.x = pbrush->ptOrigin.x + pdc->ptlDCOrig.x + XLeft;
897 BrushOrigin.y = pbrush->ptOrigin.y + pdc->ptlDCOrig.y + YLeft;
898#else
899 BrushOrigin.x = pbrush->ptOrigin.x + pdc->ptlDCOrig.x;
900 BrushOrigin.y = pbrush->ptOrigin.y + pdc->ptlDCOrig.y;
901#endif
902
903 DC_vPrepareDCsForBlit(pdc, &DestRect, NULL, NULL);
904
905 psurf = pdc->dclevel.pSurface;
906
907 ret = IntEngBitBlt(&psurf->SurfObj,
908 NULL,
909 NULL,
910 (CLIPOBJ *)&pdc->co,
911 NULL,
912 &DestRect,
913 NULL,
914 NULL,
915 &pebo->BrushObject,
916 &BrushOrigin,
917 WIN32_ROP3_TO_ENG_ROP4(dwRop3));
918
919 DC_vFinishBlit(pdc, NULL);
920
921 return ret;
922}
#define BR_IS_NULL
Definition: brush.h:105
#define WIN32_ROP3_TO_ENG_ROP4(dwRop4)
Definition: intgdi.h:4
#define ASSERT(a)
Definition: mode.c:44
PBRUSH pbrush
Definition: brush.h:88
_In_ HFONT _Out_ PUINT _Out_ PUINT Width
Definition: font.h:89
_In_ HFONT _Out_ PUINT Height
Definition: font.h:88
int ret

Referenced by GdiFlushUserBatch(), IntGdiPolyPatBlt(), NtGdiPatBlt(), and NtGdiSetPixel().

◆ NtGdiAlphaBlend()

BOOL APIENTRY NtGdiAlphaBlend ( HDC  hDCDest,
LONG  XOriginDest,
LONG  YOriginDest,
LONG  WidthDest,
LONG  HeightDest,
HDC  hDCSrc,
LONG  XOriginSrc,
LONG  YOriginSrc,
LONG  WidthSrc,
LONG  HeightSrc,
BLENDFUNCTION  BlendFunc,
HANDLE  hcmXform 
)

Definition at line 15 of file bitblt.c.

28{
29 PDC DCDest;
30 PDC DCSrc;
31 HDC ahDC[2];
32 PGDIOBJ apObj[2];
33 SURFACE *BitmapDest, *BitmapSrc;
34 RECTL DestRect, SourceRect;
35 BOOL bResult;
36 EXLATEOBJ exlo;
37 BLENDOBJ BlendObj;
38 BlendObj.BlendFunction = BlendFunc;
39
40 if (WidthDest < 0 || HeightDest < 0 || WidthSrc < 0 || HeightSrc < 0)
41 {
43 return FALSE;
44 }
45
46 if ((hDCDest == NULL) || (hDCSrc == NULL))
47 {
49 return FALSE;
50 }
51
52 TRACE("Locking DCs\n");
53 ahDC[0] = hDCDest;
54 ahDC[1] = hDCSrc ;
56 {
57 WARN("Invalid dc handle (dest=0x%p, src=0x%p) passed to NtGdiAlphaBlend\n", hDCDest, hDCSrc);
59 return FALSE;
60 }
61 DCDest = apObj[0];
62 DCSrc = apObj[1];
63
64 if (DCSrc->dctype == DCTYPE_INFO || DCDest->dctype == DCTYPE_INFO)
65 {
66 GDIOBJ_vUnlockObject(&DCSrc->BaseObject);
67 GDIOBJ_vUnlockObject(&DCDest->BaseObject);
68 /* Yes, Windows really returns TRUE in this case */
69 return TRUE;
70 }
71
72 DestRect.left = XOriginDest;
73 DestRect.top = YOriginDest;
74 DestRect.right = XOriginDest + WidthDest;
75 DestRect.bottom = YOriginDest + HeightDest;
76 IntLPtoDP(DCDest, (LPPOINT)&DestRect, 2);
77
78 DestRect.left += DCDest->ptlDCOrig.x;
79 DestRect.top += DCDest->ptlDCOrig.y;
80 DestRect.right += DCDest->ptlDCOrig.x;
81 DestRect.bottom += DCDest->ptlDCOrig.y;
82
83 if (DCDest->fs & (DC_ACCUM_APP|DC_ACCUM_WMGR))
84 {
85 IntUpdateBoundsRect(DCDest, &DestRect);
86 }
87
88 SourceRect.left = XOriginSrc;
89 SourceRect.top = YOriginSrc;
90 SourceRect.right = XOriginSrc + WidthSrc;
91 SourceRect.bottom = YOriginSrc + HeightSrc;
92 IntLPtoDP(DCSrc, (LPPOINT)&SourceRect, 2);
93
94 SourceRect.left += DCSrc->ptlDCOrig.x;
95 SourceRect.top += DCSrc->ptlDCOrig.y;
96 SourceRect.right += DCSrc->ptlDCOrig.x;
97 SourceRect.bottom += DCSrc->ptlDCOrig.y;
98
99 if (!DestRect.right ||
100 !DestRect.bottom ||
101 !SourceRect.right ||
102 !SourceRect.bottom)
103 {
104 GDIOBJ_vUnlockObject(&DCSrc->BaseObject);
105 GDIOBJ_vUnlockObject(&DCDest->BaseObject);
106 return TRUE;
107 }
108
109 /* Prepare DCs for blit */
110 TRACE("Preparing DCs for blit\n");
111 DC_vPrepareDCsForBlit(DCDest, &DestRect, DCSrc, &SourceRect);
112
113 /* Determine surfaces to be used in the bitblt */
114 BitmapDest = DCDest->dclevel.pSurface;
115 if (!BitmapDest)
116 {
117 bResult = FALSE ;
118 goto leave ;
119 }
120
121 BitmapSrc = DCSrc->dclevel.pSurface;
122 if (!BitmapSrc)
123 {
124 bResult = FALSE;
125 goto leave;
126 }
127
128 /* Create the XLATEOBJ. */
129 EXLATEOBJ_vInitXlateFromDCs(&exlo, DCSrc, DCDest);
130
131 /* Perform the alpha blend operation */
132 TRACE("Performing the alpha blend\n");
133 bResult = IntEngAlphaBlend(&BitmapDest->SurfObj,
134 &BitmapSrc->SurfObj,
135 (CLIPOBJ *)&DCDest->co,
136 &exlo.xlo,
137 &DestRect,
138 &SourceRect,
139 &BlendObj);
140
141 EXLATEOBJ_vCleanup(&exlo);
142leave :
143 TRACE("Finishing blit\n");
144 DC_vFinishBlit(DCDest, DCSrc);
145 GDIOBJ_vUnlockObject(&DCSrc->BaseObject);
146 GDIOBJ_vUnlockObject(&DCDest->BaseObject);
147
148 return bResult;
149}
#define leave
Definition: btrfs_drv.h:138
static const BLENDFUNCTION BlendFunc
Definition: general.c:34
#define TRACE(s)
Definition: solgame.cpp:4
BLENDFUNCTION BlendFunction
Definition: winddi.h:224
BOOL APIENTRY IntEngAlphaBlend(_Inout_ SURFOBJ *psoDest, _In_ SURFOBJ *psoSource, _In_opt_ CLIPOBJ *pco, _In_opt_ XLATEOBJ *pxlo, _In_ RECTL *prclDest, _In_ RECTL *prclSrc, _In_ BLENDOBJ *pBlendObj)
Definition: alphablend.c:197

◆ NtGdiBitBlt()

BOOL APIENTRY NtGdiBitBlt ( HDC  hDCDest,
INT  XDest,
INT  YDest,
INT  Width,
INT  Height,
HDC  hDCSrc,
INT  XSrc,
INT  YSrc,
DWORD  dwRop,
IN DWORD  crBackColor,
IN FLONG  fl 
)

Definition at line 152 of file bitblt.c.

164{
165
166 if (dwRop & CAPTUREBLT)
167 {
168 return NtGdiStretchBlt(hDCDest,
169 XDest,
170 YDest,
171 Width,
172 Height,
173 hDCSrc,
174 XSrc,
175 YSrc,
176 Width,
177 Height,
178 dwRop,
179 crBackColor);
180 }
181
182 dwRop = dwRop & ~(NOMIRRORBITMAP|CAPTUREBLT);
183
184 /* Forward to NtGdiMaskBlt */
185 // TODO: What's fl for? LOL not to send this to MaskBit!
186 return NtGdiMaskBlt(hDCDest,
187 XDest,
188 YDest,
189 Width,
190 Height,
191 hDCSrc,
192 XSrc,
193 YSrc,
194 NULL,
195 0,
196 0,
197 MAKEROP4(dwRop, dwRop),
198 crBackColor);
199}
BOOL APIENTRY NtGdiStretchBlt(HDC hDCDest, INT XOriginDest, INT YOriginDest, INT WidthDest, INT HeightDest, HDC hDCSrc, INT XOriginSrc, INT YOriginSrc, INT WidthSrc, INT HeightSrc, DWORD dwRop3, IN DWORD dwBackColor)
Definition: bitblt.c:801
BOOL APIENTRY NtGdiMaskBlt(HDC hdcDest, INT nXDest, INT nYDest, INT nWidth, INT nHeight, HDC hdcSrc, INT nXSrc, INT nYSrc, HBITMAP hbmMask, INT xMask, INT yMask, DWORD dwRop4, IN DWORD crBackColor)
Definition: bitblt.c:314
#define NOMIRRORBITMAP
Definition: wingdi.h:1377
#define CAPTUREBLT
Definition: wingdi.h:1376
#define MAKEROP4(f, b)
Definition: wingdi.h:2946

◆ NtGdiFillRgn()

BOOL APIENTRY NtGdiFillRgn ( _In_ HDC  hdc,
_In_ HRGN  hrgn,
_In_ HBRUSH  hbrush 
)

Definition at line 1295 of file bitblt.c.

1299{
1300 PDC pdc;
1301 PREGION prgn;
1302 PBRUSH pbrFill;
1303 BOOL bResult;
1304
1305 /* Lock the DC */
1306 pdc = DC_LockDc(hdc);
1307 if (pdc == NULL)
1308 {
1309 ERR("Failed to lock hdc %p\n", hdc);
1310 return FALSE;
1311 }
1312
1313 /* Check if the DC has no surface (empty mem or info DC) */
1314 if (pdc->dclevel.pSurface == NULL)
1315 {
1316 DC_UnlockDc(pdc);
1317 return TRUE;
1318 }
1319
1320 /* Lock the region */
1321 prgn = REGION_LockRgn(hrgn);
1322 if (prgn == NULL)
1323 {
1324 ERR("Failed to lock hrgn %p\n", hrgn);
1325 DC_UnlockDc(pdc);
1326 return FALSE;
1327 }
1328
1329 /* Lock the brush */
1330 pbrFill = BRUSH_ShareLockBrush(hbrush);
1331 if (pbrFill == NULL)
1332 {
1333 ERR("Failed to lock hbrush %p\n", hbrush);
1334 REGION_UnlockRgn(prgn);
1335 DC_UnlockDc(pdc);
1336 return FALSE;
1337 }
1338
1339 /* Call the internal function */
1340 bResult = IntGdiFillRgn(pdc, prgn, pbrFill);
1341
1342 /* Cleanup locks */
1343 BRUSH_ShareUnlockBrush(pbrFill);
1344 REGION_UnlockRgn(prgn);
1345 DC_UnlockDc(pdc);
1346
1347 return bResult;
1348}
static HRGN hrgn
static HBRUSH hbrush
#define ERR(fmt,...)
Definition: debug.h:113
HDC hdc
Definition: main.c:9
PREGION FASTCALL REGION_LockRgn(_In_ HRGN hrgn)
Definition: region.c:2358
VOID FASTCALL REGION_UnlockRgn(_In_ PREGION prgn)
Definition: region.c:2373

Referenced by FillRgn(), and NtGdiFrameRgn().

◆ NtGdiFrameRgn()

BOOL APIENTRY NtGdiFrameRgn ( _In_ HDC  hdc,
_In_ HRGN  hrgn,
_In_ HBRUSH  hbrush,
_In_ INT  xWidth,
_In_ INT  yHeight 
)

Definition at line 1352 of file bitblt.c.

1358{
1359 HRGN hrgnFrame;
1360 BOOL bResult;
1361
1362 hrgnFrame = GreCreateFrameRgn(hrgn, xWidth, yHeight);
1363 if (hrgnFrame == NULL)
1364 {
1365 return FALSE;
1366 }
1367
1368 bResult = NtGdiFillRgn(hdc, hrgnFrame, hbrush);
1369
1370 GreDeleteObject(hrgnFrame);
1371 return bResult;
1372}
BOOL APIENTRY NtGdiFillRgn(_In_ HDC hdc, _In_ HRGN hrgn, _In_ HBRUSH hbrush)
Definition: bitblt.c:1295
BOOL NTAPI GreDeleteObject(HGDIOBJ hobj)
Definition: gdiobj.c:1158
HRGN FASTCALL GreCreateFrameRgn(HRGN hrgn, INT cx, INT cy)
Definition: region.c:2025

Referenced by FrameRgn().

◆ NtGdiGetPixel()

COLORREF APIENTRY NtGdiGetPixel ( _In_ HDC  hdc,
_In_ INT  x,
_In_ INT  y 
)

Definition at line 1512 of file bitblt.c.

1516{
1517 PDC pdc;
1518 ULONG ulRGBColor = CLR_INVALID;
1519 POINTL ptlSrc;
1520 RECT rcDest;
1521 PSURFACE psurfSrc, psurfDest;
1522
1523 /* Lock the DC */
1524 pdc = DC_LockDc(hdc);
1525 if (!pdc)
1526 {
1528 return CLR_INVALID;
1529 }
1530
1531 /* Check if the DC has no surface (empty mem or info DC) */
1532 if (pdc->dclevel.pSurface == NULL)
1533 {
1534 /* Fail! */
1535 goto leave;
1536 }
1537
1538 /* Get the logical coordinates */
1539 ptlSrc.x = x;
1540 ptlSrc.y = y;
1541
1542 /* Translate coordinates to device coordinates */
1543 IntLPtoDP(pdc, &ptlSrc, 1);
1544 ptlSrc.x += pdc->ptlDCOrig.x;
1545 ptlSrc.y += pdc->ptlDCOrig.y;
1546
1547 rcDest.left = x;
1548 rcDest.top = y;
1549 rcDest.right = x + 1;
1550 rcDest.bottom = y + 1;
1551
1552 /* Prepare DC for blit */
1553 DC_vPrepareDCsForBlit(pdc, &rcDest, NULL, NULL);
1554
1555 /* Check if the pixel is outside the surface */
1556 psurfSrc = pdc->dclevel.pSurface;
1557 if ((ptlSrc.x >= psurfSrc->SurfObj.sizlBitmap.cx) ||
1558 (ptlSrc.y >= psurfSrc->SurfObj.sizlBitmap.cy) ||
1559 (ptlSrc.x < 0) ||
1560 (ptlSrc.y < 0))
1561 {
1562 /* Fail! */
1563 goto leave;
1564 }
1565
1566 /* Allocate a surface */
1568 1,
1569 1,
1570 BMF_32BPP,
1571 0,
1572 0,
1573 0,
1574 &ulRGBColor);
1575 if (psurfDest)
1576 {
1577 RECTL rclDest = {0, 0, 1, 1};
1578 EXLATEOBJ exlo;
1579
1580 /* Translate from the source palette to RGB color */
1582 psurfSrc->ppal,
1583 &gpalRGB,
1584 0,
1585 RGB(0xff,0xff,0xff),
1586 RGB(0,0,0));
1587
1588 /* Call the copy bits function */
1589 EngCopyBits(&psurfDest->SurfObj,
1590 &psurfSrc->SurfObj,
1591 NULL,
1592 &exlo.xlo,
1593 &rclDest,
1594 &ptlSrc);
1595
1596 /* Cleanup the XLATEOBJ */
1597 EXLATEOBJ_vCleanup(&exlo);
1598
1599 /* Delete the surface */
1600 GDIOBJ_vDeleteObject(&psurfDest->BaseObject);
1601
1602 /* The top byte is zero */
1603 ulRGBColor &= 0x00FFFFFF;
1604 }
1605
1606leave:
1607
1608 /* Unlock the DC */
1609 DC_vFinishBlit(pdc, NULL);
1610 DC_UnlockDc(pdc);
1611
1612 /* Return the new RGB color or -1 on failure */
1613 return ulRGBColor;
1614}
#define RGB(r, g, b)
Definition: precomp.h:71
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
struct _PALETTE *const ppal
Definition: surface.h:11
BASEOBJECT BaseObject
Definition: surface.h:6
uint32_t ULONG
Definition: typedefs.h:59
PSURFACE NTAPI SURFACE_AllocSurface(_In_ USHORT iType, _In_ ULONG cx, _In_ ULONG cy, _In_ ULONG iFormat, _In_ ULONG fjBitmap, _In_opt_ ULONG cjWidth, _In_opt_ ULONG cjBufSize, _In_opt_ PVOID pvBits)
Definition: surface.c:116
VOID NTAPI GDIOBJ_vDeleteObject(POBJ pobj)
Definition: gdiobj.c:1111
PALETTE gpalRGB
Definition: palette.c:20
#define STYPE_BITMAP
Definition: winddi.h:1175
ENGAPI BOOL APIENTRY EngCopyBits(_In_ SURFOBJ *psoDest, _In_ SURFOBJ *psoSrc, _In_opt_ CLIPOBJ *pco, _In_opt_ XLATEOBJ *pxlo, _In_ __in_data_source(USER_MODE) RECTL *prclDest, _In_ __in_data_source(USER_MODE) POINTL *pptlSrc)
#define BMF_32BPP
Definition: winddi.h:360
#define CLR_INVALID
Definition: wingdi.h:883
VOID NTAPI EXLATEOBJ_vInitialize(_Out_ PEXLATEOBJ pexlo, _In_opt_ PALETTE *ppalSrc, _In_opt_ PALETTE *ppalDst, _In_ COLORREF crSrcBackColor, _In_ COLORREF crDstBackColor, _In_ COLORREF crDstForeColor)
Definition: xlateobj.c:358

Referenced by GetPixel(), and START_TEST().

◆ NtGdiInvertRgn()

BOOL APIENTRY NtGdiInvertRgn ( _In_ HDC  hdc,
_In_ HRGN  hrgn 
)

Definition at line 1376 of file bitblt.c.

1379{
1380 BOOL bResult;
1381 PDC pdc;
1382 PREGION prgn;
1383
1384 /* Lock the DC */
1385 pdc = DC_LockDc(hdc);
1386 if (pdc == NULL)
1387 {
1389 return FALSE;
1390 }
1391
1392 /* Check if the DC has no surface (empty mem or info DC) */
1393 if (pdc->dclevel.pSurface == NULL)
1394 {
1395 /* Nothing to do, Windows returns TRUE! */
1396 DC_UnlockDc(pdc);
1397 return TRUE;
1398 }
1399
1400 /* Lock the region */
1401 prgn = REGION_LockRgn(hrgn);
1402 if (prgn == NULL)
1403 {
1404 DC_UnlockDc(pdc);
1405 return FALSE;
1406 }
1407
1408 /* Call the internal function */
1409 bResult = IntGdiBitBltRgn(pdc,
1410 prgn,
1411 NULL, // pbo
1412 NULL, // pptlBrush,
1414
1415 /* Unlock the region and DC and return the result */
1416 REGION_UnlockRgn(prgn);
1417 DC_UnlockDc(pdc);
1418 return bResult;
1419}
#define ROP4_DSTINVERT
Definition: dib.h:7
BOOL APIENTRY IntGdiBitBltRgn(_In_ PDC pdc, _In_ PREGION prgn, _In_opt_ BRUSHOBJ *pbo, _In_opt_ POINTL *pptlBrush, _In_ ROP4 rop4)
Definition: bitblt.c:1101

Referenced by InvertRgn().

◆ NtGdiMaskBlt()

BOOL APIENTRY NtGdiMaskBlt ( HDC  hdcDest,
INT  nXDest,
INT  nYDest,
INT  nWidth,
INT  nHeight,
HDC  hdcSrc,
INT  nXSrc,
INT  nYSrc,
HBITMAP  hbmMask,
INT  xMask,
INT  yMask,
DWORD  dwRop4,
IN DWORD  crBackColor 
)

Definition at line 314 of file bitblt.c.

328{
329 PDC DCDest;
330 PDC DCSrc = NULL;
331 HDC ahDC[2];
332 PGDIOBJ apObj[2];
333 PDC_ATTR pdcattr = NULL;
334 SURFACE *BitmapDest, *BitmapSrc = NULL, *psurfMask = NULL;
335 RECTL DestRect, SourceRect;
336 POINTL SourcePoint, MaskPoint;
337 BOOL Status = FALSE;
338 EXLATEOBJ exlo;
339 XLATEOBJ *XlateObj = NULL;
340 BOOL UsesSource;
341 ROP4 rop4;
342
344
345 UsesSource = ROP4_USES_SOURCE(rop4);
346 if (!hdcDest || (UsesSource && !hdcSrc))
347 {
349 return FALSE;
350 }
351
352 /* Check if we need a mask and have a mask bitmap */
353 if (ROP4_USES_MASK(rop4) && (hbmMask != NULL))
354 {
355 /* Reference the mask bitmap */
356 psurfMask = SURFACE_ShareLockSurface(hbmMask);
357 if (psurfMask == NULL)
358 {
360 return FALSE;
361 }
362
363 /* Make sure the mask bitmap is 1 BPP */
364 if (gajBitsPerFormat[psurfMask->SurfObj.iBitmapFormat] != 1)
365 {
368 return FALSE;
369 }
370 }
371 else
372 {
373 /* We use NULL, if we need a mask, the Eng function will take care of
374 that and use the brushobject to get a mask */
375 psurfMask = NULL;
376 }
377
378 MaskPoint.x = xMask;
379 MaskPoint.y = yMask;
380
381 /* Take care of source and destination bitmap */
382 TRACE("Locking DCs\n");
383 ahDC[0] = hdcDest;
384 ahDC[1] = UsesSource ? hdcSrc : NULL;
386 {
387 WARN("Invalid dc handle (dest=0x%p, src=0x%p) passed to NtGdiMaskBlt\n", hdcDest, hdcSrc);
388 if(psurfMask) SURFACE_ShareUnlockSurface(psurfMask);
390 return FALSE;
391 }
392 DCDest = apObj[0];
393 DCSrc = apObj[1];
394
395 ASSERT(DCDest);
396 if (NULL == DCDest)
397 {
398 if(DCSrc) DC_UnlockDc(DCSrc);
399 WARN("Invalid destination dc handle (0x%p) passed to NtGdiMaskBlt\n", hdcDest);
400 if(psurfMask) SURFACE_ShareUnlockSurface(psurfMask);
401 return FALSE;
402 }
403
404 if (DCDest->dctype == DCTYPE_INFO)
405 {
406 if(DCSrc) DC_UnlockDc(DCSrc);
407 DC_UnlockDc(DCDest);
408 /* Yes, Windows really returns TRUE in this case */
409 if(psurfMask) SURFACE_ShareUnlockSurface(psurfMask);
410 return TRUE;
411 }
412
413 if (UsesSource)
414 {
415 ASSERT(DCSrc);
416 if (DCSrc->dctype == DCTYPE_INFO)
417 {
418 DC_UnlockDc(DCDest);
419 DC_UnlockDc(DCSrc);
420 /* Yes, Windows really returns TRUE in this case */
421 if(psurfMask) SURFACE_ShareUnlockSurface(psurfMask);
422 return TRUE;
423 }
424 }
425
426 pdcattr = DCDest->pdcattr;
427
428 DestRect.left = nXDest;
429 DestRect.top = nYDest;
430 DestRect.right = nXDest + nWidth;
431 DestRect.bottom = nYDest + nHeight;
432 IntLPtoDP(DCDest, (LPPOINT)&DestRect, 2);
433
434 DestRect.left += DCDest->ptlDCOrig.x;
435 DestRect.top += DCDest->ptlDCOrig.y;
436 DestRect.right += DCDest->ptlDCOrig.x;
437 DestRect.bottom += DCDest->ptlDCOrig.y;
438
439 if (DCDest->fs & (DC_ACCUM_APP|DC_ACCUM_WMGR))
440 {
441 IntUpdateBoundsRect(DCDest, &DestRect);
442 }
443
444 SourcePoint.x = nXSrc;
445 SourcePoint.y = nYSrc;
446
447 if (UsesSource)
448 {
449 IntLPtoDP(DCSrc, (LPPOINT)&SourcePoint, 1);
450
451 SourcePoint.x += DCSrc->ptlDCOrig.x;
452 SourcePoint.y += DCSrc->ptlDCOrig.y;
453 /* Calculate Source Rect */
454 SourceRect.left = SourcePoint.x;
455 SourceRect.top = SourcePoint.y;
456 SourceRect.right = SourcePoint.x + DestRect.right - DestRect.left;
457 SourceRect.bottom = SourcePoint.y + DestRect.bottom - DestRect.top ;
458 }
459 else
460 {
461 SourceRect.left = 0;
462 SourceRect.top = 0;
463 SourceRect.right = 0;
464 SourceRect.bottom = 0;
465 }
466
467 /* Prepare blit */
468 DC_vPrepareDCsForBlit(DCDest, &DestRect, DCSrc, &SourceRect);
469
470 if (pdcattr->ulDirty_ & (DIRTY_FILL | DC_BRUSH_DIRTY))
471 DC_vUpdateFillBrush(DCDest);
472
473 /* Determine surfaces to be used in the bitblt */
474 BitmapDest = DCDest->dclevel.pSurface;
475 if (!BitmapDest)
476 goto cleanup;
477
478 if (UsesSource)
479 {
480 BitmapSrc = DCSrc->dclevel.pSurface;
481 if (!BitmapSrc)
482 goto cleanup;
483
484 /* Create the XLATEOBJ. */
485 EXLATEOBJ_vInitXlateFromDCs(&exlo, DCSrc, DCDest);
486 XlateObj = &exlo.xlo;
487 }
488
489 DPRINT("DestRect: (%d,%d)-(%d,%d) and SourcePoint is (%d,%d)\n",
490 DestRect.left, DestRect.top, DestRect.right, DestRect.bottom,
491 SourcePoint.x, SourcePoint.y);
492
493 DPRINT("nWidth is '%d' and nHeight is '%d'.\n", nWidth, nHeight);
494
495 /* Fix BitBlt so that it will not flip left to right */
496 if ((DestRect.left > DestRect.right) && (nWidth < 0))
497 {
498 SourcePoint.x += nWidth;
499 nWidth = -nWidth;
500 }
501
502 /* Fix BitBlt so that it will not flip top to bottom */
503 if ((DestRect.top > DestRect.bottom) && (nHeight < 0))
504 {
505 SourcePoint.y += nHeight;
506 nHeight = -nHeight;
507 }
508
509 /* Make Well Ordered so that we don't flip either way */
510 RECTL_vMakeWellOrdered(&DestRect);
511
512 /* Perform the bitblt operation */
513 Status = IntEngBitBlt(&BitmapDest->SurfObj,
514 BitmapSrc ? &BitmapSrc->SurfObj : NULL,
515 psurfMask ? &psurfMask->SurfObj : NULL,
516 (CLIPOBJ *)&DCDest->co,
517 XlateObj,
518 &DestRect,
519 &SourcePoint,
520 &MaskPoint,
521 &DCDest->eboFill.BrushObject,
522 &DCDest->dclevel.pbrFill->ptOrigin,
523 rop4);
524
525 if (UsesSource)
526 EXLATEOBJ_vCleanup(&exlo);
527cleanup:
528 DC_vFinishBlit(DCDest, DCSrc);
529 if (UsesSource)
530 {
531 DC_UnlockDc(DCSrc);
532 }
533 DC_UnlockDc(DCDest);
534 if(psurfMask) SURFACE_ShareUnlockSurface(psurfMask);
535
536 return Status;
537}
static void cleanup(void)
Definition: main.c:1335
UCHAR gajBitsPerFormat[11]
Definition: surface.c:21
#define SURFACE_ShareUnlockSurface(pBMObj)
Definition: surface.h:102
#define SURFACE_ShareLockSurface(hBMObj)
Definition: surface.h:91
VOID FASTCALL RECTL_vMakeWellOrdered(_Inout_ RECTL *prcl)
Definition: rect.c:81
static HDC hdcSrc
Definition: xlate.c:32

Referenced by NtGdiBitBlt().

◆ NtGdiPatBlt()

BOOL APIENTRY NtGdiPatBlt ( _In_ HDC  hdcDest,
_In_ INT  x,
_In_ INT  y,
_In_ INT  cx,
_In_ INT  cy,
_In_ DWORD  dwRop 
)

Definition at line 984 of file bitblt.c.

991{
992 BOOL bResult;
993 PDC pdc;
994
995 /* Convert the ROP3 to a ROP4 */
996 dwRop = MAKEROP4(dwRop & 0xFF0000, dwRop);
997
998 /* Check if the rop uses a source */
999 if (WIN32_ROP4_USES_SOURCE(dwRop))
1000 {
1001 /* This is not possible */
1002 return FALSE;
1003 }
1004
1005 /* Lock the DC */
1006 pdc = DC_LockDc(hdcDest);
1007 if (pdc == NULL)
1008 {
1010 return FALSE;
1011 }
1012
1013 /* Check if the DC has no surface (empty mem or info DC) */
1014 if (pdc->dclevel.pSurface == NULL)
1015 {
1016 /* Nothing to do, Windows returns TRUE! */
1017 DC_UnlockDc(pdc);
1018 return TRUE;
1019 }
1020
1021 /* Update the fill brush, if necessary */
1022 if (pdc->pdcattr->ulDirty_ & (DIRTY_FILL | DC_BRUSH_DIRTY))
1024
1025 /* Call the internal function */
1026 bResult = IntPatBlt(pdc, x, y, cx, cy, dwRop, &pdc->eboFill);
1027
1028 /* Unlock the DC and return the result */
1029 DC_UnlockDc(pdc);
1030 return bResult;
1031}
#define WIN32_ROP4_USES_SOURCE(Rop)
Definition: intgdi.h:7
_Out_opt_ int _Out_opt_ int * cy
Definition: commctrl.h:586
_Out_opt_ int * cx
Definition: commctrl.h:585

Referenced by co_IntDrawCaret(), FillRect(), FrameRect(), IntDrawScrollInterior(), IntPaintDesktop(), IntUpdateLayeredWindowI(), NC_DoNCPaint(), NC_DrawFrame(), PatBlt(), UITOOLS_DrawCheckedRect(), UserDrawCaption(), UserDrawCaptionBar(), and UserDrawWindowFrame().

◆ NtGdiPlgBlt()

BOOL APIENTRY NtGdiPlgBlt ( IN HDC  hdcTrg,
IN LPPOINT  pptlTrg,
IN HDC  hdcSrc,
IN INT  xSrc,
IN INT  ySrc,
IN INT  cxSrc,
IN INT  cySrc,
IN HBITMAP  hbmMask,
IN INT  xMask,
IN INT  yMask,
IN DWORD  crBackColor 
)

Definition at line 541 of file bitblt.c.

553{
554 FIXME("NtGdiPlgBlt: unimplemented.\n");
555 return FALSE;
556}
#define FIXME(fmt,...)
Definition: debug.h:114

◆ NtGdiPolyPatBlt()

BOOL APIENTRY NtGdiPolyPatBlt ( HDC  hDC,
DWORD  dwRop,
IN PPOLYPATBLT  pRects,
IN DWORD  cRects,
IN DWORD  Mode 
)

Definition at line 1035 of file bitblt.c.

1041{
1042 PPATRECT rb = NULL;
1044 BOOL Ret;
1045
1046 if (cRects > 0)
1047 {
1049 if (!rb)
1050 {
1052 return FALSE;
1053 }
1054 _SEH2_TRY
1055 {
1056 ProbeForRead(pRects,
1057 cRects * sizeof(PATRECT),
1058 1);
1059 RtlCopyMemory(rb,
1060 pRects,
1061 cRects * sizeof(PATRECT));
1062 }
1064 {
1066 }
1067 _SEH2_END;
1068
1069 if (!NT_SUCCESS(Status))
1070 {
1073 return FALSE;
1074 }
1075 }
1076
1077 Ret = IntGdiPolyPatBlt(hDC, dwRop, rb, cRects, Mode);
1078
1079 if (cRects > 0)
1081
1082 return Ret;
1083}
LONG NTSTATUS
Definition: precomp.h:26
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
#define PagedPool
Definition: env_spec_w32.h:308
VOID NTAPI ProbeForRead(IN CONST VOID *Address, IN SIZE_T Length, IN ULONG Alignment)
Definition: exintrin.c:102
#define _SEH2_END
Definition: filesup.c:22
#define _SEH2_TRY
Definition: filesup.c:19
_In_ ULONG Mode
Definition: hubbusif.h:303
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1109
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:165
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:66
#define STATUS_SUCCESS
Definition: shellext.h:65
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
VOID FASTCALL SetLastNtError(_In_ NTSTATUS Status)
Definition: error.c:31
BOOL FASTCALL IntGdiPolyPatBlt(HDC hDC, DWORD dwRop, PPATRECT pRects, INT cRects, ULONG Reserved)
Definition: bitblt.c:925
#define GDITAG_PLGBLT_DATA
Definition: tags.h:151

◆ NtGdiSetPixel()

COLORREF APIENTRY NtGdiSetPixel ( _In_ HDC  hdc,
_In_ INT  x,
_In_ INT  y,
_In_ COLORREF  crColor 
)

FIXME: we shouldn't dereference pSurface while the PDEV is not locked!

Definition at line 1423 of file bitblt.c.

1428{
1429 PDC pdc;
1430 ULONG iOldColor, iSolidColor;
1431 BOOL bResult;
1432 PEBRUSHOBJ pebo;
1433 ULONG ulDirty;
1434 EXLATEOBJ exlo;
1435
1436 /* Lock the DC */
1437 pdc = DC_LockDc(hdc);
1438 if (!pdc)
1439 {
1441 return -1;
1442 }
1443
1444 /* Check if the DC has no surface (empty mem or info DC) */
1445 if (pdc->dclevel.pSurface == NULL)
1446 {
1447 /* Fail! */
1448 DC_UnlockDc(pdc);
1449 return -1;
1450 }
1451
1452 if (pdc->fs & (DC_ACCUM_APP|DC_ACCUM_WMGR))
1453 {
1454 RECTL rcDst;
1455
1456 RECTL_vSetRect(&rcDst, x, y, x+1, y+1);
1457
1458 IntLPtoDP(pdc, (LPPOINT)&rcDst, 2);
1459
1460 rcDst.left += pdc->ptlDCOrig.x;
1461 rcDst.top += pdc->ptlDCOrig.y;
1462 rcDst.right += pdc->ptlDCOrig.x;
1463 rcDst.bottom += pdc->ptlDCOrig.y;
1464
1465 IntUpdateBoundsRect(pdc, &rcDst);
1466 }
1467
1468 /* Translate the color to the target format */
1469 iSolidColor = TranslateCOLORREF(pdc, crColor);
1470
1471 /* Use the DC's text brush, which is always a solid brush */
1472 pebo = &pdc->eboText;
1473
1474 /* Save the old solid color and set the one for the pixel */
1475 iOldColor = EBRUSHOBJ_iSetSolidColor(pebo, iSolidColor);
1476
1477 /* Save dirty flags and reset dirty text brush flag */
1478 ulDirty = pdc->pdcattr->ulDirty_;
1479 pdc->pdcattr->ulDirty_ &= ~DIRTY_TEXT;
1480
1481 /* Call the internal function */
1482 bResult = IntPatBlt(pdc, x, y, 1, 1, PATCOPY, pebo);
1483
1484 /* Restore old text brush color and dirty flags */
1485 EBRUSHOBJ_iSetSolidColor(pebo, iOldColor);
1486 pdc->pdcattr->ulDirty_ = ulDirty;
1487
1489 /* Initialize an XLATEOBJ from the target surface to RGB */
1491 pdc->dclevel.pSurface->ppal,
1492 &gpalRGB,
1493 0,
1494 pdc->pdcattr->crBackgroundClr,
1495 pdc->pdcattr->crForegroundClr);
1496
1497 /* Translate the color back to RGB */
1498 crColor = XLATEOBJ_iXlate(&exlo.xlo, iSolidColor);
1499
1500 /* Cleanup and return the target format color */
1501 EXLATEOBJ_vCleanup(&exlo);
1502
1503 /* Unlock the DC */
1504 DC_UnlockDc(pdc);
1505
1506 /* Return the new RGB color or -1 on failure */
1507 return bResult ? crColor : -1;
1508}
ULONG TranslateCOLORREF(PDC pdc, COLORREF crColor)
Definition: dcutil.c:869
FORCEINLINE ULONG EBRUSHOBJ_iSetSolidColor(EBRUSHOBJ *pebo, ULONG iSolidColor)
Definition: brush.h:187
FORCEINLINE VOID RECTL_vSetRect(_Out_ RECTL *prcl, _In_ LONG left, _In_ LONG top, _In_ LONG right, _In_ LONG bottom)
Definition: rect.h:5
ENGAPI ULONG APIENTRY XLATEOBJ_iXlate(_In_ XLATEOBJ *pxlo, _In_ ULONG iColor)
Definition: xlateobj.c:664
#define PATCOPY
Definition: wingdi.h:335

Referenced by SetPixel(), and START_TEST().

◆ NtGdiStretchBlt()

BOOL APIENTRY NtGdiStretchBlt ( HDC  hDCDest,
INT  XOriginDest,
INT  YOriginDest,
INT  WidthDest,
INT  HeightDest,
HDC  hDCSrc,
INT  XOriginSrc,
INT  YOriginSrc,
INT  WidthSrc,
INT  HeightSrc,
DWORD  dwRop3,
IN DWORD  dwBackColor 
)

Definition at line 801 of file bitblt.c.

814{
815 dwRop3 = dwRop3 & ~(NOMIRRORBITMAP|CAPTUREBLT);
816
817 return GreStretchBltMask(
818 hDCDest,
819 XOriginDest,
820 YOriginDest,
821 WidthDest,
822 HeightDest,
823 hDCSrc,
824 XOriginSrc,
825 YOriginSrc,
826 WidthSrc,
827 HeightSrc,
828 MAKEROP4(dwRop3 & 0xFF0000, dwRop3),
829 dwBackColor,
830 NULL,
831 0,
832 0);
833}
BOOL NTAPI GreStretchBltMask(HDC hDCDest, INT XOriginDest, INT YOriginDest, INT WidthDest, INT HeightDest, HDC hDCSrc, INT XOriginSrc, INT YOriginSrc, INT WidthSrc, INT HeightSrc, DWORD dwRop4, IN DWORD dwBackColor, HDC hDCMask, INT XOriginMask, INT YOriginMask)
Definition: bitblt.c:560

Referenced by NtGdiBitBlt().

◆ NtGdiTransparentBlt()

BOOL APIENTRY NtGdiTransparentBlt ( HDC  hdcDst,
INT  xDst,
INT  yDst,
INT  cxDst,
INT  cyDst,
HDC  hdcSrc,
INT  xSrc,
INT  ySrc,
INT  cxSrc,
INT  cySrc,
COLORREF  TransColor 
)

Definition at line 202 of file bitblt.c.

214{
215 PDC DCDest, DCSrc;
216 HDC ahDC[2];
217 PGDIOBJ apObj[2];
218 RECTL rcDest, rcSrc;
219 SURFACE *BitmapDest, *BitmapSrc = NULL;
220 ULONG TransparentColor = 0;
221 BOOL Ret = FALSE;
222 EXLATEOBJ exlo;
223
224 if ((hdcDst == NULL) || (hdcSrc == NULL))
225 {
227 return FALSE;
228 }
229
230 TRACE("Locking DCs\n");
231 ahDC[0] = hdcDst;
232 ahDC[1] = hdcSrc ;
234 {
235 WARN("Invalid dc handle (dest=0x%p, src=0x%p) passed to NtGdiAlphaBlend\n", hdcDst, hdcSrc);
237 return FALSE;
238 }
239 DCDest = apObj[0];
240 DCSrc = apObj[1];
241
242 if (DCSrc->dctype == DCTYPE_INFO || DCDest->dctype == DCTYPE_INFO)
243 {
244 GDIOBJ_vUnlockObject(&DCSrc->BaseObject);
245 GDIOBJ_vUnlockObject(&DCDest->BaseObject);
246 /* Yes, Windows really returns TRUE in this case */
247 return TRUE;
248 }
249
250 rcDest.left = xDst;
251 rcDest.top = yDst;
252 rcDest.right = rcDest.left + cxDst;
253 rcDest.bottom = rcDest.top + cyDst;
254 IntLPtoDP(DCDest, (LPPOINT)&rcDest, 2);
255
256 rcDest.left += DCDest->ptlDCOrig.x;
257 rcDest.top += DCDest->ptlDCOrig.y;
258 rcDest.right += DCDest->ptlDCOrig.x;
259 rcDest.bottom += DCDest->ptlDCOrig.y;
260
261 rcSrc.left = xSrc;
262 rcSrc.top = ySrc;
263 rcSrc.right = rcSrc.left + cxSrc;
264 rcSrc.bottom = rcSrc.top + cySrc;
265 IntLPtoDP(DCSrc, (LPPOINT)&rcSrc, 2);
266
267 rcSrc.left += DCSrc->ptlDCOrig.x;
268 rcSrc.top += DCSrc->ptlDCOrig.y;
269 rcSrc.right += DCSrc->ptlDCOrig.x;
270 rcSrc.bottom += DCSrc->ptlDCOrig.y;
271
272 if (DCDest->fs & (DC_ACCUM_APP|DC_ACCUM_WMGR))
273 {
274 IntUpdateBoundsRect(DCDest, &rcDest);
275 }
276
277 /* Prepare for blit */
278 DC_vPrepareDCsForBlit(DCDest, &rcDest, DCSrc, &rcSrc);
279
280 BitmapDest = DCDest->dclevel.pSurface;
281 if (!BitmapDest)
282 {
283 goto done;
284 }
285
286 BitmapSrc = DCSrc->dclevel.pSurface;
287 if (!BitmapSrc)
288 {
289 goto done;
290 }
291
292 /* Translate Transparent (RGB) Color to the source palette */
293 EXLATEOBJ_vInitialize(&exlo, &gpalRGB, BitmapSrc->ppal, 0, 0, 0);
294 TransparentColor = XLATEOBJ_iXlate(&exlo.xlo, (ULONG)TransColor);
295 EXLATEOBJ_vCleanup(&exlo);
296
297 EXLATEOBJ_vInitXlateFromDCs(&exlo, DCSrc, DCDest);
298
299 Ret = IntEngTransparentBlt(&BitmapDest->SurfObj, &BitmapSrc->SurfObj,
300 (CLIPOBJ *)&DCDest->co, &exlo.xlo, &rcDest, &rcSrc,
301 TransparentColor, 0);
302
303 EXLATEOBJ_vCleanup(&exlo);
304
305done:
306 DC_vFinishBlit(DCDest, DCSrc);
307 GDIOBJ_vUnlockObject(&DCDest->BaseObject);
308 GDIOBJ_vUnlockObject(&DCSrc->BaseObject);
309
310 return Ret;
311}
BOOL FASTCALL IntEngTransparentBlt(SURFOBJ *Dest, SURFOBJ *Source, CLIPOBJ *Clip, XLATEOBJ *ColorTranslation, PRECTL DestRect, PRECTL SourceRect, ULONG iTransColor, ULONG Reserved)
Definition: transblt.c:207
static HDC hdcDst
Definition: xlate.c:32

◆ REGION_LPTODP()

static BOOL FASTCALL REGION_LPTODP ( _In_ PDC  pdc,
_Inout_ PREGION  prgnDest,
_In_ PREGION  prgnSrc 
)
static

Definition at line 1088 of file bitblt.c.

1092{
1093 if (IntGdiCombineRgn(prgnDest, prgnSrc, NULL, RGN_COPY) == ERROR)
1094 return FALSE;
1095
1096 return REGION_bXformRgn(prgnDest, DC_pmxWorldToDevice(pdc));
1097}
FORCEINLINE PMATRIX DC_pmxWorldToDevice(PDC pdc)
Definition: coord.h:135
#define ERROR(name)
Definition: error_private.h:53
BOOL FASTCALL REGION_bXformRgn(_Inout_ PREGION prgn, _In_ PMATRIX pmx)
Definition: region.c:2066
#define RGN_COPY
Definition: wingdi.h:357

Referenced by IntGdiBitBltRgn(), and IntGdiFillRgn().