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
8d53fc56
Commit
8d53fc56
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 GdipCreateTextureIA.
parent
47ef2acc
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
15 deletions
+25
-15
brush.c
dlls/gdiplus/brush.c
+25
-15
No files found.
dlls/gdiplus/brush.c
View file @
8d53fc56
...
...
@@ -480,7 +480,7 @@ GpStatus WINGDIPAPI GdipCreateTextureIA(GpImage *image,
HDC
hdc
;
OLE_HANDLE
hbm
;
HBITMAP
old
=
NULL
;
BITMAPINFO
bmi
;
BITMAPINFO
*
p
bmi
;
BITMAPINFOHEADER
*
bmih
;
INT
n_x
,
n_y
,
n_width
,
n_height
,
abs_height
,
stride
,
image_stride
,
i
,
bytespp
;
BOOL
bm_is_selected
;
...
...
@@ -512,8 +512,11 @@ GpStatus WINGDIPAPI GdipCreateTextureIA(GpImage *image,
IPicture_get_CurDC
(
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
);
...
...
@@ -521,32 +524,37 @@ GpStatus WINGDIPAPI GdipCreateTextureIA(GpImage *image,
}
/* 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
);
bytespp
=
bmi
.
bmiHeader
.
biBitCount
/
8
;
abs_height
=
abs
(
bmi
.
bmiHeader
.
biHeight
);
bytespp
=
pbmi
->
bmiHeader
.
biBitCount
/
8
;
abs_height
=
abs
(
pbmi
->
bmiHeader
.
biHeight
);
if
(
n_x
>
bmi
.
bmiHeader
.
biWidth
||
n_x
+
n_width
>
bmi
.
bmiHeader
.
biWidth
||
n_y
>
abs_height
||
n_y
+
n_height
>
abs_height
)
if
(
n_x
>
pbmi
->
bmiHeader
.
biWidth
||
n_x
+
n_width
>
pbmi
->
bmiHeader
.
biWidth
||
n_y
>
abs_height
||
n_y
+
n_height
>
abs_height
){
GdipFree
(
pbmi
);
return
InvalidParameter
;
}
dibits
=
GdipAlloc
(
bmi
.
bmiHeader
.
biSizeImage
);
dibits
=
GdipAlloc
(
pbmi
->
bmiHeader
.
biSizeImage
);
if
(
dibits
)
/* this is not a good place to error out */
GetDIBits
(
hdc
,
(
HBITMAP
)
hbm
,
0
,
abs_height
,
dibits
,
&
bmi
,
DIB_RGB_COLORS
);
GetDIBits
(
hdc
,
(
HBITMAP
)
hbm
,
0
,
abs_height
,
dibits
,
p
bmi
,
DIB_RGB_COLORS
);
if
(
!
bm_is_selected
){
SelectObject
(
hdc
,
old
);
DeleteDC
(
hdc
);
}
if
(
!
dibits
)
if
(
!
dibits
){
GdipFree
(
pbmi
);
return
OutOfMemory
;
}
image_stride
=
(
bmi
.
bmiHeader
.
biWidth
*
bytespp
+
3
)
&
~
3
;
image_stride
=
(
pbmi
->
bmiHeader
.
biWidth
*
bytespp
+
3
)
&
~
3
;
stride
=
(
n_width
*
bytespp
+
3
)
&
~
3
;
buff
=
GdipAlloc
(
sizeof
(
BITMAPINFOHEADER
)
+
stride
*
n_height
);
if
(
!
buff
){
GdipFree
(
pbmi
);
GdipFree
(
dibits
);
return
OutOfMemory
;
}
...
...
@@ -558,18 +566,20 @@ GpStatus WINGDIPAPI GdipCreateTextureIA(GpImage *image,
bmih
->
biHeight
=
n_height
;
bmih
->
biCompression
=
BI_RGB
;
bmih
->
biSizeImage
=
stride
*
n_height
;
bmih
->
biBitCount
=
bmi
.
bmiHeader
.
biBitCount
;
bmih
->
biBitCount
=
pbmi
->
bmiHeader
.
biBitCount
;
bmih
->
biClrUsed
=
0
;
bmih
->
biPlanes
=
1
;
/* image is flipped */
if
(
bmi
.
bmiHeader
.
biHeight
>
0
){
dibits
+=
bmi
.
bmiHeader
.
biSizeImage
;
if
(
pbmi
->
bmiHeader
.
biHeight
>
0
){
dibits
+=
pbmi
->
bmiHeader
.
biSizeImage
;
image_stride
*=
-
1
;
textbits
+=
stride
*
(
n_height
-
1
);
stride
*=
-
1
;
}
GdipFree
(
pbmi
);
for
(
i
=
0
;
i
<
n_height
;
i
++
)
memcpy
(
&
textbits
[
i
*
stride
],
&
dibits
[
n_x
*
bytespp
+
(
n_y
+
i
)
*
image_stride
],
...
...
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