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
48f083b3
Commit
48f083b3
authored
Apr 12, 2011
by
Huw Davies
Committed by
Alexandre Julliard
Apr 12, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gdi32: Don't set the bitfields when the dib section is BI_RGB.
parent
bb28917b
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
69 additions
and
18 deletions
+69
-18
dib.c
dlls/gdi32/dib.c
+18
-17
dib.c
dlls/gdi32/tests/dib.c
+51
-1
No files found.
dlls/gdi32/dib.c
View file @
48f083b3
...
...
@@ -1216,8 +1216,9 @@ HBITMAP WINAPI CreateDIBSection(HDC hdc, CONST BITMAPINFO *bmi, UINT usage,
if
(
!
(
dib
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
*
dib
)
)))
return
0
;
TRACE
(
"format (%d,%d), planes %d, bpp %d, size %d, %s
\n
"
,
width
,
height
,
planes
,
bpp
,
sizeImage
,
usage
==
DIB_PAL_COLORS
?
"PAL"
:
"RGB"
);
TRACE
(
"format (%d,%d), planes %d, bpp %d, %s, size %d %s
\n
"
,
width
,
height
,
planes
,
bpp
,
compression
==
BI_BITFIELDS
?
"BI_BITFIELDS"
:
"BI_RGB"
,
sizeImage
,
usage
==
DIB_PAL_COLORS
?
"PAL"
:
"RGB"
);
dib
->
dsBm
.
bmType
=
0
;
dib
->
dsBm
.
bmWidth
=
width
;
...
...
@@ -1255,24 +1256,24 @@ HBITMAP WINAPI CreateDIBSection(HDC hdc, CONST BITMAPINFO *bmi, UINT usage,
dib
->
dsBmih
.
biSizeImage
=
dib
->
dsBm
.
bmWidthBytes
*
dib
->
dsBm
.
bmHeight
;
/* set dsBitfields values */
if
(
usage
==
DIB_PAL_COLORS
||
bpp
<=
8
)
{
dib
->
dsBitfields
[
0
]
=
dib
->
dsBitfields
[
1
]
=
dib
->
dsBitfields
[
2
]
=
0
;
if
((
bpp
==
15
||
bpp
==
16
)
&&
compression
==
BI_RGB
)
{
/* In this case Windows changes biCompression to BI_BITFIELDS,
however for now we won't do this, as there are a lot
of places where BI_BITFIELDS is currently unsupported. */
/* dib->dsBmih.biCompression = compression = BI_BITFIELDS;*/
dib
->
dsBitfields
[
0
]
=
0x7c00
;
dib
->
dsBitfields
[
1
]
=
0x03e0
;
dib
->
dsBitfields
[
2
]
=
0x001f
;
}
else
switch
(
bpp
)
else
if
(
compression
==
BI_BITFIELDS
)
{
case
15
:
case
16
:
dib
->
dsBitfields
[
0
]
=
(
compression
==
BI_BITFIELDS
)
?
*
(
const
DWORD
*
)
bmi
->
bmiColors
:
0x7c00
;
dib
->
dsBitfields
[
1
]
=
(
compression
==
BI_BITFIELDS
)
?
*
((
const
DWORD
*
)
bmi
->
bmiColors
+
1
)
:
0x03e0
;
dib
->
dsBitfields
[
2
]
=
(
compression
==
BI_BITFIELDS
)
?
*
((
const
DWORD
*
)
bmi
->
bmiColors
+
2
)
:
0x001f
;
break
;
case
24
:
case
32
:
dib
->
dsBitfields
[
0
]
=
(
compression
==
BI_BITFIELDS
)
?
*
(
const
DWORD
*
)
bmi
->
bmiColors
:
0xff0000
;
dib
->
dsBitfields
[
1
]
=
(
compression
==
BI_BITFIELDS
)
?
*
((
const
DWORD
*
)
bmi
->
bmiColors
+
1
)
:
0x00ff00
;
dib
->
dsBitfields
[
2
]
=
(
compression
==
BI_BITFIELDS
)
?
*
((
const
DWORD
*
)
bmi
->
bmiColors
+
2
)
:
0x0000ff
;
break
;
dib
->
dsBitfields
[
0
]
=
*
(
const
DWORD
*
)
bmi
->
bmiColors
;
dib
->
dsBitfields
[
1
]
=
*
((
const
DWORD
*
)
bmi
->
bmiColors
+
1
);
dib
->
dsBitfields
[
2
]
=
*
((
const
DWORD
*
)
bmi
->
bmiColors
+
2
);
}
/* get storage location for DIB bits */
...
...
dlls/gdi32/tests/dib.c
View file @
48f083b3
...
...
@@ -204,10 +204,14 @@ static void test_simple_graphics(void)
{
char
bmibuf
[
sizeof
(
BITMAPINFO
)
+
256
*
sizeof
(
RGBQUAD
)];
BITMAPINFO
*
bmi
=
(
BITMAPINFO
*
)
bmibuf
;
DWORD
*
bit_fields
=
(
DWORD
*
)(
bmibuf
+
sizeof
(
BITMAPINFOHEADER
));
HDC
mem_dc
;
BYTE
*
bits
;
HBITMAP
dib
,
orig_bm
;
const
char
**
sha1
;
DIBSECTION
ds
;
mem_dc
=
CreateCompatibleDC
(
NULL
);
/* a8r8g8b8 */
trace
(
"8888
\n
"
);
...
...
@@ -221,7 +225,12 @@ static void test_simple_graphics(void)
dib
=
CreateDIBSection
(
0
,
bmi
,
DIB_RGB_COLORS
,
(
void
**
)
&
bits
,
NULL
,
0
);
ok
(
dib
!=
NULL
,
"ret NULL
\n
"
);
mem_dc
=
CreateCompatibleDC
(
NULL
);
ok
(
GetObjectW
(
dib
,
sizeof
(
ds
),
&
ds
),
"GetObject failed
\n
"
);
ok
(
ds
.
dsBitfields
[
0
]
==
0
,
"got %08x
\n
"
,
ds
.
dsBitfields
[
0
]);
ok
(
ds
.
dsBitfields
[
1
]
==
0
,
"got %08x
\n
"
,
ds
.
dsBitfields
[
1
]);
ok
(
ds
.
dsBitfields
[
2
]
==
0
,
"got %08x
\n
"
,
ds
.
dsBitfields
[
2
]);
ok
(
ds
.
dsBmih
.
biCompression
==
BI_RGB
,
"got %x
\n
"
,
ds
.
dsBmih
.
biCompression
);
orig_bm
=
SelectObject
(
mem_dc
,
dib
);
sha1
=
sha1_graphics_a8r8g8b8
;
...
...
@@ -229,6 +238,47 @@ static void test_simple_graphics(void)
SelectObject
(
mem_dc
,
orig_bm
);
DeleteObject
(
dib
);
/* a8r8g8b8 - bitfields. Should be the same as the regular 32 bit case.*/
trace
(
"8888 - bitfields
\n
"
);
bmi
->
bmiHeader
.
biBitCount
=
32
;
bmi
->
bmiHeader
.
biCompression
=
BI_BITFIELDS
;
bit_fields
[
0
]
=
0xff0000
;
bit_fields
[
1
]
=
0x00ff00
;
bit_fields
[
2
]
=
0x0000ff
;
dib
=
CreateDIBSection
(
mem_dc
,
bmi
,
DIB_RGB_COLORS
,
(
void
**
)
&
bits
,
NULL
,
0
);
ok
(
dib
!=
NULL
,
"ret NULL
\n
"
);
ok
(
GetObjectW
(
dib
,
sizeof
(
ds
),
&
ds
),
"GetObject failed
\n
"
);
ok
(
ds
.
dsBitfields
[
0
]
==
0xff0000
,
"got %08x
\n
"
,
ds
.
dsBitfields
[
0
]);
ok
(
ds
.
dsBitfields
[
1
]
==
0x00ff00
,
"got %08x
\n
"
,
ds
.
dsBitfields
[
1
]);
ok
(
ds
.
dsBitfields
[
2
]
==
0x0000ff
,
"got %08x
\n
"
,
ds
.
dsBitfields
[
2
]);
ok
(
ds
.
dsBmih
.
biCompression
==
BI_BITFIELDS
,
"got %x
\n
"
,
ds
.
dsBmih
.
biCompression
);
orig_bm
=
SelectObject
(
mem_dc
,
dib
);
sha1
=
sha1_graphics_a8r8g8b8
;
draw_graphics
(
mem_dc
,
bmi
,
bits
,
&
sha1
);
SelectObject
(
mem_dc
,
orig_bm
);
DeleteObject
(
dib
);
/* r5g5b5 */
bmi
->
bmiHeader
.
biBitCount
=
16
;
bmi
->
bmiHeader
.
biCompression
=
BI_RGB
;
dib
=
CreateDIBSection
(
0
,
bmi
,
DIB_RGB_COLORS
,
(
void
**
)
&
bits
,
NULL
,
0
);
ok
(
dib
!=
NULL
,
"ret NULL
\n
"
);
ok
(
GetObjectW
(
dib
,
sizeof
(
ds
),
&
ds
),
"GetObject failed
\n
"
);
ok
(
ds
.
dsBitfields
[
0
]
==
0x7c00
,
"got %08x
\n
"
,
ds
.
dsBitfields
[
0
]);
ok
(
ds
.
dsBitfields
[
1
]
==
0x03e0
,
"got %08x
\n
"
,
ds
.
dsBitfields
[
1
]);
ok
(
ds
.
dsBitfields
[
2
]
==
0x001f
,
"got %08x
\n
"
,
ds
.
dsBitfields
[
2
]);
todo_wine
ok
(
ds
.
dsBmih
.
biCompression
==
BI_BITFIELDS
,
"got %x
\n
"
,
ds
.
dsBmih
.
biCompression
);
DeleteObject
(
dib
);
DeleteDC
(
mem_dc
);
}
...
...
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