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
01d4767a
Commit
01d4767a
authored
Aug 16, 2017
by
Henri Verbeet
Committed by
Alexandre Julliard
Aug 18, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d2d1/tests: Add a test for bezier intersections.
Signed-off-by:
Henri Verbeet
<
hverbeet@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
0ede13e1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
164 additions
and
0 deletions
+164
-0
d2d1.c
dlls/d2d1/tests/d2d1.c
+164
-0
No files found.
dlls/d2d1/tests/d2d1.c
View file @
01d4767a
...
...
@@ -196,6 +196,19 @@ static void quadratic_to(ID2D1GeometrySink *sink, float x1, float y1, float x2,
ID2D1GeometrySink_AddQuadraticBezier
(
sink
,
&
quadratic
);
}
static
void
cubic_to
(
ID2D1GeometrySink
*
sink
,
float
x1
,
float
y1
,
float
x2
,
float
y2
,
float
x3
,
float
y3
)
{
D2D1_BEZIER_SEGMENT
b
;
b
.
point1
.
x
=
x1
;
b
.
point1
.
y
=
y1
;
b
.
point2
.
x
=
x2
;
b
.
point2
.
y
=
y2
;
b
.
point3
.
x
=
x3
;
b
.
point3
.
y
=
y3
;
ID2D1GeometrySink_AddBezier
(
sink
,
&
b
);
}
static
BOOL
compare_float
(
float
f
,
float
g
,
unsigned
int
ulps
)
{
int
x
=
*
(
int
*
)
&
f
;
...
...
@@ -5545,6 +5558,156 @@ static void test_layer(void)
DestroyWindow
(
window
);
}
static
void
test_bezier_intersect
(
void
)
{
D2D1_POINT_2F
point
=
{
0
.
0
f
,
0
.
0
f
};
ID2D1SolidColorBrush
*
brush
;
ID2D1PathGeometry
*
geometry
;
IDXGISwapChain
*
swapchain
;
ID2D1GeometrySink
*
sink
;
ID2D1RenderTarget
*
rt
;
ID3D10Device1
*
device
;
IDXGISurface
*
surface
;
ID2D1Factory
*
factory
;
D2D1_COLOR_F
color
;
ULONG
refcount
;
HWND
window
;
HRESULT
hr
;
BOOL
match
;
if
(
!
(
device
=
create_device
()))
{
skip
(
"Failed to create device, skipping tests.
\n
"
);
return
;
}
window
=
create_window
();
swapchain
=
create_swapchain
(
device
,
window
,
TRUE
);
hr
=
IDXGISwapChain_GetBuffer
(
swapchain
,
0
,
&
IID_IDXGISurface
,
(
void
**
)
&
surface
);
ok
(
SUCCEEDED
(
hr
),
"Failed to get buffer, hr %#x.
\n
"
,
hr
);
rt
=
create_render_target
(
surface
);
ok
(
!!
rt
,
"Failed to create render target.
\n
"
);
ID2D1RenderTarget_GetFactory
(
rt
,
&
factory
);
ID2D1RenderTarget_SetDpi
(
rt
,
192
.
0
f
,
48
.
0
f
);
ID2D1RenderTarget_SetAntialiasMode
(
rt
,
D2D1_ANTIALIAS_MODE_ALIASED
);
set_color
(
&
color
,
0
.
890
f
,
0
.
851
f
,
0
.
600
f
,
1
.
0
f
);
hr
=
ID2D1RenderTarget_CreateSolidColorBrush
(
rt
,
&
color
,
NULL
,
&
brush
);
ok
(
SUCCEEDED
(
hr
),
"Failed to create brush, hr %#x.
\n
"
,
hr
);
hr
=
ID2D1Factory_CreatePathGeometry
(
factory
,
&
geometry
);
ok
(
SUCCEEDED
(
hr
),
"Failed to create path geometry, hr %#x.
\n
"
,
hr
);
hr
=
ID2D1PathGeometry_Open
(
geometry
,
&
sink
);
ok
(
SUCCEEDED
(
hr
),
"Failed to open geometry sink, hr %#x.
\n
"
,
hr
);
set_point
(
&
point
,
160
.
0
f
,
720
.
0
f
);
ID2D1GeometrySink_BeginFigure
(
sink
,
point
,
D2D1_FIGURE_BEGIN_FILLED
);
cubic_to
(
sink
,
119
.
0
f
,
720
.
0
f
,
83
.
0
f
,
600
.
0
f
,
80
.
0
f
,
474
.
0
f
);
cubic_to
(
sink
,
78
.
0
f
,
349
.
0
f
,
108
.
0
f
,
245
.
0
f
,
135
.
0
f
,
240
.
0
f
);
cubic_to
(
sink
,
163
.
0
f
,
235
.
0
f
,
180
.
0
f
,
318
.
0
f
,
176
.
0
f
,
370
.
0
f
);
cubic_to
(
sink
,
171
.
0
f
,
422
.
0
f
,
149
.
0
f
,
422
.
0
f
,
144
.
0
f
,
370
.
0
f
);
cubic_to
(
sink
,
140
.
0
f
,
318
.
0
f
,
157
.
0
f
,
235
.
0
f
,
185
.
0
f
,
240
.
0
f
);
cubic_to
(
sink
,
212
.
0
f
,
245
.
0
f
,
242
.
0
f
,
349
.
0
f
,
240
.
0
f
,
474
.
0
f
);
cubic_to
(
sink
,
238
.
0
f
,
600
.
0
f
,
201
.
0
f
,
720
.
0
f
,
160
.
0
f
,
720
.
0
f
);
ID2D1GeometrySink_EndFigure
(
sink
,
D2D1_FIGURE_END_CLOSED
);
set_point
(
&
point
,
160
.
0
f
,
240
.
0
f
);
ID2D1GeometrySink_BeginFigure
(
sink
,
point
,
D2D1_FIGURE_BEGIN_FILLED
);
line_to
(
sink
,
240
.
0
f
,
240
.
0
f
);
line_to
(
sink
,
240
.
0
f
,
720
.
0
f
);
line_to
(
sink
,
160
.
0
f
,
720
.
0
f
);
ID2D1GeometrySink_EndFigure
(
sink
,
D2D1_FIGURE_END_CLOSED
);
hr
=
ID2D1GeometrySink_Close
(
sink
);
ok
(
SUCCEEDED
(
hr
),
"Failed to close geometry sink, hr %#x.
\n
"
,
hr
);
ID2D1GeometrySink_Release
(
sink
);
ID2D1RenderTarget_BeginDraw
(
rt
);
set_color
(
&
color
,
0
.
396
f
,
0
.
180
f
,
0
.
537
f
,
1
.
0
f
);
ID2D1RenderTarget_Clear
(
rt
,
&
color
);
ID2D1RenderTarget_FillGeometry
(
rt
,
(
ID2D1Geometry
*
)
geometry
,
(
ID2D1Brush
*
)
brush
,
NULL
);
hr
=
ID2D1RenderTarget_EndDraw
(
rt
,
NULL
,
NULL
);
ok
(
SUCCEEDED
(
hr
),
"Failed to end draw, hr %#x.
\n
"
,
hr
);
ID2D1PathGeometry_Release
(
geometry
);
match
=
compare_figure
(
surface
,
160
,
120
,
320
,
240
,
0xff652e89
,
2048
,
"aRQjIxRpYiIcHCJiXSwXFyxdWTQTEzRZVTsQEDtVUkIMDEJST0cKCkdPTUsICEtNSlEFBVFKSFUD"
"A1VIRlkBAVlGRFsBAVtEQlwCAlxCQFwEBFxAPl0FBV0+PF0HB108Ol4ICF46OV0KCl05N14LC143"
"Nl4MDF42NF8NDV80M14PD14zMV8QEF8xMF8REV8wL18SEl8vLWATE2AtLGAUFGAsK2EUFGErKWIV"
"FWIpKGIWFmIoJ2IXF2InJmIYGGImJWMYGGMlJGMZGWMkI2MaGmMjImQaGmQiIWQbG2QhIGQcHGQg"
"H2UcHGUfHmUdHWUeHWYdHWYdHGcdHWccG2ceHmcbGmgeHmgaGWgfH2gZGWgfH2gZGGkfH2kYF2kg"
"IGkXFmogIGoWFmogIGoWFWsgIGsVFGshIWsUE2whIWwTE2whIWwTEm0hIW0SEW4hIW4REW4hIW4R"
"EG8hIW8QD3AhIXAPD3AhIXAPDnEhIXEODnEhIXEODXIhIXINDHQgIHQMDHQgIHQMC3UgIHULC3Yf"
"H3YLCncfH3cKCngeHngKCXkeHnkJCXodHXoJCXscHHsJCHwcHHwICH0bG30IB38aGn8HB4ABGRmA"
"AQcHgQEYGIEBBwaEARYWhAEGBoUBFRWFAQYFiAETE4gBBQWKARERigEFBYwBDw+MAQUEkAEMDJAB"
"BASTAQkJkwEEBJwBnAEEA50BnQEDA50BnQEDA50BnQEDA50BnQEDAp4BngECAp4BngECAp4BngEC"
"Ap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ok
(
match
,
"Figure does not match.
\n
"
);
hr
=
ID2D1Factory_CreatePathGeometry
(
factory
,
&
geometry
);
ok
(
SUCCEEDED
(
hr
),
"Failed to create path geometry, hr %#x.
\n
"
,
hr
);
hr
=
ID2D1PathGeometry_Open
(
geometry
,
&
sink
);
ok
(
SUCCEEDED
(
hr
),
"Failed to open geometry sink, hr %#x.
\n
"
,
hr
);
set_point
(
&
point
,
240
.
0
f
,
720
.
0
f
);
ID2D1GeometrySink_BeginFigure
(
sink
,
point
,
D2D1_FIGURE_BEGIN_FILLED
);
cubic_to
(
sink
,
152
.
0
f
,
720
.
0
f
,
80
.
0
f
,
613
.
0
f
,
80
.
0
f
,
480
.
0
f
);
cubic_to
(
sink
,
80
.
0
f
,
347
.
0
f
,
152
.
0
f
,
240
.
0
f
,
240
.
0
f
,
240
.
0
f
);
cubic_to
(
sink
,
152
.
0
f
,
339
.
0
f
,
134
.
0
f
,
528
.
0
f
,
200
.
0
f
,
660
.
0
f
);
cubic_to
(
sink
,
212
.
0
f
,
683
.
0
f
,
225
.
0
f
,
703
.
0
f
,
240
.
0
f
,
720
.
0
f
);
ID2D1GeometrySink_EndFigure
(
sink
,
D2D1_FIGURE_END_CLOSED
);
hr
=
ID2D1GeometrySink_Close
(
sink
);
ok
(
SUCCEEDED
(
hr
),
"Failed to close geometry sink, hr %#x.
\n
"
,
hr
);
ID2D1GeometrySink_Release
(
sink
);
ID2D1RenderTarget_BeginDraw
(
rt
);
ID2D1RenderTarget_Clear
(
rt
,
&
color
);
ID2D1RenderTarget_FillGeometry
(
rt
,
(
ID2D1Geometry
*
)
geometry
,
(
ID2D1Brush
*
)
brush
,
NULL
);
hr
=
ID2D1RenderTarget_EndDraw
(
rt
,
NULL
,
NULL
);
ok
(
SUCCEEDED
(
hr
),
"Failed to end draw, hr %#x.
\n
"
,
hr
);
ID2D1PathGeometry_Release
(
geometry
);
match
=
compare_figure
(
surface
,
160
,
120
,
320
,
240
,
0xff652e89
,
2048
,
"pQIZkg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tAGNAbUBjQG2AYwBtgGLAbgBigG4AYoBuQGJAboBhwG7"
"AYcBvAGGAb0BhQG+AYQBvwGDAcABggHBAYIBwgGAAcMBf8QBfsYBfMgBe8gBesoBeMwBd80BddAB"
"c9EBcdQBb9YBbNkBatsBaN0BZeEBYuQBX+gBW+0BVvEBUvUBTvwBR4QCQIoCOZgCK6oCGQIA"
);
todo_wine
ok
(
match
,
"Figure does not match.
\n
"
);
ID2D1SolidColorBrush_Release
(
brush
);
ID2D1RenderTarget_Release
(
rt
);
refcount
=
ID2D1Factory_Release
(
factory
);
ok
(
!
refcount
,
"Factory has %u references left.
\n
"
,
refcount
);
IDXGISurface_Release
(
surface
);
IDXGISwapChain_Release
(
swapchain
);
ID3D10Device1_Release
(
device
);
DestroyWindow
(
window
);
}
START_TEST
(
d2d1
)
{
test_clip
();
...
...
@@ -5570,4 +5733,5 @@ START_TEST(d2d1)
test_draw_geometry
();
test_gdi_interop
();
test_layer
();
test_bezier_intersect
();
}
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