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
2f6f8f12
Commit
2f6f8f12
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: Only allow path geometries to be opened once.
parent
94f6d069
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
95 additions
and
2 deletions
+95
-2
d2d1_private.h
dlls/d2d1/d2d1_private.h
+9
-0
geometry.c
dlls/d2d1/geometry.c
+13
-2
d2d1.c
dlls/d2d1/tests/d2d1.c
+73
-0
No files found.
dlls/d2d1/d2d1_private.h
View file @
2f6f8f12
...
...
@@ -189,11 +189,20 @@ void d2d_state_block_init(struct d2d_state_block *state_block, const D2D1_DRAWIN
IDWriteRenderingParams
*
text_rendering_params
)
DECLSPEC_HIDDEN
;
struct
d2d_state_block
*
unsafe_impl_from_ID2D1DrawingStateBlock
(
ID2D1DrawingStateBlock
*
iface
)
DECLSPEC_HIDDEN
;
enum
d2d_geometry_state
{
D2D_GEOMETRY_STATE_INITIAL
=
0
,
D2D_GEOMETRY_STATE_OPEN
,
D2D_GEOMETRY_STATE_CLOSED
,
};
struct
d2d_geometry
{
ID2D1Geometry
ID2D1Geometry_iface
;
ID2D1GeometrySink
ID2D1GeometrySink_iface
;
LONG
refcount
;
enum
d2d_geometry_state
state
;
};
void
d2d_path_geometry_init
(
struct
d2d_geometry
*
geometry
)
DECLSPEC_HIDDEN
;
...
...
dlls/d2d1/geometry.c
View file @
2f6f8f12
...
...
@@ -101,9 +101,15 @@ static void STDMETHODCALLTYPE d2d_geometry_sink_EndFigure(ID2D1GeometrySink *ifa
static
HRESULT
STDMETHODCALLTYPE
d2d_geometry_sink_Close
(
ID2D1GeometrySink
*
iface
)
{
FIXME
(
"iface %p stub!
\n
"
,
iface
);
struct
d2d_geometry
*
geometry
=
impl_from_ID2D1GeometrySink
(
iface
);
return
E_NOTIMPL
;
TRACE
(
"iface %p.
\n
"
,
iface
);
if
(
geometry
->
state
!=
D2D_GEOMETRY_STATE_OPEN
)
return
D2DERR_WRONG_STATE
;
geometry
->
state
=
D2D_GEOMETRY_STATE_CLOSED
;
return
S_OK
;
}
static
void
STDMETHODCALLTYPE
d2d_geometry_sink_AddLine
(
ID2D1GeometrySink
*
iface
,
D2D1_POINT_2F
point
)
...
...
@@ -336,9 +342,14 @@ static HRESULT STDMETHODCALLTYPE d2d_path_geometry_Open(ID2D1PathGeometry *iface
TRACE
(
"iface %p, sink %p.
\n
"
,
iface
,
sink
);
if
(
geometry
->
state
!=
D2D_GEOMETRY_STATE_INITIAL
)
return
D2DERR_WRONG_STATE
;
*
sink
=
&
geometry
->
ID2D1GeometrySink_iface
;
ID2D1GeometrySink_AddRef
(
*
sink
);
geometry
->
state
=
D2D_GEOMETRY_STATE_OPEN
;
return
S_OK
;
}
...
...
dlls/d2d1/tests/d2d1.c
View file @
2f6f8f12
...
...
@@ -873,10 +873,83 @@ static void test_bitmap_brush(void)
DestroyWindow
(
window
);
}
static
void
test_path_geometry
(
void
)
{
ID2D1GeometrySink
*
sink
,
*
tmp_sink
;
ID2D1PathGeometry
*
geometry
;
IDXGISwapChain
*
swapchain
;
ID2D1RenderTarget
*
rt
;
ID3D10Device1
*
device
;
IDXGISurface
*
surface
;
ID2D1Factory
*
factory
;
ULONG
refcount
;
HWND
window
;
HRESULT
hr
;
if
(
!
(
device
=
create_device
()))
{
skip
(
"Failed to create device, skipping tests.
\n
"
);
return
;
}
window
=
CreateWindowA
(
"static"
,
"d2d1_test"
,
WS_OVERLAPPEDWINDOW
|
WS_VISIBLE
,
0
,
0
,
640
,
480
,
NULL
,
NULL
,
NULL
,
NULL
);
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
);
/* Close() when closed. */
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
);
hr
=
ID2D1GeometrySink_Close
(
sink
);
ok
(
SUCCEEDED
(
hr
),
"Failed to close geometry sink, hr %#x.
\n
"
,
hr
);
hr
=
ID2D1GeometrySink_Close
(
sink
);
ok
(
hr
==
D2DERR_WRONG_STATE
,
"Got unexpected hr %#x.
\n
"
,
hr
);
ID2D1GeometrySink_Release
(
sink
);
ID2D1PathGeometry_Release
(
geometry
);
/* Open() when closed. */
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
);
hr
=
ID2D1GeometrySink_Close
(
sink
);
ok
(
SUCCEEDED
(
hr
),
"Failed to close geometry sink, hr %#x.
\n
"
,
hr
);
ID2D1GeometrySink_Release
(
sink
);
hr
=
ID2D1PathGeometry_Open
(
geometry
,
&
sink
);
ok
(
hr
==
D2DERR_WRONG_STATE
,
"Got unexpected hr %#x.
\n
"
,
hr
);
ID2D1PathGeometry_Release
(
geometry
);
/* Open() when open. */
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
);
hr
=
ID2D1PathGeometry_Open
(
geometry
,
&
tmp_sink
);
ok
(
hr
==
D2DERR_WRONG_STATE
,
"Got unexpected hr %#x.
\n
"
,
hr
);
hr
=
ID2D1GeometrySink_Close
(
sink
);
ok
(
SUCCEEDED
(
hr
),
"Failed to close geometry sink, hr %#x.
\n
"
,
hr
);
ID2D1GeometrySink_Release
(
sink
);
ID2D1PathGeometry_Release
(
geometry
);
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
();
test_state_block
();
test_color_brush
();
test_bitmap_brush
();
test_path_geometry
();
}
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