[PATCH 6/9] d2d1: Stub ID2D1Bitmap1

Lucian Poston lucian.poston at gmail.com
Tue Nov 21 02:41:10 CST 2017


https://bugs.winehq.org/show_bug.cgi?id=44052

Signed-off-by: Lucian Poston <lucian.poston at gmail.com>
---
 dlls/d2d1/bitmap.c        | 80 ++++++++++++++++++++++++++++++++++++++---------
 dlls/d2d1/brush.c         |  8 ++---
 dlls/d2d1/d2d1_private.h  |  3 +-
 dlls/d2d1/render_target.c |  6 ++--
 4 files changed, 74 insertions(+), 23 deletions(-)

diff --git a/dlls/d2d1/bitmap.c b/dlls/d2d1/bitmap.c
index 6d9c352924..54202a6b13 100644
--- a/dlls/d2d1/bitmap.c
+++ b/dlls/d2d1/bitmap.c
@@ -24,20 +24,22 @@
 
 WINE_DEFAULT_DEBUG_CHANNEL(d2d);
 
-static inline struct d2d_bitmap *impl_from_ID2D1Bitmap(ID2D1Bitmap *iface)
+static inline struct d2d_bitmap *impl_from_ID2D1Bitmap(ID2D1Bitmap1 *iface)
 {
     return CONTAINING_RECORD(iface, struct d2d_bitmap, ID2D1Bitmap_iface);
 }
 
-static HRESULT STDMETHODCALLTYPE d2d_bitmap_QueryInterface(ID2D1Bitmap *iface, REFIID iid, void **out)
+static HRESULT STDMETHODCALLTYPE d2d_bitmap_QueryInterface(ID2D1Bitmap1 *iface, REFIID iid, void **out)
 {
     TRACE("iface %p, iid %s, out %p.\n", iface, debugstr_guid(iid), out);
 
     if (IsEqualGUID(iid, &IID_ID2D1Bitmap)
+            || IsEqualGUID(iid, &IID_ID2D1Bitmap1)
+            || IsEqualGUID(iid, &IID_ID2D1Image)
             || IsEqualGUID(iid, &IID_ID2D1Resource)
             || IsEqualGUID(iid, &IID_IUnknown))
     {
-        ID2D1Bitmap_AddRef(iface);
+        ID2D1Bitmap1_AddRef(iface);
         *out = iface;
         return S_OK;
     }
@@ -48,7 +50,7 @@ static HRESULT STDMETHODCALLTYPE d2d_bitmap_QueryInterface(ID2D1Bitmap *iface, R
     return E_NOINTERFACE;
 }
 
-static ULONG STDMETHODCALLTYPE d2d_bitmap_AddRef(ID2D1Bitmap *iface)
+static ULONG STDMETHODCALLTYPE d2d_bitmap_AddRef(ID2D1Bitmap1 *iface)
 {
     struct d2d_bitmap *bitmap = impl_from_ID2D1Bitmap(iface);
     ULONG refcount = InterlockedIncrement(&bitmap->refcount);
@@ -58,7 +60,7 @@ static ULONG STDMETHODCALLTYPE d2d_bitmap_AddRef(ID2D1Bitmap *iface)
     return refcount;
 }
 
-static ULONG STDMETHODCALLTYPE d2d_bitmap_Release(ID2D1Bitmap *iface)
+static ULONG STDMETHODCALLTYPE d2d_bitmap_Release(ID2D1Bitmap1 *iface)
 {
     struct d2d_bitmap *bitmap = impl_from_ID2D1Bitmap(iface);
     ULONG refcount = InterlockedDecrement(&bitmap->refcount);
@@ -75,7 +77,7 @@ static ULONG STDMETHODCALLTYPE d2d_bitmap_Release(ID2D1Bitmap *iface)
     return refcount;
 }
 
-static void STDMETHODCALLTYPE d2d_bitmap_GetFactory(ID2D1Bitmap *iface, ID2D1Factory **factory)
+static void STDMETHODCALLTYPE d2d_bitmap_GetFactory(ID2D1Bitmap1 *iface, ID2D1Factory **factory)
 {
     struct d2d_bitmap *bitmap = impl_from_ID2D1Bitmap(iface);
 
@@ -84,7 +86,7 @@ static void STDMETHODCALLTYPE d2d_bitmap_GetFactory(ID2D1Bitmap *iface, ID2D1Fac
     ID2D1Factory_AddRef(*factory = bitmap->factory);
 }
 
-static D2D1_SIZE_F * STDMETHODCALLTYPE d2d_bitmap_GetSize(ID2D1Bitmap *iface, D2D1_SIZE_F *size)
+static D2D1_SIZE_F * STDMETHODCALLTYPE d2d_bitmap_GetSize(ID2D1Bitmap1 *iface, D2D1_SIZE_F *size)
 {
     struct d2d_bitmap *bitmap = impl_from_ID2D1Bitmap(iface);
 
@@ -95,7 +97,7 @@ static D2D1_SIZE_F * STDMETHODCALLTYPE d2d_bitmap_GetSize(ID2D1Bitmap *iface, D2
     return size;
 }
 
-static D2D1_SIZE_U * STDMETHODCALLTYPE d2d_bitmap_GetPixelSize(ID2D1Bitmap *iface, D2D1_SIZE_U *pixel_size)
+static D2D1_SIZE_U * STDMETHODCALLTYPE d2d_bitmap_GetPixelSize(ID2D1Bitmap1 *iface, D2D1_SIZE_U *pixel_size)
 {
     struct d2d_bitmap *bitmap = impl_from_ID2D1Bitmap(iface);
 
@@ -105,7 +107,7 @@ static D2D1_SIZE_U * STDMETHODCALLTYPE d2d_bitmap_GetPixelSize(ID2D1Bitmap *ifac
     return pixel_size;
 }
 
-static D2D1_PIXEL_FORMAT * STDMETHODCALLTYPE d2d_bitmap_GetPixelFormat(ID2D1Bitmap *iface, D2D1_PIXEL_FORMAT *format)
+static D2D1_PIXEL_FORMAT * STDMETHODCALLTYPE d2d_bitmap_GetPixelFormat(ID2D1Bitmap1 *iface, D2D1_PIXEL_FORMAT *format)
 {
     struct d2d_bitmap *bitmap = impl_from_ID2D1Bitmap(iface);
 
@@ -115,7 +117,7 @@ static D2D1_PIXEL_FORMAT * STDMETHODCALLTYPE d2d_bitmap_GetPixelFormat(ID2D1Bitm
     return format;
 }
 
-static void STDMETHODCALLTYPE d2d_bitmap_GetDpi(ID2D1Bitmap *iface, float *dpi_x, float *dpi_y)
+static void STDMETHODCALLTYPE d2d_bitmap_GetDpi(ID2D1Bitmap1 *iface, float *dpi_x, float *dpi_y)
 {
     struct d2d_bitmap *bitmap = impl_from_ID2D1Bitmap(iface);
 
@@ -125,7 +127,7 @@ static void STDMETHODCALLTYPE d2d_bitmap_GetDpi(ID2D1Bitmap *iface, float *dpi_x
     *dpi_y = bitmap->dpi_y;
 }
 
-static HRESULT STDMETHODCALLTYPE d2d_bitmap_CopyFromBitmap(ID2D1Bitmap *iface,
+static HRESULT STDMETHODCALLTYPE d2d_bitmap_CopyFromBitmap(ID2D1Bitmap1 *iface,
         const D2D1_POINT_2U *dst_point, ID2D1Bitmap *bitmap, const D2D1_RECT_U *src_rect)
 {
     FIXME("iface %p, dst_point %p, bitmap %p, src_rect %p stub!\n", iface, dst_point, bitmap, src_rect);
@@ -133,7 +135,7 @@ static HRESULT STDMETHODCALLTYPE d2d_bitmap_CopyFromBitmap(ID2D1Bitmap *iface,
     return E_NOTIMPL;
 }
 
-static HRESULT STDMETHODCALLTYPE d2d_bitmap_CopyFromRenderTarget(ID2D1Bitmap *iface,
+static HRESULT STDMETHODCALLTYPE d2d_bitmap_CopyFromRenderTarget(ID2D1Bitmap1 *iface,
         const D2D1_POINT_2U *dst_point, ID2D1RenderTarget *render_target, const D2D1_RECT_U *src_rect)
 {
     FIXME("iface %p, dst_point %p, render_target %p, src_rect %p stub!\n", iface, dst_point, render_target, src_rect);
@@ -141,7 +143,7 @@ static HRESULT STDMETHODCALLTYPE d2d_bitmap_CopyFromRenderTarget(ID2D1Bitmap *if
     return E_NOTIMPL;
 }
 
-static HRESULT STDMETHODCALLTYPE d2d_bitmap_CopyFromMemory(ID2D1Bitmap *iface,
+static HRESULT STDMETHODCALLTYPE d2d_bitmap_CopyFromMemory(ID2D1Bitmap1 *iface,
         const D2D1_RECT_U *dst_rect, const void *src_data, UINT32 pitch)
 {
     struct d2d_bitmap *bitmap = impl_from_ID2D1Bitmap(iface);
@@ -170,7 +172,50 @@ static HRESULT STDMETHODCALLTYPE d2d_bitmap_CopyFromMemory(ID2D1Bitmap *iface,
     return S_OK;
 }
 
-static const struct ID2D1BitmapVtbl d2d_bitmap_vtbl =
+static void WINAPI d2d_bitmap1_GetColorContext(
+        ID2D1Bitmap1 *iface,
+        ID2D1ColorContext **colorContext)
+{
+    struct d2d_bitmap *This = impl_from_ID2D1Bitmap(iface);
+    FIXME("%p stub!\n", This);
+}
+
+static D2D1_BITMAP_OPTIONS WINAPI d2d_bitmap1_GetOptions(
+        ID2D1Bitmap1 *iface)
+{
+    struct d2d_bitmap *This = impl_from_ID2D1Bitmap(iface);
+    FIXME("%p stub!\n", This);
+    return D2D1_BITMAP_OPTIONS_NONE;
+}
+
+static HRESULT WINAPI d2d_bitmap1_GetSurface(
+        ID2D1Bitmap1 *iface,
+        IDXGISurface **dxgiSurface)
+{
+    struct d2d_bitmap *This = impl_from_ID2D1Bitmap(iface);
+    FIXME("%p stub!\n", This);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI d2d_bitmap1_Map(
+        ID2D1Bitmap1 *iface,
+        D2D1_MAP_OPTIONS Options,
+        D2D1_MAPPED_RECT *mappedRect)
+{
+    struct d2d_bitmap *This = impl_from_ID2D1Bitmap(iface);
+    FIXME("%p stub!\n", This);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI d2d_bitmap1_Unmap(
+        ID2D1Bitmap1 *iface)
+{
+    struct d2d_bitmap *This = impl_from_ID2D1Bitmap(iface);
+    FIXME("%p stub!\n", This);
+    return E_NOTIMPL;
+}
+
+static const struct ID2D1Bitmap1Vtbl d2d_bitmap_vtbl =
 {
     d2d_bitmap_QueryInterface,
     d2d_bitmap_AddRef,
@@ -183,6 +228,11 @@ static const struct ID2D1BitmapVtbl d2d_bitmap_vtbl =
     d2d_bitmap_CopyFromBitmap,
     d2d_bitmap_CopyFromRenderTarget,
     d2d_bitmap_CopyFromMemory,
+    d2d_bitmap1_GetColorContext,
+    d2d_bitmap1_GetOptions,
+    d2d_bitmap1_GetSurface,
+    d2d_bitmap1_Map,
+    d2d_bitmap1_Unmap,
 };
 
 static BOOL format_supported(const D2D1_PIXEL_FORMAT *format)
@@ -534,6 +584,6 @@ struct d2d_bitmap *unsafe_impl_from_ID2D1Bitmap(ID2D1Bitmap *iface)
 {
     if (!iface)
         return NULL;
-    assert(iface->lpVtbl == &d2d_bitmap_vtbl);
+    assert(((ID2D1Bitmap1 *)iface)->lpVtbl == &d2d_bitmap_vtbl);
     return CONTAINING_RECORD(iface, struct d2d_bitmap, ID2D1Bitmap_iface);
 }
diff --git a/dlls/d2d1/brush.c b/dlls/d2d1/brush.c
index ba07006c58..03573df054 100644
--- a/dlls/d2d1/brush.c
+++ b/dlls/d2d1/brush.c
@@ -863,7 +863,7 @@ static ULONG STDMETHODCALLTYPE d2d_bitmap_brush_Release(ID2D1BitmapBrush *iface)
         if (brush->u.bitmap.sampler_state)
             ID3D10SamplerState_Release(brush->u.bitmap.sampler_state);
         if (brush->u.bitmap.bitmap)
-            ID2D1Bitmap_Release(&brush->u.bitmap.bitmap->ID2D1Bitmap_iface);
+            ID2D1Bitmap1_Release(&brush->u.bitmap.bitmap->ID2D1Bitmap_iface);
         d2d_brush_destroy(brush);
     }
 
@@ -970,7 +970,7 @@ static void STDMETHODCALLTYPE d2d_bitmap_brush_SetBitmap(ID2D1BitmapBrush *iface
     if (bitmap)
         ID2D1Bitmap_AddRef(bitmap);
     if (brush->u.bitmap.bitmap)
-        ID2D1Bitmap_Release(&brush->u.bitmap.bitmap->ID2D1Bitmap_iface);
+        ID2D1Bitmap1_Release(&brush->u.bitmap.bitmap->ID2D1Bitmap_iface);
     brush->u.bitmap.bitmap = unsafe_impl_from_ID2D1Bitmap(bitmap);
 }
 
@@ -1007,7 +1007,7 @@ static void STDMETHODCALLTYPE d2d_bitmap_brush_GetBitmap(ID2D1BitmapBrush *iface
 
     TRACE("iface %p, bitmap %p.\n", iface, bitmap);
 
-    if ((*bitmap = &brush->u.bitmap.bitmap->ID2D1Bitmap_iface))
+    if ((*bitmap = (ID2D1Bitmap *)&brush->u.bitmap.bitmap->ID2D1Bitmap_iface))
         ID2D1Bitmap_AddRef(*bitmap);
 }
 
@@ -1040,7 +1040,7 @@ HRESULT d2d_bitmap_brush_create(ID2D1Factory *factory, ID2D1Bitmap *bitmap, cons
     d2d_brush_init(*brush, factory, D2D_BRUSH_TYPE_BITMAP,
             brush_desc, (ID2D1BrushVtbl *)&d2d_bitmap_brush_vtbl);
     if (((*brush)->u.bitmap.bitmap = unsafe_impl_from_ID2D1Bitmap(bitmap)))
-        ID2D1Bitmap_AddRef(&(*brush)->u.bitmap.bitmap->ID2D1Bitmap_iface);
+        ID2D1Bitmap1_AddRef(&(*brush)->u.bitmap.bitmap->ID2D1Bitmap_iface);
     if (bitmap_brush_desc)
     {
         (*brush)->u.bitmap.extend_mode_x = bitmap_brush_desc->extendModeX;
diff --git a/dlls/d2d1/d2d1_private.h b/dlls/d2d1/d2d1_private.h
index 3b21bc1fb6..69560e93f0 100644
--- a/dlls/d2d1/d2d1_private.h
+++ b/dlls/d2d1/d2d1_private.h
@@ -319,7 +319,8 @@ HRESULT d2d_mesh_create(ID2D1Factory *factory, struct d2d_mesh **mesh) DECLSPEC_
 
 struct d2d_bitmap
 {
-    ID2D1Bitmap ID2D1Bitmap_iface;
+    ID2D1Bitmap1 ID2D1Bitmap_iface;
+
     LONG refcount;
 
     ID2D1Factory *factory;
diff --git a/dlls/d2d1/render_target.c b/dlls/d2d1/render_target.c
index 0c44014ae1..1299c849ac 100644
--- a/dlls/d2d1/render_target.c
+++ b/dlls/d2d1/render_target.c
@@ -299,7 +299,7 @@ static HRESULT STDMETHODCALLTYPE d2d_d3d_render_target_CreateBitmap(ID2D1RenderT
             iface, size.width, size.height, src_data, pitch, desc, bitmap);
 
     if (SUCCEEDED(hr = d2d_bitmap_create(render_target->factory, render_target->device, size, src_data, pitch, desc, &object)))
-        *bitmap = &object->ID2D1Bitmap_iface;
+        *bitmap = (ID2D1Bitmap *)&object->ID2D1Bitmap_iface;
 
     return hr;
 }
@@ -316,7 +316,7 @@ static HRESULT STDMETHODCALLTYPE d2d_d3d_render_target_CreateBitmapFromWicBitmap
 
     if (SUCCEEDED(hr = d2d_bitmap_create_from_wic_bitmap(render_target->factory, render_target->device, bitmap_source,
             desc, &object)))
-        *bitmap = &object->ID2D1Bitmap_iface;
+        *bitmap = (ID2D1Bitmap *)&object->ID2D1Bitmap_iface;
 
     return hr;
 }
@@ -332,7 +332,7 @@ static HRESULT STDMETHODCALLTYPE d2d_d3d_render_target_CreateSharedBitmap(ID2D1R
             iface, debugstr_guid(iid), data, desc, bitmap);
 
     if (SUCCEEDED(hr = d2d_bitmap_create_shared(iface, render_target->device, iid, data, desc, &object)))
-        *bitmap = &object->ID2D1Bitmap_iface;
+        *bitmap = (ID2D1Bitmap *)&object->ID2D1Bitmap_iface;
 
     return hr;
 }
-- 
2.13.6




More information about the wine-devel mailing list