mirror of
git://source.winehq.org/git/wine.git
synced 2024-09-02 09:53:37 +00:00
d2d1/commandlist: Implement DrawBitmap() command.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
This commit is contained in:
parent
40e353a6a6
commit
da9eabd64d
|
@ -34,6 +34,7 @@ enum d2d_command_type
|
|||
D2D_COMMAND_DRAW_LINE,
|
||||
D2D_COMMAND_DRAW_GEOMETRY,
|
||||
D2D_COMMAND_DRAW_RECTANGLE,
|
||||
D2D_COMMAND_DRAW_BITMAP,
|
||||
D2D_COMMAND_FILL_GEOMETRY,
|
||||
D2D_COMMAND_FILL_RECTANGLE,
|
||||
D2D_COMMAND_PUSH_CLIP,
|
||||
|
@ -153,6 +154,17 @@ struct d2d_command_draw_glyph_run
|
|||
DWRITE_GLYPH_RUN_DESCRIPTION *run_desc;
|
||||
};
|
||||
|
||||
struct d2d_command_draw_bitmap
|
||||
{
|
||||
struct d2d_command c;
|
||||
float opacity;
|
||||
D2D1_INTERPOLATION_MODE interpolation_mode;
|
||||
ID2D1Bitmap *bitmap;
|
||||
D2D1_RECT_F *dst_rect;
|
||||
D2D1_RECT_F *src_rect;
|
||||
D2D1_MATRIX_4X4_F *perspective_transform;
|
||||
};
|
||||
|
||||
static inline struct d2d_command_list *impl_from_ID2D1CommandList(ID2D1CommandList *iface)
|
||||
{
|
||||
return CONTAINING_RECORD(iface, struct d2d_command_list, ID2D1CommandList_iface);
|
||||
|
@ -314,6 +326,13 @@ static HRESULT STDMETHODCALLTYPE d2d_command_list_Stream(ID2D1CommandList *iface
|
|||
c->stroke_style);
|
||||
break;
|
||||
}
|
||||
case D2D_COMMAND_DRAW_BITMAP:
|
||||
{
|
||||
const struct d2d_command_draw_bitmap *c = data;
|
||||
hr = ID2D1CommandSink_DrawBitmap(sink, c->bitmap, c->dst_rect, c->opacity,
|
||||
c->interpolation_mode, c->src_rect, c->perspective_transform);
|
||||
break;
|
||||
}
|
||||
case D2D_COMMAND_FILL_GEOMETRY:
|
||||
{
|
||||
const struct d2d_command_fill_geometry *c = data;
|
||||
|
@ -819,3 +838,31 @@ void d2d_command_list_draw_glyph_run(struct d2d_command_list *command_list,
|
|||
command->origin = origin;
|
||||
command->measuring_mode = measuring_mode;
|
||||
}
|
||||
|
||||
void d2d_command_list_draw_bitmap(struct d2d_command_list *command_list, ID2D1Bitmap *bitmap,
|
||||
const D2D1_RECT_F *dst_rect, float opacity, D2D1_INTERPOLATION_MODE interpolation_mode,
|
||||
const D2D1_RECT_F *src_rect, const D2D1_MATRIX_4X4_F *perspective_transform)
|
||||
{
|
||||
struct d2d_command_draw_bitmap *command;
|
||||
size_t size;
|
||||
BYTE *data;
|
||||
|
||||
size = sizeof(*command);
|
||||
if (dst_rect) size += sizeof(*dst_rect);
|
||||
if (src_rect) size += sizeof(*src_rect);
|
||||
if (perspective_transform) size += sizeof(*perspective_transform);
|
||||
|
||||
d2d_command_list_reference_object(command_list, bitmap);
|
||||
|
||||
command = d2d_command_list_require_space(command_list, size);
|
||||
command->c.op = D2D_COMMAND_DRAW_BITMAP;
|
||||
command->bitmap = bitmap;
|
||||
command->opacity = opacity;
|
||||
command->interpolation_mode = interpolation_mode;
|
||||
|
||||
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));
|
||||
d2d_command_list_write_field(&data, &command->perspective_transform, perspective_transform, sizeof(*perspective_transform));
|
||||
}
|
||||
|
|
|
@ -765,6 +765,9 @@ void d2d_command_list_draw_glyph_run(struct d2d_command_list *command_list,
|
|||
const struct d2d_device_context *context, D2D1_POINT_2F origin, const DWRITE_GLYPH_RUN *run,
|
||||
const DWRITE_GLYPH_RUN_DESCRIPTION *run_desc, ID2D1Brush *orig_brush,
|
||||
DWRITE_MEASURING_MODE measuring_mode) DECLSPEC_HIDDEN;
|
||||
void d2d_command_list_draw_bitmap(struct d2d_command_list *command_list, ID2D1Bitmap *bitmap,
|
||||
const D2D1_RECT_F *dst_rect, float opacity, D2D1_INTERPOLATION_MODE interpolation_mode,
|
||||
const D2D1_RECT_F *src_rect, const D2D1_MATRIX_4X4_F *perspective_transform) DECLSPEC_HIDDEN;
|
||||
|
||||
static inline BOOL d2d_array_reserve(void **elements, size_t *capacity, size_t count, size_t size)
|
||||
{
|
||||
|
|
|
@ -1181,12 +1181,14 @@ static void STDMETHODCALLTYPE d2d_device_context_DrawBitmap(ID2D1DeviceContext1
|
|||
|
||||
if (context->target.type == D2D_TARGET_COMMAND_LIST)
|
||||
{
|
||||
FIXME("Unimplemented for command list target.\n");
|
||||
return;
|
||||
d2d_command_list_draw_bitmap(context->target.command_list, bitmap, dst_rect, opacity,
|
||||
d2d1_1_interp_mode_from_d2d1(interpolation_mode), src_rect, NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
d2d_device_context_draw_bitmap(context, bitmap, dst_rect, opacity,
|
||||
d2d1_1_interp_mode_from_d2d1(interpolation_mode), src_rect, NULL, NULL);
|
||||
}
|
||||
|
||||
d2d_device_context_draw_bitmap(context, bitmap, dst_rect, opacity, d2d1_1_interp_mode_from_d2d1(interpolation_mode),
|
||||
src_rect, NULL, NULL);
|
||||
}
|
||||
|
||||
static void STDMETHODCALLTYPE d2d_device_context_DrawText(ID2D1DeviceContext1 *iface,
|
||||
|
@ -2498,12 +2500,14 @@ static void STDMETHODCALLTYPE d2d_device_context_ID2D1DeviceContext_DrawBitmap(I
|
|||
|
||||
if (context->target.type == D2D_TARGET_COMMAND_LIST)
|
||||
{
|
||||
FIXME("Unimplemented for command list target.\n");
|
||||
return;
|
||||
d2d_command_list_draw_bitmap(context->target.command_list, bitmap, dst_rect, opacity, interpolation_mode,
|
||||
src_rect, perspective_transform);
|
||||
}
|
||||
else
|
||||
{
|
||||
d2d_device_context_draw_bitmap(context, bitmap, dst_rect, opacity, interpolation_mode, src_rect,
|
||||
NULL, perspective_transform);
|
||||
}
|
||||
|
||||
d2d_device_context_draw_bitmap(context, bitmap, dst_rect, opacity, interpolation_mode, src_rect,
|
||||
NULL, perspective_transform);
|
||||
}
|
||||
|
||||
static void STDMETHODCALLTYPE d2d_device_context_ID2D1DeviceContext_PushLayer(ID2D1DeviceContext1 *iface,
|
||||
|
|
|
@ -9501,7 +9501,6 @@ static void test_command_list(BOOL d3d11)
|
|||
ID2D1RenderTarget_DrawBitmap(rt, bitmap, NULL, 0.25f, D2D1_BITMAP_INTERPOLATION_MODE_NEAREST_NEIGHBOR, NULL);
|
||||
|
||||
refcount = ID2D1Bitmap_Release(bitmap);
|
||||
todo_wine
|
||||
ok(refcount == 1, "Got unexpected refcount %lu.\n", refcount);
|
||||
|
||||
/* Solid color brush. */
|
||||
|
|
Loading…
Reference in a new issue