480 Commits
Author SHA1 Message Date
Timo Kreuzer 5e76d075f1 [WIN32K:ENG] Relax surface parameter validation
If no bitmap buffer size is provided (e.g. allocation path from EngCreateBitmap), do not validate that the size calculation is valid. Should fix some display drivers, like Radeon IGP 320M.
See CORE-13036, CORE-11676
2026-07-04 07:55:24 +00:00
Mohammad Amin MollazadehandSimone Mario Lombardo 6d8a5fa0bb [WIN32SS:NTGDI] Allow calling NtGdiCreateHalftonePalette with a NULL hDC (#9217)
CORE-20231

Tests show this is allowed on Windows and even Wine. Also, official MS
Windows SDK headers indicate that the `CreateHalftonePalette()` `hDC`
parameter is optional, and so can be NULL.

Not allowing a NULL `hDC` caused compatibility issues, breaking applications
like Internet Explorer 8.0 and Microsoft Encarta.

Make `NtGdiCreateHalftonePalette()` accept a NULL `hDC`, fixing its crash
in this case, and only locking it when it's not NULL. Simplify also the
function execution path.

Co-authored-by: Simone Mario Lombardo <[email protected]>
2026-07-02 20:19:33 +02:00
Ahmed Arif c0f18d059a [WIN32SS:GDI] Fix an off-by-one error in the StretchBlt mask bounds check (#9136)
The mask bounds check in `DIB_XXBPP_StretchBlt` allowed `sx == cx` (and similar for `sy`),
reading one pixel past the end of the mask bitmap.
On the contrary, the source-surface check a few lines below already does it right.
2026-06-27 17:03:48 +02:00
Katayama Hirofumi MZ d47cdbbdff [GDI32][GDI32_APITEST][SDK] Support GetGlyphOutlineWow (#9210)
Add 16-bit support and refactor.
JIRA issue: CORE-8466
- Refactor GetGlyphOutlineA/W.
- Implement GetGlyphOutlineWow.
- Modify gdi32.spec.
- Add prototype into <undocgdi.h>.
- Enhance GetGlyphOutline testcase.
2026-06-27 11:36:36 +09:00
Ahmed Arif aaab5f0198 [WIN32SS:NTGDI] IntGdiCreateDisplayDC: Directly invoke GreCreateCompatibleDC (#9164)
Call the internal GreCreateCompatibleDC instead of the NtGdi syscall stub.
2026-06-26 14:28:42 +02:00
Ahmed Arif 6e95a132bd [WIN32SS:ENG/NTUSER] Use shared locks for display list lookups (#9090)
- Use shared locks for the display device and PDEV lookup paths.
  These functions only walk existing lists and take references, while list updates
  and mode-switch paths still use exclusive locking.
  This avoids serializing read-only display queries unnecessarily.

- Use shared locks for other read-only NtUser calls.
2026-06-26 14:07:15 +02:00
Ahmed Arif ae0e4ee305 [WIN32K:DIB] Fix some bugs in DIB_8BPP_BitBltSrcCopy (#9119)
- Fix destination row stride;
- Fix source stride and double translation in the flip path.

Related to CORE-2965
2026-06-25 18:03:00 +02:00
Ahmed Arif d3ed29ef06 [NTGDI][POLYTEST] Use newx1 as the lower bound in polyfill line-touch test (#9118)
Bug/typo was introduced in https://github.com/reactos/reactos/commit/5b6d43ab50b88d2ab8fd3d7ebf434173c5768065 (r5619).
2026-06-08 16:42:33 +03:00
Ahmed Arif a94352ba48 [WIN32SS:ENG] Fix copy direction in overlapping EngTransparentBlt (#9117)
The brackets were around the wrong part, so the < checked the left edge against the picked direction instead of against the other left edge.

Bug was introduced in https://github.com/reactos/reactos/commit/5424a511074933c1b7874cdfce28fd1e06125b12 (r8988), then improved in https://github.com/reactos/reactos/commit/07a533fe02d9f3affaa33d004159ae846cbf1eb5 (r40380), however the obvious braces issue was not noticed.
2026-06-08 14:20:41 +03:00
Ahmed Arif 984657bdf0 [WIN32SS:ENG] Fix Y coordinate of the software pointer exclude rectangle (#9116)
Crazy that this typo survived two decades, but here we are, that might fix some GDI test.

Bug was introduced in https://github.com/reactos/reactos/commit/50b193239bd9554a4e7cf671a001dc12ec726454 (r12035).
2026-06-08 13:48:12 +03:00
Timo Kreuzer 7f459b49f0 [WIN32K:NTGDI] Fix brush origin for pattern painting
Use pdc->ptlFillOrigin (which is adjusted by the Window origin already) instead of pdc->pdcattr->ptlBrushOrigin.
Fixes several gdiplus_winetest:brush tests
2026-05-22 18:23:42 +00:00
Katayama Hirofumi MZ df7c1fbc6b [NTGDI][FREETYPE] Remove dead parameters (#9022)
Improve simplicity for future.
JIRA issue: CORE-8466
- Remove the 1st parameter (PDC) of
  TextIntUpdateSize function.
- Remove the 1st parameter (PDC) of
  IntRequestFontSize function.
2026-05-17 09:58:56 +09:00
Katayama Hirofumi MZ 713888355b [NTGDI][FREETYPE] 2-line fix: Changing DPRINT1 to DPRINT
to avoid unnecessary log spam. @KRosUser suggests.
JIRA issue: N/A
2026-05-14 21:31:44 +09:00
Timo Kreuzer f85e19ecfb [GDI32] Relax an ASSERT
This prevents an assertion failure in gdi32_winetest
2026-05-08 19:30:33 +00:00
Timo Kreuzer 1cf31524d5 [REACTOS] Stop using non-conforming swprintf / vswprintf
Use the underscored versions instead.
2026-05-07 06:27:58 +00:00
Doug Lyons 049085f106 [GDI32] Fix pptviewer '97 and calls to PolylineTo and PolyBezierTo (#8902)
CORE-20553

Fix PolylineTo and PolyBezierTo based on Wine 10.0.
Include starting point in the "POINTS" variable being passed to PolylineTo and PolyBezierTo.
Handle the starting point as the origin for drawing the lines.
2026-05-04 20:53:32 -05:00
Katayama Hirofumi MZ 5ab1ff188c [NTUSER][ENG] Remove needless comments (#8896)
JIRA issue: N/A
2026-04-24 07:02:23 +09:00
Timo Kreuzer 9d1418fcb6 [NDK][NTDLL][KERNEL32] Improve tick count to ms calculation
Use an inline function to do the calculation (optimized for 32/64 bit).
2026-04-23 11:58:15 +00:00
Katayama Hirofumi MZ 4671b481a3 [NTGDI][FREETYPE] FontLink: Request sub-font sizes (#8806)
A bug fix of FontLink'ed glyph size.
JIRA issue: CORE-20470
- Add FONTLINK_ENTRY structure
  and g_FontLinkEntries variable.
- Delete font-link cache mechanism.
- Don't access the registry while
  rendering is in progress.
- Request sub-font sizes while
  drawing FontLink text.
2026-04-07 14:06:50 +09:00
Katayama Hirofumi MZ 45a4f95b04 [NTGDI][FREETYPE] Revert 'font look-up cache #8641' (#8816)
#8641 introduced some bugs. We revert it.
JIRA issue: CORE-20538
- Delete FONT_LOOKUP_CACHE and
  s_FontLookupCacheList.
- Delete FontLookUp_... functions.
- Revert FontLink_PrepareFontInfo and
  TextIntRealizeFont functions.
2026-04-01 19:23:17 +09:00
Katayama Hirofumi MZ 0566a0f699 [NTGDI][GDI32][FREETYPE] Rewrite GetGlyphIndicesA/W (#8747)
JIRA issue: CORE-20505
- NtGdiGetGlyphIndicesW function simply calls
  NtGdiGetGlyphIndicesWInternal function.
- NtGdiGetGlyphIndicesWInternal allocates buffer
  and calls GreGetGlyphIndicesW function.
- Add GreGetGlyphIndicesW definition in freetype.c.
- Modify GetGlyphIndicesA function.
2026-03-23 12:05:19 +09:00
Katayama Hirofumi MZ e6328fbf1e [NTGDI][FREETYPE][SDK] Rewrite NtGdiGetCharABCWidthsW (#8704)
Refactor and improve readability.
JIRA issue: CORE-20505
- Add GreGetCharABCWidthsW helper function.
- Rewrite NtGdiGetCharABCWidthsW by using
  GreGetCharABCWidthsW.
2026-03-13 18:24:26 +09:00
Katayama Hirofumi MZ 06ae7ec211 [FREETYPE][NTGDI][GDI32][GDI32_APITEST] Rewrite GetCharWidth etc. (#8690)
Refactoring and improve readability.
JIRA issue: CORE-20505
- Add GreGetCharWidthW helper
  function.
- Rewrite NtGdiGetCharWidthW
  using GreGetCharWidthW.
- Refactor NtGdiGetGlyphIndicesW.
- Improve sanity check of
  GetCharWidthA/W/I,
  GetCharWidth32A/W, and
  GetCharWidthFloatA/W.
- Add GetCharWidth testcase to
  gdi32_apitest.
2026-03-01 20:12:45 +09:00
Katayama Hirofumi MZ 0c4091cd04 [FREETYPE][NTGDI] Update FreeType from 2.10.0 to 2.10.4 (#8671)
Modernize modules.
JIRA issue: CORE-17390
- Update FreeType to 2.10.4.
- Delete ChangeLog.
- Delete sdk/lib/3rdparty/freetype/src/gxvalid
  (useless for us).
- Delete sdk/lib/3rdparty/freetype/src/otvalid
  (useless for us).
- Keep ReactOS hacks on FreeType.
- Adapt ntgdi/freetype.c to new FreeType.
2026-02-26 09:32:57 +09:00
Katayama Hirofumi MZ f7ef944dca [NTGDI][FREETYPE] Refactor NtGdiGetGlyphIndicesW (#8682)
Make code faster and improve readability.
JIRA issue: N/A
- Avoid buffer allocation by using
  stack variables if possible.
- Add IntGetFontDefaultChar helper
  function and use it.
2026-02-26 08:56:02 +09:00
Katayama Hirofumi MZ f9c7221a1e [NTGDI][FREETYPE] Follow-up of #8641 (#8658)
Follow-up of #8641. Reduce freetype.c lines.
JIRA issue: CORE-19898
- Follow @HBelusca's review in #8641.
- Move some codes in freetype.c into utils.c.
2026-02-07 08:08:30 +09:00
Katayama Hirofumi MZ 9d5c0bff36 [NTGDI][FREETYPE] Introduce font look-up cache (#8641)
Text rendering speed is justice! Font
search is heavy operation. Adding
cache to it is rational.
JIRA issue: CORE-19898
- Define FONT_LOOKUP_CACHE
  structure.
- Add s_FontLookupCacheList
  global variable to save cache.
- Use cache in FontLink_PrepareFontInfo
  and TextIntRealizeFont.
2026-02-02 09:45:06 +09:00
a30ed15ceb [WIN32SS:NTGDI] Handle AMD GPUs being dumb when they do a double restore (#8644)
According to the kerestorefloatingpointstate msdn article shouldn't be on the kernel's responsibility to handle. for the life of me i couldn't figure out why this specific driver does this until finally I tried this on Windows and low and behold on checked builds of windows it actually tells you it does the exact same thing. Investigating deeper I realized win32k just has some extra handling for this dumb case.

Co-authored-by: Hermès BÉLUSCA - MAÏTO <[email protected]>
Co-authored-by: Timo Kreuzer <[email protected]>
2026-01-29 23:17:33 +00:00
Justin MillerandHermès BÉLUSCA - MAÏTO c990b725b4 [WIN32SS] Remove NATIVE_REACTX check - reenable Oleg's code (#8554)
* [REACTX] Simple Non-AGP ddraw allocator
* [WIN32SS] remove NATIVE_REACTX check - reenable oleg's code
JIRA issue: CORE-19142

Co-authored-by: Hermès BÉLUSCA - MAÏTO <[email protected]>
2026-01-29 06:28:43 +00:00
a08d639b22 [WIN32SS:NTGDI][VIDEOPRT] Multimonitor on RealHW fixes (#8638)
This commit attempts to resolve two regressions and improve realhw behavior
A PNP_DETECTED_FATAL_ERROR bug check caused by the monitor device instance being duplicated.
https://jira.reactos.org/browse/CORE-20410
this is mostly due to ChildID being overwritten with the same bus/slot when 2 monitors are attached to one GPU
And video drivers failing to startup after calling VideoPortCreateSecondaryDisplay

Co-authored-by: Dmitry Borisov <[email protected]>
Co-authored-by: Hermès BÉLUSCA - MAÏTO <[email protected]>
2026-01-29 04:29:55 +00:00
Hermès Bélusca-Maïto fc75870f1c [WIN32SS:NTGDI] Addendum to commit 108db5b356 (PR #8536)
- In the `if (!psurf)` code path, unlock in the reverse locking order.
- Move the `SafeInData == NULL` check outside of `_SEH2_TRY` and just
  after the `ExAllocatePoolWithTag` call.
- Removing trailing whitespace.
2026-01-20 19:52:47 +01:00
Justin MillerandHermès BÉLUSCA - MAÏTO 108db5b356 [NTGDI] Minimal pass of fixing ExtEscape (#8536)
* [WIN32SS] Minimal pass of fixing ExtEscape
Resolves issues with the AMD/ATI GPU Driver and the Intel OpenGL ICD when used in fullscreen mode.

Co-authored-by: Hermès BÉLUSCA - MAÏTO <[email protected]>
2026-01-20 17:56:03 +00:00
Timo Kreuzer 49f633517f [WIN32K:NTGDI] Fix last error for NtGdiMaskBlt 2026-01-20 12:35:55 +02:00
Timo Kreuzer 4799c8a21c [WIN32K][GDI32] Handle crBackColor in NtGdiMaskBlt and NtGdiStretchBlt
Pass it to EXLATEOBJ_vInitXlateFromDCsEx, which uses it (or, if it's CLR_INVALID, the source DC's background color) to initialize the EXLATEOBJ.
Adjust all callers to pass CLR_INVALID instead of 0.
2026-01-20 12:35:55 +02:00
Timo Kreuzer bb7a218367 [WIN32K:ENG] Implement EXLATEOBJ_vInitXlateFromDCsEx
This version allows to pass a background color.
2026-01-20 12:35:55 +02:00
Timo Kreuzer 3e7009a08e [WIN32K:NTGDI] Mark DIB palettes with PAL_DIBSECTION flag
This is needed, because color translation works differently for DIB sections.
2026-01-20 12:35:55 +02:00
Timo Kreuzer 11c276109c [WIN32K:NTGDI] Mark 2-color indexed palettes as monochrome
This is mostly an optimization, as translation from RGB to mono are much faster than generic indexed palettes.
It exposes a broken RGB-to-mono translation though, which previously was hidden for DIB sections, which didn't mark the palette as mono, therefore taking the slow index path, which worked correctly.
2026-01-20 12:35:55 +02:00
Timo Kreuzer ce8329f862 [WIN32K:ENG] Rewrite monochrome color translation
- Handle DIB sections
- Use DC's background / foreground colors as appropriate
- Optimize translation functions
2026-01-20 12:35:55 +02:00
Timo Kreuzer ece903d96f [WIN32K:NTGDI] Fix pen color on 1BPP surfaces
The actual color is not nearest-matched (like for SetPixel), but the RGB color is matched against background color of the DC.
2026-01-20 12:35:55 +02:00
Timo Kreuzer f09fcc2a96 [WIN32K:NTGDI] Handle RGB/BGR directly in PALETTE_ulGetNearestIndex 2026-01-20 12:35:55 +02:00
Timo Kreuzer 3e61bc2bed [WIN32K:DIB] Fix DIB_1BPP_BitBltSrcCopy_From1BPP
Handle cases where the XLATEOBJ always translates to 0 or 1 independent of the source pixel.
2026-01-20 12:35:55 +02:00
Timo Kreuzer c6c3ac7473 [WIN32K:NTGDI] Improve TranslateCOLORREF
Fixes a number of tests for NtGdiSetPixel.
2026-01-20 12:35:55 +02:00
Timo Kreuzer cbbca1e98f [WIN32K:NTGDI] Improve NtGdiSetPixel 2026-01-20 12:35:55 +02:00
Oleg Dubinskiy c9da37f7a4 [ENG] Fix behaviour of EngGradientFill() for rectangles
Don't offset the rectangle's top left point to the current dithering point, since it's already done now in Gre part of the function.
This fixes broken gradient captions after the previous commit, in case when Drv implementation is not provided by a display/video driver and Eng function is used instead.
CORE-14927, CORE-15341
2026-01-19 11:39:28 +01:00
Oleg Dubinskiy 3a763d2126 [NTGDI] Fix gradient offset handling
- Offset vertex array to the current DC's coordinates for rectangular gradients. Don't change anything for triangular gradients. This is more correct regarding to how Windows XP/2003 handles that and debugging analysis shows the same behaviour there.
- Additionally, fix checking mode condition for triangles on parameters validation. It should actually be checked for an equalness, not via bitwise "OR", since only one mode type can be set for ulMode parameter for GradientFill() according to MSDN.

This avoids incorrect gradient coordinates passed to DrvGradientFill() in case it's supported by the display/video driver, so now gradients are drawing at the correct position as they should.
Hence, this fixes broken gradients in window captions (always painted at the top left corner) on real hardware with native video drivers (AMD/ATI/Intel/Nvidia etc.). Tested successfully on Asus-F5R notebook with ATI Radeon XPress 1100 + ATI Catalyst 10.2 video driver at least.
CORE-14927, CORE-15341
2026-01-19 11:39:28 +01:00
Timo Kreuzer eba2bbd177 [CRT] Remove ftol2_sse 2025-12-12 12:21:53 +02:00
Doug Lyons ad6cb32fa5 [NTGDI] Fix 3D-text screensaver not moving in preview mode (#8402)
Thanks, @I_Kill_Bugs for the fix.
CORE-5601
2025-10-10 15:59:13 -05:00
Doug Lyons 34fce8a997 [NTGDI][GDI32] SAI Paint Tool regression fix (#8383)
CORE-20336
Move some code in win32ss/gdi/ntgdi/dibobj.c into win32ss/gdi/gdi32/objects/bitmap.c.
Condition "YSrc = 0;" on "if (Height + YDest + 1 < ScanLines)" which fixes some gdi32:bitmap regressions.
2025-09-27 02:01:57 -05:00
Timo Kreuzer fff6d96000 [WIN32K:NTGDI] Check for failure of PATH_CreatePath
Also use common cleanup path.
2025-09-10 16:39:22 +03:00
Timo Kreuzer 8a2a587e57 [WIN32K:NTGDI] Save and restore FP state in IntGdiWidenPath 2025-09-10 16:39:22 +03:00