Wine-Devel
By thread
wine-devel@list.winehq.org
By month
Messages by month
- ----- 2026 -----
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2004 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2003 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2002 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2001 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
September 2018
- 70 participants
- 1549 messages
C++ .NET code crashes in WINE
by mrt303xx@aol.com
I'm a developer working on porting an application to Mac using WINE and the main windows show up however, the application crashes if I try to use any .NET code. We have a few windows in the NET framework and use managed C++ to create them. The allocation of the class using new generates an untrappable exception.
Tarie
Sept. 16, 2018
[PATCH 4/4] d2d1: Implement newer CreateBitmapBrush() variant.
by Nikolay Sivov
Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com>
---
dlls/d2d1/brush.c | 5 +++--
dlls/d2d1/d2d1_private.h | 2 +-
dlls/d2d1/device.c | 20 ++++++++++++++------
3 files changed, 18 insertions(+), 9 deletions(-)
diff --git a/dlls/d2d1/brush.c b/dlls/d2d1/brush.c
index f2c13d4788..cbc59d15d3 100644
--- a/dlls/d2d1/brush.c
+++ b/dlls/d2d1/brush.c
@@ -1090,8 +1090,9 @@ static const struct ID2D1BitmapBrush1Vtbl d2d_bitmap_brush_vtbl =
d2d_bitmap_brush_GetInterpolationMode1,
};
-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)
+HRESULT d2d_bitmap_brush_create(ID2D1Factory *factory, ID2D1Bitmap *bitmap,
+ const D2D1_BITMAP_BRUSH_PROPERTIES1 *bitmap_brush_desc, const D2D1_BRUSH_PROPERTIES *brush_desc,
+ struct d2d_brush **brush)
{
if (!(*brush = heap_alloc_zero(sizeof(**brush))))
return E_OUTOFMEMORY;
diff --git a/dlls/d2d1/d2d1_private.h b/dlls/d2d1/d2d1_private.h
index c8515eaa12..d7989f93a2 100644
--- a/dlls/d2d1/d2d1_private.h
+++ b/dlls/d2d1/d2d1_private.h
@@ -295,7 +295,7 @@ HRESULT d2d_radial_gradient_brush_create(ID2D1Factory *factory,
const D2D1_RADIAL_GRADIENT_BRUSH_PROPERTIES *gradient_desc, 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,
+ const D2D1_BITMAP_BRUSH_PROPERTIES1 *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,
diff --git a/dlls/d2d1/device.c b/dlls/d2d1/device.c
index 041cb33c90..d779fb0a97 100644
--- a/dlls/d2d1/device.c
+++ b/dlls/d2d1/device.c
@@ -401,14 +401,15 @@ static HRESULT STDMETHODCALLTYPE d2d_device_context_CreateBitmapBrush(ID2D1Devic
ID2D1Bitmap *bitmap, const D2D1_BITMAP_BRUSH_PROPERTIES *bitmap_brush_desc,
const D2D1_BRUSH_PROPERTIES *brush_desc, ID2D1BitmapBrush **brush)
{
- struct d2d_device_context *render_target = impl_from_ID2D1DeviceContext(iface);
+ struct d2d_device_context *context = impl_from_ID2D1DeviceContext(iface);
struct d2d_brush *object;
HRESULT hr;
TRACE("iface %p, bitmap %p, bitmap_brush_desc %p, brush_desc %p, brush %p.\n",
iface, bitmap, bitmap_brush_desc, brush_desc, brush);
- if (SUCCEEDED(hr = d2d_bitmap_brush_create(render_target->factory, bitmap, bitmap_brush_desc, brush_desc, &object)))
+ if (SUCCEEDED(hr = d2d_bitmap_brush_create(context->factory, bitmap, (const D2D1_BITMAP_BRUSH_PROPERTIES1 *)bitmap_brush_desc,
+ brush_desc, &object)))
*brush = (ID2D1BitmapBrush *)&object->ID2D1Brush_iface;
return hr;
@@ -1863,12 +1864,19 @@ static HRESULT STDMETHODCALLTYPE d2d_device_context_CreateImageBrush(ID2D1Device
static HRESULT STDMETHODCALLTYPE d2d_device_context_ID2D1DeviceContext_CreateBitmapBrush(ID2D1DeviceContext *iface,
ID2D1Bitmap *bitmap, const D2D1_BITMAP_BRUSH_PROPERTIES1 *bitmap_brush_desc,
- const D2D1_BRUSH_PROPERTIES *brush_desc, ID2D1BitmapBrush1 **bitmap_brush)
+ const D2D1_BRUSH_PROPERTIES *brush_desc, ID2D1BitmapBrush1 **brush)
{
- FIXME("iface %p, bitmap %p, bitmap_brush_desc %p, brush_desc %p, bitmap_brush %p stub!\n", iface, bitmap,
- bitmap_brush_desc, brush_desc, bitmap_brush);
+ struct d2d_device_context *context = impl_from_ID2D1DeviceContext(iface);
+ struct d2d_brush *object;
+ HRESULT hr;
- return E_NOTIMPL;
+ TRACE("iface %p, bitmap %p, bitmap_brush_desc %p, brush_desc %p, brush %p.\n", iface, bitmap, bitmap_brush_desc,
+ brush_desc, brush);
+
+ if (SUCCEEDED(hr = d2d_bitmap_brush_create(context->factory, bitmap, bitmap_brush_desc, brush_desc, &object)))
+ *brush = (ID2D1BitmapBrush1 *)&object->ID2D1Brush_iface;
+
+ return hr;
}
static HRESULT STDMETHODCALLTYPE d2d_device_context_CreateCommandList(ID2D1DeviceContext *iface,
--
2.18.0
Sept. 16, 2018
[PATCH 3/4] d2d1: Update to ID2D1BitmapBrush1.
by Nikolay Sivov
Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com>
---
dlls/d2d1/brush.c | 132 ++++++++++++++++++++++++++++-----------
dlls/d2d1/d2d1_private.h | 2 +-
dlls/d2d1/tests/d2d1.c | 44 +++++++++++++
3 files changed, 140 insertions(+), 38 deletions(-)
diff --git a/dlls/d2d1/brush.c b/dlls/d2d1/brush.c
index 450507cef6..f2c13d4788 100644
--- a/dlls/d2d1/brush.c
+++ b/dlls/d2d1/brush.c
@@ -816,22 +816,23 @@ HRESULT d2d_radial_gradient_brush_create(ID2D1Factory *factory,
return S_OK;
}
-static inline struct d2d_brush *impl_from_ID2D1BitmapBrush(ID2D1BitmapBrush *iface)
+static inline struct d2d_brush *impl_from_ID2D1BitmapBrush1(ID2D1BitmapBrush1 *iface)
{
return CONTAINING_RECORD(iface, struct d2d_brush, ID2D1Brush_iface);
}
-static HRESULT STDMETHODCALLTYPE d2d_bitmap_brush_QueryInterface(ID2D1BitmapBrush *iface,
+static HRESULT STDMETHODCALLTYPE d2d_bitmap_brush_QueryInterface(ID2D1BitmapBrush1 *iface,
REFIID iid, void **out)
{
TRACE("iface %p, iid %s, out %p.\n", iface, debugstr_guid(iid), out);
- if (IsEqualGUID(iid, &IID_ID2D1BitmapBrush)
+ if (IsEqualGUID(iid, &IID_ID2D1BitmapBrush1)
+ || IsEqualGUID(iid, &IID_ID2D1BitmapBrush)
|| IsEqualGUID(iid, &IID_ID2D1Brush)
|| IsEqualGUID(iid, &IID_ID2D1Resource)
|| IsEqualGUID(iid, &IID_IUnknown))
{
- ID2D1BitmapBrush_AddRef(iface);
+ ID2D1BitmapBrush1_AddRef(iface);
*out = iface;
return S_OK;
}
@@ -842,9 +843,9 @@ static HRESULT STDMETHODCALLTYPE d2d_bitmap_brush_QueryInterface(ID2D1BitmapBrus
return E_NOINTERFACE;
}
-static ULONG STDMETHODCALLTYPE d2d_bitmap_brush_AddRef(ID2D1BitmapBrush *iface)
+static ULONG STDMETHODCALLTYPE d2d_bitmap_brush_AddRef(ID2D1BitmapBrush1 *iface)
{
- struct d2d_brush *brush = impl_from_ID2D1BitmapBrush(iface);
+ struct d2d_brush *brush = impl_from_ID2D1BitmapBrush1(iface);
ULONG refcount = InterlockedIncrement(&brush->refcount);
TRACE("%p increasing refcount to %u.\n", iface, refcount);
@@ -852,9 +853,9 @@ static ULONG STDMETHODCALLTYPE d2d_bitmap_brush_AddRef(ID2D1BitmapBrush *iface)
return refcount;
}
-static ULONG STDMETHODCALLTYPE d2d_bitmap_brush_Release(ID2D1BitmapBrush *iface)
+static ULONG STDMETHODCALLTYPE d2d_bitmap_brush_Release(ID2D1BitmapBrush1 *iface)
{
- struct d2d_brush *brush = impl_from_ID2D1BitmapBrush(iface);
+ struct d2d_brush *brush = impl_from_ID2D1BitmapBrush1(iface);
ULONG refcount = InterlockedDecrement(&brush->refcount);
TRACE("%p decreasing refcount to %u.\n", iface, refcount);
@@ -871,57 +872,57 @@ static ULONG STDMETHODCALLTYPE d2d_bitmap_brush_Release(ID2D1BitmapBrush *iface)
return refcount;
}
-static void STDMETHODCALLTYPE d2d_bitmap_brush_GetFactory(ID2D1BitmapBrush *iface,
+static void STDMETHODCALLTYPE d2d_bitmap_brush_GetFactory(ID2D1BitmapBrush1 *iface,
ID2D1Factory **factory)
{
- struct d2d_brush *brush = impl_from_ID2D1BitmapBrush(iface);
+ struct d2d_brush *brush = impl_from_ID2D1BitmapBrush1(iface);
TRACE("iface %p, factory %p.\n", iface, factory);
ID2D1Factory_AddRef(*factory = brush->factory);
}
-static void STDMETHODCALLTYPE d2d_bitmap_brush_SetOpacity(ID2D1BitmapBrush *iface, float opacity)
+static void STDMETHODCALLTYPE d2d_bitmap_brush_SetOpacity(ID2D1BitmapBrush1 *iface, float opacity)
{
- struct d2d_brush *brush = impl_from_ID2D1BitmapBrush(iface);
+ struct d2d_brush *brush = impl_from_ID2D1BitmapBrush1(iface);
TRACE("iface %p, opacity %.8e.\n", iface, opacity);
brush->opacity = opacity;
}
-static void STDMETHODCALLTYPE d2d_bitmap_brush_SetTransform(ID2D1BitmapBrush *iface,
+static void STDMETHODCALLTYPE d2d_bitmap_brush_SetTransform(ID2D1BitmapBrush1 *iface,
const D2D1_MATRIX_3X2_F *transform)
{
- struct d2d_brush *brush = impl_from_ID2D1BitmapBrush(iface);
+ struct d2d_brush *brush = impl_from_ID2D1BitmapBrush1(iface);
TRACE("iface %p, transform %p.\n", iface, transform);
brush->transform = *transform;
}
-static float STDMETHODCALLTYPE d2d_bitmap_brush_GetOpacity(ID2D1BitmapBrush *iface)
+static float STDMETHODCALLTYPE d2d_bitmap_brush_GetOpacity(ID2D1BitmapBrush1 *iface)
{
- struct d2d_brush *brush = impl_from_ID2D1BitmapBrush(iface);
+ struct d2d_brush *brush = impl_from_ID2D1BitmapBrush1(iface);
TRACE("iface %p.\n", iface);
return brush->opacity;
}
-static void STDMETHODCALLTYPE d2d_bitmap_brush_GetTransform(ID2D1BitmapBrush *iface,
+static void STDMETHODCALLTYPE d2d_bitmap_brush_GetTransform(ID2D1BitmapBrush1 *iface,
D2D1_MATRIX_3X2_F *transform)
{
- struct d2d_brush *brush = impl_from_ID2D1BitmapBrush(iface);
+ struct d2d_brush *brush = impl_from_ID2D1BitmapBrush1(iface);
TRACE("iface %p, transform %p.\n", iface, transform);
*transform = brush->transform;
}
-static void STDMETHODCALLTYPE d2d_bitmap_brush_SetExtendModeX(ID2D1BitmapBrush *iface, D2D1_EXTEND_MODE mode)
+static void STDMETHODCALLTYPE d2d_bitmap_brush_SetExtendModeX(ID2D1BitmapBrush1 *iface, D2D1_EXTEND_MODE mode)
{
- struct d2d_brush *brush = impl_from_ID2D1BitmapBrush(iface);
+ struct d2d_brush *brush = impl_from_ID2D1BitmapBrush1(iface);
TRACE("iface %p, mode %#x.\n", iface, mode);
@@ -933,9 +934,9 @@ static void STDMETHODCALLTYPE d2d_bitmap_brush_SetExtendModeX(ID2D1BitmapBrush *
}
}
-static void STDMETHODCALLTYPE d2d_bitmap_brush_SetExtendModeY(ID2D1BitmapBrush *iface, D2D1_EXTEND_MODE mode)
+static void STDMETHODCALLTYPE d2d_bitmap_brush_SetExtendModeY(ID2D1BitmapBrush1 *iface, D2D1_EXTEND_MODE mode)
{
- struct d2d_brush *brush = impl_from_ID2D1BitmapBrush(iface);
+ struct d2d_brush *brush = impl_from_ID2D1BitmapBrush1(iface);
TRACE("iface %p, mode %#x.\n", iface, mode);
@@ -947,13 +948,23 @@ static void STDMETHODCALLTYPE d2d_bitmap_brush_SetExtendModeY(ID2D1BitmapBrush *
}
}
-static void STDMETHODCALLTYPE d2d_bitmap_brush_SetInterpolationMode(ID2D1BitmapBrush *iface,
+static void STDMETHODCALLTYPE d2d_bitmap_brush_SetInterpolationMode(ID2D1BitmapBrush1 *iface,
D2D1_BITMAP_INTERPOLATION_MODE mode)
{
- struct d2d_brush *brush = impl_from_ID2D1BitmapBrush(iface);
+ struct d2d_brush *brush = impl_from_ID2D1BitmapBrush1(iface);
TRACE("iface %p, mode %#x.\n", iface, mode);
+ switch (mode)
+ {
+ case D2D1_BITMAP_INTERPOLATION_MODE_NEAREST_NEIGHBOR:
+ case D2D1_BITMAP_INTERPOLATION_MODE_LINEAR:
+ break;
+ default:
+ WARN("Unknown interpolation mode %#x.\n", mode);
+ return;
+ }
+
brush->u.bitmap.interpolation_mode = mode;
if (brush->u.bitmap.sampler_state)
{
@@ -962,9 +973,9 @@ static void STDMETHODCALLTYPE d2d_bitmap_brush_SetInterpolationMode(ID2D1BitmapB
}
}
-static void STDMETHODCALLTYPE d2d_bitmap_brush_SetBitmap(ID2D1BitmapBrush *iface, ID2D1Bitmap *bitmap)
+static void STDMETHODCALLTYPE d2d_bitmap_brush_SetBitmap(ID2D1BitmapBrush1 *iface, ID2D1Bitmap *bitmap)
{
- struct d2d_brush *brush = impl_from_ID2D1BitmapBrush(iface);
+ struct d2d_brush *brush = impl_from_ID2D1BitmapBrush1(iface);
TRACE("iface %p, bitmap %p.\n", iface, bitmap);
@@ -975,36 +986,43 @@ static void STDMETHODCALLTYPE d2d_bitmap_brush_SetBitmap(ID2D1BitmapBrush *iface
brush->u.bitmap.bitmap = unsafe_impl_from_ID2D1Bitmap(bitmap);
}
-static D2D1_EXTEND_MODE STDMETHODCALLTYPE d2d_bitmap_brush_GetExtendModeX(ID2D1BitmapBrush *iface)
+static D2D1_EXTEND_MODE STDMETHODCALLTYPE d2d_bitmap_brush_GetExtendModeX(ID2D1BitmapBrush1 *iface)
{
- struct d2d_brush *brush = impl_from_ID2D1BitmapBrush(iface);
+ struct d2d_brush *brush = impl_from_ID2D1BitmapBrush1(iface);
TRACE("iface %p.\n", iface);
return brush->u.bitmap.extend_mode_x;
}
-static D2D1_EXTEND_MODE STDMETHODCALLTYPE d2d_bitmap_brush_GetExtendModeY(ID2D1BitmapBrush *iface)
+static D2D1_EXTEND_MODE STDMETHODCALLTYPE d2d_bitmap_brush_GetExtendModeY(ID2D1BitmapBrush1 *iface)
{
- struct d2d_brush *brush = impl_from_ID2D1BitmapBrush(iface);
+ struct d2d_brush *brush = impl_from_ID2D1BitmapBrush1(iface);
TRACE("iface %p.\n", iface);
return brush->u.bitmap.extend_mode_y;
}
-static D2D1_BITMAP_INTERPOLATION_MODE STDMETHODCALLTYPE d2d_bitmap_brush_GetInterpolationMode(ID2D1BitmapBrush *iface)
+static D2D1_BITMAP_INTERPOLATION_MODE STDMETHODCALLTYPE d2d_bitmap_brush_GetInterpolationMode(ID2D1BitmapBrush1 *iface)
{
- struct d2d_brush *brush = impl_from_ID2D1BitmapBrush(iface);
+ struct d2d_brush *brush = impl_from_ID2D1BitmapBrush1(iface);
TRACE("iface %p.\n", iface);
- return brush->u.bitmap.interpolation_mode;
+ switch (brush->u.bitmap.interpolation_mode)
+ {
+ case D2D1_INTERPOLATION_MODE_NEAREST_NEIGHBOR:
+ case D2D1_INTERPOLATION_MODE_LINEAR:
+ return brush->u.bitmap.interpolation_mode;
+ default:
+ return D2D1_BITMAP_INTERPOLATION_MODE_LINEAR;
+ }
}
-static void STDMETHODCALLTYPE d2d_bitmap_brush_GetBitmap(ID2D1BitmapBrush *iface, ID2D1Bitmap **bitmap)
+static void STDMETHODCALLTYPE d2d_bitmap_brush_GetBitmap(ID2D1BitmapBrush1 *iface, ID2D1Bitmap **bitmap)
{
- struct d2d_brush *brush = impl_from_ID2D1BitmapBrush(iface);
+ struct d2d_brush *brush = impl_from_ID2D1BitmapBrush1(iface);
TRACE("iface %p, bitmap %p.\n", iface, bitmap);
@@ -1012,7 +1030,45 @@ static void STDMETHODCALLTYPE d2d_bitmap_brush_GetBitmap(ID2D1BitmapBrush *iface
ID2D1Bitmap_AddRef(*bitmap);
}
-static const struct ID2D1BitmapBrushVtbl d2d_bitmap_brush_vtbl =
+static void STDMETHODCALLTYPE d2d_bitmap_brush_SetInterpolationMode1(ID2D1BitmapBrush1 *iface,
+ D2D1_INTERPOLATION_MODE mode)
+{
+ struct d2d_brush *brush = impl_from_ID2D1BitmapBrush1(iface);
+
+ TRACE("iface %p, mode %#x.\n", iface, mode);
+
+ switch (mode)
+ {
+ case D2D1_INTERPOLATION_MODE_NEAREST_NEIGHBOR:
+ case D2D1_INTERPOLATION_MODE_LINEAR:
+ case D2D1_INTERPOLATION_MODE_CUBIC:
+ case D2D1_INTERPOLATION_MODE_MULTI_SAMPLE_LINEAR:
+ case D2D1_INTERPOLATION_MODE_ANISOTROPIC:
+ case D2D1_INTERPOLATION_MODE_HIGH_QUALITY_CUBIC:
+ break;
+ default:
+ WARN("Unknown interpolation mode %#x.\n", mode);
+ return;
+ }
+
+ brush->u.bitmap.interpolation_mode = mode;
+ if (brush->u.bitmap.sampler_state)
+ {
+ ID3D10SamplerState_Release(brush->u.bitmap.sampler_state);
+ brush->u.bitmap.sampler_state = NULL;
+ }
+}
+
+static D2D1_INTERPOLATION_MODE STDMETHODCALLTYPE d2d_bitmap_brush_GetInterpolationMode1(ID2D1BitmapBrush1 *iface)
+{
+ struct d2d_brush *brush = impl_from_ID2D1BitmapBrush1(iface);
+
+ TRACE("iface %p.\n", iface);
+
+ return brush->u.bitmap.interpolation_mode;
+}
+
+static const struct ID2D1BitmapBrush1Vtbl d2d_bitmap_brush_vtbl =
{
d2d_bitmap_brush_QueryInterface,
d2d_bitmap_brush_AddRef,
@@ -1030,6 +1086,8 @@ static const struct ID2D1BitmapBrushVtbl d2d_bitmap_brush_vtbl =
d2d_bitmap_brush_GetExtendModeY,
d2d_bitmap_brush_GetInterpolationMode,
d2d_bitmap_brush_GetBitmap,
+ d2d_bitmap_brush_SetInterpolationMode1,
+ d2d_bitmap_brush_GetInterpolationMode1,
};
HRESULT d2d_bitmap_brush_create(ID2D1Factory *factory, ID2D1Bitmap *bitmap, const D2D1_BITMAP_BRUSH_PROPERTIES *bitmap_brush_desc,
@@ -1242,7 +1300,7 @@ static void d2d_brush_bind_bitmap(struct d2d_brush *brush, ID3D10Device *device,
{
D3D10_SAMPLER_DESC sampler_desc;
- if (brush->u.bitmap.interpolation_mode == D2D1_BITMAP_INTERPOLATION_MODE_NEAREST_NEIGHBOR)
+ if (brush->u.bitmap.interpolation_mode == D2D1_INTERPOLATION_MODE_NEAREST_NEIGHBOR)
sampler_desc.Filter = D3D10_FILTER_MIN_MAG_MIP_POINT;
else
sampler_desc.Filter = D3D10_FILTER_MIN_MAG_MIP_LINEAR;
diff --git a/dlls/d2d1/d2d1_private.h b/dlls/d2d1/d2d1_private.h
index 3fed59fa72..c8515eaa12 100644
--- a/dlls/d2d1/d2d1_private.h
+++ b/dlls/d2d1/d2d1_private.h
@@ -280,7 +280,7 @@ struct d2d_brush
struct d2d_bitmap *bitmap;
D2D1_EXTEND_MODE extend_mode_x;
D2D1_EXTEND_MODE extend_mode_y;
- D2D1_BITMAP_INTERPOLATION_MODE interpolation_mode;
+ D2D1_INTERPOLATION_MODE interpolation_mode;
ID3D10SamplerState *sampler_state;
} bitmap;
} u;
diff --git a/dlls/d2d1/tests/d2d1.c b/dlls/d2d1/tests/d2d1.c
index 6419df23d8..8584e69d3e 100644
--- a/dlls/d2d1/tests/d2d1.c
+++ b/dlls/d2d1/tests/d2d1.c
@@ -1656,6 +1656,7 @@ static void test_bitmap_brush(void)
D2D1_RECT_F src_rect, dst_rect;
D2D1_EXTEND_MODE extend_mode;
IDXGISwapChain *swapchain;
+ ID2D1BitmapBrush1 *brush1;
ID2D1BitmapBrush *brush;
ID2D1RenderTarget *rt;
ID3D10Device1 *device;
@@ -1877,6 +1878,49 @@ static void test_bitmap_brush(void)
match = compare_surface(surface, "cf7b90ba7b139fdfbe9347e1907d635cfb4ed197");
ok(match, "Surface does not match.\n");
+ if (SUCCEEDED(ID2D1BitmapBrush_QueryInterface(brush, &IID_ID2D1BitmapBrush1, (void **)&brush1)))
+ {
+ D2D1_INTERPOLATION_MODE interpolation_mode1;
+
+ interpolation_mode = ID2D1BitmapBrush1_GetInterpolationMode(brush1);
+ ok(interpolation_mode == D2D1_BITMAP_INTERPOLATION_MODE_NEAREST_NEIGHBOR,
+ "Unexpected interpolation mode %#x.\n", interpolation_mode);
+
+ interpolation_mode1 = ID2D1BitmapBrush1_GetInterpolationMode1(brush1);
+ ok(interpolation_mode1 == D2D1_INTERPOLATION_MODE_NEAREST_NEIGHBOR,
+ "Unexpected interpolation mode %#x.\n", interpolation_mode1);
+
+ ID2D1BitmapBrush1_SetInterpolationMode1(brush1, D2D1_INTERPOLATION_MODE_HIGH_QUALITY_CUBIC);
+ interpolation_mode = ID2D1BitmapBrush1_GetInterpolationMode(brush1);
+ ok(interpolation_mode == D2D1_BITMAP_INTERPOLATION_MODE_LINEAR,
+ "Unexpected interpolation mode %#x.\n", interpolation_mode);
+
+ interpolation_mode1 = ID2D1BitmapBrush1_GetInterpolationMode1(brush1);
+ ok(interpolation_mode1 == D2D1_INTERPOLATION_MODE_HIGH_QUALITY_CUBIC,
+ "Unexpected interpolation mode %#x.\n", interpolation_mode1);
+
+ ID2D1BitmapBrush1_SetInterpolationMode1(brush1, 100);
+ interpolation_mode1 = ID2D1BitmapBrush1_GetInterpolationMode1(brush1);
+ ok(interpolation_mode1 == D2D1_INTERPOLATION_MODE_HIGH_QUALITY_CUBIC,
+ "Unexpected interpolation mode %#x.\n", interpolation_mode1);
+
+ ID2D1BitmapBrush1_SetInterpolationMode(brush1, 100);
+ interpolation_mode1 = ID2D1BitmapBrush1_GetInterpolationMode1(brush1);
+ ok(interpolation_mode1 == D2D1_INTERPOLATION_MODE_HIGH_QUALITY_CUBIC,
+ "Unexpected interpolation mode %#x.\n", interpolation_mode1);
+
+ ID2D1BitmapBrush1_SetInterpolationMode(brush1, D2D1_BITMAP_INTERPOLATION_MODE_NEAREST_NEIGHBOR);
+ interpolation_mode = ID2D1BitmapBrush1_GetInterpolationMode(brush1);
+ ok(interpolation_mode == D2D1_BITMAP_INTERPOLATION_MODE_NEAREST_NEIGHBOR,
+ "Unexpected interpolation mode %#x.\n", interpolation_mode);
+
+ interpolation_mode1 = ID2D1BitmapBrush1_GetInterpolationMode1(brush1);
+ ok(interpolation_mode1 == D2D1_INTERPOLATION_MODE_NEAREST_NEIGHBOR,
+ "Unexpected interpolation mode %#x.\n", interpolation_mode1);
+
+ ID2D1BitmapBrush1_Release(brush1);
+ }
+
ID2D1BitmapBrush_Release(brush);
refcount = ID2D1Bitmap_Release(bitmap);
ok(!refcount, "Bitmap has %u references left.\n", refcount);
--
2.18.0
Sept. 16, 2018
[PATCH 2/4] include: Add ID2D1BitmapBrush1 definition.
by Nikolay Sivov
Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com>
---
include/d2d1_1.idl | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/include/d2d1_1.idl b/include/d2d1_1.idl
index ff283f8f1a..284bd60ece 100644
--- a/include/d2d1_1.idl
+++ b/include/d2d1_1.idl
@@ -286,6 +286,19 @@ interface ID2D1Bitmap1 : ID2D1Bitmap
HRESULT Unmap();
}
+[
+ object,
+ uuid(41343a53-e41a-49a2-91cd-21793bbb62e5),
+ local,
+]
+interface ID2D1BitmapBrush1 : ID2D1BitmapBrush
+{
+ void SetInterpolationMode1(
+ [in] D2D1_INTERPOLATION_MODE mode
+ );
+ D2D1_INTERPOLATION_MODE GetInterpolationMode1();
+}
+
[
object,
uuid(47dd575d-ac05-4cdd-8049-9b02cd16f44c),
--
2.18.0
Sept. 16, 2018
[v2 PATCH 1/4] d2d1: Implement GetSurface() for bitmaps.
by Nikolay Sivov
Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com>
---
dlls/d2d1/bitmap.c | 64 +++++++++++++++++++++-----------------
dlls/d2d1/d2d1_private.h | 12 +++++--
dlls/d2d1/device.c | 9 ++----
dlls/d2d1/tests/d2d1.c | 67 ++++++++++++++++++++++++----------------
4 files changed, 88 insertions(+), 64 deletions(-)
diff --git a/dlls/d2d1/bitmap.c b/dlls/d2d1/bitmap.c
index 8b5b6aa0a9..01dc829a1c 100644
--- a/dlls/d2d1/bitmap.c
+++ b/dlls/d2d1/bitmap.c
@@ -70,6 +70,8 @@ static ULONG STDMETHODCALLTYPE d2d_bitmap_Release(ID2D1Bitmap1 *iface)
if (!refcount)
{
ID3D10ShaderResourceView_Release(bitmap->view);
+ if (bitmap->surface)
+ IDXGISurface_Release(bitmap->surface);
ID2D1Factory_Release(bitmap->factory);
heap_free(bitmap);
}
@@ -188,9 +190,15 @@ static D2D1_BITMAP_OPTIONS STDMETHODCALLTYPE d2d_bitmap_GetOptions(ID2D1Bitmap1
static HRESULT STDMETHODCALLTYPE d2d_bitmap_GetSurface(ID2D1Bitmap1 *iface, IDXGISurface **surface)
{
- FIXME("iface %p, surface %p stub!\n", iface, surface);
+ struct d2d_bitmap *bitmap = impl_from_ID2D1Bitmap1(iface);
- return E_NOTIMPL;
+ TRACE("iface %p, surface %p.\n", iface, surface);
+
+ *surface = bitmap->surface;
+ if (*surface)
+ IDXGISurface_AddRef(*surface);
+
+ return *surface ? S_OK : D2DERR_INVALID_CALL;
}
static HRESULT STDMETHODCALLTYPE d2d_bitmap_Map(ID2D1Bitmap1 *iface, D2D1_MAP_OPTIONS options,
@@ -263,18 +271,26 @@ static BOOL format_supported(const D2D1_PIXEL_FORMAT *format)
return FALSE;
}
-static void d2d_bitmap_init(struct d2d_bitmap *bitmap, ID2D1Factory *factory,
+static void d2d_bitmap_init(struct d2d_bitmap *bitmap, struct d2d_device_context *context,
ID3D10ShaderResourceView *view, D2D1_SIZE_U size, const D2D1_BITMAP_PROPERTIES1 *desc)
{
bitmap->ID2D1Bitmap1_iface.lpVtbl = &d2d_bitmap_vtbl;
bitmap->refcount = 1;
- ID2D1Factory_AddRef(bitmap->factory = factory);
+ ID2D1Factory_AddRef(bitmap->factory = context->factory);
ID3D10ShaderResourceView_AddRef(bitmap->view = view);
bitmap->pixel_size = size;
bitmap->format = desc->pixelFormat;
bitmap->dpi_x = desc->dpiX;
bitmap->dpi_y = desc->dpiY;
bitmap->options = desc->bitmapOptions;
+ if (d2d_device_context_is_dxgi_target(context))
+ {
+ ID3D10Resource *resource;
+
+ ID3D10ShaderResourceView_GetResource(bitmap->view, &resource);
+ ID3D10Resource_QueryInterface(resource, &IID_IDXGISurface, (void **)&bitmap->surface);
+ ID3D10Resource_Release(resource);
+ }
if (bitmap->dpi_x == 0.0f && bitmap->dpi_y == 0.0f)
{
@@ -283,7 +299,7 @@ static void d2d_bitmap_init(struct d2d_bitmap *bitmap, ID2D1Factory *factory,
}
}
-HRESULT d2d_bitmap_create(ID2D1Factory *factory, ID3D10Device *device, D2D1_SIZE_U size, const void *src_data,
+HRESULT d2d_bitmap_create(struct d2d_device_context *context, D2D1_SIZE_U size, const void *src_data,
UINT32 pitch, const D2D1_BITMAP_PROPERTIES1 *desc, struct d2d_bitmap **bitmap)
{
D3D10_SUBRESOURCE_DATA resource_data;
@@ -314,14 +330,14 @@ HRESULT d2d_bitmap_create(ID2D1Factory *factory, ID3D10Device *device, D2D1_SIZE
resource_data.pSysMem = src_data;
resource_data.SysMemPitch = pitch;
- if (FAILED(hr = ID3D10Device_CreateTexture2D(device, &texture_desc,
+ if (FAILED(hr = ID3D10Device_CreateTexture2D(context->device, &texture_desc,
src_data ? &resource_data : NULL, &texture)))
{
ERR("Failed to create texture, hr %#x.\n", hr);
return hr;
}
- hr = ID3D10Device_CreateShaderResourceView(device, (ID3D10Resource *)texture, NULL, &view);
+ hr = ID3D10Device_CreateShaderResourceView(context->device, (ID3D10Resource *)texture, NULL, &view);
ID3D10Texture2D_Release(texture);
if (FAILED(hr))
{
@@ -331,7 +347,7 @@ HRESULT d2d_bitmap_create(ID2D1Factory *factory, ID3D10Device *device, D2D1_SIZE
if ((*bitmap = heap_alloc_zero(sizeof(**bitmap))))
{
- d2d_bitmap_init(*bitmap, factory, view, size, desc);
+ d2d_bitmap_init(*bitmap, context, view, size, desc);
TRACE("Created bitmap %p.\n", *bitmap);
}
@@ -340,11 +356,10 @@ HRESULT d2d_bitmap_create(ID2D1Factory *factory, ID3D10Device *device, D2D1_SIZE
return *bitmap ? S_OK : E_OUTOFMEMORY;
}
-HRESULT d2d_bitmap_create_shared(ID2D1DeviceContext *context, ID3D10Device *target_device,
- REFIID iid, void *data, const D2D1_BITMAP_PROPERTIES1 *desc, struct d2d_bitmap **bitmap)
+HRESULT d2d_bitmap_create_shared(struct d2d_device_context *context, REFIID iid, void *data,
+ const D2D1_BITMAP_PROPERTIES1 *desc, struct d2d_bitmap **bitmap)
{
D2D1_BITMAP_PROPERTIES1 d;
- ID2D1Factory *factory;
if (IsEqualGUID(iid, &IID_ID2D1Bitmap))
{
@@ -352,8 +367,7 @@ HRESULT d2d_bitmap_create_shared(ID2D1DeviceContext *context, ID3D10Device *targ
ID3D10Device *device;
HRESULT hr = S_OK;
- ID2D1DeviceContext_GetFactory(context, &factory);
- if (src_impl->factory != factory)
+ if (src_impl->factory != context->factory)
{
hr = D2DERR_WRONG_FACTORY;
goto failed;
@@ -361,7 +375,7 @@ HRESULT d2d_bitmap_create_shared(ID2D1DeviceContext *context, ID3D10Device *targ
ID3D10ShaderResourceView_GetDevice(src_impl->view, &device);
ID3D10Device_Release(device);
- if (device != target_device)
+ if (device != context->device)
{
hr = D2DERR_UNSUPPORTED_OPERATION;
goto failed;
@@ -391,11 +405,10 @@ HRESULT d2d_bitmap_create_shared(ID2D1DeviceContext *context, ID3D10Device *targ
goto failed;
}
- d2d_bitmap_init(*bitmap, factory, src_impl->view, src_impl->pixel_size, desc);
+ d2d_bitmap_init(*bitmap, context, src_impl->view, src_impl->pixel_size, desc);
TRACE("Created bitmap %p.\n", *bitmap);
failed:
- ID2D1Factory_Release(factory);
return hr;
}
@@ -417,13 +430,13 @@ HRESULT d2d_bitmap_create_shared(ID2D1DeviceContext *context, ID3D10Device *targ
ID3D10Resource_GetDevice(resource, &device);
ID3D10Device_Release(device);
- if (device != target_device)
+ if (device != context->device)
{
ID3D10Resource_Release(resource);
return D2DERR_UNSUPPORTED_OPERATION;
}
- hr = ID3D10Device_CreateShaderResourceView(target_device, resource, NULL, &view);
+ hr = ID3D10Device_CreateShaderResourceView(context->device, resource, NULL, &view);
ID3D10Resource_Release(resource);
if (FAILED(hr))
{
@@ -455,22 +468,17 @@ HRESULT d2d_bitmap_create_shared(ID2D1DeviceContext *context, ID3D10Device *targ
if (d.dpiX == 0.0f || d.dpiY == 0.0f)
{
- float dpi_x, dpi_y;
-
- ID2D1DeviceContext_GetDpi(context, &dpi_x, &dpi_y);
if (d.dpiX == 0.0f)
- d.dpiX = dpi_x;
+ d.dpiX = context->desc.dpiX;
if (d.dpiY == 0.0f)
- d.dpiY = dpi_y;
+ d.dpiY = context->desc.dpiY;
}
pixel_size.width = surface_desc.Width;
pixel_size.height = surface_desc.Height;
- ID2D1DeviceContext_GetFactory(context, &factory);
- d2d_bitmap_init(*bitmap, factory, view, pixel_size, &d);
+ d2d_bitmap_init(*bitmap, context, view, pixel_size, &d);
ID3D10ShaderResourceView_Release(view);
- ID2D1Factory_Release(factory);
TRACE("Created bitmap %p.\n", *bitmap);
return S_OK;
@@ -481,7 +489,7 @@ HRESULT d2d_bitmap_create_shared(ID2D1DeviceContext *context, ID3D10Device *targ
return E_INVALIDARG;
}
-HRESULT d2d_bitmap_create_from_wic_bitmap(ID2D1Factory *factory, ID3D10Device *device, IWICBitmapSource *bitmap_source,
+HRESULT d2d_bitmap_create_from_wic_bitmap(struct d2d_device_context *context, IWICBitmapSource *bitmap_source,
const D2D1_BITMAP_PROPERTIES1 *desc, struct d2d_bitmap **bitmap)
{
const D2D1_PIXEL_FORMAT *d2d_format;
@@ -581,7 +589,7 @@ HRESULT d2d_bitmap_create_from_wic_bitmap(ID2D1Factory *factory, ID3D10Device *d
return hr;
}
- hr = d2d_bitmap_create(factory, device, size, data, pitch, &bitmap_desc, bitmap);
+ hr = d2d_bitmap_create(context, size, data, pitch, &bitmap_desc, bitmap);
heap_free(data);
diff --git a/dlls/d2d1/d2d1_private.h b/dlls/d2d1/d2d1_private.h
index 5b96a6050d..3fed59fa72 100644
--- a/dlls/d2d1/d2d1_private.h
+++ b/dlls/d2d1/d2d1_private.h
@@ -160,6 +160,11 @@ HRESULT d2d_d3d_create_render_target(ID2D1Factory *factory, IDXGISurface *surfac
void **render_target) DECLSPEC_HIDDEN;
HRESULT d2d_d3d_render_target_create_rtv(ID2D1RenderTarget *render_target, IDXGISurface1 *surface) DECLSPEC_HIDDEN;
+static inline BOOL d2d_device_context_is_dxgi_target(const struct d2d_device_context *context)
+{
+ return !context->ops;
+}
+
struct d2d_wic_render_target
{
IUnknown IUnknown_iface;
@@ -339,6 +344,7 @@ struct d2d_bitmap
ID2D1Factory *factory;
ID3D10ShaderResourceView *view;
+ IDXGISurface *surface;
D2D1_SIZE_U pixel_size;
D2D1_PIXEL_FORMAT format;
float dpi_x;
@@ -346,11 +352,11 @@ struct d2d_bitmap
D2D1_BITMAP_OPTIONS options;
};
-HRESULT d2d_bitmap_create(ID2D1Factory *factory, ID3D10Device *device, D2D1_SIZE_U size, const void *src_data,
+HRESULT d2d_bitmap_create(struct d2d_device_context *context, D2D1_SIZE_U size, const void *src_data,
UINT32 pitch, const D2D1_BITMAP_PROPERTIES1 *desc, struct d2d_bitmap **bitmap) DECLSPEC_HIDDEN;
-HRESULT d2d_bitmap_create_shared(ID2D1DeviceContext *context, ID3D10Device *device, REFIID iid, void *data,
+HRESULT d2d_bitmap_create_shared(struct d2d_device_context *context, REFIID iid, void *data,
const D2D1_BITMAP_PROPERTIES1 *desc, struct d2d_bitmap **bitmap) DECLSPEC_HIDDEN;
-HRESULT d2d_bitmap_create_from_wic_bitmap(ID2D1Factory *factory, ID3D10Device *device, IWICBitmapSource *bitmap_source,
+HRESULT d2d_bitmap_create_from_wic_bitmap(struct d2d_device_context *context, IWICBitmapSource *bitmap_source,
const D2D1_BITMAP_PROPERTIES1 *desc, struct d2d_bitmap **bitmap) DECLSPEC_HIDDEN;
struct d2d_bitmap *unsafe_impl_from_ID2D1Bitmap(ID2D1Bitmap *iface) DECLSPEC_HIDDEN;
diff --git a/dlls/d2d1/device.c b/dlls/d2d1/device.c
index 649fcc4311..041cb33c90 100644
--- a/dlls/d2d1/device.c
+++ b/dlls/d2d1/device.c
@@ -343,8 +343,7 @@ static HRESULT STDMETHODCALLTYPE d2d_device_context_CreateBitmap(ID2D1DeviceCont
bitmap_desc.colorContext = NULL;
}
- if (SUCCEEDED(hr = d2d_bitmap_create(context->factory, context->device,
- size, src_data, pitch, desc ? &bitmap_desc : NULL, &object)))
+ if (SUCCEEDED(hr = d2d_bitmap_create(context, size, src_data, pitch, desc ? &bitmap_desc : NULL, &object)))
*bitmap = (ID2D1Bitmap *)&object->ID2D1Bitmap1_iface;
return hr;
@@ -368,8 +367,7 @@ static HRESULT STDMETHODCALLTYPE d2d_device_context_CreateBitmapFromWicBitmap(ID
bitmap_desc.colorContext = NULL;
}
- if (SUCCEEDED(hr = d2d_bitmap_create_from_wic_bitmap(context->factory, context->device,
- bitmap_source, desc ? &bitmap_desc : NULL, &object)))
+ if (SUCCEEDED(hr = d2d_bitmap_create_from_wic_bitmap(context, bitmap_source, desc ? &bitmap_desc : NULL, &object)))
*bitmap = (ID2D1Bitmap *)&object->ID2D1Bitmap1_iface;
return hr;
@@ -393,8 +391,7 @@ static HRESULT STDMETHODCALLTYPE d2d_device_context_CreateSharedBitmap(ID2D1Devi
bitmap_desc.colorContext = NULL;
}
- if (SUCCEEDED(hr = d2d_bitmap_create_shared(iface, context->device,
- iid, data, desc ? &bitmap_desc : NULL, &object)))
+ if (SUCCEEDED(hr = d2d_bitmap_create_shared(context, iid, data, desc ? &bitmap_desc : NULL, &object)))
*bitmap = (ID2D1Bitmap *)&object->ID2D1Bitmap1_iface;
return hr;
diff --git a/dlls/d2d1/tests/d2d1.c b/dlls/d2d1/tests/d2d1.c
index 1753d6282f..6419df23d8 100644
--- a/dlls/d2d1/tests/d2d1.c
+++ b/dlls/d2d1/tests/d2d1.c
@@ -774,29 +774,31 @@ static ID2D1RenderTarget *create_render_target(IDXGISurface *surface)
}
#define check_bitmap_surface(b, s, o) check_bitmap_surface_(__LINE__, b, s, o)
-static void check_bitmap_surface_(unsigned int line, ID2D1Bitmap1 *bitmap, BOOL has_surface, DWORD expected_options)
+static void check_bitmap_surface_(unsigned int line, ID2D1Bitmap *bitmap, BOOL has_surface, DWORD expected_options)
{
D2D1_BITMAP_OPTIONS options;
IDXGISurface *surface;
+ ID2D1Bitmap1 *bitmap1;
HRESULT hr;
- options = ID2D1Bitmap1_GetOptions(bitmap);
+ hr = ID2D1Bitmap_QueryInterface(bitmap, &IID_ID2D1Bitmap1, (void **)&bitmap1);
+ if (FAILED(hr))
+ return;
+
+ options = ID2D1Bitmap1_GetOptions(bitmap1);
ok_(__FILE__, line)(options == expected_options, "Unexpected bitmap options %#x, expected %#x.\n",
options, expected_options);
surface = (void *)0xdeadbeef;
- hr = ID2D1Bitmap1_GetSurface(bitmap, &surface);
+ hr = ID2D1Bitmap1_GetSurface(bitmap1, &surface);
if (has_surface)
{
D3D10_TEXTURE2D_DESC desc;
ID3D10Texture2D *texture;
- todo_wine
ok_(__FILE__, line)(SUCCEEDED(hr), "Failed to get bitmap surface, hr %#x.\n", hr);
ok_(__FILE__, line)(!!surface, "Expected surface instance.\n");
- if (SUCCEEDED(hr))
- {
/* Correlate with resource configuration. */
hr = IDXGISurface_QueryInterface(surface, &IID_ID3D10Texture2D, (void **)&texture);
ok_(__FILE__, line)(SUCCEEDED(hr), "Failed to get texture pointer, hr %#x.\n", hr);
@@ -813,14 +815,13 @@ static void check_bitmap_surface_(unsigned int line, ID2D1Bitmap1 *bitmap, BOOL
IDXGISurface_Release(surface);
}
- }
else
{
- todo_wine {
ok_(__FILE__, line)(hr == D2DERR_INVALID_CALL, "Unexpected hr %#x.\n", hr);
ok_(__FILE__, line)(!surface, "Unexpected surface instance.\n");
}
- }
+
+ ID2D1Bitmap1_Release(bitmap1);
}
static inline struct geometry_sink *impl_from_ID2D1SimplifiedGeometrySink(ID2D1SimplifiedGeometrySink *iface)
@@ -4132,12 +4133,14 @@ static void test_shared_bitmap(void)
hr = ID2D1Factory_CreateDxgiSurfaceRenderTarget(factory1, surface1, &desc, &rt1);
ok(SUCCEEDED(hr), "Failed to create render target, hr %#x.\n", hr);
hr = ID2D1RenderTarget_CreateBitmap(rt1, size, NULL, 0, &bitmap_desc, &bitmap1);
+ check_bitmap_surface(bitmap1, TRUE, 0);
ok(SUCCEEDED(hr), "Failed to create bitmap, hr %#x.\n", hr);
hr = ID2D1Factory_CreateDxgiSurfaceRenderTarget(factory1, surface2, &desc, &rt2);
ok(SUCCEEDED(hr), "Failed to create render target, hr %#x.\n", hr);
hr = ID2D1RenderTarget_CreateSharedBitmap(rt2, &IID_ID2D1Bitmap, bitmap1, NULL, &bitmap2);
ok(SUCCEEDED(hr), "Failed to create bitmap, hr %#x.\n", hr);
+ check_bitmap_surface(bitmap2, TRUE, 0);
ID2D1Bitmap_Release(bitmap2);
hr = ID2D1RenderTarget_CreateSharedBitmap(rt2, &IID_IUnknown, bitmap1, NULL, &bitmap2);
ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr);
@@ -4206,6 +4209,7 @@ static void test_shared_bitmap(void)
ok(SUCCEEDED(hr), "Failed to create render target, hr %#x.\n", hr);
hr = ID2D1RenderTarget_CreateSharedBitmap(rt2, &IID_ID2D1Bitmap, bitmap1, NULL, &bitmap2);
ok(SUCCEEDED(hr), "Failed to create bitmap, hr %#x.\n", hr);
+ check_bitmap_surface(bitmap2, FALSE, 0);
ID2D1Bitmap_Release(bitmap2);
ID2D1RenderTarget_Release(rt2);
@@ -4231,18 +4235,12 @@ static void test_shared_bitmap(void)
if (SUCCEEDED(hr))
{
- ID2D1Bitmap1 *bitmap3;
-
size = ID2D1Bitmap_GetPixelSize(bitmap2);
hr = IDXGISurface_GetDesc(surface2, &surface_desc);
ok(SUCCEEDED(hr), "Failed to get surface description, hr %#x.\n", hr);
ok(size.width == surface_desc.Width && size.height == surface_desc.Height, "Got wrong bitmap size.\n");
- hr = ID2D1Bitmap_QueryInterface(bitmap2, &IID_ID2D1Bitmap1, (void **)&bitmap3);
- ok(SUCCEEDED(hr), "Failed to get ID2D1Bitmap1 pointer, hr %#x.\n", hr);
-
- check_bitmap_surface(bitmap3, TRUE, D2D1_BITMAP_OPTIONS_TARGET | D2D1_BITMAP_OPTIONS_CANNOT_DRAW);
- ID2D1Bitmap1_Release(bitmap3);
+ check_bitmap_surface(bitmap2, TRUE, D2D1_BITMAP_OPTIONS_TARGET | D2D1_BITMAP_OPTIONS_CANNOT_DRAW);
ID2D1Bitmap_Release(bitmap2);
@@ -6661,8 +6659,9 @@ static void check_rt_bitmap_surface_(unsigned int line, ID2D1RenderTarget *rt, B
{
D2D1_BITMAP_PROPERTIES bitmap_desc;
ID2D1RenderTarget *compatible_rt;
+ IWICImagingFactory *wic_factory;
ID2D1DeviceContext *context;
- ID2D1Bitmap1 *bitmap1;
+ IWICBitmap *wic_bitmap;
ID2D1Bitmap *bitmap;
D2D1_SIZE_U size;
HRESULT hr;
@@ -6672,6 +6671,7 @@ static void check_rt_bitmap_surface_(unsigned int line, ID2D1RenderTarget *rt, B
0x7f7f0000,
};
+ /* Raw data bitmap. */
set_size_u(&size, 1, 1);
bitmap_desc.pixelFormat.format = DXGI_FORMAT_B8G8R8A8_UNORM;
bitmap_desc.pixelFormat.alphaMode = D2D1_ALPHA_MODE_IGNORE;
@@ -6680,14 +6680,31 @@ static void check_rt_bitmap_surface_(unsigned int line, ID2D1RenderTarget *rt, B
hr = ID2D1RenderTarget_CreateBitmap(rt, size, bitmap_data, sizeof(*bitmap_data), &bitmap_desc, &bitmap);
ok_(__FILE__, line)(SUCCEEDED(hr), "Failed to create bitmap, hr %#x.\n", hr);
- hr = ID2D1Bitmap_QueryInterface(bitmap, &IID_ID2D1Bitmap1, (void **)&bitmap1);
- ok_(__FILE__, line)(SUCCEEDED(hr), "Failed to get ID2D1Bitmap1 interface, hr %#x.\n", hr);
+ check_bitmap_surface_(line, bitmap, has_surface, options);
- check_bitmap_surface_(line, bitmap1, has_surface, options);
+ ID2D1Bitmap_Release(bitmap);
+
+ /* WIC bitmap. */
+ CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
+
+ hr = CoCreateInstance(&CLSID_WICImagingFactory, NULL, CLSCTX_INPROC_SERVER,
+ &IID_IWICImagingFactory, (void **)&wic_factory);
+ ok_(__FILE__, line)(SUCCEEDED(hr), "Failed to create WIC imaging factory, hr %#x.\n", hr);
+
+ hr = IWICImagingFactory_CreateBitmap(wic_factory, 16, 16,
+ &GUID_WICPixelFormat32bppPBGRA, WICBitmapCacheOnDemand, &wic_bitmap);
+ ok_(__FILE__, line)(SUCCEEDED(hr), "Failed to create WIC bitmap, hr %#x.\n", hr);
+ IWICImagingFactory_Release(wic_factory);
+
+ hr = ID2D1RenderTarget_CreateBitmapFromWicBitmap(rt, (IWICBitmapSource *)wic_bitmap, NULL, &bitmap);
+ ok_(__FILE__, line)(SUCCEEDED(hr), "Failed to create bitmap from WIC source, hr %#x.\n", hr);
+
+ check_bitmap_surface_(line, bitmap, has_surface, options);
- ID2D1Bitmap1_Release(bitmap1);
ID2D1Bitmap_Release(bitmap);
+ CoUninitialize();
+
if (FAILED(ID2D1RenderTarget_QueryInterface(rt, &IID_ID2D1DeviceContext, (void **)&context)))
{
/* Compatible target follows its parent. */
@@ -6698,13 +6715,9 @@ static void check_rt_bitmap_surface_(unsigned int line, ID2D1RenderTarget *rt, B
hr = ID2D1RenderTarget_CreateBitmap(compatible_rt, size, bitmap_data, sizeof(*bitmap_data), &bitmap_desc, &bitmap);
ok_(__FILE__, line)(SUCCEEDED(hr), "Failed to create bitmap, hr %#x.\n", hr);
- hr = ID2D1Bitmap_QueryInterface(bitmap, &IID_ID2D1Bitmap1, (void **)&bitmap1);
- ok_(__FILE__, line)(SUCCEEDED(hr), "Failed to get ID2D1Bitmap1 interface, hr %#x.\n", hr);
-
- check_bitmap_surface_(line, bitmap1, has_surface, options);
+ check_bitmap_surface_(line, bitmap, has_surface, options);
ID2D1RenderTarget_Release(compatible_rt);
- ID2D1Bitmap1_Release(bitmap1);
ID2D1Bitmap_Release(bitmap);
}
else
@@ -6776,7 +6789,7 @@ if (SUCCEEDED(hr))
hr = ID2D1DeviceContext_CreateBitmapFromDxgiSurface(device_context, surface, NULL, &bitmap);
ok(SUCCEEDED(hr), "Failed to create a bitmap, hr %#x.\n", hr);
- check_bitmap_surface(bitmap, TRUE, D2D1_BITMAP_OPTIONS_TARGET | D2D1_BITMAP_OPTIONS_CANNOT_DRAW);
+ check_bitmap_surface((ID2D1Bitmap *)bitmap, TRUE, D2D1_BITMAP_OPTIONS_TARGET | D2D1_BITMAP_OPTIONS_CANNOT_DRAW);
check_rt_bitmap_surface((ID2D1RenderTarget *)device_context, TRUE, D2D1_BITMAP_OPTIONS_NONE);
ID2D1DeviceContext_Release(device_context);
--
2.18.0
Sept. 16, 2018
[PATCH] kernel32: Add stub for SetProcessWorkingSetSizeEx
by André Hentschel
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=45523
Signed-off-by: André Hentschel <nerv(a)dawncrow.de>
---
.../api-ms-win-core-memory-l1-1-1.spec | 2 +-
.../api-ms-win-core-memory-l1-1-2.spec | 2 +-
dlls/kernel32/kernel32.spec | 2 +-
dlls/kernel32/process.c | 29 +++++++++++++++----
dlls/kernelbase/kernelbase.spec | 2 +-
include/winbase.h | 1 +
6 files changed, 29 insertions(+), 9 deletions(-)
diff --git a/dlls/api-ms-win-core-memory-l1-1-1/api-ms-win-core-memory-l1-1-1.spec b/dlls/api-ms-win-core-memory-l1-1-1/api-ms-win-core-memory-l1-1-1.spec
index 42630c1048..3200be9a78 100644
--- a/dlls/api-ms-win-core-memory-l1-1-1/api-ms-win-core-memory-l1-1-1.spec
+++ b/dlls/api-ms-win-core-memory-l1-1-1/api-ms-win-core-memory-l1-1-1.spec
@@ -15,7 +15,7 @@
@ stdcall QueryMemoryResourceNotification(ptr ptr) kernel32.QueryMemoryResourceNotification
@ stdcall ReadProcessMemory(long ptr ptr long ptr) kernel32.ReadProcessMemory
@ stdcall ResetWriteWatch(ptr long) kernel32.ResetWriteWatch
-@ stub SetProcessWorkingSetSizeEx
+@ stdcall SetProcessWorkingSetSizeEx(long long long long) kernel32.SetProcessWorkingSetSizeEx
@ stdcall SetSystemFileCacheSize(long long long) kernel32.SetSystemFileCacheSize
@ stdcall UnmapViewOfFile(ptr) kernel32.UnmapViewOfFile
@ stub UnmapViewOfFileEx
diff --git a/dlls/api-ms-win-core-memory-l1-1-2/api-ms-win-core-memory-l1-1-2.spec b/dlls/api-ms-win-core-memory-l1-1-2/api-ms-win-core-memory-l1-1-2.spec
index 6100213eb7..57a5b10562 100644
--- a/dlls/api-ms-win-core-memory-l1-1-2/api-ms-win-core-memory-l1-1-2.spec
+++ b/dlls/api-ms-win-core-memory-l1-1-2/api-ms-win-core-memory-l1-1-2.spec
@@ -21,7 +21,7 @@
@ stdcall ReadProcessMemory(long ptr ptr long ptr) kernel32.ReadProcessMemory
@ stub RegisterBadMemoryNotification
@ stdcall ResetWriteWatch(ptr long) kernel32.ResetWriteWatch
-@ stub SetProcessWorkingSetSizeEx
+@ stdcall SetProcessWorkingSetSizeEx(long long long long) kernel32.SetProcessWorkingSetSizeEx
@ stdcall SetSystemFileCacheSize(long long long) kernel32.SetSystemFileCacheSize
@ stdcall UnmapViewOfFile(ptr) kernel32.UnmapViewOfFile
@ stub UnmapViewOfFileEx
diff --git a/dlls/kernel32/kernel32.spec b/dlls/kernel32/kernel32.spec
index f1d75b8e1c..9db7d98f41 100644
--- a/dlls/kernel32/kernel32.spec
+++ b/dlls/kernel32/kernel32.spec
@@ -1434,7 +1434,7 @@
@ stdcall SetProcessShutdownParameters(long long)
# @ stub SetProcessUserModeExceptionPolicy
@ stdcall SetProcessWorkingSetSize(long long long)
-# @ stub SetProcessWorkingSetSizeEx
+@ stdcall SetProcessWorkingSetSizeEx(long long long long)
@ stdcall SetSearchPathMode(long)
@ stdcall SetStdHandle(long long)
# @ stub SetStdHandleEx
diff --git a/dlls/kernel32/process.c b/dlls/kernel32/process.c
index 85e0042024..eacc8e67b8 100644
--- a/dlls/kernel32/process.c
+++ b/dlls/kernel32/process.c
@@ -3390,22 +3390,22 @@ err:
/***********************************************************************
- * SetProcessWorkingSetSize [KERNEL32.@]
+ * SetProcessWorkingSetSizeEx [KERNEL32.@]
* Sets the min/max working set sizes for a specified process.
*
* PARAMS
- * hProcess [I] Handle to the process of interest
+ * process [I] Handle to the process of interest
* minset [I] Specifies minimum working set size
* maxset [I] Specifies maximum working set size
+ * flags [I] Flags to enforce working set sizes
*
* RETURNS
* Success: TRUE
* Failure: FALSE
*/
-BOOL WINAPI SetProcessWorkingSetSize(HANDLE hProcess, SIZE_T minset,
- SIZE_T maxset)
+BOOL WINAPI SetProcessWorkingSetSizeEx(HANDLE process, SIZE_T minset, SIZE_T maxset, DWORD flags)
{
- WARN("(%p,%ld,%ld): stub - harmless\n",hProcess,minset,maxset);
+ WARN("(%p,%ld,%ld,%x): stub - harmless\n", process, minset, maxset, flags);
if(( minset == (SIZE_T)-1) && (maxset == (SIZE_T)-1)) {
/* Trim the working set to zero */
/* Swap the process out of physical RAM */
@@ -3413,6 +3413,25 @@ BOOL WINAPI SetProcessWorkingSetSize(HANDLE hProcess, SIZE_T minset,
return TRUE;
}
+/***********************************************************************
+ * SetProcessWorkingSetSize [KERNEL32.@]
+ * Sets the min/max working set sizes for a specified process.
+ *
+ * PARAMS
+ * process [I] Handle to the process of interest
+ * minset [I] Specifies minimum working set size
+ * maxset [I] Specifies maximum working set size
+ *
+ * RETURNS
+ * Success: TRUE
+ * Failure: FALSE
+ */
+BOOL WINAPI SetProcessWorkingSetSize(HANDLE process, SIZE_T minset, SIZE_T maxset)
+{
+ WARN("(%p,%ld,%ld): stub - harmless\n", process, minset, maxset);
+ return SetProcessWorkingSetSizeEx(process, minset, maxset, 0);
+}
+
/***********************************************************************
* K32EmptyWorkingSet (KERNEL32.@)
*/
diff --git a/dlls/kernelbase/kernelbase.spec b/dlls/kernelbase/kernelbase.spec
index 89fad2c835..29805760da 100644
--- a/dlls/kernelbase/kernelbase.spec
+++ b/dlls/kernelbase/kernelbase.spec
@@ -1461,7 +1461,7 @@
@ stdcall SetProcessPriorityBoost(long long) kernel32.SetProcessPriorityBoost
@ stdcall SetProcessShutdownParameters(long long) kernel32.SetProcessShutdownParameters
# @ stub SetProcessValidCallTargets
-# @ stub SetProcessWorkingSetSizeEx
+@ stdcall SetProcessWorkingSetSizeEx(long long long long) kernel32.SetProcessWorkingSetSizeEx
# @ stub SetProtectedPolicy
# @ stub SetRoamingLastObservedChangeTime
@ stub SetSecurityAccessMask
diff --git a/include/winbase.h b/include/winbase.h
index 8b26308b95..4d959d0da6 100644
--- a/include/winbase.h
+++ b/include/winbase.h
@@ -2597,6 +2597,7 @@ WINBASEAPI BOOL WINAPI SetProcessAffinityMask(HANDLE,DWORD_PTR);
WINBASEAPI BOOL WINAPI SetProcessPriorityBoost(HANDLE,BOOL);
WINBASEAPI BOOL WINAPI SetProcessShutdownParameters(DWORD,DWORD);
WINBASEAPI BOOL WINAPI SetProcessWorkingSetSize(HANDLE,SIZE_T,SIZE_T);
+WINBASEAPI BOOL WINAPI SetProcessWorkingSetSizeEx(HANDLE,SIZE_T,SIZE_T,DWORD);
WINBASEAPI BOOL WINAPI SetSearchPathMode(DWORD);
WINADVAPI BOOL WINAPI SetSecurityDescriptorControl(PSECURITY_DESCRIPTOR,SECURITY_DESCRIPTOR_CONTROL,SECURITY_DESCRIPTOR_CONTROL);
WINADVAPI BOOL WINAPI SetSecurityDescriptorDacl(PSECURITY_DESCRIPTOR,BOOL,PACL,BOOL);
--
2.17.1
Sept. 16, 2018
Re: [PATCH] scrrun: Add MoveFile().
by Fabian Maurer
On Sonntag, 16. September 2018 16:06:07 CEST Nikolay Sivov
wrote:
> Should still work for reported case. I can add a warning with
arguments
> for error case if you think it helps.
Yeah, if you don't implement it right away, some sort of FIXME in
case it's called with unsupported parameters would be nice, I think.
Regards,
Fabian Maurer
Sept. 16, 2018
Re: [PATCH] scrrun: Add MoveFile().
by Nikolay Sivov
On 09/16/2018 04:48 PM, Fabian Maurer wrote:
> > + TRACE("%p %s %s\n", iface, debugstr_w(src), debugstr_w(dest));
>
> > +
>
> > + if (MoveFileW(src, dest))
>
> > + return S_OK;
>
> > +
>
> > + error = GetLastError();
>
> > + switch (error)
>
> > + {
>
> > + case ERROR_ALREADY_EXISTS:
>
> > + return CTL_E_FILEALREADYEXISTS;
>
> > + case ERROR_FILE_NOT_FOUND:
>
> > + return CTL_E_FILENOTFOUND;
>
> > + default:
>
> > + return HRESULT_FROM_WIN32(error);
>
> > + }
>
> That doesn't seem quite correct.
>
> As the docs I linked from
> https://bugs.winehq.org/show_bug.cgi?id=45839 state, this function
> also accepts wildcards. On my win7 machine that works, but MoveFileW
> can't handle this.
>
Should still work for reported case. I can add a warning with arguments
for error case if you think it helps.
> Regards,
>
> Fabian Maurer
>
Sept. 16, 2018
[PATCH] propsys: Add InitPropVariantFromCLSID().
by Nikolay Sivov
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=45347
Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com>
---
dlls/propsys/propsys.spec | 2 +-
dlls/propsys/propvar.c | 13 +++++++++++++
dlls/propsys/tests/propsys.c | 19 +++++++++++++++++++
include/propvarutil.h | 1 +
4 files changed, 34 insertions(+), 1 deletion(-)
diff --git a/dlls/propsys/propsys.spec b/dlls/propsys/propsys.spec
index db20fd39c9..bbc71654a8 100644
--- a/dlls/propsys/propsys.spec
+++ b/dlls/propsys/propsys.spec
@@ -29,7 +29,7 @@
@ stdcall -private DllUnregisterServer()
@ stub InitPropVariantFromBooleanVector
@ stdcall InitPropVariantFromBuffer(ptr long ptr)
-@ stub InitPropVariantFromCLSID
+@ stdcall InitPropVariantFromCLSID(ptr ptr)
@ stub InitPropVariantFromDoubleVector
@ stub InitPropVariantFromFileTime
@ stub InitPropVariantFromFileTimeVector
diff --git a/dlls/propsys/propvar.c b/dlls/propsys/propvar.c
index e6d4eba57c..ae96e4ee69 100644
--- a/dlls/propsys/propvar.c
+++ b/dlls/propsys/propvar.c
@@ -570,6 +570,19 @@ HRESULT WINAPI InitPropVariantFromBuffer(const VOID *pv, UINT cb, PROPVARIANT *p
return S_OK;
}
+HRESULT WINAPI InitPropVariantFromCLSID(REFCLSID clsid, PROPVARIANT *ppropvar)
+{
+ TRACE("(%s %p)\n", debugstr_guid(clsid), ppropvar);
+
+ ppropvar->u.puuid = CoTaskMemAlloc(sizeof(*ppropvar->u.puuid));
+ if(!ppropvar->u.puuid)
+ return E_OUTOFMEMORY;
+
+ ppropvar->vt = VT_CLSID;
+ memcpy(ppropvar->u.puuid, clsid, sizeof(*ppropvar->u.puuid));
+ return S_OK;
+}
+
HRESULT WINAPI InitVariantFromBuffer(const VOID *pv, UINT cb, VARIANT *pvar)
{
SAFEARRAY *arr;
diff --git a/dlls/propsys/tests/propsys.c b/dlls/propsys/tests/propsys.c
index e899ff9dc4..34c51b382b 100644
--- a/dlls/propsys/tests/propsys.c
+++ b/dlls/propsys/tests/propsys.c
@@ -1230,6 +1230,24 @@ static void test_PropVariantChangeType_LPWSTR(void)
PropVariantClear(&src);
}
+static void test_InitPropVariantFromCLSID(void)
+{
+ PROPVARIANT propvar;
+ GUID clsid;
+ HRESULT hr;
+
+ memset(&propvar, 0, sizeof(propvar));
+ propvar.vt = VT_I4;
+ propvar.u.lVal = 15;
+
+ memset(&clsid, 0xcc, sizeof(clsid));
+ hr = InitPropVariantFromCLSID(&clsid, &propvar);
+ ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+ ok(propvar.vt == VT_CLSID, "Unexpected type %d.\n", propvar.vt);
+ ok(IsEqualGUID(propvar.u.puuid, &clsid), "Unexpected puuid value.\n");
+ PropVariantClear(&propvar);
+}
+
START_TEST(propsys)
{
test_PSStringFromPropertyKey();
@@ -1244,4 +1262,5 @@ START_TEST(propsys)
test_PropVariantChangeType_LPWSTR();
test_PropVariantToBoolean();
test_PropVariantToStringWithDefault();
+ test_InitPropVariantFromCLSID();
}
diff --git a/include/propvarutil.h b/include/propvarutil.h
index ced51ec295..0285cafbb4 100644
--- a/include/propvarutil.h
+++ b/include/propvarutil.h
@@ -64,6 +64,7 @@ HRESULT WINAPI PropVariantChangeType(PROPVARIANT *ppropvarDest, REFPROPVARIANT p
HRESULT WINAPI InitPropVariantFromGUIDAsString(REFGUID guid, PROPVARIANT *ppropvar);
HRESULT WINAPI InitVariantFromGUIDAsString(REFGUID guid, VARIANT *pvar);
HRESULT WINAPI InitPropVariantFromBuffer(const VOID *pv, UINT cb, PROPVARIANT *ppropvar);
+HRESULT WINAPI InitPropVariantFromCLSID(REFCLSID clsid, PROPVARIANT *ppropvar);
HRESULT WINAPI InitVariantFromBuffer(const VOID *pv, UINT cb, VARIANT *pvar);
HRESULT WINAPI PropVariantToGUID(const PROPVARIANT *ppropvar, GUID *guid);
HRESULT WINAPI VariantToGUID(const VARIANT *pvar, GUID *guid);
--
2.18.0
Sept. 16, 2018
[PATCH] comctl32/button: Fix text buffer leak (Coverity).
by Nikolay Sivov
Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com>
---
dlls/comctl32/button.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dlls/comctl32/button.c b/dlls/comctl32/button.c
index 5621fda4f3..56a47302c9 100644
--- a/dlls/comctl32/button.c
+++ b/dlls/comctl32/button.c
@@ -1293,7 +1293,6 @@ static UINT BUTTON_CalcLayoutRects(const BUTTON_INFO *infoPtr, HDC hdc, RECT *la
/* Get text rect */
maxTextWidth = labelRc->right - labelRc->left;
textRect = BUTTON_GetTextRect(infoPtr, hdc, text, maxTextWidth);
- heap_free(text);
/* Show image and text */
if (show_image_and_text(infoPtr))
@@ -1361,6 +1360,7 @@ static UINT BUTTON_CalcLayoutRects(const BUTTON_INFO *infoPtr, HDC hdc, RECT *la
SetRectEmpty(&imageRect);
}
}
+ heap_free(text);
CopyRect(labelRc, &labelRect);
CopyRect(imageRc, &imageRect);
--
2.18.0
Sept. 16, 2018