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
ddec784a
Commit
ddec784a
authored
Jul 10, 2015
by
Henri Verbeet
Committed by
Alexandre Julliard
Jul 10, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d2d1: Implement d2d_geometry_sink_BeginFigure() and d2d_geometry_sink_EndFigure().
parent
2f6f8f12
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
99 additions
and
0 deletions
+99
-0
d2d1_private.h
dlls/d2d1/d2d1_private.h
+2
-0
geometry.c
dlls/d2d1/geometry.c
+42
-0
d2d1.c
dlls/d2d1/tests/d2d1.c
+55
-0
No files found.
dlls/d2d1/d2d1_private.h
View file @
ddec784a
...
...
@@ -192,8 +192,10 @@ struct d2d_state_block *unsafe_impl_from_ID2D1DrawingStateBlock(ID2D1DrawingStat
enum
d2d_geometry_state
{
D2D_GEOMETRY_STATE_INITIAL
=
0
,
D2D_GEOMETRY_STATE_ERROR
,
D2D_GEOMETRY_STATE_OPEN
,
D2D_GEOMETRY_STATE_CLOSED
,
D2D_GEOMETRY_STATE_FIGURE
,
};
struct
d2d_geometry
...
...
dlls/d2d1/geometry.c
View file @
ddec784a
...
...
@@ -78,25 +78,53 @@ static void STDMETHODCALLTYPE d2d_geometry_sink_SetSegmentFlags(ID2D1GeometrySin
static
void
STDMETHODCALLTYPE
d2d_geometry_sink_BeginFigure
(
ID2D1GeometrySink
*
iface
,
D2D1_POINT_2F
start_point
,
D2D1_FIGURE_BEGIN
figure_begin
)
{
struct
d2d_geometry
*
geometry
=
impl_from_ID2D1GeometrySink
(
iface
);
FIXME
(
"iface %p, start_point {%.8e, %.8e}, figure_begin %#x stub!
\n
"
,
iface
,
start_point
.
x
,
start_point
.
y
,
figure_begin
);
if
(
geometry
->
state
!=
D2D_GEOMETRY_STATE_OPEN
)
{
geometry
->
state
=
D2D_GEOMETRY_STATE_ERROR
;
return
;
}
geometry
->
state
=
D2D_GEOMETRY_STATE_FIGURE
;
}
static
void
STDMETHODCALLTYPE
d2d_geometry_sink_AddLines
(
ID2D1GeometrySink
*
iface
,
const
D2D1_POINT_2F
*
points
,
UINT32
count
)
{
struct
d2d_geometry
*
geometry
=
impl_from_ID2D1GeometrySink
(
iface
);
FIXME
(
"iface %p, points %p, count %u stub!
\n
"
,
iface
,
points
,
count
);
if
(
geometry
->
state
!=
D2D_GEOMETRY_STATE_FIGURE
)
geometry
->
state
=
D2D_GEOMETRY_STATE_ERROR
;
}
static
void
STDMETHODCALLTYPE
d2d_geometry_sink_AddBeziers
(
ID2D1GeometrySink
*
iface
,
const
D2D1_BEZIER_SEGMENT
*
beziers
,
UINT32
count
)
{
struct
d2d_geometry
*
geometry
=
impl_from_ID2D1GeometrySink
(
iface
);
FIXME
(
"iface %p, beziers %p, count %u stub!
\n
"
,
iface
,
beziers
,
count
);
if
(
geometry
->
state
!=
D2D_GEOMETRY_STATE_FIGURE
)
geometry
->
state
=
D2D_GEOMETRY_STATE_ERROR
;
}
static
void
STDMETHODCALLTYPE
d2d_geometry_sink_EndFigure
(
ID2D1GeometrySink
*
iface
,
D2D1_FIGURE_END
figure_end
)
{
struct
d2d_geometry
*
geometry
=
impl_from_ID2D1GeometrySink
(
iface
);
FIXME
(
"iface %p, figure_end %#x stub!
\n
"
,
iface
,
figure_end
);
if
(
geometry
->
state
!=
D2D_GEOMETRY_STATE_FIGURE
)
{
geometry
->
state
=
D2D_GEOMETRY_STATE_ERROR
;
return
;
}
geometry
->
state
=
D2D_GEOMETRY_STATE_OPEN
;
}
static
HRESULT
STDMETHODCALLTYPE
d2d_geometry_sink_Close
(
ID2D1GeometrySink
*
iface
)
...
...
@@ -106,7 +134,11 @@ static HRESULT STDMETHODCALLTYPE d2d_geometry_sink_Close(ID2D1GeometrySink *ifac
TRACE
(
"iface %p.
\n
"
,
iface
);
if
(
geometry
->
state
!=
D2D_GEOMETRY_STATE_OPEN
)
{
if
(
geometry
->
state
!=
D2D_GEOMETRY_STATE_CLOSED
)
geometry
->
state
=
D2D_GEOMETRY_STATE_ERROR
;
return
D2DERR_WRONG_STATE
;
}
geometry
->
state
=
D2D_GEOMETRY_STATE_CLOSED
;
return
S_OK
;
...
...
@@ -137,12 +169,22 @@ static void STDMETHODCALLTYPE d2d_geometry_sink_AddQuadraticBezier(ID2D1Geometry
static
void
STDMETHODCALLTYPE
d2d_geometry_sink_AddQuadraticBeziers
(
ID2D1GeometrySink
*
iface
,
const
D2D1_QUADRATIC_BEZIER_SEGMENT
*
beziers
,
UINT32
bezier_count
)
{
struct
d2d_geometry
*
geometry
=
impl_from_ID2D1GeometrySink
(
iface
);
FIXME
(
"iface %p, beziers %p, bezier_count %u stub!
\n
"
,
iface
,
beziers
,
bezier_count
);
if
(
geometry
->
state
!=
D2D_GEOMETRY_STATE_FIGURE
)
geometry
->
state
=
D2D_GEOMETRY_STATE_ERROR
;
}
static
void
STDMETHODCALLTYPE
d2d_geometry_sink_AddArc
(
ID2D1GeometrySink
*
iface
,
const
D2D1_ARC_SEGMENT
*
arc
)
{
struct
d2d_geometry
*
geometry
=
impl_from_ID2D1GeometrySink
(
iface
);
FIXME
(
"iface %p, arc %p stub!
\n
"
,
iface
,
arc
);
if
(
geometry
->
state
!=
D2D_GEOMETRY_STATE_FIGURE
)
geometry
->
state
=
D2D_GEOMETRY_STATE_ERROR
;
}
struct
ID2D1GeometrySinkVtbl
d2d_geometry_sink_vtbl
=
...
...
dlls/d2d1/tests/d2d1.c
View file @
ddec784a
...
...
@@ -876,6 +876,7 @@ static void test_bitmap_brush(void)
static
void
test_path_geometry
(
void
)
{
ID2D1GeometrySink
*
sink
,
*
tmp_sink
;
D2D1_POINT_2F
point
=
{
0
.
0
f
,
0
.
0
f
};
ID2D1PathGeometry
*
geometry
;
IDXGISwapChain
*
swapchain
;
ID2D1RenderTarget
*
rt
;
...
...
@@ -936,6 +937,60 @@ static void test_path_geometry(void)
ID2D1GeometrySink_Release
(
sink
);
ID2D1PathGeometry_Release
(
geometry
);
/* BeginFigure() without EndFigure(). */
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
);
ID2D1GeometrySink_BeginFigure
(
sink
,
point
,
D2D1_FIGURE_BEGIN_FILLED
);
hr
=
ID2D1GeometrySink_Close
(
sink
);
ok
(
hr
==
D2DERR_WRONG_STATE
,
"Got unexpected hr %#x.
\n
"
,
hr
);
ID2D1GeometrySink_EndFigure
(
sink
,
D2D1_FIGURE_END_CLOSED
);
hr
=
ID2D1GeometrySink_Close
(
sink
);
ok
(
hr
==
D2DERR_WRONG_STATE
,
"Got unexpected hr %#x.
\n
"
,
hr
);
ID2D1GeometrySink_Release
(
sink
);
ID2D1PathGeometry_Release
(
geometry
);
/* EndFigure() without BeginFigure(). */
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
);
ID2D1GeometrySink_EndFigure
(
sink
,
D2D1_FIGURE_END_CLOSED
);
hr
=
ID2D1GeometrySink_Close
(
sink
);
ok
(
hr
==
D2DERR_WRONG_STATE
,
"Got unexpected hr %#x.
\n
"
,
hr
);
ID2D1GeometrySink_Release
(
sink
);
ID2D1PathGeometry_Release
(
geometry
);
/* BeginFigure()/EndFigure() mismatch. */
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
);
ID2D1GeometrySink_BeginFigure
(
sink
,
point
,
D2D1_FIGURE_BEGIN_FILLED
);
ID2D1GeometrySink_BeginFigure
(
sink
,
point
,
D2D1_FIGURE_BEGIN_FILLED
);
ID2D1GeometrySink_EndFigure
(
sink
,
D2D1_FIGURE_END_CLOSED
);
ID2D1GeometrySink_EndFigure
(
sink
,
D2D1_FIGURE_END_CLOSED
);
hr
=
ID2D1GeometrySink_Close
(
sink
);
ok
(
hr
==
D2DERR_WRONG_STATE
,
"Got unexpected hr %#x.
\n
"
,
hr
);
ID2D1GeometrySink_EndFigure
(
sink
,
D2D1_FIGURE_END_CLOSED
);
hr
=
ID2D1GeometrySink_Close
(
sink
);
ok
(
hr
==
D2DERR_WRONG_STATE
,
"Got unexpected hr %#x.
\n
"
,
hr
);
ID2D1GeometrySink_Release
(
sink
);
ID2D1PathGeometry_Release
(
geometry
);
/* AddLine() outside BeginFigure()/EndFigure(). */
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
);
ID2D1GeometrySink_AddLine
(
sink
,
point
);
hr
=
ID2D1GeometrySink_Close
(
sink
);
ok
(
hr
==
D2DERR_WRONG_STATE
,
"Got unexpected hr %#x.
\n
"
,
hr
);
ID2D1GeometrySink_AddLine
(
sink
,
point
);
ID2D1GeometrySink_Release
(
sink
);
ID2D1PathGeometry_Release
(
geometry
);
ID2D1RenderTarget_Release
(
rt
);
refcount
=
ID2D1Factory_Release
(
factory
);
ok
(
!
refcount
,
"Factory has %u references left.
\n
"
,
refcount
);
...
...
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