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
52150d21
Commit
52150d21
authored
Jan 11, 2012
by
Vincent Povirk
Committed by
Alexandre Julliard
Jan 12, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gdiplus: Test GdipCreateBitmapFromHBITMAP with 16-bit dib's.
parent
e8a6ca7d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
110 additions
and
10 deletions
+110
-10
image.c
dlls/gdiplus/tests/image.c
+110
-10
No files found.
dlls/gdiplus/tests/image.c
View file @
52150d21
...
...
@@ -831,6 +831,18 @@ static void test_LockBits_UserBuf(void)
expect
(
Ok
,
stat
);
}
struct
BITMAPINFOWITHBITFIELDS
{
BITMAPINFOHEADER
bmiHeader
;
DWORD
masks
[
3
];
};
union
BITMAPINFOUNION
{
BITMAPINFO
bi
;
struct
BITMAPINFOWITHBITFIELDS
bf
;
};
static
void
test_GdipCreateBitmapFromHBITMAP
(
void
)
{
GpBitmap
*
gpbm
=
NULL
;
...
...
@@ -845,8 +857,9 @@ static void test_GdipCreateBitmapFromHBITMAP(void)
const
REAL
WIDTH2
=
10
;
const
REAL
HEIGHT2
=
20
;
HDC
hdc
;
BITMAPINFO
bmi
;
union
BITMAPINFOUNION
bmi
;
BYTE
*
bits
;
PixelFormat
format
;
stat
=
GdipCreateBitmapFromHBITMAP
(
NULL
,
NULL
,
NULL
);
expect
(
InvalidParameter
,
stat
);
...
...
@@ -880,15 +893,15 @@ static void test_GdipCreateBitmapFromHBITMAP(void)
hdc
=
CreateCompatibleDC
(
0
);
ok
(
hdc
!=
NULL
,
"CreateCompatibleDC failed
\n
"
);
bmi
.
b
miHeader
.
biSize
=
sizeof
(
bm
i
.
bmiHeader
);
bmi
.
bmiHeader
.
biHeight
=
HEIGHT1
;
bmi
.
bmiHeader
.
biWidth
=
WIDTH1
;
bmi
.
bmiHeader
.
biBitCount
=
24
;
bmi
.
bmiHeader
.
biPlanes
=
1
;
bmi
.
bmiHeader
.
biCompression
=
BI_RGB
;
bmi
.
bmiHeader
.
biClrUsed
=
0
;
hbm
=
CreateDIBSection
(
hdc
,
&
bmi
,
DIB_RGB_COLORS
,
(
void
**
)
&
bits
,
NULL
,
0
);
bmi
.
b
i
.
bmiHeader
.
biSize
=
sizeof
(
bmi
.
b
i
.
bmiHeader
);
bmi
.
b
i
.
b
miHeader
.
biHeight
=
HEIGHT1
;
bmi
.
b
i
.
b
miHeader
.
biWidth
=
WIDTH1
;
bmi
.
b
i
.
b
miHeader
.
biBitCount
=
24
;
bmi
.
b
i
.
b
miHeader
.
biPlanes
=
1
;
bmi
.
b
i
.
b
miHeader
.
biCompression
=
BI_RGB
;
bmi
.
b
i
.
b
miHeader
.
biClrUsed
=
0
;
hbm
=
CreateDIBSection
(
hdc
,
&
bmi
.
bi
,
DIB_RGB_COLORS
,
(
void
**
)
&
bits
,
NULL
,
0
);
ok
(
hbm
!=
NULL
,
"CreateDIBSection failed
\n
"
);
bits
[
0
]
=
0
;
...
...
@@ -925,6 +938,93 @@ static void test_GdipCreateBitmapFromHBITMAP(void)
DeleteObject
(
hpal
);
DeleteObject
(
hbm
);
/* 16-bit 555 dib, rgb */
bmi
.
bi
.
bmiHeader
.
biBitCount
=
16
;
bmi
.
bi
.
bmiHeader
.
biCompression
=
BI_RGB
;
hbm
=
CreateDIBSection
(
hdc
,
&
bmi
.
bi
,
DIB_RGB_COLORS
,
(
void
**
)
&
bits
,
NULL
,
0
);
ok
(
hbm
!=
NULL
,
"CreateDIBSection failed
\n
"
);
bits
[
0
]
=
0
;
stat
=
GdipCreateBitmapFromHBITMAP
(
hbm
,
NULL
,
&
gpbm
);
todo_wine
expect
(
Ok
,
stat
);
if
(
stat
==
Ok
)
{
stat
=
GdipGetImageDimension
((
GpImage
*
)
gpbm
,
&
width
,
&
height
);
expect
(
Ok
,
stat
);
expectf
(
WIDTH1
,
width
);
expectf
(
HEIGHT1
,
height
);
stat
=
GdipGetImagePixelFormat
((
GpImage
*
)
gpbm
,
&
format
);
expect
(
Ok
,
stat
);
expect
(
PixelFormat16bppRGB555
,
format
);
GdipDisposeImage
((
GpImage
*
)
gpbm
);
}
DeleteObject
(
hbm
);
/* 16-bit 555 dib, with bitfields */
bmi
.
bi
.
bmiHeader
.
biSize
=
sizeof
(
bmi
);
bmi
.
bi
.
bmiHeader
.
biCompression
=
BI_BITFIELDS
;
bmi
.
bf
.
masks
[
0
]
=
0x7c00
;
bmi
.
bf
.
masks
[
1
]
=
0x3e0
;
bmi
.
bf
.
masks
[
2
]
=
0x1f
;
hbm
=
CreateDIBSection
(
hdc
,
&
bmi
.
bi
,
DIB_RGB_COLORS
,
(
void
**
)
&
bits
,
NULL
,
0
);
ok
(
hbm
!=
NULL
,
"CreateDIBSection failed
\n
"
);
bits
[
0
]
=
0
;
stat
=
GdipCreateBitmapFromHBITMAP
(
hbm
,
NULL
,
&
gpbm
);
todo_wine
expect
(
Ok
,
stat
);
if
(
stat
==
Ok
)
{
stat
=
GdipGetImageDimension
((
GpImage
*
)
gpbm
,
&
width
,
&
height
);
expect
(
Ok
,
stat
);
expectf
(
WIDTH1
,
width
);
expectf
(
HEIGHT1
,
height
);
stat
=
GdipGetImagePixelFormat
((
GpImage
*
)
gpbm
,
&
format
);
expect
(
Ok
,
stat
);
expect
(
PixelFormat16bppRGB555
,
format
);
GdipDisposeImage
((
GpImage
*
)
gpbm
);
}
DeleteObject
(
hbm
);
/* 16-bit 565 dib, with bitfields */
bmi
.
bf
.
masks
[
0
]
=
0xf800
;
bmi
.
bf
.
masks
[
1
]
=
0x7e0
;
bmi
.
bf
.
masks
[
2
]
=
0x1f
;
hbm
=
CreateDIBSection
(
hdc
,
&
bmi
.
bi
,
DIB_RGB_COLORS
,
(
void
**
)
&
bits
,
NULL
,
0
);
ok
(
hbm
!=
NULL
,
"CreateDIBSection failed
\n
"
);
bits
[
0
]
=
0
;
stat
=
GdipCreateBitmapFromHBITMAP
(
hbm
,
NULL
,
&
gpbm
);
todo_wine
expect
(
Ok
,
stat
);
if
(
stat
==
Ok
)
{
stat
=
GdipGetImageDimension
((
GpImage
*
)
gpbm
,
&
width
,
&
height
);
expect
(
Ok
,
stat
);
expectf
(
WIDTH1
,
width
);
expectf
(
HEIGHT1
,
height
);
stat
=
GdipGetImagePixelFormat
((
GpImage
*
)
gpbm
,
&
format
);
expect
(
Ok
,
stat
);
expect
(
PixelFormat16bppRGB565
,
format
);
GdipDisposeImage
((
GpImage
*
)
gpbm
);
}
DeleteObject
(
hbm
);
DeleteDC
(
hdc
);
}
static
void
test_GdipGetImageFlags
(
void
)
...
...
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