Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
wine
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Package registry
Container registry
Model registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Lorenzo Ferrillo
wine
Commits
48f083b3
Commit
48f083b3
authored
14 years ago
by
Huw Davies
Committed by
Alexandre Julliard
14 years ago
Browse files
Options
Downloads
Patches
Plain Diff
gdi32: Don't set the bitfields when the dib section is BI_RGB.
parent
bb28917b
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
dlls/gdi32/dib.c
+18
-17
18 additions, 17 deletions
dlls/gdi32/dib.c
dlls/gdi32/tests/dib.c
+51
-1
51 additions, 1 deletion
dlls/gdi32/tests/dib.c
with
69 additions
and
18 deletions
dlls/gdi32/dib.c
+
18
−
17
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
)
{
dib
->
dsBitfields
[
0
]
=
dib
->
dsBitfields
[
1
]
=
dib
->
dsBitfields
[
2
]
=
0
;
/* 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 */
...
...
This diff is collapsed.
Click to expand it.
dlls/gdi32/tests/dib.c
+
51
−
1
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
);
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment