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
36a7f317
Commit
36a7f317
authored
May 21, 2008
by
Nikolay Sivov
Committed by
Alexandre Julliard
May 21, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gdiplus: GdipBitmapLockBits should allow a NULL rect argument.
parent
87bb1cbc
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
10 deletions
+31
-10
image.c
dlls/gdiplus/image.c
+19
-9
image.c
dlls/gdiplus/tests/image.c
+12
-1
No files found.
dlls/gdiplus/image.c
View file @
36a7f317
...
...
@@ -101,15 +101,25 @@ GpStatus WINGDIPAPI GdipBitmapLockBits(GpBitmap* bitmap, GDIPCONST GpRect* rect,
BITMAPINFO
bmi
;
BYTE
*
buff
=
NULL
;
UINT
abs_height
;
GpRect
act_rect
;
/* actual rect to be used */
TRACE
(
"%p %p %d %d %p
\n
"
,
bitmap
,
rect
,
flags
,
format
,
lockeddata
);
if
(
!
lockeddata
||
!
bitmap
||
!
rect
)
if
(
!
lockeddata
||
!
bitmap
)
return
InvalidParameter
;
if
(
rect
->
X
<
0
||
rect
->
Y
<
0
||
(
rect
->
X
+
rect
->
Width
>
bitmap
->
width
)
||
(
rect
->
Y
+
rect
->
Height
>
bitmap
->
height
)
||
!
flags
)
return
InvalidParameter
;
if
(
rect
){
if
(
rect
->
X
<
0
||
rect
->
Y
<
0
||
(
rect
->
X
+
rect
->
Width
>
bitmap
->
width
)
||
(
rect
->
Y
+
rect
->
Height
>
bitmap
->
height
)
||
!
flags
)
return
InvalidParameter
;
act_rect
=
*
rect
;
}
else
{
act_rect
.
X
=
act_rect
.
Y
=
0
;
act_rect
.
Width
=
bitmap
->
width
;
act_rect
.
Height
=
bitmap
->
height
;
}
if
(
flags
&
ImageLockModeUserInputBuf
)
return
NotImplemented
;
...
...
@@ -151,19 +161,19 @@ GpStatus WINGDIPAPI GdipBitmapLockBits(GpBitmap* bitmap, GDIPCONST GpRect* rect,
if
(
!
buff
)
return
OutOfMemory
;
lockeddata
->
Width
=
rect
->
Width
;
lockeddata
->
Height
=
rect
->
Height
;
lockeddata
->
Width
=
act_rect
.
Width
;
lockeddata
->
Height
=
act_rect
.
Height
;
lockeddata
->
PixelFormat
=
format
;
lockeddata
->
Reserved
=
flags
;
if
(
bmi
.
bmiHeader
.
biHeight
>
0
){
lockeddata
->
Stride
=
-
stride
;
lockeddata
->
Scan0
=
buff
+
(
bitspp
/
8
)
*
rect
->
X
+
stride
*
(
abs_height
-
1
-
rect
->
Y
);
lockeddata
->
Scan0
=
buff
+
(
bitspp
/
8
)
*
act_rect
.
X
+
stride
*
(
abs_height
-
1
-
act_rect
.
Y
);
}
else
{
lockeddata
->
Stride
=
stride
;
lockeddata
->
Scan0
=
buff
+
(
bitspp
/
8
)
*
rect
->
X
+
stride
*
rect
->
Y
;
lockeddata
->
Scan0
=
buff
+
(
bitspp
/
8
)
*
act_rect
.
X
+
stride
*
act_rect
.
Y
;
}
bitmap
->
lockmode
=
flags
;
...
...
dlls/gdiplus/tests/image.c
View file @
36a7f317
...
...
@@ -247,7 +247,7 @@ static void test_LockBits(void)
GpBitmap
*
bm
;
GpRect
rect
;
BitmapData
bd
;
const
REAL
WIDTH
=
10
.
0
,
HEIGHT
=
20
.
0
;
const
INT
WIDTH
=
10
,
HEIGHT
=
2
0
;
bm
=
NULL
;
stat
=
GdipCreateBitmapFromScan0
(
WIDTH
,
HEIGHT
,
0
,
PixelFormat24bppRGB
,
NULL
,
&
bm
);
...
...
@@ -267,6 +267,17 @@ static void test_LockBits(void)
expect
(
Ok
,
stat
);
}
/* read-only, with NULL rect -> whole bitmap lock */
stat
=
GdipBitmapLockBits
(
bm
,
NULL
,
ImageLockModeRead
,
PixelFormat24bppRGB
,
&
bd
);
expect
(
Ok
,
stat
);
expect
(
bd
.
Width
,
WIDTH
);
expect
(
bd
.
Height
,
HEIGHT
);
if
(
stat
==
Ok
)
{
stat
=
GdipBitmapUnlockBits
(
bm
,
&
bd
);
expect
(
Ok
,
stat
);
}
/* read-only, consecutive */
stat
=
GdipBitmapLockBits
(
bm
,
&
rect
,
ImageLockModeRead
,
PixelFormat24bppRGB
,
&
bd
);
expect
(
Ok
,
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