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
2309a9e4
Commit
2309a9e4
authored
Sep 28, 2008
by
Lei Zhang
Committed by
Alexandre Julliard
Sep 30, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gdiplus: Allocate enough space for BITMAPINFO in GdipBitmapLockBits.
parent
fc753bbb
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
10 deletions
+16
-10
image.c
dlls/gdiplus/image.c
+16
-10
No files found.
dlls/gdiplus/image.c
View file @
2309a9e4
...
...
@@ -98,7 +98,7 @@ GpStatus WINGDIPAPI GdipBitmapLockBits(GpBitmap* bitmap, GDIPCONST GpRect* rect,
OLE_HANDLE
hbm
;
HDC
hdc
;
HBITMAP
old
=
NULL
;
BITMAPINFO
bmi
;
BITMAPINFO
*
p
bmi
;
BYTE
*
buff
=
NULL
;
UINT
abs_height
;
GpRect
act_rect
;
/* actual rect to be used */
...
...
@@ -131,8 +131,11 @@ GpStatus WINGDIPAPI GdipBitmapLockBits(GpBitmap* bitmap, GDIPCONST GpRect* rect,
IPicture_get_CurDC
(
bitmap
->
image
.
picture
,
&
hdc
);
bm_is_selected
=
(
hdc
!=
0
);
bmi
.
bmiHeader
.
biSize
=
sizeof
(
BITMAPINFOHEADER
);
bmi
.
bmiHeader
.
biBitCount
=
0
;
pbmi
=
GdipAlloc
(
sizeof
(
BITMAPINFOHEADER
)
+
256
*
sizeof
(
RGBQUAD
));
if
(
!
pbmi
)
return
OutOfMemory
;
pbmi
->
bmiHeader
.
biSize
=
sizeof
(
BITMAPINFOHEADER
);
pbmi
->
bmiHeader
.
biBitCount
=
0
;
if
(
!
bm_is_selected
){
hdc
=
CreateCompatibleDC
(
0
);
...
...
@@ -140,33 +143,35 @@ GpStatus WINGDIPAPI GdipBitmapLockBits(GpBitmap* bitmap, GDIPCONST GpRect* rect,
}
/* fill out bmi */
GetDIBits
(
hdc
,
(
HBITMAP
)
hbm
,
0
,
0
,
NULL
,
&
bmi
,
DIB_RGB_COLORS
);
GetDIBits
(
hdc
,
(
HBITMAP
)
hbm
,
0
,
0
,
NULL
,
p
bmi
,
DIB_RGB_COLORS
);
abs_height
=
abs
(
bmi
.
bmiHeader
.
biHeight
);
stride
=
bmi
.
bmiHeader
.
biWidth
*
bitspp
/
8
;
abs_height
=
abs
(
pbmi
->
bmiHeader
.
biHeight
);
stride
=
pbmi
->
bmiHeader
.
biWidth
*
bitspp
/
8
;
stride
=
(
stride
+
3
)
&
~
3
;
buff
=
GdipAlloc
(
stride
*
abs_height
);
bmi
.
bmiHeader
.
biBitCount
=
bitspp
;
pbmi
->
bmiHeader
.
biBitCount
=
bitspp
;
if
(
buff
)
GetDIBits
(
hdc
,
(
HBITMAP
)
hbm
,
0
,
abs_height
,
buff
,
&
bmi
,
DIB_RGB_COLORS
);
GetDIBits
(
hdc
,
(
HBITMAP
)
hbm
,
0
,
abs_height
,
buff
,
p
bmi
,
DIB_RGB_COLORS
);
if
(
!
bm_is_selected
){
SelectObject
(
hdc
,
old
);
DeleteDC
(
hdc
);
}
if
(
!
buff
)
if
(
!
buff
){
GdipFree
(
pbmi
);
return
OutOfMemory
;
}
lockeddata
->
Width
=
act_rect
.
Width
;
lockeddata
->
Height
=
act_rect
.
Height
;
lockeddata
->
PixelFormat
=
format
;
lockeddata
->
Reserved
=
flags
;
if
(
bmi
.
bmiHeader
.
biHeight
>
0
){
if
(
pbmi
->
bmiHeader
.
biHeight
>
0
){
lockeddata
->
Stride
=
-
stride
;
lockeddata
->
Scan0
=
buff
+
(
bitspp
/
8
)
*
act_rect
.
X
+
stride
*
(
abs_height
-
1
-
act_rect
.
Y
);
...
...
@@ -181,6 +186,7 @@ GpStatus WINGDIPAPI GdipBitmapLockBits(GpBitmap* bitmap, GDIPCONST GpRect* rect,
bitmap
->
bitmapbits
=
buff
;
GdipFree
(
pbmi
);
return
Ok
;
}
...
...
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