[PATCH 1/2] d2d1: Reset bitmap brush sampler state only if parameters have changed.
Nikolay Sivov
nsivov at codeweavers.com
Mon Jun 7 05:36:21 CDT 2021
Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
---
dlls/d2d1/brush.c | 37 +++++++++++++++++++++----------------
1 file changed, 21 insertions(+), 16 deletions(-)
diff --git a/dlls/d2d1/brush.c b/dlls/d2d1/brush.c
index 07d2e26a143..496a399aa6e 100644
--- a/dlls/d2d1/brush.c
+++ b/dlls/d2d1/brush.c
@@ -818,6 +818,15 @@ static inline struct d2d_brush *impl_from_ID2D1BitmapBrush1(ID2D1BitmapBrush1 *i
return CONTAINING_RECORD(iface, struct d2d_brush, ID2D1Brush_iface);
}
+static void d2d_bitmap_brush_reset_sampler_state(struct d2d_brush *brush)
+{
+ if (brush->u.bitmap.sampler_state)
+ {
+ ID3D10SamplerState_Release(brush->u.bitmap.sampler_state);
+ brush->u.bitmap.sampler_state = NULL;
+ }
+}
+
static HRESULT STDMETHODCALLTYPE d2d_bitmap_brush_QueryInterface(ID2D1BitmapBrush1 *iface,
REFIID iid, void **out)
{
@@ -923,11 +932,10 @@ static void STDMETHODCALLTYPE d2d_bitmap_brush_SetExtendModeX(ID2D1BitmapBrush1
TRACE("iface %p, mode %#x.\n", iface, mode);
- brush->u.bitmap.extend_mode_x = mode;
- if (brush->u.bitmap.sampler_state)
+ if (brush->u.bitmap.extend_mode_x != mode)
{
- ID3D10SamplerState_Release(brush->u.bitmap.sampler_state);
- brush->u.bitmap.sampler_state = NULL;
+ brush->u.bitmap.extend_mode_x = mode;
+ d2d_bitmap_brush_reset_sampler_state(brush);
}
}
@@ -937,11 +945,10 @@ static void STDMETHODCALLTYPE d2d_bitmap_brush_SetExtendModeY(ID2D1BitmapBrush1
TRACE("iface %p, mode %#x.\n", iface, mode);
- brush->u.bitmap.extend_mode_y = mode;
- if (brush->u.bitmap.sampler_state)
+ if (brush->u.bitmap.extend_mode_y != mode)
{
- ID3D10SamplerState_Release(brush->u.bitmap.sampler_state);
- brush->u.bitmap.sampler_state = NULL;
+ brush->u.bitmap.extend_mode_y = mode;
+ d2d_bitmap_brush_reset_sampler_state(brush);
}
}
@@ -962,11 +969,10 @@ static void STDMETHODCALLTYPE d2d_bitmap_brush_SetInterpolationMode(ID2D1BitmapB
return;
}
- brush->u.bitmap.interpolation_mode = d2d1_1_interp_mode_from_d2d1(mode);
- if (brush->u.bitmap.sampler_state)
+ if (brush->u.bitmap.interpolation_mode != d2d1_1_interp_mode_from_d2d1(mode))
{
- ID3D10SamplerState_Release(brush->u.bitmap.sampler_state);
- brush->u.bitmap.sampler_state = NULL;
+ brush->u.bitmap.interpolation_mode = d2d1_1_interp_mode_from_d2d1(mode);
+ d2d_bitmap_brush_reset_sampler_state(brush);
}
}
@@ -1050,11 +1056,10 @@ static void STDMETHODCALLTYPE d2d_bitmap_brush_SetInterpolationMode1(ID2D1Bitmap
return;
}
- brush->u.bitmap.interpolation_mode = mode;
- if (brush->u.bitmap.sampler_state)
+ if (brush->u.bitmap.interpolation_mode != mode)
{
- ID3D10SamplerState_Release(brush->u.bitmap.sampler_state);
- brush->u.bitmap.sampler_state = NULL;
+ brush->u.bitmap.interpolation_mode = mode;
+ d2d_bitmap_brush_reset_sampler_state(brush);
}
}
--
2.30.2
More information about the wine-devel
mailing list