Commit 7c430c5c authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

d2d1: Implement d2d_d3d_render_target_CreateRadialGradientBrush().

parent e29e6270
......@@ -578,6 +578,202 @@ HRESULT d2d_linear_gradient_brush_create(ID2D1Factory *factory, const D2D1_LINEA
return S_OK;
}
static inline struct d2d_brush *impl_from_ID2D1RadialGradientBrush(ID2D1RadialGradientBrush *iface)
{
return CONTAINING_RECORD(iface, struct d2d_brush, ID2D1Brush_iface);
}
static HRESULT STDMETHODCALLTYPE d2d_radial_gradient_brush_QueryInterface(ID2D1RadialGradientBrush *iface,
REFIID iid, void **out)
{
TRACE("iface %p, iid %s, out %p.\n", iface, debugstr_guid(iid), out);
if (IsEqualGUID(iid, &IID_ID2D1RadialGradientBrush)
|| IsEqualGUID(iid, &IID_ID2D1Brush)
|| IsEqualGUID(iid, &IID_ID2D1Resource)
|| IsEqualGUID(iid, &IID_IUnknown))
{
ID2D1RadialGradientBrush_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_radial_gradient_brush_AddRef(ID2D1RadialGradientBrush *iface)
{
struct d2d_brush *brush = impl_from_ID2D1RadialGradientBrush(iface);
ULONG refcount = InterlockedIncrement(&brush->refcount);
TRACE("%p increasing refcount to %u.\n", iface, refcount);
return refcount;
}
static ULONG STDMETHODCALLTYPE d2d_radial_gradient_brush_Release(ID2D1RadialGradientBrush *iface)
{
struct d2d_brush *brush = impl_from_ID2D1RadialGradientBrush(iface);
ULONG refcount = InterlockedDecrement(&brush->refcount);
TRACE("%p decreasing refcount to %u.\n", iface, refcount);
if (!refcount)
d2d_brush_destroy(brush);
return refcount;
}
static void STDMETHODCALLTYPE d2d_radial_gradient_brush_GetFactory(ID2D1RadialGradientBrush *iface,
ID2D1Factory **factory)
{
struct d2d_brush *brush = impl_from_ID2D1RadialGradientBrush(iface);
TRACE("iface %p, factory %p.\n", iface, factory);
ID2D1Factory_AddRef(*factory = brush->factory);
}
static void STDMETHODCALLTYPE d2d_radial_gradient_brush_SetOpacity(ID2D1RadialGradientBrush *iface, float opacity)
{
struct d2d_brush *brush = impl_from_ID2D1RadialGradientBrush(iface);
TRACE("iface %p, opacity %.8e.\n", iface, opacity);
brush->opacity = opacity;
}
static void STDMETHODCALLTYPE d2d_radial_gradient_brush_SetTransform(ID2D1RadialGradientBrush *iface,
const D2D1_MATRIX_3X2_F *transform)
{
struct d2d_brush *brush = impl_from_ID2D1RadialGradientBrush(iface);
TRACE("iface %p, transform %p.\n", iface, transform);
brush->transform = *transform;
}
static float STDMETHODCALLTYPE d2d_radial_gradient_brush_GetOpacity(ID2D1RadialGradientBrush *iface)
{
struct d2d_brush *brush = impl_from_ID2D1RadialGradientBrush(iface);
TRACE("iface %p.\n", iface);
return brush->opacity;
}
static void STDMETHODCALLTYPE d2d_radial_gradient_brush_GetTransform(ID2D1RadialGradientBrush *iface,
D2D1_MATRIX_3X2_F *transform)
{
struct d2d_brush *brush = impl_from_ID2D1RadialGradientBrush(iface);
TRACE("iface %p, transform %p.\n", iface, transform);
*transform = brush->transform;
}
static void STDMETHODCALLTYPE d2d_radial_gradient_brush_SetCenter(ID2D1RadialGradientBrush *iface,
D2D1_POINT_2F centre)
{
FIXME("iface %p, centre {%.8e, %.8e} stub!\n", iface, centre.x, centre.y);
}
static void STDMETHODCALLTYPE d2d_radial_gradient_brush_SetGradientOriginOffset(ID2D1RadialGradientBrush *iface,
D2D1_POINT_2F offset)
{
FIXME("iface %p, offset {%.8e, %.8e} stub!\n", iface, offset.x, offset.y);
}
static void STDMETHODCALLTYPE d2d_radial_gradient_brush_SetRadiusX(ID2D1RadialGradientBrush *iface, float radius)
{
FIXME("iface %p, radius %.8e stub!\n", iface, radius);
}
static void STDMETHODCALLTYPE d2d_radial_gradient_brush_SetRadiusY(ID2D1RadialGradientBrush *iface, float radius)
{
FIXME("iface %p, radius %.8e stub!\n", iface, radius);
}
static D2D1_POINT_2F * STDMETHODCALLTYPE d2d_radial_gradient_brush_GetCenter(ID2D1RadialGradientBrush *iface,
D2D1_POINT_2F *centre)
{
FIXME("iface %p, centre %p stub!\n", iface, centre);
d2d_point_set(centre, 0.0f, 0.0f);
return centre;
}
static D2D1_POINT_2F * STDMETHODCALLTYPE d2d_radial_gradient_brush_GetGradientOriginOffset(
ID2D1RadialGradientBrush *iface, D2D1_POINT_2F *offset)
{
FIXME("iface %p, offset %p stub!\n", iface, offset);
d2d_point_set(offset, 0.0f, 0.0f);
return offset;
}
static float STDMETHODCALLTYPE d2d_radial_gradient_brush_GetRadiusX(ID2D1RadialGradientBrush *iface)
{
FIXME("iface %p stub!\n", iface);
return 0.0f;
}
static float STDMETHODCALLTYPE d2d_radial_gradient_brush_GetRadiusY(ID2D1RadialGradientBrush *iface)
{
FIXME("iface %p stub!\n", iface);
return 0.0f;
}
static void STDMETHODCALLTYPE d2d_radial_gradient_brush_GetGradientStopCollection(ID2D1RadialGradientBrush *iface,
ID2D1GradientStopCollection **gradient)
{
FIXME("iface %p, gradient %p stub!\n", iface, gradient);
*gradient = NULL;
}
static const struct ID2D1RadialGradientBrushVtbl d2d_radial_gradient_brush_vtbl =
{
d2d_radial_gradient_brush_QueryInterface,
d2d_radial_gradient_brush_AddRef,
d2d_radial_gradient_brush_Release,
d2d_radial_gradient_brush_GetFactory,
d2d_radial_gradient_brush_SetOpacity,
d2d_radial_gradient_brush_SetTransform,
d2d_radial_gradient_brush_GetOpacity,
d2d_radial_gradient_brush_GetTransform,
d2d_radial_gradient_brush_SetCenter,
d2d_radial_gradient_brush_SetGradientOriginOffset,
d2d_radial_gradient_brush_SetRadiusX,
d2d_radial_gradient_brush_SetRadiusY,
d2d_radial_gradient_brush_GetCenter,
d2d_radial_gradient_brush_GetGradientOriginOffset,
d2d_radial_gradient_brush_GetRadiusX,
d2d_radial_gradient_brush_GetRadiusY,
d2d_radial_gradient_brush_GetGradientStopCollection,
};
HRESULT d2d_radial_gradient_brush_create(ID2D1Factory *factory, const D2D1_BRUSH_PROPERTIES *brush_desc,
ID2D1GradientStopCollection *gradient, struct d2d_brush **brush)
{
struct d2d_brush *b;
if (!(b = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*b))))
return E_OUTOFMEMORY;
d2d_brush_init(b, factory, D2D_BRUSH_TYPE_RADIAL, brush_desc, (ID2D1BrushVtbl *)&d2d_radial_gradient_brush_vtbl);
TRACE("Created brush %p.\n", b);
*brush = b;
return S_OK;
}
static inline struct d2d_brush *impl_from_ID2D1BitmapBrush(ID2D1BitmapBrush *iface)
{
return CONTAINING_RECORD(iface, struct d2d_brush, ID2D1Brush_iface);
......@@ -827,6 +1023,7 @@ struct d2d_brush *unsafe_impl_from_ID2D1Brush(ID2D1Brush *iface)
return NULL;
assert(iface->lpVtbl == (const ID2D1BrushVtbl *)&d2d_solid_color_brush_vtbl
|| iface->lpVtbl == (const ID2D1BrushVtbl *)&d2d_linear_gradient_brush_vtbl
|| iface->lpVtbl == (const ID2D1BrushVtbl *)&d2d_radial_gradient_brush_vtbl
|| iface->lpVtbl == (const ID2D1BrushVtbl *)&d2d_bitmap_brush_vtbl);
return CONTAINING_RECORD(iface, struct d2d_brush, ID2D1Brush_iface);
}
......
......@@ -38,6 +38,7 @@ enum d2d_brush_type
{
D2D_BRUSH_TYPE_SOLID,
D2D_BRUSH_TYPE_LINEAR,
D2D_BRUSH_TYPE_RADIAL,
D2D_BRUSH_TYPE_BITMAP,
D2D_BRUSH_TYPE_COUNT,
};
......@@ -251,11 +252,14 @@ struct d2d_brush
HRESULT d2d_solid_color_brush_create(ID2D1Factory *factory, const D2D1_COLOR_F *color,
const D2D1_BRUSH_PROPERTIES *desc, struct d2d_brush **brush) DECLSPEC_HIDDEN;
HRESULT d2d_linear_gradient_brush_create(ID2D1Factory *factory, const D2D1_LINEAR_GRADIENT_BRUSH_PROPERTIES *gradient_brush_desc,
const D2D1_BRUSH_PROPERTIES *brush_desc, ID2D1GradientStopCollection *gradient,
HRESULT d2d_linear_gradient_brush_create(ID2D1Factory *factory,
const D2D1_LINEAR_GRADIENT_BRUSH_PROPERTIES *gradient_desc, const D2D1_BRUSH_PROPERTIES *brush_desc,
ID2D1GradientStopCollection *gradient, struct d2d_brush **brush) DECLSPEC_HIDDEN;
HRESULT d2d_radial_gradient_brush_create(ID2D1Factory *factory, const D2D1_BRUSH_PROPERTIES *brush_desc,
ID2D1GradientStopCollection *gradient, struct d2d_brush **brush) DECLSPEC_HIDDEN;
HRESULT d2d_bitmap_brush_create(ID2D1Factory *factory, ID2D1Bitmap *bitmap,
const D2D1_BITMAP_BRUSH_PROPERTIES *bitmap_brush_desc, const D2D1_BRUSH_PROPERTIES *brush_desc,
struct d2d_brush **brush) DECLSPEC_HIDDEN;
HRESULT d2d_bitmap_brush_create(ID2D1Factory *factory, ID2D1Bitmap *bitmap, const D2D1_BITMAP_BRUSH_PROPERTIES *bitmap_brush_desc,
const D2D1_BRUSH_PROPERTIES *brush_desc, struct d2d_brush **brush) DECLSPEC_HIDDEN;
void d2d_brush_bind_resources(struct d2d_brush *brush, ID3D10Device *device, unsigned int brush_idx) DECLSPEC_HIDDEN;
HRESULT d2d_brush_get_ps_cb(struct d2d_brush *brush, struct d2d_brush *opacity_brush, BOOL outline,
struct d2d_d3d_render_target *render_target, ID3D10Buffer **ps_cb) DECLSPEC_HIDDEN;
......
......@@ -409,10 +409,18 @@ static HRESULT STDMETHODCALLTYPE d2d_d3d_render_target_CreateRadialGradientBrush
const D2D1_RADIAL_GRADIENT_BRUSH_PROPERTIES *gradient_brush_desc, const D2D1_BRUSH_PROPERTIES *brush_desc,
ID2D1GradientStopCollection *gradient, ID2D1RadialGradientBrush **brush)
{
FIXME("iface %p, gradient_brush_desc %p, brush_desc %p, gradient %p, brush %p stub!\n",
struct d2d_d3d_render_target *render_target = impl_from_ID2D1RenderTarget(iface);
struct d2d_brush *object;
HRESULT hr;
TRACE("iface %p, gradient_brush_desc %p, brush_desc %p, gradient %p, brush %p.\n",
iface, gradient_brush_desc, brush_desc, gradient, brush);
return E_NOTIMPL;
if (SUCCEEDED(hr = d2d_radial_gradient_brush_create(render_target->factory,
brush_desc, gradient, &object)))
*brush = (ID2D1RadialGradientBrush *)&object->ID2D1Brush_iface;
return hr;
}
static HRESULT STDMETHODCALLTYPE d2d_d3d_render_target_CreateCompatibleRenderTarget(ID2D1RenderTarget *iface,
......@@ -2565,8 +2573,9 @@ static HRESULT d2d_d3d_render_target_init(struct d2d_d3d_render_target *render_t
#if 0
#define BRUSH_TYPE_SOLID 0
#define BRUSH_TYPE_LINEAR 1
#define BRUSH_TYPE_BITMAP 2
#define BRUSH_TYPE_COUNT 3
#define BRUSH_TYPE_RADIAL 2
#define BRUSH_TYPE_BITMAP 3
#define BRUSH_TYPE_COUNT 4
bool outline;
struct brush
......@@ -2694,7 +2703,7 @@ static HRESULT d2d_d3d_render_target_init(struct d2d_d3d_render_target *render_t
return colour;
}
#endif
0x43425844, 0x8b6abf47, 0x898d4cd7, 0x0052859f, 0x209737c6, 0x00000001, 0x00001094, 0x00000003,
0x43425844, 0x6387f851, 0xd0684a53, 0xfac88e1c, 0xb2e1e70c, 0x00000001, 0x00001094, 0x00000003,
0x0000002c, 0x000000c4, 0x000000f8, 0x4e475349, 0x00000090, 0x00000004, 0x00000008, 0x00000068,
0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x00000303, 0x00000077, 0x00000000, 0x00000000,
0x00000003, 0x00000001, 0x00000f0f, 0x0000007e, 0x00000000, 0x00000000, 0x00000003, 0x00000002,
......@@ -2746,7 +2755,7 @@ static HRESULT d2d_d3d_render_target_init(struct d2d_d3d_render_target *render_t
0x00100e46, 0x00000004, 0x00100e46, 0x00000006, 0x01000015, 0x08000038, 0x001000f2, 0x00000000,
0x00100e46, 0x00000003, 0x00208556, 0x00000000, 0x00000001, 0x01000015, 0x0300001f, 0x0010000a,
0x00000001, 0x08000020, 0x00100012, 0x00000001, 0x0020800a, 0x00000000, 0x00000001, 0x00004001,
0x00000002, 0x0304001f, 0x0010000a, 0x00000001, 0x0800000f, 0x00100022, 0x00000001, 0x00101046,
0x00000003, 0x0304001f, 0x0010000a, 0x00000001, 0x0800000f, 0x00100022, 0x00000001, 0x00101046,
0x00000000, 0x00208046, 0x00000000, 0x00000002, 0x08000000, 0x00100012, 0x00000002, 0x0010001a,
0x00000001, 0x0020802a, 0x00000000, 0x00000002, 0x0800000f, 0x00100022, 0x00000001, 0x00101046,
0x00000000, 0x00208046, 0x00000000, 0x00000003, 0x08000000, 0x00100022, 0x00000002, 0x0010001a,
......@@ -2757,7 +2766,7 @@ static HRESULT d2d_d3d_render_target_init(struct d2d_d3d_render_target *render_t
0x05000036, 0x00100012, 0x00000002, 0x00004001, 0x00000000, 0x06000036, 0x00100082, 0x00000002,
0x0020801a, 0x00000000, 0x00000001, 0x09000037, 0x001000f2, 0x00000000, 0x00100006, 0x00000001,
0x00100e46, 0x00000000, 0x00100c06, 0x00000002, 0x01000015, 0x01000015, 0x0800004f, 0x00100012,
0x00000001, 0x0020800a, 0x00000000, 0x00000004, 0x00004001, 0x00000003, 0x0304001f, 0x0010000a,
0x00000001, 0x0020800a, 0x00000000, 0x00000004, 0x00004001, 0x00000004, 0x0304001f, 0x0010000a,
0x00000001, 0x09000038, 0x00100012, 0x00000001, 0x0020801a, 0x00000000, 0x00000004, 0x0020803a,
0x00000000, 0x00000005, 0x0404001f, 0x0020800a, 0x00000000, 0x00000004, 0x08000020, 0x00100022,
0x00000001, 0x0020800a, 0x00000000, 0x00000004, 0x00004001, 0x00000001, 0x0304001f, 0x0010001a,
......@@ -2796,7 +2805,7 @@ static HRESULT d2d_d3d_render_target_init(struct d2d_d3d_render_target *render_t
0x00000002, 0x01000012, 0x05000036, 0x00100042, 0x00000001, 0x0010003a, 0x00000003, 0x01000015,
0x08000038, 0x00100012, 0x00000001, 0x0010002a, 0x00000001, 0x0020801a, 0x00000000, 0x00000004,
0x01000015, 0x0300001f, 0x0010001a, 0x00000001, 0x08000020, 0x00100022, 0x00000001, 0x0020800a,
0x00000000, 0x00000004, 0x00004001, 0x00000002, 0x0304001f, 0x0010001a, 0x00000001, 0x0800000f,
0x00000000, 0x00000004, 0x00004001, 0x00000003, 0x0304001f, 0x0010001a, 0x00000001, 0x0800000f,
0x00100042, 0x00000001, 0x00101046, 0x00000000, 0x00208046, 0x00000000, 0x00000005, 0x08000000,
0x00100012, 0x00000002, 0x0010002a, 0x00000001, 0x0020802a, 0x00000000, 0x00000005, 0x0800000f,
0x00100042, 0x00000001, 0x00101046, 0x00000000, 0x00208046, 0x00000000, 0x00000006, 0x08000000,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment