d2d1: Make use of the available ARRAY_SIZE macro.

Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Michael Stefaniuc 2017-07-07 17:15:14 +02:00 committed by Alexandre Julliard
parent 0c2bbdd95c
commit 6f22d67077
3 changed files with 9 additions and 10 deletions

View File

@ -210,7 +210,7 @@ static BOOL format_supported(const D2D1_PIXEL_FORMAT *format)
{DXGI_FORMAT_B8G8R8A8_UNORM_SRGB, D2D1_ALPHA_MODE_IGNORE },
};
for (i = 0; i < sizeof(supported_formats) / sizeof(*supported_formats); ++i)
for (i = 0; i < ARRAY_SIZE(supported_formats); ++i)
{
if (supported_formats[i].format == format->format
&& supported_formats[i].alphaMode == format->alphaMode)
@ -476,7 +476,7 @@ HRESULT d2d_bitmap_create_from_wic_bitmap(ID2D1Factory *factory, ID3D10Device *d
return hr;
}
for (i = 0, d2d_format = NULL; i < sizeof(format_lookup) / sizeof(*format_lookup); ++i)
for (i = 0, d2d_format = NULL; i < ARRAY_SIZE(format_lookup); ++i)
{
if (IsEqualGUID(&wic_format, format_lookup[i].wic))
{

View File

@ -868,7 +868,7 @@ HRESULT d2d_brush_get_ps_cb(struct d2d_brush *brush, struct d2d_brush *opacity_b
buffer_data.SysMemPitch = 0;
buffer_data.SysMemSlicePitch = 0;
if (brush->type >= sizeof(brush_sizes) / sizeof(*brush_sizes))
if (brush->type >= ARRAY_SIZE(brush_sizes))
{
ERR("Unhandled brush type %#x.\n", brush->type);
return E_NOTIMPL;
@ -877,7 +877,7 @@ HRESULT d2d_brush_get_ps_cb(struct d2d_brush *brush, struct d2d_brush *opacity_b
buffer_desc.ByteWidth = brush_sizes[brush->type];
if (opacity_brush)
{
if (opacity_brush->type >= sizeof(brush_sizes) / sizeof(*brush_sizes))
if (opacity_brush->type >= ARRAY_SIZE(brush_sizes))
{
ERR("Unhandled opacity brush type %#x.\n", opacity_brush->type);
return E_NOTIMPL;

View File

@ -2738,7 +2738,7 @@ static HRESULT d2d_d3d_render_target_init(struct d2d_d3d_render_target *render_t
}
if (FAILED(hr = ID3D10Device_CreateInputLayout(render_target->device, il_desc_outline,
sizeof(il_desc_outline) / sizeof(*il_desc_outline), vs_code_outline, sizeof(vs_code_outline),
ARRAY_SIZE(il_desc_outline), vs_code_outline, sizeof(vs_code_outline),
&render_target->shape_resources[D2D_SHAPE_TYPE_OUTLINE].il)))
{
WARN("Failed to create outline input layout, hr %#x.\n", hr);
@ -2746,7 +2746,7 @@ static HRESULT d2d_d3d_render_target_init(struct d2d_d3d_render_target *render_t
}
if (FAILED(hr = ID3D10Device_CreateInputLayout(render_target->device, il_desc_triangle,
sizeof(il_desc_triangle) / sizeof(*il_desc_triangle), vs_code_triangle, sizeof(vs_code_triangle),
ARRAY_SIZE(il_desc_triangle), vs_code_triangle, sizeof(vs_code_triangle),
&render_target->shape_resources[D2D_SHAPE_TYPE_TRIANGLE].il)))
{
WARN("Failed to create triangle input layout, hr %#x.\n", hr);
@ -2754,8 +2754,7 @@ static HRESULT d2d_d3d_render_target_init(struct d2d_d3d_render_target *render_t
}
if (FAILED(hr = ID3D10Device_CreateInputLayout(render_target->device, il_desc_bezier_outline,
sizeof(il_desc_bezier_outline) / sizeof(*il_desc_bezier_outline),
vs_code_bezier_outline, sizeof(vs_code_bezier_outline),
ARRAY_SIZE(il_desc_bezier_outline), vs_code_bezier_outline, sizeof(vs_code_bezier_outline),
&render_target->shape_resources[D2D_SHAPE_TYPE_BEZIER_OUTLINE].il)))
{
WARN("Failed to create bezier outline input layout, hr %#x.\n", hr);
@ -2763,7 +2762,7 @@ static HRESULT d2d_d3d_render_target_init(struct d2d_d3d_render_target *render_t
}
if (FAILED(hr = ID3D10Device_CreateInputLayout(render_target->device, il_desc_bezier,
sizeof(il_desc_bezier) / sizeof(*il_desc_bezier), vs_code_bezier, sizeof(vs_code_bezier),
ARRAY_SIZE(il_desc_bezier), vs_code_bezier, sizeof(vs_code_bezier),
&render_target->shape_resources[D2D_SHAPE_TYPE_BEZIER].il)))
{
WARN("Failed to create bezier input layout, hr %#x.\n", hr);
@ -2798,7 +2797,7 @@ static HRESULT d2d_d3d_render_target_init(struct d2d_d3d_render_target *render_t
goto err;
}
for (i = 0; i < sizeof(brush_shaders) / sizeof(*brush_shaders); ++i)
for (i = 0; i < ARRAY_SIZE(brush_shaders); ++i)
{
const struct brush_shader *bs = &brush_shaders[i];
if (FAILED(hr = ID3D10Device_CreatePixelShader(render_target->device, bs->byte_code, bs->byte_code_size,