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
24f10907
Commit
24f10907
authored
Aug 30, 2017
by
Changhui Liu
Committed by
Alexandre Julliard
Aug 30, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gdiplus/tests: Add drawing tests for GdipFillRegion with gdi transform.
Signed-off-by:
Vincent Povirk
<
vincent@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
0241da1c
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
245 additions
and
0 deletions
+245
-0
graphics.c
dlls/gdiplus/tests/graphics.c
+245
-0
No files found.
dlls/gdiplus/tests/graphics.c
View file @
24f10907
...
...
@@ -6287,6 +6287,248 @@ static void test_GdipFillRectanglesOnMemoryDCSolidBrush(void)
ReleaseDC
(
hwnd
,
dc
);
}
static
void
test_GdipFillRectanglesOnMemoryDCTextureBrush
(
void
)
{
ARGB
color
[
6
]
=
{
0
,
0
,
0
,
0
,
0
,
0
};
POINT
pt
=
{
0
,
0
};
RECT
rect
=
{
100
,
100
,
180
,
180
};
UINT
width
=
rect
.
right
-
rect
.
left
;
UINT
height
=
rect
.
bottom
-
rect
.
top
;
GpStatus
status
=
0
;
union
{
GpBitmap
*
bitmap
;
GpImage
*
image
;
}
src_img
;
GpTexture
*
brush
=
NULL
;
GpGraphics
*
graphics
=
NULL
;
HDC
dc
=
GetDC
(
hwnd
);
HDC
hdc
=
CreateCompatibleDC
(
dc
);
HBITMAP
bmp
=
CreateCompatibleBitmap
(
dc
,
width
,
height
);
HGDIOBJ
old
=
SelectObject
(
hdc
,
bmp
);
UINT
x
=
0
;
UINT
y
=
0
;
UINT
src_img_width
=
width
/
2
;
UINT
src_img_height
=
height
/
2
;
BYTE
*
src_img_data
=
GdipAlloc
(
src_img_width
*
src_img_height
*
4
);
DWORD
*
pixel
=
(
DWORD
*
)
src_img_data
;
ok
(
pixel
!=
NULL
,
"Expected src_img_data is valid
\n
"
);
/*Change the window origin is the key test point*/
SetWindowOrgEx
(
hdc
,
rect
.
left
,
rect
.
top
,
&
pt
);
/*build a blue solid image!*/
for
(
y
=
0
;
y
<
src_img_height
;
++
y
)
{
for
(
x
=
0
;
x
<
src_img_width
;
++
x
)
{
pixel
[
x
]
=
BLUE_COLOR
;
}
pixel
+=
src_img_width
;
}
status
=
GdipCreateBitmapFromScan0
(
src_img_width
,
src_img_height
,
src_img_width
*
4
,
PixelFormat32bppARGB
,
src_img_data
,
&
src_img
.
bitmap
);
expect
(
Ok
,
status
);
status
=
GdipCreateTexture
(
src_img
.
image
,
0
,
&
brush
);
expect
(
Ok
,
status
);
status
=
GdipCreateFromHDC
(
hdc
,
&
graphics
);
expect
(
Ok
,
status
);
status
=
GdipSetClipRectI
(
graphics
,
rect
.
left
+
width
/
2
,
rect
.
top
+
height
/
2
,
width
,
height
,
CombineModeReplace
);
expect
(
Ok
,
status
);
status
=
GdipFillRectangleI
(
graphics
,
(
GpBrush
*
)
brush
,
0
,
0
,
rect
.
right
,
rect
.
bottom
);
expect
(
Ok
,
status
);
GdipDisposeImage
(
src_img
.
image
);
GdipDeleteBrush
((
GpBrush
*
)
brush
);
GdipDeleteGraphics
(
graphics
);
GdipFree
(
src_img_data
);
pixel
=
GetBitmapPixelBuffer
(
hdc
,
bmp
,
width
,
height
);
if
(
pixel
)
{
color
[
0
]
=
get_bitmap_pixel
(
width
/
2
,
height
/
2
);
color
[
1
]
=
get_bitmap_pixel
(
width
/
2
+
1
,
height
/
2
);
color
[
2
]
=
get_bitmap_pixel
(
width
/
2
,
height
/
2
+
1
);
color
[
3
]
=
get_bitmap_pixel
(
width
/
2
-
1
,
height
/
2
-
1
);
color
[
4
]
=
get_bitmap_pixel
(
width
/
2
-
1
,
height
-
1
);
color
[
5
]
=
get_bitmap_pixel
(
width
-
1
,
height
/
2
-
1
);
}
todo_wine
ok
(
is_blue_color
(
color
[
0
])
&&
is_blue_color
(
color
[
1
])
&&
is_blue_color
(
color
[
2
])
&&
color
[
3
]
==
0
&&
color
[
4
]
==
0
&&
color
[
5
]
==
0
,
"Expected GdipFillRectangleI take effect!
\n
"
);
ReleaseBitmapPixelBuffer
(
pixel
);
SelectObject
(
hdc
,
old
);
DeleteObject
(
bmp
);
DeleteDC
(
hdc
);
ReleaseDC
(
hwnd
,
dc
);
}
static
void
test_GdipFillRectanglesOnBitmapTextureBrush
(
void
)
{
ARGB
color
[
6
]
=
{
0
,
0
,
0
,
0
,
0
,
0
};
UINT
x
=
0
;
UINT
y
=
0
;
RECT
rect
=
{
100
,
100
,
180
,
180
};
UINT
width
=
rect
.
right
-
rect
.
left
;
UINT
height
=
rect
.
bottom
-
rect
.
top
;
UINT
src_img_width
=
width
/
2
;
UINT
src_img_height
=
height
/
2
;
GpStatus
status
=
0
;
union
{
GpBitmap
*
bitmap
;
GpImage
*
image
;
}
src_img
;
union
{
GpBitmap
*
bitmap
;
GpImage
*
image
;
}
dst_img
;
GpTexture
*
brush
=
NULL
;
GpGraphics
*
graphics
=
NULL
;
BYTE
*
src_img_data
=
GdipAlloc
(
src_img_width
*
src_img_height
*
4
);
DWORD
*
pixel
=
(
DWORD
*
)
src_img_data
;
ok
(
pixel
!=
NULL
,
"Expected src_img_data is valid
\n
"
);
status
=
GdipCreateBitmapFromScan0
(
width
,
height
,
width
*
4
,
PixelFormat32bppARGB
,
NULL
,
&
dst_img
.
bitmap
);
expect
(
Ok
,
status
);
/*build a blue solid image!*/
for
(
y
=
0
;
y
<
src_img_height
;
++
y
)
{
for
(
x
=
0
;
x
<
src_img_width
;
++
x
)
{
pixel
[
x
]
=
BLUE_COLOR
;
}
pixel
+=
src_img_width
;
}
status
=
GdipCreateBitmapFromScan0
(
src_img_width
,
src_img_height
,
src_img_width
*
4
,
PixelFormat32bppARGB
,
src_img_data
,
&
src_img
.
bitmap
);
expect
(
Ok
,
status
);
status
=
GdipCreateTexture
(
src_img
.
image
,
0
,
&
brush
);
expect
(
Ok
,
status
);
status
=
GdipGetImageGraphicsContext
(
dst_img
.
image
,
&
graphics
);
expect
(
Ok
,
status
);
status
=
GdipSetClipRectI
(
graphics
,
0
,
0
,
width
,
height
,
CombineModeReplace
);
expect
(
Ok
,
status
);
status
=
GdipFillRectangleI
(
graphics
,
(
GpBrush
*
)
brush
,
0
,
0
,
width
/
2
,
height
/
2
);
expect
(
Ok
,
status
);
GdipDeleteBrush
((
GpBrush
*
)
brush
);
GdipDeleteGraphics
(
graphics
);
GdipBitmapGetPixel
(
dst_img
.
bitmap
,
0
,
0
,
&
color
[
0
]);
GdipBitmapGetPixel
(
dst_img
.
bitmap
,
0
,
1
,
&
color
[
1
]);
GdipBitmapGetPixel
(
dst_img
.
bitmap
,
1
,
0
,
&
color
[
2
]);
GdipBitmapGetPixel
(
dst_img
.
bitmap
,
width
/
2
,
0
,
&
color
[
3
]);
GdipBitmapGetPixel
(
dst_img
.
bitmap
,
width
/
2
,
height
/
2
,
&
color
[
4
]);
GdipBitmapGetPixel
(
dst_img
.
bitmap
,
0
,
height
/
2
,
&
color
[
5
]);
ok
(
is_blue_color
(
color
[
0
])
&&
is_blue_color
(
color
[
1
])
&&
is_blue_color
(
color
[
2
])
&&
color
[
3
]
==
0
&&
color
[
4
]
==
0
&&
color
[
5
]
==
0
,
"Expected GdipFillRectangleI take effect!
\n
"
);
GdipDisposeImage
(
src_img
.
image
);
GdipDisposeImage
(
dst_img
.
image
);
GdipFree
(
src_img_data
);
}
static
void
test_GdipDrawImagePointsRectOnMemoryDC
(
void
)
{
ARGB
color
[
6
]
=
{
0
,
0
,
0
,
0
,
0
,
0
};
POINT
pt
=
{
0
,
0
};
RECT
rect
=
{
100
,
100
,
180
,
180
};
UINT
width
=
rect
.
right
-
rect
.
left
;
UINT
height
=
rect
.
bottom
-
rect
.
top
;
GpStatus
status
=
0
;
union
{
GpBitmap
*
bitmap
;
GpImage
*
image
;
}
src_img
;
GpGraphics
*
graphics
=
NULL
;
HDC
dc
=
GetDC
(
hwnd
);
HDC
hdc
=
CreateCompatibleDC
(
dc
);
HBITMAP
bmp
=
CreateCompatibleBitmap
(
dc
,
width
,
height
);
HGDIOBJ
old
=
SelectObject
(
hdc
,
bmp
);
UINT
x
=
0
;
UINT
y
=
0
;
UINT
src_img_width
=
width
/
2
;
UINT
src_img_height
=
height
/
2
;
BYTE
*
src_img_data
=
GdipAlloc
(
src_img_width
*
src_img_height
*
4
);
DWORD
*
pixel
=
(
DWORD
*
)
src_img_data
;
ok
(
pixel
!=
NULL
,
"Expected src_img_data is valid
\n
"
);
/*Change the window origin is the key test point*/
SetWindowOrgEx
(
hdc
,
rect
.
left
,
rect
.
top
,
&
pt
);
/*build a blue solid image!*/
for
(
y
=
0
;
y
<
src_img_height
;
++
y
)
{
for
(
x
=
0
;
x
<
src_img_width
;
++
x
)
{
pixel
[
x
]
=
BLUE_COLOR
;
}
pixel
+=
src_img_width
;
}
status
=
GdipCreateBitmapFromScan0
(
src_img_width
,
src_img_height
,
src_img_width
*
4
,
PixelFormat32bppARGB
,
src_img_data
,
&
src_img
.
bitmap
);
expect
(
Ok
,
status
);
status
=
GdipCreateFromHDC
(
hdc
,
&
graphics
);
expect
(
Ok
,
status
);
status
=
GdipDrawImageRectRectI
(
graphics
,
src_img
.
image
,
rect
.
left
+
width
/
2
,
rect
.
top
+
height
/
2
,
width
/
2
,
height
/
2
,
0
,
0
,
src_img_width
,
src_img_height
,
UnitPixel
,
NULL
,
NULL
,
NULL
);
expect
(
Ok
,
status
);
GdipDisposeImage
(
src_img
.
image
);
GdipDeleteGraphics
(
graphics
);
GdipFree
(
src_img_data
);
pixel
=
GetBitmapPixelBuffer
(
hdc
,
bmp
,
width
,
height
);
if
(
pixel
)
{
color
[
0
]
=
get_bitmap_pixel
(
width
/
2
,
height
/
2
);
color
[
1
]
=
get_bitmap_pixel
(
width
/
2
+
1
,
height
/
2
);
color
[
2
]
=
get_bitmap_pixel
(
width
/
2
,
height
/
2
+
1
);
color
[
3
]
=
get_bitmap_pixel
(
width
/
2
-
1
,
height
/
2
-
1
);
color
[
4
]
=
get_bitmap_pixel
(
width
/
2
-
1
,
height
-
1
);
color
[
5
]
=
get_bitmap_pixel
(
width
-
1
,
height
/
2
-
1
);
}
ok
(
is_blue_color
(
color
[
0
])
&&
is_blue_color
(
color
[
1
])
&&
is_blue_color
(
color
[
2
])
&&
color
[
3
]
==
0
&&
color
[
4
]
==
0
&&
color
[
5
]
==
0
,
"Expected GdipDrawImageRectRectI take effect!
\n
"
);
ReleaseBitmapPixelBuffer
(
pixel
);
SelectObject
(
hdc
,
old
);
DeleteObject
(
bmp
);
DeleteDC
(
hdc
);
ReleaseDC
(
hwnd
,
dc
);
}
START_TEST
(
graphics
)
{
struct
GdiplusStartupInput
gdiplusStartupInput
;
...
...
@@ -6371,6 +6613,9 @@ START_TEST(graphics)
test_GdipFillRectangles
();
test_GdipGetVisibleClipBounds_memoryDC
();
test_GdipFillRectanglesOnMemoryDCSolidBrush
();
test_GdipFillRectanglesOnMemoryDCTextureBrush
();
test_GdipFillRectanglesOnBitmapTextureBrush
();
test_GdipDrawImagePointsRectOnMemoryDC
();
test_container_rects
();
test_GdipGraphicsSetAbort
();
...
...
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