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
65750fab
Commit
65750fab
authored
Feb 17, 2009
by
Vincent Povirk
Committed by
Alexandre Julliard
Feb 18, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gdiplus: Handle negative stride in GdipCreateBitmapFromScan0.
parent
4a8e1fee
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
13 deletions
+18
-13
image.c
dlls/gdiplus/image.c
+16
-9
image.c
dlls/gdiplus/tests/image.c
+2
-4
No files found.
dlls/gdiplus/image.c
View file @
65750fab
...
...
@@ -496,12 +496,6 @@ GpStatus WINGDIPAPI GdipCreateBitmapFromScan0(INT width, INT height, INT stride,
if
(
scan0
&&
!
stride
)
return
InvalidParameter
;
/* FIXME: windows allows negative stride (reads backwards from scan0) */
if
(
stride
<
0
){
FIXME
(
"negative stride
\n
"
);
return
InvalidParameter
;
}
*
bitmap
=
GdipAlloc
(
sizeof
(
GpBitmap
));
if
(
!*
bitmap
)
return
OutOfMemory
;
...
...
@@ -527,16 +521,29 @@ GpStatus WINGDIPAPI GdipCreateBitmapFromScan0(INT width, INT height, INT stride,
bmih
->
biSize
=
sizeof
(
BITMAPINFOHEADER
);
bmih
->
biWidth
=
width
;
bmih
->
biHeight
=
-
height
;
/* FIXME: use the rest of the data from format */
bmih
->
biBitCount
=
PIXELFORMATBPP
(
format
);
bmih
->
biCompression
=
BI_RGB
;
bmih
->
biSizeImage
=
datalen
;
if
(
scan0
)
memcpy
(
bmih
+
1
,
scan0
,
datalen
);
if
(
scan0
)
{
if
(
stride
>
0
)
{
bmih
->
biHeight
=
-
height
;
memcpy
(
bmih
+
1
,
scan0
,
datalen
);
}
else
{
bmih
->
biHeight
=
height
;
memcpy
(
bmih
+
1
,
scan0
+
stride
*
(
height
-
1
),
datalen
);
}
}
else
{
bmih
->
biHeight
=
height
;
memset
(
bmih
+
1
,
0
,
datalen
);
}
if
(
CreateStreamOnHGlobal
(
buff
,
TRUE
,
&
stream
)
!=
S_OK
){
ERR
(
"could not make stream
\n
"
);
...
...
dlls/gdiplus/tests/image.c
View file @
65750fab
...
...
@@ -129,10 +129,8 @@ static void test_Scan0(void)
bm
=
NULL
;
stat
=
GdipCreateBitmapFromScan0
(
10
,
10
,
-
8
,
PixelFormat24bppRGB
,
buff
,
&
bm
);
todo_wine
{
expect
(
Ok
,
stat
);
ok
(
NULL
!=
bm
,
"Expected bitmap to be initialized
\n
"
);
}
expect
(
Ok
,
stat
);
ok
(
NULL
!=
bm
,
"Expected bitmap to be initialized
\n
"
);
if
(
stat
==
Ok
)
GdipDisposeImage
((
GpImage
*
)
bm
);
...
...
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