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
5f946531
Commit
5f946531
authored
Sep 29, 2011
by
Vincent Povirk
Committed by
Alexandre Julliard
Oct 03, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gdiplus: Include an alpha channel in HBITMAPs created from Bitmaps.
parent
42c1b06a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
59 additions
and
16 deletions
+59
-16
image.c
dlls/gdiplus/image.c
+10
-16
image.c
dlls/gdiplus/tests/image.c
+49
-0
No files found.
dlls/gdiplus/image.c
View file @
5f946531
...
...
@@ -1370,12 +1370,12 @@ GpStatus WINGDIPAPI GdipCreateHBITMAPFromBitmap(GpBitmap* bitmap,
HBITMAP
*
hbmReturn
,
ARGB
background
)
{
GpStatus
stat
;
HBITMAP
result
,
oldbitmap
;
HBITMAP
result
;
UINT
width
,
height
;
HDC
hdc
;
GpGraphics
*
graphics
;
BITMAPINFOHEADER
bih
;
void
*
bits
;
LPBYTE
bits
;
BitmapData
lockeddata
;
TRACE
(
"(%p,%p,%x)
\n
"
,
bitmap
,
hbmReturn
,
background
);
if
(
!
bitmap
||
!
hbmReturn
)
return
InvalidParameter
;
...
...
@@ -1398,25 +1398,19 @@ GpStatus WINGDIPAPI GdipCreateHBITMAPFromBitmap(GpBitmap* bitmap,
hdc
=
CreateCompatibleDC
(
NULL
);
if
(
!
hdc
)
return
GenericError
;
result
=
CreateDIBSection
(
hdc
,
(
BITMAPINFO
*
)
&
bih
,
DIB_RGB_COLORS
,
&
bits
,
result
=
CreateDIBSection
(
hdc
,
(
BITMAPINFO
*
)
&
bih
,
DIB_RGB_COLORS
,
(
void
**
)
&
bits
,
NULL
,
0
);
if
(
result
)
{
oldbitmap
=
SelectObject
(
hdc
,
result
);
stat
=
GdipCreateFromHDC
(
hdc
,
&
graphics
);
if
(
stat
==
Ok
)
{
stat
=
GdipGraphicsClear
(
graphics
,
background
);
lockeddata
.
Stride
=
-
width
*
4
;
lockeddata
.
Scan0
=
bits
-
(
lockeddata
.
Stride
*
(
height
-
1
));
if
(
stat
==
Ok
)
stat
=
GdipDrawImage
(
graphics
,
(
GpImage
*
)
bitmap
,
0
,
0
);
stat
=
GdipBitmapLockBits
(
bitmap
,
NULL
,
ImageLockModeRead
|
ImageLockModeUserInputBuf
,
PixelFormat32bppPARGB
,
&
lockeddata
);
GdipDeleteGraphics
(
graphics
);
}
SelectObject
(
hdc
,
oldbitmap
);
if
(
stat
==
Ok
)
stat
=
GdipBitmapUnlockBits
(
bitmap
,
&
lockeddata
);
}
else
stat
=
GenericError
;
...
...
dlls/gdiplus/tests/image.c
View file @
5f946531
...
...
@@ -1514,6 +1514,12 @@ static void test_createhbitmap(void)
expect
(
32
,
bm
.
bmBitsPixel
);
ok
(
bm
.
bmBits
!=
NULL
,
"got DDB, expected DIB
\n
"
);
if
(
bm
.
bmBits
)
{
DWORD
val
=
*
(
DWORD
*
)
bm
.
bmBits
;
ok
(
val
==
0xff686868
,
"got %x, expected 0xff686868
\n
"
,
val
);
}
hdc
=
CreateCompatibleDC
(
NULL
);
oldhbitmap
=
SelectObject
(
hdc
,
hbitmap
);
...
...
@@ -1529,6 +1535,49 @@ static void test_createhbitmap(void)
stat
=
GdipDisposeImage
((
GpImage
*
)
bitmap
);
expect
(
Ok
,
stat
);
/* create alpha Bitmap */
stat
=
GdipCreateBitmapFromScan0
(
8
,
20
,
32
,
PixelFormat32bppARGB
,
bits
,
&
bitmap
);
expect
(
Ok
,
stat
);
/* create HBITMAP */
stat
=
GdipCreateHBITMAPFromBitmap
(
bitmap
,
&
hbitmap
,
0
);
expect
(
Ok
,
stat
);
if
(
stat
==
Ok
)
{
ret
=
GetObjectA
(
hbitmap
,
sizeof
(
BITMAP
),
&
bm
);
expect
(
sizeof
(
BITMAP
),
ret
);
expect
(
0
,
bm
.
bmType
);
expect
(
8
,
bm
.
bmWidth
);
expect
(
20
,
bm
.
bmHeight
);
expect
(
32
,
bm
.
bmWidthBytes
);
expect
(
1
,
bm
.
bmPlanes
);
expect
(
32
,
bm
.
bmBitsPixel
);
ok
(
bm
.
bmBits
!=
NULL
,
"got DDB, expected DIB
\n
"
);
if
(
bm
.
bmBits
)
{
DWORD
val
=
*
(
DWORD
*
)
bm
.
bmBits
;
ok
(
val
==
0x682a2a2a
,
"got %x, expected 0x682a2a2a
\n
"
,
val
);
}
hdc
=
CreateCompatibleDC
(
NULL
);
oldhbitmap
=
SelectObject
(
hdc
,
hbitmap
);
pixel
=
GetPixel
(
hdc
,
5
,
5
);
SelectObject
(
hdc
,
oldhbitmap
);
DeleteDC
(
hdc
);
expect
(
0x2a2a2a
,
pixel
);
DeleteObject
(
hbitmap
);
}
stat
=
GdipDisposeImage
((
GpImage
*
)
bitmap
);
expect
(
Ok
,
stat
);
}
static
void
test_getthumbnail
(
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