ReactOS  0.4.10-dev-479-g13a3cf0
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

#define NDEBUG

Definition at line 11 of file engmisc.c.

Function Documentation

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

Definition at line 232 of file engmisc.c.

Referenced by FillTMEx().

235 {
236  /* Forward to kernel */
238 }
static CODEPAGE_ENTRY AnsiCodePage
Definition: nls.c:41
NTSYSAPI VOID NTAPI RtlGetDefaultCodePage(_Out_ PUSHORT AnsiCodePage, _Out_ PUSHORT OemCodePage)
static CODEPAGE_ENTRY OemCodePage
Definition: nls.c:42
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 }
smooth NULL
Definition: ftsmooth.c:416
ULONGLONG APIENTRY EngGetTickCount ( VOID  )

Definition at line 288 of file engmisc.c.

Referenced by co_EVENT_CallEvents(), and IntNotifyWinEvent().

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 }
VOID NTAPI KeQueryTickCount(IN PLARGE_INTEGER TickCount)
Definition: clock.c:165
#define SharedUserData
ULONG LowPart
Definition: typedefs.h:104
#define Int64ShrlMod32(a, b)
unsigned int ULONG
Definition: retypes.h:1
#define UInt32x32To64(a, b)
Definition: intsafe.h:258
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,
255  sizeof(SYSTEM_BASIC_INFORMATION),
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 
266  case EngProcessorFeature:
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 }
#define TRUE
Definition: types.h:120
NTSYSAPI NTSTATUS NTAPI NtQuerySystemInformation(IN SYSTEM_INFORMATION_CLASS SystemInfoClass, OUT PVOID SystemInfoBuffer, IN ULONG SystemInfoBufferSize, OUT PULONG BytesReturned OPTIONAL)
#define FALSE
Definition: types.h:117
smooth NULL
Definition: ftsmooth.c:416
LONG NTSTATUS
Definition: precomp.h:26
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:24
#define SystemBasicInformation
Definition: xboxvmp.h:35
#define DPRINT1
Definition: precomp.h:8
_Check_return_ _Out_ PDWORD pCapability
Definition: winddi.h:2308
static SERVICE_STATUS status
Definition: service.c:31
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.

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

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;
55  Width = WIDTH_BYTES_ALIGN32(BitmapSize.cx, BitsPerFormat(psoDest->iBitmapFormat));
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  {
69  EngDeleteSurface((HSURF)EnterLeave->OutputBitmap);
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  }
105  EnterLeave->TrivialClipObj->iDComplexity = DC_TRIVIAL;
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 }
SURFOBJ * OutputObj
Definition: misc.h:7
#define TRUE
Definition: types.h:120
SIZEL sizlBitmap
Definition: winddi.h:1209
LONG lDelta
Definition: winddi.h:1213
ENGAPI BOOL APIENTRY EngDeleteSurface(_In_ _Post_ptr_invalid_ HSURF hsurf)
Definition: surface.c:564
#define WIDTH_BYTES_ALIGN32(cx, bpp)
Definition: swimpl.c:26
#define STYPE_BITMAP
Definition: winddi.h:1175
#define BitsPerFormat(Format)
Definition: surface.h:109
Definition: arc.h:80
USHORT iType
Definition: winddi.h:1216
#define DC_TRIVIAL
Definition: winddi.h:259
#define BMF_TOPDOWN
Definition: winddi.h:1180
long bottom
Definition: polytest.cpp:53
ENGAPI CLIPOBJ *APIENTRY EngCreateClip(VOID)
Definition: clip.c:222
ULONG iBitmapFormat
Definition: winddi.h:1215
SURFOBJ * DestObj
Definition: misc.h:6
LONG y
Definition: windef.h:320
long right
Definition: polytest.cpp:53
#define FALSE
Definition: types.h:117
long LONG
Definition: pedump.c:60
long top
Definition: polytest.cpp:53
smooth NULL
Definition: ftsmooth.c:416
LONG cx
Definition: windef.h:324
long left
Definition: polytest.cpp:53
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
typedef HSURF(APIENTRY FN_DrvEnableSurface)(_In_ DHPDEV dhpdev)
#define GDIDEVFUNCS(SurfObj)
Definition: surface.h:106
LONG x
Definition: windef.h:319
ENGAPI SURFOBJ *APIENTRY EngLockSurface(_In_ HSURF hsurf)
Definition: surface.c:604
#define BMF_NOZEROINIT
Definition: winddi.h:1181
#define HOOK_SYNCHRONIZE
Definition: winddi.h:1431
#define HOOK_COPYBITS
Definition: winddi.h:1429
BYTE iDComplexity
Definition: winddi.h:278
FLONG flags
Definition: surface.h:10
ENGAPI VOID APIENTRY EngUnlockSurface(_In_ _Post_ptr_invalid_ SURFOBJ *pso)
Definition: surface.c:625
CLIPOBJ * TrivialClipObj
Definition: misc.h:9
HBITMAP OutputBitmap
Definition: misc.h:8
#define DPRINT1
Definition: precomp.h:8
ENGAPI VOID APIENTRY EngDeleteClip(_In_ _Post_ptr_invalid_ CLIPOBJ *pco)
Definition: clip.c:241
LONG cy
Definition: windef.h:325
ENGAPI HBITMAP APIENTRY EngCreateBitmap(_In_ SIZEL sizl, _In_ LONG lWidth, _In_ ULONG iFormat, _In_ FLONG fl, _In_opt_ PVOID pvBits)
PVOID pvScan0
Definition: winddi.h:1212
BOOL APIENTRY IntEngLeave ( PINTENG_ENTER_LEAVE  EnterLeave)

Definition at line 162 of file engmisc.c.

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

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 }
SURFOBJ * OutputObj
Definition: misc.h:7
#define TRUE
Definition: types.h:120
SIZEL sizlBitmap
Definition: winddi.h:1209
ENGAPI BOOL APIENTRY EngDeleteSurface(_In_ _Post_ptr_invalid_ HSURF hsurf)
Definition: surface.c:564
long bottom
Definition: polytest.cpp:53
_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:426
SURFOBJ * DestObj
Definition: misc.h:6
LONG y
Definition: windef.h:320
long right
Definition: polytest.cpp:53
long top
Definition: polytest.cpp:53
smooth NULL
Definition: ftsmooth.c:416
LONG cx
Definition: windef.h:324
long left
Definition: polytest.cpp:53
typedef HSURF(APIENTRY FN_DrvEnableSurface)(_In_ DHPDEV dhpdev)
unsigned int BOOL
Definition: ntddk_ex.h:94
#define GDIDEVFUNCS(SurfObj)
Definition: surface.h:106
LONG x
Definition: windef.h:319
ENGAPI VOID APIENTRY EngUnlockSurface(_In_ _Post_ptr_invalid_ SURFOBJ *pso)
Definition: surface.c:625
CLIPOBJ * TrivialClipObj
Definition: misc.h:9
HBITMAP OutputBitmap
Definition: misc.h:8
ENGAPI VOID APIENTRY EngDeleteClip(_In_ _Post_ptr_invalid_ CLIPOBJ *pco)
Definition: clip.c:241
LONG cy
Definition: windef.h:325