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
3c239fa0
Commit
3c239fa0
authored
Feb 20, 2011
by
John Edmonds
Committed by
Alexandre Julliard
Feb 23, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gdi32: Fixed GetDIBits for top-down bitmaps.
parent
d2e1478d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
14 deletions
+19
-14
dib.c
dlls/gdi32/dib.c
+14
-9
bitmap.c
dlls/gdi32/tests/bitmap.c
+5
-5
No files found.
dlls/gdi32/dib.c
View file @
3c239fa0
...
...
@@ -871,18 +871,23 @@ INT WINAPI GetDIBits(
if
(
bmp
->
dib
&&
bmp
->
dib
->
dsBm
.
bmBitsPixel
>=
15
&&
bpp
>=
15
)
{
/*FIXME: Only RGB dibs supported for now */
unsigned
int
srcwidth
=
bmp
->
dib
->
dsBm
.
bmWidth
,
srcwidthb
=
bmp
->
dib
->
dsBm
.
bmWidthBytes
;
unsigned
int
srcwidth
=
bmp
->
dib
->
dsBm
.
bmWidth
;
int
srcwidthb
=
bmp
->
dib
->
dsBm
.
bmWidthBytes
;
unsigned
int
dstwidth
=
width
;
int
dstwidthb
=
DIB_GetDIBWidthBytes
(
width
,
bpp
);
unsigned
int
dstwidthb
=
DIB_GetDIBWidthBytes
(
width
,
bpp
);
LPBYTE
dbits
=
bits
,
sbits
=
(
LPBYTE
)
bmp
->
dib
->
dsBm
.
bmBits
+
(
startscan
*
srcwidthb
);
unsigned
int
x
,
y
,
width
,
widthb
;
if
((
height
<
0
)
^
(
bmp
->
dib
->
dsBmih
.
biHeight
<
0
))
/*
* If copying from a top-down source bitmap, move the source
* pointer to the end of the source bitmap and negate the width
* so that we copy the bits upside-down.
*/
if
(
bmp
->
dib
->
dsBmih
.
biHeight
<
0
)
{
dbits
=
(
LPBYTE
)
bits
+
(
dstwidthb
*
(
lines
-
1
));
dstwidthb
=
-
dst
widthb
;
sbits
+=
(
srcwidthb
*
(
abs
(
bmp
->
dib
->
dsBmih
.
biHeight
)
-
2
*
startscan
-
1
));
srcwidthb
=
-
src
widthb
;
}
switch
(
bpp
)
{
case
15
:
...
...
@@ -897,7 +902,7 @@ INT WINAPI GetDIBits(
case
16
:
/* 16 bpp srcDIB -> 16 bpp dstDIB */
{
widthb
=
min
(
srcwidthb
,
abs
(
dstwidthb
)
);
widthb
=
min
(
abs
(
srcwidthb
),
dstwidthb
);
/* FIXME: BI_BITFIELDS not supported yet */
for
(
y
=
0
;
y
<
lines
;
y
++
,
dbits
+=
dstwidthb
,
sbits
+=
srcwidthb
)
memcpy
(
dbits
,
sbits
,
widthb
);
...
...
@@ -975,7 +980,7 @@ INT WINAPI GetDIBits(
case
24
:
/* 24 bpp srcDIB -> 24 bpp dstDIB */
{
widthb
=
min
(
srcwidthb
,
abs
(
dstwidthb
)
);
widthb
=
min
(
abs
(
srcwidthb
),
dstwidthb
);
for
(
y
=
0
;
y
<
lines
;
y
++
,
dbits
+=
dstwidthb
,
sbits
+=
srcwidthb
)
memcpy
(
dbits
,
sbits
,
widthb
);
}
...
...
@@ -1051,7 +1056,7 @@ INT WINAPI GetDIBits(
case
32
:
/* 32 bpp srcDIB -> 32 bpp dstDIB */
{
widthb
=
min
(
srcwidthb
,
abs
(
dstwidthb
)
);
widthb
=
min
(
abs
(
srcwidthb
),
dstwidthb
);
/* FIXME: BI_BITFIELDS not supported yet */
for
(
y
=
0
;
y
<
lines
;
y
++
,
dbits
+=
dstwidthb
,
sbits
+=
srcwidthb
)
{
memcpy
(
dbits
,
sbits
,
widthb
);
...
...
dlls/gdi32/tests/bitmap.c
View file @
3c239fa0
...
...
@@ -3116,27 +3116,27 @@ static void test_GetDIBits_single_pixel_destination(int bpp)
ok
((
char
)
pixelOut
==
0
,
"Bottom-up -> bottom-up: first pixel should be 0 but was %d.
\n
"
,
(
char
)
pixelOut
);
statusCode
=
GetDIBits
(
hdc
,
bmptb
,
0
,
1
,
&
pixelOut
,
&
bi
,
DIB_RGB_COLORS
);
ok
(
statusCode
,
"Failed to call GetDIBits. Status code: %d.
\n
"
,
statusCode
);
todo_wine
ok
((
char
)
pixelOut
==
2
,
"Top-down -> bottom-up: first pixel should be 2 but was %d.
\n
"
,
(
char
)
pixelOut
);
ok
((
char
)
pixelOut
==
2
,
"Top-down -> bottom-up: first pixel should be 2 but was %d.
\n
"
,
(
char
)
pixelOut
);
/*Check second scanline.*/
statusCode
=
GetDIBits
(
hdc
,
bmptb
,
1
,
1
,
&
pixelOut
,
&
bi
,
DIB_RGB_COLORS
);
ok
(
statusCode
,
"Failed to call GetDIBits. Status code: %d.
\n
"
,
statusCode
);
todo_wine
ok
((
char
)
pixelOut
==
0
,
"Top-down -> bottom-up: first pixel should be 0 but was %d.
\n
"
,
(
char
)
pixelOut
);
ok
((
char
)
pixelOut
==
0
,
"Top-down -> bottom-up: first pixel should be 0 but was %d.
\n
"
,
(
char
)
pixelOut
);
statusCode
=
GetDIBits
(
hdc
,
bmpbt
,
1
,
1
,
&
pixelOut
,
&
bi
,
DIB_RGB_COLORS
);
ok
(
statusCode
,
"Failed to call GetDIBits. Status code: %d.
\n
"
,
statusCode
);
ok
((
char
)
pixelOut
==
2
,
"Top-down -> bottom-up: first pixel should be 2 but was %d.
\n
"
,
(
char
)
pixelOut
);
/*Make destination bitmap top-down.
Windows (and soon, Wine) will ignore thi
s.*/
/*Make destination bitmap top-down.
This should be ignored by GetDIBit
s.*/
bi
.
bmiHeader
.
biHeight
=
-
2
;
statusCode
=
GetDIBits
(
hdc
,
bmpbt
,
0
,
1
,
&
pixelOut
,
&
bi
,
DIB_RGB_COLORS
);
ok
(
statusCode
,
"Failed to call GetDIBits. Status code: %d.
\n
"
,
statusCode
);
ok
((
char
)
pixelOut
==
0
,
"Bottom-up -> top-down: first pixel should be 0 but was %d.
\n
"
,
(
char
)
pixelOut
);
statusCode
=
GetDIBits
(
hdc
,
bmptb
,
0
,
1
,
&
pixelOut
,
&
bi
,
DIB_RGB_COLORS
);
ok
(
statusCode
,
"Failed to call GetDIBits. Status code: %d.
\n
"
,
statusCode
);
todo_wine
ok
((
char
)
pixelOut
==
2
,
"Top-down -> top-down: first pixel should be 2 but was %d.
\n
"
,
(
char
)
pixelOut
);
ok
((
char
)
pixelOut
==
2
,
"Top-down -> top-down: first pixel should be 2 but was %d.
\n
"
,
(
char
)
pixelOut
);
/*Check second scanline.*/
statusCode
=
GetDIBits
(
hdc
,
bmptb
,
1
,
1
,
&
pixelOut
,
&
bi
,
DIB_RGB_COLORS
);
ok
(
statusCode
,
"Failed to call GetDIBits. Status code: %d.
\n
"
,
statusCode
);
todo_wine
ok
((
char
)
pixelOut
==
0
,
"Top-down -> bottom-up: first pixel should be 0 but was %d.
\n
"
,
(
char
)
pixelOut
);
ok
((
char
)
pixelOut
==
0
,
"Top-down -> bottom-up: first pixel should be 0 but was %d.
\n
"
,
(
char
)
pixelOut
);
statusCode
=
GetDIBits
(
hdc
,
bmpbt
,
1
,
1
,
&
pixelOut
,
&
bi
,
DIB_RGB_COLORS
);
ok
(
statusCode
,
"Failed to call GetDIBits. Status code: %d.
\n
"
,
statusCode
);
ok
((
char
)
pixelOut
==
2
,
"Top-down -> bottom-up: first pixel should be 2 but was %d.
\n
"
,
(
char
)
pixelOut
);
...
...
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