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
a41fa500
Commit
a41fa500
authored
Aug 08, 2007
by
Evan Stade
Committed by
Alexandre Julliard
Aug 09, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gdiplus: Fixed conformance of GdipCreateBitmapFromScan0.
parent
cae277f1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
12 deletions
+27
-12
image.c
dlls/gdiplus/image.c
+24
-3
image.c
dlls/gdiplus/tests/image.c
+3
-9
No files found.
dlls/gdiplus/image.c
View file @
a41fa500
...
...
@@ -257,17 +257,34 @@ GpStatus WINGDIPAPI GdipCreateBitmapFromScan0(INT width, INT height, INT stride,
BITMAPFILEHEADER
*
bmfh
;
BITMAPINFOHEADER
*
bmih
;
BYTE
*
buff
;
INT
datalen
=
stride
*
height
,
size
;
INT
datalen
,
size
;
IStream
*
stream
;
TRACE
(
"%d %d %d %d %p %p
\n
"
,
width
,
height
,
stride
,
format
,
scan0
,
bitmap
);
if
(
!
scan0
||
!
bitmap
)
if
(
!
bitmap
||
width
<=
0
||
height
<=
0
||
(
scan0
&&
(
stride
%
4
))){
*
bitmap
=
NULL
;
return
InvalidParameter
;
}
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
;
if
(
stride
==
0
){
stride
=
width
*
(
PIXELFORMATBPP
(
format
)
/
8
);
stride
=
(
stride
+
3
)
&
~
3
;
}
datalen
=
abs
(
stride
*
height
);
size
=
sizeof
(
BITMAPFILEHEADER
)
+
sizeof
(
BITMAPINFOHEADER
)
+
datalen
;
buff
=
GdipAlloc
(
size
);
if
(
!
buff
){
...
...
@@ -284,12 +301,16 @@ GpStatus WINGDIPAPI GdipCreateBitmapFromScan0(INT width, INT height, INT stride,
bmih
->
biSize
=
sizeof
(
BITMAPINFOHEADER
);
bmih
->
biWidth
=
width
;
bmih
->
biHeight
=
height
;
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
);
else
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 @
a41fa500
...
...
@@ -32,28 +32,26 @@ static void test_Scan0()
bm
=
NULL
;
stat
=
GdipCreateBitmapFromScan0
(
10
,
10
,
10
,
PixelFormat24bppRGB
,
NULL
,
&
bm
);
todo_wine
{
expect
(
Ok
,
stat
);
ok
(
NULL
!=
bm
,
"Expected bitmap to be initialized
\n
"
);
}
GdipDisposeImage
((
GpImage
*
)
bm
);
bm
=
(
GpBitmap
*
)
0xdeadbeef
;
stat
=
GdipCreateBitmapFromScan0
(
10
,
-
10
,
10
,
PixelFormat24bppRGB
,
NULL
,
&
bm
);
expect
(
InvalidParameter
,
stat
);
todo_wine
expect
(
NULL
,
bm
);
bm
=
(
GpBitmap
*
)
0xdeadbeef
;
stat
=
GdipCreateBitmapFromScan0
(
-
10
,
10
,
10
,
PixelFormat24bppRGB
,
NULL
,
&
bm
);
expect
(
InvalidParameter
,
stat
);
todo_wine
expect
(
NULL
,
bm
);
bm
=
(
GpBitmap
*
)
0xdeadbeef
;
stat
=
GdipCreateBitmapFromScan0
(
10
,
0
,
10
,
PixelFormat24bppRGB
,
NULL
,
&
bm
);
expect
(
InvalidParameter
,
stat
);
todo_wine
expect
(
NULL
,
bm
);
bm
=
NULL
;
...
...
@@ -64,17 +62,13 @@ static void test_Scan0()
bm
=
(
GpBitmap
*
)
0xdeadbeef
;
stat
=
GdipCreateBitmapFromScan0
(
10
,
10
,
10
,
PixelFormat24bppRGB
,
buff
,
&
bm
);
todo_wine
{
expect
(
InvalidParameter
,
stat
);
expect
(
NULL
,
bm
);
}
bm
=
(
GpBitmap
*
)
0xdeadbeef
;
stat
=
GdipCreateBitmapFromScan0
(
10
,
10
,
0
,
PixelFormat24bppRGB
,
buff
,
&
bm
);
todo_wine
{
expect
(
InvalidParameter
,
stat
);
expect
(
0xdeadbeef
,
bm
);
}
}
START_TEST
(
image
)
...
...
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