ReactOS 0.4.15-dev-8434-g155a7c7
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 568 of file bitblt.c.

584{
585 PDC DCDest;
586 PDC DCSrc = NULL;
587 PDC DCMask = NULL;
588 HDC ahDC[3];
589 PGDIOBJ apObj[3];
590 PDC_ATTR pdcattr;
591 SURFACE *BitmapDest, *BitmapSrc = NULL;
592 SURFACE *BitmapMask = NULL;
593 RECTL DestRect;
594 RECTL SourceRect;
595 POINTL MaskPoint;
596 BOOL Status = FALSE;
597 EXLATEOBJ exlo;
598 XLATEOBJ *XlateObj = NULL;
599 POINTL BrushOrigin;
600 BOOL UsesSource;
601 BOOL UsesMask;
602 ROP4 rop4;
603 BOOL Case0000, Case0101, Case1010, CaseExcept;
604
606
607 UsesSource = ROP4_USES_SOURCE(rop4);
608 UsesMask = ROP4_USES_MASK(rop4);
609
610 if (0 == WidthDest || 0 == HeightDest || 0 == WidthSrc || 0 == HeightSrc)
611 {
613 return TRUE;
614 }
615
616 if (!hDCDest || (UsesSource && !hDCSrc) || (UsesMask && !hDCMask))
617 {
619 return FALSE;
620 }
621
622 ahDC[0] = hDCDest;
623 ahDC[1] = UsesSource ? hDCSrc : NULL;
624 ahDC[2] = UsesMask ? hDCMask : NULL;
626 {
627 WARN("Invalid dc handle (dest=0x%p, src=0x%p) passed to GreStretchBltMask\n", hDCDest, hDCSrc);
629 return FALSE;
630 }
631 DCDest = apObj[0];
632 DCSrc = apObj[1];
633 DCMask = apObj[2];
634
635 if (DCDest->dctype == DCTYPE_INFO)
636 {
637 if(DCSrc) GDIOBJ_vUnlockObject(&DCSrc->BaseObject);
638 if(DCMask) GDIOBJ_vUnlockObject(&DCMask->BaseObject);
639 GDIOBJ_vUnlockObject(&DCDest->BaseObject);
640 /* Yes, Windows really returns TRUE in this case */
641 return TRUE;
642 }
643
644 if (UsesSource)
645 {
646 if (DCSrc->dctype == DCTYPE_INFO)
647 {
648 GDIOBJ_vUnlockObject(&DCDest->BaseObject);
649 GDIOBJ_vUnlockObject(&DCSrc->BaseObject);
650 if(DCMask) GDIOBJ_vUnlockObject(&DCMask->BaseObject);
651 /* Yes, Windows really returns TRUE in this case */
652 return TRUE;
653 }
654 }
655
656
657 Case0000 = ((WidthDest < 0) && (HeightDest < 0) && (WidthSrc < 0) && (HeightSrc < 0));
658 Case0101 = ((WidthDest < 0) && (HeightDest > 0) && (WidthSrc < 0) && (HeightSrc > 0));
659 Case1010 = ((WidthDest > 0) && (HeightDest < 0) && (WidthSrc > 0) && (HeightSrc < 0));
660 CaseExcept = (Case0000 || Case0101 || Case1010);
661
662 pdcattr = DCDest->pdcattr;
663
664 DestRect.left = XOriginDest;
665 DestRect.top = YOriginDest;
666 DestRect.right = XOriginDest+WidthDest;
667 DestRect.bottom = YOriginDest+HeightDest;
668
669 /* Account for possible negative span values */
670 if ((WidthDest < 0) && !CaseExcept)
671 {
672 DestRect.left++;
673 DestRect.right++;
674 }
675 if ((HeightDest < 0) && !CaseExcept)
676 {
677 DestRect.top++;
678 DestRect.bottom++;
679 }
680
681 IntLPtoDP(DCDest, (LPPOINT)&DestRect, 2);
682
683 DestRect.left += DCDest->ptlDCOrig.x;
684 DestRect.top += DCDest->ptlDCOrig.y;
685 DestRect.right += DCDest->ptlDCOrig.x;
686 DestRect.bottom += DCDest->ptlDCOrig.y;
687
688 if (DCDest->fs & (DC_ACCUM_APP|DC_ACCUM_WMGR))
689 {
690 IntUpdateBoundsRect(DCDest, &DestRect);
691 }
692
693 SourceRect.left = XOriginSrc;
694 SourceRect.top = YOriginSrc;
695 SourceRect.right = XOriginSrc+WidthSrc;
696 SourceRect.bottom = YOriginSrc+HeightSrc;
697
698 /* Account for possible negative span values */
699 if ((WidthSrc < 0) && !CaseExcept)
700 {
701 SourceRect.left++;
702 SourceRect.right++;
703 }
704 if ((HeightSrc < 0) && !CaseExcept)
705 {
706 SourceRect.top++;
707 SourceRect.bottom++;
708 }
709
710 if (UsesSource)
711 {
712 IntLPtoDP(DCSrc, (LPPOINT)&SourceRect, 2);
713
714 SourceRect.left += DCSrc->ptlDCOrig.x;
715 SourceRect.top += DCSrc->ptlDCOrig.y;
716 SourceRect.right += DCSrc->ptlDCOrig.x;
717 SourceRect.bottom += DCSrc->ptlDCOrig.y;
718 }
719
720 BrushOrigin.x = 0;
721 BrushOrigin.y = 0;
722
723 /* Only prepare Source and Dest, hdcMask represents a DIB */
724 DC_vPrepareDCsForBlit(DCDest, &DestRect, DCSrc, &SourceRect);
725
726 if (pdcattr->ulDirty_ & (DIRTY_FILL | DC_BRUSH_DIRTY))
727 DC_vUpdateFillBrush(DCDest);
728
729 /* Determine surfaces to be used in the bitblt */
730 BitmapDest = DCDest->dclevel.pSurface;
731 if (BitmapDest == NULL)
732 goto failed;
733 if (UsesSource)
734 {
735 BitmapSrc = DCSrc->dclevel.pSurface;
736 if (BitmapSrc == NULL)
737 goto failed;
738
739 /* Create the XLATEOBJ. */
740 EXLATEOBJ_vInitXlateFromDCs(&exlo, DCSrc, DCDest);
741 XlateObj = &exlo.xlo;
742 }
743
744 /* Offset the brush */
745 BrushOrigin.x += DCDest->ptlDCOrig.x;
746 BrushOrigin.y += DCDest->ptlDCOrig.y;
747
748 /* Make mask surface for source surface */
749 if (BitmapSrc && DCMask)
750 {
751 BitmapMask = DCMask->dclevel.pSurface;
752 if (BitmapMask &&
753 (BitmapMask->SurfObj.sizlBitmap.cx < WidthSrc ||
754 BitmapMask->SurfObj.sizlBitmap.cy < HeightSrc))
755 {
756 WARN("%dx%d mask is smaller than %dx%d bitmap\n",
757 BitmapMask->SurfObj.sizlBitmap.cx, BitmapMask->SurfObj.sizlBitmap.cy,
758 WidthSrc, HeightSrc);
759 EXLATEOBJ_vCleanup(&exlo);
760 goto failed;
761 }
762 /* Create mask offset point */
763 MaskPoint.x = XOriginMask;
764 MaskPoint.y = YOriginMask;
765 IntLPtoDP(DCMask, &MaskPoint, 1);
766 MaskPoint.x += DCMask->ptlDCOrig.x;
767 MaskPoint.y += DCMask->ptlDCOrig.y;
768 }
769
770 DPRINT("Calling IntEngStrethBlt SourceRect: (%d,%d)-(%d,%d) and DestRect: (%d,%d)-(%d,%d).\n",
771 SourceRect.left, SourceRect.top, SourceRect.right, SourceRect.bottom,
772 DestRect.left, DestRect.top, DestRect.right, DestRect.bottom);
773
774 /* Perform the bitblt operation */
775 Status = IntEngStretchBlt(&BitmapDest->SurfObj,
776 BitmapSrc ? &BitmapSrc->SurfObj : NULL,
777 BitmapMask ? &BitmapMask->SurfObj : NULL,
778 (CLIPOBJ *)&DCDest->co,
779 XlateObj,
780 &DCDest->dclevel.ca,
781 &DestRect,
782 &SourceRect,
783 BitmapMask ? &MaskPoint : NULL,
784 &DCDest->eboFill.BrushObject,
785 &BrushOrigin,
786 rop4);
787 if (UsesSource)
788 {
789 EXLATEOBJ_vCleanup(&exlo);
790 }
791
792failed:
793 DC_vFinishBlit(DCDest, DCSrc);
794 if (UsesSource)
795 {
796 DC_UnlockDc(DCSrc);
797 }
798 if (DCMask)
799 {
800 DC_UnlockDc(DCMask);
801 }
802 DC_UnlockDc(DCDest);
803
804 return Status;
805}
#define WARN(fmt,...)
Definition: precomp.h:61
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 1109 of file bitblt.c.

1115{
1116 PREGION prgnClip;
1117 XCLIPOBJ xcoClip;
1118 BOOL bResult;
1119 NT_ASSERT((pdc != NULL) && (prgn != NULL));
1120
1121 /* Check if we have a surface */
1122 if (pdc->dclevel.pSurface == NULL)
1123 {
1124 return TRUE;
1125 }
1126
1127 /* Create an empty clip region */
1128 prgnClip = IntSysCreateRectpRgn(0, 0, 0, 0);
1129 if (prgnClip == NULL)
1130 {
1131 return FALSE;
1132 }
1133
1134 /* Transform given region into device coordinates */
1135 if (!REGION_LPTODP(pdc, prgnClip, prgn))
1136 {
1137 REGION_Delete(prgnClip);
1138 return FALSE;
1139 }
1140
1141 /* Intersect with the system or RAO region (these are (atm) without DC-origin) */
1142 if (pdc->prgnRao)
1143 IntGdiCombineRgn(prgnClip, prgnClip, pdc->prgnRao, RGN_AND);
1144 else
1145 IntGdiCombineRgn(prgnClip, prgnClip, pdc->prgnVis, RGN_AND);
1146
1147 /* Now account for the DC-origin */
1148 if (!REGION_bOffsetRgn(prgnClip, pdc->ptlDCOrig.x, pdc->ptlDCOrig.y))
1149 {
1150 REGION_Delete(prgnClip);
1151 return FALSE;
1152 }
1153
1154 if (pdc->fs & (DC_ACCUM_APP|DC_ACCUM_WMGR))
1155 {
1156 RECTL rcrgn;
1157 REGION_GetRgnBox(prgnClip, &rcrgn);
1158 IntUpdateBoundsRect(pdc, &rcrgn);
1159 }
1160
1161 /* Prepare the DC */
1162 DC_vPrepareDCsForBlit(pdc, &prgnClip->rdh.rcBound, NULL, NULL);
1163
1164 /* Initialize a clip object */
1165 IntEngInitClipObj(&xcoClip);
1166 IntEngUpdateClipRegion(&xcoClip,
1167 prgnClip->rdh.nCount,
1168 prgnClip->Buffer,
1169 &prgnClip->rdh.rcBound);
1170
1171 /* Call the Eng or Drv function */
1172 bResult = IntEngBitBlt(&pdc->dclevel.pSurface->SurfObj,
1173 NULL,
1174 NULL,
1175 (CLIPOBJ *)&xcoClip,
1176 NULL,
1177 &prgnClip->rdh.rcBound,
1178 NULL,
1179 NULL,
1180 pbo,
1181 pptlBrush,
1182 rop4);
1183
1184 /* Cleanup */
1185 DC_vFinishBlit(pdc, NULL);
1186 REGION_Delete(prgnClip);
1187 IntEngFreeClipResources(&xcoClip);
1188
1189 /* Return the result */
1190 return bResult;
1191}
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:1096
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 1194 of file bitblt.c.

1198{
1199 PREGION prgnClip;
1200 XCLIPOBJ xcoClip;
1201 EBRUSHOBJ eboFill;
1202 BRUSHOBJ *pbo;
1203 BOOL bRet;
1204 DWORD rop2Fg;
1205 MIX mix;
1206 NT_ASSERT((pdc != NULL) && (prgn != NULL));
1207
1208 if (pdc->dclevel.pSurface == NULL)
1209 {
1210 return TRUE;
1211 }
1212
1213 prgnClip = IntSysCreateRectpRgn(0, 0, 0, 0);
1214 if (prgnClip == NULL)
1215 {
1216 return FALSE;
1217 }
1218
1219 /* Transform region into device coordinates */
1220 if (!REGION_LPTODP(pdc, prgnClip, prgn))
1221 {
1222 REGION_Delete(prgnClip);
1223 return FALSE;
1224 }
1225
1226 /* Intersect with the system or RAO region (these are (atm) without DC-origin) */
1227 if (pdc->prgnRao)
1228 IntGdiCombineRgn(prgnClip, prgnClip, pdc->prgnRao, RGN_AND);
1229 else
1230 IntGdiCombineRgn(prgnClip, prgnClip, pdc->prgnVis, RGN_AND);
1231
1232 /* Now account for the DC-origin */
1233 if (!REGION_bOffsetRgn(prgnClip, pdc->ptlDCOrig.x, pdc->ptlDCOrig.y))
1234 {
1235 REGION_Delete(prgnClip);
1236 return FALSE;
1237 }
1238
1239 if (pdc->fs & (DC_ACCUM_APP|DC_ACCUM_WMGR))
1240 {
1241 RECTL rcrgn;
1242 REGION_GetRgnBox(prgnClip, &rcrgn);
1243 IntUpdateBoundsRect(pdc, &rcrgn);
1244 }
1245
1246 IntEngInitClipObj(&xcoClip);
1247 IntEngUpdateClipRegion(&xcoClip,
1248 prgnClip->rdh.nCount,
1249 prgnClip->Buffer,
1250 &prgnClip->rdh.rcBound );
1251
1252 /* Get the FG rop and create a MIX based on the BK mode */
1253 rop2Fg = FIXUP_ROP2(pdc->pdcattr->jROP2);
1254 mix = rop2Fg | (pdc->pdcattr->jBkMode == OPAQUE ? rop2Fg : R2_NOP) << 8;
1255
1256 /* Prepare DC for blit */
1257 DC_vPrepareDCsForBlit(pdc, &prgnClip->rdh.rcBound, NULL, NULL);
1258
1259 /* Check if we have a fill brush */
1260 if (pbrFill != NULL)
1261 {
1262 /* Initialize the brush object */
1264 EBRUSHOBJ_vInit(&eboFill, pbrFill, pdc->dclevel.pSurface, 0x00FFFFFF, 0, NULL);
1265 pbo = &eboFill.BrushObject;
1266 }
1267 else
1268 {
1269 /* Update the fill brush if needed */
1270 if (pdc->pdcattr->ulDirty_ & (DIRTY_FILL | DC_BRUSH_DIRTY))
1272
1273 /* Use the DC brush object */
1274 pbo = &pdc->eboFill.BrushObject;
1275 }
1276
1277 /* Call the internal function */
1278 bRet = IntEngPaint(&pdc->dclevel.pSurface->SurfObj,
1279 (CLIPOBJ *)&xcoClip,
1280 pbo,
1281 &pdc->pdcattr->ptlBrushOrigin,
1282 mix);
1283
1284 DC_vFinishBlit(pdc, NULL);
1285 REGION_Delete(prgnClip);
1286 IntEngFreeClipResources(&xcoClip);
1287
1288 // Fill the region
1289 return bRet;
1290}
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 1294 of file bitblt.c.

1297{
1298 return IntGdiFillRgn(pdc, prgn, NULL);
1299}
BOOL IntGdiFillRgn(_In_ PDC pdc, _In_ PREGION prgn, _In_opt_ PBRUSH pbrFill)
Definition: bitblt.c:1194

◆ IntGdiPolyPatBlt()

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

Definition at line 933 of file bitblt.c.

939{
940 INT i;
941 PBRUSH pbrush;
942 PDC pdc;
943 EBRUSHOBJ eboFill;
944
945 pdc = DC_LockDc(hDC);
946 if (!pdc)
947 {
949 return FALSE;
950 }
951
952 if (pdc->dctype == DCTYPE_INFO)
953 {
954 DC_UnlockDc(pdc);
955 /* Yes, Windows really returns TRUE in this case */
956 return TRUE;
957 }
958
959 for (i = 0; i < cRects; i++)
960 {
961 pbrush = BRUSH_ShareLockBrush(pRects->hBrush);
962
963 /* Check if we could lock the brush */
964 if (pbrush != NULL)
965 {
966 /* Initialize a brush object */
967 EBRUSHOBJ_vInitFromDC(&eboFill, pbrush, pdc);
968
969 IntPatBlt(
970 pdc,
971 pRects->r.left,
972 pRects->r.top,
973 pRects->r.right,
974 pRects->r.bottom,
975 dwRop,
976 &eboFill);
977
978 /* Cleanup the brush object and unlock the brush */
979 EBRUSHOBJ_vCleanup(&eboFill);
981 }
982 pRects++;
983 }
984
985 DC_UnlockDc(pdc);
986
987 return TRUE;
988}
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:845

Referenced by NtGdiPolyPatBlt().

◆ IntPatBlt()

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

Definition at line 845 of file bitblt.c.

853{
854 RECTL DestRect;
855 SURFACE *psurf;
856 POINTL BrushOrigin;
857 BOOL ret;
858 PBRUSH pbrush;
859
860 ASSERT(pebo);
861 pbrush = pebo->pbrush;
862 ASSERT(pbrush);
863
864 if (pbrush->flAttrs & BR_IS_NULL)
865 {
866 return TRUE;
867 }
868
869 if (Width >= 0)
870 {
871 DestRect.left = XLeft;
872 DestRect.right = XLeft + Width;
873 }
874 else
875 {
876 DestRect.left = XLeft + Width;
877 DestRect.right = XLeft;
878 }
879
880 if (Height >= 0)
881 {
882 DestRect.top = YLeft;
883 DestRect.bottom = YLeft + Height;
884 }
885 else
886 {
887 DestRect.top = YLeft + Height;
888 DestRect.bottom = YLeft;
889 }
890
891 IntLPtoDP(pdc, (LPPOINT)&DestRect, 2);
892
893 DestRect.left += pdc->ptlDCOrig.x;
894 DestRect.top += pdc->ptlDCOrig.y;
895 DestRect.right += pdc->ptlDCOrig.x;
896 DestRect.bottom += pdc->ptlDCOrig.y;
897
898 if (pdc->fs & (DC_ACCUM_APP|DC_ACCUM_WMGR))
899 {
900 IntUpdateBoundsRect(pdc, &DestRect);
901 }
902
903#ifdef _USE_DIBLIB_
904 BrushOrigin.x = pbrush->ptOrigin.x + pdc->ptlDCOrig.x + XLeft;
905 BrushOrigin.y = pbrush->ptOrigin.y + pdc->ptlDCOrig.y + YLeft;
906#else
907 BrushOrigin.x = pbrush->ptOrigin.x + pdc->ptlDCOrig.x;
908 BrushOrigin.y = pbrush->ptOrigin.y + pdc->ptlDCOrig.y;
909#endif
910
911 DC_vPrepareDCsForBlit(pdc, &DestRect, NULL, NULL);
912
913 psurf = pdc->dclevel.pSurface;
914
915 ret = IntEngBitBlt(&psurf->SurfObj,
916 NULL,
917 NULL,
918 (CLIPOBJ *)&pdc->co,
919 NULL,
920 &DestRect,
921 NULL,
922 NULL,
923 &pebo->BrushObject,
924 &BrushOrigin,
925 WIN32_ROP3_TO_ENG_ROP4(dwRop3));
926
927 DC_vFinishBlit(pdc, NULL);
928
929 return ret;
930}
#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:809
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 1303 of file bitblt.c.

1307{
1308 PDC pdc;
1309 PREGION prgn;
1310 PBRUSH pbrFill;
1311 BOOL bResult;
1312
1313 /* Lock the DC */
1314 pdc = DC_LockDc(hdc);
1315 if (pdc == NULL)
1316 {
1317 ERR("Failed to lock hdc %p\n", hdc);
1318 return FALSE;
1319 }
1320
1321 /* Check if the DC has no surface (empty mem or info DC) */
1322 if (pdc->dclevel.pSurface == NULL)
1323 {
1324 DC_UnlockDc(pdc);
1325 return TRUE;
1326 }
1327
1328 /* Lock the region */
1329 prgn = REGION_LockRgn(hrgn);
1330 if (prgn == NULL)
1331 {
1332 ERR("Failed to lock hrgn %p\n", hrgn);
1333 DC_UnlockDc(pdc);
1334 return FALSE;
1335 }
1336
1337 /* Lock the brush */
1338 pbrFill = BRUSH_ShareLockBrush(hbrush);
1339 if (pbrFill == NULL)
1340 {
1341 ERR("Failed to lock hbrush %p\n", hbrush);
1342 REGION_UnlockRgn(prgn);
1343 DC_UnlockDc(pdc);
1344 return FALSE;
1345 }
1346
1347 /* Call the internal function */
1348 bResult = IntGdiFillRgn(pdc, prgn, pbrFill);
1349
1350 /* Cleanup locks */
1351 BRUSH_ShareUnlockBrush(pbrFill);
1352 REGION_UnlockRgn(prgn);
1353 DC_UnlockDc(pdc);
1354
1355 return bResult;
1356}
static HRGN hrgn
static HBRUSH hbrush
#define ERR(fmt,...)
Definition: precomp.h:57
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 1360 of file bitblt.c.

1366{
1367 HRGN hrgnFrame;
1368 BOOL bResult;
1369
1370 hrgnFrame = GreCreateFrameRgn(hrgn, xWidth, yHeight);
1371 if (hrgnFrame == NULL)
1372 {
1373 return FALSE;
1374 }
1375
1376 bResult = NtGdiFillRgn(hdc, hrgnFrame, hbrush);
1377
1378 GreDeleteObject(hrgnFrame);
1379 return bResult;
1380}
BOOL APIENTRY NtGdiFillRgn(_In_ HDC hdc, _In_ HRGN hrgn, _In_ HBRUSH hbrush)
Definition: bitblt.c:1303
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 1520 of file bitblt.c.

1524{
1525 PDC pdc;
1526 ULONG ulRGBColor = CLR_INVALID;
1527 POINTL ptlSrc;
1528 RECT rcDest;
1529 PSURFACE psurfSrc, psurfDest;
1530
1531 /* Lock the DC */
1532 pdc = DC_LockDc(hdc);
1533 if (!pdc)
1534 {
1536 return CLR_INVALID;
1537 }
1538
1539 /* Check if the DC has no surface (empty mem or info DC) */
1540 if (pdc->dclevel.pSurface == NULL)
1541 {
1542 /* Fail! */
1543 goto leave;
1544 }
1545
1546 /* Get the logical coordinates */
1547 ptlSrc.x = x;
1548 ptlSrc.y = y;
1549
1550 /* Translate coordinates to device coordinates */
1551 IntLPtoDP(pdc, &ptlSrc, 1);
1552 ptlSrc.x += pdc->ptlDCOrig.x;
1553 ptlSrc.y += pdc->ptlDCOrig.y;
1554
1555 rcDest.left = x;
1556 rcDest.top = y;
1557 rcDest.right = x + 1;
1558 rcDest.bottom = y + 1;
1559
1560 /* Prepare DC for blit */
1561 DC_vPrepareDCsForBlit(pdc, &rcDest, NULL, NULL);
1562
1563 /* Check if the pixel is outside the surface */
1564 psurfSrc = pdc->dclevel.pSurface;
1565 if ((ptlSrc.x >= psurfSrc->SurfObj.sizlBitmap.cx) ||
1566 (ptlSrc.y >= psurfSrc->SurfObj.sizlBitmap.cy) ||
1567 (ptlSrc.x < 0) ||
1568 (ptlSrc.y < 0))
1569 {
1570 /* Fail! */
1571 goto leave;
1572 }
1573
1574 /* Allocate a surface */
1576 1,
1577 1,
1578 BMF_32BPP,
1579 0,
1580 0,
1581 0,
1582 &ulRGBColor);
1583 if (psurfDest)
1584 {
1585 RECTL rclDest = {0, 0, 1, 1};
1586 EXLATEOBJ exlo;
1587
1588 /* Translate from the source palette to RGB color */
1590 psurfSrc->ppal,
1591 &gpalRGB,
1592 0,
1593 RGB(0xff,0xff,0xff),
1594 RGB(0,0,0));
1595
1596 /* Call the copy bits function */
1597 EngCopyBits(&psurfDest->SurfObj,
1598 &psurfSrc->SurfObj,
1599 NULL,
1600 &exlo.xlo,
1601 &rclDest,
1602 &ptlSrc);
1603
1604 /* Cleanup the XLATEOBJ */
1605 EXLATEOBJ_vCleanup(&exlo);
1606
1607 /* Delete the surface */
1608 GDIOBJ_vDeleteObject(&psurfDest->BaseObject);
1609
1610 /* The top byte is zero */
1611 ulRGBColor &= 0x00FFFFFF;
1612 }
1613
1614leave:
1615
1616 /* Unlock the DC */
1617 DC_vFinishBlit(pdc, NULL);
1618 DC_UnlockDc(pdc);
1619
1620 /* Return the new RGB color or -1 on failure */
1621 return ulRGBColor;
1622}
#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 1384 of file bitblt.c.

1387{
1388 BOOL bResult;
1389 PDC pdc;
1390 PREGION prgn;
1391
1392 /* Lock the DC */
1393 pdc = DC_LockDc(hdc);
1394 if (pdc == NULL)
1395 {
1397 return FALSE;
1398 }
1399
1400 /* Check if the DC has no surface (empty mem or info DC) */
1401 if (pdc->dclevel.pSurface == NULL)
1402 {
1403 /* Nothing to do, Windows returns TRUE! */
1404 DC_UnlockDc(pdc);
1405 return TRUE;
1406 }
1407
1408 /* Lock the region */
1409 prgn = REGION_LockRgn(hrgn);
1410 if (prgn == NULL)
1411 {
1412 DC_UnlockDc(pdc);
1413 return FALSE;
1414 }
1415
1416 /* Call the internal function */
1417 bResult = IntGdiBitBltRgn(pdc,
1418 prgn,
1419 NULL, // pbo
1420 NULL, // pptlBrush,
1422
1423 /* Unlock the region and DC and return the result */
1424 REGION_UnlockRgn(prgn);
1425 DC_UnlockDc(pdc);
1426 return bResult;
1427}
#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:1109

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

999{
1000 BOOL bResult;
1001 PDC pdc;
1002
1003 /* Convert the ROP3 to a ROP4 */
1004 dwRop = MAKEROP4(dwRop & 0xFF0000, dwRop);
1005
1006 /* Check if the rop uses a source */
1007 if (WIN32_ROP4_USES_SOURCE(dwRop))
1008 {
1009 /* This is not possible */
1010 return FALSE;
1011 }
1012
1013 /* Lock the DC */
1014 pdc = DC_LockDc(hdcDest);
1015 if (pdc == NULL)
1016 {
1018 return FALSE;
1019 }
1020
1021 /* Check if the DC has no surface (empty mem or info DC) */
1022 if (pdc->dclevel.pSurface == NULL)
1023 {
1024 /* Nothing to do, Windows returns TRUE! */
1025 DC_UnlockDc(pdc);
1026 return TRUE;
1027 }
1028
1029 /* Update the fill brush, if necessary */
1030 if (pdc->pdcattr->ulDirty_ & (DIRTY_FILL | DC_BRUSH_DIRTY))
1032
1033 /* Call the internal function */
1034 bResult = IntPatBlt(pdc, x, y, cx, cy, dwRop, &pdc->eboFill);
1035
1036 /* Unlock the DC and return the result */
1037 DC_UnlockDc(pdc);
1038 return bResult;
1039}
#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 549 of file bitblt.c.

561{
562 FIXME("NtGdiPlgBlt: unimplemented.\n");
563 return FALSE;
564}
#define FIXME(fmt,...)
Definition: precomp.h:53

◆ NtGdiPolyPatBlt()

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

Definition at line 1043 of file bitblt.c.

1049{
1050 PPATRECT rb = NULL;
1052 BOOL Ret;
1053
1054 if (cRects > 0)
1055 {
1057 if (!rb)
1058 {
1060 return FALSE;
1061 }
1062 _SEH2_TRY
1063 {
1064 ProbeForRead(pRects,
1065 cRects * sizeof(PATRECT),
1066 1);
1067 RtlCopyMemory(rb,
1068 pRects,
1069 cRects * sizeof(PATRECT));
1070 }
1072 {
1074 }
1075 _SEH2_END;
1076
1077 if (!NT_SUCCESS(Status))
1078 {
1081 return FALSE;
1082 }
1083 }
1084
1085 Ret = IntGdiPolyPatBlt(hDC, dwRop, rb, cRects, Mode);
1086
1087 if (cRects > 0)
1089
1090 return Ret;
1091}
LONG NTSTATUS
Definition: precomp.h:26
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
#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:933
#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 1431 of file bitblt.c.

1436{
1437 PDC pdc;
1438 ULONG iOldColor, iSolidColor;
1439 BOOL bResult;
1440 PEBRUSHOBJ pebo;
1441 ULONG ulDirty;
1442 EXLATEOBJ exlo;
1443
1444 /* Lock the DC */
1445 pdc = DC_LockDc(hdc);
1446 if (!pdc)
1447 {
1449 return -1;
1450 }
1451
1452 /* Check if the DC has no surface (empty mem or info DC) */
1453 if (pdc->dclevel.pSurface == NULL)
1454 {
1455 /* Fail! */
1456 DC_UnlockDc(pdc);
1457 return -1;
1458 }
1459
1460 if (pdc->fs & (DC_ACCUM_APP|DC_ACCUM_WMGR))
1461 {
1462 RECTL rcDst;
1463
1464 RECTL_vSetRect(&rcDst, x, y, x+1, y+1);
1465
1466 IntLPtoDP(pdc, (LPPOINT)&rcDst, 2);
1467
1468 rcDst.left += pdc->ptlDCOrig.x;
1469 rcDst.top += pdc->ptlDCOrig.y;
1470 rcDst.right += pdc->ptlDCOrig.x;
1471 rcDst.bottom += pdc->ptlDCOrig.y;
1472
1473 IntUpdateBoundsRect(pdc, &rcDst);
1474 }
1475
1476 /* Translate the color to the target format */
1477 iSolidColor = TranslateCOLORREF(pdc, crColor);
1478
1479 /* Use the DC's text brush, which is always a solid brush */
1480 pebo = &pdc->eboText;
1481
1482 /* Save the old solid color and set the one for the pixel */
1483 iOldColor = EBRUSHOBJ_iSetSolidColor(pebo, iSolidColor);
1484
1485 /* Save dirty flags and reset dirty text brush flag */
1486 ulDirty = pdc->pdcattr->ulDirty_;
1487 pdc->pdcattr->ulDirty_ &= ~DIRTY_TEXT;
1488
1489 /* Call the internal function */
1490 bResult = IntPatBlt(pdc, x, y, 1, 1, PATCOPY, pebo);
1491
1492 /* Restore old text brush color and dirty flags */
1493 EBRUSHOBJ_iSetSolidColor(pebo, iOldColor);
1494 pdc->pdcattr->ulDirty_ = ulDirty;
1495
1497 /* Initialize an XLATEOBJ from the target surface to RGB */
1499 pdc->dclevel.pSurface->ppal,
1500 &gpalRGB,
1501 0,
1502 pdc->pdcattr->crBackgroundClr,
1503 pdc->pdcattr->crForegroundClr);
1504
1505 /* Translate the color back to RGB */
1506 crColor = XLATEOBJ_iXlate(&exlo.xlo, iSolidColor);
1507
1508 /* Cleanup and return the target format color */
1509 EXLATEOBJ_vCleanup(&exlo);
1510
1511 /* Unlock the DC */
1512 DC_UnlockDc(pdc);
1513
1514 /* Return the new RGB color or -1 on failure */
1515 return bResult ? crColor : -1;
1516}
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 809 of file bitblt.c.

822{
823 dwRop3 = dwRop3 & ~(NOMIRRORBITMAP|CAPTUREBLT);
824
825 return GreStretchBltMask(
826 hDCDest,
827 XOriginDest,
828 YOriginDest,
829 WidthDest,
830 HeightDest,
831 hDCSrc,
832 XOriginSrc,
833 YOriginSrc,
834 WidthSrc,
835 HeightSrc,
836 MAKEROP4(dwRop3 & 0xFF0000, dwRop3),
837 dwBackColor,
838 NULL,
839 0,
840 0);
841}
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:568

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 1096 of file bitblt.c.

1100{
1101 if (IntGdiCombineRgn(prgnDest, prgnSrc, NULL, RGN_COPY) == ERROR)
1102 return FALSE;
1103
1104 return REGION_bXformRgn(prgnDest, DC_pmxWorldToDevice(pdc));
1105}
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().