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
2824aa2d
Commit
2824aa2d
authored
Mar 15, 2008
by
Nathan Beckmann
Committed by
Alexandre Julliard
Mar 17, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gdiplus: Fix test crash in GdipSaveImageToStream.
Correctly initialized parameters to GetDIBits (based on GdipLockBitmapBits).
parent
efd0b9ae
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
6 deletions
+22
-6
image.c
dlls/gdiplus/image.c
+22
-6
No files found.
dlls/gdiplus/image.c
View file @
2824aa2d
...
...
@@ -908,7 +908,9 @@ GpStatus WINGDIPAPI GdipSaveImageToStream(GpImage *image, IStream* stream,
HRESULT
hr
;
short
type
;
HBITMAP
hbmp
;
HBITMAP
old_hbmp
;
HDC
hdc
;
int
bm_is_selected
;
BITMAPINFO
bmp_info
;
LPVOID
bmp_bits
;
encode_image_func
*
encode_image
;
...
...
@@ -917,6 +919,7 @@ GpStatus WINGDIPAPI GdipSaveImageToStream(GpImage *image, IStream* stream,
unsigned
int
dummy
;
int
i
;
old_hbmp
=
0
;
output
=
NULL
;
output_size
=
0
;
...
...
@@ -943,18 +946,32 @@ GpStatus WINGDIPAPI GdipSaveImageToStream(GpImage *image, IStream* stream,
hr
=
IPicture_get_Handle
(
image
->
picture
,
(
OLE_HANDLE
*
)
&
hbmp
);
if
(
FAILED
(
hr
)
||
!
hbmp
)
return
GenericError
;
hr
=
IPicture_get_CurDC
(
image
->
picture
,
&
hdc
);
if
(
FAILED
(
hr
))
return
GenericError
;
bm_is_selected
=
(
hdc
!=
0
);
if
(
!
bm_is_selected
)
{
hdc
=
CreateCompatibleDC
(
0
);
old_hbmp
=
SelectObject
(
hdc
,
hbmp
);
}
/* get bits from HBITMAP */
hdc
=
GetDC
(
0
);
bmp_info
.
bmiHeader
.
biSize
=
sizeof
(
bmp_info
.
bmiHeader
);
bmp_info
.
bmiHeader
.
biBitCount
=
0
;
GetDIBits
(
hdc
,
hbmp
,
0
,
0
,
NULL
,
&
bmp_info
,
DIB_RGB_COLORS
);
bmp_bits
=
GdipAlloc
(
bmp_info
.
bmiHeader
.
biSizeImage
);
if
(
!
bmp_bits
)
{
ReleaseDC
(
0
,
hdc
);
return
OutOfMemory
;
if
(
bmp_bits
)
GetDIBits
(
hdc
,
hbmp
,
0
,
abs
(
bmp_info
.
bmiHeader
.
biHeight
),
bmp_bits
,
&
bmp_info
,
DIB_RGB_COLORS
);
if
(
!
bm_is_selected
)
{
SelectObject
(
hdc
,
old_hbmp
);
DeleteDC
(
hdc
);
}
GetDIBits
(
hdc
,
hbmp
,
0
,
bmp_info
.
bmiHeader
.
biHeight
,
bmp_bits
,
&
bmp_info
,
DIB_RGB_COLORS
);
if
(
!
bmp_bits
)
return
OutOfMemory
;
stat
=
encode_image
(
bmp_bits
,
&
bmp_info
,
&
output
,
&
output_size
);
if
(
stat
==
Ok
)
...
...
@@ -962,7 +979,6 @@ GpStatus WINGDIPAPI GdipSaveImageToStream(GpImage *image, IStream* stream,
GdipFree
(
output
);
GdipFree
(
bmp_bits
);
ReleaseDC
(
0
,
hdc
);
return
stat
;
}
...
...
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