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
d2e1478d
Commit
d2e1478d
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/tests: Added tests for copying a single pixel from top down and bottom up bitmaps.
parent
e9ab576c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
98 additions
and
0 deletions
+98
-0
bitmap.c
dlls/gdi32/tests/bitmap.c
+98
-0
No files found.
dlls/gdi32/tests/bitmap.c
View file @
d2e1478d
...
...
@@ -3050,6 +3050,101 @@ static void test_32bit_bitmap_blt(void)
DeleteDC
(
hdcScreen
);
}
/*
* Used by test_GetDIBits_single_pixel_destination to create the bitmap to test against.
*/
static
void
setup_picture
(
char
*
picture
,
int
bpp
)
{
int
i
;
switch
(
bpp
)
{
case
16
:
case
32
:
/*Set the first byte in each pixel to the index of that pixel.*/
for
(
i
=
0
;
i
<
4
;
i
++
)
picture
[
i
*
(
bpp
/
8
)]
=
i
;
break
;
case
24
:
picture
[
0
]
=
0
;
picture
[
3
]
=
1
;
/*Each scanline in a bitmap must be a multiple of 4 bytes long.*/
picture
[
8
]
=
2
;
picture
[
11
]
=
3
;
break
;
}
}
static
void
test_GetDIBits_single_pixel_destination
(
int
bpp
)
{
BITMAPINFO
bi
;
HBITMAP
bmptb
,
bmpbt
;
HDC
hdc
;
int
pixelOut
;
int
*
picture
;
int
statusCode
;
bi
.
bmiHeader
.
biSize
=
sizeof
(
bi
.
bmiHeader
);
bi
.
bmiHeader
.
biWidth
=
2
;
bi
.
bmiHeader
.
biHeight
=
2
;
bi
.
bmiHeader
.
biPlanes
=
1
;
bi
.
bmiHeader
.
biBitCount
=
bpp
;
bi
.
bmiHeader
.
biCompression
=
BI_RGB
;
/*Get the device context for the screen.*/
hdc
=
GetDC
(
NULL
);
ok
(
hdc
!=
NULL
,
"Could not get a handle to a device context.
\n
"
);
/*Create the bottom to top image (image's bottom scan line is at the top in memory).*/
bmpbt
=
CreateDIBSection
(
hdc
,
&
bi
,
DIB_RGB_COLORS
,
(
void
**
)
&
picture
,
NULL
,
0
);
ok
(
bmpbt
!=
NULL
,
"Could not create a DIB section.
\n
"
);
/*Now that we have a pointer to the pixels, we write to them.*/
setup_picture
((
char
*
)
picture
,
bpp
);
/*Create the top to bottom image (images' bottom scan line is at the bottom in memory).*/
bi
.
bmiHeader
.
biHeight
=-
2
;
/*We specify that we want a top to bottom image by specifying a negative height.*/
bmptb
=
CreateDIBSection
(
hdc
,
&
bi
,
DIB_RGB_COLORS
,
(
void
**
)
&
picture
,
NULL
,
0
);
ok
(
bmptb
!=
NULL
,
"Could not create a DIB section.
\n
"
);
/*Write to this top to bottom bitmap.*/
setup_picture
((
char
*
)
picture
,
bpp
);
bi
.
bmiHeader
.
biWidth
=
1
;
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
);
/*Check the first byte of the pixel.*/
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
);
/*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
);
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 this.*/
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
);
/*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
);
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
);
DeleteObject
(
bmpbt
);
DeleteObject
(
bmptb
);
}
START_TEST
(
bitmap
)
{
HMODULE
hdll
;
...
...
@@ -3080,4 +3175,7 @@ START_TEST(bitmap)
test_bitmapinfoheadersize
();
test_get16dibits
();
test_clipping
();
test_GetDIBits_single_pixel_destination
(
16
);
test_GetDIBits_single_pixel_destination
(
24
);
test_GetDIBits_single_pixel_destination
(
32
);
}
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