[PATCH 5/5] d2d1: Implement d2d_solid_color_brush_SetOpacity().
Henri Verbeet
hverbeet at codeweavers.com
Thu Nov 6 01:20:17 CST 2014
---
dlls/d2d1/brush.c | 7 ++++++-
dlls/d2d1/d2d1_private.h | 2 ++
dlls/d2d1/render_target.c | 11 +++++++++--
3 files changed, 17 insertions(+), 3 deletions(-)
diff --git a/dlls/d2d1/brush.c b/dlls/d2d1/brush.c
index eacbebb..8837cee 100644
--- a/dlls/d2d1/brush.c
+++ b/dlls/d2d1/brush.c
@@ -149,6 +149,7 @@ static void d2d_brush_init(struct d2d_brush *brush, ID2D1RenderTarget *render_ta
{
brush->ID2D1Brush_iface.lpVtbl = vtbl;
brush->refcount = 1;
+ brush->opacity = desc ? desc->opacity : 1.0f;
brush->type = type;
}
@@ -210,7 +211,11 @@ static void STDMETHODCALLTYPE d2d_solid_color_brush_GetFactory(ID2D1SolidColorBr
static void STDMETHODCALLTYPE d2d_solid_color_brush_SetOpacity(ID2D1SolidColorBrush *iface, float opacity)
{
- FIXME("iface %p, opacity %.8e stub!\n", iface, opacity);
+ struct d2d_brush *brush = impl_from_ID2D1SolidColorBrush(iface);
+
+ TRACE("iface %p, opacity %.8e.\n", iface, opacity);
+
+ brush->opacity = opacity;
}
static void STDMETHODCALLTYPE d2d_solid_color_brush_SetTransform(ID2D1SolidColorBrush *iface,
diff --git a/dlls/d2d1/d2d1_private.h b/dlls/d2d1/d2d1_private.h
index 0a99633..8504e68 100644
--- a/dlls/d2d1/d2d1_private.h
+++ b/dlls/d2d1/d2d1_private.h
@@ -107,6 +107,8 @@ struct d2d_brush
ID2D1Brush ID2D1Brush_iface;
LONG refcount;
+ float opacity;
+
enum d2d_brush_type type;
union
{
diff --git a/dlls/d2d1/render_target.c b/dlls/d2d1/render_target.c
index 1dd5122..0f5907f 100644
--- a/dlls/d2d1/render_target.c
+++ b/dlls/d2d1/render_target.c
@@ -501,6 +501,7 @@ static void STDMETHODCALLTYPE d2d_d3d_render_target_FillRectangle(ID2D1RenderTar
D3D10_SUBRESOURCE_DATA buffer_data;
D3D10_BUFFER_DESC buffer_desc;
ID3D10Buffer *vs_cb, *ps_cb;
+ D2D1_COLOR_F color;
float tmp_x, tmp_y;
HRESULT hr;
struct
@@ -558,8 +559,14 @@ static void STDMETHODCALLTYPE d2d_d3d_render_target_FillRectangle(ID2D1RenderTar
return;
}
- buffer_desc.ByteWidth = sizeof(brush_impl->u.solid.color);
- buffer_data.pSysMem = &brush_impl->u.solid.color;
+ color = brush_impl->u.solid.color;
+ color.r *= brush_impl->opacity;
+ color.g *= brush_impl->opacity;
+ color.b *= brush_impl->opacity;
+ color.a *= brush_impl->opacity;
+
+ buffer_desc.ByteWidth = sizeof(color);
+ buffer_data.pSysMem = &color;
if (FAILED(hr = ID3D10Device_CreateBuffer(render_target->device, &buffer_desc, &buffer_data, &ps_cb)))
{
--
1.7.10.4
More information about the wine-patches
mailing list