[PATCH 2/2] d2d1: Add ID2D1DeviceContext stub.

Nikolay Sivov nsivov at codeweavers.com
Sat May 26 01:47:17 CDT 2018


Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
---
 dlls/d2d1/device.c | 784 ++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 782 insertions(+), 2 deletions(-)

diff --git a/dlls/d2d1/device.c b/dlls/d2d1/device.c
index 67b3fab906..63941dca3d 100644
--- a/dlls/d2d1/device.c
+++ b/dlls/d2d1/device.c
@@ -38,11 +38,23 @@ struct d2d_draw_text_layout_ctx
     D2D1_DRAW_TEXT_OPTIONS options;
 };
 
+struct d2d_device_context
+{
+    ID2D1DeviceContext ID2D1DeviceContext_iface;
+    LONG refcount;
+    struct d2d_device *device;
+};
+
 static inline struct d2d_device *impl_from_ID2D1Device(ID2D1Device *iface)
 {
     return CONTAINING_RECORD(iface, struct d2d_device, ID2D1Device_iface);
 }
 
+static inline struct d2d_device_context *impl_from_ID2D1DeviceContext(ID2D1DeviceContext *iface)
+{
+    return CONTAINING_RECORD(iface, struct d2d_device_context, ID2D1DeviceContext_iface);
+}
+
 static ID2D1Brush *d2d_draw_get_text_brush(struct d2d_draw_text_layout_ctx *context, IUnknown *effect)
 {
     ID2D1Brush *brush = NULL;
@@ -3295,6 +3307,763 @@ HRESULT d2d_d3d_render_target_create_rtv(ID2D1RenderTarget *iface, IDXGISurface1
     return S_OK;
 }
 
+static HRESULT WINAPI d2d_device_context_QueryInterface(ID2D1DeviceContext *iface, REFIID iid, void **out)
+{
+    TRACE("iface %p, iid %s, out %p.\n", iface, debugstr_guid(iid), out);
+
+    if (IsEqualGUID(iid, &IID_ID2D1DeviceContext)
+            || IsEqualGUID(iid, &IID_ID2D1RenderTarget)
+            || IsEqualGUID(iid, &IID_ID2D1Resource)
+            || IsEqualGUID(iid, &IID_IUnknown))
+    {
+        ID2D1DeviceContext_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 WINAPI d2d_device_context_AddRef(ID2D1DeviceContext *iface)
+{
+    struct d2d_device_context *device_context = impl_from_ID2D1DeviceContext(iface);
+    ULONG refcount = InterlockedIncrement(&device_context->refcount);
+
+    TRACE("%p increasing refcount to %u.\n", iface, refcount);
+
+    return refcount;
+}
+
+static ULONG WINAPI d2d_device_context_Release(ID2D1DeviceContext *iface)
+{
+    struct d2d_device_context *device_context = impl_from_ID2D1DeviceContext(iface);
+    ULONG refcount = InterlockedDecrement(&device_context->refcount);
+
+    TRACE("%p decreasing refcount to %u.\n", iface, refcount);
+
+    if (!refcount)
+    {
+        ID2D1Device_Release(&device_context->device->ID2D1Device_iface);
+        heap_free(device_context);
+    }
+
+    return refcount;
+}
+
+static void WINAPI d2d_device_context_GetFactory(ID2D1DeviceContext *iface, ID2D1Factory **factory)
+{
+    struct d2d_device_context *device_context = impl_from_ID2D1DeviceContext(iface);
+
+    TRACE("iface %p, factory %p.\n", iface, factory);
+
+    *factory = (ID2D1Factory *)device_context->device->factory;
+    ID2D1Factory_AddRef(*factory);
+}
+
+static HRESULT WINAPI d2d_device_context_CreateBitmap(ID2D1DeviceContext *iface, D2D1_SIZE_U size,
+        const void *src_data, UINT32 pitch, const D2D1_BITMAP_PROPERTIES *desc, ID2D1Bitmap **bitmap)
+{
+    FIXME("iface %p, size {%u, %u}, src_data %p, pitch %u, desc %p, bitmap %p stub!\n", iface, size.width,
+            size.height, src_data, pitch, desc, bitmap);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI d2d_device_context_CreateBitmapFromWicBitmap(ID2D1DeviceContext *iface,
+        IWICBitmapSource *bitmap_source, const D2D1_BITMAP_PROPERTIES *desc, ID2D1Bitmap **bitmap)
+{
+    FIXME("iface %p, bitmap_source %p, desc %p, bitmap %p stub!\n", iface, bitmap_source, desc, bitmap);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI d2d_device_context_CreateSharedBitmap(ID2D1DeviceContext *iface, REFIID iid, void *data,
+        const D2D1_BITMAP_PROPERTIES *desc, ID2D1Bitmap **bitmap)
+{
+    FIXME("iface %p, iid %s, data %p, desc %p, bitmap %p stub!\n", iface, debugstr_guid(iid), data, desc, bitmap);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI d2d_device_context_CreateBitmapBrush(ID2D1DeviceContext *iface, ID2D1Bitmap *bitmap,
+        const D2D1_BITMAP_BRUSH_PROPERTIES *bitmap_brush_desc, const D2D1_BRUSH_PROPERTIES *brush_desc,
+        ID2D1BitmapBrush **brush)
+{
+    FIXME("iface %p, bitmap %p, bitmap_brush_desc %p, brush_desc %p, brush %p stub!\n", iface, bitmap,
+            bitmap_brush_desc, brush_desc, brush);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI d2d_device_context_CreateSolidColorBrush(ID2D1DeviceContext *iface, const D2D1_COLOR_F *color,
+        const D2D1_BRUSH_PROPERTIES *desc, ID2D1SolidColorBrush **brush)
+{
+    FIXME("iface %p, color %p, desc %p, brush %p stub!\n", iface, color, desc, brush);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI d2d_device_context_CreateGradientStopCollection(ID2D1DeviceContext *iface,
+        const D2D1_GRADIENT_STOP *stops, UINT32 stop_count, D2D1_GAMMA gamma, D2D1_EXTEND_MODE extend_mode,
+        ID2D1GradientStopCollection **gradient)
+{
+    FIXME("iface %p, stops %p, stop_count %u, gamma %d, extend_mode %d, gradient %p stub!\n", iface, stops, stop_count,
+            gamma, extend_mode, gradient);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI d2d_device_context_CreateLinearGradientBrush(ID2D1DeviceContext *iface,
+        const D2D1_LINEAR_GRADIENT_BRUSH_PROPERTIES *gradient_brush_desc, const D2D1_BRUSH_PROPERTIES *brush_desc,
+        ID2D1GradientStopCollection *gradient, ID2D1LinearGradientBrush **brush)
+{
+    FIXME("iface %p, gradient_brush_desc %p, brush_desc %p, gradient %p, brush %p stub!\n", iface,
+            gradient_brush_desc, brush_desc, gradient, brush);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI d2d_device_context_CreateRadialGradientBrush(ID2D1DeviceContext *iface,
+        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", iface,
+            gradient_brush_desc, brush_desc, gradient, brush);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI d2d_device_context_CreateCompatibleRenderTarget(ID2D1DeviceContext *iface,
+        const D2D1_SIZE_F *size, const D2D1_SIZE_U *pixel_size, const D2D1_PIXEL_FORMAT *format,
+        D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS options, ID2D1BitmapRenderTarget **render_target)
+{
+    FIXME("iface %p, size %p, pixel_size %p, format %p, options %u, render_target %p stub!\n", iface,
+            size, pixel_size, format, options, render_target);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI d2d_device_context_CreateLayer(ID2D1DeviceContext *iface, const D2D1_SIZE_F *size,
+        ID2D1Layer **layer)
+{
+    FIXME("iface %p, size %p, layer %p stub!\n", iface, size, layer);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI d2d_device_context_CreateMesh(ID2D1DeviceContext *iface, ID2D1Mesh **mesh)
+{
+    FIXME("iface %p, mesh %p stub!\n", iface, mesh);
+    return E_NOTIMPL;
+}
+
+static void WINAPI d2d_device_context_DrawLine(ID2D1DeviceContext *iface, D2D1_POINT_2F p0, D2D1_POINT_2F p1,
+        ID2D1Brush *brush, float stroke_width, ID2D1StrokeStyle *stroke_style)
+{
+    FIXME("iface %p, p0 {%.8e, %.8e}, p1 {%.8e, %.8e}, brush %p, stroke_width %.8e, stroke_style %p stub!\n", iface,
+            p0.x, p0.y, p1.x, p1.y, brush, stroke_width, stroke_style);
+}
+
+static void WINAPI d2d_device_context_DrawRectangle(ID2D1DeviceContext *iface, const D2D1_RECT_F *rect,
+        ID2D1Brush *brush, float stroke_width, ID2D1StrokeStyle *stroke_style)
+{
+    FIXME("iface %p, rect %p, brush %p, stroke_width %.8e, stroke_style %p stub!\n", iface, rect, brush, stroke_width,
+            stroke_style);
+}
+
+static void WINAPI d2d_device_context_FillRectangle(ID2D1DeviceContext *iface, const D2D1_RECT_F *rect,
+        ID2D1Brush *brush)
+{
+    FIXME("iface %p, rect %p, brush %p stub!\n", iface, rect, brush);
+}
+
+static void WINAPI d2d_device_context_DrawRoundedRectangle(ID2D1DeviceContext *iface, const D2D1_ROUNDED_RECT *rect,
+        ID2D1Brush *brush, float stroke_width, ID2D1StrokeStyle *stroke_style)
+{
+    FIXME("iface %p, rect %p, brush %p, stroke_width %.8e, stroke_style %p stub!\n", iface, rect, brush, stroke_width,
+            stroke_style);
+}
+
+static void WINAPI d2d_device_context_FillRoundedRectangle(ID2D1DeviceContext *iface, const D2D1_ROUNDED_RECT *rect,
+        ID2D1Brush *brush)
+{
+    FIXME("iface %p, rect %p, brush %p stub!\n", iface, rect, brush);
+}
+
+static void WINAPI d2d_device_context_DrawEllipse(ID2D1DeviceContext *iface, const D2D1_ELLIPSE *ellipse,
+        ID2D1Brush *brush, float stroke_width, ID2D1StrokeStyle *stroke_style)
+{
+    FIXME("iface %p, ellipse %p, brush %p, stroke_width %.8e, stroke_style %p stub!\n", iface, ellipse, brush,
+            stroke_width, stroke_style);
+}
+
+static void WINAPI d2d_device_context_FillEllipse(ID2D1DeviceContext *iface, const D2D1_ELLIPSE *ellipse,
+        ID2D1Brush *brush)
+{
+    FIXME("iface %p, ellipse %p, brush %p stub!\n", iface, ellipse, brush);
+}
+
+static void WINAPI d2d_device_context_DrawGeometry(ID2D1DeviceContext *iface, ID2D1Geometry *geometry,
+        ID2D1Brush *brush, float stroke_width, ID2D1StrokeStyle *stroke_style)
+{
+    FIXME("iface %p, geometry %p, brush %p, stroke_width %.8e, stroke_style %p stub!\n", iface, geometry,
+            brush, stroke_width, stroke_style);
+}
+
+static void WINAPI d2d_device_context_FillGeometry(ID2D1DeviceContext *iface, ID2D1Geometry *geometry,
+        ID2D1Brush *brush, ID2D1Brush *opacity_brush)
+{
+    FIXME("iface %p, geometry %p, brush %p, opacity_brush %p stub!\n", iface, geometry, brush, opacity_brush);
+}
+
+static void WINAPI d2d_device_context_FillMesh(ID2D1DeviceContext *iface, ID2D1Mesh *mesh, ID2D1Brush *brush)
+{
+    FIXME("iface %p, mesh %p, brush %p stub!\n", iface, mesh, brush);
+}
+
+static void WINAPI d2d_device_context_FillOpacityMask(ID2D1DeviceContext *iface, ID2D1Bitmap *mask, ID2D1Brush *brush,
+        D2D1_OPACITY_MASK_CONTENT content, const D2D1_RECT_F *dst_rect, const D2D1_RECT_F *src_rect)
+{
+    FIXME("iface %p, mask %p, brush %p, content %d, dst_rect %p, src_rect %p stub!\n", iface, mask, brush, content,
+            dst_rect, src_rect);
+}
+
+static void WINAPI d2d_device_context_DrawBitmap(ID2D1DeviceContext *iface, ID2D1Bitmap *bitmap,
+        const D2D1_RECT_F *dst_rect, float opacity, D2D1_BITMAP_INTERPOLATION_MODE interpolation_mode,
+        const D2D1_RECT_F *src_rect)
+{
+    FIXME("iface %p, bitmap %p, dst_rect %p, opacity %.8e, interpolation_mode %d, src_rect %p stub!\n", iface, bitmap,
+            dst_rect, opacity, interpolation_mode, src_rect);
+}
+
+static void WINAPI d2d_device_context_DrawText(ID2D1DeviceContext *iface, const WCHAR *string, UINT32 string_len,
+        IDWriteTextFormat *text_format, const D2D1_RECT_F *layout_rect, ID2D1Brush *brush,
+        D2D1_DRAW_TEXT_OPTIONS options, DWRITE_MEASURING_MODE measuring_mode)
+{
+    FIXME("iface %p, string %s, string_len %u, text_format %p, layout_rect %p, brush %p, options %#x, \
+            measuring_mode %d stub!\n", iface, debugstr_wn(string, string_len), string_len, text_format, layout_rect,
+            brush, options, measuring_mode);
+}
+
+static void WINAPI d2d_device_context_DrawTextLayout(ID2D1DeviceContext *iface, D2D1_POINT_2F origin,
+        IDWriteTextLayout *layout, ID2D1Brush *brush, D2D1_DRAW_TEXT_OPTIONS options)
+{
+    FIXME("iface %p, origin {%.8e, %.8e}, layout %p, brush %p, options %#x stub!\n", iface, origin.x, origin.y, layout,
+            brush, options);
+}
+
+static void WINAPI d2d_device_context_DrawGlyphRun(ID2D1DeviceContext *iface, D2D1_POINT_2F baseline_origin,
+        const DWRITE_GLYPH_RUN *glyph_run, ID2D1Brush *brush, DWRITE_MEASURING_MODE measuring_mode)
+{
+    FIXME("iface %p, baseline_origin {%.8e, %.8e}, glyph_run %p, brush %p, measuring_mode %d stub!\n", iface,
+            baseline_origin.x, baseline_origin.y, glyph_run, brush, measuring_mode);
+}
+
+static void WINAPI d2d_device_context_SetTransform(ID2D1DeviceContext *iface, const D2D1_MATRIX_3X2_F *transform)
+{
+    FIXME("iface %p, transform %p stub!\n", iface, transform);
+}
+
+static void WINAPI d2d_device_context_GetTransform(ID2D1DeviceContext *iface, D2D1_MATRIX_3X2_F *transform)
+{
+    FIXME("iface %p, transform %p stub!\n", iface, transform);
+}
+
+static void WINAPI d2d_device_context_SetAntialiasMode(ID2D1DeviceContext *iface, D2D1_ANTIALIAS_MODE antialias_mode)
+{
+    FIXME("iface %p, antialias_mode %d stub!\n", iface, antialias_mode);
+}
+
+static D2D1_ANTIALIAS_MODE WINAPI d2d_device_context_GetAntialiasMode(ID2D1DeviceContext *iface)
+{
+    FIXME("iface %p stub!\n", iface);
+    return D2D1_ANTIALIAS_MODE_PER_PRIMITIVE;
+}
+
+static void WINAPI d2d_device_context_SetTextAntialiasMode(ID2D1DeviceContext *iface,
+        D2D1_TEXT_ANTIALIAS_MODE antialias_mode)
+{
+    FIXME("iface %p, antialias_mode %d stub!\n", iface, antialias_mode);
+}
+
+static D2D1_TEXT_ANTIALIAS_MODE WINAPI d2d_device_context_GetTextAntialiasMode(ID2D1DeviceContext *iface)
+{
+    FIXME("iface %p stub!\n", iface);
+    return D2D1_TEXT_ANTIALIAS_MODE_DEFAULT;
+}
+
+static void WINAPI d2d_device_context_SetTextRenderingParams(ID2D1DeviceContext *iface,
+        IDWriteRenderingParams *text_rendering_params)
+{
+    FIXME("iface %p, text_rendering_params %p stub!\n", iface, text_rendering_params);
+}
+
+static void WINAPI d2d_device_context_GetTextRenderingParams(ID2D1DeviceContext *iface,
+        IDWriteRenderingParams **text_rendering_params)
+{
+    FIXME("iface %p, text_rendering_params %p stub!\n", iface, text_rendering_params);
+}
+
+static void WINAPI d2d_device_context_SetTags(ID2D1DeviceContext *iface, D2D1_TAG tag1, D2D1_TAG tag2)
+{
+    FIXME("iface %p, tag1 %s, tag2 %s stub!\n", iface, wine_dbgstr_longlong(tag1), wine_dbgstr_longlong(tag2));
+}
+
+static void WINAPI d2d_device_context_GetTags(ID2D1DeviceContext *iface, D2D1_TAG *tag1, D2D1_TAG *tag2)
+{
+    FIXME("iface %p, tag1 %p, tag2 %p stub!\n", iface, tag1, tag2);
+}
+
+static void WINAPI d2d_device_context_PushLayer(ID2D1DeviceContext *iface,
+        const D2D1_LAYER_PARAMETERS *layer_parameters, ID2D1Layer *layer)
+{
+    FIXME("iface %p, layer_parameters %p, layer %p stub!\n", iface, layer_parameters, layer);
+}
+
+static void WINAPI d2d_device_context_PopLayer(ID2D1DeviceContext *iface)
+{
+    FIXME("iface %p stub!\n", iface);
+}
+
+static HRESULT WINAPI d2d_device_context_Flush(ID2D1DeviceContext *iface, D2D1_TAG *tag1, D2D1_TAG *tag2)
+{
+    FIXME("iface %p, tag1 %p, tag2 %p stub!\n", iface, tag1, tag2);
+    return E_NOTIMPL;
+}
+
+static void WINAPI d2d_device_context_SaveDrawingState(ID2D1DeviceContext *iface, ID2D1DrawingStateBlock *state_block)
+{
+    FIXME("iface %p, state_block %p stub!\n", iface, state_block);
+}
+
+static void WINAPI d2d_device_context_RestoreDrawingState(ID2D1DeviceContext *iface,
+        ID2D1DrawingStateBlock *state_block)
+{
+    FIXME("iface %p, state_block %p stub!\n", iface, state_block);
+}
+
+static void WINAPI d2d_device_context_PushAxisAlignedClip(ID2D1DeviceContext *iface,
+        const D2D1_RECT_F *clip_rect, D2D1_ANTIALIAS_MODE antialias_mode)
+{
+    FIXME("iface %p, clip_rect %p, antialias_mode %d stub!\n", iface, clip_rect, antialias_mode);
+}
+
+static void WINAPI d2d_device_context_PopAxisAlignedClip(ID2D1DeviceContext *iface)
+{
+    FIXME("iface %p stub!\n", iface);
+}
+
+static void WINAPI d2d_device_context_Clear(ID2D1DeviceContext *iface, const D2D1_COLOR_F *color)
+{
+    FIXME("iface %p, color %p stub!\n", iface, color);
+}
+
+static void WINAPI d2d_device_context_BeginDraw(ID2D1DeviceContext *iface)
+{
+    FIXME("iface %p stub!\n", iface);
+}
+
+static HRESULT WINAPI d2d_device_context_EndDraw(ID2D1DeviceContext *iface, D2D1_TAG *tag1, D2D1_TAG *tag2)
+{
+    FIXME("iface %p, tag1 %p, tag2 %p stub!\n", iface, tag1, tag2);
+    return E_NOTIMPL;
+}
+
+static D2D1_PIXEL_FORMAT * WINAPI d2d_device_context_GetPixelFormat(ID2D1DeviceContext *iface,
+        D2D1_PIXEL_FORMAT *format)
+{
+    FIXME("iface %p, format %p stub!\n", iface, format);
+    return NULL;
+}
+
+static void WINAPI d2d_device_context_SetDpi(ID2D1DeviceContext *iface, float dpi_x, float dpi_y)
+{
+    FIXME("iface %p, dpi_x %.8e, dpi_y %.8e stub!\n", iface, dpi_x, dpi_y);
+}
+
+static void WINAPI d2d_device_context_GetDpi(ID2D1DeviceContext *iface, float *dpi_x, float *dpi_y)
+{
+    FIXME("iface %p, dpi_x %p, dpi_y %p stub!\n", iface, dpi_x, dpi_y);
+}
+
+static D2D1_SIZE_F * WINAPI d2d_device_context_GetSize(ID2D1DeviceContext *iface, D2D1_SIZE_F *size)
+{
+    FIXME("iface %p, size %p stub!\n", iface, size);
+    return NULL;
+}
+
+static D2D1_SIZE_U * WINAPI d2d_device_context_GetPixelSize(ID2D1DeviceContext *iface, D2D1_SIZE_U *size)
+{
+    FIXME("iface %p, size %p stub!\n", iface, size);
+    return NULL;
+}
+
+static UINT32 WINAPI d2d_device_context_GetMaximumBitmapSize(ID2D1DeviceContext *iface)
+{
+    FIXME("iface %p stub!\n", iface);
+    return 0;
+}
+
+static BOOL WINAPI d2d_device_context_IsSupported(ID2D1DeviceContext *iface, const D2D1_RENDER_TARGET_PROPERTIES *desc)
+{
+    FIXME("iface %p, desc %p stub!\n", iface, desc);
+    return FALSE;
+}
+
+static HRESULT WINAPI d2d_device_context_CreateBitmap_(ID2D1DeviceContext *iface, D2D1_SIZE_U size,
+        const void *src_data, UINT32 pitch, const D2D1_BITMAP_PROPERTIES1 *bitmap_desc, ID2D1Bitmap1 **bitmap)
+{
+    FIXME("iface %p, size {%u, %u}, src_data %p, pitch %u, bitmap_desc %p, bitmap %p stub!\n", iface,
+            size.width, size.height, src_data, pitch, bitmap_desc, bitmap);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI d2d_device_context_CreateBitmapFromWicBitmap_(ID2D1DeviceContext *iface,
+        IWICBitmapSource *wic_bitmap_source, const D2D1_BITMAP_PROPERTIES1 *bitmap_desc, ID2D1Bitmap1 **bitmap)
+{
+    FIXME("iface %p, wic_bitmap_source %p, bitmap_desc %p, bitmap %p stub!\n", iface, wic_bitmap_source,
+            bitmap_desc, bitmap);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI d2d_device_context_CreateColorContext(ID2D1DeviceContext *iface, D2D1_COLOR_SPACE space,
+        const BYTE *profile, UINT32 profile_size, ID2D1ColorContext **color_context)
+{
+    FIXME("iface %p, space %d, profile %p, profile_size %u, color_context %p stub!\n", iface, space, profile,
+            profile_size, color_context);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI d2d_device_context_CreateColorContextFromFilename(ID2D1DeviceContext *iface,
+        const WCHAR *filename, ID2D1ColorContext **color_context)
+{
+    FIXME("iface %p, filename %s, color_context %p stub!\n", iface, debugstr_w(filename), color_context);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI d2d_device_context_CreateColorContextFromWicColorContext(ID2D1DeviceContext *iface,
+        IWICColorContext *wic_color_context, ID2D1ColorContext **color_context)
+{
+    FIXME("iface %p, wic_color_context %p, color_context %p stub!\n", iface, wic_color_context,
+            color_context);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI d2d_device_context_CreateBitmapFromDxgiSurface(ID2D1DeviceContext *iface, IDXGISurface *surface,
+        const D2D1_BITMAP_PROPERTIES1 *bitmap_desc, ID2D1Bitmap1 **bitmap)
+{
+    FIXME("iface %p, surface %p, bitmap_desc %p, bitmap %p stub!\n", iface, surface, bitmap_desc, bitmap);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI d2d_device_context_CreateEffect(ID2D1DeviceContext *iface, REFCLSID effect_id,
+        ID2D1Effect **effect)
+{
+    FIXME("iface %p, effect_id %s, effect %p stub!\n", iface, debugstr_guid(effect_id), effect);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI d2d_device_context_CreateGradientStopCollection_(ID2D1DeviceContext *iface,
+        const D2D1_GRADIENT_STOP *stops, UINT stop_count, D2D1_COLOR_SPACE preinterpolation_space,
+        D2D1_COLOR_SPACE postinterpolation_space, D2D1_BUFFER_PRECISION buffer_precision,
+        D2D1_EXTEND_MODE extend_mode, D2D1_COLOR_INTERPOLATION_MODE color_interpolation_mode,
+        ID2D1GradientStopCollection1 **gradient)
+{
+    FIXME("iface %p, stops %p, stop_count %u, preinterpolation_mode %d, postinterpolation_mode %d, \
+            buffer_precision %d, extend_mode %d, color_interpolation_mode %d, gradient %p stub!\n", iface,
+            stops, stop_count, preinterpolation_space, postinterpolation_space, buffer_precision, extend_mode,
+            color_interpolation_mode, gradient);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI d2d_device_context_CreateImageBrush(ID2D1DeviceContext *iface, ID2D1Image *image,
+        const D2D1_IMAGE_BRUSH_PROPERTIES *image_brush_desc, const D2D1_BRUSH_PROPERTIES *brush_desc,
+        ID2D1ImageBrush **brush)
+{
+    FIXME("iface %p, image %p, image_brush_desc %p, brush_desc %p, brush %p stub!\n", iface, image,
+            image_brush_desc, brush_desc, brush);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI d2d_device_context_CreateBitmapBrush_(ID2D1DeviceContext *iface, ID2D1Bitmap *bitmap,
+        const D2D1_BITMAP_BRUSH_PROPERTIES1 *bitmap_brush_desc, const D2D1_BRUSH_PROPERTIES *brush_desc,
+        ID2D1BitmapBrush1 **brush)
+{
+    FIXME("iface %p, bitmap %p, bitmap_brush_desc %p, brush_desc %p, brush %p stub!\n", iface, bitmap,
+            bitmap_brush_desc, brush_desc, brush);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI d2d_device_context_CreateCommandList(ID2D1DeviceContext *iface, ID2D1CommandList **command_list)
+{
+    FIXME("iface %p, command_list %p stub!\n", iface, command_list);
+    return E_NOTIMPL;
+}
+
+static BOOL WINAPI d2d_device_context_IsDxgiFormatSupported(ID2D1DeviceContext *iface, DXGI_FORMAT format)
+{
+    FIXME("iface %p, format %d stub!\n", iface, format);
+    return FALSE;
+}
+
+static BOOL WINAPI d2d_device_context_IsBufferPrecisionSupported(ID2D1DeviceContext *iface,
+        D2D1_BUFFER_PRECISION buffer_precision)
+{
+    FIXME("iface %p, buffer_precision %d stub!\n", iface, buffer_precision);
+    return FALSE;
+}
+
+static void WINAPI d2d_device_context_GetImageLocalBounds(ID2D1DeviceContext *iface, ID2D1Image *image,
+        D2D1_RECT_F *bounds)
+{
+    FIXME("iface %p, image %p, bounds %p stub!\n", iface, image, bounds);
+}
+
+static HRESULT WINAPI d2d_device_context_GetImageWorldBounds(ID2D1DeviceContext *iface, ID2D1Image *image,
+         D2D1_RECT_F *bounds)
+{
+    FIXME("iface %p, image %p, bounds %p stub!\n", iface, image, bounds);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI d2d_device_context_GetGlyphRunWorldBounds(ID2D1DeviceContext *iface,
+        D2D1_POINT_2F baseline_origin, const DWRITE_GLYPH_RUN *glyph_run, DWRITE_MEASURING_MODE measuring_mode,
+        D2D1_RECT_F *bounds)
+{
+    FIXME("iface %p, baseline_origin {%.8e, %.8e}, glyph_run %p, measuring_mode %d, bounds %p stub!\n", iface,
+        baseline_origin.x, baseline_origin.y, glyph_run, measuring_mode, bounds);
+    return E_NOTIMPL;
+}
+
+static void WINAPI d2d_device_context_GetDevice(ID2D1DeviceContext *iface, ID2D1Device **device)
+{
+    struct d2d_device_context *device_context = impl_from_ID2D1DeviceContext(iface);
+
+    TRACE("iface %p, device %p.\n", iface, device);
+
+    *device = &device_context->device->ID2D1Device_iface;
+    ID2D1Device_AddRef(*device);
+}
+
+static void WINAPI d2d_device_context_SetTarget(ID2D1DeviceContext *iface, ID2D1Image *target)
+{
+    FIXME("iface %p, target %p stub!\n", iface, target);
+}
+
+static void WINAPI d2d_device_context_GetTarget(ID2D1DeviceContext *iface, ID2D1Image **target)
+{
+    FIXME("iface %p, target %p stub!\n", iface, target);
+}
+
+static void WINAPI d2d_device_context_SetRenderingControls(ID2D1DeviceContext *iface,
+        const D2D1_RENDERING_CONTROLS *rendering_controls)
+{
+    FIXME("iface %p, rendering_controls %p stub!\n", iface, rendering_controls);
+}
+
+static void WINAPI d2d_device_context_GetRenderingControls(ID2D1DeviceContext *iface,
+        D2D1_RENDERING_CONTROLS *rendering_controls)
+{
+    FIXME("iface %p, rendering_controls %p stub!\n", iface, rendering_controls);
+}
+
+static void WINAPI d2d_device_context_SetPrimitiveBlend(ID2D1DeviceContext *iface,
+        D2D1_PRIMITIVE_BLEND primitive_blend)
+{
+    FIXME("iface %p, primitive_blend %d stub!\n", iface, primitive_blend);
+}
+
+static D2D1_PRIMITIVE_BLEND WINAPI d2d_device_context_GetPrimitiveBlend(ID2D1DeviceContext *iface)
+{
+    FIXME("iface %p stub!\n", iface);
+    return D2D1_PRIMITIVE_BLEND_SOURCE_OVER;
+}
+
+static void WINAPI d2d_device_context_SetUnitMode(ID2D1DeviceContext *iface, D2D1_UNIT_MODE unit_mode)
+{
+    FIXME("iface %p, unit_mode %d stub!\n", iface, unit_mode);
+}
+
+static D2D1_UNIT_MODE WINAPI d2d_device_context_GetUnitMode(ID2D1DeviceContext *iface)
+{
+    FIXME("iface %p stub!\n", iface);
+    return D2D1_UNIT_MODE_DIPS;
+}
+
+static void WINAPI d2d_device_context_DrawGlyphRun_(ID2D1DeviceContext *iface, D2D1_POINT_2F baseline_origin,
+        const DWRITE_GLYPH_RUN *glyph_run, const DWRITE_GLYPH_RUN_DESCRIPTION *glyph_run_desc,
+        ID2D1Brush *brush, DWRITE_MEASURING_MODE measuring_mode)
+{
+    FIXME("iface %p, baseline_origin {%.8e, %.8e}, glyph_run %p, glyph_run_desc %p, brush %p, measuring_mode %d stub!\n",
+            iface, baseline_origin.x, baseline_origin.y, glyph_run, glyph_run_desc, brush, measuring_mode);
+}
+
+static void WINAPI d2d_device_context_DrawImage(ID2D1DeviceContext *iface, ID2D1Image *image,
+        const D2D1_POINT_2F *target_offset, const D2D1_RECT_F *image_rect, D2D1_INTERPOLATION_MODE interpolation_mode,
+        D2D1_COMPOSITE_MODE composite_mode)
+{
+    FIXME("iface %p, image %p, target_offset %p, image_rect %p, interpolation_mode %d, composite_mode %d stub!\n",
+            iface, image, target_offset, image_rect, interpolation_mode, composite_mode);
+}
+
+static void WINAPI d2d_device_context_DrawGdiMetafile(ID2D1DeviceContext *iface, ID2D1GdiMetafile *metafile,
+        const D2D1_POINT_2F *target_offset)
+{
+    FIXME("iface %p, metafile %p, target_offset %p stub!\n", iface, metafile, target_offset);
+}
+
+static void WINAPI d2d_device_context_DrawBitmap_(ID2D1DeviceContext *iface, ID2D1Bitmap *bitmap,
+        const D2D1_RECT_F *dest_rect, float opacity, D2D1_INTERPOLATION_MODE interpolation_mode,
+        const D2D1_RECT_F *src_rect, const D2D1_MATRIX_4X4_F *transform)
+{
+    FIXME("iface %p, bitmap %p, dest_rect %p, opacity %.8e, interpolation_mode %d, src_rect %p, \
+            transform %p stub!\n", iface, bitmap, dest_rect, opacity, interpolation_mode, src_rect, transform);
+}
+
+static void WINAPI d2d_device_context_PushLayer_(ID2D1DeviceContext *iface,
+        const D2D1_LAYER_PARAMETERS1 *layer_parameters, ID2D1Layer *layer)
+{
+    FIXME("iface %p, layer_parameters %p, layer %p stub!\n", iface, layer_parameters, layer);
+}
+
+static HRESULT WINAPI d2d_device_context_InvalidateEffectInputRectangle(ID2D1DeviceContext *iface,
+        ID2D1Effect *effect, UINT32 input, const D2D1_RECT_F *rect)
+{
+    FIXME("iface %p, effect %p, input %u, rect %p stub!\n", iface, effect, input, rect);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI d2d_device_context_GetEffectInvalidRectangleCount(ID2D1DeviceContext *iface,
+        ID2D1Effect *effect, UINT32 *rect_count)
+{
+    FIXME("iface %p, effect %p, rect_count %p stub!\n", iface, effect, rect_count);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI d2d_device_context_GetEffectInvalidRectangles(ID2D1DeviceContext *iface, ID2D1Effect *effect,
+        D2D1_RECT_F *rects, UINT32 rect_count)
+{
+    FIXME("iface %p, effect %p, rects %p, rect_count %u stub!\n", iface, effect, rects, rect_count);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI d2d_device_context_GetEffectRequiredInputRectangles(ID2D1DeviceContext *iface,
+        ID2D1Effect *effect, const D2D1_RECT_F *image_rect, const D2D1_EFFECT_INPUT_DESCRIPTION *input_desc,
+        D2D1_RECT_F *required_rects, UINT32 input_count)
+{
+    FIXME("iface %p, effect %p, image_rect %p, input_desc %p, required_rects %p, input_count %u stub!\n", iface,
+            effect, image_rect, input_desc, required_rects, input_count);
+    return E_NOTIMPL;
+}
+
+static void WINAPI d2d_device_context_ID2D1DeviceContext_FillOpacityMask(
+        ID2D1DeviceContext *iface,
+        ID2D1Bitmap *opacityMask,
+        ID2D1Brush *brush,
+        const D2D1_RECT_F *destinationRectangle,
+        const D2D1_RECT_F *sourceRectangle)
+{
+    struct d2d_device_context *This = impl_from_ID2D1DeviceContext(iface);
+    FIXME("%p stub!\n", This);
+}
+
+static const struct ID2D1DeviceContextVtbl d2d_device_context_vtbl =
+{
+    d2d_device_context_QueryInterface,
+    d2d_device_context_AddRef,
+    d2d_device_context_Release,
+    d2d_device_context_GetFactory,
+    d2d_device_context_CreateBitmap,
+    d2d_device_context_CreateBitmapFromWicBitmap,
+    d2d_device_context_CreateSharedBitmap,
+    d2d_device_context_CreateBitmapBrush,
+    d2d_device_context_CreateSolidColorBrush,
+    d2d_device_context_CreateGradientStopCollection,
+    d2d_device_context_CreateLinearGradientBrush,
+    d2d_device_context_CreateRadialGradientBrush,
+    d2d_device_context_CreateCompatibleRenderTarget,
+    d2d_device_context_CreateLayer,
+    d2d_device_context_CreateMesh,
+    d2d_device_context_DrawLine,
+    d2d_device_context_DrawRectangle,
+    d2d_device_context_FillRectangle,
+    d2d_device_context_DrawRoundedRectangle,
+    d2d_device_context_FillRoundedRectangle,
+    d2d_device_context_DrawEllipse,
+    d2d_device_context_FillEllipse,
+    d2d_device_context_DrawGeometry,
+    d2d_device_context_FillGeometry,
+    d2d_device_context_FillMesh,
+    d2d_device_context_FillOpacityMask,
+    d2d_device_context_DrawBitmap,
+    d2d_device_context_DrawText,
+    d2d_device_context_DrawTextLayout,
+    d2d_device_context_DrawGlyphRun,
+    d2d_device_context_SetTransform,
+    d2d_device_context_GetTransform,
+    d2d_device_context_SetAntialiasMode,
+    d2d_device_context_GetAntialiasMode,
+    d2d_device_context_SetTextAntialiasMode,
+    d2d_device_context_GetTextAntialiasMode,
+    d2d_device_context_SetTextRenderingParams,
+    d2d_device_context_GetTextRenderingParams,
+    d2d_device_context_SetTags,
+    d2d_device_context_GetTags,
+    d2d_device_context_PushLayer,
+    d2d_device_context_PopLayer,
+    d2d_device_context_Flush,
+    d2d_device_context_SaveDrawingState,
+    d2d_device_context_RestoreDrawingState,
+    d2d_device_context_PushAxisAlignedClip,
+    d2d_device_context_PopAxisAlignedClip,
+    d2d_device_context_Clear,
+    d2d_device_context_BeginDraw,
+    d2d_device_context_EndDraw,
+    d2d_device_context_GetPixelFormat,
+    d2d_device_context_SetDpi,
+    d2d_device_context_GetDpi,
+    d2d_device_context_GetSize,
+    d2d_device_context_GetPixelSize,
+    d2d_device_context_GetMaximumBitmapSize,
+    d2d_device_context_IsSupported,
+    d2d_device_context_CreateBitmap_,
+    d2d_device_context_CreateBitmapFromWicBitmap_,
+    d2d_device_context_CreateColorContext,
+    d2d_device_context_CreateColorContextFromFilename,
+    d2d_device_context_CreateColorContextFromWicColorContext,
+    d2d_device_context_CreateBitmapFromDxgiSurface,
+    d2d_device_context_CreateEffect,
+    d2d_device_context_CreateGradientStopCollection_,
+    d2d_device_context_CreateImageBrush,
+    d2d_device_context_CreateBitmapBrush_,
+    d2d_device_context_CreateCommandList,
+    d2d_device_context_IsDxgiFormatSupported,
+    d2d_device_context_IsBufferPrecisionSupported,
+    d2d_device_context_GetImageLocalBounds,
+    d2d_device_context_GetImageWorldBounds,
+    d2d_device_context_GetGlyphRunWorldBounds,
+    d2d_device_context_GetDevice,
+    d2d_device_context_SetTarget,
+    d2d_device_context_GetTarget,
+    d2d_device_context_SetRenderingControls,
+    d2d_device_context_GetRenderingControls,
+    d2d_device_context_SetPrimitiveBlend,
+    d2d_device_context_GetPrimitiveBlend,
+    d2d_device_context_SetUnitMode,
+    d2d_device_context_GetUnitMode,
+    d2d_device_context_DrawGlyphRun_,
+    d2d_device_context_DrawImage,
+    d2d_device_context_DrawGdiMetafile,
+    d2d_device_context_DrawBitmap_,
+    d2d_device_context_PushLayer_,
+    d2d_device_context_InvalidateEffectInputRectangle,
+    d2d_device_context_GetEffectInvalidRectangleCount,
+    d2d_device_context_GetEffectInvalidRectangles,
+    d2d_device_context_GetEffectRequiredInputRectangles,
+    d2d_device_context_ID2D1DeviceContext_FillOpacityMask,
+};
+
+static void d2d_device_context_init(struct d2d_device_context *device_context, struct d2d_device *device)
+{
+    device_context->ID2D1DeviceContext_iface.lpVtbl = &d2d_device_context_vtbl;
+    device_context->refcount = 1;
+    device_context->device = device;
+    ID2D1Device_AddRef(&device->ID2D1Device_iface);
+}
+
 static HRESULT WINAPI d2d_device_QueryInterface(ID2D1Device *iface, REFIID iid, void **out)
 {
     TRACE("iface %p, iid %s, out %p.\n", iface, debugstr_guid(iid), out);
@@ -3354,9 +4123,20 @@ static void WINAPI d2d_device_GetFactory(ID2D1Device *iface, ID2D1Factory **fact
 static HRESULT WINAPI d2d_device_CreateDeviceContext(ID2D1Device *iface, D2D1_DEVICE_CONTEXT_OPTIONS options,
         ID2D1DeviceContext **context)
 {
-    FIXME("iface %p, options %#x, context %p stub!\n", iface, options, context);
+    struct d2d_device *device = impl_from_ID2D1Device(iface);
+    struct d2d_device_context *object;
 
-    return E_NOTIMPL;
+    TRACE("iface %p, options %#x, context %p.\n", iface, options, context);
+
+    if (!(object = heap_alloc_zero(sizeof(*object))))
+        return E_OUTOFMEMORY;
+
+    d2d_device_context_init(object, device);
+
+    TRACE("Created device context %p.\n", object);
+    *context = &object->ID2D1DeviceContext_iface;
+
+    return S_OK;
 }
 
 static HRESULT WINAPI d2d_device_CreatePrintControl(ID2D1Device *iface, IWICImagingFactory *wic_factory,
-- 
2.17.0




More information about the wine-devel mailing list