Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
3f051d3b
Commit
3f051d3b
authored
Mar 30, 2023
by
Piotr Caban
Committed by
Alexandre Julliard
Apr 06, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
win32u: Add support for undocummented DIB_PAL_INDICES color usage in SetDIBits.
parent
b5bc0267
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
3 deletions
+28
-3
bitmap.c
dlls/gdi32/tests/bitmap.c
+7
-1
dib.c
dlls/win32u/dib.c
+18
-2
ntgdi_private.h
dlls/win32u/ntgdi_private.h
+3
-0
No files found.
dlls/gdi32/tests/bitmap.c
View file @
3f051d3b
...
...
@@ -915,7 +915,7 @@ static void test_dib_formats(void)
char
data
[
2048
];
/* 2 x 2 pixels, max 64 bits-per-pixel, max 64 planes */
void
*
bits
;
int
planes
,
bpp
,
compr
,
format
;
HBITMAP
hdib
,
hbmp
;
HBITMAP
hdib
,
hbmp
,
hbmp_mono
;
HDC
hdc
,
memdc
;
UINT
ret
;
BOOL
format_ok
,
expect_ok
;
...
...
@@ -924,6 +924,7 @@ static void test_dib_formats(void)
hdc
=
GetDC
(
0
);
memdc
=
CreateCompatibleDC
(
0
);
hbmp
=
CreateCompatibleBitmap
(
hdc
,
10
,
10
);
hbmp_mono
=
CreateBitmap
(
10
,
10
,
1
,
1
,
NULL
);
memset
(
data
,
0xaa
,
sizeof
(
data
)
);
...
...
@@ -1203,6 +1204,8 @@ static void test_dib_formats(void)
DeleteObject
(
hdib
);
ret
=
SetDIBits
(
hdc
,
hbmp
,
0
,
1
,
data
,
bi
,
DIB_PAL_COLORS
+
1
);
ok
(
!
ret
,
"SetDIBits succeeded with DIB_PAL_COLORS+1
\n
"
);
ret
=
SetDIBits
(
hdc
,
hbmp_mono
,
0
,
1
,
data
,
bi
,
DIB_PAL_COLORS
+
1
);
ok
(
ret
,
"SetDIBits failed with DIB_PAL_COLORS+1
\n
"
);
ret
=
SetDIBitsToDevice
(
memdc
,
0
,
0
,
1
,
1
,
0
,
0
,
0
,
1
,
data
,
bi
,
DIB_PAL_COLORS
+
1
);
ok
(
ret
,
"SetDIBitsToDevice failed with DIB_PAL_COLORS+1
\n
"
);
ret
=
StretchDIBits
(
memdc
,
0
,
0
,
1
,
1
,
0
,
0
,
1
,
1
,
data
,
bi
,
DIB_PAL_COLORS
+
1
,
SRCCOPY
);
...
...
@@ -1227,6 +1230,8 @@ static void test_dib_formats(void)
DeleteObject
(
hdib
);
ret
=
SetDIBits
(
hdc
,
hbmp
,
0
,
1
,
data
,
bi
,
DIB_PAL_COLORS
+
2
);
ok
(
!
ret
,
"SetDIBits succeeded with DIB_PAL_COLORS+2
\n
"
);
ret
=
SetDIBits
(
hdc
,
hbmp_mono
,
0
,
1
,
data
,
bi
,
DIB_PAL_COLORS
+
2
);
ok
(
!
ret
,
"SetDIBits succeeded with DIB_PAL_COLORS+2
\n
"
);
ret
=
SetDIBitsToDevice
(
memdc
,
0
,
0
,
1
,
1
,
0
,
0
,
0
,
1
,
data
,
bi
,
DIB_PAL_COLORS
+
2
);
ok
(
!
ret
,
"SetDIBitsToDevice succeeded with DIB_PAL_COLORS+2
\n
"
);
ret
=
StretchDIBits
(
memdc
,
0
,
0
,
1
,
1
,
0
,
0
,
1
,
1
,
data
,
bi
,
DIB_PAL_COLORS
+
2
,
SRCCOPY
);
...
...
@@ -1285,6 +1290,7 @@ static void test_dib_formats(void)
DeleteDC
(
memdc
);
DeleteObject
(
hbmp
);
DeleteObject
(
hbmp_mono
);
ReleaseDC
(
0
,
hdc
);
HeapFree
(
GetProcessHeap
(),
0
,
bi
);
}
...
...
dlls/win32u/dib.c
View file @
3f051d3b
...
...
@@ -205,9 +205,11 @@ static BOOL bitmapinfo_from_user_bitmapinfo( BITMAPINFO *dst, const BITMAPINFO *
{
void
*
src_colors
;
if
(
coloruse
>
DIB_PAL_
COLORS
+
1
)
return
FALSE
;
/* FIXME: handle DIB_PAL_COLORS+1 format */
if
(
coloruse
>
DIB_PAL_
INDICES
)
return
FALSE
;
if
(
!
bitmapinfoheader_from_user_bitmapinfo
(
&
dst
->
bmiHeader
,
&
info
->
bmiHeader
))
return
FALSE
;
if
(
!
is_valid_dib_format
(
&
dst
->
bmiHeader
,
allow_compression
))
return
FALSE
;
if
(
coloruse
==
DIB_PAL_INDICES
&&
(
dst
->
bmiHeader
.
biBitCount
!=
1
||
dst
->
bmiHeader
.
biCompression
!=
BI_RGB
))
return
FALSE
;
src_colors
=
(
char
*
)
info
+
info
->
bmiHeader
.
biSize
;
...
...
@@ -230,6 +232,18 @@ static BOOL bitmapinfo_from_user_bitmapinfo( BITMAPINFO *dst, const BITMAPINFO *
memcpy
(
dst
->
bmiColors
,
src_colors
,
colors
*
sizeof
(
WORD
)
);
max_colors
=
colors
;
}
else
if
(
coloruse
==
DIB_PAL_INDICES
)
{
dst
->
bmiColors
[
0
].
rgbRed
=
0
;
dst
->
bmiColors
[
0
].
rgbGreen
=
0
;
dst
->
bmiColors
[
0
].
rgbBlue
=
0
;
dst
->
bmiColors
[
0
].
rgbReserved
=
0
;
dst
->
bmiColors
[
1
].
rgbRed
=
0xff
;
dst
->
bmiColors
[
1
].
rgbGreen
=
0xff
;
dst
->
bmiColors
[
1
].
rgbBlue
=
0xff
;
dst
->
bmiColors
[
1
].
rgbReserved
=
0
;
colors
=
max_colors
;
}
else
if
(
info
->
bmiHeader
.
biSize
!=
sizeof
(
BITMAPCOREHEADER
))
{
memcpy
(
dst
->
bmiColors
,
src_colors
,
colors
*
sizeof
(
RGBQUAD
)
);
...
...
@@ -675,7 +689,7 @@ INT WINAPI SetDIBits( HDC hdc, HBITMAP hbitmap, UINT startscan,
INT
src_to_dst_offset
;
HRGN
clip
=
0
;
if
(
!
bitmapinfo_from_user_bitmapinfo
(
src_info
,
info
,
coloruse
,
TRUE
)
||
coloruse
>
DIB_PAL_COLORS
)
if
(
!
bitmapinfo_from_user_bitmapinfo
(
src_info
,
info
,
coloruse
,
TRUE
))
{
RtlSetLastWin32Error
(
ERROR_INVALID_PARAMETER
);
return
0
;
...
...
@@ -699,6 +713,8 @@ INT WINAPI SetDIBits( HDC hdc, HBITMAP hbitmap, UINT startscan,
if
(
!
(
bitmap
=
GDI_GetObjPtr
(
hbitmap
,
NTGDI_OBJ_BITMAP
)))
return
0
;
if
(
coloruse
==
DIB_PAL_INDICES
&&
bitmap
->
dib
.
dsBm
.
bmBitsPixel
!=
1
)
return
0
;
if
(
src_info
->
bmiHeader
.
biCompression
==
BI_RLE4
||
src_info
->
bmiHeader
.
biCompression
==
BI_RLE8
)
{
if
(
lines
==
0
)
goto
done
;
...
...
dlls/win32u/ntgdi_private.h
View file @
3f051d3b
...
...
@@ -28,6 +28,9 @@
/* extra stock object: default 1x1 bitmap for memory DCs */
#define DEFAULT_BITMAP (STOCK_LAST+1)
/* Undocumented value for DIB's color use: indicates a mono DIB w/o pal entries */
#define DIB_PAL_INDICES 2
struct
gdi_obj_funcs
{
INT
(
*
pGetObjectW
)(
HGDIOBJ
handle
,
INT
count
,
LPVOID
buffer
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment