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
88ce0310
Commit
88ce0310
authored
Feb 14, 2011
by
Vincent Povirk
Committed by
Alexandre Julliard
Feb 15, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gdiplus: Add tests for locked image bit reading/writing.
parent
732aa89c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
104 additions
and
0 deletions
+104
-0
image.c
dlls/gdiplus/tests/image.c
+104
-0
No files found.
dlls/gdiplus/tests/image.c
View file @
88ce0310
...
...
@@ -516,6 +516,7 @@ static void test_LockBits(void)
GpRect
rect
;
BitmapData
bd
;
const
INT
WIDTH
=
10
,
HEIGHT
=
20
;
ARGB
color
;
bm
=
NULL
;
stat
=
GdipCreateBitmapFromScan0
(
WIDTH
,
HEIGHT
,
0
,
PixelFormat24bppRGB
,
NULL
,
&
bm
);
...
...
@@ -526,15 +527,33 @@ static void test_LockBits(void)
rect
.
Width
=
4
;
rect
.
Height
=
5
;
stat
=
GdipBitmapSetPixel
(
bm
,
2
,
3
,
0xffc30000
);
expect
(
Ok
,
stat
);
stat
=
GdipBitmapSetPixel
(
bm
,
2
,
8
,
0xff480000
);
expect
(
Ok
,
stat
);
/* read-only */
stat
=
GdipBitmapLockBits
(
bm
,
&
rect
,
ImageLockModeRead
,
PixelFormat24bppRGB
,
&
bd
);
expect
(
Ok
,
stat
);
if
(
stat
==
Ok
)
{
expect
(
0xc3
,
((
BYTE
*
)
bd
.
Scan0
)[
2
]);
expect
(
0x48
,
((
BYTE
*
)
bd
.
Scan0
)[
2
+
bd
.
Stride
*
5
]);
((
char
*
)
bd
.
Scan0
)[
2
]
=
0xff
;
stat
=
GdipBitmapUnlockBits
(
bm
,
&
bd
);
expect
(
Ok
,
stat
);
}
stat
=
GdipBitmapGetPixel
(
bm
,
2
,
3
,
&
color
);
expect
(
Ok
,
stat
);
expect
(
0xffff0000
,
color
);
stat
=
GdipBitmapSetPixel
(
bm
,
2
,
3
,
0xffc30000
);
expect
(
Ok
,
stat
);
/* read-only, with NULL rect -> whole bitmap lock */
stat
=
GdipBitmapLockBits
(
bm
,
NULL
,
ImageLockModeRead
,
PixelFormat24bppRGB
,
&
bd
);
expect
(
Ok
,
stat
);
...
...
@@ -542,10 +561,16 @@ static void test_LockBits(void)
expect
(
bd
.
Height
,
HEIGHT
);
if
(
stat
==
Ok
)
{
((
char
*
)
bd
.
Scan0
)[
2
+
2
*
3
+
3
*
bd
.
Stride
]
=
0xff
;
stat
=
GdipBitmapUnlockBits
(
bm
,
&
bd
);
expect
(
Ok
,
stat
);
}
stat
=
GdipBitmapGetPixel
(
bm
,
2
,
3
,
&
color
);
expect
(
Ok
,
stat
);
expect
(
0xffff0000
,
color
);
/* read-only, consecutive */
stat
=
GdipBitmapLockBits
(
bm
,
&
rect
,
ImageLockModeRead
,
PixelFormat24bppRGB
,
&
bd
);
expect
(
Ok
,
stat
);
...
...
@@ -574,6 +599,81 @@ static void test_LockBits(void)
stat
=
GdipCreateBitmapFromScan0
(
WIDTH
,
HEIGHT
,
0
,
PixelFormat24bppRGB
,
NULL
,
&
bm
);
expect
(
Ok
,
stat
);
stat
=
GdipBitmapSetPixel
(
bm
,
2
,
3
,
0xffff0000
);
expect
(
Ok
,
stat
);
stat
=
GdipBitmapSetPixel
(
bm
,
2
,
8
,
0xffc30000
);
expect
(
Ok
,
stat
);
/* write, no conversion */
stat
=
GdipBitmapLockBits
(
bm
,
&
rect
,
ImageLockModeWrite
,
PixelFormat24bppRGB
,
&
bd
);
expect
(
Ok
,
stat
);
if
(
stat
==
Ok
)
{
/* all bits are readable, inside the rect or not */
expect
(
0xff
,
((
BYTE
*
)
bd
.
Scan0
)[
2
]);
expect
(
0xc3
,
((
BYTE
*
)
bd
.
Scan0
)[
2
+
bd
.
Stride
*
5
]);
stat
=
GdipBitmapUnlockBits
(
bm
,
&
bd
);
expect
(
Ok
,
stat
);
}
/* read, conversion */
stat
=
GdipBitmapLockBits
(
bm
,
&
rect
,
ImageLockModeRead
,
PixelFormat32bppARGB
,
&
bd
);
expect
(
Ok
,
stat
);
if
(
stat
==
Ok
)
{
expect
(
0xff
,
((
BYTE
*
)
bd
.
Scan0
)[
2
]);
if
(
0
)
/* Areas outside the rectangle appear to be uninitialized */
ok
(
0xc3
!=
((
BYTE
*
)
bd
.
Scan0
)[
2
+
bd
.
Stride
*
5
],
"original image bits are readable
\n
"
);
((
BYTE
*
)
bd
.
Scan0
)[
2
]
=
0xc3
;
stat
=
GdipBitmapUnlockBits
(
bm
,
&
bd
);
expect
(
Ok
,
stat
);
}
/* writes do not work in read mode if there was a conversion */
stat
=
GdipBitmapGetPixel
(
bm
,
2
,
3
,
&
color
);
expect
(
Ok
,
stat
);
expect
(
0xffff0000
,
color
);
/* read/write, conversion */
stat
=
GdipBitmapLockBits
(
bm
,
&
rect
,
ImageLockModeRead
|
ImageLockModeWrite
,
PixelFormat32bppARGB
,
&
bd
);
expect
(
Ok
,
stat
);
if
(
stat
==
Ok
)
{
expect
(
0xff
,
((
BYTE
*
)
bd
.
Scan0
)[
2
]);
if
(
0
)
/* Areas outside the rectangle appear to be uninitialized */
ok
(
0xc3
!=
((
BYTE
*
)
bd
.
Scan0
)[
2
+
bd
.
Stride
*
5
],
"original image bits are readable
\n
"
);
stat
=
GdipBitmapUnlockBits
(
bm
,
&
bd
);
expect
(
Ok
,
stat
);
}
/* write, conversion */
stat
=
GdipBitmapLockBits
(
bm
,
&
rect
,
ImageLockModeWrite
,
PixelFormat32bppARGB
,
&
bd
);
expect
(
Ok
,
stat
);
if
(
stat
==
Ok
)
{
if
(
0
)
{
/* This is completely uninitialized. */
ok
(
0xff
!=
((
BYTE
*
)
bd
.
Scan0
)[
2
],
"original image bits are readable
\n
"
);
ok
(
0xc3
!=
((
BYTE
*
)
bd
.
Scan0
)[
2
+
bd
.
Stride
*
5
],
"original image bits are readable
\n
"
);
}
stat
=
GdipBitmapUnlockBits
(
bm
,
&
bd
);
expect
(
Ok
,
stat
);
}
stat
=
GdipDisposeImage
((
GpImage
*
)
bm
);
expect
(
Ok
,
stat
);
stat
=
GdipCreateBitmapFromScan0
(
WIDTH
,
HEIGHT
,
0
,
PixelFormat24bppRGB
,
NULL
,
&
bm
);
expect
(
Ok
,
stat
);
/* write, no modification */
stat
=
GdipBitmapLockBits
(
bm
,
&
rect
,
ImageLockModeWrite
,
PixelFormat24bppRGB
,
&
bd
);
expect
(
Ok
,
stat
);
...
...
@@ -609,6 +709,10 @@ static void test_LockBits(void)
expect
(
Ok
,
stat
);
}
stat
=
GdipBitmapGetPixel
(
bm
,
2
,
3
,
&
color
);
expect
(
Ok
,
stat
);
expect
(
0xffff0000
,
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