mirror of
git://source.winehq.org/git/wine.git
synced 2024-09-02 09:03:38 +00:00
d2d1/commandlist: Implement FillOpacityMask() command.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
This commit is contained in:
parent
4f1dfdad1d
commit
7cfe6d8f29
|
@ -41,6 +41,7 @@ enum d2d_command_type
|
|||
D2D_COMMAND_DRAW_RECTANGLE,
|
||||
D2D_COMMAND_DRAW_BITMAP,
|
||||
D2D_COMMAND_FILL_MESH,
|
||||
D2D_COMMAND_FILL_OPACITY_MASK,
|
||||
D2D_COMMAND_FILL_GEOMETRY,
|
||||
D2D_COMMAND_FILL_RECTANGLE,
|
||||
D2D_COMMAND_PUSH_CLIP,
|
||||
|
@ -142,6 +143,15 @@ struct d2d_command_fill_mesh
|
|||
ID2D1Brush *brush;
|
||||
};
|
||||
|
||||
struct d2d_command_fill_opacity_mask
|
||||
{
|
||||
struct d2d_command c;
|
||||
ID2D1Bitmap *bitmap;
|
||||
ID2D1Brush *brush;
|
||||
D2D1_RECT_F *dst_rect;
|
||||
D2D1_RECT_F *src_rect;
|
||||
};
|
||||
|
||||
struct d2d_command_fill_geometry
|
||||
{
|
||||
struct d2d_command c;
|
||||
|
@ -383,6 +393,12 @@ static HRESULT STDMETHODCALLTYPE d2d_command_list_Stream(ID2D1CommandList *iface
|
|||
hr = ID2D1CommandSink_FillMesh(sink, c->mesh, c->brush);
|
||||
break;
|
||||
}
|
||||
case D2D_COMMAND_FILL_OPACITY_MASK:
|
||||
{
|
||||
const struct d2d_command_fill_opacity_mask *c = data;
|
||||
hr = ID2D1CommandSink_FillOpacityMask(sink, c->bitmap, c->brush, c->dst_rect, c->src_rect);
|
||||
break;
|
||||
}
|
||||
case D2D_COMMAND_FILL_GEOMETRY:
|
||||
{
|
||||
const struct d2d_command_fill_geometry *c = data;
|
||||
|
@ -960,3 +976,34 @@ void d2d_command_list_fill_mesh(struct d2d_command_list *command_list, const str
|
|||
command->mesh = mesh;
|
||||
command->brush = brush;
|
||||
}
|
||||
|
||||
void d2d_command_list_fill_opacity_mask(struct d2d_command_list *command_list, const struct d2d_device_context *context,
|
||||
ID2D1Bitmap *bitmap, ID2D1Brush *orig_brush, const D2D1_RECT_F *dst_rect, const D2D1_RECT_F *src_rect)
|
||||
{
|
||||
struct d2d_command_fill_opacity_mask *command;
|
||||
ID2D1Brush *brush;
|
||||
size_t size;
|
||||
BYTE *data;
|
||||
|
||||
if (FAILED(d2d_command_list_create_brush(command_list, context, orig_brush, &brush)))
|
||||
{
|
||||
command_list->state = D2D_COMMAND_LIST_STATE_ERROR;
|
||||
return;
|
||||
}
|
||||
|
||||
size = sizeof(*command);
|
||||
if (dst_rect) size += sizeof(*dst_rect);
|
||||
if (src_rect) size += sizeof(*src_rect);
|
||||
|
||||
d2d_command_list_reference_object(command_list, bitmap);
|
||||
|
||||
command = d2d_command_list_require_space(command_list, size);
|
||||
command->c.op = D2D_COMMAND_FILL_OPACITY_MASK;
|
||||
command->bitmap = bitmap;
|
||||
command->brush = brush;
|
||||
|
||||
data = (BYTE *)(command + 1);
|
||||
|
||||
d2d_command_list_write_field(&data, &command->dst_rect, dst_rect, sizeof(*dst_rect));
|
||||
d2d_command_list_write_field(&data, &command->src_rect, src_rect, sizeof(*src_rect));
|
||||
}
|
||||
|
|
|
@ -771,6 +771,8 @@ void d2d_command_list_draw_bitmap(struct d2d_command_list *command_list, ID2D1Bi
|
|||
const D2D1_RECT_F *src_rect, const D2D1_MATRIX_4X4_F *perspective_transform) DECLSPEC_HIDDEN;
|
||||
void d2d_command_list_fill_mesh(struct d2d_command_list *command_list, const struct d2d_device_context *context,
|
||||
ID2D1Mesh *mesh, ID2D1Brush *orig_brush) DECLSPEC_HIDDEN;
|
||||
void d2d_command_list_fill_opacity_mask(struct d2d_command_list *command_list, const struct d2d_device_context *context,
|
||||
ID2D1Bitmap *bitmap, ID2D1Brush *orig_brush, const D2D1_RECT_F *dst_rect, const D2D1_RECT_F *src_rect) DECLSPEC_HIDDEN;
|
||||
|
||||
static inline BOOL d2d_array_reserve(void **elements, size_t *capacity, size_t count, size_t size)
|
||||
{
|
||||
|
|
|
@ -1115,6 +1115,9 @@ static void STDMETHODCALLTYPE d2d_device_context_FillOpacityMask(ID2D1DeviceCont
|
|||
d2d_device_context_set_error(context, E_INVALIDARG);
|
||||
return;
|
||||
}
|
||||
|
||||
if (context->target.type == D2D_TARGET_COMMAND_LIST)
|
||||
d2d_command_list_fill_opacity_mask(context->target.command_list, context, mask, brush, dst_rect, src_rect);
|
||||
}
|
||||
|
||||
static void d2d_device_context_draw_bitmap(struct d2d_device_context *context, ID2D1Bitmap *bitmap,
|
||||
|
@ -2614,6 +2617,9 @@ static void STDMETHODCALLTYPE d2d_device_context_ID2D1DeviceContext_FillOpacityM
|
|||
d2d_device_context_set_error(context, D2DERR_WRONG_STATE);
|
||||
return;
|
||||
}
|
||||
|
||||
if (context->target.type == D2D_TARGET_COMMAND_LIST)
|
||||
d2d_command_list_fill_opacity_mask(context->target.command_list, context, mask, brush, dst_rect, src_rect);
|
||||
}
|
||||
|
||||
static HRESULT STDMETHODCALLTYPE d2d_device_context_CreateFilledGeometryRealization(ID2D1DeviceContext1 *iface,
|
||||
|
|
Loading…
Reference in a new issue