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
21d6fc96
Commit
21d6fc96
authored
Feb 24, 2011
by
Vincent Povirk
Committed by
Alexandre Julliard
Feb 25, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gdiplus: Implement ImageLockModeUserInputBuf.
parent
546b1a5c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
37 deletions
+26
-37
image.c
dlls/gdiplus/image.c
+19
-30
image.c
dlls/gdiplus/tests/image.c
+7
-7
No files found.
dlls/gdiplus/image.c
View file @
21d6fc96
...
...
@@ -913,9 +913,7 @@ GpStatus convert_pixels(UINT width, UINT height,
GpStatus
WINGDIPAPI
GdipBitmapLockBits
(
GpBitmap
*
bitmap
,
GDIPCONST
GpRect
*
rect
,
UINT
flags
,
PixelFormat
format
,
BitmapData
*
lockeddata
)
{
INT
stride
,
bitspp
=
PIXELFORMATBPP
(
format
);
BYTE
*
buff
=
NULL
;
UINT
abs_height
;
INT
bitspp
=
PIXELFORMATBPP
(
format
);
GpRect
act_rect
;
/* actual rect to be used */
GpStatus
stat
;
...
...
@@ -937,20 +935,13 @@ GpStatus WINGDIPAPI GdipBitmapLockBits(GpBitmap* bitmap, GDIPCONST GpRect* rect,
act_rect
.
Height
=
bitmap
->
height
;
}
if
(
flags
&
ImageLockModeUserInputBuf
)
{
static
int
fixme
=
0
;
if
(
!
fixme
++
)
FIXME
(
"ImageLockModeUserInputBuf not implemented
\n
"
);
return
NotImplemented
;
}
if
(
bitmap
->
lockmode
)
{
WARN
(
"bitmap is already locked and cannot be locked again
\n
"
);
return
WrongState
;
}
if
(
bitmap
->
bits
&&
bitmap
->
format
==
format
)
if
(
bitmap
->
bits
&&
bitmap
->
format
==
format
&&
!
(
flags
&
ImageLockModeUserInputBuf
)
)
{
/* no conversion is necessary; just use the bits directly */
lockeddata
->
Width
=
act_rect
.
Width
;
...
...
@@ -990,13 +981,21 @@ GpStatus WINGDIPAPI GdipBitmapLockBits(GpBitmap* bitmap, GDIPCONST GpRect* rect,
}
}
abs_height
=
act_rect
.
Height
;
stride
=
(
act_rect
.
Width
*
bitspp
+
7
)
/
8
;
stride
=
(
stride
+
3
)
&
~
3
;
lockeddata
->
Width
=
act_rect
.
Width
;
lockeddata
->
Height
=
act_rect
.
Height
;
lockeddata
->
PixelFormat
=
format
;
lockeddata
->
Reserved
=
flags
;
if
(
!
(
flags
&
ImageLockModeUserInputBuf
))
{
lockeddata
->
Stride
=
(((
act_rect
.
Width
*
bitspp
+
7
)
/
8
)
+
3
)
&
~
3
;
bitmap
->
bitmapbits
=
GdipAlloc
(
lockeddata
->
Stride
*
act_rect
.
Height
);
buff
=
GdipAlloc
(
stride
*
abs_height
)
;
if
(
!
bitmap
->
bitmapbits
)
return
OutOfMemory
;
if
(
!
buff
)
return
OutOfMemory
;
lockeddata
->
Scan0
=
bitmap
->
bitmapbits
;
}
if
(
flags
&
ImageLockModeRead
)
{
...
...
@@ -1009,28 +1008,21 @@ GpStatus WINGDIPAPI GdipBitmapLockBits(GpBitmap* bitmap, GDIPCONST GpRect* rect,
}
stat
=
convert_pixels
(
act_rect
.
Width
,
act_rect
.
Height
,
stride
,
buff
,
format
,
lockeddata
->
Stride
,
lockeddata
->
Scan0
,
format
,
bitmap
->
stride
,
bitmap
->
bits
+
bitmap
->
stride
*
act_rect
.
Y
+
PIXELFORMATBPP
(
bitmap
->
format
)
*
act_rect
.
X
/
8
,
bitmap
->
format
,
bitmap
->
image
.
palette_entries
);
if
(
stat
!=
Ok
)
{
GdipFree
(
buff
);
GdipFree
(
bitmap
->
bitmapbits
);
bitmap
->
bitmapbits
=
NULL
;
return
stat
;
}
}
lockeddata
->
Width
=
act_rect
.
Width
;
lockeddata
->
Height
=
act_rect
.
Height
;
lockeddata
->
PixelFormat
=
format
;
lockeddata
->
Reserved
=
flags
;
lockeddata
->
Stride
=
stride
;
lockeddata
->
Scan0
=
buff
;
bitmap
->
lockmode
=
flags
;
bitmap
->
numlocks
++
;
bitmap
->
bitmapbits
=
buff
;
bitmap
->
lockx
=
act_rect
.
X
;
bitmap
->
locky
=
act_rect
.
Y
;
...
...
@@ -1064,9 +1056,6 @@ GpStatus WINGDIPAPI GdipBitmapUnlockBits(GpBitmap* bitmap,
if
(
!
bitmap
->
lockmode
)
return
WrongState
;
if
(
lockeddata
->
Reserved
&
ImageLockModeUserInputBuf
)
return
NotImplemented
;
if
(
!
(
lockeddata
->
Reserved
&
ImageLockModeWrite
)){
if
(
!
(
--
bitmap
->
numlocks
))
bitmap
->
lockmode
=
0
;
...
...
@@ -1076,7 +1065,7 @@ GpStatus WINGDIPAPI GdipBitmapUnlockBits(GpBitmap* bitmap,
return
Ok
;
}
if
(
!
bitmap
->
bitmapbits
)
if
(
!
bitmap
->
bitmapbits
&&
!
(
lockeddata
->
Reserved
&
ImageLockModeUserInputBuf
)
)
{
/* we passed a direct reference; no need to do anything */
bitmap
->
lockmode
=
0
;
...
...
dlls/gdiplus/tests/image.c
View file @
21d6fc96
...
...
@@ -777,10 +777,10 @@ static void test_LockBits_UserBuf(void)
/* read-only */
stat
=
GdipBitmapLockBits
(
bm
,
&
rect
,
ImageLockModeRead
|
ImageLockModeUserInputBuf
,
PixelFormat32bppARGB
,
&
bd
);
todo_wine
expect
(
Ok
,
stat
);
expect
(
Ok
,
stat
);
expect
(
0xaaaaaaaa
,
bits
[
0
]);
todo_wine
expect
(
0
,
bits
[
2
+
3
*
WIDTH
]);
expect
(
0
,
bits
[
2
+
3
*
WIDTH
]);
bits
[
2
+
3
*
WIDTH
]
=
0xdeadbeef
;
...
...
@@ -795,7 +795,7 @@ static void test_LockBits_UserBuf(void)
/* write-only */
stat
=
GdipBitmapLockBits
(
bm
,
&
rect
,
ImageLockModeWrite
|
ImageLockModeUserInputBuf
,
PixelFormat32bppARGB
,
&
bd
);
todo_wine
expect
(
Ok
,
stat
);
expect
(
Ok
,
stat
);
expect
(
0xdeadbeef
,
bits
[
2
+
3
*
WIDTH
]);
bits
[
2
+
3
*
WIDTH
]
=
0x12345678
;
...
...
@@ -807,15 +807,15 @@ static void test_LockBits_UserBuf(void)
stat
=
GdipBitmapGetPixel
(
bm
,
2
,
3
,
&
color
);
expect
(
Ok
,
stat
);
todo_wine
expect
(
0x12345678
,
color
);
expect
(
0x12345678
,
color
);
bits
[
2
+
3
*
WIDTH
]
=
0
;
/* read/write */
stat
=
GdipBitmapLockBits
(
bm
,
&
rect
,
ImageLockModeRead
|
ImageLockModeWrite
|
ImageLockModeUserInputBuf
,
PixelFormat32bppARGB
,
&
bd
);
todo_wine
expect
(
Ok
,
stat
);
expect
(
Ok
,
stat
);
todo_wine
expect
(
0x12345678
,
bits
[
2
+
3
*
WIDTH
]);
expect
(
0x12345678
,
bits
[
2
+
3
*
WIDTH
]);
bits
[
2
+
3
*
WIDTH
]
=
0xdeadbeef
;
if
(
stat
==
Ok
)
{
...
...
@@ -825,7 +825,7 @@ static void test_LockBits_UserBuf(void)
stat
=
GdipBitmapGetPixel
(
bm
,
2
,
3
,
&
color
);
expect
(
Ok
,
stat
);
todo_wine
expect
(
0xdeadbeef
,
color
);
expect
(
0xdeadbeef
,
color
);
stat
=
GdipDisposeImage
((
GpImage
*
)
bm
);
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