ReactOS 0.4.15-dev-8219-ge8b88cf
engmisc.c File Reference
#include <win32k.h>
#include <debug.h>
Include dependency graph for engmisc.c:

Go to the source code of this file.

Macros

#define NDEBUG
 

Functions

BOOL APIENTRY IntEngEnter (PINTENG_ENTER_LEAVE EnterLeave, SURFOBJ *psoDest, RECTL *DestRect, BOOL ReadOnly, POINTL *Translate, SURFOBJ **ppsoOutput)
 
BOOL APIENTRY IntEngLeave (PINTENG_ENTER_LEAVE EnterLeave)
 
HANDLE APIENTRY EngGetProcessHandle (VOID)
 
VOID APIENTRY EngGetCurrentCodePage (_Out_ PUSHORT OemCodePage, _Out_ PUSHORT AnsiCodePage)
 
BOOL APIENTRY EngQuerySystemAttribute (_In_ ENG_SYSTEM_ATTRIBUTE CapNum, _Out_ PDWORD pCapability)
 
ULONGLONG APIENTRY EngGetTickCount (VOID)
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 11 of file engmisc.c.

Function Documentation

◆ EngGetCurrentCodePage()

VOID APIENTRY EngGetCurrentCodePage ( _Out_ PUSHORT  OemCodePage,
_Out_ PUSHORT  AnsiCodePage 
)

Definition at line 232 of file engmisc.c.

235{
236 /* Forward to kernel */
238}
static CODEPAGE_ENTRY AnsiCodePage
Definition: nls.c:46
static CODEPAGE_ENTRY OemCodePage
Definition: nls.c:47
NTSYSAPI VOID NTAPI RtlGetDefaultCodePage(_Out_ PUSHORT AnsiCodePage, _Out_ PUSHORT OemCodePage)

Referenced by FillTM().

◆ EngGetProcessHandle()

HANDLE APIENTRY EngGetProcessHandle ( VOID  )

Definition at line 222 of file engmisc.c.

223{
224 /* http://www.osr.com/ddk/graphics/gdifncs_3tif.htm
225 In Windows 2000 and later, the EngGetProcessHandle function always returns NULL.
226 FIXME: What does NT4 return? */
227 return NULL;
228}
#define NULL
Definition: types.h:112

◆ EngGetTickCount()

ULONGLONG APIENTRY EngGetTickCount ( VOID  )

Definition at line 288 of file engmisc.c.

289{
290 ULONG Multiplier;
291 LARGE_INTEGER TickCount;
292
293 /* Get the multiplier and current tick count */
294 KeQueryTickCount(&TickCount);
295 Multiplier = SharedUserData->TickCountMultiplier;
296
297 /* Convert to milliseconds and return */
298 return (Int64ShrlMod32(UInt32x32To64(Multiplier, TickCount.LowPart), 24) +
299 (Multiplier * (TickCount.HighPart << 8)));
300}
#define UInt32x32To64(a, b)
Definition: intsafe.h:252
#define Int64ShrlMod32(a, b)
#define KeQueryTickCount(CurrentCount)
Definition: ke.h:43
#define SharedUserData
uint32_t ULONG
Definition: typedefs.h:59
ULONG LowPart
Definition: typedefs.h:106

◆ EngQuerySystemAttribute()

BOOL APIENTRY EngQuerySystemAttribute ( _In_ ENG_SYSTEM_ATTRIBUTE  CapNum,
_Out_ PDWORD  pCapability 
)

Definition at line 242 of file engmisc.c.

245{
249
250 switch (CapNum)
251 {
254 &sbi,
256 NULL);
257 if (!NT_SUCCESS(status))
258 {
259 DPRINT1("Failed to query basic information: 0x%lx\n", status);
260 return FALSE;
261 }
262
264 return TRUE;
265
268 &spi,
270 NULL);
271 if (!NT_SUCCESS(status))
272 {
273 DPRINT1("Failed to query processor information: 0x%lx\n", status);
274 return FALSE;
275 }
277 return TRUE;
278
279 default:
280 break;
281 }
282
283 return FALSE;
284}
LONG NTSTATUS
Definition: precomp.h:26
#define DPRINT1
Definition: precomp.h:8
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
@ SystemProcessorInformation
Definition: ntddk_ex.h:12
@ SystemBasicInformation
Definition: ntddk_ex.h:11
NTSYSAPI NTSTATUS NTAPI NtQuerySystemInformation(IN SYSTEM_INFORMATION_CLASS SystemInfoClass, OUT PVOID SystemInfoBuffer, IN ULONG SystemInfoBufferSize, OUT PULONG BytesReturned OPTIONAL)
Definition: ps.c:97
_Check_return_ _Out_ PDWORD pCapability
Definition: winddi.h:2308
@ EngNumberOfProcessors
Definition: winddi.h:2287
@ EngProcessorFeature
Definition: winddi.h:2286

◆ IntEngEnter()

BOOL APIENTRY IntEngEnter ( PINTENG_ENTER_LEAVE  EnterLeave,
SURFOBJ psoDest,
RECTL DestRect,
BOOL  ReadOnly,
POINTL Translate,
SURFOBJ **  ppsoOutput 
)

Definition at line 15 of file engmisc.c.

21{
22 LONG Exchange;
23 SIZEL BitmapSize;
24 POINTL SrcPoint;
25 LONG Width;
26 RECTL ClippedDestRect;
27
28 /* Normalize */
29 if (DestRect->right < DestRect->left)
30 {
31 Exchange = DestRect->left;
32 DestRect->left = DestRect->right;
33 DestRect->right = Exchange;
34 }
35 if (DestRect->bottom < DestRect->top)
36 {
37 Exchange = DestRect->top;
38 DestRect->top = DestRect->bottom;
39 DestRect->bottom = Exchange;
40 }
41
42 if (NULL != psoDest && STYPE_BITMAP != psoDest->iType &&
43 (NULL == psoDest->pvScan0 || 0 == psoDest->lDelta))
44 {
45 /* Driver needs to support DrvCopyBits, else we can't do anything */
46 SURFACE *psurfDest = CONTAINING_RECORD(psoDest, SURFACE, SurfObj);
47 if (!(psurfDest->flags & HOOK_COPYBITS))
48 {
49 return FALSE;
50 }
51
52 /* Allocate a temporary bitmap */
53 BitmapSize.cx = DestRect->right - DestRect->left;
54 BitmapSize.cy = DestRect->bottom - DestRect->top;
56 EnterLeave->OutputBitmap = EngCreateBitmap(BitmapSize, Width,
57 psoDest->iBitmapFormat,
59
60 if (!EnterLeave->OutputBitmap)
61 {
62 DPRINT1("EngCreateBitmap() failed\n");
63 return FALSE;
64 }
65
66 *ppsoOutput = EngLockSurface((HSURF)EnterLeave->OutputBitmap);
67 if (*ppsoOutput == NULL)
68 {
70 return FALSE;
71 }
72
73 EnterLeave->DestRect.left = 0;
74 EnterLeave->DestRect.top = 0;
75 EnterLeave->DestRect.right = BitmapSize.cx;
76 EnterLeave->DestRect.bottom = BitmapSize.cy;
77 SrcPoint.x = DestRect->left;
78 SrcPoint.y = DestRect->top;
79 ClippedDestRect = EnterLeave->DestRect;
80 if (SrcPoint.x < 0)
81 {
82 ClippedDestRect.left -= SrcPoint.x;
83 SrcPoint.x = 0;
84 }
85 if (psoDest->sizlBitmap.cx < SrcPoint.x + ClippedDestRect.right - ClippedDestRect.left)
86 {
87 ClippedDestRect.right = ClippedDestRect.left + psoDest->sizlBitmap.cx - SrcPoint.x;
88 }
89 if (SrcPoint.y < 0)
90 {
91 ClippedDestRect.top -= SrcPoint.y;
92 SrcPoint.y = 0;
93 }
94 if (psoDest->sizlBitmap.cy < SrcPoint.y + ClippedDestRect.bottom - ClippedDestRect.top)
95 {
96 ClippedDestRect.bottom = ClippedDestRect.top + psoDest->sizlBitmap.cy - SrcPoint.y;
97 }
98 EnterLeave->TrivialClipObj = EngCreateClip();
99 if (EnterLeave->TrivialClipObj == NULL)
100 {
101 EngUnlockSurface(*ppsoOutput);
102 EngDeleteSurface((HSURF)EnterLeave->OutputBitmap);
103 return FALSE;
104 }
106 if (ClippedDestRect.left < (*ppsoOutput)->sizlBitmap.cx &&
107 0 <= ClippedDestRect.right &&
108 SrcPoint.x < psoDest->sizlBitmap.cx &&
109 ClippedDestRect.top <= (*ppsoOutput)->sizlBitmap.cy &&
110 0 <= ClippedDestRect.bottom &&
111 SrcPoint.y < psoDest->sizlBitmap.cy &&
112 ! GDIDEVFUNCS(psoDest).CopyBits(
113 *ppsoOutput, psoDest,
114 EnterLeave->TrivialClipObj, NULL,
115 &ClippedDestRect, &SrcPoint))
116 {
117 EngDeleteClip(EnterLeave->TrivialClipObj);
118 EngUnlockSurface(*ppsoOutput);
119 EngDeleteSurface((HSURF)EnterLeave->OutputBitmap);
120 return FALSE;
121 }
122 EnterLeave->DestRect.left = DestRect->left;
123 EnterLeave->DestRect.top = DestRect->top;
124 EnterLeave->DestRect.right = DestRect->right;
125 EnterLeave->DestRect.bottom = DestRect->bottom;
126 Translate->x = - DestRect->left;
127 Translate->y = - DestRect->top;
128 }
129 else
130 {
131 Translate->x = 0;
132 Translate->y = 0;
133 *ppsoOutput = psoDest;
134 }
135
136 if (NULL != *ppsoOutput)
137 {
138 SURFACE* psurfOutput = CONTAINING_RECORD(*ppsoOutput, SURFACE, SurfObj);
139 if (0 != (psurfOutput->flags & HOOK_SYNCHRONIZE))
140 {
141 if (NULL != GDIDEVFUNCS(*ppsoOutput).SynchronizeSurface)
142 {
143 GDIDEVFUNCS(*ppsoOutput).SynchronizeSurface(*ppsoOutput, DestRect, 0);
144 }
145 else if (STYPE_BITMAP == (*ppsoOutput)->iType
146 && NULL != GDIDEVFUNCS(*ppsoOutput).Synchronize)
147 {
148 GDIDEVFUNCS(*ppsoOutput).Synchronize((*ppsoOutput)->dhpdev, DestRect);
149 }
150 }
151 }
152 else return FALSE;
153
154 EnterLeave->DestObj = psoDest;
155 EnterLeave->OutputObj = *ppsoOutput;
156 EnterLeave->ReadOnly = ReadOnly;
157
158 return TRUE;
159}
long LONG
Definition: pedump.c:60
@ ReadOnly
Definition: arc.h:80
HBITMAP OutputBitmap
Definition: misc.h:8
SURFOBJ * OutputObj
Definition: misc.h:7
SURFOBJ * DestObj
Definition: misc.h:6
CLIPOBJ * TrivialClipObj
Definition: misc.h:9
long bottom
Definition: polytest.cpp:53
long right
Definition: polytest.cpp:53
long top
Definition: polytest.cpp:53
long left
Definition: polytest.cpp:53
BYTE iDComplexity
Definition: winddi.h:278
LONG y
Definition: windef.h:330
LONG x
Definition: windef.h:329
LONG cx
Definition: kdterminal.h:27
LONG cy
Definition: kdterminal.h:28
FLONG flags
Definition: surface.h:10
USHORT iType
Definition: winddi.h:1216
SIZEL sizlBitmap
Definition: winddi.h:1209
ULONG iBitmapFormat
Definition: winddi.h:1215
PVOID pvScan0
Definition: winddi.h:1212
LONG lDelta
Definition: winddi.h:1213
#define WIDTH_BYTES_ALIGN32(cx, bpp)
Definition: swimpl.c:16
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260
_In_ HFONT _Out_ PUINT _Out_ PUINT Width
Definition: font.h:89
#define GDIDEVFUNCS(SurfObj)
Definition: surface.h:106
#define BitsPerFormat(Format)
Definition: surface.h:109
#define DC_TRIVIAL
Definition: winddi.h:259
ENGAPI CLIPOBJ *APIENTRY EngCreateClip(VOID)
Definition: clip.c:222
#define STYPE_BITMAP
Definition: winddi.h:1175
ENGAPI VOID APIENTRY EngDeleteClip(_In_ _Post_ptr_invalid_ CLIPOBJ *pco)
Definition: clip.c:241
ENGAPI BOOL APIENTRY EngDeleteSurface(_In_ _Post_ptr_invalid_ HSURF hsurf)
Definition: surface.c:567
ENGAPI SURFOBJ *APIENTRY EngLockSurface(_In_ HSURF hsurf)
Definition: surface.c:607
ENGAPI HBITMAP APIENTRY EngCreateBitmap(_In_ SIZEL sizl, _In_ LONG lWidth, _In_ ULONG iFormat, _In_ FLONG fl, _In_opt_ PVOID pvBits)
#define BMF_TOPDOWN
Definition: winddi.h:1180
typedef HSURF(APIENTRY FN_DrvEnableSurface)(_In_ DHPDEV dhpdev)
#define BMF_NOZEROINIT
Definition: winddi.h:1181
#define HOOK_SYNCHRONIZE
Definition: winddi.h:1431
#define HOOK_COPYBITS
Definition: winddi.h:1429
ENGAPI VOID APIENTRY EngUnlockSurface(_In_ _Post_ptr_invalid_ SURFOBJ *pso)
Definition: surface.c:628

Referenced by EngAlphaBlend(), EngLineTo(), EngMaskBitBlt(), EngStretchBltROP(), EngTransparentBlt(), IntEngGradientFillRect(), and IntEngGradientFillTriangle().

◆ IntEngLeave()

BOOL APIENTRY IntEngLeave ( PINTENG_ENTER_LEAVE  EnterLeave)

Definition at line 162 of file engmisc.c.

163{
164 POINTL SrcPoint;
165 BOOL Result = TRUE;
166
167 if (EnterLeave->OutputObj != EnterLeave->DestObj && NULL != EnterLeave->OutputObj)
168 {
169 if (! EnterLeave->ReadOnly)
170 {
171 SrcPoint.x = 0;
172 SrcPoint.y = 0;
173 if (EnterLeave->DestRect.left < 0)
174 {
175 SrcPoint.x = - EnterLeave->DestRect.left;
176 EnterLeave->DestRect.left = 0;
177 }
178 if (EnterLeave->DestObj->sizlBitmap.cx < EnterLeave->DestRect.right)
179 {
180 EnterLeave->DestRect.right = EnterLeave->DestObj->sizlBitmap.cx;
181 }
182 if (EnterLeave->DestRect.top < 0)
183 {
184 SrcPoint.y = - EnterLeave->DestRect.top;
185 EnterLeave->DestRect.top = 0;
186 }
187 if (EnterLeave->DestObj->sizlBitmap.cy < EnterLeave->DestRect.bottom)
188 {
189 EnterLeave->DestRect.bottom = EnterLeave->DestObj->sizlBitmap.cy;
190 }
191 if (SrcPoint.x < EnterLeave->OutputObj->sizlBitmap.cx &&
192 EnterLeave->DestRect.left <= EnterLeave->DestRect.right &&
193 EnterLeave->DestRect.left < EnterLeave->DestObj->sizlBitmap.cx &&
194 SrcPoint.y < EnterLeave->OutputObj->sizlBitmap.cy &&
195 EnterLeave->DestRect.top <= EnterLeave->DestRect.bottom &&
196 EnterLeave->DestRect.top < EnterLeave->DestObj->sizlBitmap.cy)
197 {
198 Result = GDIDEVFUNCS(EnterLeave->DestObj).CopyBits(
199 EnterLeave->DestObj,
200 EnterLeave->OutputObj,
201 EnterLeave->TrivialClipObj, NULL,
202 &EnterLeave->DestRect, &SrcPoint);
203 }
204 else
205 {
206 Result = TRUE;
207 }
208 }
209 EngUnlockSurface(EnterLeave->OutputObj);
210 EngDeleteSurface((HSURF)EnterLeave->OutputBitmap);
211 EngDeleteClip(EnterLeave->TrivialClipObj);
212 }
213 else
214 {
215 Result = TRUE;
216 }
217
218 return Result;
219}
unsigned int BOOL
Definition: ntddk_ex.h:94
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:409

Referenced by EngAlphaBlend(), EngLineTo(), EngMaskBitBlt(), EngStretchBltROP(), EngTransparentBlt(), IntEngGradientFillRect(), and IntEngGradientFillTriangle().