mirror of
git://source.winehq.org/git/wine.git
synced 2024-09-15 02:44:46 +00:00
d2d1: Add a command list object stub.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
This commit is contained in:
parent
56b50f158d
commit
753ae1d0a5
|
@ -7,6 +7,7 @@ C_SRCS = \
|
|||
bitmap.c \
|
||||
bitmap_render_target.c \
|
||||
brush.c \
|
||||
command_list.c \
|
||||
dc_render_target.c \
|
||||
device.c \
|
||||
effect.c \
|
||||
|
|
119
dlls/d2d1/command_list.c
Normal file
119
dlls/d2d1/command_list.c
Normal file
|
@ -0,0 +1,119 @@
|
|||
/*
|
||||
* Copyright 2022 Nikolay Sivov for CodeWeavers
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "d2d1_private.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(d2d);
|
||||
|
||||
static inline struct d2d_command_list *impl_from_ID2D1CommandList(ID2D1CommandList *iface)
|
||||
{
|
||||
return CONTAINING_RECORD(iface, struct d2d_command_list, ID2D1CommandList_iface);
|
||||
}
|
||||
|
||||
static HRESULT STDMETHODCALLTYPE d2d_command_list_QueryInterface(ID2D1CommandList *iface, REFIID iid, void **out)
|
||||
{
|
||||
TRACE("iface %p, iid %s, out %p.\n", iface, debugstr_guid(iid), out);
|
||||
|
||||
if (IsEqualGUID(iid, &IID_ID2D1CommandList)
|
||||
|| IsEqualGUID(iid, &IID_ID2D1Image)
|
||||
|| IsEqualGUID(iid, &IID_ID2D1Resource)
|
||||
|| IsEqualGUID(iid, &IID_IUnknown))
|
||||
{
|
||||
ID2D1CommandList_AddRef(iface);
|
||||
*out = iface;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(iid));
|
||||
|
||||
*out = NULL;
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
|
||||
static ULONG STDMETHODCALLTYPE d2d_command_list_AddRef(ID2D1CommandList *iface)
|
||||
{
|
||||
struct d2d_command_list *command_list = impl_from_ID2D1CommandList(iface);
|
||||
ULONG refcount = InterlockedIncrement(&command_list->refcount);
|
||||
|
||||
TRACE("%p increasing refcount to %lu.\n", iface, refcount);
|
||||
|
||||
return refcount;
|
||||
}
|
||||
|
||||
static ULONG STDMETHODCALLTYPE d2d_command_list_Release(ID2D1CommandList *iface)
|
||||
{
|
||||
struct d2d_command_list *command_list = impl_from_ID2D1CommandList(iface);
|
||||
ULONG refcount = InterlockedDecrement(&command_list->refcount);
|
||||
|
||||
TRACE("%p decreasing refcount to %lu.\n", iface, refcount);
|
||||
|
||||
if (!refcount)
|
||||
{
|
||||
ID2D1Factory_Release(command_list->factory);
|
||||
free(command_list);
|
||||
}
|
||||
|
||||
return refcount;
|
||||
}
|
||||
|
||||
static void STDMETHODCALLTYPE d2d_command_list_GetFactory(ID2D1CommandList *iface, ID2D1Factory **factory)
|
||||
{
|
||||
struct d2d_command_list *command_list = impl_from_ID2D1CommandList(iface);
|
||||
|
||||
TRACE("iface %p, factory %p.\n", iface, factory);
|
||||
|
||||
ID2D1Factory_AddRef(*factory = command_list->factory);
|
||||
}
|
||||
|
||||
static HRESULT STDMETHODCALLTYPE d2d_command_list_Stream(ID2D1CommandList *iface, ID2D1CommandSink *sink)
|
||||
{
|
||||
FIXME("iface %p, sink %p stub.\n", iface, sink);
|
||||
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT STDMETHODCALLTYPE d2d_command_list_Close(ID2D1CommandList *iface)
|
||||
{
|
||||
FIXME("iface %p stub.\n", iface);
|
||||
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static const ID2D1CommandListVtbl d2d_command_list_vtbl =
|
||||
{
|
||||
d2d_command_list_QueryInterface,
|
||||
d2d_command_list_AddRef,
|
||||
d2d_command_list_Release,
|
||||
d2d_command_list_GetFactory,
|
||||
d2d_command_list_Stream,
|
||||
d2d_command_list_Close,
|
||||
};
|
||||
|
||||
HRESULT d2d_command_list_create(ID2D1Factory *factory, struct d2d_command_list **command_list)
|
||||
{
|
||||
if (!(*command_list = calloc(1, sizeof(**command_list))))
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
(*command_list)->ID2D1CommandList_iface.lpVtbl = &d2d_command_list_vtbl;
|
||||
(*command_list)->refcount = 1;
|
||||
ID2D1Factory_AddRef((*command_list)->factory = factory);
|
||||
|
||||
TRACE("Created command list %p.\n", *command_list);
|
||||
|
||||
return S_OK;
|
||||
}
|
|
@ -689,6 +689,16 @@ struct d2d_effect_property * d2d_effect_properties_get_property_by_name(
|
|||
const struct d2d_effect_properties *properties, const WCHAR *name) DECLSPEC_HIDDEN;
|
||||
void d2d_effect_properties_cleanup(struct d2d_effect_properties *props) DECLSPEC_HIDDEN;
|
||||
|
||||
struct d2d_command_list
|
||||
{
|
||||
ID2D1CommandList ID2D1CommandList_iface;
|
||||
LONG refcount;
|
||||
|
||||
ID2D1Factory *factory;
|
||||
};
|
||||
|
||||
HRESULT d2d_command_list_create(ID2D1Factory *factory, struct d2d_command_list **command_list) DECLSPEC_HIDDEN;
|
||||
|
||||
static inline BOOL d2d_array_reserve(void **elements, size_t *capacity, size_t count, size_t size)
|
||||
{
|
||||
size_t new_capacity, max_capacity;
|
||||
|
|
|
@ -2004,9 +2004,16 @@ static HRESULT STDMETHODCALLTYPE d2d_device_context_ID2D1DeviceContext_CreateBit
|
|||
static HRESULT STDMETHODCALLTYPE d2d_device_context_CreateCommandList(ID2D1DeviceContext1 *iface,
|
||||
ID2D1CommandList **command_list)
|
||||
{
|
||||
FIXME("iface %p, command_list %p stub!\n", iface, command_list);
|
||||
struct d2d_device_context *context = impl_from_ID2D1DeviceContext(iface);
|
||||
struct d2d_command_list *object;
|
||||
HRESULT hr;
|
||||
|
||||
return E_NOTIMPL;
|
||||
TRACE("iface %p, command_list %p.\n", iface, command_list);
|
||||
|
||||
if (SUCCEEDED(hr = d2d_command_list_create(context->factory, &object)))
|
||||
*command_list = &object->ID2D1CommandList_iface;
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
static BOOL STDMETHODCALLTYPE d2d_device_context_IsDxgiFormatSupported(ID2D1DeviceContext1 *iface, DXGI_FORMAT format)
|
||||
|
|
|
@ -9469,13 +9469,7 @@ static void test_command_list(BOOL d3d11)
|
|||
device_context = ctx.context;
|
||||
|
||||
hr = ID2D1DeviceContext_CreateCommandList(device_context, &command_list);
|
||||
todo_wine ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
|
||||
|
||||
if (FAILED(hr))
|
||||
{
|
||||
release_test_context(&ctx);
|
||||
return;
|
||||
}
|
||||
ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
|
||||
|
||||
ID2D1DeviceContext_SetTarget(device_context, (ID2D1Image *)command_list);
|
||||
ID2D1DeviceContext_BeginDraw(device_context);
|
||||
|
@ -9497,6 +9491,7 @@ static void test_command_list(BOOL d3d11)
|
|||
ID2D1RenderTarget_DrawBitmap(rt, bitmap, NULL, 0.25f, D2D1_BITMAP_INTERPOLATION_MODE_NEAREST_NEIGHBOR, NULL);
|
||||
|
||||
refcount = ID2D1Bitmap_Release(bitmap);
|
||||
todo_wine
|
||||
ok(refcount == 1, "Got unexpected refcount %lu.\n", refcount);
|
||||
|
||||
/* Solid color brush. */
|
||||
|
@ -9524,6 +9519,7 @@ static void test_command_list(BOOL d3d11)
|
|||
ok(refcount == 0, "Got unexpected refcount %lu.\n", refcount);
|
||||
|
||||
refcount = ID2D1Bitmap_Release(bitmap);
|
||||
todo_wine
|
||||
ok(refcount == 1, "Got unexpected refcount %lu.\n", refcount);
|
||||
|
||||
/* Linear gradient brush. */
|
||||
|
@ -9547,9 +9543,11 @@ static void test_command_list(BOOL d3d11)
|
|||
ok(refcount == 0, "Got unexpected refcount %lu.\n", refcount);
|
||||
|
||||
refcount = ID2D1Geometry_Release(geometry);
|
||||
todo_wine
|
||||
ok(refcount == 1, "Got unexpected refcount %lu.\n", refcount);
|
||||
|
||||
refcount = ID2D1GradientStopCollection_Release(gradient);
|
||||
todo_wine
|
||||
ok(refcount == 1, "Got unexpected refcount %lu.\n", refcount);
|
||||
|
||||
/* Radial gradient brush. */
|
||||
|
@ -9575,9 +9573,11 @@ static void test_command_list(BOOL d3d11)
|
|||
ok(refcount == 0, "Got unexpected refcount %lu.\n", refcount);
|
||||
|
||||
refcount = ID2D1Geometry_Release(geometry);
|
||||
todo_wine
|
||||
ok(refcount == 1, "Got unexpected refcount %lu.\n", refcount);
|
||||
|
||||
refcount = ID2D1GradientStopCollection_Release(gradient);
|
||||
todo_wine
|
||||
ok(refcount == 1, "Got unexpected refcount %lu.\n", refcount);
|
||||
|
||||
/* Geometry. */
|
||||
|
@ -9595,6 +9595,7 @@ static void test_command_list(BOOL d3d11)
|
|||
ok(refcount == 0, "Got unexpected refcount %lu.\n", refcount);
|
||||
|
||||
refcount = ID2D1Geometry_Release(geometry);
|
||||
todo_wine
|
||||
ok(refcount == 1, "Got unexpected refcount %lu.\n", refcount);
|
||||
|
||||
/* Stroke style. */
|
||||
|
@ -9621,20 +9622,26 @@ static void test_command_list(BOOL d3d11)
|
|||
ok(refcount == 0, "Got unexpected refcount %lu.\n", refcount);
|
||||
|
||||
refcount = ID2D1StrokeStyle_Release(stroke_style);
|
||||
todo_wine
|
||||
ok(refcount == 1, "Got unexpected refcount %lu.\n", refcount);
|
||||
|
||||
/* Close on attached list. */
|
||||
ID2D1DeviceContext_GetTarget(device_context, &target);
|
||||
todo_wine
|
||||
ok(target == (ID2D1Image *)command_list, "Unexpected context target.\n");
|
||||
ID2D1Image_Release(target);
|
||||
|
||||
hr = ID2D1CommandList_Close(command_list);
|
||||
todo_wine
|
||||
ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
|
||||
|
||||
ID2D1DeviceContext_GetTarget(device_context, &target);
|
||||
todo_wine
|
||||
ok(target == NULL, "Unexpected context target.\n");
|
||||
if (target) ID2D1Image_Release(target);
|
||||
|
||||
hr = ID2D1CommandList_Close(command_list);
|
||||
todo_wine
|
||||
ok(hr == D2DERR_WRONG_STATE, "Got unexpected hr %#lx.\n", hr);
|
||||
|
||||
ID2D1CommandList_Release(command_list);
|
||||
|
@ -9644,6 +9651,7 @@ static void test_command_list(BOOL d3d11)
|
|||
ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
|
||||
|
||||
hr = ID2D1CommandList_Close(command_list);
|
||||
todo_wine
|
||||
ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
|
||||
|
||||
ID2D1CommandList_Release(command_list);
|
||||
|
|
Loading…
Reference in a new issue