Rebase against 8b9ba16e9ad9ca85b93b05c13d6c5044a1a5ecf3.

This commit is contained in:
Zebediah Figura
2018-05-21 20:30:37 -05:00
parent 53a402bde4
commit da46ed3444
15 changed files with 313 additions and 1338 deletions

View File

@@ -1,65 +1,36 @@
From 6bb2d09fd7d71ccf338f3a32d52dfbc3029b104c Mon Sep 17 00:00:00 2001
From b9218f8580e217d01bbef80ff78b21c877fd4a3f Mon Sep 17 00:00:00 2001
From: Lucian Poston <lucian.poston@gmail.com>
Date: Wed, 2 May 2018 22:38:33 -0700
Subject: [PATCH 1/7] d2d1: Add d2d1_1.idl for drawing ID2D1Bitmap1
Subject: d2d1: Add d2d1_1.idl for drawing ID2D1Bitmap1
https://bugs.winehq.org/show_bug.cgi?id=44052
Signed-off-by: Lucian Poston <lucian.poston@gmail.com>
---
include/d2d1_1.idl | 523 ++++++++++++++++++++++++++++++++++++++++++++++++++++
include/d2d1_1.idl | 462 ++++++++++++++++++++++++++++++++++++++++++++++++++++
include/dcommon.idl | 15 ++
2 files changed, 538 insertions(+)
2 files changed, 477 insertions(+)
diff --git a/include/d2d1_1.idl b/include/d2d1_1.idl
index 1fbbb30..2ff042f 100644
index 2b1ef2e..33a661c 100644
--- a/include/d2d1_1.idl
+++ b/include/d2d1_1.idl
@@ -17,7 +17,17 @@
*/
@@ -18,6 +18,11 @@
import "d2d1.idl";
+import "dxgi.idl";
+interface IWICImagingFactory;
+interface IWICColorContext;
+interface IPrintDocumentPackageTarget;
+interface ID2D1PrintControl;
+interface ID2D1ColorContext;
+interface ID2D1Bitmap1;
+interface ID2D1CommandSink;
+interface ID2D1Effect;
+interface ID2D1ImageBrush;
interface ID2D1Device;
interface ID2D1DeviceContext;
interface ID2D1StrokeStyle1;
interface ID2D1PathGeometry1;
@@ -50,6 +60,105 @@ typedef enum D2D1_UNIT_MODE
D2D1_UNIT_MODE_FORCE_DWORD = 0xffffffff,
} D2D1_UNIT_MODE;
@@ -76,6 +81,82 @@ typedef enum D2D1_COLOR_SPACE
D2D1_COLOR_SPACE_FORCE_DWORD = 0xffffffff,
} D2D1_COLOR_SPACE;
+typedef enum D2D1_DEVICE_CONTEXT_OPTIONS
+{
+ D2D1_DEVICE_CONTEXT_OPTIONS_NONE = 0,
+ D2D1_DEVICE_CONTEXT_OPTIONS_ENABLE_MULTITHREADED_OPTIMIZATIONS = 1,
+ D2D1_DEVICE_CONTEXT_OPTIONS_FORCE_DWORD = 0xffffffff,
+} D2D1_DEVICE_CONTEXT_OPTIONS;
+
+typedef enum D2D1_PRINT_FONT_SUBSET_MODE
+{
+ D2D1_PRINT_FONT_SUBSET_DEFAULT = 0,
+ D2D1_PRINT_FONT_SUBSET_EACHPAGE = 1,
+ D2D1_PRINT_FONT_SUBSET_NONE = 2,
+ D2D1_PRINT_FONT_SUBSET_FORCE_DWORD = 0xffffffff,
+} D2D1_PRINT_FONT_SUBSET_MODE;
+
+typedef enum D2D1_COLOR_SPACE
+{
+ D2D1_COLOR_SPACE_CUSTOM = 0,
+ D2D1_COLOR_SPACE_SRGB = 1,
+ D2D1_COLOR_SPACE_SCRGB = 2,
+ D2D1_COLOR_SPACE_FORCE_DWORD = 0xffffffff,
+} D2D1_COLOR_SPACE;
+
+typedef enum D2D1_BITMAP_OPTIONS
+{
+ D2D1_BITMAP_OPTIONS_NONE = 0,
@@ -139,9 +110,9 @@ index 1fbbb30..2ff042f 100644
typedef struct D2D1_PROPERTY_BINDING D2D1_PROPERTY_BINDING;
typedef struct D2D1_STROKE_STYLE_PROPERTIES1
@@ -75,6 +184,76 @@ typedef struct D2D1_DRAWING_STATE_DESCRIPTION1
D2D1_UNIT_MODE unitMode;
} D2D1_DRAWING_STATE_DESCRIPTION1;
@@ -108,6 +189,69 @@ typedef struct D2D1_PRINT_CONTROL_PROPERTIES
D2D1_COLOR_SPACE colorSpace;
} D2D1_PRINT_CONTROL_PROPERTIES;
+typedef struct D2D1_MAPPED_RECT
+{
@@ -197,13 +168,6 @@ index 1fbbb30..2ff042f 100644
+ ID2D1ColorContext *colorContext;
+} D2D1_BITMAP_PROPERTIES1;
+
+typedef struct D2D1_PRINT_CONTROL_PROPERTIES
+{
+ D2D1_PRINT_FONT_SUBSET_MODE fontSubset;
+ float rasterDPI;
+ D2D1_COLOR_SPACE colorSpace;
+} D2D1_PRINT_CONTROL_PROPERTIES;
+
+typedef struct D2D1_POINT_DESCRIPTION
+{
+ D2D1_POINT_2F point;
@@ -216,7 +180,7 @@ index 1fbbb30..2ff042f 100644
typedef HRESULT (__stdcall *PD2D1_EFFECT_FACTORY)(IUnknown **effect);
[
@@ -134,3 +313,347 @@ interface ID2D1Factory1 : ID2D1Factory
@@ -193,3 +337,321 @@ interface ID2D1Factory1 : ID2D1Factory
[out] ID2D1Properties **props
);
}
@@ -538,32 +502,6 @@ index 1fbbb30..2ff042f 100644
+ [in] const D2D1_RECT_F *src_rect
+ );
+}
+
+[
+ local,
+ object,
+ uuid(47dd575d-ac05-4cdd-8049-9b02cd16f44c)
+]
+interface ID2D1Device : ID2D1Resource
+{
+ HRESULT CreateDeviceContext(
+ [in] D2D1_DEVICE_CONTEXT_OPTIONS options,
+ [out] ID2D1DeviceContext **context
+ );
+ HRESULT CreatePrintControl(
+ [in] IWICImagingFactory *wic_factory,
+ [in] IPrintDocumentPackageTarget *document_target,
+ [in] const D2D1_PRINT_CONTROL_PROPERTIES *desc,
+ [out] ID2D1PrintControl **print_control
+ );
+ void SetMaximumTextureMemory(
+ [in] UINT64 max_texture_memory
+ );
+ UINT64 GetMaximumTextureMemory();
+ HRESULT ClearResources(
+ [in, defaultvalue(0)] UINT msec_since_use
+ );
+}
diff --git a/include/dcommon.idl b/include/dcommon.idl
index db5055d..18f2fbe 100644
--- a/include/dcommon.idl
@@ -588,5 +526,5 @@ index db5055d..18f2fbe 100644
+ };
+} D2D_MATRIX_4X4_F;
--
1.9.1
2.7.4

View File

@@ -1,152 +0,0 @@
From 041f7ef0b4e4d0ca72470032b2ce7eac9b3a118b Mon Sep 17 00:00:00 2001
From: Lucian Poston <lucian.poston@gmail.com>
Date: Wed, 2 May 2018 23:38:21 -0700
Subject: [PATCH 2/7] d2d1: Test ID2D1DeviceContext drawing ID2D1Bitmap1
This test is based on the d2d usage in the Temple+ app referred to in
the winehq bug at https://bugs.winehq.org/show_bug.cgi?id=44052
Essentially, this test draws a rectangle using a d2d device context,
similar to the basic how-to in the link below.
https://msdn.microsoft.com/en-us/library/windows/desktop/hh780339(v=vs.85).aspx
Signed-off-by: Lucian Poston <lucian.poston@gmail.com>
---
dlls/d2d1/tests/d2d1.c | 107 +++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 107 insertions(+)
diff --git a/dlls/d2d1/tests/d2d1.c b/dlls/d2d1/tests/d2d1.c
index 9bd9e2b..21b4e53 100644
--- a/dlls/d2d1/tests/d2d1.c
+++ b/dlls/d2d1/tests/d2d1.c
@@ -20,6 +20,7 @@
#include <limits.h>
#include <math.h>
#include "d2d1.h"
+#include "d2d1_1.h"
#include "wincrypt.h"
#include "wine/test.h"
#include "initguid.h"
@@ -4635,6 +4636,111 @@ todo_wine
DestroyWindow(window);
}
+static void test_draw_via_ID2D1DeviceContext(void)
+{
+ HRESULT hr;
+ ID2D1Factory1 *factory;
+ ID2D1Device *device;
+ ID3D10Device1 *d3d10_device;
+ IDXGIDevice *dxgi_device;
+ ID2D1DeviceContext *context;
+ IDXGISurface *dxgi_surface;
+ ID2D1Bitmap1 *bitmap;
+ D2D1_BITMAP_PROPERTIES1 bitmap_properties;
+ IDXGISwapChain *swapchain;
+ HWND window;
+ ID2D1SolidColorBrush *brush;
+ D2D1_COLOR_F c;
+ D2D1_RECT_F r;
+ set_color(&c, 0.5f, 0.5f, 0.5f, 0.5f);
+ set_rect(&r, 10.0f, 480.0f, 10.0f, 480.0f);
+
+ if (!(d3d10_device = create_device()))
+ {
+ skip("Failed to create device, skipping test.\n");
+ return;
+ }
+
+ window = create_window();
+ swapchain = create_swapchain(d3d10_device, window, TRUE);
+ hr = IDXGISwapChain_GetBuffer(swapchain, 0, &IID_IDXGISurface, (void **)&dxgi_surface);
+ ok(SUCCEEDED(hr), "Failed to get buffer, hr %#x.\n", hr);
+
+ hr = D2D1CreateFactory(D2D1_FACTORY_TYPE_SINGLE_THREADED,
+ &IID_ID2D1Factory1, NULL, (void**)&factory);
+ if (FAILED(hr))
+ {
+ skip("ID2D1Factory1 unavailable, skipping test.\n");
+ return;
+ }
+
+ hr = ID3D10Device1_QueryInterface(d3d10_device, &IID_IDXGIDevice,
+ (void**)&dxgi_device);
+ ok(SUCCEEDED(hr), "Failed to create dxgi_device, hr %#x.\n", hr);
+ if (FAILED(hr))
+ {
+ skip("dxgi_device unavailable, skipping test.\n");
+ return;
+ }
+
+ hr = ID2D1Factory1_CreateDevice(factory, dxgi_device, &device);
+ todo_wine
+ ok(SUCCEEDED(hr), "Failed to create device, hr %#x.\n", hr);
+ if (FAILED(hr))
+ {
+ skip("device unavailable, skipping test.\n");
+ return;
+ }
+
+ hr = ID2D1Device_CreateDeviceContext(device,
+ D2D1_DEVICE_CONTEXT_OPTIONS_NONE, &context);
+ todo_wine
+ ok(SUCCEEDED(hr), "Failed to create device context, hr %#x.\n", hr);
+ if (FAILED(hr))
+ {
+ skip("device context unavailable, skipping test.\n");
+ return;
+ }
+
+ bitmap_properties.pixelFormat.format = DXGI_FORMAT_UNKNOWN;
+ bitmap_properties.pixelFormat.alphaMode = D2D1_ALPHA_MODE_IGNORE;
+ bitmap_properties.dpiX = 96.0;
+ bitmap_properties.dpiY = 96.0;
+ bitmap_properties.bitmapOptions = D2D1_BITMAP_OPTIONS_TARGET | D2D1_BITMAP_OPTIONS_CANNOT_DRAW;
+ hr = ID2D1DeviceContext_CreateBitmapFromDxgiSurface(context, dxgi_surface,
+ &bitmap_properties, &bitmap);
+ todo_wine
+ ok(SUCCEEDED(hr), "Failed to create bitmap, hr %#x.\n", hr);
+ if (FAILED(hr))
+ {
+ skip("bitmap unavailable for use as device context target, skipping test.\n");
+ return;
+ }
+
+ ID2D1DeviceContext_SetTarget(context, (ID2D1Image *)bitmap);
+ ID2D1DeviceContext_CreateSolidColorBrush(context, &c, NULL, &brush);
+
+ ID2D1DeviceContext_BeginDraw(context);
+ ID2D1DeviceContext_DrawRectangle(context, &r, (ID2D1Brush *)brush, 1.0f, NULL);
+ hr = ID2D1DeviceContext_EndDraw(context, NULL, NULL);
+ todo_wine
+ ok(SUCCEEDED(hr), "Failed to draw, hr %#x.\n", hr);
+ hr = IDXGISwapChain_Present(swapchain, 0, 0);
+ todo_wine
+ ok(SUCCEEDED(hr), "Failed to present image, hr %#x.\n", hr);
+
+ ID2D1SolidColorBrush_Release(brush);
+ DestroyWindow(window);
+ IDXGISwapChain_Release(swapchain);
+ ID2D1Bitmap1_Release(bitmap);
+ IDXGISurface_Release(dxgi_surface);
+ ID2D1DeviceContext_Release(context);
+ IDXGIDevice_Release(dxgi_device);
+ ID3D10Device1_Release(d3d10_device);
+ ID2D1Device_Release(device);
+ ID2D1Factory1_Release(factory);
+}
+
static void create_target_dibsection(HDC hdc, UINT32 width, UINT32 height)
{
char bmibuf[FIELD_OFFSET(BITMAPINFO, bmiColors[256])];
@@ -6444,6 +6550,7 @@ START_TEST(d2d1)
test_opacity_brush();
test_create_target();
test_draw_text_layout();
+ test_draw_via_ID2D1DeviceContext();
test_dc_target();
test_hwnd_target();
test_bitmap_target();
--
1.9.1

View File

@@ -1,18 +1,19 @@
From f2291f6639479555979f1f403518f86a1ef31640 Mon Sep 17 00:00:00 2001
From 2af2d1c51ec73862a156850d702dcb4608d73558 Mon Sep 17 00:00:00 2001
From: Lucian Poston <lucian.poston@gmail.com>
Date: Thu, 3 May 2018 00:38:06 -0700
Subject: [PATCH 3/7] d2d1: Use ID2D1Factory1 in d2d_geometry
Subject: d2d1: Use ID2D1Factory1 in d2d_geometry
https://bugs.winehq.org/show_bug.cgi?id=44052
Signed-off-by: Lucian Poston <lucian.poston@gmail.com>
---
dlls/d2d1/d2d1_private.h | 8 ++++----
dlls/d2d1/factory.c | 6 +++---
dlls/d2d1/geometry.c | 30 +++++++++++++++++++++---------
2 files changed, 25 insertions(+), 13 deletions(-)
3 files changed, 28 insertions(+), 16 deletions(-)
diff --git a/dlls/d2d1/d2d1_private.h b/dlls/d2d1/d2d1_private.h
index dbfb83c..ed29c4c 100644
index 21e2b88..0bb0112 100644
--- a/dlls/d2d1/d2d1_private.h
+++ b/dlls/d2d1/d2d1_private.h
@@ -406,7 +406,7 @@ struct d2d_geometry
@@ -38,6 +39,37 @@ index dbfb83c..ed29c4c 100644
ID2D1Geometry *src_geometry, const D2D_MATRIX_3X2_F *transform) DECLSPEC_HIDDEN;
struct d2d_geometry *unsafe_impl_from_ID2D1Geometry(ID2D1Geometry *iface) DECLSPEC_HIDDEN;
diff --git a/dlls/d2d1/factory.c b/dlls/d2d1/factory.c
index 7810e95..2a1a536 100644
--- a/dlls/d2d1/factory.c
+++ b/dlls/d2d1/factory.c
@@ -140,7 +140,7 @@ static HRESULT STDMETHODCALLTYPE d2d_factory_CreateRectangleGeometry(ID2D1Factor
if (!(object = heap_alloc_zero(sizeof(*object))))
return E_OUTOFMEMORY;
- if (FAILED(hr = d2d_rectangle_geometry_init(object, (ID2D1Factory *)iface, rect)))
+ if (FAILED(hr = d2d_rectangle_geometry_init(object, iface, rect)))
{
WARN("Failed to initialize rectangle geometry, hr %#x.\n", hr);
heap_free(object);
@@ -190,7 +190,7 @@ static HRESULT STDMETHODCALLTYPE d2d_factory_CreateTransformedGeometry(ID2D1Fact
if (!(object = heap_alloc_zero(sizeof(*object))))
return E_OUTOFMEMORY;
- d2d_transformed_geometry_init(object, (ID2D1Factory *)iface, src_geometry, transform);
+ d2d_transformed_geometry_init(object, iface, src_geometry, transform);
TRACE("Created transformed geometry %p.\n", object);
*transformed_geometry = (ID2D1TransformedGeometry *)&object->ID2D1Geometry_iface;
@@ -207,7 +207,7 @@ static HRESULT STDMETHODCALLTYPE d2d_factory_CreatePathGeometry(ID2D1Factory1 *i
if (!(object = heap_alloc_zero(sizeof(*object))))
return E_OUTOFMEMORY;
- d2d_path_geometry_init(object, (ID2D1Factory *)iface);
+ d2d_path_geometry_init(object, iface);
TRACE("Created path geometry %p.\n", object);
*geometry = (ID2D1PathGeometry *)&object->ID2D1Geometry_iface;
diff --git a/dlls/d2d1/geometry.c b/dlls/d2d1/geometry.c
index d716fb1..5bf63f6 100644
--- a/dlls/d2d1/geometry.c
@@ -137,5 +169,5 @@ index d716fb1..5bf63f6 100644
{
struct d2d_geometry *src_impl;
--
1.9.1
2.7.4

View File

@@ -1,253 +0,0 @@
From d8f2ab6b92e9c845c57df905d13c60d9dec0f94f Mon Sep 17 00:00:00 2001
From: Lucian Poston <lucian.poston@gmail.com>
Date: Thu, 3 May 2018 01:37:52 -0700
Subject: [PATCH 4/7] d2d1: Implement ID2D1Device
https://bugs.winehq.org/show_bug.cgi?id=44052
Signed-off-by: Lucian Poston <lucian.poston@gmail.com>
---
dlls/d2d1/Makefile.in | 1 +
dlls/d2d1/d2d1_private.h | 10 +++
dlls/d2d1/device.c | 159 +++++++++++++++++++++++++++++++++++++++++++++++
dlls/d2d1/factory.c | 13 +++-
dlls/d2d1/tests/d2d1.c | 1 -
5 files changed, 181 insertions(+), 3 deletions(-)
create mode 100644 dlls/d2d1/device.c
diff --git a/dlls/d2d1/Makefile.in b/dlls/d2d1/Makefile.in
index 20d3f26..5aa2f4c 100644
--- a/dlls/d2d1/Makefile.in
+++ b/dlls/d2d1/Makefile.in
@@ -8,6 +8,7 @@ C_SRCS = \
bitmap_render_target.c \
brush.c \
dc_render_target.c \
+ device.c \
factory.c \
geometry.c \
hwnd_render_target.c \
diff --git a/dlls/d2d1/d2d1_private.h b/dlls/d2d1/d2d1_private.h
index ed29c4c..4af5372 100644
--- a/dlls/d2d1/d2d1_private.h
+++ b/dlls/d2d1/d2d1_private.h
@@ -567,4 +567,14 @@ static inline const char *debug_d2d_rect_f(const D2D1_RECT_F *rect)
return wine_dbg_sprintf("(%.8e,%.8e)-(%.8e,%.8e)", rect->left, rect->top, rect->right, rect->bottom );
}
+struct d2d_device
+{
+ ID2D1Device ID2D1Device_iface;
+ LONG refcount;
+ ID2D1Factory1 *factory;
+ IDXGIDevice *dxgi_device;
+};
+
+void d2d_device_init(struct d2d_device *This, ID2D1Factory1 *iface, IDXGIDevice *dxgiDevice) DECLSPEC_HIDDEN;
+
#endif /* __WINE_D2D1_PRIVATE_H */
diff --git a/dlls/d2d1/device.c b/dlls/d2d1/device.c
new file mode 100644
index 0000000..c060d4f
--- /dev/null
+++ b/dlls/d2d1/device.c
@@ -0,0 +1,159 @@
+/*
+ * Copyright 2018 Lucian Poston
+ *
+ * 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 "config.h"
+#include "wine/port.h"
+
+#include "d2d1_private.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(d2d);
+
+static inline struct d2d_device *impl_from_ID2D1Device(ID2D1Device *iface)
+{
+ return CONTAINING_RECORD(iface, struct d2d_device, ID2D1Device_iface);
+}
+
+static HRESULT WINAPI d2d_device_QueryInterface(
+ ID2D1Device *iface,
+ REFIID riid,
+ void **ppvObject)
+{
+ TRACE("iface %p, riid %s, ppvObject %p.\n", iface, debugstr_guid(riid), ppvObject);
+ if (ppvObject == NULL)
+ return E_POINTER;
+
+ if (IsEqualGUID(riid, &IID_ID2D1Device)
+ || IsEqualGUID(riid, &IID_ID2D1Resource)
+ || IsEqualGUID(riid, &IID_IUnknown))
+ {
+ ID2D1Device_AddRef(iface);
+ *ppvObject = iface;
+ return S_OK;
+ }
+
+ WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(riid));
+ *ppvObject = NULL;
+ return E_NOINTERFACE;
+}
+
+static ULONG WINAPI d2d_device_AddRef(
+ ID2D1Device *iface)
+{
+ struct d2d_device *This = impl_from_ID2D1Device(iface);
+ ULONG refcount = InterlockedIncrement(&This->refcount);
+ TRACE("%p increasing refcount to %u.\n", iface, refcount);
+ return refcount;
+}
+
+static ULONG WINAPI d2d_device_Release(
+ ID2D1Device *iface)
+{
+ struct d2d_device *This = impl_from_ID2D1Device(iface);
+ ULONG refcount = InterlockedDecrement(&This->refcount);
+ TRACE("%p decreasing refcount to %u.\n", iface, refcount);
+
+ if (refcount == 0)
+ {
+ IDXGIDevice_Release(This->dxgi_device);
+ ID2D1Factory1_Release(This->factory);
+ HeapFree(GetProcessHeap(), 0, This);
+ }
+
+ return refcount;
+}
+
+static void WINAPI d2d_device_GetFactory(
+ ID2D1Device *iface,
+ ID2D1Factory **factory)
+{
+ struct d2d_device *This = impl_from_ID2D1Device(iface);
+
+ TRACE("iface %p, factory %p.\n", iface, factory);
+ *factory = (ID2D1Factory *)This->factory;
+ ID2D1Factory1_AddRef(This->factory);
+}
+
+static HRESULT WINAPI d2d_device_CreateDeviceContext(
+ ID2D1Device *iface,
+ D2D1_DEVICE_CONTEXT_OPTIONS options,
+ ID2D1DeviceContext **deviceContext)
+{
+ struct d2d_device *This = impl_from_ID2D1Device(iface);
+ FIXME("%p stub!\n", This);
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI d2d_device_CreatePrintControl(
+ ID2D1Device *iface,
+ IWICImagingFactory *wicFactory,
+ IPrintDocumentPackageTarget *documentTarget,
+ const D2D1_PRINT_CONTROL_PROPERTIES *printControlProperties,
+ ID2D1PrintControl **printControl)
+{
+ struct d2d_device *This = impl_from_ID2D1Device(iface);
+ FIXME("%p stub!\n", This);
+ return E_NOTIMPL;
+}
+
+static void WINAPI d2d_device_SetMaximumTextureMemory(
+ ID2D1Device *iface,
+ UINT64 maximumInBytes)
+{
+ struct d2d_device *This = impl_from_ID2D1Device(iface);
+ FIXME("%p stub!\n", This);
+}
+
+static UINT64 WINAPI d2d_device_GetMaximumTextureMemory(
+ ID2D1Device *iface)
+{
+ struct d2d_device *This = impl_from_ID2D1Device(iface);
+ FIXME("%p stub!\n", This);
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI d2d_device_ClearResources(
+ ID2D1Device *iface,
+ UINT millisecondsSinceUse)
+{
+ struct d2d_device *This = impl_from_ID2D1Device(iface);
+ FIXME("%p stub!\n", This);
+ return E_NOTIMPL;
+}
+
+static const struct ID2D1DeviceVtbl d2d_device_vtbl =
+{
+ d2d_device_QueryInterface,
+ d2d_device_AddRef,
+ d2d_device_Release,
+ d2d_device_GetFactory,
+ d2d_device_CreateDeviceContext,
+ d2d_device_CreatePrintControl,
+ d2d_device_SetMaximumTextureMemory,
+ d2d_device_GetMaximumTextureMemory,
+ d2d_device_ClearResources,
+};
+
+void d2d_device_init(struct d2d_device *device, ID2D1Factory1 *iface, IDXGIDevice *dxgi_device)
+{
+ device->ID2D1Device_iface.lpVtbl = &d2d_device_vtbl;
+ device->refcount = 1;
+ device->factory = iface;
+ ID2D1Factory1_AddRef(device->factory);
+ device->dxgi_device = dxgi_device;
+ IDXGIDevice_AddRef(device->dxgi_device);
+}
diff --git a/dlls/d2d1/factory.c b/dlls/d2d1/factory.c
index 9bacc85..a6bc6e2 100644
--- a/dlls/d2d1/factory.c
+++ b/dlls/d2d1/factory.c
@@ -375,9 +375,18 @@ static HRESULT STDMETHODCALLTYPE d2d_factory_CreateDCRenderTarget(ID2D1Factory1
static HRESULT STDMETHODCALLTYPE d2d_factory_CreateDevice(ID2D1Factory1 *iface,
IDXGIDevice *dxgi_device, ID2D1Device **device)
{
- FIXME("iface %p, dxgi_device %p, device %p stub!\n", iface, dxgi_device, device);
+ struct d2d_device *object;
- return E_NOTIMPL;
+ TRACE("iface %p, dxgi_device %p, device %p\n", iface, dxgi_device, device);
+
+ if (!(object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object))))
+ return E_OUTOFMEMORY;
+
+ d2d_device_init(object, iface, dxgi_device);
+ *device = &object->ID2D1Device_iface;
+ TRACE("Created device %p.\n", object);
+
+ return S_OK;
}
static HRESULT STDMETHODCALLTYPE d2d_factory_CreateStrokeStyle1(ID2D1Factory1 *iface,
diff --git a/dlls/d2d1/tests/d2d1.c b/dlls/d2d1/tests/d2d1.c
index 21b4e53..cf0ddd7 100644
--- a/dlls/d2d1/tests/d2d1.c
+++ b/dlls/d2d1/tests/d2d1.c
@@ -4684,7 +4684,6 @@ static void test_draw_via_ID2D1DeviceContext(void)
}
hr = ID2D1Factory1_CreateDevice(factory, dxgi_device, &device);
- todo_wine
ok(SUCCEEDED(hr), "Failed to create device, hr %#x.\n", hr);
if (FAILED(hr))
{
--
1.9.1

View File

@@ -1,7 +1,7 @@
From a4a71ac89b388fa8346a2ce31b0da3adc794ef68 Mon Sep 17 00:00:00 2001
From d74d9f9e5c1502418932e75101979794763706c0 Mon Sep 17 00:00:00 2001
From: Lucian Poston <lucian.poston@gmail.com>
Date: Thu, 3 May 2018 02:37:30 -0700
Subject: [PATCH 5/7] d2d1: Stub ID2D1DeviceContext
Subject: d2d1: Stub ID2D1DeviceContext
This commit contains only stubs in order to keep its size down so the
mailing list doesn't reject it.
@@ -16,7 +16,7 @@ Signed-off-by: Lucian Poston <lucian.poston@gmail.com>
create mode 100644 dlls/d2d1/device_context.c
diff --git a/dlls/d2d1/Makefile.in b/dlls/d2d1/Makefile.in
index 5aa2f4c..a0eea3e 100644
index 4bfe3b5..ce3d42d 100644
--- a/dlls/d2d1/Makefile.in
+++ b/dlls/d2d1/Makefile.in
@@ -9,6 +9,7 @@ C_SRCS = \
@@ -29,7 +29,7 @@ index 5aa2f4c..a0eea3e 100644
hwnd_render_target.c \
diff --git a/dlls/d2d1/device_context.c b/dlls/d2d1/device_context.c
new file mode 100644
index 0000000..3b7b7dc
index 0000000..04da4bf
--- /dev/null
+++ b/dlls/d2d1/device_context.c
@@ -0,0 +1,1040 @@
@@ -728,8 +728,8 @@ index 0000000..3b7b7dc
+static HRESULT WINAPI d2d_device_context_ID2D1DeviceContext_CreateBitmapBrush(
+ ID2D1DeviceContext *iface,
+ ID2D1Bitmap *bitmap,
+ D2D1_BITMAP_BRUSH_PROPERTIES1 *bitmapBrushProperties,
+ D2D1_BRUSH_PROPERTIES *brushProperties,
+ const D2D1_BITMAP_BRUSH_PROPERTIES1 *bitmapBrushProperties,
+ const D2D1_BRUSH_PROPERTIES *brushProperties,
+ ID2D1BitmapBrush1 **bitmapBrush)
+{
+ struct d2d_device_context *This = impl_from_ID2D1DeviceContext(iface);
@@ -903,11 +903,11 @@ index 0000000..3b7b7dc
+static void WINAPI d2d_device_context_ID2D1DeviceContext_DrawBitmap(
+ ID2D1DeviceContext *iface,
+ ID2D1Bitmap *bitmap,
+ D2D1_RECT_F *destinationRectangle,
+ const D2D1_RECT_F *destinationRectangle,
+ float opacity,
+ D2D1_INTERPOLATION_MODE interpolationMode,
+ const D2D1_RECT_F sourceRectangle,
+ const D2D1_MATRIX_4X4_F perspectiveTransform)
+ const D2D1_RECT_F *sourceRectangle,
+ const D2D1_MATRIX_4X4_F *perspectiveTransform)
+{
+ struct d2d_device_context *This = impl_from_ID2D1DeviceContext(iface);
+ FIXME("%p stub!\n", This);
@@ -1074,5 +1074,5 @@ index 0000000..3b7b7dc
+ d2d_device_context_ID2D1DeviceContext_FillOpacityMask,
+};
--
1.9.1
2.7.4

View File

@@ -1,21 +1,19 @@
From b2a226371fa61a959cae4fcfed7e3503e1f3fd8c Mon Sep 17 00:00:00 2001
From a1de88de49c28a61ecc21f380e6ad3c25037eb59 Mon Sep 17 00:00:00 2001
From: Lucian Poston <lucian.poston@gmail.com>
Date: Thu, 3 May 2018 03:37:07 -0700
Subject: [PATCH 6/7] d2d1: Implement ID2D1DeviceContext
Subject: d2d1: Implement ID2D1DeviceContext
https://bugs.winehq.org/show_bug.cgi?id=44052
Signed-off-by: Lucian Poston <lucian.poston@gmail.com>
---
dlls/d2d1/d2d1_private.h | 16 +++
dlls/d2d1/device.c | 36 ++++-
dlls/d2d1/device_context.c | 328 ++++++++++++++++++++++++++++++++-------------
dlls/d2d1/render_target.c | 82 ++++++++----
dlls/d2d1/tests/d2d1.c | 1 -
5 files changed, 341 insertions(+), 122 deletions(-)
dlls/d2d1/device.c | 118 +++++++++++++----
dlls/d2d1/device_context.c | 318 ++++++++++++++++++++++++++++++++-------------
3 files changed, 336 insertions(+), 116 deletions(-)
diff --git a/dlls/d2d1/d2d1_private.h b/dlls/d2d1/d2d1_private.h
index 4af5372..1cb57e4 100644
index 0bb0112..1958aa0 100644
--- a/dlls/d2d1/d2d1_private.h
+++ b/dlls/d2d1/d2d1_private.h
@@ -154,6 +154,10 @@ struct d2d_d3d_render_target
@@ -29,9 +27,9 @@ index 4af5372..1cb57e4 100644
HRESULT d2d_d3d_render_target_create_rtv(ID2D1RenderTarget *render_target, IDXGISurface1 *surface) DECLSPEC_HIDDEN;
struct d2d_wic_render_target
@@ -577,4 +581,16 @@ struct d2d_device
void d2d_device_init(struct d2d_device *This, ID2D1Factory1 *iface, IDXGIDevice *dxgiDevice) DECLSPEC_HIDDEN;
@@ -577,4 +581,16 @@ static inline const char *debug_d2d_rect_f(const D2D1_RECT_F *rect)
return wine_dbg_sprintf("(%.8e,%.8e)-(%.8e,%.8e)", rect->left, rect->top, rect->right, rect->bottom );
}
+struct d2d_device_context
+{
@@ -47,24 +45,140 @@ index 4af5372..1cb57e4 100644
+
#endif /* __WINE_D2D1_PRIVATE_H */
diff --git a/dlls/d2d1/device.c b/dlls/d2d1/device.c
index c060d4f..c5075b4 100644
index f74e9f8..24fb3c9 100644
--- a/dlls/d2d1/device.c
+++ b/dlls/d2d1/device.c
@@ -94,8 +94,40 @@ static HRESULT WINAPI d2d_device_CreateDeviceContext(
ID2D1DeviceContext **deviceContext)
@@ -2144,7 +2144,7 @@ static const struct ID2D1GdiInteropRenderTargetVtbl d2d_gdi_interop_render_targe
};
static HRESULT d2d_d3d_render_target_init(struct d2d_d3d_render_target *render_target, ID2D1Factory *factory,
- IDXGISurface *surface, IUnknown *outer_unknown, const D2D1_RENDER_TARGET_PROPERTIES *desc)
+ IDXGISurface *surface, ID3D10Device *device, IUnknown *outer_unknown, const D2D1_RENDER_TARGET_PROPERTIES *desc)
{
struct d2d_device *This = impl_from_ID2D1Device(iface);
- FIXME("%p stub!\n", This);
- return E_NOTIMPL;
D3D10_SUBRESOURCE_DATA buffer_data;
D3D10_STATE_BLOCK_MASK state_mask;
@@ -3033,25 +3033,41 @@ static HRESULT d2d_d3d_render_target_init(struct d2d_d3d_render_target *render_t
render_target->outer_unknown = outer_unknown ? outer_unknown :
(IUnknown *)&render_target->ID2D1RenderTarget_iface;
- if (FAILED(hr = IDXGISurface_GetDevice(surface, &IID_ID3D10Device, (void **)&render_target->device)))
+ if (surface == NULL)
{
- WARN("Failed to get device interface, hr %#x.\n", hr);
- ID2D1Factory_Release(render_target->factory);
- return hr;
+ ID3D10Device_AddRef(render_target->device = device);
}
-
- if (FAILED(hr = IDXGISurface_QueryInterface(surface, &IID_ID3D10Resource, (void **)&resource)))
+ else
{
- WARN("Failed to get ID3D10Resource interface, hr %#x.\n", hr);
- goto err;
- }
+ if (FAILED(hr = IDXGISurface_GetDevice(surface, &IID_ID3D10Device, (void **)&render_target->device)))
+ {
+ WARN("Failed to get device interface, hr %#x.\n", hr);
+ ID2D1Factory_Release(render_target->factory);
+ return hr;
+ }
- hr = ID3D10Device_CreateRenderTargetView(render_target->device, resource, NULL, &render_target->view);
- ID3D10Resource_Release(resource);
- if (FAILED(hr))
- {
- WARN("Failed to create rendertarget view, hr %#x.\n", hr);
- goto err;
+ if (FAILED(hr = IDXGISurface_QueryInterface(surface, &IID_ID3D10Resource, (void **)&resource)))
+ {
+ WARN("Failed to get ID3D10Resource interface, hr %#x.\n", hr);
+ goto err;
+ }
+
+ hr = ID3D10Device_CreateRenderTargetView(render_target->device, resource, NULL, &render_target->view);
+ ID3D10Resource_Release(resource);
+ if (FAILED(hr))
+ {
+ WARN("Failed to create rendertarget view, hr %#x.\n", hr);
+ goto err;
+ }
+
+ if (FAILED(hr = IDXGISurface_GetDesc(surface, &surface_desc)))
+ {
+ WARN("Failed to get surface desc, hr %#x.\n", hr);
+ goto err;
+ }
+
+ render_target->pixel_size.width = surface_desc.Width;
+ render_target->pixel_size.height = surface_desc.Height;
}
if (FAILED(hr = D3D10StateBlockMaskEnableAll(&state_mask)))
@@ -3176,15 +3192,7 @@ static HRESULT d2d_d3d_render_target_init(struct d2d_d3d_render_target *render_t
goto err;
}
- if (FAILED(hr = IDXGISurface_GetDesc(surface, &surface_desc)))
- {
- WARN("Failed to get surface desc, hr %#x.\n", hr);
- goto err;
- }
-
render_target->desc.pixelFormat = desc->pixelFormat;
- render_target->pixel_size.width = surface_desc.Width;
- render_target->pixel_size.height = surface_desc.Height;
render_target->drawing_state.transform = identity;
if (!d2d_clip_stack_init(&render_target->clip_stack))
@@ -3238,7 +3246,31 @@ HRESULT d2d_d3d_create_render_target(ID2D1Factory *factory, IDXGISurface *surfac
if (!(object = heap_alloc_zero(sizeof(*object))))
return E_OUTOFMEMORY;
- if (FAILED(hr = d2d_d3d_render_target_init(object, factory, surface, outer_unknown, desc)))
+ if (FAILED(hr = d2d_d3d_render_target_init(object, factory, surface, NULL, outer_unknown, desc)))
+ {
+ WARN("Failed to initialize render target, hr %#x.\n", hr);
+ HeapFree(GetProcessHeap(), 0, object);
+ return hr;
+ }
+
+ TRACE("Created render target %p.\n", object);
+ *render_target = &object->ID2D1RenderTarget_iface;
+
+ return S_OK;
+}
+
+HRESULT d2d_d3d_create_render_target_with_device(ID2D1Factory *factory,
+ ID3D10Device *device, IUnknown *outer_unknown,
+ const D2D1_RENDER_TARGET_PROPERTIES *desc,
+ ID2D1RenderTarget **render_target)
+{
+ struct d2d_d3d_render_target *object;
+ HRESULT hr;
+
+ if (!(object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object))))
+ return E_OUTOFMEMORY;
+
+ if (FAILED(hr = d2d_d3d_render_target_init(object, factory, NULL, device, outer_unknown, desc)))
{
WARN("Failed to initialize render target, hr %#x.\n", hr);
heap_free(object);
@@ -3354,9 +3386,41 @@ 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;
+ ID3D10Device *d3d_device;
+ HRESULT hr;
+
+ TRACE("This %p, options %#x\n", This, options);
+ if (deviceContext == NULL)
- return E_NOTIMPL;
+ TRACE("iface %p, options %#x, context %p.\n", iface, options, context);
+ if (!context)
+ return E_POINTER;
+
+ if (FAILED(hr = IDXGIDevice_QueryInterface(This->dxgi_device,
+ if (FAILED(hr = IDXGIDevice_QueryInterface(device->dxgi_device,
+ &IID_ID3D10Device, (void **)&d3d_device)))
+ {
+ WARN("Failed to query d3d device, hr %#x.\n", hr);
@@ -86,15 +200,15 @@ index c060d4f..c5075b4 100644
+ return hr;
+ }
+
+ *deviceContext = &object->ID2D1DeviceContext_iface;
+ *context = &object->ID2D1DeviceContext_iface;
+ TRACE("Created device context %p.\n", object);
+
+ return S_OK;
}
static HRESULT WINAPI d2d_device_CreatePrintControl(
static HRESULT WINAPI d2d_device_CreatePrintControl(ID2D1Device *iface, IWICImagingFactory *wic_factory,
diff --git a/dlls/d2d1/device_context.c b/dlls/d2d1/device_context.c
index 3b7b7dc..75d163c 100644
index 04da4bf..75d163c 100644
--- a/dlls/d2d1/device_context.c
+++ b/dlls/d2d1/device_context.c
@@ -23,12 +23,6 @@
@@ -739,17 +853,6 @@ index 3b7b7dc..75d163c 100644
}
static HRESULT WINAPI d2d_device_context_ID2D1DeviceContext_CreateBitmap(
@@ -693,8 +763,8 @@ static HRESULT WINAPI d2d_device_context_CreateImageBrush(
static HRESULT WINAPI d2d_device_context_ID2D1DeviceContext_CreateBitmapBrush(
ID2D1DeviceContext *iface,
ID2D1Bitmap *bitmap,
- D2D1_BITMAP_BRUSH_PROPERTIES1 *bitmapBrushProperties,
- D2D1_BRUSH_PROPERTIES *brushProperties,
+ const D2D1_BITMAP_BRUSH_PROPERTIES1 *bitmapBrushProperties,
+ const D2D1_BRUSH_PROPERTIES *brushProperties,
ID2D1BitmapBrush1 **bitmapBrush)
{
struct d2d_device_context *This = impl_from_ID2D1DeviceContext(iface);
@@ -765,7 +835,12 @@ static void WINAPI d2d_device_context_GetDevice(
ID2D1Device **device)
{
@@ -800,21 +903,6 @@ index 3b7b7dc..75d163c 100644
}
static void WINAPI d2d_device_context_GetTarget(
@@ -868,11 +970,11 @@ static void WINAPI d2d_device_context_DrawGdiMetafile(
static void WINAPI d2d_device_context_ID2D1DeviceContext_DrawBitmap(
ID2D1DeviceContext *iface,
ID2D1Bitmap *bitmap,
- D2D1_RECT_F *destinationRectangle,
+ const D2D1_RECT_F *destinationRectangle,
float opacity,
D2D1_INTERPOLATION_MODE interpolationMode,
- const D2D1_RECT_F sourceRectangle,
- const D2D1_MATRIX_4X4_F perspectiveTransform)
+ const D2D1_RECT_F *sourceRectangle,
+ const D2D1_MATRIX_4X4_F *perspectiveTransform)
{
struct d2d_device_context *This = impl_from_ID2D1DeviceContext(iface);
FIXME("%p stub!\n", This);
@@ -1038,3 +1140,41 @@ static const struct ID2D1DeviceContextVtbl d2d_device_context_vtbl =
d2d_device_context_GetEffectRequiredInputRectangles,
d2d_device_context_ID2D1DeviceContext_FillOpacityMask,
@@ -857,137 +945,6 @@ index 3b7b7dc..75d163c 100644
+
+ return S_OK;
+}
diff --git a/dlls/d2d1/render_target.c b/dlls/d2d1/render_target.c
index 7afbc84..3f15406 100644
--- a/dlls/d2d1/render_target.c
+++ b/dlls/d2d1/render_target.c
@@ -2139,7 +2139,7 @@ static const struct ID2D1GdiInteropRenderTargetVtbl d2d_gdi_interop_render_targe
};
static HRESULT d2d_d3d_render_target_init(struct d2d_d3d_render_target *render_target, ID2D1Factory *factory,
- IDXGISurface *surface, IUnknown *outer_unknown, const D2D1_RENDER_TARGET_PROPERTIES *desc)
+ IDXGISurface *surface, ID3D10Device *device, IUnknown *outer_unknown, const D2D1_RENDER_TARGET_PROPERTIES *desc)
{
D3D10_SUBRESOURCE_DATA buffer_data;
D3D10_STATE_BLOCK_MASK state_mask;
@@ -3028,25 +3028,41 @@ static HRESULT d2d_d3d_render_target_init(struct d2d_d3d_render_target *render_t
render_target->outer_unknown = outer_unknown ? outer_unknown :
(IUnknown *)&render_target->ID2D1RenderTarget_iface;
- if (FAILED(hr = IDXGISurface_GetDevice(surface, &IID_ID3D10Device, (void **)&render_target->device)))
+ if (surface == NULL)
{
- WARN("Failed to get device interface, hr %#x.\n", hr);
- ID2D1Factory_Release(render_target->factory);
- return hr;
+ ID3D10Device_AddRef(render_target->device = device);
}
-
- if (FAILED(hr = IDXGISurface_QueryInterface(surface, &IID_ID3D10Resource, (void **)&resource)))
+ else
{
- WARN("Failed to get ID3D10Resource interface, hr %#x.\n", hr);
- goto err;
- }
+ if (FAILED(hr = IDXGISurface_GetDevice(surface, &IID_ID3D10Device, (void **)&render_target->device)))
+ {
+ WARN("Failed to get device interface, hr %#x.\n", hr);
+ ID2D1Factory_Release(render_target->factory);
+ return hr;
+ }
- hr = ID3D10Device_CreateRenderTargetView(render_target->device, resource, NULL, &render_target->view);
- ID3D10Resource_Release(resource);
- if (FAILED(hr))
- {
- WARN("Failed to create rendertarget view, hr %#x.\n", hr);
- goto err;
+ if (FAILED(hr = IDXGISurface_QueryInterface(surface, &IID_ID3D10Resource, (void **)&resource)))
+ {
+ WARN("Failed to get ID3D10Resource interface, hr %#x.\n", hr);
+ goto err;
+ }
+
+ hr = ID3D10Device_CreateRenderTargetView(render_target->device, resource, NULL, &render_target->view);
+ ID3D10Resource_Release(resource);
+ if (FAILED(hr))
+ {
+ WARN("Failed to create rendertarget view, hr %#x.\n", hr);
+ goto err;
+ }
+
+ if (FAILED(hr = IDXGISurface_GetDesc(surface, &surface_desc)))
+ {
+ WARN("Failed to get surface desc, hr %#x.\n", hr);
+ goto err;
+ }
+
+ render_target->pixel_size.width = surface_desc.Width;
+ render_target->pixel_size.height = surface_desc.Height;
}
if (FAILED(hr = D3D10StateBlockMaskEnableAll(&state_mask)))
@@ -3171,15 +3187,7 @@ static HRESULT d2d_d3d_render_target_init(struct d2d_d3d_render_target *render_t
goto err;
}
- if (FAILED(hr = IDXGISurface_GetDesc(surface, &surface_desc)))
- {
- WARN("Failed to get surface desc, hr %#x.\n", hr);
- goto err;
- }
-
render_target->desc.pixelFormat = desc->pixelFormat;
- render_target->pixel_size.width = surface_desc.Width;
- render_target->pixel_size.height = surface_desc.Height;
render_target->drawing_state.transform = identity;
if (!d2d_clip_stack_init(&render_target->clip_stack))
@@ -3233,7 +3241,31 @@ HRESULT d2d_d3d_create_render_target(ID2D1Factory *factory, IDXGISurface *surfac
if (!(object = heap_alloc_zero(sizeof(*object))))
return E_OUTOFMEMORY;
- if (FAILED(hr = d2d_d3d_render_target_init(object, factory, surface, outer_unknown, desc)))
+ if (FAILED(hr = d2d_d3d_render_target_init(object, factory, surface, NULL, outer_unknown, desc)))
+ {
+ WARN("Failed to initialize render target, hr %#x.\n", hr);
+ HeapFree(GetProcessHeap(), 0, object);
+ return hr;
+ }
+
+ TRACE("Created render target %p.\n", object);
+ *render_target = &object->ID2D1RenderTarget_iface;
+
+ return S_OK;
+}
+
+HRESULT d2d_d3d_create_render_target_with_device(ID2D1Factory *factory,
+ ID3D10Device *device, IUnknown *outer_unknown,
+ const D2D1_RENDER_TARGET_PROPERTIES *desc,
+ ID2D1RenderTarget **render_target)
+{
+ struct d2d_d3d_render_target *object;
+ HRESULT hr;
+
+ if (!(object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object))))
+ return E_OUTOFMEMORY;
+
+ if (FAILED(hr = d2d_d3d_render_target_init(object, factory, NULL, device, outer_unknown, desc)))
{
WARN("Failed to initialize render target, hr %#x.\n", hr);
heap_free(object);
diff --git a/dlls/d2d1/tests/d2d1.c b/dlls/d2d1/tests/d2d1.c
index cf0ddd7..5e9bf97 100644
--- a/dlls/d2d1/tests/d2d1.c
+++ b/dlls/d2d1/tests/d2d1.c
@@ -4693,7 +4693,6 @@ static void test_draw_via_ID2D1DeviceContext(void)
hr = ID2D1Device_CreateDeviceContext(device,
D2D1_DEVICE_CONTEXT_OPTIONS_NONE, &context);
- todo_wine
ok(SUCCEEDED(hr), "Failed to create device context, hr %#x.\n", hr);
if (FAILED(hr))
{
--
1.9.1
2.7.4

View File

@@ -1,7 +1,7 @@
From 986ff7ac31a4413b83b665d828ebc0844f50b526 Mon Sep 17 00:00:00 2001
From 4da54c6040345f0a4d2f9d11e1d24461dec69e77 Mon Sep 17 00:00:00 2001
From: Lucian Poston <lucian.poston@gmail.com>
Date: Thu, 3 May 2018 04:36:13 -0700
Subject: [PATCH 7/7] d2d1: Implement ID2D1Bitmap1
Subject: d2d1: Implement ID2D1Bitmap1
https://bugs.winehq.org/show_bug.cgi?id=44052
@@ -10,10 +10,9 @@ Signed-off-by: Lucian Poston <lucian.poston@gmail.com>
dlls/d2d1/bitmap.c | 277 +++++++++++++++++++++++++++++++++------------
dlls/d2d1/brush.c | 8 +-
dlls/d2d1/d2d1_private.h | 8 +-
dlls/d2d1/device.c | 6 +-
dlls/d2d1/device_context.c | 24 +++-
dlls/d2d1/render_target.c | 6 +-
dlls/d2d1/tests/d2d1.c | 3 -
6 files changed, 243 insertions(+), 83 deletions(-)
5 files changed, 243 insertions(+), 80 deletions(-)
diff --git a/dlls/d2d1/bitmap.c b/dlls/d2d1/bitmap.c
index 0d4098f..32e6085 100644
@@ -556,7 +555,7 @@ index c46d940..b00629f 100644
{
(*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 1cb57e4..2169ff1 100644
index 1958aa0..9db671e 100644
--- a/dlls/d2d1/d2d1_private.h
+++ b/dlls/d2d1/d2d1_private.h
@@ -330,7 +330,8 @@ HRESULT d2d_mesh_create(ID2D1Factory *factory, struct d2d_mesh **mesh) DECLSPEC_
@@ -585,6 +584,37 @@ index 1cb57e4..2169ff1 100644
HRESULT d2d_bitmap_create_shared(ID2D1RenderTarget *render_target, ID3D10Device *device, REFIID iid, void *data,
const D2D1_BITMAP_PROPERTIES *desc, struct d2d_bitmap **bitmap) DECLSPEC_HIDDEN;
HRESULT d2d_bitmap_create_from_wic_bitmap(ID2D1Factory *factory, ID3D10Device *device, IWICBitmapSource *bitmap_source,
diff --git a/dlls/d2d1/device.c b/dlls/d2d1/device.c
index 24fb3c9..5ba3d07 100644
--- a/dlls/d2d1/device.c
+++ b/dlls/d2d1/device.c
@@ -291,7 +291,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;
}
@@ -308,7 +308,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;
}
@@ -324,7 +324,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;
}
diff --git a/dlls/d2d1/device_context.c b/dlls/d2d1/device_context.c
index 75d163c..e5577b0 100644
--- a/dlls/d2d1/device_context.c
@@ -620,60 +650,6 @@ index 75d163c..e5577b0 100644
}
static HRESULT WINAPI d2d_device_context_CreateEffect(
diff --git a/dlls/d2d1/render_target.c b/dlls/d2d1/render_target.c
index 3f15406..7c6752f 100644
--- a/dlls/d2d1/render_target.c
+++ b/dlls/d2d1/render_target.c
@@ -286,7 +286,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;
}
@@ -303,7 +303,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;
}
@@ -319,7 +319,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;
}
diff --git a/dlls/d2d1/tests/d2d1.c b/dlls/d2d1/tests/d2d1.c
index 5e9bf97..5d38672 100644
--- a/dlls/d2d1/tests/d2d1.c
+++ b/dlls/d2d1/tests/d2d1.c
@@ -4707,7 +4707,6 @@ static void test_draw_via_ID2D1DeviceContext(void)
bitmap_properties.bitmapOptions = D2D1_BITMAP_OPTIONS_TARGET | D2D1_BITMAP_OPTIONS_CANNOT_DRAW;
hr = ID2D1DeviceContext_CreateBitmapFromDxgiSurface(context, dxgi_surface,
&bitmap_properties, &bitmap);
- todo_wine
ok(SUCCEEDED(hr), "Failed to create bitmap, hr %#x.\n", hr);
if (FAILED(hr))
{
@@ -4721,10 +4720,8 @@ static void test_draw_via_ID2D1DeviceContext(void)
ID2D1DeviceContext_BeginDraw(context);
ID2D1DeviceContext_DrawRectangle(context, &r, (ID2D1Brush *)brush, 1.0f, NULL);
hr = ID2D1DeviceContext_EndDraw(context, NULL, NULL);
- todo_wine
ok(SUCCEEDED(hr), "Failed to draw, hr %#x.\n", hr);
hr = IDXGISwapChain_Present(swapchain, 0, 0);
- todo_wine
ok(SUCCEEDED(hr), "Failed to present image, hr %#x.\n", hr);
ID2D1SolidColorBrush_Release(brush);
--
1.9.1
2.7.4