Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
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-winehq
Commits
5c323a54
Commit
5c323a54
authored
Apr 07, 2015
by
Bruno Jesus
Committed by
Alexandre Julliard
Apr 08, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gdi32: Support negative count values in GetBitmapBits.
parent
3a14df3b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
9 deletions
+21
-9
bitmap.c
dlls/gdi32/bitmap.c
+1
-1
bitmap.c
dlls/gdi32/tests/bitmap.c
+20
-8
No files found.
dlls/gdi32/bitmap.c
View file @
5c323a54
...
...
@@ -253,7 +253,7 @@ LONG WINAPI GetBitmapBits(
dst_stride
=
get_bitmap_stride
(
bmp
->
dib
.
dsBm
.
bmWidth
,
bmp
->
dib
.
dsBm
.
bmBitsPixel
);
ret
=
max
=
dst_stride
*
bmp
->
dib
.
dsBm
.
bmHeight
;
if
(
!
bits
)
goto
done
;
if
(
count
>
max
)
count
=
max
;
if
(
count
<
0
||
count
>
max
)
count
=
max
;
ret
=
count
;
src
.
visrect
.
left
=
0
;
...
...
dlls/gdi32/tests/bitmap.c
View file @
5c323a54
...
...
@@ -56,8 +56,9 @@ static void test_bitmap_info(HBITMAP hbm, INT expected_depth, const BITMAPINFOHE
{
BITMAP
bm
;
BITMAP
bma
[
2
];
INT
ret
,
width_bytes
;
INT
ret
,
width_bytes
,
i
;
BYTE
buf
[
512
],
buf_cmp
[
512
];
INT
test_size
[]
=
{
0
/*first value will be changed */
,
0
,
-
1
,
-
1000
,
~
0
,
sizeof
(
buf
)};
ret
=
GetObjectW
(
hbm
,
sizeof
(
bm
),
&
bm
);
ok
(
ret
==
sizeof
(
bm
),
"GetObject returned %d
\n
"
,
ret
);
...
...
@@ -75,17 +76,28 @@ static void test_bitmap_info(HBITMAP hbm, INT expected_depth, const BITMAPINFOHE
assert
(
sizeof
(
buf
)
==
sizeof
(
buf_cmp
));
SetLastError
(
0xdeadbeef
);
ret
=
GetBitmapBits
(
hbm
,
0
,
NULL
);
ok
(
ret
==
bm
.
bmWidthBytes
*
bm
.
bmHeight
,
"%d != %d
\n
"
,
ret
,
bm
.
bmWidthBytes
*
bm
.
bmHeight
);
test_size
[
0
]
=
bm
.
bmWidthBytes
*
bm
.
bmHeight
;
/* NULL output buffer with different count values */
for
(
i
=
0
;
i
<
sizeof
(
test_size
)
/
sizeof
(
test_size
[
0
]);
i
++
)
{
ret
=
GetBitmapBits
(
hbm
,
test_size
[
i
],
NULL
);
ok
(
ret
==
bm
.
bmWidthBytes
*
bm
.
bmHeight
,
"%d != %d
\n
"
,
ret
,
bm
.
bmWidthBytes
*
bm
.
bmHeight
);
}
memset
(
buf_cmp
,
0xAA
,
sizeof
(
buf_cmp
));
memset
(
buf_cmp
,
0
,
bm
.
bmWidthBytes
*
bm
.
bmHeight
);
memset
(
buf
,
0xAA
,
sizeof
(
buf
));
ret
=
GetBitmapBits
(
hbm
,
sizeof
(
buf
),
buf
);
ok
(
ret
==
bm
.
bmWidthBytes
*
bm
.
bmHeight
,
"%d != %d
\n
"
,
ret
,
bm
.
bmWidthBytes
*
bm
.
bmHeight
);
ok
(
!
memcmp
(
buf
,
buf_cmp
,
sizeof
(
buf
)),
"buffers do not match, depth %d
\n
"
,
bmih
->
biBitCount
);
/* Correct output buffer with different count values */
for
(
i
=
0
;
i
<
sizeof
(
test_size
)
/
sizeof
(
test_size
[
0
]);
i
++
)
{
int
expect
=
i
==
1
?
0
:
bm
.
bmWidthBytes
*
bm
.
bmHeight
;
memset
(
buf
,
0xAA
,
sizeof
(
buf
));
ret
=
GetBitmapBits
(
hbm
,
test_size
[
i
],
buf
);
ok
(
ret
==
expect
,
"Test[%d]: %d != %d
\n
"
,
i
,
ret
,
expect
);
if
(
expect
)
ok
(
!
memcmp
(
buf
,
buf_cmp
,
sizeof
(
buf
)),
"Test[%d]: buffers do not match, depth %d
\n
"
,
i
,
bmih
->
biBitCount
);
}
/* test various buffer sizes for GetObject */
ret
=
GetObjectW
(
hbm
,
sizeof
(
*
bma
)
*
2
,
bma
);
...
...
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