ReactOS 0.4.17-dev-970-gcf0f1a6
d2d1.c File Reference
#include <limits.h>
#include <math.h>
#include <float.h>
#include <stdint.h>
#include "d3dcompiler.h"
#include "d2d1_3.h"
#include "d2d1effectauthor.h"
#include "d3d11.h"
#include "wincrypt.h"
#include "wine/test.h"
#include "initguid.h"
#include "dwrite.h"
#include "wincodec.h"
Include dependency graph for d2d1.c:

Go to the source code of this file.

Classes

struct  test_entry
 
struct  d2d1_test_context
 
struct  resource_readback
 
struct  figure
 
struct  geometry_sink
 
struct  geometry_sink::geometry_figure
 
struct  geometry_sink::geometry_figure::geometry_segment
 
struct  expected_geometry_figure
 
struct  effect_impl
 

Macros

#define COBJMACROS
 
#define check_interface(a, b, c)   check_interface_(__LINE__, a, b, c)
 
#define release_test_context(ctx)   release_test_context_(__LINE__, ctx)
 
#define init_test_context(ctx, d3d11)   init_test_context_(__LINE__, ctx, d3d11, D2D1_FACTORY_TYPE_SINGLE_THREADED)
 
#define init_test_multithreaded_context(ctx, d3d11)   init_test_context_(__LINE__, ctx, d3d11, D2D1_FACTORY_TYPE_MULTI_THREADED)
 
#define check_bitmap_options(b, o)   check_bitmap_options_(__LINE__, b, o)
 
#define check_bitmap_surface(b, s, o)   check_bitmap_surface_(__LINE__, b, s, o)
 
#define geometry_sink_check(a, b, c, d, e)   geometry_sink_check_(__LINE__, a, b, c, d, e)
 
#define test_compatible_target_size(r)   test_compatible_target_size_(__LINE__, r)
 
#define check_rt_bitmap_surface(r, s, o)   check_rt_bitmap_surface_(__LINE__, r, s, o)
 
#define check_system_properties(effect)   check_system_properties_(__LINE__, effect)
 
#define check_zero_buffer(a, b)   check_zero_buffer_(a, b, __LINE__)
 
#define check_blend_desc(blend_desc, expected)   check_blend_desc_(__LINE__, blend_desc, expected)
 

Functions

 DEFINE_GUID (CLSID_TestEffect, 0xb9ee12e9, 0x32d9, 0xe659, 0xac, 0x61, 0x2d, 0x7c, 0xea, 0x69, 0x28, 0x78)
 
 DEFINE_GUID (CLSID_TestEffect2, 0xb9ee12e9, 0x32d9, 0xe659, 0xac, 0x61, 0x2d, 0x7c, 0xea, 0x69, 0x28, 0x79)
 
 DEFINE_GUID (CLSID_AuxEffect, 0xb9ee12e9, 0x32d9, 0xe659, 0xac, 0x61, 0x2d, 0x7c, 0xea, 0x69, 0x28, 0x79)
 
 DEFINE_GUID (GUID_TestVertexShader, 0x5bcdcfae, 0x1e92, 0x4dc1, 0x94, 0xfa, 0x3b, 0x01, 0xca, 0x54, 0x59, 0x20)
 
 DEFINE_GUID (GUID_TestPixelShader, 0x53015748, 0xfc13, 0x4168, 0xbd, 0x13, 0x0f, 0xcf, 0x15, 0x29, 0x7f, 0x01)
 
 DEFINE_GUID (GUID_CustomVertexBuffer, 0x53015748, 0xfc13, 0x4168, 0xbd, 0x13, 0x0f, 0xcf, 0x15, 0x29, 0x7f, 0x02)
 
static ULONG get_refcount (void *iface)
 
static void check_interface_ (unsigned int line, void *iface_ptr, REFIID iid, BOOL supported)
 
static HRESULT (WINAPI *pD2D1CreateDevice)(IDXGIDevice *dxgi_device
 
static void (WINAPI *pD2D1SinCos)(float angle
 
static float (WINAPI *pD2D1Tan)(float angle)
 
static D2D1_COLOR_F (WINAPI *pD2D1ConvertColorSpace)(D2D1_COLOR_SPACE src_colour_space
 
static void queue_d3d1x_test (void(*test)(BOOL d3d11), BOOL d3d11)
 
static void queue_d3d10_test (void(*test)(BOOL d3d11))
 
static void queue_test (void(*test)(BOOL d3d11))
 
static DWORD WINAPI thread_func (void *ctx)
 
static void run_queued_tests (void)
 
static void set_point (D2D1_POINT_2F *point, float x, float y)
 
static void set_quadratic (D2D1_QUADRATIC_BEZIER_SEGMENT *quadratic, float x1, float y1, float x2, float y2)
 
static void set_rect (D2D1_RECT_F *rect, float left, float top, float right, float bottom)
 
static void set_vec4 (D2D_VECTOR_4F *vec, float x, float y, float z, float w)
 
static void set_rounded_rect (D2D1_ROUNDED_RECT *rect, float left, float top, float right, float bottom, float radius_x, float radius_y)
 
static void set_rect_u (D2D1_RECT_U *rect, UINT32 left, UINT32 top, UINT32 right, UINT32 bottom)
 
static void set_rect_l (D2D1_RECT_L *rect, LONG left, LONG top, LONG right, LONG bottom)
 
static void set_ellipse (D2D1_ELLIPSE *ellipse, float x, float y, float rx, float ry)
 
static void set_color (D2D1_COLOR_F *color, float r, float g, float b, float a)
 
static void set_size_u (D2D1_SIZE_U *size, unsigned int w, unsigned int h)
 
static void set_size_f (D2D1_SIZE_F *size, float w, float h)
 
static void set_matrix_identity (D2D1_MATRIX_3X2_F *matrix)
 
static void rotate_matrix (D2D1_MATRIX_3X2_F *matrix, float theta)
 
static void skew_matrix (D2D1_MATRIX_3X2_F *matrix, float x, float y)
 
static void scale_matrix (D2D1_MATRIX_3X2_F *matrix, float x, float y)
 
static void translate_matrix (D2D1_MATRIX_3X2_F *matrix, float x, float y)
 
static void line_to (ID2D1GeometrySink *sink, float x, float y)
 
static void quadratic_to (ID2D1GeometrySink *sink, float x1, float y1, float x2, float y2)
 
static void cubic_to (ID2D1GeometrySink *sink, float x1, float y1, float x2, float y2, float x3, float y3)
 
static void get_d3d10_surface_readback (IDXGISurface *surface, struct resource_readback *rb)
 
static void get_d3d11_surface_readback (IDXGISurface *surface, struct resource_readback *rb)
 
static void get_surface_readback (struct d2d1_test_context *ctx, struct resource_readback *rb)
 
static void release_d3d10_resource_readback (struct resource_readback *rb)
 
static void release_d3d11_resource_readback (struct resource_readback *rb)
 
static void release_resource_readback (struct resource_readback *rb)
 
static DWORD get_readback_colour (struct resource_readback *rb, unsigned int x, unsigned int y)
 
static float clamp_float (float f, float lower, float upper)
 
static BOOL compare_uint (unsigned int x, unsigned int y, unsigned int max_diff)
 
static BOOL compare_colour (DWORD c1, DWORD c2, BYTE max_diff)
 
static BOOL compare_float (float f, float g, unsigned int ulps)
 
static BOOL compare_colour_f (const D2D1_COLOR_F *colour, float r, float g, float b, float a, unsigned int ulps)
 
static BOOL compare_point (const D2D1_POINT_2F *point, float x, float y, unsigned int ulps)
 
static BOOL compare_rect (const D2D1_RECT_F *rect, float left, float top, float right, float bottom, unsigned int ulps)
 
static BOOL compare_bezier_segment (const D2D1_BEZIER_SEGMENT *b, float x1, float y1, float x2, float y2, float x3, float y3, unsigned int ulps)
 
static BOOL compare_sha1 (void *data, unsigned int pitch, unsigned int bpp, unsigned int w, unsigned int h, const char *ref_sha1)
 
static BOOL compare_surface (struct d2d1_test_context *ctx, const char *ref_sha1)
 
static BOOL compare_wic_bitmap (IWICBitmap *bitmap, const char *ref_sha1)
 
static void serialize_figure (struct figure *figure)
 
static void figure_add_span (struct figure *figure, unsigned int span)
 
static void deserialize_span (struct figure *figure, unsigned int *current, unsigned int *shift, unsigned int c)
 
static void deserialize_figure (struct figure *figure, const BYTE *s)
 
static void read_figure (struct figure *figure, BYTE *data, unsigned int pitch, unsigned int x, unsigned int y, unsigned int w, unsigned int h, DWORD prev)
 
static BOOL compare_figure (struct d2d1_test_context *ctx, unsigned int x, unsigned int y, unsigned int w, unsigned int h, DWORD prev, unsigned int max_diff, const char *ref)
 
static ID3D10Device1 * create_d3d10_device (void)
 
static ID3D11Device * create_d3d11_device (void)
 
static IDXGIDevice * create_device (BOOL d3d11)
 
static HWND create_window (void)
 
static IDXGISwapChain * create_swapchain (IDXGIDevice *device, HWND window, BOOL windowed)
 
static IDXGISwapChain * create_d3d10_swapchain (ID3D10Device1 *device, HWND window, BOOL windowed)
 
static ID2D1RenderTarget * create_render_target_desc (IDXGISurface *surface, const D2D1_RENDER_TARGET_PROPERTIES *desc, BOOL d3d11, D2D1_FACTORY_TYPE factory_type)
 
static ID2D1RenderTarget * create_render_target (IDXGISurface *surface, BOOL d3d11, D2D1_FACTORY_TYPE factory_type)
 
static void release_test_context_ (unsigned int line, struct d2d1_test_context *ctx)
 
static BOOL init_test_context_ (unsigned int line, struct d2d1_test_context *ctx, BOOL d3d11, D2D1_FACTORY_TYPE factory_type)
 
static void check_bitmap_options_ (unsigned int line, ID2D1Bitmap *bitmap, DWORD expected_options)
 
static void check_bitmap_surface_ (unsigned int line, ID2D1Bitmap *bitmap, BOOL has_surface, DWORD expected_options)
 
static struct geometry_sink * impl_from_ID2D1SimplifiedGeometrySink (ID2D1SimplifiedGeometrySink *iface)
 
static HRESULT STDMETHODCALLTYPE geometry_sink_QueryInterface (ID2D1SimplifiedGeometrySink *iface, REFIID iid, void **out)
 
static ULONG STDMETHODCALLTYPE geometry_sink_AddRef (ID2D1SimplifiedGeometrySink *iface)
 
static ULONG STDMETHODCALLTYPE geometry_sink_Release (ID2D1SimplifiedGeometrySink *iface)
 
static void STDMETHODCALLTYPE geometry_sink_SetFillMode (ID2D1SimplifiedGeometrySink *iface, D2D1_FILL_MODE mode)
 
static void STDMETHODCALLTYPE geometry_sink_SetSegmentFlags (ID2D1SimplifiedGeometrySink *iface, D2D1_PATH_SEGMENT flags)
 
static void STDMETHODCALLTYPE geometry_sink_BeginFigure (ID2D1SimplifiedGeometrySink *iface, D2D1_POINT_2F start_point, D2D1_FIGURE_BEGIN figure_begin)
 
static struct geometry_segment * geometry_figure_add_segment (struct geometry_figure *figure)
 
static void STDMETHODCALLTYPE geometry_sink_AddLines (ID2D1SimplifiedGeometrySink *iface, const D2D1_POINT_2F *points, UINT32 count)
 
static void STDMETHODCALLTYPE geometry_sink_AddBeziers (ID2D1SimplifiedGeometrySink *iface, const D2D1_BEZIER_SEGMENT *beziers, UINT32 count)
 
static void STDMETHODCALLTYPE geometry_sink_EndFigure (ID2D1SimplifiedGeometrySink *iface, D2D1_FIGURE_END figure_end)
 
static HRESULT STDMETHODCALLTYPE geometry_sink_Close (ID2D1SimplifiedGeometrySink *iface)
 
static void geometry_sink_init (struct geometry_sink *sink)
 
static void geometry_sink_cleanup (struct geometry_sink *sink)
 
static void geometry_sink_check_ (unsigned int line, const struct geometry_sink *sink, D2D1_FILL_MODE fill_mode, unsigned int figure_count, const struct expected_geometry_figure *expected_figures, unsigned int ulps)
 
static void test_clip (BOOL d3d11)
 
static void test_state_block (BOOL d3d11)
 
static void test_color_brush (BOOL d3d11)
 
static void test_bitmap_brush (BOOL d3d11)
 
static void test_image_brush (BOOL d3d11)
 
static void test_linear_brush (BOOL d3d11)
 
static void test_radial_brush (BOOL d3d11)
 
static void fill_geometry_sink (ID2D1GeometrySink *sink, unsigned int hollow_count)
 
static void fill_geometry_sink_bezier (ID2D1GeometrySink *sink, unsigned int hollow_count)
 
static void test_path_geometry (BOOL d3d11)
 
static void test_rectangle_geometry (BOOL d3d11)
 
static void test_rounded_rectangle_geometry (BOOL d3d11)
 
static void test_bitmap_formats (BOOL d3d11)
 
static void test_alpha_mode (BOOL d3d11)
 
static void test_shared_bitmap (BOOL d3d11)
 
static void test_bitmap_updates (BOOL d3d11)
 
static void test_opacity_brush (BOOL d3d11)
 
static void test_create_target (BOOL d3d11)
 
static void test_draw_text_layout (BOOL d3d11)
 
static void create_target_dibsection (HDC hdc, UINT32 width, UINT32 height)
 
static void test_dc_target (BOOL d3d11)
 
static void test_dc_target_gdi_interop (BOOL d3d11)
 
static void test_hwnd_target (BOOL d3d11)
 
static void test_hwnd_target_gdi_interop (BOOL d3d11)
 
static IDXGISurface * create_surface (IDXGIDevice *dxgi_device, unsigned int width, unsigned int height, unsigned int bind_flags, unsigned int misc_flags, DXGI_FORMAT format)
 
static void test_dxgi_surface_target_gdi_interop (BOOL d3d11)
 
static void test_compatible_target_size_ (unsigned int line, ID2D1RenderTarget *rt)
 
static void test_bitmap_target (BOOL d3d11)
 
static void test_desktop_dpi (BOOL d3d11)
 
static void test_stroke_style (BOOL d3d11)
 
static void test_gradient (BOOL d3d11)
 
static void test_draw_geometry (BOOL d3d11)
 
static void test_fill_geometry (BOOL d3d11)
 
static void test_wic_gdi_interop (BOOL d3d11)
 
static void test_layer (BOOL d3d11)
 
static void test_bezier_intersect (BOOL d3d11)
 
static void test_create_device (BOOL d3d11)
 
static void check_rt_bitmap_surface_ (unsigned int line, ID2D1RenderTarget *rt, BOOL has_surface, DWORD options)
 
static void test_bitmap_surface (BOOL d3d11)
 
static void test_device_context (BOOL d3d11)
 
static void test_invert_matrix (BOOL d3d11)
 
static void test_skew_matrix (BOOL d3d11)
 
static ID2D1DeviceContext * create_device_context (ID2D1Factory1 *factory, IDXGIDevice *dxgi_device, BOOL d3d11)
 
static void test_command_list (BOOL d3d11)
 
static void test_max_bitmap_size (BOOL d3d11)
 
static void test_dpi (BOOL d3d11)
 
static void test_unit_mode (BOOL d3d11)
 
static void test_wic_bitmap_format (BOOL d3d11)
 
static void test_math (BOOL d3d11)
 
static void test_colour_space (BOOL d3d11)
 
static void test_geometry_group (BOOL d3d11)
 
static DWORD WINAPI mt_factory_test_thread_func (void *param)
 
static DWORD WINAPI mt_factory_test_thread_draw_func (void *param)
 
static void test_mt_factory (BOOL d3d11)
 
static void check_system_properties_ (unsigned int line, ID2D1Effect *effect)
 
static void test_builtin_effect (BOOL d3d11)
 
static struct effect_impl * impl_from_ID2D1EffectImpl (ID2D1EffectImpl *iface)
 
static struct effect_impl * impl_from_ID2D1DrawTransform (ID2D1DrawTransform *iface)
 
static HRESULT STDMETHODCALLTYPE effect_impl_QueryInterface (ID2D1EffectImpl *iface, REFIID iid, void **out)
 
static ULONG STDMETHODCALLTYPE effect_impl_AddRef (ID2D1EffectImpl *iface)
 
static ULONG STDMETHODCALLTYPE effect_impl_Release (ID2D1EffectImpl *iface)
 
static HRESULT STDMETHODCALLTYPE effect_impl_Initialize (ID2D1EffectImpl *iface, ID2D1EffectContext *context, ID2D1TransformGraph *graph)
 
static HRESULT STDMETHODCALLTYPE effect_impl_PrepareForRender (ID2D1EffectImpl *iface, D2D1_CHANGE_TYPE type)
 
static HRESULT STDMETHODCALLTYPE effect_impl_SetGraph (ID2D1EffectImpl *iface, ID2D1TransformGraph *graph)
 
static HRESULT STDMETHODCALLTYPE effect_impl_create (IUnknown **effect_impl)
 
static HRESULT STDMETHODCALLTYPE effect_impl_set_integer (IUnknown *iface, const BYTE *data, UINT32 data_size)
 
static HRESULT STDMETHODCALLTYPE effect_impl_get_integer (const IUnknown *iface, BYTE *data, UINT32 data_size, UINT32 *actual_size)
 
static HRESULT STDMETHODCALLTYPE effect_impl_set_blob (IUnknown *iface, const BYTE *data, UINT32 data_size)
 
static HRESULT STDMETHODCALLTYPE effect_impl_get_blob (const IUnknown *iface, BYTE *data, UINT32 data_size, UINT32 *actual_size)
 
static HRESULT STDMETHODCALLTYPE effect_impl_get_context (const IUnknown *iface, BYTE *data, UINT32 data_size, UINT32 *actual_size)
 
static HRESULT STDMETHODCALLTYPE effect_impl_get_graph (const IUnknown *iface, BYTE *data, UINT32 data_size, UINT32 *actual_size)
 
static void test_effect_register (BOOL d3d11)
 
static void test_effect_context (BOOL d3d11)
 
static void check_zero_buffer_ (const void *buffer, size_t size, unsigned int line)
 
static void test_effect_properties (BOOL d3d11)
 
static void check_enum_property (ID2D1Effect *effect, UINT32 property, const UINT32 *values, UINT32 count)
 
static void test_effect_2d_affine (BOOL d3d11)
 
static void test_effect_crop (BOOL d3d11)
 
static void test_effect_grayscale (BOOL d3d11)
 
static void test_registered_effects (BOOL d3d11)
 
static void test_transform_graph (BOOL d3d11)
 
static void test_offset_transform (BOOL d3d11)
 
static void check_blend_desc_ (unsigned int line, const D2D1_BLEND_DESCRIPTION *blend_desc, const D2D1_BLEND_DESCRIPTION *expected)
 
static void test_blend_transform (BOOL d3d11)
 
static void test_border_transform (BOOL d3d11)
 
static void test_bounds_adjustment_transform (BOOL d3d11)
 
static void test_stroke_contains_point (BOOL d3d11)
 
static void test_image_bounds (BOOL d3d11)
 
static void test_bitmap_map (BOOL d3d11)
 
static void test_bitmap_create (BOOL d3d11)
 
static void test_hwnd_target_is_supported (BOOL d3d11)
 
static void test_dc_target_is_supported (BOOL d3d11)
 
static HRESULT STDMETHODCALLTYPE ps_effect_impl_Initialize (ID2D1EffectImpl *iface, ID2D1EffectContext *context, ID2D1TransformGraph *graph)
 
static HRESULT STDMETHODCALLTYPE effect_impl_draw_transform_QueryInterface (ID2D1DrawTransform *iface, REFIID iid, void **out)
 
static ULONG STDMETHODCALLTYPE effect_impl_draw_transform_AddRef (ID2D1DrawTransform *iface)
 
static ULONG STDMETHODCALLTYPE effect_impl_draw_transform_Release (ID2D1DrawTransform *iface)
 
static UINT32 STDMETHODCALLTYPE effect_impl_draw_transform_GetInputCount (ID2D1DrawTransform *iface)
 
static HRESULT STDMETHODCALLTYPE effect_impl_draw_transform_MapOutputRectToInputRects (ID2D1DrawTransform *iface, const D2D1_RECT_L *output_rect, D2D1_RECT_L *input_rects, UINT32 input_rect_count)
 
static HRESULT STDMETHODCALLTYPE effect_impl_draw_transform_MapInputRectsToOutputRect (ID2D1DrawTransform *iface, const D2D1_RECT_L *input_rects, const D2D1_RECT_L *input_opaque_rects, UINT32 input_rect_count, D2D1_RECT_L *output_rect, D2D1_RECT_L *output_opaque_rect)
 
static HRESULT STDMETHODCALLTYPE effect_impl_draw_transform_MapInvalidRect (ID2D1DrawTransform *iface, UINT32 index, D2D1_RECT_L input_rect, D2D1_RECT_L *output_rect)
 
static HRESULT STDMETHODCALLTYPE effect_impl_draw_transform_SetDrawInfo (ID2D1DrawTransform *iface, ID2D1DrawInfo *info)
 
static HRESULT create_custom_shader_effect (IUnknown **effect_impl, const GUID *pixel_shader, const GUID *vertex_shader, const GUID *vertex_buffer)
 
static HRESULT STDMETHODCALLTYPE custom_effect_impl_create (IUnknown **effect_impl)
 
static void preload_shader (const char *target, const char *code, const GUID *id, struct d2d1_test_context *ctx)
 
static void test_effect_custom_pixel_shader (BOOL d3d11)
 
static void test_get_effect_properties (BOOL d3d11)
 
static void create_effect (ID2D1DeviceContext *device_context, const GUID *id, ID2D1EffectContext **effect_context, ID2D1Effect **effect)
 
static void test_effect_vertex_buffer (BOOL d3d11)
 
static void test_compute_geometry_area (BOOL d3d11)
 
static void test_wic_target_format (BOOL d3d11)
 
static void test_effect_blob_property (BOOL d3d11)
 
 START_TEST (d2d1)
 

Variables

static const WCHAR * effect_xml_a
 
static const WCHAR * effect_xml_b
 
static const WCHAR * effect_xml_c
 
static const WCHAR * effect_xml_minimum
 
static const WCHAR * effect_xml_without_version
 
static const WCHAR * effect_xml_without_inputs
 
static const WCHAR * effect_xml_without_name
 
static const WCHAR * effect_xml_without_author
 
static const WCHAR * effect_xml_without_category
 
static const WCHAR * effect_xml_without_description
 
static const WCHAR * effect_xml_without_type
 
static const WCHAR * effect_variable_input_count
 
static const char test_vs_code []
 
static const char test_ps_code []
 
static const D2D1_CREATION_PROPERTIES * properties
 
static const D2D1_CREATION_PROPERTIES ID2D1Device ** device
 
static float * s
 
static float float * c
 
static float y
 
static float float z
 
static D2D1_COLOR_SPACE dst_colour_space
 
static D2D1_COLOR_SPACE const D2D1_COLOR_F * colour
 
static BOOL use_mt = TRUE
 
static struct test_entry * mt_tests
 
size_t mt_tests_size
 
size_t mt_test_count
 
static const struct ID2D1SimplifiedGeometrySinkVtbl geometry_sink_vtbl
 
static const ID2D1EffectImplVtbl effect_impl_vtbl
 
static const ID2D1EffectImplVtbl custom_effect_impl_vtbl
 
static const ID2D1DrawTransformVtbl custom_shader_effect_draw_transform_vtbl
 

Macro Definition Documentation

◆ check_bitmap_options

#define check_bitmap_options (   b,
  o 
)    check_bitmap_options_(__LINE__, b, o)

Definition at line 1335 of file d2d1.c.

◆ check_bitmap_surface

#define check_bitmap_surface (   b,
  s,
  o 
)    check_bitmap_surface_(__LINE__, b, s, o)

Definition at line 1353 of file d2d1.c.

◆ check_blend_desc

#define check_blend_desc (   blend_desc,
  expected 
)    check_blend_desc_(__LINE__, blend_desc, expected)

Definition at line 13046 of file d2d1.c.

◆ check_interface

#define check_interface (   a,
  b,
  c 
)    check_interface_(__LINE__, a, b, c)

Definition at line 51 of file d2d1.c.

◆ check_rt_bitmap_surface

#define check_rt_bitmap_surface (   r,
  s,
  o 
)    check_rt_bitmap_surface_(__LINE__, r, s, o)

Definition at line 9157 of file d2d1.c.

◆ check_system_properties

#define check_system_properties (   effect)    check_system_properties_(__LINE__, effect)

Definition at line 10881 of file d2d1.c.

◆ check_zero_buffer

#define check_zero_buffer (   a,
  b 
)    check_zero_buffer_(a, b, __LINE__)

Definition at line 11801 of file d2d1.c.

◆ COBJMACROS

#define COBJMACROS

Definition at line 19 of file d2d1.c.

◆ geometry_sink_check

#define geometry_sink_check (   a,
  b,
  c,
  d,
  e 
)    geometry_sink_check_(__LINE__, a, b, c, d, e)

Definition at line 1584 of file d2d1.c.

◆ init_test_context

#define init_test_context (   ctx,
  d3d11 
)    init_test_context_(__LINE__, ctx, d3d11, D2D1_FACTORY_TYPE_SINGLE_THREADED)

Definition at line 1288 of file d2d1.c.

◆ init_test_multithreaded_context

#define init_test_multithreaded_context (   ctx,
  d3d11 
)    init_test_context_(__LINE__, ctx, d3d11, D2D1_FACTORY_TYPE_MULTI_THREADED)

Definition at line 1289 of file d2d1.c.

◆ release_test_context

#define release_test_context (   ctx)    release_test_context_(__LINE__, ctx)

Definition at line 1265 of file d2d1.c.

◆ test_compatible_target_size

#define test_compatible_target_size (   r)    test_compatible_target_size_(__LINE__, r)

Definition at line 6591 of file d2d1.c.

Function Documentation

◆ check_bitmap_options_()

static void check_bitmap_options_ ( unsigned int  line,
ID2D1Bitmap *  bitmap,
DWORD  expected_options 
)
static

Definition at line 1336 of file d2d1.c.

1337{
1339 ID2D1Bitmap1 *bitmap1;
1340 HRESULT hr;
1341
1342 hr = ID2D1Bitmap_QueryInterface(bitmap, &IID_ID2D1Bitmap1, (void **)&bitmap1);
1343 if (FAILED(hr))
1344 return;
1345
1346 options = ID2D1Bitmap1_GetOptions(bitmap1);
1347 ok_(__FILE__, line)(options == expected_options, "Got unexpected bitmap options %#x, expected %#lx.\n",
1348 options, expected_options);
1349
1350 ID2D1Bitmap1_Release(bitmap1);
1351}
#define ok_(x1, x2)
Definition: atltest.h:61
D2D1_BITMAP_OPTIONS
Definition: d2d1_1.idl:87
HRESULT hr
Definition: delayimp.cpp:582
#define FAILED(hr)
Definition: intsafe.h:51
Definition: uimain.c:89
Definition: parser.c:49

◆ check_bitmap_surface_()

static void check_bitmap_surface_ ( unsigned int  line,
ID2D1Bitmap *  bitmap,
BOOL  has_surface,
DWORD  expected_options 
)
static

Definition at line 1354 of file d2d1.c.

1355{
1357 IDXGISurface *surface;
1358 ID2D1Bitmap1 *bitmap1;
1359 HRESULT hr;
1360
1361 hr = ID2D1Bitmap_QueryInterface(bitmap, &IID_ID2D1Bitmap1, (void **)&bitmap1);
1362 if (FAILED(hr))
1363 return;
1364
1365 options = ID2D1Bitmap1_GetOptions(bitmap1);
1366 ok_(__FILE__, line)(options == expected_options, "Got unexpected bitmap options %#x, expected %#lx.\n",
1367 options, expected_options);
1368
1369 surface = (void *)0xdeadbeef;
1370 hr = ID2D1Bitmap1_GetSurface(bitmap1, &surface);
1371 if (has_surface)
1372 {
1373 unsigned int bind_flags = 0, misc_flags = 0;
1376 D2D1_SIZE_U pixel_size;
1377
1378 ok_(__FILE__, line)(hr == S_OK, "Failed to get bitmap surface, hr %#lx.\n", hr);
1379 ok_(__FILE__, line)(!!surface, "Expected surface instance.\n");
1380
1381 /* Correlate with resource configuration. */
1382 hr = IDXGISurface_QueryInterface(surface, &IID_ID3D10Texture2D, (void **)&texture);
1383 ok_(__FILE__, line)(hr == S_OK, "Failed to get texture pointer, hr %#lx.\n", hr);
1384
1385 ID3D10Texture2D_GetDesc(texture, &desc);
1386 ok_(__FILE__, line)(desc.Usage == 0, "Unexpected usage %#x.\n", desc.Usage);
1387
1389 bind_flags |= D3D10_BIND_RENDER_TARGET;
1391 bind_flags |= D3D10_BIND_SHADER_RESOURCE;
1394
1395 ok_(__FILE__, line)(desc.BindFlags == bind_flags, "Unexpected bind flags %#x for bitmap options %#x.\n",
1396 desc.BindFlags, options);
1397 ok_(__FILE__, line)(!desc.CPUAccessFlags, "Unexpected cpu access flags %#x.\n", desc.CPUAccessFlags);
1398 ok_(__FILE__, line)(desc.MiscFlags == misc_flags, "Unexpected misc flags %#x for bitmap options %#x.\n",
1399 desc.MiscFlags, options);
1400
1401 pixel_size = ID2D1Bitmap_GetPixelSize(bitmap);
1402 if (!pixel_size.width || !pixel_size.height)
1403 pixel_size.width = pixel_size.height = 1;
1404 ok_(__FILE__, line)(desc.Width == pixel_size.width, "Got width %u, expected %u.\n",
1405 desc.Width, pixel_size.width);
1406 ok_(__FILE__, line)(desc.Height == pixel_size.height, "Got height %u, expected %u.\n",
1407 desc.Height, pixel_size.height);
1408
1409 ID3D10Texture2D_Release(texture);
1410
1411 IDXGISurface_Release(surface);
1412 }
1413 else
1414 {
1415 ok_(__FILE__, line)(hr == D2DERR_INVALID_CALL, "Got unexpected hr %#lx.\n", hr);
1416 ok_(__FILE__, line)(!surface, "Unexpected surface instance.\n");
1417 }
1418
1419 ID2D1Bitmap1_Release(bitmap1);
1420}
@ D2D1_BITMAP_OPTIONS_GDI_COMPATIBLE
Definition: d2d1_1.idl:92
@ D2D1_BITMAP_OPTIONS_CANNOT_DRAW
Definition: d2d1_1.idl:90
@ D2D1_BITMAP_OPTIONS_TARGET
Definition: d2d1_1.idl:89
@ D3D10_RESOURCE_MISC_GDI_COMPATIBLE
Definition: d3d10.idl:892
@ D3D10_BIND_SHADER_RESOURCE
Definition: d3d10.idl:471
@ D3D10_BIND_RENDER_TARGET
Definition: d3d10.idl:473
GLenum GLuint texture
Definition: glext.h:6295
#define S_OK
Definition: intsafe.h:52
D3D11_SHADER_VARIABLE_DESC desc
Definition: reflection.c:1683
UINT32 height
Definition: dcommon.idl:116
UINT32 width
Definition: dcommon.idl:115
#define D2DERR_INVALID_CALL
Definition: winerror.h:7361

Referenced by check_rt_bitmap_surface_().

◆ check_blend_desc_()

static void check_blend_desc_ ( unsigned int  line,
const D2D1_BLEND_DESCRIPTION *  blend_desc,
const D2D1_BLEND_DESCRIPTION *  expected 
)
static

Definition at line 13047 of file d2d1.c.

13049{
13050 ok_(__FILE__, line)(blend_desc->sourceBlend == expected->sourceBlend,
13051 "Got unexpected source blend %u, expected %u.\n",
13052 blend_desc->sourceBlend, expected->sourceBlend);
13053 ok_(__FILE__, line)(blend_desc->destinationBlend == expected->destinationBlend,
13054 "Got unexpected destination blend %u, expected %u.\n",
13055 blend_desc->destinationBlend, expected->destinationBlend);
13056 ok_(__FILE__, line)(blend_desc->blendOperation == expected->blendOperation,
13057 "Got unexpected blend operation %u, expected %u.\n",
13058 blend_desc->blendOperation, expected->blendOperation);
13059 ok_(__FILE__, line)(blend_desc->sourceBlendAlpha == expected->sourceBlendAlpha,
13060 "Got unexpected source blend alpha %u, expected %u.\n",
13061 blend_desc->sourceBlendAlpha, expected->sourceBlendAlpha);
13062 ok_(__FILE__, line)(blend_desc->destinationBlendAlpha == expected->destinationBlendAlpha,
13063 "Got unexpected destination blend alpha %u, expected %u.\n",
13064 blend_desc->destinationBlendAlpha, expected->destinationBlendAlpha);
13065 ok_(__FILE__, line)(blend_desc->blendOperationAlpha == expected->blendOperationAlpha,
13066 "Got unexpected blend operation alpha %u, expected %u.\n",
13067 blend_desc->blendOperationAlpha, expected->blendOperationAlpha);
13068 ok_(__FILE__, line)(blend_desc->blendFactor[0] == expected->blendFactor[0],
13069 "Got unexpected blendFactor[0] %.8e, expected %.8e.\n",
13070 blend_desc->blendFactor[0], expected->blendFactor[0]);
13071 ok_(__FILE__, line)(blend_desc->blendFactor[1] == expected->blendFactor[1],
13072 "Got unexpected blendFactor[1] %.8e, expected %.8e.\n",
13073 blend_desc->blendFactor[1], expected->blendFactor[1]);
13074 ok_(__FILE__, line)(blend_desc->blendFactor[2] == expected->blendFactor[2],
13075 "Got unexpected blendFactor[2] %.8e, expected %.8e.\n",
13076 blend_desc->blendFactor[2], expected->blendFactor[2]);
13077 ok_(__FILE__, line)(blend_desc->blendFactor[3] == expected->blendFactor[3],
13078 "Got unexpected blendFactor[3] %.8e, expected %.8e.\n",
13079 blend_desc->blendFactor[3], expected->blendFactor[3]);
13080}
BOOL expected
Definition: store.c:2000
D2D1_BLEND_OPERATION blendOperation
D2D1_BLEND_OPERATION blendOperationAlpha

◆ check_enum_property()

static void check_enum_property ( ID2D1Effect *  effect,
UINT32  property,
const UINT32 *  values,
UINT32  count 
)
static

Definition at line 12320 of file d2d1.c.

12322{
12323 ID2D1Properties *subproperties, *fields_subproperties, *field_subproperties;
12324 D2D1_PROPERTY_TYPE prop_type;
12325 UINT32 prop_count, value;
12326 WCHAR buffer[64];
12327 unsigned int i;
12328 HRESULT hr;
12329
12330 prop_type = ID2D1Effect_GetType(effect, property);
12331 ok(prop_type == D2D1_PROPERTY_TYPE_ENUM, "Unexpected type %d.\n", prop_type);
12332
12333 hr = ID2D1Effect_GetSubProperties(effect, property, &subproperties);
12334 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
12335
12336 prop_type = ID2D1Properties_GetType(subproperties, D2D1_SUBPROPERTY_FIELDS);
12337 ok(prop_type == D2D1_PROPERTY_TYPE_ARRAY, "Unexpected type %d.\n", prop_type);
12338
12339 /* Number of enum members. */
12340 hr = ID2D1Properties_GetValue(subproperties, D2D1_SUBPROPERTY_FIELDS, D2D1_PROPERTY_TYPE_ARRAY,
12341 (BYTE *)&value, sizeof(value));
12342 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
12343 ok(value == count, "Unexpected value %u.\n", value);
12344
12345 prop_count = ID2D1Properties_GetPropertyCount(subproperties);
12346 ok(!prop_count, "Got unexpected property count %u.\n", count);
12347
12348 /* Fields is an array of strings providing display names for members. */
12349 hr = ID2D1Properties_GetSubProperties(subproperties, D2D1_SUBPROPERTY_FIELDS,
12350 &fields_subproperties);
12351 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
12352 prop_count = ID2D1Properties_GetPropertyCount(fields_subproperties);
12353 ok(prop_count == count, "Got unexpected property count %u.\n", count);
12354
12355 for (i = 0; i < prop_count; ++i)
12356 {
12357 winetest_push_context("Test %u", i);
12358
12359 prop_type = ID2D1Properties_GetType(fields_subproperties, i);
12360 ok(prop_type == D2D1_PROPERTY_TYPE_STRING, "Unexpected type %d.\n", prop_type);
12361
12362 /* Field names are localized. */
12363 hr = ID2D1Properties_GetSubProperties(fields_subproperties, i, &field_subproperties);
12364 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
12365 prop_count = ID2D1Properties_GetPropertyCount(field_subproperties);
12366 ok(prop_count == 1, "Got unexpected property count %u.\n", count);
12367
12368 prop_type = ID2D1Properties_GetType(field_subproperties, 0);
12369 ok(prop_type == D2D1_PROPERTY_TYPE_UINT32, "Unexpected type %d.\n", prop_type);
12370 hr = ID2D1Properties_GetPropertyName(field_subproperties, 0, buffer, ARRAY_SIZE(buffer));
12371 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
12372 ok(!wcscmp(buffer, L"Index"), "Unexpected name %s.\n", wine_dbgstr_w(buffer));
12373 hr = ID2D1Properties_GetValue(field_subproperties, 0, D2D1_PROPERTY_TYPE_UINT32, (BYTE *)&value, sizeof(value));
12374 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
12375 ok(value == values[i], "Unexpected value %u, expected %u.\n", value, values[i]);
12376
12377 ID2D1Properties_Release(field_subproperties);
12378
12380 }
12381
12382 ID2D1Properties_Release(fields_subproperties);
12383 ID2D1Properties_Release(subproperties);
12384}
#define ok(value,...)
Definition: atltest.h:57
#define ARRAY_SIZE(A)
Definition: main.h:20
D2D1_PROPERTY_TYPE
Definition: d2d1_1.idl:164
@ D2D1_PROPERTY_TYPE_ENUM
Definition: d2d1_1.idl:176
@ D2D1_PROPERTY_TYPE_UINT32
Definition: d2d1_1.idl:168
@ D2D1_PROPERTY_TYPE_STRING
Definition: d2d1_1.idl:166
@ D2D1_PROPERTY_TYPE_ARRAY
Definition: d2d1_1.idl:177
@ D2D1_SUBPROPERTY_FIELDS
Definition: d2d1_1.idl:209
_ACRTIMP int __cdecl wcscmp(const wchar_t *, const wchar_t *)
Definition: wcs.c:1977
#define L(x)
Definition: resources.c:13
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLuint buffer
Definition: glext.h:5915
GLboolean GLenum GLenum GLvoid * values
Definition: glext.h:5666
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define wine_dbgstr_w
Definition: kernel32.h:34
void __cdecl void __cdecl void __cdecl void __cdecl void __cdecl void winetest_pop_context(void)
void __cdecl void __cdecl void __cdecl void __cdecl void __cdecl winetest_push_context(const char *fmt,...) __WINE_PRINTF_ATTR(1
Definition: test.h:539
short WCHAR
Definition: pedump.c:58
uint32_t UINT32
Definition: typedefs.h:59
Definition: pdh_main.c:64
unsigned char BYTE
Definition: xxhash.c:193

Referenced by test_effect_2d_affine().

◆ check_interface_()

static void check_interface_ ( unsigned int  line,
void *  iface_ptr,
REFIID  iid,
BOOL  supported 
)
static

Definition at line 52 of file d2d1.c.

53{
54 IUnknown *iface = iface_ptr;
56 IUnknown *unk;
57
58 expected_hr = supported ? S_OK : E_NOINTERFACE;
59
60 hr = IUnknown_QueryInterface(iface, iid, (void **)&unk);
61 ok_(__FILE__, line)(hr == expected_hr, "Got hr %#lx, expected %#lx.\n", hr, expected_hr);
62 if (SUCCEEDED(hr))
63 IUnknown_Release(unk);
64}
HRESULT expected_hr
#define SUCCEEDED(hr)
Definition: intsafe.h:50
#define E_NOINTERFACE
Definition: winerror.h:3479

◆ check_rt_bitmap_surface_()

static void check_rt_bitmap_surface_ ( unsigned int  line,
ID2D1RenderTarget *  rt,
BOOL  has_surface,
DWORD  options 
)
static

Definition at line 9158 of file d2d1.c.

9159{
9160 ID2D1BitmapRenderTarget *compatible_rt;
9161 D2D1_BITMAP_PROPERTIES bitmap_desc;
9162 IWICImagingFactory *wic_factory;
9165 ID2D1DCRenderTarget *dc_rt;
9166 IWICBitmap *wic_bitmap;
9169 HRESULT hr;
9170
9171 static const DWORD bitmap_data[] =
9172 {
9173 0x7f7f0000,
9174 };
9175
9176 /* Raw data bitmap. */
9177 set_size_u(&size, 1, 1);
9179 bitmap_desc.pixelFormat.alphaMode = D2D1_ALPHA_MODE_IGNORE;
9180 bitmap_desc.dpiX = 96.0f;
9181 bitmap_desc.dpiY = 96.0f;
9182 hr = ID2D1RenderTarget_CreateBitmap(rt, size, bitmap_data, sizeof(*bitmap_data), &bitmap_desc, &bitmap);
9183 ok_(__FILE__, line)(hr == S_OK, "Failed to create bitmap, hr %#lx.\n", hr);
9184
9185 check_bitmap_surface_(line, bitmap, has_surface, options);
9186
9187 ID2D1Bitmap_Release(bitmap);
9188
9189 /* Zero sized bitmaps. */
9190 set_size_u(&size, 0, 0);
9191 hr = ID2D1RenderTarget_CreateBitmap(rt, size, NULL, 0, &bitmap_desc, &bitmap);
9192 ok_(__FILE__, line)(hr == S_OK, "Failed to create bitmap, hr %#lx.\n", hr);
9193 check_bitmap_surface_(line, bitmap, has_surface, options);
9194 ID2D1Bitmap_Release(bitmap);
9195
9196 set_size_u(&size, 2, 0);
9197 hr = ID2D1RenderTarget_CreateBitmap(rt, size, NULL, 0, &bitmap_desc, &bitmap);
9198 ok_(__FILE__, line)(hr == S_OK, "Failed to create bitmap, hr %#lx.\n", hr);
9199 check_bitmap_surface_(line, bitmap, has_surface, options);
9200 ID2D1Bitmap_Release(bitmap);
9201
9202 set_size_u(&size, 0, 2);
9203 hr = ID2D1RenderTarget_CreateBitmap(rt, size, NULL, 0, &bitmap_desc, &bitmap);
9204 ok_(__FILE__, line)(hr == S_OK, "Failed to create bitmap, hr %#lx.\n", hr);
9205 check_bitmap_surface_(line, bitmap, has_surface, options);
9206 ID2D1Bitmap_Release(bitmap);
9207
9208 /* WIC bitmap. */
9210
9211 hr = CoCreateInstance(&CLSID_WICImagingFactory, NULL, CLSCTX_INPROC_SERVER,
9212 &IID_IWICImagingFactory, (void **)&wic_factory);
9213 ok_(__FILE__, line)(hr == S_OK, "Failed to create WIC imaging factory, hr %#lx.\n", hr);
9214
9215 hr = IWICImagingFactory_CreateBitmap(wic_factory, 16, 16,
9216 &GUID_WICPixelFormat32bppPBGRA, WICBitmapCacheOnDemand, &wic_bitmap);
9217 ok_(__FILE__, line)(hr == S_OK, "Failed to create WIC bitmap, hr %#lx.\n", hr);
9218 IWICImagingFactory_Release(wic_factory);
9219
9220 hr = ID2D1RenderTarget_CreateBitmapFromWicBitmap(rt, (IWICBitmapSource *)wic_bitmap, NULL, &bitmap);
9221 ok_(__FILE__, line)(hr == S_OK, "Failed to create bitmap from WIC source, hr %#lx.\n", hr);
9222
9223 check_bitmap_surface_(line, bitmap, has_surface, options);
9224
9225 ID2D1Bitmap_Release(bitmap);
9226
9228
9229 /* Compatible target follows its parent. */
9230 hr = ID2D1RenderTarget_QueryInterface(rt, &IID_ID2D1DeviceContext, (void **)&context);
9231 ok_(__FILE__, line)(hr == S_OK, "Failed to get device context, hr %#lx.\n", hr);
9232
9233 dc_rt = NULL;
9234 ID2D1RenderTarget_QueryInterface(rt, &IID_ID2D1DCRenderTarget, (void **)&dc_rt);
9235
9236 bitmap = NULL;
9237 target = NULL;
9238 ID2D1DeviceContext_GetTarget(context, &target);
9239 if (target && FAILED(ID2D1Image_QueryInterface(target, &IID_ID2D1Bitmap, (void **)&bitmap)))
9240 {
9241 ID2D1Image_Release(target);
9242 target = NULL;
9243 }
9244 if (bitmap)
9245 {
9246 D2D1_PIXEL_FORMAT rt_format, bitmap_format;
9247
9248 rt_format = ID2D1RenderTarget_GetPixelFormat(rt);
9249 bitmap_format = ID2D1Bitmap_GetPixelFormat(bitmap);
9250 ok_(__FILE__, line)(!memcmp(&rt_format, &bitmap_format, sizeof(rt_format)), "Unexpected bitmap format.\n");
9251
9252 ID2D1Bitmap_Release(bitmap);
9253 }
9254
9255 /* Pixel format is not defined until target is set, for DC target it's specified on creation. */
9256 if (target || dc_rt)
9257 {
9258 ID2D1Device *device, *device2;
9259 ID2D1DeviceContext *context2;
9260
9261 ID2D1DeviceContext_GetDevice(context, &device);
9262
9263 hr = ID2D1RenderTarget_CreateCompatibleRenderTarget(rt, NULL, NULL, NULL,
9265 ok_(__FILE__, line)(hr == S_OK, "Failed to create compatible render target, hr %#lx.\n", hr);
9266
9267 hr = ID2D1BitmapRenderTarget_QueryInterface(compatible_rt, &IID_ID2D1DeviceContext, (void **)&context2);
9268 ok_(__FILE__, line)(hr == S_OK, "Failed to get device context, hr %#lx.\n", hr);
9269
9270 ID2D1DeviceContext_GetDevice(context2, &device2);
9271 ok_(__FILE__, line)(device == device2, "Unexpected device.\n");
9272
9273 ID2D1Device_Release(device);
9274 ID2D1Device_Release(device2);
9275
9276 hr = ID2D1BitmapRenderTarget_CreateBitmap(compatible_rt, size,
9277 bitmap_data, sizeof(*bitmap_data), &bitmap_desc, &bitmap);
9278 ok_(__FILE__, line)(hr == S_OK, "Failed to create bitmap, hr %#lx.\n", hr);
9279 check_bitmap_surface_(line, bitmap, has_surface, options);
9280 ID2D1Bitmap_Release(bitmap);
9281
9282 hr = ID2D1BitmapRenderTarget_GetBitmap(compatible_rt, &bitmap);
9283 ok_(__FILE__, line)(hr == S_OK, "Failed to get compatible target bitmap, hr %#lx.\n", hr);
9284
9285 bitmap2 = NULL;
9286 ID2D1DeviceContext_GetTarget(context2, (ID2D1Image **)&bitmap2);
9287 ok_(__FILE__, line)(bitmap2 == bitmap, "Unexpected bitmap.\n");
9288
9290 ID2D1Bitmap_Release(bitmap2);
9291 ID2D1Bitmap_Release(bitmap);
9292
9293 ID2D1BitmapRenderTarget_Release(compatible_rt);
9294 ID2D1DeviceContext_Release(context2);
9295 }
9296 else
9297 {
9298 hr = ID2D1RenderTarget_CreateCompatibleRenderTarget(rt, NULL, NULL, NULL,
9300 ok_(__FILE__, line)(hr == D2DERR_UNSUPPORTED_PIXEL_FORMAT, "Unexpected hr %#lx.\n", hr);
9301 }
9302
9303 ID2D1DeviceContext_Release(context);
9304 if (target)
9305 ID2D1Image_Release(target);
9306 if (dc_rt)
9307 ID2D1DCRenderTarget_Release(dc_rt);
9308}
static void check_bitmap_surface_(unsigned int line, ID2D1Bitmap *bitmap, BOOL has_surface, DWORD expected_options)
Definition: d2d1.c:1354
static const D2D1_CREATION_PROPERTIES ID2D1Device ** device
Definition: d2d1.c:299
static void set_size_u(D2D1_SIZE_U *size, unsigned int w, unsigned int h)
Definition: d2d1.c:550
@ D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS_NONE
Definition: d2d1.idl:221
#define D2DERR_UNSUPPORTED_PIXEL_FORMAT
Definition: d2derr.h:24
#define NULL
Definition: types.h:112
HRESULT WINAPI DECLSPEC_HOTPATCH CoInitializeEx(void *reserved, DWORD model)
Definition: combase.c:2803
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: combase.c:2842
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, IUnknown *outer, DWORD cls_context, REFIID riid, void **obj)
Definition: combase.c:1685
_ACRTIMP int __cdecl memcmp(const void *, const void *, size_t)
Definition: string.c:2807
@ DXGI_FORMAT_B8G8R8A8_UNORM
Definition: dxgiformat.idl:110
unsigned long DWORD
Definition: ntddk_ex.h:95
GLsizeiptr size
Definition: glext.h:5919
static HBITMAP bitmap2
Definition: clipboard.c:1456
@ COINIT_APARTMENTTHREADED
Definition: objbase.h:279
D2D1_PIXEL_FORMAT pixelFormat
Definition: d2d1.idl:362
D2D1_ALPHA_MODE alphaMode
Definition: dcommon.idl:71
DXGI_FORMAT format
Definition: dcommon.idl:70
Definition: http.c:7252
Definition: devices.h:37
Definition: tools.h:99
@ WICBitmapCacheOnDemand
Definition: wincodec.idl:36

◆ check_system_properties_()

static void check_system_properties_ ( unsigned int  line,
ID2D1Effect *  effect 
)
static

Definition at line 10882 of file d2d1.c.

10883{
10884 UINT i, value_size, str_size;
10885 WCHAR name[32], buffer[256];
10887 UINT32 count;
10888 HRESULT hr;
10889
10890 static const struct system_property_test
10891 {
10892 UINT32 index;
10893 const WCHAR *name;
10895 UINT32 value_size;
10896 }
10897 system_property_tests[] =
10898 {
10909 };
10910
10911 hr = ID2D1Effect_GetPropertyName(effect, 0xdeadbeef, name, sizeof(name));
10912 ok_(__FILE__, line)(hr == D2DERR_INVALID_PROPERTY, "GetPropertyName() got unexpected hr %#lx for 0xdeadbeef.\n", hr);
10913 type = ID2D1Effect_GetType(effect, 0xdeadbeef);
10914 ok_(__FILE__, line)(type == D2D1_PROPERTY_TYPE_UNKNOWN, "Got unexpected property type %#x for 0xdeadbeef.\n", type);
10915 value_size = ID2D1Effect_GetValueSize(effect, 0xdeadbeef);
10916 ok_(__FILE__, line)(value_size == 0, "Got unexpected value size %u for 0xdeadbeef.\n", value_size);
10917
10918 for (i = 0; i < ARRAY_SIZE(system_property_tests); ++i)
10919 {
10920 const struct system_property_test *test = &system_property_tests[i];
10921 winetest_push_context("Property %u", i);
10922
10923 name[0] = 0;
10924 hr = ID2D1Effect_GetPropertyName(effect, test->index, name, ARRAY_SIZE(name));
10925 ok_(__FILE__, line)(hr == S_OK, "Failed to get property name, hr %#lx\n", hr);
10927 {
10929 continue;
10930 }
10931 ok_(__FILE__, line)(!wcscmp(name, test->name), "Got unexpected property name %s, expected %s.\n",
10933 count = ID2D1Effect_GetPropertyNameLength(effect, test->index);
10934 ok_(__FILE__, line)(wcslen(name) == count, "Got unexpected property name length %u.\n", count);
10935
10936 name[0] = 0;
10937 hr = ID2D1Effect_GetPropertyName(effect, test->index, name, count);
10938 ok_(__FILE__, line)(hr == D2DERR_INSUFFICIENT_BUFFER, "Failed to get property name, hr %#lx\n", hr);
10939
10940 name[0] = 0;
10941 hr = ID2D1Effect_GetPropertyName(effect, test->index, name, count + 1);
10942 ok_(__FILE__, line)(hr == S_OK, "Failed to get property name, hr %#lx\n", hr);
10943
10944 type = ID2D1Effect_GetType(effect, test->index);
10945 ok_(__FILE__, line)(type == test->type, "Got unexpected property type %#x, expected %#x.\n",
10946 type, test->type);
10947
10948 value_size = 0;
10949 value_size = ID2D1Effect_GetValueSize(effect, test->index);
10950 if (test->value_size != 0)
10951 {
10952 ok_(__FILE__, line)(value_size == test->value_size, "Got unexpected value size %u, expected %u.\n",
10953 value_size, test->value_size);
10954 }
10955 else if (test->type == D2D1_PROPERTY_TYPE_STRING)
10956 {
10957 hr = ID2D1Effect_GetValue(effect, test->index, D2D1_PROPERTY_TYPE_STRING, (BYTE *)buffer, sizeof(buffer));
10958 ok_(__FILE__, line)(hr == S_OK, "Failed to get value, hr %#lx.\n", hr);
10959 str_size = (wcslen(buffer) + 1) * sizeof(WCHAR);
10960 ok_(__FILE__, line)(value_size == str_size, "Got unexpected value size %u, expected %u.\n",
10961 value_size, str_size);
10962 }
10964 }
10965}
#define index(s, c)
Definition: various.h:29
@ D2D1_PROPERTY_CLSID
Definition: d2d1_1.idl:189
@ D2D1_PROPERTY_CACHED
Definition: d2d1_1.idl:195
@ D2D1_PROPERTY_MAX_INPUTS
Definition: d2d1_1.idl:198
@ D2D1_PROPERTY_PRECISION
Definition: d2d1_1.idl:196
@ D2D1_PROPERTY_MIN_INPUTS
Definition: d2d1_1.idl:197
@ D2D1_PROPERTY_DISPLAYNAME
Definition: d2d1_1.idl:190
@ D2D1_PROPERTY_DESCRIPTION
Definition: d2d1_1.idl:193
@ D2D1_PROPERTY_CATEGORY
Definition: d2d1_1.idl:192
@ D2D1_PROPERTY_INPUTS
Definition: d2d1_1.idl:194
@ D2D1_PROPERTY_AUTHOR
Definition: d2d1_1.idl:191
@ D2D1_PROPERTY_TYPE_CLSID
Definition: d2d1_1.idl:178
@ D2D1_PROPERTY_TYPE_BOOL
Definition: d2d1_1.idl:167
@ D2D1_PROPERTY_TYPE_UNKNOWN
Definition: d2d1_1.idl:165
#define D2DERR_INSUFFICIENT_BUFFER
Definition: d2derr.h:23
_ACRTIMP size_t __cdecl wcslen(const wchar_t *)
Definition: wcs.c:2988
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
unsigned int UINT
Definition: sysinfo.c:13
#define debugstr_w
Definition: kernel32.h:32
IID CLSID
Definition: mstsclib_i.c:62
#define BOOL
Definition: nt_native.h:43
#define test
Definition: rosglue.h:37
char * name
Definition: wpp.c:52
Definition: name.c:39
#define D2DERR_INVALID_PROPERTY
Definition: winerror.h:7392

◆ check_zero_buffer_()

static void check_zero_buffer_ ( const void *  buffer,
size_t  size,
unsigned int  line 
)
static

Definition at line 11802 of file d2d1.c.

11803{
11804 const uint32_t *ptr = buffer;
11805 const uint8_t *ptr2 = buffer;
11806 size_t i;
11807
11808 for (i = 0; i < size / sizeof(*ptr); ++i)
11809 ok_(__FILE__, line)(!ptr[i], "Expected zero value %#x.\n", ptr[i]);
11810 for (i = 0; i < size % sizeof(*ptr); ++i)
11811 ok_(__FILE__, line)(!ptr2[size - i - 1], "Expected zero value %#x.\n", ptr2[i]);
11812}
UINT32 uint32_t
Definition: types.h:75
unsigned char uint8_t
Definition: stdint.h:33
static PVOID ptr
Definition: dispmode.c:27

◆ clamp_float()

static float clamp_float ( float  f,
float  lower,
float  upper 
)
static

Definition at line 773 of file d2d1.c.

774{
775 return f < lower ? lower : f > upper ? upper : f;
776}
#define f
Definition: ke_i.h:83

Referenced by test_colour_space().

◆ compare_bezier_segment()

static BOOL compare_bezier_segment ( const D2D1_BEZIER_SEGMENT *  b,
float  x1,
float  y1,
float  x2,
float  y2,
float  x3,
float  y3,
unsigned int  ulps 
)
static

Definition at line 828 of file d2d1.c.

830{
831 return compare_point(&b->point1, x1, y1, ulps)
832 && compare_point(&b->point2, x2, y2, ulps)
833 && compare_point(&b->point3, x3, y3, ulps);
834}
static BOOL compare_point(const D2D1_POINT_2F *point, float x, float y, unsigned int ulps)
Definition: d2d1.c:814
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
unsigned int ulps
Definition: effect.c:4467
static float int float int float int x3
Definition: server.c:79
static float int float int float int float y3
Definition: server.c:79
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG x1
Definition: winddi.h:3708
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG y1
Definition: winddi.h:3709
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG _In_ LONG _In_ LONG y2
Definition: winddi.h:3711
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG _In_ LONG x2
Definition: winddi.h:3710

Referenced by geometry_sink_check_().

◆ compare_colour()

static BOOL compare_colour ( DWORD  c1,
DWORD  c2,
BYTE  max_diff 
)
static

Definition at line 785 of file d2d1.c.

786{
787 return compare_uint(c1 & 0xff, c2 & 0xff, max_diff)
788 && compare_uint((c1 >> 8) & 0xff, (c2 >> 8) & 0xff, max_diff)
789 && compare_uint((c1 >> 16) & 0xff, (c2 >> 16) & 0xff, max_diff)
790 && compare_uint((c1 >> 24) & 0xff, (c2 >> 24) & 0xff, max_diff);
791}
static BOOL compare_uint(unsigned int x, unsigned int y, unsigned int max_diff)
Definition: d2d1.c:778

Referenced by test_effect_custom_pixel_shader(), test_effect_grayscale(), test_linear_brush(), and test_radial_brush().

◆ compare_colour_f()

static BOOL compare_colour_f ( const D2D1_COLOR_F *  colour,
float  r,
float  g,
float  b,
float  a,
unsigned int  ulps 
)
static

Definition at line 806 of file d2d1.c.

807{
808 return compare_float(colour->r, r, ulps)
811 && compare_float(colour->a, a, ulps);
812}
static D2D1_COLOR_SPACE const D2D1_COLOR_F * colour
Definition: d2d1.c:304
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
GLboolean GLboolean g
Definition: glext.h:6204
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204
#define compare_float(got, exp)
Definition: mesh.c:43

Referenced by test_colour_space().

◆ compare_figure()

static BOOL compare_figure ( struct d2d1_test_context *  ctx,
unsigned int  x,
unsigned int  y,
unsigned int  w,
unsigned int  h,
DWORD  prev,
unsigned int  max_diff,
const char *  ref 
)
static

Definition at line 1050 of file d2d1.c.

1052{
1053 struct figure ref_figure, figure;
1054 unsigned int i, j, span, diff;
1055 struct resource_readback rb;
1056
1058
1059 figure.span_count = 0;
1060 figure.spans_size = 64;
1062
1063 read_figure(&figure, rb.data, rb.pitch, x, y, w, h, prev);
1064
1065 deserialize_figure(&ref_figure, (BYTE *)ref);
1066 span = w * h;
1067 for (i = 0; i < ref_figure.span_count; ++i)
1068 {
1069 span -= ref_figure.spans[i];
1070 }
1071 if (span)
1072 figure_add_span(&ref_figure, span);
1073
1074 for (i = 0, j = 0, diff = 0; i < figure.span_count && j < ref_figure.span_count;)
1075 {
1076 if (figure.spans[i] == ref_figure.spans[j])
1077 {
1078 if ((i ^ j) & 1)
1079 diff += ref_figure.spans[j];
1080 ++i;
1081 ++j;
1082 }
1083 else if (figure.spans[i] > ref_figure.spans[j])
1084 {
1085 if ((i ^ j) & 1)
1086 diff += ref_figure.spans[j];
1087 figure.spans[i] -= ref_figure.spans[j];
1088 ++j;
1089 }
1090 else
1091 {
1092 if ((i ^ j) & 1)
1093 diff += figure.spans[i];
1094 ref_figure.spans[j] -= figure.spans[i];
1095 ++i;
1096 }
1097 }
1098 if (diff > max_diff)
1099 {
1100 trace("diff %u > max_diff %u.\n", diff, max_diff);
1101 read_figure(&figure, rb.data, rb.pitch, x, y, w, h, prev);
1103 }
1104
1105 HeapFree(GetProcessHeap(), 0, ref_figure.spans);
1108
1109 return diff <= max_diff;
1110}
#define trace
Definition: atltest.h:70
static void release_resource_readback(struct resource_readback *rb)
Definition: d2d1.c:760
static void get_surface_readback(struct d2d1_test_context *ctx, struct resource_readback *rb)
Definition: d2d1.c:732
static void figure_add_span(struct figure *figure, unsigned int span)
Definition: d2d1.c:967
static void deserialize_figure(struct figure *figure, const BYTE *s)
Definition: d2d1.c:994
static void serialize_figure(struct figure *figure)
Definition: d2d1.c:919
static void read_figure(struct figure *figure, BYTE *data, unsigned int pitch, unsigned int x, unsigned int y, unsigned int w, unsigned int h, DWORD prev)
Definition: d2d1.c:1027
#define GetProcessHeap()
Definition: compat.h:736
#define HeapAlloc
Definition: compat.h:733
#define HeapFree(x, y, z)
Definition: compat.h:735
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
GLenum GLenum GLvoid GLvoid GLvoid * span
Definition: glext.h:5664
GLubyte GLubyte GLubyte GLubyte w
Definition: glext.h:6102
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
Definition: d2d1.c:343
unsigned int * spans
Definition: d2d1.c:344
unsigned int span_count
Definition: d2d1.c:346
unsigned int spans_size
Definition: d2d1.c:345
Definition: send.c:48

Referenced by test_bezier_intersect(), test_draw_geometry(), test_effect_2d_affine(), test_fill_geometry(), and test_path_geometry().

◆ compare_float()

static BOOL compare_float ( float  f,
float  g,
unsigned int  ulps 
)
static

Definition at line 793 of file d2d1.c.

794{
795 int x = *(int *)&f;
796 int y = *(int *)&g;
797
798 if (x < 0)
799 x = INT_MIN - x;
800 if (y < 0)
801 y = INT_MIN - y;
802
803 return compare_uint(x, y, ulps);
804}
static float y
Definition: d2d1.c:302
#define INT_MIN
Definition: limits.h:25
GLfloat f
Definition: glext.h:7540

◆ compare_point()

static BOOL compare_point ( const D2D1_POINT_2F *  point,
float  x,
float  y,
unsigned int  ulps 
)
static

Definition at line 814 of file d2d1.c.

815{
816 return compare_float(point->x, x, ulps)
817 && compare_float(point->y, y, ulps);
818}
POINTL point
Definition: edittest.c:50
LONG y
Definition: windef.h:130
LONG x
Definition: windef.h:129

Referenced by compare_bezier_segment(), geometry_sink_check_(), test_linear_brush(), and test_radial_brush().

◆ compare_rect()

static BOOL compare_rect ( const D2D1_RECT_F *  rect,
float  left,
float  top,
float  right,
float  bottom,
unsigned int  ulps 
)
static

Definition at line 820 of file d2d1.c.

821{
822 return compare_float(rect->left, left, ulps)
826}
RECT rect
Definition: combotst.c:67
GLdouble GLdouble GLdouble GLdouble top
Definition: glext.h:10859
GLdouble GLdouble right
Definition: glext.h:10859
GLint left
Definition: glext.h:7726
GLint GLint bottom
Definition: glext.h:7726
long bottom
Definition: dcommon.idl:29
long right
Definition: dcommon.idl:29
long left
Definition: dcommon.idl:29
long top
Definition: dcommon.idl:29

Referenced by test_effect_2d_affine(), test_effect_crop(), test_geometry_group(), test_image_bounds(), test_image_brush(), test_path_geometry(), and test_rectangle_geometry().

◆ compare_sha1()

static BOOL compare_sha1 ( void *  data,
unsigned int  pitch,
unsigned int  bpp,
unsigned int  w,
unsigned int  h,
const char *  ref_sha1 
)
static

Definition at line 836 of file d2d1.c.

838{
839 static const char hex_chars[] = "0123456789abcdef";
840 HCRYPTPROV provider;
841 BYTE hash_data[20];
843 DWORD hash_size;
844 unsigned int i;
845 char sha1[41];
846 BOOL ret;
847
849 ok(ret, "Failed to acquire crypt context.\n");
850 ret = CryptCreateHash(provider, CALG_SHA1, 0, 0, &hash);
851 ok(ret, "Failed to create hash.\n");
852
853 for (i = 0; i < h; ++i)
854 {
855 if (!(ret = CryptHashData(hash, (BYTE *)data + pitch * i, w * bpp, 0)))
856 break;
857 }
858 ok(ret, "Failed to hash data.\n");
859
860 hash_size = sizeof(hash_data);
861 ret = CryptGetHashParam(hash, HP_HASHVAL, hash_data, &hash_size, 0);
862 ok(ret, "Failed to get hash value.\n");
863 ok(hash_size == sizeof(hash_data), "Got unexpected hash size %lu.\n", hash_size);
864
866 ok(ret, "Failed to destroy hash.\n");
867 ret = CryptReleaseContext(provider, 0);
868 ok(ret, "Failed to release crypt context.\n");
869
870 for (i = 0; i < 20; ++i)
871 {
872 sha1[i * 2] = hex_chars[hash_data[i] >> 4];
873 sha1[i * 2 + 1] = hex_chars[hash_data[i] & 0xf];
874 }
875 sha1[40] = 0;
876
877 return !strcmp(ref_sha1, (char *)sha1);
878}
#define sha1
Definition: compat-1.3.h:2261
BOOL WINAPI CryptCreateHash(HCRYPTPROV hProv, ALG_ID Algid, HCRYPTKEY hKey, DWORD dwFlags, HCRYPTHASH *phHash)
Definition: crypt.c:715
BOOL WINAPI CryptGetHashParam(HCRYPTHASH hHash, DWORD dwParam, BYTE *pbData, DWORD *pdwDataLen, DWORD dwFlags)
Definition: crypt.c:1584
BOOL WINAPI CryptDestroyHash(HCRYPTHASH hHash)
Definition: crypt.c:875
BOOL WINAPI CryptReleaseContext(HCRYPTPROV hProv, DWORD dwFlags)
Definition: crypt.c:641
BOOL WINAPI CryptHashData(HCRYPTHASH hHash, const BYTE *pbData, DWORD dwDataLen, DWORD dwFlags)
Definition: crypt.c:1745
BOOL WINAPI CryptAcquireContextW(HCRYPTPROV *phProv, LPCWSTR pszContainer, LPCWSTR pszProvider, DWORD dwProvType, DWORD dwFlags)
Definition: crypt.c:362
_ACRTIMP int __cdecl strcmp(const char *, const char *)
Definition: string.c:3324
return ret
Definition: mutex.c:147
unsigned int BOOL
Definition: ntddk_ex.h:94
const char hex_chars[]
Definition: gdb_send.c:11
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
static const struct @1952 hash_data[]
#define PROV_RSA_FULL
Definition: wincrypt.h:2243
#define CRYPT_VERIFYCONTEXT
Definition: wincrypt.h:2273
#define CALG_SHA1
Definition: wincrypt.h:2060
ULONG_PTR HCRYPTPROV
Definition: wincrypt.h:55
ULONG_PTR HCRYPTHASH
Definition: wincrypt.h:59
#define HP_HASHVAL
Definition: wincrypt.h:2387
ULONG bpp[]
Definition: xlate.c:19

Referenced by compare_surface(), and compare_wic_bitmap().

◆ compare_surface()

static BOOL compare_surface ( struct d2d1_test_context *  ctx,
const char *  ref_sha1 
)
static

Definition at line 880 of file d2d1.c.

881{
882 struct resource_readback rb;
883 BOOL ret;
884
886 ret = compare_sha1(rb.data, rb.pitch, 4, rb.width, rb.height, ref_sha1);
888
889 return ret;
890}
static BOOL compare_sha1(void *data, unsigned int pitch, unsigned int bpp, unsigned int w, unsigned int h, const char *ref_sha1)
Definition: d2d1.c:836

Referenced by test_alpha_mode(), test_bitmap_brush(), test_bitmap_updates(), test_clip(), test_color_brush(), test_image_brush(), test_opacity_brush(), and test_path_geometry().

◆ compare_uint()

static BOOL compare_uint ( unsigned int  x,
unsigned int  y,
unsigned int  max_diff 
)
static

Definition at line 778 of file d2d1.c.

779{
780 unsigned int diff = x > y ? x - y : y - x;
781
782 return diff <= max_diff;
783}

Referenced by compare_colour(), and compare_float().

◆ compare_wic_bitmap()

static BOOL compare_wic_bitmap ( IWICBitmap *  bitmap,
const char *  ref_sha1 
)
static

Definition at line 892 of file d2d1.c.

893{
896 BYTE *data;
897 HRESULT hr;
898 BOOL ret;
899
900 hr = IWICBitmap_Lock(bitmap, NULL, WICBitmapLockRead, &lock);
901 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
902
903 hr = IWICBitmapLock_GetDataPointer(lock, &buffer_size, &data);
904 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
905
906 hr = IWICBitmapLock_GetStride(lock, &stride);
907 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
908
909 hr = IWICBitmapLock_GetSize(lock, &width, &height);
910 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
911
912 ret = compare_sha1(data, stride, 4, width, height, ref_sha1);
913
914 IWICBitmapLock_Release(lock);
915
916 return ret;
917}
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
GLint GLint GLsizei width
Definition: gl.h:1546
GLsizei stride
Definition: glext.h:5848
wchar_t const *const size_t const buffer_size
Definition: stat.cpp:95
rwlock_t lock
Definition: tcpcore.h:0
@ WICBitmapLockRead
Definition: wincodec.idl:86

Referenced by test_wic_gdi_interop().

◆ create_custom_shader_effect()

static HRESULT create_custom_shader_effect ( IUnknown **  effect_impl,
const GUID *  pixel_shader,
const GUID *  vertex_shader,
const GUID *  vertex_buffer 
)
static

Definition at line 14701 of file d2d1.c.

14703{
14704 struct effect_impl *object;
14705
14706 if (!(object = calloc(1, sizeof(*object))))
14707 return E_OUTOFMEMORY;
14708
14709 object->ID2D1EffectImpl_iface.lpVtbl = &custom_effect_impl_vtbl;
14710 object->ID2D1DrawTransform_iface.lpVtbl = &custom_shader_effect_draw_transform_vtbl;
14711 object->refcount = 1;
14712 object->pixel_shader = pixel_shader;
14713 object->vertex_shader = vertex_shader;
14714 object->vertex_buffer = vertex_buffer;
14715
14716 *effect_impl = (IUnknown *)&object->ID2D1EffectImpl_iface;
14717 return S_OK;
14718}
static const ID2D1EffectImplVtbl custom_effect_impl_vtbl
Definition: d2d1.c:14588
static const ID2D1DrawTransformVtbl custom_shader_effect_draw_transform_vtbl
Definition: d2d1.c:14689
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define calloc
Definition: rosglue.h:14
const GUID * vertex_shader
Definition: d2d1.c:408
const GUID * vertex_buffer
Definition: d2d1.c:407
const GUID * pixel_shader
Definition: d2d1.c:409

Referenced by custom_effect_impl_create().

◆ create_d3d10_device()

static ID3D10Device1 * create_d3d10_device ( void  )
static

Definition at line 1112 of file d2d1.c.

1113{
1115
1118 return device;
1121 return device;
1124 return device;
1125
1126 return NULL;
1127}
@ D3D10_CREATE_DEVICE_BGRA_SUPPORT
Definition: d3d10.idl:995
const UINT D3D10_1_SDK_VERSION
Definition: d3d10_1.idl:150
@ D3D10_FEATURE_LEVEL_10_0
Definition: d3d10_1.idl:54
HRESULT WINAPI D3D10CreateDevice1(IDXGIAdapter *adapter, D3D10_DRIVER_TYPE driver_type, HMODULE swrast, UINT flags, D3D10_FEATURE_LEVEL1 hw_level, UINT sdk_version, ID3D10Device1 **device)
Definition: d3d10_1_main.c:182
@ D3D10_DRIVER_TYPE_REFERENCE
Definition: d3d10misc.h:30
@ D3D10_DRIVER_TYPE_HARDWARE
Definition: d3d10misc.h:29
@ D3D10_DRIVER_TYPE_WARP
Definition: d3d10misc.h:33

Referenced by create_device().

◆ create_d3d10_swapchain()

static IDXGISwapChain * create_d3d10_swapchain ( ID3D10Device1 *  device,
HWND  window,
BOOL  windowed 
)
static

Definition at line 1221 of file d2d1.c.

1222{
1223 IDXGISwapChain *swapchain;
1224 IDXGIDevice *dxgi_device;
1225 HRESULT hr;
1226
1227 hr = ID3D10Device1_QueryInterface(device, &IID_IDXGIDevice, (void **)&dxgi_device);
1228 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
1229 swapchain = create_swapchain(dxgi_device, window, windowed);
1230 IDXGIDevice_Release(dxgi_device);
1231 return swapchain;
1232}
static IDXGISwapChain * create_swapchain(IDXGIDevice *device, HWND window, BOOL windowed)
Definition: d2d1.c:1184
static IHTMLWindow2 * window
Definition: events.c:77

Referenced by test_max_bitmap_size().

◆ create_d3d11_device()

static ID3D11Device * create_d3d11_device ( void  )
static

Definition at line 1129 of file d2d1.c.

1130{
1132 ID3D11Device *device;
1133
1135 D3D11_CREATE_DEVICE_BGRA_SUPPORT, &level, 1, D3D11_SDK_VERSION, &device, NULL, NULL)))
1136 return device;
1138 D3D11_CREATE_DEVICE_BGRA_SUPPORT, &level, 1, D3D11_SDK_VERSION, &device, NULL, NULL)))
1139 return device;
1141 D3D11_CREATE_DEVICE_BGRA_SUPPORT, &level, 1, D3D11_SDK_VERSION, &device, NULL, NULL)))
1142 return device;
1143
1144 return NULL;
1145}
HRESULT WINAPI D3D11CreateDevice(IDXGIAdapter *adapter, D3D_DRIVER_TYPE driver_type, HMODULE swrast, UINT flags, const D3D_FEATURE_LEVEL *feature_levels, UINT levels, UINT sdk_version, ID3D11Device **device_out, D3D_FEATURE_LEVEL *obtained_feature_level, ID3D11DeviceContext **immediate_context)
Definition: d3d11_main.c:286
D3D_FEATURE_LEVEL
Definition: d3dcommon.idl:102
@ D3D_FEATURE_LEVEL_11_0
Definition: d3dcommon.idl:109
@ D3D_DRIVER_TYPE_HARDWARE
Definition: d3dcommon.idl:94
@ D3D_DRIVER_TYPE_REFERENCE
Definition: d3dcommon.idl:95
@ D3D_DRIVER_TYPE_WARP
Definition: d3dcommon.idl:98
GLint level
Definition: gl.h:1546

Referenced by create_device().

◆ create_device()

static IDXGIDevice * create_device ( BOOL  d3d11)
static

Definition at line 1147 of file d2d1.c.

1148{
1149 ID3D10Device1 *d3d10_device;
1150 ID3D11Device *d3d11_device;
1151 IDXGIDevice *device;
1152 HRESULT hr;
1153
1154 if (d3d11)
1155 {
1156 if (!(d3d11_device = create_d3d11_device()))
1157 return NULL;
1158 hr = ID3D11Device_QueryInterface(d3d11_device, &IID_IDXGIDevice, (void **)&device);
1159 ID3D11Device_Release(d3d11_device);
1160 }
1161 else
1162 {
1163 if (!(d3d10_device = create_d3d10_device()))
1164 return NULL;
1165 hr = ID3D10Device1_QueryInterface(d3d10_device, &IID_IDXGIDevice, (void **)&device);
1166 ID3D10Device1_Release(d3d10_device);
1167 }
1168
1169 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
1170
1171 return device;
1172}
static ID3D11Device * create_d3d11_device(void)
Definition: d2d1.c:1129
static ID3D10Device1 * create_d3d10_device(void)
Definition: d2d1.c:1112

◆ create_device_context()

static ID2D1DeviceContext * create_device_context ( ID2D1Factory1 *  factory,
IDXGIDevice *  dxgi_device,
BOOL  d3d11 
)
static

Definition at line 9866 of file d2d1.c.

9867{
9868 ID2D1DeviceContext *device_context;
9870 HRESULT hr;
9871
9872 hr = ID2D1Factory1_CreateDevice(factory, dxgi_device, &device);
9873 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
9874
9875 hr = ID2D1Device_CreateDeviceContext(device, D2D1_DEVICE_CONTEXT_OPTIONS_NONE, &device_context);
9876 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
9877 ID2D1Device_Release(device);
9878
9879 return device_context;
9880}
@ D2D1_DEVICE_CONTEXT_OPTIONS_NONE
Definition: d2d1_1.idl:40
Definition: main.c:439

Referenced by test_command_list(), and test_dpi().

◆ create_effect()

static void create_effect ( ID2D1DeviceContext *  device_context,
const GUID *  id,
ID2D1EffectContext **  effect_context,
ID2D1Effect **  effect 
)
static

Definition at line 14945 of file d2d1.c.

14947{
14948 HRESULT hr;
14949
14950 hr = ID2D1DeviceContext_CreateEffect(device_context, id, effect);
14951 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
14952
14953 if (effect_context)
14954 {
14955 *effect_context = NULL;
14956 hr = ID2D1Effect_GetValueByName(*effect, L"Context", D2D1_PROPERTY_TYPE_IUNKNOWN,
14957 (BYTE *)effect_context, sizeof*(effect_context));
14958 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
14959 }
14960}
@ D2D1_PROPERTY_TYPE_IUNKNOWN
Definition: d2d1_1.idl:175

Referenced by test_effect_vertex_buffer().

◆ create_render_target()

static ID2D1RenderTarget * create_render_target ( IDXGISurface *  surface,
BOOL  d3d11,
D2D1_FACTORY_TYPE  factory_type 
)
static

Definition at line 1250 of file d2d1.c.

1251{
1253
1255 desc.pixelFormat.format = DXGI_FORMAT_UNKNOWN;
1256 desc.pixelFormat.alphaMode = D2D1_ALPHA_MODE_PREMULTIPLIED;
1257 desc.dpiX = 0.0f;
1258 desc.dpiY = 0.0f;
1261
1262 return create_render_target_desc(surface, &desc, d3d11, factory_type);
1263}
static ID2D1RenderTarget * create_render_target_desc(IDXGISurface *surface, const D2D1_RENDER_TARGET_PROPERTIES *desc, BOOL d3d11, D2D1_FACTORY_TYPE factory_type)
Definition: d2d1.c:1234
@ D2D1_FEATURE_LEVEL_DEFAULT
Definition: d2d1.idl:269
@ D2D1_RENDER_TARGET_TYPE_DEFAULT
Definition: d2d1.idl:253
@ D2D1_RENDER_TARGET_USAGE_NONE
Definition: d2d1.idl:261
@ DXGI_FORMAT_UNKNOWN
Definition: dxgiformat.idl:23
factory_type
Definition: factory.h:22

Referenced by init_test_context_().

◆ create_render_target_desc()

static ID2D1RenderTarget * create_render_target_desc ( IDXGISurface *  surface,
const D2D1_RENDER_TARGET_PROPERTIES *  desc,
BOOL  d3d11,
D2D1_FACTORY_TYPE  factory_type 
)
static

Definition at line 1234 of file d2d1.c.

1236{
1237 ID2D1RenderTarget *render_target;
1239 HRESULT hr;
1240
1241 hr = D2D1CreateFactory(factory_type, &IID_ID2D1Factory, NULL, (void **)&factory);
1242 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
1243 hr = ID2D1Factory_CreateDxgiSurfaceRenderTarget(factory, surface, desc, &render_target);
1244 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
1245 ID2D1Factory_Release(factory);
1246
1247 return render_target;
1248}
HRESULT WINAPI D2D1CreateFactory(D2D1_FACTORY_TYPE factory_type, REFIID iid, const D2D1_FACTORY_OPTIONS *factory_options, void **factory)
Definition: factory.c:1363

Referenced by create_render_target(), and test_alpha_mode().

◆ create_surface()

static IDXGISurface * create_surface ( IDXGIDevice *  dxgi_device,
unsigned int  width,
unsigned int  height,
unsigned int  bind_flags,
unsigned int  misc_flags,
DXGI_FORMAT  format 
)
static

Definition at line 6442 of file d2d1.c.

6444{
6445 D3D10_TEXTURE2D_DESC texture_desc;
6448 IDXGISurface *surface;
6449 HRESULT hr;
6450
6451 texture_desc.Width = width;
6452 texture_desc.Height = height;
6453 texture_desc.MipLevels = 1;
6454 texture_desc.ArraySize = 1;
6455 texture_desc.Format = format;
6456 texture_desc.SampleDesc.Count = 1;
6457 texture_desc.SampleDesc.Quality = 0;
6458 texture_desc.Usage = D3D10_USAGE_DEFAULT;
6459 texture_desc.BindFlags = bind_flags;
6460 texture_desc.CPUAccessFlags = 0;
6461 texture_desc.MiscFlags = misc_flags;
6462
6463 hr = IDXGIDevice_QueryInterface(dxgi_device, &IID_ID3D10Device, (void **)&d3d_device);
6464 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
6465
6466 hr = ID3D10Device_CreateTexture2D(d3d_device, &texture_desc, NULL, &texture);
6467 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
6468
6469 hr = ID3D10Texture2D_QueryInterface(texture, &IID_IDXGISurface, (void **)&surface);
6470 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
6471
6472 ID3D10Device_Release(d3d_device);
6473 ID3D10Texture2D_Release(texture);
6474
6475 return surface;
6476}
@ D3D10_USAGE_DEFAULT
Definition: d3d10.idl:461
DXGI_FORMAT Format
Definition: d3d10.idl:550
DXGI_SAMPLE_DESC SampleDesc
Definition: d3d10.idl:551
D3D10_USAGE Usage
Definition: d3d10.idl:552

Referenced by test_bitmap_surface(), and test_dxgi_surface_target_gdi_interop().

◆ create_swapchain()

static IDXGISwapChain * create_swapchain ( IDXGIDevice *  device,
HWND  window,
BOOL  windowed 
)
static

Definition at line 1184 of file d2d1.c.

1185{
1186 IDXGISwapChain *swapchain;
1190 HRESULT hr;
1191
1192 hr = IDXGIDevice_GetAdapter(device, &adapter);
1193 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
1194 hr = IDXGIAdapter_GetParent(adapter, &IID_IDXGIFactory, (void **)&factory);
1195 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
1196 IDXGIAdapter_Release(adapter);
1197
1198 desc.BufferDesc.Width = 640;
1199 desc.BufferDesc.Height = 480;
1200 desc.BufferDesc.RefreshRate.Numerator = 60;
1201 desc.BufferDesc.RefreshRate.Denominator = 1;
1202 desc.BufferDesc.Format = DXGI_FORMAT_B8G8R8A8_UNORM;
1203 desc.BufferDesc.ScanlineOrdering = DXGI_MODE_SCANLINE_ORDER_UNSPECIFIED;
1204 desc.BufferDesc.Scaling = DXGI_MODE_SCALING_UNSPECIFIED;
1205 desc.SampleDesc.Count = 1;
1206 desc.SampleDesc.Quality = 0;
1208 desc.BufferCount = 1;
1209 desc.OutputWindow = window;
1210 desc.Windowed = windowed;
1211 desc.SwapEffect = DXGI_SWAP_EFFECT_DISCARD;
1212 desc.Flags = 0;
1213
1214 hr = IDXGIFactory_CreateSwapChain(factory, (IUnknown *)device, &desc, &swapchain);
1215 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
1216 IDXGIFactory_Release(factory);
1217
1218 return swapchain;
1219}
@ DXGI_SWAP_EFFECT_DISCARD
Definition: dxgi.idl:65
const DXGI_USAGE DXGI_USAGE_RENDER_TARGET_OUTPUT
Definition: dxgi.idl:44
@ DXGI_MODE_SCALING_UNSPECIFIED
Definition: dxgitype.idl:46
@ DXGI_MODE_SCANLINE_ORDER_UNSPECIFIED
Definition: dxgitype.idl:38
return adapter

Referenced by create_d3d10_swapchain(), init_test_context_(), and test_shared_bitmap().

◆ create_target_dibsection()

static void create_target_dibsection ( HDC  hdc,
UINT32  width,
UINT32  height 
)
static

Definition at line 5921 of file d2d1.c.

5922{
5923#ifdef _MSC_VER
5924 char bmibuf[FIELD_OFFSET(BITMAPINFO, bmiColors) + 256 * sizeof(RGBQUAD)];
5925#else
5926 char bmibuf[FIELD_OFFSET(BITMAPINFO, bmiColors[256])];
5927#endif
5928 BITMAPINFO *bmi = (BITMAPINFO*)bmibuf;
5929 HBITMAP hbm;
5930
5931 memset(bmi, 0, sizeof(bmibuf));
5932 bmi->bmiHeader.biSize = sizeof(bmi->bmiHeader);
5933 bmi->bmiHeader.biHeight = -height;
5934 bmi->bmiHeader.biWidth = width;
5935 bmi->bmiHeader.biBitCount = 32;
5936 bmi->bmiHeader.biPlanes = 1;
5938
5940 ok(hbm != NULL, "Failed to create a dib section.\n");
5941
5943}
ULONG RGBQUAD
Definition: precomp.h:47
pKey DeleteObject()
HDC hdc
Definition: main.c:9
static HBITMAP
Definition: button.c:44
_In_ HBITMAP hbm
Definition: ntgdi.h:2804
#define memset(x, y, z)
Definition: compat.h:39
USHORT biBitCount
Definition: precomp.h:34
ULONG biCompression
Definition: precomp.h:35
BITMAPINFOHEADER bmiHeader
Definition: wingdi.h:1922
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255
#define BI_RGB
Definition: uefivid.c:46
HBITMAP WINAPI CreateDIBSection(HDC hDC, CONST BITMAPINFO *BitmapInfo, UINT Usage, VOID **Bits, HANDLE hSection, DWORD dwOffset)
Definition: bitmap.c:245
#define DIB_RGB_COLORS
Definition: wingdi.h:367
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1546

Referenced by test_dc_target(), test_dc_target_gdi_interop(), and test_device_context().

◆ create_window()

static HWND create_window ( void  )
static

Definition at line 1174 of file d2d1.c.

1175{
1176 RECT r = {0, 0, 640, 480};
1177
1179
1180 return CreateWindowA("static", "d2d1_test", WS_OVERLAPPEDWINDOW | WS_VISIBLE,
1181 0, 0, r.right - r.left, r.bottom - r.top, NULL, NULL, NULL, NULL);
1182}
#define FALSE
Definition: types.h:117
#define WS_OVERLAPPEDWINDOW
Definition: pedump.c:637
#define WS_VISIBLE
Definition: pedump.c:620
BOOL WINAPI AdjustWindowRect(_Inout_ LPRECT, _In_ DWORD, _In_ BOOL)
#define CreateWindowA(a, b, c, d, e, f, g, h, i, j, k)
Definition: winuser.h:4469
Definition: dcommon.idl:28

Referenced by init_test_context_(), test_hwnd_target_gdi_interop(), test_hwnd_target_is_supported(), test_max_bitmap_size(), and test_shared_bitmap().

◆ cubic_to()

static void cubic_to ( ID2D1GeometrySink *  sink,
float  x1,
float  y1,
float  x2,
float  y2,
float  x3,
float  y3 
)
static

Definition at line 630 of file d2d1.c.

631{
633
634 b.point1.x = x1;
635 b.point1.y = y1;
636 b.point2.x = x2;
637 b.point2.y = y2;
638 b.point3.x = x3;
639 b.point3.y = y3;
640 ID2D1GeometrySink_AddBezier(sink, &b);
641}
GLsizei GLenum GLboolean sink
Definition: glext.h:5672
#define b
Definition: ke_i.h:79

Referenced by test_bezier_intersect(), and test_stroke_contains_point().

◆ custom_effect_impl_create()

static HRESULT STDMETHODCALLTYPE custom_effect_impl_create ( IUnknown **  effect_impl)
static

Definition at line 14720 of file d2d1.c.

14721{
14722 return create_custom_shader_effect(effect_impl, &GUID_TestPixelShader, NULL, NULL);
14723}
static HRESULT create_custom_shader_effect(IUnknown **effect_impl, const GUID *pixel_shader, const GUID *vertex_shader, const GUID *vertex_buffer)
Definition: d2d1.c:14701

Referenced by test_effect_custom_pixel_shader().

◆ D2D1_COLOR_F()

static D2D1_COLOR_F ( WINAPI *  pD2D1ConvertColorSpace)
static

◆ DEFINE_GUID() [1/6]

DEFINE_GUID ( CLSID_AuxEffect  ,
0xb9ee12e9  ,
0x32d9  ,
0xe659  ,
0xac  ,
0x61  ,
0x2d  ,
0x7c  ,
0xea  ,
0x69  ,
0x28  ,
0x79   
)

◆ DEFINE_GUID() [2/6]

DEFINE_GUID ( CLSID_TestEffect  ,
0xb9ee12e9  ,
0x32d9  ,
0xe659  ,
0xac  ,
0x61  ,
0x2d  ,
0x7c  ,
0xea  ,
0x69  ,
0x28  ,
0x78   
)

◆ DEFINE_GUID() [3/6]

DEFINE_GUID ( CLSID_TestEffect2  ,
0xb9ee12e9  ,
0x32d9  ,
0xe659  ,
0xac  ,
0x61  ,
0x2d  ,
0x7c  ,
0xea  ,
0x69  ,
0x28  ,
0x79   
)

◆ DEFINE_GUID() [4/6]

DEFINE_GUID ( GUID_CustomVertexBuffer  ,
0x53015748  ,
0xfc13  ,
0x4168  ,
0xbd  ,
0x13  ,
0x0f  ,
0xcf  ,
0x15  ,
0x29  ,
0x7f  ,
0x02   
)

◆ DEFINE_GUID() [5/6]

DEFINE_GUID ( GUID_TestPixelShader  ,
0x53015748  ,
0xfc13  ,
0x4168  ,
0xbd  ,
0x13  ,
0x0f  ,
0xcf  ,
0x15  ,
0x29  ,
0x7f  ,
0x01   
)

◆ DEFINE_GUID() [6/6]

DEFINE_GUID ( GUID_TestVertexShader  ,
0x5bcdcfae  ,
0x1e92  ,
0x4dc1  ,
0x94  ,
0xfa  ,
0x3b  ,
0x01  ,
0xca  ,
0x54  ,
0x59  ,
0x20   
)

◆ deserialize_figure()

static void deserialize_figure ( struct figure *  figure,
const BYTE *  s 
)
static

Definition at line 994 of file d2d1.c.

995{
996 static const BYTE lookup[] =
997 {
998 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
999 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
1000 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3e, 0xff, 0xff, 0xff, 0x3f,
1001 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
1002 0xff, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e,
1003 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0xff, 0xff, 0xff, 0xff, 0xff,
1004 0xff, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28,
1005 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, 0x30, 0x31, 0x32, 0x33, 0xff, 0xff, 0xff, 0xff, 0xff,
1006 };
1007 unsigned int current = 0, shift = 0;
1008 const BYTE *ptr;
1009 BYTE x, y;
1010
1011 figure->span_count = 0;
1012 figure->spans_size = 64;
1014
1015 for (ptr = s; *ptr; ptr += 4)
1016 {
1017 x = lookup[ptr[0]];
1018 y = lookup[ptr[1]];
1019 deserialize_span(figure, &current, &shift, ((x & 0x3f) << 2) | ((y & 0x3f) >> 4));
1020 x = lookup[ptr[2]];
1021 deserialize_span(figure, &current, &shift, ((y & 0x0f) << 4) | ((x & 0x3f) >> 2));
1022 y = lookup[ptr[3]];
1023 deserialize_span(figure, &current, &shift, ((x & 0x03) << 6) | (y & 0x3f));
1024 }
1025}
static void deserialize_span(struct figure *figure, unsigned int *current, unsigned int *shift, unsigned int c)
Definition: d2d1.c:979
GLdouble s
Definition: gl.h:2039
struct task_struct * current
Definition: linux.c:32
#define shift
Definition: input.c:3280

Referenced by compare_figure().

◆ deserialize_span()

static void deserialize_span ( struct figure *  figure,
unsigned int *  current,
unsigned int *  shift,
unsigned int  c 
)
static

Definition at line 979 of file d2d1.c.

980{
981 *current |= (c & 0x7f) << *shift;
982 if (c & 0x80)
983 {
984 *shift += 7;
985 return;
986 }
987
988 if (*current)
990 *current = 0;
991 *shift = 0;
992}
const GLubyte * c
Definition: glext.h:8905

Referenced by deserialize_figure().

◆ effect_impl_AddRef()

static ULONG STDMETHODCALLTYPE effect_impl_AddRef ( ID2D1EffectImpl *  iface)
static

Definition at line 11214 of file d2d1.c.

11215{
11218 return refcount;
11219}
#define InterlockedIncrement
Definition: armddk.h:53
static struct effect_impl * impl_from_ID2D1EffectImpl(ID2D1EffectImpl *iface)
Definition: d2d1.c:11180
LONG refcount
Definition: d2d1.c:396
uint32_t ULONG
Definition: typedefs.h:59

◆ effect_impl_create()

static HRESULT STDMETHODCALLTYPE effect_impl_create ( IUnknown **  effect_impl)
static

Definition at line 11273 of file d2d1.c.

11274{
11275 struct effect_impl *object;
11276
11277 if (!(object = calloc(1, sizeof(*object))))
11278 return E_OUTOFMEMORY;
11279
11280 object->ID2D1EffectImpl_iface.lpVtbl = &effect_impl_vtbl;
11281 object->refcount = 1;
11282 object->integer = 10;
11283 object->effect_context = NULL;
11284 object->transform_graph = NULL;
11285
11286 *effect_impl = (IUnknown *)&object->ID2D1EffectImpl_iface;
11287 return S_OK;
11288}
static const ID2D1EffectImplVtbl effect_impl_vtbl
Definition: d2d1.c:11263

Referenced by preload_shader(), test_blend_transform(), test_border_transform(), test_bounds_adjustment_transform(), test_effect_blob_property(), test_effect_context(), test_effect_properties(), test_effect_register(), test_effect_vertex_buffer(), test_offset_transform(), test_registered_effects(), and test_transform_graph().

◆ effect_impl_draw_transform_AddRef()

static ULONG STDMETHODCALLTYPE effect_impl_draw_transform_AddRef ( ID2D1DrawTransform *  iface)
static

Definition at line 14605 of file d2d1.c.

14606{
14608 return ID2D1EffectImpl_AddRef(&effect_impl->ID2D1EffectImpl_iface);
14609}
static struct effect_impl * impl_from_ID2D1DrawTransform(ID2D1DrawTransform *iface)
Definition: d2d1.c:11185
ID2D1EffectImpl ID2D1EffectImpl_iface
Definition: d2d1.c:394

◆ effect_impl_draw_transform_GetInputCount()

static UINT32 STDMETHODCALLTYPE effect_impl_draw_transform_GetInputCount ( ID2D1DrawTransform *  iface)
static

Definition at line 14617 of file d2d1.c.

14618{
14619 return 1;
14620}

◆ effect_impl_draw_transform_MapInputRectsToOutputRect()

static HRESULT STDMETHODCALLTYPE effect_impl_draw_transform_MapInputRectsToOutputRect ( ID2D1DrawTransform *  iface,
const D2D1_RECT_L *  input_rects,
const D2D1_RECT_L *  input_opaque_rects,
UINT32  input_rect_count,
D2D1_RECT_L *  output_rect,
D2D1_RECT_L *  output_opaque_rect 
)
static

Definition at line 14633 of file d2d1.c.

14636{
14637 if (input_rect_count != 1)
14638 return E_INVALIDARG;
14639
14640 *output_rect = input_rects[0];
14641 memset(output_opaque_rect, 0, sizeof(*output_opaque_rect));
14642
14643 return S_OK;
14644}
#define E_INVALIDARG
Definition: ddrawi.h:101

◆ effect_impl_draw_transform_MapInvalidRect()

static HRESULT STDMETHODCALLTYPE effect_impl_draw_transform_MapInvalidRect ( ID2D1DrawTransform *  iface,
UINT32  index,
D2D1_RECT_L  input_rect,
D2D1_RECT_L *  output_rect 
)
static

Definition at line 14646 of file d2d1.c.

14648{
14649 ok(0, "Unexpected call.\n");
14650 return E_NOTIMPL;
14651}
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ effect_impl_draw_transform_MapOutputRectToInputRects()

static HRESULT STDMETHODCALLTYPE effect_impl_draw_transform_MapOutputRectToInputRects ( ID2D1DrawTransform *  iface,
const D2D1_RECT_L *  output_rect,
D2D1_RECT_L *  input_rects,
UINT32  input_rect_count 
)
static

Definition at line 14622 of file d2d1.c.

14625{
14626 if (input_rect_count != 1)
14627 return E_INVALIDARG;
14628
14629 input_rects[0] = *output_rect;
14630 return S_OK;
14631}

◆ effect_impl_draw_transform_QueryInterface()

static HRESULT STDMETHODCALLTYPE effect_impl_draw_transform_QueryInterface ( ID2D1DrawTransform *  iface,
REFIID  iid,
void **  out 
)
static

Definition at line 14598 of file d2d1.c.

14600{
14602 return ID2D1EffectImpl_QueryInterface(&effect_impl->ID2D1EffectImpl_iface, iid, out);
14603}
wchar_t tm const _CrtWcstime_Writes_and_advances_ptr_ count wchar_t ** out
Definition: wcsftime.cpp:383

◆ effect_impl_draw_transform_Release()

static ULONG STDMETHODCALLTYPE effect_impl_draw_transform_Release ( ID2D1DrawTransform *  iface)
static

Definition at line 14611 of file d2d1.c.

14612{
14614 return ID2D1EffectImpl_Release(&effect_impl->ID2D1EffectImpl_iface);
14615}

◆ effect_impl_draw_transform_SetDrawInfo()

static HRESULT STDMETHODCALLTYPE effect_impl_draw_transform_SetDrawInfo ( ID2D1DrawTransform *  iface,
ID2D1DrawInfo *  info 
)
static

Definition at line 14653 of file d2d1.c.

14655{
14658 HRESULT hr = S_OK;
14660
14662 check_interface(info, &IID_ID2D1RenderInfo, TRUE);
14663 check_interface(info, &IID_ID2D1EffectContext, FALSE);
14664
14666 ok(refcount == 1, "Unexpected refcount %lu.\n", refcount);
14667
14669 hr = ID2D1DrawInfo_SetPixelShader(info, effect_impl->pixel_shader, 0);
14670
14672 {
14674 {
14675 hr = ID2D1EffectContext_FindVertexBuffer(effect_impl->effect_context,
14677 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
14678 }
14679
14680 hr = ID2D1DrawInfo_SetVertexProcessing(info, buffer, 0, NULL, NULL, effect_impl->vertex_shader);
14681 }
14682
14683 if (buffer)
14684 ID2D1VertexBuffer_Release(buffer);
14685
14686 return hr;
14687}
const GUID IID_IUnknown
static ULONG get_refcount(void *iface)
Definition: d2d1.c:44
#define check_interface(a, b, c)
Definition: d2d1.c:51
#define TRUE
Definition: types.h:120
ID2D1EffectContext * effect_context
Definition: d2d1.c:398

◆ effect_impl_get_blob()

static HRESULT STDMETHODCALLTYPE effect_impl_get_blob ( const IUnknown *  iface,
BYTE *  data,
UINT32  data_size,
UINT32 *  actual_size 
)
static

Definition at line 11334 of file d2d1.c.

11336{
11338
11339 if (actual_size)
11340 *actual_size = effect_impl->blob.size;
11341
11342 if (!data)
11343 return S_OK;
11344
11345 if (data_size != effect_impl->blob.size)
11346 return E_INVALIDARG;
11347
11348 memcpy(data, effect_impl->blob.data, data_size);
11349
11350 return S_OK;
11351}
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
struct effect_impl::@1913 blob

Referenced by test_effect_blob_property().

◆ effect_impl_get_context()

static HRESULT STDMETHODCALLTYPE effect_impl_get_context ( const IUnknown *  iface,
BYTE *  data,
UINT32  data_size,
UINT32 *  actual_size 
)
static

◆ effect_impl_get_graph()

static HRESULT STDMETHODCALLTYPE effect_impl_get_graph ( const IUnknown *  iface,
BYTE *  data,
UINT32  data_size,
UINT32 *  actual_size 
)
static

Definition at line 11368 of file d2d1.c.

11370{
11372
11373 if (!data)
11374 return E_INVALIDARG;
11375
11377 if (actual_size)
11378 *actual_size = sizeof(effect_impl->transform_graph);
11379
11380 return S_OK;
11381}
ID2D1TransformGraph * transform_graph
Definition: d2d1.c:399

Referenced by test_effect_register(), and test_transform_graph().

◆ effect_impl_get_integer()

static HRESULT STDMETHODCALLTYPE effect_impl_get_integer ( const IUnknown *  iface,
BYTE *  data,
UINT32  data_size,
UINT32 *  actual_size 
)
static

Definition at line 11302 of file d2d1.c.

11304{
11306
11307 if (!data)
11308 return E_INVALIDARG;
11309
11310 *((UINT *)data) = effect_impl->integer;
11311 if (actual_size)
11312 *actual_size = sizeof(effect_impl->integer);
11313
11314 return S_OK;
11315}
UINT integer
Definition: d2d1.c:397

Referenced by test_effect_properties(), and test_effect_register().

◆ effect_impl_Initialize()

static HRESULT STDMETHODCALLTYPE effect_impl_Initialize ( ID2D1EffectImpl *  iface,
ID2D1EffectContext *  context,
ID2D1TransformGraph *  graph 
)
static

Definition at line 11239 of file d2d1.c.

11241{
11243 ID2D1EffectContext_AddRef(effect_impl->effect_context = context);
11244 ID2D1TransformGraph_AddRef(effect_impl->transform_graph = graph);
11245 return S_OK;
11246}
Definition: graph.c:32

◆ effect_impl_PrepareForRender()

static HRESULT STDMETHODCALLTYPE effect_impl_PrepareForRender ( ID2D1EffectImpl *  iface,
D2D1_CHANGE_TYPE  type 
)
static

Definition at line 11248 of file d2d1.c.

11249{
11250 return S_OK;
11251}

◆ effect_impl_QueryInterface()

static HRESULT STDMETHODCALLTYPE effect_impl_QueryInterface ( ID2D1EffectImpl *  iface,
REFIID  iid,
void **  out 
)
static

Definition at line 11190 of file d2d1.c.

11191{
11193
11194 if (IsEqualGUID(iid, &IID_ID2D1EffectImpl)
11195 || IsEqualGUID(iid, &IID_IUnknown))
11196 {
11197 ID2D1EffectImpl_AddRef(iface);
11198 *out = iface;
11199 return S_OK;
11200 }
11201 else if (IsEqualGUID(iid, &IID_ID2D1DrawTransform)
11202 || IsEqualGUID(iid, &IID_ID2D1Transform)
11203 || IsEqualGUID(iid, &IID_ID2D1TransformNode))
11204 {
11205 ID2D1EffectImpl_AddRef(iface);
11207 return S_OK;
11208 }
11209
11210 *out = NULL;
11211 return E_NOINTERFACE;
11212}
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
ID2D1DrawTransform ID2D1DrawTransform_iface
Definition: d2d1.c:395

◆ effect_impl_Release()

static ULONG STDMETHODCALLTYPE effect_impl_Release ( ID2D1EffectImpl *  iface)
static

Definition at line 11221 of file d2d1.c.

11222{
11225
11226 if (!refcount)
11227 {
11229 ID2D1EffectContext_Release(effect_impl->effect_context);
11231 ID2D1DrawInfo_Release(effect_impl->draw_info);
11232 free(effect_impl->blob.data);
11234 }
11235
11236 return refcount;
11237}
#define InterlockedDecrement
Definition: armddk.h:52
#define free
Definition: debug_ros.c:5
ID2D1DrawInfo * draw_info
Definition: d2d1.c:400

◆ effect_impl_set_blob()

static HRESULT STDMETHODCALLTYPE effect_impl_set_blob ( IUnknown *  iface,
const BYTE *  data,
UINT32  data_size 
)
static

Definition at line 11317 of file d2d1.c.

11319{
11321
11322 free(effect_impl->blob.data);
11323 effect_impl->blob.data = NULL;
11324 effect_impl->blob.size = 0;
11325
11326 if (!(effect_impl->blob.data = malloc(data_size)))
11327 return E_OUTOFMEMORY;
11328 memcpy(effect_impl->blob.data, data, data_size);
11329 effect_impl->blob.size = data_size;
11330
11331 return S_OK;
11332}
#define malloc
Definition: debug_ros.c:4

Referenced by test_effect_blob_property().

◆ effect_impl_set_integer()

static HRESULT STDMETHODCALLTYPE effect_impl_set_integer ( IUnknown *  iface,
const BYTE *  data,
UINT32  data_size 
)
static

Definition at line 11290 of file d2d1.c.

11291{
11293
11294 if (!data)
11295 return E_INVALIDARG;
11296
11297 effect_impl->integer = *((UINT *)data);
11298
11299 return S_OK;
11300}

Referenced by test_effect_properties(), and test_effect_register().

◆ effect_impl_SetGraph()

static HRESULT STDMETHODCALLTYPE effect_impl_SetGraph ( ID2D1EffectImpl *  iface,
ID2D1TransformGraph *  graph 
)
static

Definition at line 11253 of file d2d1.c.

11254{
11256
11257 ID2D1TransformGraph_Release(effect_impl->transform_graph);
11258 ID2D1TransformGraph_AddRef(effect_impl->transform_graph = graph);
11259
11260 return S_OK;
11261}

◆ figure_add_span()

static void figure_add_span ( struct figure *  figure,
unsigned int  span 
)
static

Definition at line 967 of file d2d1.c.

968{
970 {
971 figure->spans_size *= 2;
973 figure->spans_size * sizeof(*figure->spans));
974 }
975
977}
#define HeapReAlloc
Definition: compat.h:734

Referenced by compare_figure(), deserialize_span(), and read_figure().

◆ fill_geometry_sink()

static void fill_geometry_sink ( ID2D1GeometrySink *  sink,
unsigned int  hollow_count 
)
static

Definition at line 3180 of file d2d1.c.

3181{
3182 D2D1_FIGURE_BEGIN begin;
3183 unsigned int idx = 0;
3185
3186 set_point(&point, 15.0f, 20.0f);
3187 begin = idx++ < hollow_count ? D2D1_FIGURE_BEGIN_HOLLOW : D2D1_FIGURE_BEGIN_FILLED;
3188 ID2D1GeometrySink_BeginFigure(sink, point, begin);
3189 line_to(sink, 55.0f, 20.0f);
3190 line_to(sink, 55.0f, 220.0f);
3191 line_to(sink, 25.0f, 220.0f);
3192 line_to(sink, 25.0f, 100.0f);
3193 line_to(sink, 75.0f, 100.0f);
3194 line_to(sink, 75.0f, 300.0f);
3195 line_to(sink, 5.0f, 300.0f);
3196 line_to(sink, 5.0f, 60.0f);
3197 line_to(sink, 45.0f, 60.0f);
3198 line_to(sink, 45.0f, 180.0f);
3199 line_to(sink, 35.0f, 180.0f);
3200 line_to(sink, 35.0f, 140.0f);
3201 line_to(sink, 65.0f, 140.0f);
3202 line_to(sink, 65.0f, 260.0f);
3203 line_to(sink, 15.0f, 260.0f);
3204 ID2D1GeometrySink_EndFigure(sink, D2D1_FIGURE_END_CLOSED);
3205
3206 set_point(&point, 155.0f, 300.0f);
3207 begin = idx++ < hollow_count ? D2D1_FIGURE_BEGIN_HOLLOW : D2D1_FIGURE_BEGIN_FILLED;
3208 ID2D1GeometrySink_BeginFigure(sink, point, begin);
3209 line_to(sink, 155.0f, 160.0f);
3210 line_to(sink, 85.0f, 160.0f);
3211 line_to(sink, 85.0f, 300.0f);
3212 line_to(sink, 120.0f, 300.0f);
3213 line_to(sink, 120.0f, 20.0f);
3214 line_to(sink, 155.0f, 20.0f);
3215 line_to(sink, 155.0f, 160.0f);
3216 line_to(sink, 85.0f, 160.0f);
3217 line_to(sink, 85.0f, 20.0f);
3218 line_to(sink, 120.0f, 20.0f);
3219 line_to(sink, 120.0f, 300.0f);
3220 ID2D1GeometrySink_EndFigure(sink, D2D1_FIGURE_END_CLOSED);
3221
3222 set_point(&point, 165.0f, 20.0f);
3223 begin = idx++ < hollow_count ? D2D1_FIGURE_BEGIN_HOLLOW : D2D1_FIGURE_BEGIN_FILLED;
3224 ID2D1GeometrySink_BeginFigure(sink, point, begin);
3225 line_to(sink, 165.0f, 300.0f);
3226 line_to(sink, 235.0f, 300.0f);
3227 line_to(sink, 235.0f, 20.0f);
3228 ID2D1GeometrySink_EndFigure(sink, D2D1_FIGURE_END_CLOSED);
3229 set_point(&point, 225.0f, 60.0f);
3230 begin = idx++ < hollow_count ? D2D1_FIGURE_BEGIN_HOLLOW : D2D1_FIGURE_BEGIN_FILLED;
3231 ID2D1GeometrySink_BeginFigure(sink, point, begin);
3232 line_to(sink, 225.0f, 260.0f);
3233 line_to(sink, 175.0f, 260.0f);
3234 line_to(sink, 175.0f, 60.0f);
3235 ID2D1GeometrySink_EndFigure(sink, D2D1_FIGURE_END_CLOSED);
3236 set_point(&point, 215.0f, 220.0f);
3237 begin = idx++ < hollow_count ? D2D1_FIGURE_BEGIN_HOLLOW : D2D1_FIGURE_BEGIN_FILLED;
3238 ID2D1GeometrySink_BeginFigure(sink, point, begin);
3239 line_to(sink, 185.0f, 220.0f);
3240 line_to(sink, 185.0f, 100.0f);
3241 line_to(sink, 215.0f, 100.0f);
3242 ID2D1GeometrySink_EndFigure(sink, D2D1_FIGURE_END_CLOSED);
3243 set_point(&point, 195.0f, 180.0f);
3244 begin = idx++ < hollow_count ? D2D1_FIGURE_BEGIN_HOLLOW : D2D1_FIGURE_BEGIN_FILLED;
3245 ID2D1GeometrySink_BeginFigure(sink, point, begin);
3246 line_to(sink, 205.0f, 180.0f);
3247 line_to(sink, 205.0f, 140.0f);
3248 line_to(sink, 195.0f, 140.0f);
3249 ID2D1GeometrySink_EndFigure(sink, D2D1_FIGURE_END_CLOSED);
3250}
static void set_point(D2D1_POINT_2F *point, float x, float y)
Definition: d2d1.c:481
static void line_to(ID2D1GeometrySink *sink, float x, float y)
Definition: d2d1.c:614
D2D1_FIGURE_BEGIN
Definition: d2d1.idl:99
@ D2D1_FIGURE_BEGIN_HOLLOW
Definition: d2d1.idl:101
@ D2D1_FIGURE_BEGIN_FILLED
Definition: d2d1.idl:100
@ D2D1_FIGURE_END_CLOSED
Definition: d2d1.idl:108
unsigned int idx
Definition: utils.c:40

Referenced by test_path_geometry().

◆ fill_geometry_sink_bezier()

static void fill_geometry_sink_bezier ( ID2D1GeometrySink *  sink,
unsigned int  hollow_count 
)
static

Definition at line 3252 of file d2d1.c.

3253{
3254 D2D1_FIGURE_BEGIN begin;
3255 unsigned int idx = 0;
3257
3258 set_point(&point, 5.0f, 160.0f);
3259 begin = idx++ < hollow_count ? D2D1_FIGURE_BEGIN_HOLLOW : D2D1_FIGURE_BEGIN_FILLED;
3260 ID2D1GeometrySink_BeginFigure(sink, point, begin);
3261 quadratic_to(sink, 40.0f, 160.0f, 40.0f, 20.0f);
3262 quadratic_to(sink, 40.0f, 160.0f, 75.0f, 160.0f);
3263 quadratic_to(sink, 40.0f, 160.0f, 40.0f, 300.0f);
3264 quadratic_to(sink, 40.0f, 160.0f, 5.0f, 160.0f);
3265 ID2D1GeometrySink_EndFigure(sink, D2D1_FIGURE_END_CLOSED);
3266
3267 set_point(&point, 20.0f, 160.0f);
3268 begin = idx++ < hollow_count ? D2D1_FIGURE_BEGIN_HOLLOW : D2D1_FIGURE_BEGIN_FILLED;
3269 ID2D1GeometrySink_BeginFigure(sink, point, begin);
3270 quadratic_to(sink, 20.0f, 80.0f, 40.0f, 80.0f);
3271 quadratic_to(sink, 60.0f, 80.0f, 60.0f, 160.0f);
3272 quadratic_to(sink, 60.0f, 240.0f, 40.0f, 240.0f);
3273 quadratic_to(sink, 20.0f, 240.0f, 20.0f, 160.0f);
3274 ID2D1GeometrySink_EndFigure(sink, D2D1_FIGURE_END_CLOSED);
3275
3276 set_point(&point, 5.0f, 612.0f);
3277 begin = idx++ < hollow_count ? D2D1_FIGURE_BEGIN_HOLLOW : D2D1_FIGURE_BEGIN_FILLED;
3278 ID2D1GeometrySink_BeginFigure(sink, point, begin);
3279 quadratic_to(sink, 40.0f, 612.0f, 40.0f, 752.0f);
3280 quadratic_to(sink, 40.0f, 612.0f, 75.0f, 612.0f);
3281 quadratic_to(sink, 40.0f, 612.0f, 40.0f, 472.0f);
3282 quadratic_to(sink, 40.0f, 612.0f, 5.0f, 612.0f);
3283 ID2D1GeometrySink_EndFigure(sink, D2D1_FIGURE_END_CLOSED);
3284
3285 set_point(&point, 20.0f, 612.0f);
3286 begin = idx++ < hollow_count ? D2D1_FIGURE_BEGIN_HOLLOW : D2D1_FIGURE_BEGIN_FILLED;
3287 ID2D1GeometrySink_BeginFigure(sink, point, begin);
3288 quadratic_to(sink, 20.0f, 692.0f, 40.0f, 692.0f);
3289 quadratic_to(sink, 60.0f, 692.0f, 60.0f, 612.0f);
3290 quadratic_to(sink, 60.0f, 532.0f, 40.0f, 532.0f);
3291 quadratic_to(sink, 20.0f, 532.0f, 20.0f, 612.0f);
3292 ID2D1GeometrySink_EndFigure(sink, D2D1_FIGURE_END_CLOSED);
3293}
static void quadratic_to(ID2D1GeometrySink *sink, float x1, float y1, float x2, float y2)
Definition: d2d1.c:622

Referenced by test_path_geometry().

◆ float()

static float ( WINAPI *  pD2D1Tan)
static

Referenced by __string_to_float(), _TIFFVSetField(), basetype_arg_size(), calc_wheel_change(), CMultimediaBackend::CalculateSteps(), color_to_float(), ComplexMarshall(), ComplexUnmarshall(), conv_s16_to_f32(), convert_fixed_to_float(), d3d10_effect_parse_stream_output_declaration(), d3drm_viewport2_Init(), d3dx9_sprite_Flush(), d3dx_set_shader_const_state(), D3DXCreateTextW(), dct64_altivec(), ddraw_surface_blt_clipped(), depthbias(), BtrfsRecv::do_recv(), DoLoadImageFile(), DrawBackgroundPreview(), EDIT_BuildLineDefs_ML(), EmbeddedComplexSize(), empty_image(), emptyImage3D(), extract1010102(), extract1555rev(), extract2101010rev(), extract233rev(), extract332(), extract4444(), extract4444rev(), extract5551(), extract565(), extract565rev(), extract8888(), extract8888rev(), float_16_to_32(), float_24_to_32(), fontface_get_scaled_design_advance(), for(), format_size(), format_to_d3dx_color(), fromfixedpoint(), audio_membuffer::fseconds_recorded(), audio_membuffer::fseconds_total(), get_fx_4_type_size(), gl_Accum(), gl_clear_accum_buffer(), gluCylinder(), gluPartialDisk(), halve1Dimage_int(), halve1DimagePackedPixel(), halveImage_int(), halveImagePackedPixel(), halveImagePackedPixel3D(), halveImagePackedPixelSlice(), init_font_prop_vec(), InitGL(), InitializeImage(), isInRefBlackWhiteRange(), linear_vari_process(), LISTBOX_HandleMouseWheel(), hashtable< _Val, _Key, _HF, _Traits, _ExK, _EqK, _All >::load_factor(), metafile_get_pen_brush_data_offset(), METAFILE_PlaybackObject(), modff(), NdrBaseTypeMemorySize(), normalize(), number_from_string(), number_with_units(), audio_resampler_acm::open(), pack_strided_data(), CAppScrnshotPreview::PaintOnDC(), parse_fx10_property_assignment(), parse_fx10_set_default_numeric_value(), parse_new_id3(), parse_skin_weights_info(), process_comment(), process_extra(), __crt_stdio_input::input_processor< Character, InputAdapter >::process_floating_point_specifier(), process_vertices_strided(), rasterizer_state_from_wined3d(), BtrfsScrub::RefreshScrubDlg(), render(), CWineTest::RunTest(), audio_format::samples_in_seconds(), scale_internal(), scale_internal_byte(), scale_internal_float(), scale_internal_int(), scale_internal_short(), scale_internal_ubyte(), scale_internal_uint(), scale_internal_ushort(), scaleInternal3D(), scaleInternalPackedPixel(), ScreenSaverProc(), ScriptCPtoX(), ScriptXtoCP(), BtrfsPropSheet::set_size_on_disk(), shader_sm4_read_dcl_constant_buffer(), sinc_mono_vari_process(), src_int_to_float_array(), src_short_to_float_array(), START_TEST(), synth_1to1_altivec(), synth_1to1_fltst_altivec(), synth_1to1_real_altivec(), synth_1to1_s32_altivec(), synth_1to1_s32_stereo_altivec(), synth_1to1_stereo_altivec(), test_buffer(), test_buffer8(), test_compute_normals(), test_createtext(), test_D3DXFillTexture(), test_effect_parameter_value_GetMatrixPointerArray(), test_effect_parameter_value_GetMatrixTransposePointerArray(), test_EnumForms(), Test_exceptions(), test_propertybag_write(), test_ScCountProps(), test_UlPropSize(), texture2d_get_blt_info(), texture_shader_fill_2d(), texture_shader_fill_3d(), TIFFCIELab16ToXYZ(), TIFFCIELabToRGBInit(), TIFFDefaultRefBlackWhite(), TIFFReadDirEntryFloat(), TIFFReadDirEntryFloatArray(), __crt_stdio_input::to_floating_point_length(), UlPropSize(), units_to_twips(), update_filter(), update_preview_sizes(), BtrfsScrub::UpdateTextBox(), VarFix(), VARIANT_DataSize(), VarInt(), wave_generate_la(), wglUseFontOutlines_common(), wine_glFogi(), wine_glFogiv(), wined3d_clip_blit(), wined3d_get_flexible_vertex_size(), wined3d_shader_set_local_constants_float(), wmain(), write_fx_4_type(), and xsltParseStylesheetTemplate().

◆ geometry_figure_add_segment()

static struct geometry_segment * geometry_figure_add_segment ( struct geometry_figure *  figure)
static

Definition at line 1487 of file d2d1.c.

1488{
1489 if (figure->segment_count == figure->segments_size)
1490 {
1491 figure->segments_size *= 2;
1492 figure->segments = HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, figure->segments,
1493 figure->segments_size * sizeof(*figure->segments));
1494 }
1495 return &figure->segments[figure->segment_count++];
1496}
#define HEAP_ZERO_MEMORY
Definition: compat.h:134

Referenced by geometry_sink_AddBeziers(), and geometry_sink_AddLines().

◆ geometry_sink_AddBeziers()

static void STDMETHODCALLTYPE geometry_sink_AddBeziers ( ID2D1SimplifiedGeometrySink *  iface,
const D2D1_BEZIER_SEGMENT *  beziers,
UINT32  count 
)
static

Definition at line 1515 of file d2d1.c.

1517{
1519 struct geometry_figure *figure = &sink->figures[sink->figure_count - 1];
1520 struct geometry_segment *segment;
1521 unsigned int i;
1522
1523 for (i = 0; i < count; ++i)
1524 {
1526 segment->type = SEGMENT_BEZIER;
1527 segment->u.bezier = beziers[i];
1528 segment->flags = sink->segment_flags;
1529 }
1530}
static struct geometry_segment * geometry_figure_add_segment(struct geometry_figure *figure)
Definition: d2d1.c:1487
static struct geometry_sink * impl_from_ID2D1SimplifiedGeometrySink(ID2D1SimplifiedGeometrySink *iface)
Definition: d2d1.c:1422

◆ geometry_sink_AddLines()

static void STDMETHODCALLTYPE geometry_sink_AddLines ( ID2D1SimplifiedGeometrySink *  iface,
const D2D1_POINT_2F *  points,
UINT32  count 
)
static

Definition at line 1498 of file d2d1.c.

1500{
1502 struct geometry_figure *figure = &sink->figures[sink->figure_count - 1];
1503 struct geometry_segment *segment;
1504 unsigned int i;
1505
1506 for (i = 0; i < count; ++i)
1507 {
1509 segment->type = SEGMENT_LINE;
1510 segment->u.line = points[i];
1511 segment->flags = sink->segment_flags;
1512 }
1513}
GLsizei const GLfloat * points
Definition: glext.h:8112

◆ geometry_sink_AddRef()

static ULONG STDMETHODCALLTYPE geometry_sink_AddRef ( ID2D1SimplifiedGeometrySink *  iface)
static

Definition at line 1441 of file d2d1.c.

1442{
1443 return 0;
1444}

◆ geometry_sink_BeginFigure()

static void STDMETHODCALLTYPE geometry_sink_BeginFigure ( ID2D1SimplifiedGeometrySink *  iface,
D2D1_POINT_2F  start_point,
D2D1_FIGURE_BEGIN  figure_begin 
)
static

Definition at line 1466 of file d2d1.c.

1468{
1470 struct geometry_figure *figure;
1471
1472 if (sink->figure_count == sink->figures_size)
1473 {
1474 sink->figures_size *= 2;
1475 sink->figures = HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sink->figures,
1476 sink->figures_size * sizeof(*sink->figures));
1477 }
1478 figure = &sink->figures[sink->figure_count++];
1479
1480 figure->begin = figure_begin;
1481 figure->start_point = start_point;
1482 figure->segments_size = 4;
1484 figure->segments_size * sizeof(*figure->segments));
1485}

◆ geometry_sink_check_()

static void geometry_sink_check_ ( unsigned int  line,
const struct geometry_sink *  sink,
D2D1_FILL_MODE  fill_mode,
unsigned int  figure_count,
const struct expected_geometry_figure *  expected_figures,
unsigned int  ulps 
)
static

Definition at line 1585 of file d2d1.c.

1587{
1588 const struct geometry_segment *segment, *expected_segment;
1589 const struct expected_geometry_figure *expected_figure;
1590 const struct geometry_figure *figure;
1591 unsigned int i, j;
1592 unsigned int segment_count;
1593 BOOL match;
1594
1595 ok_(__FILE__, line)(sink->fill_mode == fill_mode,
1596 "Got unexpected fill mode %#x.\n", sink->fill_mode);
1597 ok_(__FILE__, line)(sink->figure_count == figure_count,
1598 "Got unexpected figure count %u, expected %u.\n", sink->figure_count, figure_count);
1599 ok_(__FILE__, line)(!sink->closed, "Sink is closed.\n");
1600
1601 for (i = 0; i < figure_count; ++i)
1602 {
1603 expected_figure = &expected_figures[i];
1604 figure = &sink->figures[i];
1605
1606 ok_(__FILE__, line)(figure->begin == expected_figure->begin,
1607 "Got unexpected figure %u begin %#x, expected %#x.\n",
1608 i, figure->begin, expected_figure->begin);
1609 ok_(__FILE__, line)(figure->end == expected_figure->end,
1610 "Got unexpected figure %u end %#x, expected %#x.\n",
1611 i, figure->end, expected_figure->end);
1612 match = compare_point(&figure->start_point,
1613 expected_figure->start_point.x, expected_figure->start_point.y, ulps);
1614 ok_(__FILE__, line)(match, "Got unexpected figure %u start point {%.8e, %.8e}, expected {%.8e, %.8e}.\n",
1615 i, figure->start_point.x, figure->start_point.y,
1616 expected_figure->start_point.x, expected_figure->start_point.y);
1617 ok_(__FILE__, line)(figure->segment_count == expected_figure->segment_count,
1618 "Got unexpected figure %u segment count %u, expected %u.\n",
1619 i, figure->segment_count, expected_figure->segment_count);
1620
1621 segment_count = expected_figure->segment_count < figure->segment_count ?
1622 expected_figure->segment_count : figure->segment_count;
1623
1624 for (j = 0; j < segment_count; ++j)
1625 {
1626 expected_segment = &expected_figure->segments[j];
1627 segment = &figure->segments[j];
1628 ok_(__FILE__, line)(segment->type == expected_segment->type,
1629 "Got unexpected figure %u, segment %u type %#x, expected %#x.\n",
1630 i, j, segment->type, expected_segment->type);
1631 ok_(__FILE__, line)(segment->flags == expected_segment->flags,
1632 "Got unexpected figure %u, segment %u flags %#lx, expected %#lx.\n",
1633 i, j, segment->flags, expected_segment->flags);
1634 switch (segment->type)
1635 {
1636 case SEGMENT_LINE:
1637 match = compare_point(&segment->u.line,
1638 expected_segment->u.line.x, expected_segment->u.line.y, ulps);
1639 ok_(__FILE__, line)(match, "Got unexpected figure %u segment %u {%.8e, %.8e}, "
1640 "expected {%.8e, %.8e}.\n",
1641 i, j, segment->u.line.x, segment->u.line.y,
1642 expected_segment->u.line.x, expected_segment->u.line.y);
1643 break;
1644
1645 case SEGMENT_BEZIER:
1647 expected_segment->u.bezier.point1.x, expected_segment->u.bezier.point1.y,
1648 expected_segment->u.bezier.point2.x, expected_segment->u.bezier.point2.y,
1649 expected_segment->u.bezier.point3.x, expected_segment->u.bezier.point3.y,
1650 ulps);
1651 ok_(__FILE__, line)(match, "Got unexpected figure %u segment %u "
1652 "{%.8e, %.8e, %.8e, %.8e, %.8e, %.8e}, "
1653 "expected {%.8e, %.8e, %.8e, %.8e, %.8e, %.8e}.\n",
1654 i, j, segment->u.bezier.point1.x, segment->u.bezier.point1.y,
1655 segment->u.bezier.point2.x, segment->u.bezier.point2.y,
1656 segment->u.bezier.point3.x, segment->u.bezier.point3.y,
1657 expected_segment->u.bezier.point1.x, expected_segment->u.bezier.point1.y,
1658 expected_segment->u.bezier.point2.x, expected_segment->u.bezier.point2.y,
1659 expected_segment->u.bezier.point3.x, expected_segment->u.bezier.point3.y);
1660 break;
1661 }
1662 }
1663
1664 for (j = segment_count; j < expected_figure->segment_count; ++j)
1665 {
1666 segment = &expected_figure->segments[j];
1667 switch (segment->type)
1668 {
1669 case SEGMENT_LINE:
1670 ok_(__FILE__, line)(FALSE, "Missing figure %u segment %u {%.8e, %.8e}.\n",
1671 i, j, segment->u.line.x, segment->u.line.y);
1672 break;
1673 case SEGMENT_BEZIER:
1674 ok_(__FILE__, line)(FALSE, "Missing figure %u segment %u "
1675 "{%.8e, %.8e, %.8e, %.8e, %.8e, %.8e}\n",
1676 i, j, segment->u.bezier.point1.x, segment->u.bezier.point1.y,
1677 segment->u.bezier.point2.x, segment->u.bezier.point2.y,
1678 segment->u.bezier.point3.x, segment->u.bezier.point3.y);
1679 break;
1680 }
1681 }
1682
1683 for (j = segment_count; j < figure->segment_count; ++j)
1684 {
1685 segment = &figure->segments[j];
1686 switch (segment->type)
1687 {
1688 case SEGMENT_LINE:
1689 ok_(__FILE__, line)(FALSE, "Got unexpected figure %u segment %u {%.8e, %.8e}.\n",
1690 i, j, segment->u.line.x, segment->u.line.y);
1691 break;
1692 case SEGMENT_BEZIER:
1693 ok_(__FILE__, line)(FALSE, "Got unexpected figure %u segment %u "
1694 "{%.8e, %.8e, %.8e, %.8e, %.8e, %.8e}\n",
1695 i, j, segment->u.bezier.point1.x, segment->u.bezier.point1.y,
1696 segment->u.bezier.point2.x, segment->u.bezier.point2.y,
1697 segment->u.bezier.point3.x, segment->u.bezier.point3.y);
1698 break;
1699 }
1700 }
1701 }
1702}
static BOOL compare_bezier_segment(const D2D1_BEZIER_SEGMENT *b, float x1, float y1, float x2, float y2, float x3, float y3, unsigned int ulps)
Definition: d2d1.c:828
D2D1_POINT_2F start_point
Definition: d2d1.c:387
D2D1_FIGURE_END end
Definition: d2d1.c:386
const struct geometry_segment * segments
Definition: d2d1.c:389
unsigned int segment_count
Definition: d2d1.c:388
D2D1_FIGURE_BEGIN begin
Definition: d2d1.c:385
Definition: match.c:28

◆ geometry_sink_cleanup()

static void geometry_sink_cleanup ( struct geometry_sink *  sink)
static

Definition at line 1573 of file d2d1.c.

1574{
1575 unsigned int i;
1576
1577 for (i = 0; i < sink->figure_count; ++i)
1578 {
1579 HeapFree(GetProcessHeap(), 0, sink->figures[i].segments);
1580 }
1581 HeapFree(GetProcessHeap(), 0, sink->figures);
1582}

Referenced by test_path_geometry(), and test_rectangle_geometry().

◆ geometry_sink_Close()

static HRESULT STDMETHODCALLTYPE geometry_sink_Close ( ID2D1SimplifiedGeometrySink *  iface)
static

Definition at line 1541 of file d2d1.c.

1542{
1544
1545 sink->closed = TRUE;
1546
1547 return S_OK;
1548}

◆ geometry_sink_EndFigure()

static void STDMETHODCALLTYPE geometry_sink_EndFigure ( ID2D1SimplifiedGeometrySink *  iface,
D2D1_FIGURE_END  figure_end 
)
static

Definition at line 1532 of file d2d1.c.

1534{
1536 struct geometry_figure *figure = &sink->figures[sink->figure_count - 1];
1537
1538 figure->end = figure_end;
1539}

◆ geometry_sink_init()

static void geometry_sink_init ( struct geometry_sink *  sink)
static

Definition at line 1564 of file d2d1.c.

1565{
1566 memset(sink, 0, sizeof(*sink));
1567 sink->ID2D1SimplifiedGeometrySink_iface.lpVtbl = &geometry_sink_vtbl;
1568 sink->figures_size = 4;
1570 sink->figures_size * sizeof(*sink->figures));
1571}
static const struct ID2D1SimplifiedGeometrySinkVtbl geometry_sink_vtbl
Definition: d2d1.c:1550

Referenced by test_path_geometry(), and test_rectangle_geometry().

◆ geometry_sink_QueryInterface()

static HRESULT STDMETHODCALLTYPE geometry_sink_QueryInterface ( ID2D1SimplifiedGeometrySink *  iface,
REFIID  iid,
void **  out 
)
static

Definition at line 1427 of file d2d1.c.

1429{
1430 if (IsEqualGUID(iid, &IID_ID2D1SimplifiedGeometrySink)
1431 || IsEqualGUID(iid, &IID_IUnknown))
1432 {
1433 *out = iface;
1434 return S_OK;
1435 }
1436
1437 *out = NULL;
1438 return E_NOINTERFACE;
1439}

◆ geometry_sink_Release()

static ULONG STDMETHODCALLTYPE geometry_sink_Release ( ID2D1SimplifiedGeometrySink *  iface)
static

Definition at line 1446 of file d2d1.c.

1447{
1448 return 0;
1449}

◆ geometry_sink_SetFillMode()

static void STDMETHODCALLTYPE geometry_sink_SetFillMode ( ID2D1SimplifiedGeometrySink *  iface,
D2D1_FILL_MODE  mode 
)
static

Definition at line 1451 of file d2d1.c.

1452{
1454
1455 sink->fill_mode = mode;
1456}
GLenum mode
Definition: glext.h:6217

◆ geometry_sink_SetSegmentFlags()

static void STDMETHODCALLTYPE geometry_sink_SetSegmentFlags ( ID2D1SimplifiedGeometrySink *  iface,
D2D1_PATH_SEGMENT  flags 
)
static

Definition at line 1458 of file d2d1.c.

1460{
1462
1463 sink->segment_flags = flags;
1464}
GLbitfield flags
Definition: glext.h:7161

◆ get_d3d10_surface_readback()

static void get_d3d10_surface_readback ( IDXGISurface *  surface,
struct resource_readback *  rb 
)
static

Definition at line 643 of file d2d1.c.

644{
645 D3D10_TEXTURE2D_DESC texture_desc;
646 D3D10_MAPPED_TEXTURE2D map_desc;
647 DXGI_SURFACE_DESC surface_desc;
648 ID3D10Resource *src_resource;
650 HRESULT hr;
651
652 hr = IDXGISurface_GetDevice(surface, &IID_ID3D10Device, (void **)&device);
653 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
654 hr = IDXGISurface_QueryInterface(surface, &IID_ID3D10Resource, (void **)&src_resource);
655 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
656
657 hr = IDXGISurface_GetDesc(surface, &surface_desc);
658 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
659 texture_desc.Width = surface_desc.Width;
660 texture_desc.Height = surface_desc.Height;
661 texture_desc.MipLevels = 1;
662 texture_desc.ArraySize = 1;
663 texture_desc.Format = surface_desc.Format;
664 texture_desc.SampleDesc = surface_desc.SampleDesc;
665 texture_desc.Usage = D3D10_USAGE_STAGING;
666 texture_desc.BindFlags = 0;
668 texture_desc.MiscFlags = 0;
669 hr = ID3D10Device_CreateTexture2D(device, &texture_desc, NULL, (ID3D10Texture2D **)&rb->u.d3d10_resource);
670 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
671
672 rb->width = texture_desc.Width;
673 rb->height = texture_desc.Height;
674
675 ID3D10Device_CopyResource(device, rb->u.d3d10_resource, src_resource);
676 ID3D10Resource_Release(src_resource);
677 ID3D10Device_Release(device);
678
679 hr = ID3D10Texture2D_Map((ID3D10Texture2D *)rb->u.d3d10_resource, 0, D3D10_MAP_READ, 0, &map_desc);
680 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
681
682 rb->pitch = map_desc.RowPitch;
683 rb->data = map_desc.pData;
684}
@ D3D10_USAGE_STAGING
Definition: d3d10.idl:464
@ D3D10_MAP_READ
Definition: d3d10.idl:504
@ D3D10_CPU_ACCESS_READ
Definition: d3d10.idl:884
DXGI_SAMPLE_DESC SampleDesc
Definition: dxgi.idl:81
DXGI_FORMAT Format
Definition: dxgi.idl:80
unsigned int width
Definition: d2d1.c:338
unsigned int pitch
Definition: d2d1.c:338
void * data
Definition: d2d1.c:339
ID3D10Resource * d3d10_resource
Definition: d2d1.c:335
unsigned int height
Definition: d2d1.c:338
union resource_readback::@1910 u

Referenced by get_surface_readback().

◆ get_d3d11_surface_readback()

static void get_d3d11_surface_readback ( IDXGISurface *  surface,
struct resource_readback *  rb 
)
static

Definition at line 686 of file d2d1.c.

687{
688 D3D11_TEXTURE2D_DESC texture_desc;
690 DXGI_SURFACE_DESC surface_desc;
691 ID3D11Resource *src_resource;
692 ID3D11DeviceContext *context;
693 ID3D11Device *device;
694 HRESULT hr;
695
696 hr = IDXGISurface_GetDevice(surface, &IID_ID3D11Device, (void **)&device);
697 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
698 hr = IDXGISurface_QueryInterface(surface, &IID_ID3D11Resource, (void **)&src_resource);
699 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
700
701 hr = IDXGISurface_GetDesc(surface, &surface_desc);
702 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
703 texture_desc.Width = surface_desc.Width;
704 texture_desc.Height = surface_desc.Height;
705 texture_desc.MipLevels = 1;
706 texture_desc.ArraySize = 1;
707 texture_desc.Format = surface_desc.Format;
708 texture_desc.SampleDesc = surface_desc.SampleDesc;
709 texture_desc.Usage = D3D11_USAGE_STAGING;
710 texture_desc.BindFlags = 0;
711 texture_desc.CPUAccessFlags = D3D11_CPU_ACCESS_READ;
712 texture_desc.MiscFlags = 0;
713 hr = ID3D11Device_CreateTexture2D(device, &texture_desc, NULL, (ID3D11Texture2D **)&rb->u.d3d11_resource);
714 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
715
716 rb->width = texture_desc.Width;
717 rb->height = texture_desc.Height;
718
719 ID3D11Device_GetImmediateContext(device, &context);
720 ID3D11DeviceContext_CopyResource(context, rb->u.d3d11_resource, src_resource);
721 ID3D11Resource_Release(src_resource);
722 ID3D11Device_Release(device);
723
724 hr = ID3D11DeviceContext_Map(context, rb->u.d3d11_resource, 0, D3D11_MAP_READ, 0, &map_desc);
725 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
726 ID3D11DeviceContext_Release(context);
727
728 rb->pitch = map_desc.RowPitch;
729 rb->data = map_desc.pData;
730}
@ D3D11_MAP_READ
Definition: d3d11.idl:972
ID3D11Resource * d3d11_resource
Definition: d2d1.c:336

Referenced by get_surface_readback().

◆ get_readback_colour()

static DWORD get_readback_colour ( struct resource_readback *  rb,
unsigned int  x,
unsigned int  y 
)
static

Definition at line 768 of file d2d1.c.

769{
770 return ((DWORD *)((BYTE *)rb->data + y * rb->pitch))[x];
771}

Referenced by test_effect_custom_pixel_shader(), test_effect_grayscale(), test_linear_brush(), and test_radial_brush().

◆ get_refcount()

static ULONG get_refcount ( void *  iface)
static

Definition at line 44 of file d2d1.c.

45{
46 IUnknown *unknown = iface;
47 IUnknown_AddRef(unknown);
48 return IUnknown_Release(unknown);
49}
static WCHAR unknown[MAX_STRING_RESOURCE_LEN]
Definition: object.c:1674

Referenced by effect_impl_draw_transform_SetDrawInfo(), and test_get_effect_properties().

◆ get_surface_readback()

static void get_surface_readback ( struct d2d1_test_context *  ctx,
struct resource_readback *  rb 
)
static

Definition at line 732 of file d2d1.c.

733{
734 if ((rb->d3d11 = ctx->d3d11))
735 get_d3d11_surface_readback(ctx->surface, rb);
736 else
737 get_d3d10_surface_readback(ctx->surface, rb);
738}
static void get_d3d10_surface_readback(IDXGISurface *surface, struct resource_readback *rb)
Definition: d2d1.c:643
static void get_d3d11_surface_readback(IDXGISurface *surface, struct resource_readback *rb)
Definition: d2d1.c:686

Referenced by compare_figure(), compare_surface(), test_effect_custom_pixel_shader(), test_effect_grayscale(), test_linear_brush(), and test_radial_brush().

◆ HRESULT()

static HRESULT ( WINAPI *  pD2D1CreateDevice)
static

◆ impl_from_ID2D1DrawTransform()

static struct effect_impl * impl_from_ID2D1DrawTransform ( ID2D1DrawTransform *  iface)
inlinestatic

Definition at line 11185 of file d2d1.c.

11186{
11187 return CONTAINING_RECORD(iface, struct effect_impl, ID2D1DrawTransform_iface);
11188}
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260

Referenced by effect_impl_draw_transform_AddRef(), effect_impl_draw_transform_QueryInterface(), effect_impl_draw_transform_Release(), and effect_impl_draw_transform_SetDrawInfo().

◆ impl_from_ID2D1EffectImpl()

◆ impl_from_ID2D1SimplifiedGeometrySink()

static struct geometry_sink * impl_from_ID2D1SimplifiedGeometrySink ( ID2D1SimplifiedGeometrySink *  iface)
inlinestatic

◆ init_test_context_()

static BOOL init_test_context_ ( unsigned int  line,
struct d2d1_test_context *  ctx,
BOOL  d3d11,
D2D1_FACTORY_TYPE  factory_type 
)
static

Definition at line 1290 of file d2d1.c.

1291{
1292 HRESULT hr;
1293
1294 memset(ctx, 0, sizeof(*ctx));
1295
1296 ctx->d3d11 = d3d11;
1297 if (!(ctx->device = create_device(d3d11)))
1298 {
1299 skip_(__FILE__, line)("Failed to create device, skipping tests.\n");
1300 return FALSE;
1301 }
1302
1303 ctx->window = create_window();
1304 ok_(__FILE__, line)(!!ctx->window, "Failed to create test window.\n");
1305 ctx->swapchain = create_swapchain(ctx->device, ctx->window, TRUE);
1306 ok_(__FILE__, line)(!!ctx->swapchain, "Failed to create swapchain.\n");
1307 hr = IDXGISwapChain_GetBuffer(ctx->swapchain, 0, &IID_IDXGISurface, (void **)&ctx->surface);
1308 ok_(__FILE__, line)(hr == S_OK, "Failed to get buffer, hr %#lx.\n", hr);
1309
1310 ctx->rt = create_render_target(ctx->surface, d3d11, factory_type);
1311 if (!ctx->rt && d3d11)
1312 {
1313 todo_wine win_skip_(__FILE__, line)("Skipping d3d11 tests.\n");
1314
1315 IDXGISurface_Release(ctx->surface);
1316 IDXGISwapChain_Release(ctx->swapchain);
1317 DestroyWindow(ctx->window);
1318 IDXGIDevice_Release(ctx->device);
1319
1320 return FALSE;
1321 }
1322 ok_(__FILE__, line)(!!ctx->rt, "Failed to create render target.\n");
1323
1324 hr = ID2D1RenderTarget_QueryInterface(ctx->rt, &IID_ID2D1DeviceContext, (void **)&ctx->context);
1325 ok_(__FILE__, line)(hr == S_OK, "Failed to get device context, hr %#lx.\n", hr);
1326
1327 ID2D1RenderTarget_GetFactory(ctx->rt, &ctx->factory);
1328 ID2D1Factory_QueryInterface(ctx->factory, &IID_ID2D1Factory1, (void **)&ctx->factory1);
1329 ID2D1Factory_QueryInterface(ctx->factory, &IID_ID2D1Factory2, (void **)&ctx->factory2);
1330 ID2D1Factory_QueryInterface(ctx->factory, &IID_ID2D1Factory3, (void **)&ctx->factory3);
1331
1332 return TRUE;
1333}
static ID2D1RenderTarget * create_render_target(IDXGISurface *surface, BOOL d3d11, D2D1_FACTORY_TYPE factory_type)
Definition: d2d1.c:1250
static HWND create_window(void)
Definition: d2d1.c:1174
static ID3D11Device * create_device(void)
Definition: hlsl_d3d11.c:102
#define skip_(test, file, line,...)
Definition: kmt_test.h:231
#define win_skip_(file, line)
Definition: minitest.h:61
#define todo_wine
Definition: minitest.h:80
BOOL WINAPI DestroyWindow(_In_ HWND)

◆ line_to()

static void line_to ( ID2D1GeometrySink *  sink,
float  x,
float  y 
)
static

Definition at line 614 of file d2d1.c.

615{
617
618 set_point(&point, x, y);
619 ID2D1GeometrySink_AddLine(sink, point);
620}

Referenced by fill_geometry_sink(), test_bezier_intersect(), test_draw_geometry(), test_fill_geometry(), test_path_geometry(), and test_stroke_contains_point().

◆ mt_factory_test_thread_draw_func()

static DWORD WINAPI mt_factory_test_thread_draw_func ( void *  param)
static

Definition at line 10771 of file d2d1.c.

10772{
10775 HRESULT hr;
10776
10777 ID2D1RenderTarget_BeginDraw(rt);
10778 set_color(&color, 1.0f, 1.0f, 0.0f, 1.0f);
10779 ID2D1RenderTarget_Clear(rt, &color);
10780 hr = ID2D1RenderTarget_EndDraw(rt, NULL, NULL);
10781 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
10782
10783 return 0;
10784}
static void set_color(D2D1_COLOR_F *color, float r, float g, float b, float a)
Definition: d2d1.c:542
GLuint color
Definition: glext.h:6243
GLfloat param
Definition: glext.h:5796

Referenced by test_mt_factory().

◆ mt_factory_test_thread_func()

static DWORD WINAPI mt_factory_test_thread_func ( void *  param)
static

Definition at line 10762 of file d2d1.c.

10763{
10764 ID2D1Multithread *multithread = param;
10765
10766 ID2D1Multithread_Enter(multithread);
10767
10768 return 0;
10769}

Referenced by test_mt_factory().

◆ preload_shader()

static void preload_shader ( const char *  target,
const char *  code,
const GUID *  id,
struct d2d1_test_context *  ctx 
)
static

Definition at line 14725 of file d2d1.c.

14727{
14728 D2D1_PROPERTY_BINDING bindings[1] = { 0 };
14729 ID2D1EffectContext *effect_context;
14732 ID2D1Effect *effect;
14734 HRESULT hr;
14735
14736 context = ctx->context;
14737 factory = ctx->factory1;
14738
14739 bindings[0].propertyName = L"Context";
14741 hr = ID2D1Factory1_RegisterEffectFromString(factory, &CLSID_AuxEffect, effect_xml_b,
14742 bindings, 1, effect_impl_create);
14743 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
14744
14745 hr = ID2D1DeviceContext_CreateEffect(context, &CLSID_AuxEffect, &effect);
14746 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
14747
14748 hr = ID2D1Effect_GetValueByName(effect, L"Context",
14749 D2D1_PROPERTY_TYPE_IUNKNOWN, (BYTE *)&effect_context, sizeof(effect_context));
14750 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
14751
14752 hr = D3DCompile(code, strlen(code), NULL, NULL, NULL, "main",
14753 target, 0, 0, &blob, NULL);
14754 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
14755
14756 if (!strcmp(target, "ps_4_0"))
14757 {
14758 hr = ID2D1EffectContext_LoadPixelShader(effect_context, id,
14759 ID3D10Blob_GetBufferPointer(blob), ID3D10Blob_GetBufferSize(blob));
14760 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
14761 }
14762 else
14763 ok(0, "Unexpected target %s.\n", target);
14764
14765 ID3D10Blob_Release(blob);
14766
14767 ID2D1Effect_Release(effect);
14768
14769 hr = ID2D1Factory1_UnregisterEffect(factory, &CLSID_AuxEffect);
14770 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
14771}
static HRESULT STDMETHODCALLTYPE effect_impl_create(IUnknown **effect_impl)
Definition: d2d1.c:11273
static HRESULT STDMETHODCALLTYPE effect_impl_get_context(const IUnknown *iface, BYTE *data, UINT32 data_size, UINT32 *actual_size)
Definition: d2d1.c:11353
static const WCHAR * effect_xml_b
Definition: d2d1.c:148
HRESULT WINAPI D3DCompile(const void *data, SIZE_T data_size, const char *filename, const D3D_SHADER_MACRO *defines, ID3DInclude *include, const char *entrypoint, const char *target, UINT sflags, UINT eflags, ID3DBlob **shader, ID3DBlob **error_messages)
Definition: compiler.c:639
_ACRTIMP size_t __cdecl strlen(const char *)
Definition: string.c:1597
PD2D1_PROPERTY_GET_FUNCTION getFunction
Definition: image.c:229
Definition: inflate.c:139

Referenced by test_effect_custom_pixel_shader().

◆ ps_effect_impl_Initialize()

static HRESULT STDMETHODCALLTYPE ps_effect_impl_Initialize ( ID2D1EffectImpl *  iface,
ID2D1EffectContext *  context,
ID2D1TransformGraph *  graph 
)
static

Definition at line 14576 of file d2d1.c.

14578{
14580
14582 ID2D1EffectContext_AddRef(effect_impl->effect_context);
14583
14584 return ID2D1TransformGraph_SetSingleTransformNode(graph,
14586}

◆ quadratic_to()

static void quadratic_to ( ID2D1GeometrySink *  sink,
float  x1,
float  y1,
float  x2,
float  y2 
)
static

Definition at line 622 of file d2d1.c.

623{
625
626 set_quadratic(&quadratic, x1, y1, x2, y2);
627 ID2D1GeometrySink_AddQuadraticBezier(sink, &quadratic);
628}
static void set_quadratic(D2D1_QUADRATIC_BEZIER_SEGMENT *quadratic, float x1, float y1, float x2, float y2)
Definition: d2d1.c:487

Referenced by fill_geometry_sink_bezier(), test_draw_geometry(), test_fill_geometry(), and test_path_geometry().

◆ queue_d3d10_test()

static void queue_d3d10_test ( void(*)(BOOL d3d11)  test)
static

Definition at line 423 of file d2d1.c.

424{
426}
static void queue_d3d1x_test(void(*test)(BOOL d3d11), BOOL d3d11)
Definition: d2d1.c:412

Referenced by START_TEST().

◆ queue_d3d1x_test()

static void queue_d3d1x_test ( void(*)(BOOL d3d11)  test,
BOOL  d3d11 
)
static

Definition at line 412 of file d2d1.c.

413{
415 {
418 }
420 mt_tests[mt_test_count++].d3d11 = d3d11;
421}
size_t mt_test_count
Definition: d2d1.c:313
size_t mt_tests_size
Definition: d2d1.c:313
static struct test_entry * mt_tests
#define realloc
Definition: debug_ros.c:6
#define max(a, b)
Definition: svc.c:63

Referenced by queue_d3d10_test(), and queue_test().

◆ queue_test()

static void queue_test ( void(*)(BOOL d3d11)  test)
static

Definition at line 428 of file d2d1.c.

Referenced by START_TEST().

◆ read_figure()

static void read_figure ( struct figure *  figure,
BYTE *  data,
unsigned int  pitch,
unsigned int  x,
unsigned int  y,
unsigned int  w,
unsigned int  h,
DWORD  prev 
)
static

Definition at line 1027 of file d2d1.c.

1029{
1030 unsigned int i, j, span;
1031
1032 figure->span_count = 0;
1033 for (i = 0, span = 0; i < h; ++i)
1034 {
1035 const DWORD *row = (DWORD *)&data[(y + i) * pitch + x * 4];
1036 for (j = 0; j < w; ++j, ++span)
1037 {
1038 if ((i || j) && prev != row[j])
1039 {
1041 prev = row[j];
1042 span = 0;
1043 }
1044 }
1045 }
1046 if (span)
1048}
struct png_info_def *typedef unsigned char **typedef struct png_info_def *typedef struct png_info_def *typedef struct png_info_def *typedef unsigned char ** row
Definition: typeof.h:78

Referenced by compare_figure().

◆ release_d3d10_resource_readback()

static void release_d3d10_resource_readback ( struct resource_readback *  rb)
static

Definition at line 740 of file d2d1.c.

741{
742 ID3D10Texture2D_Unmap((ID3D10Texture2D *)rb->u.d3d10_resource, 0);
743 ID3D10Resource_Release(rb->u.d3d10_resource);
744}

Referenced by release_resource_readback().

◆ release_d3d11_resource_readback()

static void release_d3d11_resource_readback ( struct resource_readback *  rb)
static

Definition at line 746 of file d2d1.c.

747{
748 ID3D11DeviceContext *context;
749 ID3D11Device *device;
750
751 ID3D11Resource_GetDevice(rb->u.d3d11_resource, &device);
752 ID3D11Device_GetImmediateContext(device, &context);
753 ID3D11Device_Release(device);
754
755 ID3D11DeviceContext_Unmap(context, rb->u.d3d11_resource, 0);
756 ID3D11Resource_Release(rb->u.d3d11_resource);
757 ID3D11DeviceContext_Release(context);
758}

Referenced by release_resource_readback().

◆ release_resource_readback()

static void release_resource_readback ( struct resource_readback *  rb)
static

Definition at line 760 of file d2d1.c.

761{
762 if (rb->d3d11)
764 else
766}
static void release_d3d10_resource_readback(struct resource_readback *rb)
Definition: d2d1.c:740
static void release_d3d11_resource_readback(struct resource_readback *rb)
Definition: d2d1.c:746

Referenced by compare_figure(), compare_surface(), test_effect_custom_pixel_shader(), test_effect_grayscale(), test_linear_brush(), and test_radial_brush().

◆ release_test_context_()

static void release_test_context_ ( unsigned int  line,
struct d2d1_test_context *  ctx 
)
static

Definition at line 1266 of file d2d1.c.

1267{
1268 ULONG ref;
1269
1270 if (ctx->factory3)
1271 ID2D1Factory3_Release(ctx->factory3);
1272 if (ctx->factory2)
1273 ID2D1Factory2_Release(ctx->factory2);
1274 if (ctx->factory1)
1275 ID2D1Factory1_Release(ctx->factory1);
1276 ID2D1DeviceContext_Release(ctx->context);
1277 ID2D1RenderTarget_Release(ctx->rt);
1278 ref = ID2D1Factory_Release(ctx->factory);
1279 ok_(__FILE__, line)(!ref, "Factory has %lu references left.\n", ref);
1280
1281 IDXGISurface_Release(ctx->surface);
1282 IDXGISwapChain_Release(ctx->swapchain);
1283 DestroyWindow(ctx->window);
1284 ref = IDXGIDevice_Release(ctx->device);
1285 ok_(__FILE__, line)(!ref, "Device has %lu references left.\n", ref);
1286}

◆ rotate_matrix()

static void rotate_matrix ( D2D1_MATRIX_3X2_F *  matrix,
float  theta 
)
static

Definition at line 572 of file d2d1.c.

573{
574 float sin_theta, cos_theta, tmp_11, tmp_12;
575
576 sin_theta = sinf(theta);
577 cos_theta = cosf(theta);
578 tmp_11 = matrix->_11;
579 tmp_12 = matrix->_12;
580
581 matrix->_11 = cos_theta * tmp_11 + sin_theta * matrix->_21;
582 matrix->_12 = cos_theta * tmp_12 + sin_theta * matrix->_22;
583 matrix->_21 = -sin_theta * tmp_11 + cos_theta * matrix->_21;
584 matrix->_22 = -sin_theta * tmp_12 + cos_theta * matrix->_22;
585}
_ACRTIMP float __cdecl cosf(float)
Definition: cosf.c:13
_ACRTIMP float __cdecl sinf(float)
Definition: sinf.c:13
GLuint GLenum matrix
Definition: glext.h:9407

Referenced by test_bitmap_brush(), test_color_brush(), test_compute_geometry_area(), test_draw_geometry(), test_effect_2d_affine(), test_fill_geometry(), test_linear_brush(), test_path_geometry(), test_radial_brush(), and test_rectangle_geometry().

◆ run_queued_tests()

static void run_queued_tests ( void  )
static

Definition at line 448 of file d2d1.c.

449{
450 unsigned int thread_count, i;
453 LONG test_idx;
454
455 if (!use_mt)
456 {
457 for (i = 0; i < mt_test_count; ++i)
458 {
459 mt_tests[i].test(mt_tests[i].d3d11);
460 }
461
462 return;
463 }
464
467 threads = calloc(thread_count, sizeof(*threads));
468 for (i = 0, test_idx = 0; i < thread_count; ++i)
469 {
470 threads[i] = CreateThread(NULL, 0, thread_func, &test_idx, 0, NULL);
471 ok(!!threads[i], "Failed to create thread %u.\n", i);
472 }
474 for (i = 0; i < thread_count; ++i)
475 {
477 }
478 free(threads);
479}
static BOOL use_mt
Definition: d2d1.c:306
static DWORD WINAPI thread_func(void *ctx)
Definition: d2d1.c:434
#define CloseHandle
Definition: compat.h:739
VOID WINAPI GetSystemInfo(IN LPSYSTEM_INFO lpSystemInfo)
Definition: sysinfo.c:143
HANDLE WINAPI DECLSPEC_HOTPATCH CreateThread(IN LPSECURITY_ATTRIBUTES lpThreadAttributes, IN DWORD dwStackSize, IN LPTHREAD_START_ROUTINE lpStartAddress, IN LPVOID lpParameter, IN DWORD dwCreationFlags, OUT LPDWORD lpThreadId)
Definition: thread.c:137
#define INFINITE
Definition: serial.h:102
static HANDLE ULONG_PTR DWORD threads
Definition: process.c:83
static SYSTEM_INFO si
Definition: virtual.c:39
long LONG
Definition: pedump.c:60
static uint32_t thread_count(IN pnfs_layout_state *state, IN enum pnfs_iomode iomode, IN uint64_t offset, IN uint64_t length)
Definition: pnfs_io.c:137
DWORD dwNumberOfProcessors
Definition: winbase.h:900
DWORD WINAPI WaitForMultipleObjects(IN DWORD nCount, IN CONST HANDLE *lpHandles, IN BOOL bWaitAll, IN DWORD dwMilliseconds)
Definition: synch.c:151

Referenced by START_TEST().

◆ scale_matrix()

◆ serialize_figure()

static void serialize_figure ( struct figure *  figure)
static

Definition at line 919 of file d2d1.c.

920{
921 static const char lookup[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
922 unsigned int i, j, k, span;
923 char output[76];
924 char t[3];
925 char *p;
926
927 for (i = 0, j = 0, k = 0, p = output; i < figure->span_count; ++i)
928 {
929 span = figure->spans[i];
930 while (span)
931 {
932 t[j] = span & 0x7f;
933 if (span > 0x7f)
934 t[j] |= 0x80;
935 span >>= 7;
936 if (++j == 3)
937 {
938 p[0] = lookup[(t[0] & 0xfc) >> 2];
939 p[1] = lookup[((t[0] & 0x03) << 4) | ((t[1] & 0xf0) >> 4)];
940 p[2] = lookup[((t[1] & 0x0f) << 2) | ((t[2] & 0xc0) >> 6)];
941 p[3] = lookup[t[2] & 0x3f];
942 p += 4;
943 if (++k == 19)
944 {
945 trace("%.76s\n", output);
946 p = output;
947 k = 0;
948 }
949 j = 0;
950 }
951 }
952 }
953 if (j)
954 {
955 for (i = j; i < 3; ++i)
956 t[i] = 0;
957 p[0] = lookup[(t[0] & 0xfc) >> 2];
958 p[1] = lookup[((t[0] & 0x03) << 4) | ((t[1] & 0xf0) >> 4)];
959 p[2] = lookup[((t[1] & 0x0f) << 2) | ((t[2] & 0xc0) >> 6)];
960 p[3] = lookup[t[2] & 0x3f];
961 ++k;
962 }
963 if (k)
964 trace("%.*s\n", k * 4, output);
965}
GLdouble GLdouble t
Definition: gl.h:2047
GLfloat GLfloat p
Definition: glext.h:8902
int k
Definition: mpi.c:3369

Referenced by compare_figure().

◆ set_color()

◆ set_ellipse()

static void set_ellipse ( D2D1_ELLIPSE *  ellipse,
float  x,
float  y,
float  rx,
float  ry 
)
static

Definition at line 535 of file d2d1.c.

536{
537 set_point(&ellipse->point, x, y);
538 ellipse->radiusX = rx;
539 ellipse->radiusY = ry;
540}
float radiusY
Definition: d2d1.idl:327
D2D1_POINT_2F point
Definition: d2d1.idl:325
float radiusX
Definition: d2d1.idl:326

Referenced by test_compute_geometry_area(), test_draw_geometry(), and test_fill_geometry().

◆ set_matrix_identity()

◆ set_point()

◆ set_quadratic()

static void set_quadratic ( D2D1_QUADRATIC_BEZIER_SEGMENT *  quadratic,
float  x1,
float  y1,
float  x2,
float  y2 
)
static

Definition at line 487 of file d2d1.c.

488{
489 quadratic->point1.x = x1;
490 quadratic->point1.y = y1;
491 quadratic->point2.x = x2;
492 quadratic->point2.y = y2;
493}

Referenced by quadratic_to().

◆ set_rect()

◆ set_rect_l()

static void set_rect_l ( D2D1_RECT_L *  rect,
LONG  left,
LONG  top,
LONG  right,
LONG  bottom 
)
static

Definition at line 527 of file d2d1.c.

528{
529 rect->left = left;
530 rect->top = top;
531 rect->right = right;
532 rect->bottom = bottom;
533}

Referenced by test_bounds_adjustment_transform().

◆ set_rect_u()

static void set_rect_u ( D2D1_RECT_U *  rect,
UINT32  left,
UINT32  top,
UINT32  right,
UINT32  bottom 
)
static

Definition at line 519 of file d2d1.c.

520{
521 rect->left = left;
522 rect->top = top;
523 rect->right = right;
524 rect->bottom = bottom;
525}

Referenced by test_bitmap_updates().

◆ set_rounded_rect()

static void set_rounded_rect ( D2D1_ROUNDED_RECT *  rect,
float  left,
float  top,
float  right,
float  bottom,
float  radius_x,
float  radius_y 
)
static

Definition at line 511 of file d2d1.c.

513{
514 set_rect(&rect->rect, left, top, right, bottom);
515 rect->radiusX = radius_x;
516 rect->radiusY = radius_y;
517}
static void set_rect(D2D1_RECT_F *rect, float left, float top, float right, float bottom)
Definition: d2d1.c:495

Referenced by test_draw_geometry(), test_fill_geometry(), and test_rounded_rectangle_geometry().

◆ set_size_f()

static void set_size_f ( D2D1_SIZE_F *  size,
float  w,
float  h 
)
static

Definition at line 556 of file d2d1.c.

557{
558 size->width = w;
559 size->height = h;
560}

Referenced by test_bitmap_target(), and test_layer().

◆ set_size_u()

◆ set_vec4()

static void set_vec4 ( D2D_VECTOR_4F *  vec,
float  x,
float  y,
float  z,
float  w 
)
static

Definition at line 503 of file d2d1.c.

504{
505 vec->x = x;
506 vec->y = y;
507 vec->z = z;
508 vec->w = w;
509}
static float float z
Definition: d2d1.c:302
FT_Vector * vec
Definition: ftbbox.c:469
FT_Pos x
Definition: ftimage.h:77
FT_Pos y
Definition: ftimage.h:78

Referenced by test_get_effect_properties().

◆ skew_matrix()

static void skew_matrix ( D2D1_MATRIX_3X2_F *  matrix,
float  x,
float  y 
)
static

Definition at line 587 of file d2d1.c.

588{
589 float tmp_11, tmp_12;
590
591 tmp_11 = matrix->_11;
592 tmp_12 = matrix->_12;
593
594 matrix->_11 += y * matrix->_21;
595 matrix->_12 += y * matrix->_22;
596 matrix->_21 += x * tmp_11;
597 matrix->_22 += x * tmp_12;
598}

Referenced by test_bitmap_brush(), test_compute_geometry_area(), test_effect_2d_affine(), test_linear_brush(), and test_radial_brush().

◆ START_TEST()

START_TEST ( d2d1  )

Definition at line 15449 of file d2d1.c.

15450{
15451 HMODULE d2d1_dll = GetModuleHandleA("d2d1.dll");
15452 unsigned int argc, i;
15453 char **argv;
15454
15455 pD2D1CreateDevice = (void *)GetProcAddress(d2d1_dll, "D2D1CreateDevice");
15456 pD2D1SinCos = (void *)GetProcAddress(d2d1_dll, "D2D1SinCos");
15457 pD2D1Tan = (void *)GetProcAddress(d2d1_dll, "D2D1Tan");
15458 pD2D1Vec3Length = (void *)GetProcAddress(d2d1_dll, "D2D1Vec3Length");
15459 pD2D1ConvertColorSpace = (void *)GetProcAddress(d2d1_dll, "D2D1ConvertColorSpace");
15460
15461 use_mt = !getenv("WINETEST_NO_MT_D3D");
15462 /* Some host drivers (MacOS, Mesa radeonsi) never unmap memory even when
15463 * requested. When using the chunk allocator, running the tests with more
15464 * than one thread can exceed the 32-bit virtual address space. */
15465 if (sizeof(void *) == 4 && !strcmp(winetest_platform, "wine"))
15466 use_mt = FALSE;
15467
15469 for (i = 2; i < argc; ++i)
15470 {
15471 if (!strcmp(argv[i], "--single"))
15472 use_mt = FALSE;
15473 }
15474
15545
15547}
static void test_effect_properties(BOOL d3d11)
Definition: d2d1.c:11814
static void test_device_context(BOOL d3d11)
Definition: d2d1.c:9546
static void test_draw_geometry(BOOL d3d11)
Definition: d2d1.c:7068
static void test_compute_geometry_area(BOOL d3d11)
Definition: d2d1.c:15159
static void test_unit_mode(BOOL d3d11)
Definition: d2d1.c:10460
static void test_wic_gdi_interop(BOOL d3d11)
Definition: d2d1.c:8815
static void test_stroke_contains_point(BOOL d3d11)
Definition: d2d1.c:13342
static void test_color_brush(BOOL d3d11)
Definition: d2d1.c:2164
static void test_alpha_mode(BOOL d3d11)
Definition: d2d1.c:4837
static void test_wic_bitmap_format(BOOL d3d11)
Definition: d2d1.c:10489
static void test_rectangle_geometry(BOOL d3d11)
Definition: d2d1.c:4446
static void test_blend_transform(BOOL d3d11)
Definition: d2d1.c:13082
static void test_hwnd_target_is_supported(BOOL d3d11)
Definition: d2d1.c:14106
static void test_hwnd_target(BOOL d3d11)
Definition: d2d1.c:6268
static void test_bitmap_formats(BOOL d3d11)
Definition: d2d1.c:4774
static void test_state_block(BOOL d3d11)
Definition: d2d1.c:1896
static void test_colour_space(BOOL d3d11)
Definition: d2d1.c:10629
static void test_layer(BOOL d3d11)
Definition: d2d1.c:8943
static void test_opacity_brush(BOOL d3d11)
Definition: d2d1.c:5529
static void test_max_bitmap_size(BOOL d3d11)
Definition: d2d1.c:10134
static void test_effect_vertex_buffer(BOOL d3d11)
Definition: d2d1.c:14962
static void queue_d3d10_test(void(*test)(BOOL d3d11))
Definition: d2d1.c:423
static void run_queued_tests(void)
Definition: d2d1.c:448
static void test_bounds_adjustment_transform(BOOL d3d11)
Definition: d2d1.c:13275
static void test_bitmap_create(BOOL d3d11)
Definition: d2d1.c:14035
static void test_invert_matrix(BOOL d3d11)
Definition: d2d1.c:9745
static void test_rounded_rectangle_geometry(BOOL d3d11)
Definition: d2d1.c:4728
static void test_effect_blob_property(BOOL d3d11)
Definition: d2d1.c:15357
static void test_dc_target_is_supported(BOOL d3d11)
Definition: d2d1.c:14344
static void test_effect_grayscale(BOOL d3d11)
Definition: d2d1.c:12684
static void test_dpi(BOOL d3d11)
Definition: d2d1.c:10251
static void test_create_target(BOOL d3d11)
Definition: d2d1.c:5694
static void test_image_brush(BOOL d3d11)
Definition: d2d1.c:2636
static void test_image_bounds(BOOL d3d11)
Definition: d2d1.c:13658
static void test_stroke_style(BOOL d3d11)
Definition: d2d1.c:6881
static void test_bitmap_map(BOOL d3d11)
Definition: d2d1.c:13752
static void test_builtin_effect(BOOL d3d11)
Definition: d2d1.c:10967
static void test_get_effect_properties(BOOL d3d11)
Definition: d2d1.c:14870
static void test_transform_graph(BOOL d3d11)
Definition: d2d1.c:12829
static void test_radial_brush(BOOL d3d11)
Definition: d2d1.c:2983
static void test_effect_context(BOOL d3d11)
Definition: d2d1.c:11659
static void test_fill_geometry(BOOL d3d11)
Definition: d2d1.c:8018
static void test_effect_register(BOOL d3d11)
Definition: d2d1.c:11383
static void test_geometry_group(BOOL d3d11)
Definition: d2d1.c:10714
static void test_registered_effects(BOOL d3d11)
Definition: d2d1.c:12765
static void test_mt_factory(BOOL d3d11)
Definition: d2d1.c:10786
static void test_bezier_intersect(BOOL d3d11)
Definition: d2d1.c:8982
static void queue_test(void(*test)(BOOL d3d11))
Definition: d2d1.c:428
static void test_gradient(BOOL d3d11)
Definition: d2d1.c:7025
static void test_hwnd_target_gdi_interop(BOOL d3d11)
Definition: d2d1.c:6375
static void test_path_geometry(BOOL d3d11)
Definition: d2d1.c:3295
static void test_desktop_dpi(BOOL d3d11)
Definition: d2d1.c:6865
static void test_bitmap_updates(BOOL d3d11)
Definition: d2d1.c:5406
static void test_dc_target(BOOL d3d11)
Definition: d2d1.c:5945
static void test_bitmap_surface(BOOL d3d11)
Definition: d2d1.c:9310
static void test_skew_matrix(BOOL d3d11)
Definition: d2d1.c:9828
static void test_command_list(BOOL d3d11)
Definition: d2d1.c:9882
static void test_offset_transform(BOOL d3d11)
Definition: d2d1.c:12980
static void test_dc_target_gdi_interop(BOOL d3d11)
Definition: d2d1.c:6204
static void test_bitmap_target(BOOL d3d11)
Definition: d2d1.c:6684
static void test_linear_brush(BOOL d3d11)
Definition: d2d1.c:2794
static void test_border_transform(BOOL d3d11)
Definition: d2d1.c:13176
static void test_bitmap_brush(BOOL d3d11)
Definition: d2d1.c:2249
static void test_effect_2d_affine(BOOL d3d11)
Definition: d2d1.c:12386
static void test_create_device(BOOL d3d11)
Definition: d2d1.c:9115
static void test_shared_bitmap(BOOL d3d11)
Definition: d2d1.c:5096
static void test_effect_custom_pixel_shader(BOOL d3d11)
Definition: d2d1.c:14773
static void test_dxgi_surface_target_gdi_interop(BOOL d3d11)
Definition: d2d1.c:6478
static void test_draw_text_layout(BOOL d3d11)
Definition: d2d1.c:5767
static void test_wic_target_format(BOOL d3d11)
Definition: d2d1.c:15250
static void test_effect_crop(BOOL d3d11)
Definition: d2d1.c:12583
static void test_clip(BOOL d3d11)
Definition: d2d1.c:1704
#define GetProcAddress(x, y)
Definition: compat.h:753
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:812
MonoAssembly int argc
Definition: metahost.c:107
char *CDECL getenv(const char *name)
Definition: environ.c:227
static void test_math(void)
Definition: hlsl_d3d11.c:404
const char * winetest_platform
#define argv
Definition: mplay32.c:18
int winetest_get_mainargs(char ***pargv)

◆ test_alpha_mode()

static void test_alpha_mode ( BOOL  d3d11)
static

Definition at line 4837 of file d2d1.c.

4838{
4840 D2D1_BITMAP_PROPERTIES1 bitmap_desc1;
4841 D2D1_BITMAP_PROPERTIES bitmap_desc;
4842 ID2D1SolidColorBrush *color_brush;
4843 ID2D1BitmapBrush *bitmap_brush;
4844 struct d2d1_test_context ctx;
4846 ID2D1Bitmap1 *bitmap1;
4851 BOOL match, match2;
4854 ULONG refcount;
4855 HRESULT hr;
4856
4857 static const DWORD bitmap_data[] =
4858 {
4859 0x7f7f0000, 0x7f7f7f00, 0x7f007f00, 0x7f007f7f,
4860 0x7f00007f, 0x7f7f007f, 0x7f000000, 0x7f404040,
4861 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f000000,
4862 0x7f7f7f7f, 0x7f000000, 0x7f000000, 0x7f000000,
4863 };
4864
4865 if (!init_test_context(&ctx, d3d11))
4866 return;
4867
4868 rt = ctx.rt;
4869 ID2D1RenderTarget_SetAntialiasMode(rt, D2D1_ANTIALIAS_MODE_ALIASED);
4870
4871 set_size_u(&size, 4, 4);
4873 bitmap_desc.pixelFormat.alphaMode = D2D1_ALPHA_MODE_IGNORE;
4874 bitmap_desc.dpiX = 96.0f / 40.0f;
4875 bitmap_desc.dpiY = 96.0f / 30.0f;
4876 hr = ID2D1RenderTarget_CreateBitmap(rt, size, bitmap_data, 4 * sizeof(*bitmap_data), &bitmap_desc, &bitmap);
4877 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
4878
4879 hr = ID2D1RenderTarget_CreateBitmapBrush(rt, bitmap, NULL, NULL, &bitmap_brush);
4880 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
4881 ID2D1BitmapBrush_SetInterpolationMode(bitmap_brush, D2D1_BITMAP_INTERPOLATION_MODE_NEAREST_NEIGHBOR);
4882 ID2D1BitmapBrush_SetExtendModeX(bitmap_brush, D2D1_EXTEND_MODE_WRAP);
4883 ID2D1BitmapBrush_SetExtendModeY(bitmap_brush, D2D1_EXTEND_MODE_WRAP);
4884
4885 set_color(&color, 0.0f, 1.0f, 0.0f, 0.75f);
4886 hr = ID2D1RenderTarget_CreateSolidColorBrush(rt, &color, NULL, &color_brush);
4887 ok(SUCCEEDED(hr), "Failed to create brush, hr %#lx.\n", hr);
4888
4889 ID2D1RenderTarget_BeginDraw(rt);
4890 ID2D1RenderTarget_Clear(rt, NULL);
4891 hr = ID2D1RenderTarget_EndDraw(rt, NULL, NULL);
4892 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
4893 match = compare_surface(&ctx, "48c41aff3a130a17ee210866b2ab7d36763934d5");
4894 ok(match, "Surface does not match.\n");
4895
4896 ID2D1RenderTarget_BeginDraw(rt);
4897 set_color(&color, 1.0f, 0.0f, 0.0f, 0.25f);
4898 ID2D1RenderTarget_Clear(rt, &color);
4899 hr = ID2D1RenderTarget_EndDraw(rt, NULL, NULL);
4900 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
4901 match = compare_surface(&ctx, "6487e683730fb5a77c1911388d00b04664c5c4e4");
4902 ok(match, "Surface does not match.\n");
4903
4904 ID2D1RenderTarget_BeginDraw(rt);
4905 set_color(&color, 0.0f, 0.0f, 1.0f, 0.75f);
4906 ID2D1RenderTarget_Clear(rt, &color);
4907 hr = ID2D1RenderTarget_EndDraw(rt, NULL, NULL);
4908 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
4909 match = compare_surface(&ctx, "7a35ba09e43cbaf591388ff1ef8de56157630c98");
4910 ok(match, "Surface does not match.\n");
4911
4912 ID2D1RenderTarget_BeginDraw(rt);
4913
4914 set_rect(&rect, 0.0f, 0.0f, 160.0f, 120.0f);
4915 ID2D1RenderTarget_FillRectangle(rt, &rect, (ID2D1Brush *)bitmap_brush);
4916 set_rect(&rect, 160.0f, 0.0f, 320.0f, 120.0f);
4917 ID2D1BitmapBrush_SetOpacity(bitmap_brush, 0.75f);
4918 ID2D1RenderTarget_FillRectangle(rt, &rect, (ID2D1Brush *)bitmap_brush);
4919 set_rect(&rect, 320.0f, 0.0f, 480.0f, 120.0f);
4920 ID2D1BitmapBrush_SetOpacity(bitmap_brush, 0.25f);
4921 ID2D1RenderTarget_FillRectangle(rt, &rect, (ID2D1Brush *)bitmap_brush);
4922
4923 ID2D1Bitmap_Release(bitmap);
4924 bitmap_desc.pixelFormat.alphaMode = D2D1_ALPHA_MODE_PREMULTIPLIED;
4925 hr = ID2D1RenderTarget_CreateBitmap(rt, size, bitmap_data, 4 * sizeof(*bitmap_data), &bitmap_desc, &bitmap);
4926 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
4927 ID2D1BitmapBrush_SetBitmap(bitmap_brush, bitmap);
4928
4929 set_rect(&rect, 0.0f, 120.0f, 160.0f, 240.0f);
4930 ID2D1BitmapBrush_SetOpacity(bitmap_brush, 1.0f);
4931 ID2D1RenderTarget_FillRectangle(rt, &rect, (ID2D1Brush *)bitmap_brush);
4932 set_rect(&rect, 160.0f, 120.0f, 320.0f, 240.0f);
4933 ID2D1BitmapBrush_SetOpacity(bitmap_brush, 0.75f);
4934 ID2D1RenderTarget_FillRectangle(rt, &rect, (ID2D1Brush *)bitmap_brush);
4935 set_rect(&rect, 320.0f, 120.0f, 480.0f, 240.0f);
4936 ID2D1BitmapBrush_SetOpacity(bitmap_brush, 0.25f);
4937 ID2D1RenderTarget_FillRectangle(rt, &rect, (ID2D1Brush *)bitmap_brush);
4938
4939 set_rect(&rect, 0.0f, 240.0f, 160.0f, 360.0f);
4940 ID2D1RenderTarget_FillRectangle(rt, &rect, (ID2D1Brush *)color_brush);
4941 set_rect(&rect, 160.0f, 240.0f, 320.0f, 360.0f);
4942 ID2D1SolidColorBrush_SetOpacity(color_brush, 0.75f);
4943 ID2D1RenderTarget_FillRectangle(rt, &rect, (ID2D1Brush *)color_brush);
4944 set_rect(&rect, 320.0f, 240.0f, 480.0f, 360.0f);
4945 ID2D1SolidColorBrush_SetOpacity(color_brush, 0.25f);
4946 ID2D1RenderTarget_FillRectangle(rt, &rect, (ID2D1Brush *)color_brush);
4947
4948 hr = ID2D1RenderTarget_EndDraw(rt, NULL, NULL);
4949 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
4950 match = compare_surface(&ctx, "14f8ac64b70966c7c3c6281c59aaecdb17c3b16a");
4951 ok(match, "Surface does not match.\n");
4952
4955 rt_desc.pixelFormat.alphaMode = D2D1_ALPHA_MODE_IGNORE;
4956 rt_desc.dpiX = 0.0f;
4957 rt_desc.dpiY = 0.0f;
4961 ok(!!rt, "Failed to create render target.\n");
4962
4963 ID2D1RenderTarget_SetAntialiasMode(rt, D2D1_ANTIALIAS_MODE_ALIASED);
4964
4965 ID2D1Bitmap_Release(bitmap);
4966 bitmap_desc.pixelFormat.alphaMode = D2D1_ALPHA_MODE_IGNORE;
4967 hr = ID2D1RenderTarget_CreateBitmap(rt, size, bitmap_data, 4 * sizeof(*bitmap_data), &bitmap_desc, &bitmap);
4968 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
4969 ID2D1BitmapBrush_SetBitmap(bitmap_brush, bitmap);
4970
4971 ID2D1BitmapBrush_Release(bitmap_brush);
4972 hr = ID2D1RenderTarget_CreateBitmapBrush(rt, bitmap, NULL, NULL, &bitmap_brush);
4973 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
4974 ID2D1BitmapBrush_SetInterpolationMode(bitmap_brush, D2D1_BITMAP_INTERPOLATION_MODE_NEAREST_NEIGHBOR);
4975 ID2D1BitmapBrush_SetExtendModeX(bitmap_brush, D2D1_EXTEND_MODE_WRAP);
4976 ID2D1BitmapBrush_SetExtendModeY(bitmap_brush, D2D1_EXTEND_MODE_WRAP);
4977
4978 ID2D1SolidColorBrush_Release(color_brush);
4979 set_color(&color, 0.0f, 1.0f, 0.0f, 0.75f);
4980 hr = ID2D1RenderTarget_CreateSolidColorBrush(rt, &color, NULL, &color_brush);
4981 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
4982
4983 ID2D1RenderTarget_BeginDraw(rt);
4984 ID2D1RenderTarget_Clear(rt, NULL);
4985 hr = ID2D1RenderTarget_EndDraw(rt, NULL, NULL);
4986 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
4987 match = compare_surface(&ctx, "b44510bf2d2e61a8d7c0ad862de49a471f1fd13f");
4988 ok(match, "Surface does not match.\n");
4989
4990 ID2D1RenderTarget_BeginDraw(rt);
4991 set_color(&color, 1.0f, 0.0f, 0.0f, 0.25f);
4992 ID2D1RenderTarget_Clear(rt, &color);
4993 hr = ID2D1RenderTarget_EndDraw(rt, NULL, NULL);
4994 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
4995 match = compare_surface(&ctx, "2184f4a9198fc1de09ac85301b7a03eebadd9b81");
4996 ok(match, "Surface does not match.\n");
4997
4998 ID2D1RenderTarget_BeginDraw(rt);
4999 set_color(&color, 0.0f, 0.0f, 1.0f, 0.75f);
5000 ID2D1RenderTarget_Clear(rt, &color);
5001 hr = ID2D1RenderTarget_EndDraw(rt, NULL, NULL);
5002 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
5003 match = compare_surface(&ctx, "6527ec83b4039c895b50f9b3e144fe0cf90d1889");
5004 ok(match, "Surface does not match.\n");
5005
5006 ID2D1RenderTarget_BeginDraw(rt);
5007
5008 set_rect(&rect, 0.0f, 0.0f, 160.0f, 120.0f);
5009 ID2D1RenderTarget_FillRectangle(rt, &rect, (ID2D1Brush *)bitmap_brush);
5010 set_rect(&rect, 160.0f, 0.0f, 320.0f, 120.0f);
5011 ID2D1BitmapBrush_SetOpacity(bitmap_brush, 0.75f);
5012 ID2D1RenderTarget_FillRectangle(rt, &rect, (ID2D1Brush *)bitmap_brush);
5013 set_rect(&rect, 320.0f, 0.0f, 480.0f, 120.0f);
5014 ID2D1BitmapBrush_SetOpacity(bitmap_brush, 0.25f);
5015 ID2D1RenderTarget_FillRectangle(rt, &rect, (ID2D1Brush *)bitmap_brush);
5016
5017 ID2D1Bitmap_Release(bitmap);
5018 bitmap_desc.pixelFormat.alphaMode = D2D1_ALPHA_MODE_PREMULTIPLIED;
5019 hr = ID2D1RenderTarget_CreateBitmap(rt, size, bitmap_data, 4 * sizeof(*bitmap_data), &bitmap_desc, &bitmap);
5020 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
5021 ID2D1BitmapBrush_SetBitmap(bitmap_brush, bitmap);
5022
5023 set_rect(&rect, 0.0f, 120.0f, 160.0f, 240.0f);
5024 ID2D1BitmapBrush_SetOpacity(bitmap_brush, 1.0f);
5025 ID2D1RenderTarget_FillRectangle(rt, &rect, (ID2D1Brush *)bitmap_brush);
5026 set_rect(&rect, 160.0f, 120.0f, 320.0f, 240.0f);
5027 ID2D1BitmapBrush_SetOpacity(bitmap_brush, 0.75f);
5028 ID2D1RenderTarget_FillRectangle(rt, &rect, (ID2D1Brush *)bitmap_brush);
5029 set_rect(&rect, 320.0f, 120.0f, 480.0f, 240.0f);
5030 ID2D1BitmapBrush_SetOpacity(bitmap_brush, 0.25f);
5031 ID2D1RenderTarget_FillRectangle(rt, &rect, (ID2D1Brush *)bitmap_brush);
5032
5033 set_rect(&rect, 0.0f, 240.0f, 160.0f, 360.0f);
5034 ID2D1RenderTarget_FillRectangle(rt, &rect, (ID2D1Brush *)color_brush);
5035 set_rect(&rect, 160.0f, 240.0f, 320.0f, 360.0f);
5036 ID2D1SolidColorBrush_SetOpacity(color_brush, 0.75f);
5037 ID2D1RenderTarget_FillRectangle(rt, &rect, (ID2D1Brush *)color_brush);
5038 set_rect(&rect, 320.0f, 240.0f, 480.0f, 360.0f);
5039 ID2D1SolidColorBrush_SetOpacity(color_brush, 0.25f);
5040 ID2D1RenderTarget_FillRectangle(rt, &rect, (ID2D1Brush *)color_brush);
5041
5042 hr = ID2D1RenderTarget_EndDraw(rt, NULL, NULL);
5043 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
5044 match = compare_surface(&ctx, "465f5a3190d7bde408b3206b4be939fb22f8a3d6");
5045 ok(match, "Surface does not match.\n");
5046
5047 refcount = ID2D1Bitmap_Release(bitmap);
5048 ok(refcount == 1, "Bitmap has %lu references left.\n", refcount);
5049 ID2D1BitmapBrush_Release(bitmap_brush);
5050
5051 hr = ID2D1RenderTarget_QueryInterface(rt, &IID_ID2D1DeviceContext, (void **)&context);
5052 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
5053
5054 set_size_u(&size, 4, 4);
5055 memset(&bitmap_desc1, 0, sizeof(bitmap_desc1));
5056 bitmap_desc1.dpiX = 96.0f;
5057 bitmap_desc1.dpiY = 96.0f;
5059 bitmap_desc1.pixelFormat.alphaMode = D2D1_ALPHA_MODE_IGNORE;
5061 hr = ID2D1DeviceContext_CreateBitmap(context, size, bitmap_data, 4 * sizeof(*bitmap_data),
5062 &bitmap_desc1, &bitmap1);
5063 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
5064
5065 ID2D1DeviceContext_BeginDraw(context);
5066 ID2D1DeviceContext_SetTarget(context, (ID2D1Image *)bitmap1);
5067 set_rect(&rect, 0.0f, 2.0f, 1.0f, 2.0f);
5068 ID2D1SolidColorBrush_SetOpacity(color_brush, 1.0f);
5069 ID2D1DeviceContext_FillRectangle(context, &rect, (ID2D1Brush *)color_brush);
5070 set_rect(&rect, 1.0f, 2.0f, 3.0f, 3.0f);
5071 ID2D1SolidColorBrush_SetOpacity(color_brush, 0.75f);
5072 ID2D1DeviceContext_FillRectangle(context, &rect, (ID2D1Brush *)color_brush);
5073 set_rect(&rect, 3.0f, 2.0f, 3.0f, 3.0f);
5074 ID2D1SolidColorBrush_SetOpacity(color_brush, 0.25f);
5075 ID2D1DeviceContext_FillRectangle(context, &rect, (ID2D1Brush *)color_brush);
5076 hr = ID2D1DeviceContext_EndDraw(context, NULL, NULL);
5077 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
5078
5079 surface = ctx.surface;
5080 hr = ID2D1Bitmap1_GetSurface(bitmap1, &ctx.surface);
5081 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
5082 match = compare_surface(&ctx, "e7ee77e89745fa5d195fd78bd398738330cfcde8");
5083 match2 = compare_surface(&ctx, "4855c7c082c8ede364cf6e2dcde83f95b88aecbe");
5084 ok(match || broken(match2) /* Win7 TestBots */, "Surface does not match.\n");
5085 IDXGISurface_Release(ctx.surface);
5086 ctx.surface = surface;
5087 ID2D1DeviceContext_SetTarget(context, NULL);
5088
5089 ID2D1Bitmap1_Release(bitmap1);
5090 ID2D1DeviceContext_Release(context);
5091 ID2D1SolidColorBrush_Release(color_brush);
5092 ID2D1RenderTarget_Release(rt);
5094}
#define broken(x)
Definition: atltest.h:178
static BOOL compare_surface(struct d2d1_test_context *ctx, const char *ref_sha1)
Definition: d2d1.c:880
#define release_test_context(ctx)
Definition: d2d1.c:1265
#define init_test_context(ctx, d3d11)
Definition: d2d1.c:1288
@ D2D1_BITMAP_INTERPOLATION_MODE_NEAREST_NEIGHBOR
Definition: d2d1.idl:207
@ D2D1_FACTORY_TYPE_SINGLE_THREADED
Definition: d2d1.idl:78
@ D2D1_EXTEND_MODE_WRAP
Definition: d2d1.idl:200
@ D2D1_ANTIALIAS_MODE_ALIASED
Definition: d2d1.idl:184
D2D1_PIXEL_FORMAT pixelFormat
Definition: d2d1_1.idl:266
D2D1_BITMAP_OPTIONS bitmapOptions
Definition: d2d1_1.idl:269
D2D1_RENDER_TARGET_TYPE type
Definition: d2d1.idl:407
D2D1_PIXEL_FORMAT pixelFormat
Definition: d2d1.idl:408
D2D1_RENDER_TARGET_USAGE usage
Definition: d2d1.idl:411
D2D1_FEATURE_LEVEL minLevel
Definition: d2d1.idl:412
ID2D1DeviceContext * context
Definition: d2d1.c:323
ID2D1RenderTarget * rt
Definition: d2d1.c:322
IDXGISurface * surface
Definition: d2d1.c:321

Referenced by START_TEST().

◆ test_bezier_intersect()

static void test_bezier_intersect ( BOOL  d3d11)
static

Definition at line 8982 of file d2d1.c.

8983{
8984 D2D1_POINT_2F point = {0.0f, 0.0f};
8985 struct d2d1_test_context ctx;
8986 ID2D1SolidColorBrush *brush;
8987 ID2D1PathGeometry *geometry;
8992 HRESULT hr;
8993 BOOL match;
8994
8995 if (!init_test_context(&ctx, d3d11))
8996 return;
8997
8998 rt = ctx.rt;
8999 factory = ctx.factory;
9000
9001 ID2D1RenderTarget_SetDpi(rt, 192.0f, 48.0f);
9002 ID2D1RenderTarget_SetAntialiasMode(rt, D2D1_ANTIALIAS_MODE_ALIASED);
9003 set_color(&color, 0.890f, 0.851f, 0.600f, 1.0f);
9004 hr = ID2D1RenderTarget_CreateSolidColorBrush(rt, &color, NULL, &brush);
9005 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
9006
9007 hr = ID2D1Factory_CreatePathGeometry(factory, &geometry);
9008 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
9009 hr = ID2D1PathGeometry_Open(geometry, &sink);
9010 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
9011
9012 set_point(&point, 160.0f, 720.0f);
9013 ID2D1GeometrySink_BeginFigure(sink, point, D2D1_FIGURE_BEGIN_FILLED);
9014 cubic_to(sink, 119.0f, 720.0f, 83.0f, 600.0f, 80.0f, 474.0f);
9015 cubic_to(sink, 78.0f, 349.0f, 108.0f, 245.0f, 135.0f, 240.0f);
9016 cubic_to(sink, 163.0f, 235.0f, 180.0f, 318.0f, 176.0f, 370.0f);
9017 cubic_to(sink, 171.0f, 422.0f, 149.0f, 422.0f, 144.0f, 370.0f);
9018 cubic_to(sink, 140.0f, 318.0f, 157.0f, 235.0f, 185.0f, 240.0f);
9019 cubic_to(sink, 212.0f, 245.0f, 242.0f, 349.0f, 240.0f, 474.0f);
9020 cubic_to(sink, 238.0f, 600.0f, 201.0f, 720.0f, 160.0f, 720.0f);
9021 ID2D1GeometrySink_EndFigure(sink, D2D1_FIGURE_END_CLOSED);
9022
9023 set_point(&point, 160.0f, 240.0f);
9024 ID2D1GeometrySink_BeginFigure(sink, point, D2D1_FIGURE_BEGIN_FILLED);
9025 line_to(sink, 240.0f, 240.0f);
9026 line_to(sink, 240.0f, 720.0f);
9027 line_to(sink, 160.0f, 720.0f);
9028 ID2D1GeometrySink_EndFigure(sink, D2D1_FIGURE_END_CLOSED);
9029
9030 hr = ID2D1GeometrySink_Close(sink);
9031 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
9032 ID2D1GeometrySink_Release(sink);
9033
9034 ID2D1RenderTarget_BeginDraw(rt);
9035 set_color(&color, 0.396f, 0.180f, 0.537f, 1.0f);
9036 ID2D1RenderTarget_Clear(rt, &color);
9037 ID2D1RenderTarget_FillGeometry(rt, (ID2D1Geometry *)geometry, (ID2D1Brush *)brush, NULL);
9038 hr = ID2D1RenderTarget_EndDraw(rt, NULL, NULL);
9039 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
9040 ID2D1PathGeometry_Release(geometry);
9041
9042 match = compare_figure(&ctx, 160, 120, 320, 240, 0xff652e89, 2048,
9043 "aRQjIxRpYiIcHCJiXSwXFyxdWTQTEzRZVTsQEDtVUkIMDEJST0cKCkdPTUsICEtNSlEFBVFKSFUD"
9044 "A1VIRlkBAVlGRFsBAVtEQlwCAlxCQFwEBFxAPl0FBV0+PF0HB108Ol4ICF46OV0KCl05N14LC143"
9045 "Nl4MDF42NF8NDV80M14PD14zMV8QEF8xMF8REV8wL18SEl8vLWATE2AtLGAUFGAsK2EUFGErKWIV"
9046 "FWIpKGIWFmIoJ2IXF2InJmIYGGImJWMYGGMlJGMZGWMkI2MaGmMjImQaGmQiIWQbG2QhIGQcHGQg"
9047 "H2UcHGUfHmUdHWUeHWYdHWYdHGcdHWccG2ceHmcbGmgeHmgaGWgfH2gZGWgfH2gZGGkfH2kYF2kg"
9048 "IGkXFmogIGoWFmogIGoWFWsgIGsVFGshIWsUE2whIWwTE2whIWwTEm0hIW0SEW4hIW4REW4hIW4R"
9049 "EG8hIW8QD3AhIXAPD3AhIXAPDnEhIXEODnEhIXEODXIhIXINDHQgIHQMDHQgIHQMC3UgIHULC3Yf"
9050 "H3YLCncfH3cKCngeHngKCXkeHnkJCXodHXoJCXscHHsJCHwcHHwICH0bG30IB38aGn8HB4ABGRmA"
9051 "AQcHgQEYGIEBBwaEARYWhAEGBoUBFRWFAQYFiAETE4gBBQWKARERigEFBYwBDw+MAQUEkAEMDJAB"
9052 "BASTAQkJkwEEBJwBnAEEA50BnQEDA50BnQEDA50BnQEDA50BnQEDAp4BngECAp4BngECAp4BngEC"
9053 "Ap4BngECAp4BngECAZ8BnwEBAZ8BnwEBAZ8BnwEBAZ8BnwEBAZ8BnwEBAZ8BnwEBAZ8BnwGhAaAB"
9054 "oAGgAaABoAGgAaABoAGgAaABoAGgAaABoAGgAaABoAGgAaABoAGgAaABoAGgAaABoAGgAaABoAGg"
9055 "AaABoAGgAaABoAGgAaABoAGhAZ8BoQGfAZ8BAQGfAZ8BAQGfAZ8BAQGfAZ8BAQGfAZ8BAQKeAZ8B"
9056 "AQKeAZ4BAgKeAZ4BAgKeAZ4BAgOdAZ4BAgOdAZ4BAgOdAZ0BAwScAZ0BAwScAZ0BAwScAZ0BAwSc"
9057 "AZwBBAWbAZwBBAWbAZwBBAWbAZsBBQaaAZsBBQaaAZoBBgeZAZoBBgeZAZoBBgeZAZkBBwiYAZkB"
9058 "BwiYAZgBCAmXAZgBCAmXAZgBCAmXAZcBCQqWAZcBCQqWAZYBCguVAZYBCguVAZUBCwyUAZUBCw2T"
9059 "AZQBDA2TAZQBDA6SAZMBDQ6SAZMBDQ+RAZIBDg+RAZIBDhCQAZEBDxCQAZABEBGPAZABEBKOAY8B"
9060 "ERONAY4BEhONAY4BEhSMAY0BExWLAYwBFBWLAYwBFBaKAYsBFReJAYoBFheJAYoBFhiIAYkBFxmH"
9061 "AYgBGBqGAYcBGRuFAYYBGhuFAYUBGxyEAYUBGx2DAYQBHB6CAYMBHR+BAYIBHiCAAYEBHyF/gAEg"
9062 "In5/ISJ+fiIjfX0jJHx8JCV7eyUmenomJ3l5Jyh4eCgpd3cpK3V2Kix0dSstc3QsLnJzLS9xci4w"
9063 "cHAwMm5vMTNtbjI0bG0zNWtrNTdpajY4aGk3OmZnOTtlZjo8ZGQ8PmJjPT9hYj5BX2BAQl5eQkRc"
9064 "XUNGWltFR1lZR0lXWEhLVVZKTVNUTE9RUk5RT1BQUk5OUlRMTFRWSkpWWUdIWFtFRVteQkNdYEBA"
9065 "YGI+PmJlOztlaDg4aGs1NWtuMjJuci4vcXUrK3V6JiZ6fiIifoMBHR2DAYsBFRWLAZUBCwuVAQAA");
9066 ok(match, "Figure does not match.\n");
9067
9068 hr = ID2D1Factory_CreatePathGeometry(factory, &geometry);
9069 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
9070 hr = ID2D1PathGeometry_Open(geometry, &sink);
9071 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
9072
9073 set_point(&point, 240.0f, 720.0f);
9074 ID2D1GeometrySink_BeginFigure(sink, point, D2D1_FIGURE_BEGIN_FILLED);
9075 cubic_to(sink, 152.0f, 720.0f, 80.0f, 613.0f, 80.0f, 480.0f);
9076 cubic_to(sink, 80.0f, 347.0f, 152.0f, 240.0f, 240.0f, 240.0f);
9077 cubic_to(sink, 152.0f, 339.0f, 134.0f, 528.0f, 200.0f, 660.0f);
9078 cubic_to(sink, 212.0f, 683.0f, 225.0f, 703.0f, 240.0f, 720.0f);
9079 ID2D1GeometrySink_EndFigure(sink, D2D1_FIGURE_END_CLOSED);
9080
9081 hr = ID2D1GeometrySink_Close(sink);
9082 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
9083 ID2D1GeometrySink_Release(sink);
9084
9085 ID2D1RenderTarget_BeginDraw(rt);
9086 ID2D1RenderTarget_Clear(rt, &color);
9087 ID2D1RenderTarget_FillGeometry(rt, (ID2D1Geometry *)geometry, (ID2D1Brush *)brush, NULL);
9088 hr = ID2D1RenderTarget_EndDraw(rt, NULL, NULL);
9089 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
9090 ID2D1PathGeometry_Release(geometry);
9091
9092 match = compare_figure(&ctx, 160, 120, 320, 240, 0xff652e89, 2048,
9093 "pQIZkgIrhAI5/QE/9gFH7wFO6wFS5wFW4gFb3gFf2wFi2AFl1gFn1AFp0gFszwFuzQFxywFyyQF1"
9094 "xwF2xgF4xAF5xAF6wgF8wAF+vwF+vwF/vQGBAbwBggG7AYMBugGEAbkBhQG4AYYBtwGHAbcBiAG1"
9095 "AYkBtAGKAbQBigGzAYsBswGMAbEBjQGxAY0BsQGOAa8BjwGvAZABrgGQAa4BkQGtAZEBrQGSAawB"
9096 "kgGsAZMBqwGTAasBlAGrAZQBqgGVAakBlQGqAZUBqQGWAagBlwGoAZYBqAGXAagBlwGnAZgBpwGY"
9097 "AaYBmQGmAZkBpgGZAaUBmgGlAZoBpQGaAaUBmgGkAZsBpAGbAaQBmwGkAZsBpAGcAaMBnAGjAZwB"
9098 "owGcAaMBnAGjAZ0BogGdAaIBnQGiAZ4BoQGeAaEBngGiAZ4BoQGeAaEBnwGgAZ8BoQGeAaEBnwGh"
9099 "AZ4BoQGfAaABnwGhAZ8BoAGgAaABnwGgAaABoAGfAaABoAGgAaABnwGgAaABoAGgAaABnwGgAaAB"
9100 "oAGgAaABnwGhAZ8BoQGfAaABoAGgAaABoAGfAaEBnwGhAZ8BoQGfAaEBnwGhAZ8BoQGfAaABoAGg"
9101 "AaABoAGgAaEBnwGhAZ8BoQGfAaEBnwGhAaABoAGgAaABoAGgAaABoAGgAaEBoAGgAaABoAGgAaAB"
9102 "oQGgAaABoAGgAaABoQGfAaEBoAGhAZ8BoQGfAaIBnwGhAZ8BogGfAaEBnwGiAZ8BogGeAaIBnwGi"
9103 "AZ4BogGfAaIBngGjAZ4BowGdAaMBngGjAZ4BowGdAaQBnQGkAZ0BpAGcAaUBnAGlAZwBpQGcAaUB"
9104 "mwGmAZsBpgGbAaYBmwGmAZsBpgGbAacBmgGnAZkBqAGZAagBmQGpAZgBqQGZAagBmQGpAZgBqQGY"
9105 "AaoBlwGqAZcBqwGWAasBlgGsAZUBrQGVAawBlQGtAZQBrgGUAa0BlAGuAZMBrwGTAa8BkgGwAZEB"
9106 "sQGRAbEBkAGyAZABsgGPAbMBjwG0AY4BtAGNAbUBjQG2AYwBtgGLAbgBigG4AYoBuQGJAboBhwG7"
9107 "AYcBvAGGAb0BhQG+AYQBvwGDAcABggHBAYIBwgGAAcMBf8QBfsYBfMgBe8gBesoBeMwBd80BddAB"
9108 "c9EBcdQBb9YBbNkBatsBaN0BZeEBYuQBX+gBW+0BVvEBUvUBTvwBR4QCQIoCOZgCK6oCGQIA");
9109 ok(match, "Figure does not match.\n");
9110
9111 ID2D1SolidColorBrush_Release(brush);
9113}
static void cubic_to(ID2D1GeometrySink *sink, float x1, float y1, float x2, float y2, float x3, float y3)
Definition: d2d1.c:630
static BOOL compare_figure(struct d2d1_test_context *ctx, unsigned int x, unsigned int y, unsigned int w, unsigned int h, DWORD prev, unsigned int max_diff, const char *ref)
Definition: d2d1.c:1050
ID2D1Factory * factory
Definition: d2d1.c:324

Referenced by START_TEST().

◆ test_bitmap_brush()

static void test_bitmap_brush ( BOOL  d3d11)
static

Definition at line 2249 of file d2d1.c.

2250{
2251 D2D1_BITMAP_INTERPOLATION_MODE interpolation_mode;
2252 ID2D1TransformedGeometry *transformed_geometry;
2253 ID2D1RectangleGeometry *rectangle_geometry;
2254 D2D1_MATRIX_3X2_F matrix, tmp_matrix;
2255 D2D1_BITMAP_PROPERTIES bitmap_desc;
2256 ID2D1Bitmap *bitmap, *tmp_bitmap;
2257 D2D1_RECT_F src_rect, dst_rect;
2258 struct d2d1_test_context ctx;
2259 D2D1_EXTEND_MODE extend_mode;
2260 ID2D1BitmapBrush1 *brush1;
2261 ID2D1BitmapBrush *brush;
2268 unsigned int i;
2269 ULONG refcount;
2270 float opacity;
2271 HRESULT hr;
2272 BOOL match;
2273
2274 static const struct
2275 {
2276 D2D1_EXTEND_MODE extend_mode_x;
2277 D2D1_EXTEND_MODE extend_mode_y;
2278 float translate_x;
2279 float translate_y;
2281 }
2282 extend_mode_tests[] =
2283 {
2284 {D2D1_EXTEND_MODE_MIRROR, D2D1_EXTEND_MODE_MIRROR, -7.0f, 1.0f, {-4.0f, 0.0f, -8.0f, 4.0f}},
2285 {D2D1_EXTEND_MODE_WRAP, D2D1_EXTEND_MODE_MIRROR, -3.0f, 1.0f, {-4.0f, 4.0f, 0.0f, 0.0f}},
2286 {D2D1_EXTEND_MODE_CLAMP, D2D1_EXTEND_MODE_MIRROR, 1.0f, 1.0f, { 4.0f, 0.0f, 0.0f, 4.0f}},
2287 {D2D1_EXTEND_MODE_MIRROR, D2D1_EXTEND_MODE_WRAP, -7.0f, 5.0f, {-8.0f, 8.0f, -4.0f, 4.0f}},
2288 {D2D1_EXTEND_MODE_WRAP, D2D1_EXTEND_MODE_WRAP, -3.0f, 5.0f, { 0.0f, 4.0f, -4.0f, 8.0f}},
2289 {D2D1_EXTEND_MODE_CLAMP, D2D1_EXTEND_MODE_WRAP, 1.0f, 5.0f, { 0.0f, 8.0f, 4.0f, 4.0f}},
2290 {D2D1_EXTEND_MODE_MIRROR, D2D1_EXTEND_MODE_CLAMP, -7.0f, 9.0f, {-4.0f, 8.0f, -8.0f, 12.0f}},
2291 {D2D1_EXTEND_MODE_WRAP, D2D1_EXTEND_MODE_CLAMP, -3.0f, 9.0f, {-4.0f, 12.0f, 0.0f, 8.0f}},
2292 {D2D1_EXTEND_MODE_CLAMP, D2D1_EXTEND_MODE_CLAMP, 1.0f, 9.0f, { 4.0f, 8.0f, 0.0f, 12.0f}},
2293 };
2294 static const DWORD bitmap_data[] =
2295 {
2296 0xffff0000, 0xffffff00, 0xff00ff00, 0xff00ffff,
2297 0xff0000ff, 0xffff00ff, 0xff000000, 0xff7f7f7f,
2298 0xffffffff, 0xffffffff, 0xffffffff, 0xff000000,
2299 0xffffffff, 0xff000000, 0xff000000, 0xff000000,
2300 };
2301
2302 if (!init_test_context(&ctx, d3d11))
2303 return;
2304
2305 rt = ctx.rt;
2306 ID2D1RenderTarget_SetDpi(rt, 192.0f, 48.0f);
2307 ID2D1RenderTarget_SetAntialiasMode(rt, D2D1_ANTIALIAS_MODE_ALIASED);
2308
2309 set_size_u(&size, 4, 4);
2311 bitmap_desc.pixelFormat.alphaMode = D2D1_ALPHA_MODE_IGNORE;
2312 bitmap_desc.dpiX = 96.0f;
2313 bitmap_desc.dpiY = 96.0f;
2314 hr = ID2D1RenderTarget_CreateBitmap(rt, size, bitmap_data, 4 * sizeof(*bitmap_data), &bitmap_desc, &bitmap);
2315 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
2316 image_size = ID2D1Bitmap_GetSize(bitmap);
2317
2318 hr = ID2D1Bitmap_QueryInterface(bitmap, &IID_ID2D1Image, (void **)&image);
2319 ok(hr == S_OK || broken(hr == E_NOINTERFACE) /* Vista */, "Got unexpected hr %#lx.\n", hr);
2320 if (hr == S_OK)
2321 {
2322 ID2D1DeviceContext *context = ctx.context;
2324 D2D1_RECT_F src_rect;
2325
2326 ID2D1RenderTarget_BeginDraw(rt);
2327 set_color(&color, 0.0f, 0.0f, 1.0f, 1.0f);
2328 ID2D1RenderTarget_Clear(rt, &color);
2329
2330 ID2D1RenderTarget_GetTransform(rt, &tmp_matrix);
2332 translate_matrix(&matrix, 20.0f, 12.0f);
2333 scale_matrix(&matrix, 2.0f, 6.0f);
2334 ID2D1RenderTarget_SetTransform(rt, &matrix);
2335
2336 /* Crash on Windows 7+ */
2337 if (0)
2338 {
2339 ID2D1DeviceContext_DrawImage(context, NULL, NULL, NULL, D2D1_INTERPOLATION_MODE_NEAREST_NEIGHBOR,
2341 }
2342
2343 ID2D1DeviceContext_DrawImage(context, image, NULL, NULL, D2D1_INTERPOLATION_MODE_NEAREST_NEIGHBOR,
2345
2346 set_rect(&src_rect, 0.0f, 0.0f, image_size.width, image_size.height);
2347
2348 ID2D1DeviceContext_DrawImage(context, image, NULL, &src_rect, D2D1_INTERPOLATION_MODE_NEAREST_NEIGHBOR,
2350
2351 offset.x = -1;
2352 offset.y = -1;
2353 ID2D1DeviceContext_DrawImage(context, image, &offset, NULL, D2D1_INTERPOLATION_MODE_NEAREST_NEIGHBOR,
2355
2356 offset.x = image_size.width * 2;
2357 offset.y = image_size.height;
2358 ID2D1DeviceContext_DrawImage(context, image, &offset, NULL, D2D1_INTERPOLATION_MODE_NEAREST_NEIGHBOR,
2360
2361 offset.x = image_size.width * 3;
2362 set_rect(&src_rect, image_size.width / 2, image_size.height / 2, image_size.width, image_size.height);
2363 ID2D1DeviceContext_DrawImage(context, image, &offset, &src_rect, D2D1_INTERPOLATION_MODE_NEAREST_NEIGHBOR,
2365
2366 offset.x = image_size.width * 4;
2367 set_rect(&src_rect, 0.0f, 0.0f, image_size.width * 2, image_size.height * 2);
2368 ID2D1DeviceContext_DrawImage(context, image, &offset, &src_rect, D2D1_INTERPOLATION_MODE_NEAREST_NEIGHBOR,
2370
2371 offset.x = image_size.width * 5;
2372 set_rect(&src_rect, image_size.width, image_size.height, 0.0f, 0.0f);
2373 ID2D1DeviceContext_DrawImage(context, image, &offset, &src_rect, D2D1_INTERPOLATION_MODE_NEAREST_NEIGHBOR,
2375
2376 hr = ID2D1RenderTarget_EndDraw(rt, NULL, NULL);
2377 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
2378 match = compare_surface(&ctx, "95675fbc4a16404c9568d41b14e8f6be64240998");
2379 ok(match, "Surface does not match.\n");
2380
2381 ID2D1RenderTarget_BeginDraw(rt);
2382
2383 offset.x = image_size.width * 6;
2384 set_rect(&src_rect, 1.0f, 0.0f, 1.0f, image_size.height);
2385 ID2D1DeviceContext_DrawImage(context, image, &offset, &src_rect, D2D1_INTERPOLATION_MODE_NEAREST_NEIGHBOR,
2387
2388 hr = ID2D1RenderTarget_EndDraw(rt, NULL, NULL);
2389 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
2390 match = compare_surface(&ctx, "95675fbc4a16404c9568d41b14e8f6be64240998");
2391 ok(match, "Surface does not match.\n");
2392
2393 ID2D1RenderTarget_SetTransform(rt, &tmp_matrix);
2394 ID2D1Image_Release(image);
2395 }
2396
2397 /* Creating a brush with a NULL bitmap crashes on Vista, but works fine on
2398 * Windows 7+. */
2399 hr = ID2D1RenderTarget_CreateBitmapBrush(rt, bitmap, NULL, NULL, &brush);
2400 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
2401 ID2D1BitmapBrush_GetBitmap(brush, &tmp_bitmap);
2402 ok(tmp_bitmap == bitmap, "Got unexpected bitmap %p, expected %p.\n", tmp_bitmap, bitmap);
2403 ID2D1Bitmap_Release(tmp_bitmap);
2404 opacity = ID2D1BitmapBrush_GetOpacity(brush);
2405 ok(opacity == 1.0f, "Got unexpected opacity %.8e.\n", opacity);
2407 ID2D1BitmapBrush_GetTransform(brush, &tmp_matrix);
2408 ok(!memcmp(&tmp_matrix, &matrix, sizeof(matrix)),
2409 "Got unexpected matrix {%.8e, %.8e, %.8e, %.8e, %.8e, %.8e}.\n",
2410 tmp_matrix._11, tmp_matrix._12, tmp_matrix._21,
2411 tmp_matrix._22, tmp_matrix._31, tmp_matrix._32);
2412 extend_mode = ID2D1BitmapBrush_GetExtendModeX(brush);
2413 ok(extend_mode == D2D1_EXTEND_MODE_CLAMP, "Got unexpected extend mode %#x.\n", extend_mode);
2414 extend_mode = ID2D1BitmapBrush_GetExtendModeY(brush);
2415 ok(extend_mode == D2D1_EXTEND_MODE_CLAMP, "Got unexpected extend mode %#x.\n", extend_mode);
2416 interpolation_mode = ID2D1BitmapBrush_GetInterpolationMode(brush);
2417 ok(interpolation_mode == D2D1_BITMAP_INTERPOLATION_MODE_LINEAR,
2418 "Got unexpected interpolation mode %#x.\n", interpolation_mode);
2419 ID2D1BitmapBrush_Release(brush);
2420
2421 hr = ID2D1RenderTarget_CreateBitmapBrush(rt, bitmap, NULL, NULL, &brush);
2422 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
2424 translate_matrix(&matrix, 40.0f, 120.0f);
2425 scale_matrix(&matrix, 20.0f, 60.0f);
2426 ID2D1BitmapBrush_SetTransform(brush, &matrix);
2427 ID2D1BitmapBrush_SetInterpolationMode(brush, D2D1_BITMAP_INTERPOLATION_MODE_NEAREST_NEIGHBOR);
2428
2429 ID2D1RenderTarget_BeginDraw(rt);
2430
2431 set_color(&color, 0.0f, 0.0f, 1.0f, 1.0f);
2432 ID2D1RenderTarget_Clear(rt, &color);
2433
2434 set_rect(&dst_rect, 40.0f, 120.0f, 120.0f, 360.0f);
2435 ID2D1RenderTarget_FillRectangle(rt, &dst_rect, (ID2D1Brush *)brush);
2436
2438 scale_matrix(&matrix, 0.5f, 2.0f);
2439 translate_matrix(&matrix, 320.0f, 240.0f);
2440 rotate_matrix(&matrix, M_PI / 4.0f);
2441 ID2D1RenderTarget_SetTransform(rt, &matrix);
2443 translate_matrix(&matrix, -80.0f, -60.0f);
2444 scale_matrix(&matrix, 64.0f, 32.0f);
2445 ID2D1BitmapBrush_SetTransform(brush, &matrix);
2446 ID2D1BitmapBrush_SetOpacity(brush, 0.75f);
2447 set_rect(&dst_rect, -80.0f, -60.0f, 80.0f, 60.0f);
2448 ID2D1RenderTarget_FillRectangle(rt, &dst_rect, (ID2D1Brush *)brush);
2449
2451 translate_matrix(&matrix, 200.0f, 120.0f);
2452 scale_matrix(&matrix, 20.0f, 60.0f);
2453 ID2D1RenderTarget_SetTransform(rt, &matrix);
2454 ID2D1RenderTarget_DrawBitmap(rt, bitmap, NULL, 0.25f,
2456 set_rect(&dst_rect, -4.0f, 12.0f, -8.0f, 8.0f);
2457 ID2D1RenderTarget_DrawBitmap(rt, bitmap, &dst_rect, 0.75f,
2459 set_rect(&dst_rect, 0.0f, 8.0f, 4.0f, 12.0f);
2460 set_rect(&src_rect, 2.0f, 1.0f, 4.0f, 3.0f);
2461 ID2D1RenderTarget_DrawBitmap(rt, bitmap, &dst_rect, 1.0f,
2463 set_rect(&dst_rect, 4.0f, 12.0f, 12.0f, 20.0f);
2464 set_rect(&src_rect, 0.0f, 0.0f, image_size.width * 2, image_size.height * 2);
2465 ID2D1RenderTarget_DrawBitmap(rt, bitmap, &dst_rect, 1.0f,
2467 set_rect(&dst_rect, 4.0f, 8.0f, 12.0f, 12.0f);
2468 set_rect(&src_rect, image_size.width / 2, image_size.height / 2, image_size.width, image_size.height);
2469 ID2D1RenderTarget_DrawBitmap(rt, bitmap, &dst_rect, 1.0f,
2471 set_rect(&dst_rect, 0.0f, 4.0f, 4.0f, 8.0f);
2472 set_rect(&src_rect, image_size.width, 0.0f, 0.0f, image_size.height);
2473 ID2D1RenderTarget_DrawBitmap(rt, bitmap, &dst_rect, 1.0f,
2475
2476 hr = ID2D1RenderTarget_EndDraw(rt, NULL, NULL);
2477 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
2478 match = compare_surface(&ctx, "f5d039c280fa33ba05496c9883192a34108efbbe");
2479 ok(match, "Surface does not match.\n");
2480
2481 /* Invalid interpolation mode. */
2482 ID2D1RenderTarget_BeginDraw(rt);
2483
2484 set_rect(&dst_rect, 4.0f, 8.0f, 8.0f, 12.0f);
2485 set_rect(&src_rect, 0.0f, 1.0f, image_size.width, 1.0f);
2486 ID2D1RenderTarget_DrawBitmap(rt, bitmap, &dst_rect, 1.0f,
2488
2489 set_rect(&dst_rect, 1.0f, 8.0f, 4.0f, 12.0f);
2490 set_rect(&src_rect, 2.0f, 1.0f, 4.0f, 3.0f);
2491 ID2D1RenderTarget_DrawBitmap(rt, bitmap, &dst_rect, 1.0f,
2493
2494 hr = ID2D1RenderTarget_EndDraw(rt, NULL, NULL);
2495 ok(hr == E_INVALIDARG, "Got unexpected hr %#lx.\n", hr);
2496 match = compare_surface(&ctx, "f5d039c280fa33ba05496c9883192a34108efbbe");
2497 ok(match, "Surface does not match.\n");
2498
2499 ID2D1RenderTarget_BeginDraw(rt);
2500 ID2D1RenderTarget_Clear(rt, &color);
2501
2502 set_rect(&src_rect, image_size.width, 0.0f, 0.0f, image_size.height);
2503 ID2D1RenderTarget_DrawBitmap(rt, bitmap, NULL, 1.0f,
2505
2506 hr = ID2D1RenderTarget_EndDraw(rt, NULL, NULL);
2507 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
2508 match = compare_surface(&ctx, "59043096393570ad800dbcbfdd644394b79493bd");
2509 ok(match, "Surface does not match.\n");
2510
2511 ID2D1RenderTarget_BeginDraw(rt);
2512
2513 ID2D1RenderTarget_Clear(rt, &color);
2514
2515 ID2D1BitmapBrush_SetOpacity(brush, 1.0f);
2516 for (i = 0; i < ARRAY_SIZE(extend_mode_tests); ++i)
2517 {
2518 ID2D1BitmapBrush_SetExtendModeX(brush, extend_mode_tests[i].extend_mode_x);
2519 extend_mode = ID2D1BitmapBrush_GetExtendModeX(brush);
2520 ok(extend_mode == extend_mode_tests[i].extend_mode_x,
2521 "Test %u: Got unexpected extend mode %#x, expected %#x.\n",
2522 i, extend_mode, extend_mode_tests[i].extend_mode_x);
2523 ID2D1BitmapBrush_SetExtendModeY(brush, extend_mode_tests[i].extend_mode_y);
2524 extend_mode = ID2D1BitmapBrush_GetExtendModeY(brush);
2525 ok(extend_mode == extend_mode_tests[i].extend_mode_y,
2526 "Test %u: Got unexpected extend mode %#x, expected %#x.\n",
2527 i, extend_mode, extend_mode_tests[i].extend_mode_y);
2529 translate_matrix(&matrix, extend_mode_tests[i].translate_x, extend_mode_tests[i].translate_y);
2530 scale_matrix(&matrix, 0.5f, 0.5f);
2531 ID2D1BitmapBrush_SetTransform(brush, &matrix);
2532 ID2D1RenderTarget_FillRectangle(rt, &extend_mode_tests[i].rect, (ID2D1Brush *)brush);
2533 }
2534
2535 hr = ID2D1RenderTarget_EndDraw(rt, NULL, NULL);
2536 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
2537 match = compare_surface(&ctx, "b4b775afecdae2d26642001f4faff73663bb8b31");
2538 ok(match, "Surface does not match.\n");
2539
2540 ID2D1Bitmap_Release(bitmap);
2541 bitmap_desc.dpiX = 96.0f / 20.0f;
2542 bitmap_desc.dpiY = 96.0f / 60.0f;
2543 hr = ID2D1RenderTarget_CreateBitmap(rt, size, bitmap_data, 4 * sizeof(*bitmap_data), &bitmap_desc, &bitmap);
2544 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
2545 ID2D1BitmapBrush_SetBitmap(brush, bitmap);
2546
2547 ID2D1RenderTarget_BeginDraw(rt);
2548
2549 ID2D1RenderTarget_Clear(rt, &color);
2550
2552 translate_matrix(&matrix, 40.0f, 120.0f);
2553 skew_matrix(&matrix, 0.125f, 2.0f);
2554 ID2D1RenderTarget_SetTransform(rt, &matrix);
2556 ID2D1BitmapBrush_SetTransform(brush, &matrix);
2557 set_rect(&dst_rect, 0.0f, 0.0f, 80.0f, 240.0f);
2558 ID2D1RenderTarget_FillRectangle(rt, &dst_rect, (ID2D1Brush *)brush);
2559
2560 factory = ctx.factory;
2561
2562 set_rect(&dst_rect, -1.0f, -1.0f, 1.0f, 1.0f);
2563 hr = ID2D1Factory_CreateRectangleGeometry(factory, &dst_rect, &rectangle_geometry);
2564 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
2565
2567 translate_matrix(&matrix, 240.0f, 720.0f);
2568 scale_matrix(&matrix, 40.0f, 120.0f);
2569 hr = ID2D1Factory_CreateTransformedGeometry(factory, (ID2D1Geometry *)rectangle_geometry,
2570 &matrix, &transformed_geometry);
2571 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
2572 ID2D1RectangleGeometry_Release(rectangle_geometry);
2573
2575 ID2D1RenderTarget_SetTransform(rt, &matrix);
2577 translate_matrix(&matrix, 200.0f, 600.0f);
2578 ID2D1BitmapBrush_SetTransform(brush, &matrix);
2579 ID2D1RenderTarget_FillGeometry(rt, (ID2D1Geometry *)transformed_geometry, (ID2D1Brush *)brush, NULL);
2580 ID2D1TransformedGeometry_Release(transformed_geometry);
2581
2582 hr = ID2D1RenderTarget_EndDraw(rt, NULL, NULL);
2583 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
2584 match = compare_surface(&ctx, "cf7b90ba7b139fdfbe9347e1907d635cfb4ed197");
2585 ok(match, "Surface does not match.\n");
2586
2587 if (SUCCEEDED(ID2D1BitmapBrush_QueryInterface(brush, &IID_ID2D1BitmapBrush1, (void **)&brush1)))
2588 {
2589 D2D1_INTERPOLATION_MODE interpolation_mode1;
2590
2591 interpolation_mode = ID2D1BitmapBrush1_GetInterpolationMode(brush1);
2593 "Unexpected interpolation mode %#x.\n", interpolation_mode);
2594
2595 interpolation_mode1 = ID2D1BitmapBrush1_GetInterpolationMode1(brush1);
2596 ok(interpolation_mode1 == D2D1_INTERPOLATION_MODE_NEAREST_NEIGHBOR,
2597 "Unexpected interpolation mode %#x.\n", interpolation_mode1);
2598
2599 ID2D1BitmapBrush1_SetInterpolationMode1(brush1, D2D1_INTERPOLATION_MODE_CUBIC);
2600 interpolation_mode = ID2D1BitmapBrush1_GetInterpolationMode(brush1);
2601 ok(interpolation_mode == D2D1_BITMAP_INTERPOLATION_MODE_LINEAR,
2602 "Unexpected interpolation mode %#x.\n", interpolation_mode);
2603
2604 interpolation_mode1 = ID2D1BitmapBrush1_GetInterpolationMode1(brush1);
2605 ok(interpolation_mode1 == D2D1_INTERPOLATION_MODE_CUBIC,
2606 "Unexpected interpolation mode %#x.\n", interpolation_mode1);
2607
2608 ID2D1BitmapBrush1_SetInterpolationMode1(brush1, 100);
2609 interpolation_mode1 = ID2D1BitmapBrush1_GetInterpolationMode1(brush1);
2610 ok(interpolation_mode1 == D2D1_INTERPOLATION_MODE_CUBIC,
2611 "Unexpected interpolation mode %#x.\n", interpolation_mode1);
2612
2613 ID2D1BitmapBrush1_SetInterpolationMode(brush1, 100);
2614 interpolation_mode1 = ID2D1BitmapBrush1_GetInterpolationMode1(brush1);
2615 ok(interpolation_mode1 == D2D1_INTERPOLATION_MODE_CUBIC,
2616 "Unexpected interpolation mode %#x.\n", interpolation_mode1);
2617
2618 ID2D1BitmapBrush1_SetInterpolationMode(brush1, D2D1_BITMAP_INTERPOLATION_MODE_NEAREST_NEIGHBOR);
2619 interpolation_mode = ID2D1BitmapBrush1_GetInterpolationMode(brush1);
2621 "Unexpected interpolation mode %#x.\n", interpolation_mode);
2622
2623 interpolation_mode1 = ID2D1BitmapBrush1_GetInterpolationMode1(brush1);
2624 ok(interpolation_mode1 == D2D1_INTERPOLATION_MODE_NEAREST_NEIGHBOR,
2625 "Unexpected interpolation mode %#x.\n", interpolation_mode1);
2626
2627 ID2D1BitmapBrush1_Release(brush1);
2628 }
2629
2630 ID2D1BitmapBrush_Release(brush);
2631 refcount = ID2D1Bitmap_Release(bitmap);
2632 ok(!refcount, "Bitmap has %lu references left.\n", refcount);
2634}
static void rotate_matrix(D2D1_MATRIX_3X2_F *matrix, float theta)
Definition: d2d1.c:572
static void skew_matrix(D2D1_MATRIX_3X2_F *matrix, float x, float y)
Definition: d2d1.c:587
static void translate_matrix(D2D1_MATRIX_3X2_F *matrix, float x, float y)
Definition: d2d1.c:608
static void scale_matrix(D2D1_MATRIX_3X2_F *matrix, float x, float y)
Definition: d2d1.c:600
static void set_matrix_identity(D2D1_MATRIX_3X2_F *matrix)
Definition: d2d1.c:562
D2D1_BITMAP_INTERPOLATION_MODE
Definition: d2d1.idl:206
@ D2D1_BITMAP_INTERPOLATION_MODE_LINEAR
Definition: d2d1.idl:208
D2D1_EXTEND_MODE
Definition: d2d1.idl:198
@ D2D1_EXTEND_MODE_MIRROR
Definition: d2d1.idl:201
@ D2D1_EXTEND_MODE_CLAMP
Definition: d2d1.idl:199
D2D1_INTERPOLATION_MODE
Definition: d2d1_1.idl:124
@ D2D1_INTERPOLATION_MODE_CUBIC
Definition: d2d1_1.idl:127
@ D2D1_INTERPOLATION_MODE_NEAREST_NEIGHBOR
Definition: d2d1_1.idl:125
@ D2D1_COMPOSITE_MODE_SOURCE_OVER
Definition: d2d1_1.idl:136
GLintptr offset
Definition: glext.h:5920
#define M_PI
Definition: macros.h:263
static GLint image_size(GLint width, GLint height, GLenum format, GLenum type)
Definition: mipmap.c:4858
Definition: image.c:84

Referenced by START_TEST().

◆ test_bitmap_create()

static void test_bitmap_create ( BOOL  d3d11)
static

Definition at line 14035 of file d2d1.c.

14036{
14037 static const struct
14038 {
14039 unsigned int options;
14040 } invalid_options[] =
14041 {
14045 };
14046 static const struct
14047 {
14048 unsigned int options;
14049 } valid_options[] =
14050 {
14057 };
14058 D2D1_BITMAP_PROPERTIES1 bitmap_desc;
14059 struct d2d1_test_context ctx;
14062 unsigned int i;
14063 HRESULT hr;
14064
14065 if (!init_test_context(&ctx, d3d11))
14066 return;
14067
14068 for (i = 0; i < ARRAY_SIZE(invalid_options); ++i)
14069 {
14070 winetest_push_context("Test %u", i);
14071
14072 set_size_u(&size, 4, 4);
14073 bitmap_desc.dpiX = 96.0f;
14074 bitmap_desc.dpiY = 96.0f;
14076 bitmap_desc.pixelFormat.alphaMode = D2D1_ALPHA_MODE_IGNORE;
14077 bitmap_desc.bitmapOptions = invalid_options[i].options;
14078 bitmap_desc.colorContext = NULL;
14079 hr = ID2D1DeviceContext_CreateBitmap(ctx.context, size, NULL, 0, &bitmap_desc, &bitmap);
14080 ok(hr == E_INVALIDARG, "Got unexpected hr %#lx.\n", hr);
14081
14083 }
14084
14085 for (i = 0; i < ARRAY_SIZE(valid_options); ++i)
14086 {
14087 winetest_push_context("Test %u", i);
14088
14089 set_size_u(&size, 4, 4);
14090 bitmap_desc.dpiX = 96.0f;
14091 bitmap_desc.dpiY = 96.0f;
14093 bitmap_desc.pixelFormat.alphaMode = D2D1_ALPHA_MODE_IGNORE;
14094 bitmap_desc.bitmapOptions = valid_options[i].options;
14095 bitmap_desc.colorContext = NULL;
14096 hr = ID2D1DeviceContext_CreateBitmap(ctx.context, size, NULL, 0, &bitmap_desc, &bitmap);
14097 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
14098 ID2D1Bitmap1_Release(bitmap);
14099
14101 }
14102
14104}
@ D2D1_BITMAP_OPTIONS_CPU_READ
Definition: d2d1_1.idl:91
@ D2D1_BITMAP_OPTIONS_NONE
Definition: d2d1_1.idl:88
ID2D1ColorContext * colorContext
Definition: d2d1_1.idl:270

Referenced by START_TEST().

◆ test_bitmap_formats()

static void test_bitmap_formats ( BOOL  d3d11)
static

Definition at line 4774 of file d2d1.c.

4775{
4776 D2D1_BITMAP_PROPERTIES bitmap_desc;
4777 struct d2d1_test_context ctx;
4778 D2D1_SIZE_U size = {4, 4};
4781 unsigned int i, j;
4782 HRESULT hr;
4783
4784 static const struct
4785 {
4787 DWORD mask;
4788 }
4789 bitmap_formats[] =
4790 {
4800 {DXGI_FORMAT_A8_UNORM, 0x06},
4805 };
4806
4807 if (!init_test_context(&ctx, d3d11))
4808 return;
4809
4810 rt = ctx.rt;
4811 bitmap_desc.dpiX = 96.0f;
4812 bitmap_desc.dpiY = 96.0f;
4813 for (i = 0; i < ARRAY_SIZE(bitmap_formats); ++i)
4814 {
4815 for (j = 0; j < 4; ++j)
4816 {
4817 if ((bitmap_formats[i].mask & (0x80 | (1u << j))) == (0x80 | (1u << j)))
4818 continue;
4819
4820 bitmap_desc.pixelFormat.format = bitmap_formats[i].format;
4821 bitmap_desc.pixelFormat.alphaMode = j;
4822 hr = ID2D1RenderTarget_CreateBitmap(rt, size, NULL, 0, &bitmap_desc, &bitmap);
4823 if (bitmap_formats[i].mask & (1u << j))
4824 ok(hr == S_OK, "Got unexpected hr %#lx, for format %#x/%#x.\n",
4825 hr, bitmap_formats[i].format, j);
4826 else
4827 ok(hr == D2DERR_UNSUPPORTED_PIXEL_FORMAT, "Got unexpected hr %#lx, for format %#x/%#x.\n",
4828 hr, bitmap_formats[i].format, j);
4829 if (SUCCEEDED(hr))
4830 ID2D1Bitmap_Release(bitmap);
4831 }
4832 }
4833
4835}
DXGI_FORMAT
Definition: dxgiformat.idl:22
@ DXGI_FORMAT_R16G16B16A16_UNORM
Definition: dxgiformat.idl:34
@ DXGI_FORMAT_R8G8B8A8_TYPELESS
Definition: dxgiformat.idl:50
@ DXGI_FORMAT_B8G8R8A8_UNORM_SRGB
Definition: dxgiformat.idl:114
@ DXGI_FORMAT_B8G8R8A8_TYPELESS
Definition: dxgiformat.idl:113
@ DXGI_FORMAT_R8G8B8A8_SINT
Definition: dxgiformat.idl:55
@ DXGI_FORMAT_R8G8B8A8_SNORM
Definition: dxgiformat.idl:54
@ DXGI_FORMAT_A8_UNORM
Definition: dxgiformat.idl:88
@ DXGI_FORMAT_R8G8B8A8_UINT
Definition: dxgiformat.idl:53
@ DXGI_FORMAT_R16G16B16A16_FLOAT
Definition: dxgiformat.idl:33
@ DXGI_FORMAT_R8G8B8A8_UNORM
Definition: dxgiformat.idl:51
@ DXGI_FORMAT_R32G32B32A32_FLOAT
Definition: dxgiformat.idl:25
@ DXGI_FORMAT_R8G8B8A8_UNORM_SRGB
Definition: dxgiformat.idl:52
@ DXGI_FORMAT_B8G8R8X8_UNORM
Definition: dxgiformat.idl:111
GLenum GLint GLuint mask
Definition: glext.h:6028

Referenced by START_TEST().

◆ test_bitmap_map()

static void test_bitmap_map ( BOOL  d3d11)
static

Definition at line 13752 of file d2d1.c.

13753{
13754 static const struct
13755 {
13756 unsigned int options;
13757 } invalid_map_options[] =
13758 {
13763 };
13764 static const struct
13765 {
13766 unsigned int options;
13767 } valid_map_options[] =
13768 {
13770 };
13771 static const struct
13772 {
13773 unsigned int bind_flags;
13774 unsigned int options;
13775 HRESULT hr;
13776 } options_tests[] =
13777 {
13778 { D3D11_BIND_RENDER_TARGET | D3D11_BIND_SHADER_RESOURCE,
13780 { D3D11_BIND_RENDER_TARGET, D2D1_BITMAP_OPTIONS_TARGET | D2D1_BITMAP_OPTIONS_CANNOT_DRAW },
13781 { D3D11_BIND_RENDER_TARGET | D3D11_BIND_SHADER_RESOURCE, D2D1_BITMAP_OPTIONS_NONE },
13783
13786 { D3D11_BIND_RENDER_TARGET, D2D1_BITMAP_OPTIONS_TARGET, E_INVALIDARG },
13787 { D3D11_BIND_RENDER_TARGET, D2D1_BITMAP_OPTIONS_NONE, E_INVALIDARG },
13788 };
13789 D2D1_BITMAP_PROPERTIES1 bitmap_desc;
13790 D3D11_TEXTURE2D_DESC texture_desc;
13791 ID2D1Bitmap *bitmap2, *bitmap3;
13792 struct d2d1_test_context ctx;
13793 D2D1_MAPPED_RECT mapped_rect;
13794 ID3D11Device *d3d_device;
13795 ID3D11Texture2D *texture;
13796 unsigned int i, options;
13800 HRESULT hr;
13801
13802 if (!init_test_context(&ctx, d3d11))
13803 return;
13804
13805 for (i = 0; i < ARRAY_SIZE(invalid_map_options); ++i)
13806 {
13807 winetest_push_context("Test %u", i);
13808
13809 set_size_u(&size, 4, 4);
13810 bitmap_desc.dpiX = 96.0f;
13811 bitmap_desc.dpiY = 96.0f;
13813 bitmap_desc.pixelFormat.alphaMode = D2D1_ALPHA_MODE_IGNORE;
13814 bitmap_desc.bitmapOptions = invalid_map_options[i].options;
13815 bitmap_desc.colorContext = NULL;
13816 hr = ID2D1DeviceContext_CreateBitmap(ctx.context, size, NULL, 0, &bitmap_desc, &bitmap);
13817 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
13818
13819 hr = ID2D1Bitmap1_Map(bitmap, D2D1_MAP_OPTIONS_NONE, &mapped_rect);
13820 ok(hr == E_INVALIDARG, "Got unexpected hr %#lx.\n", hr);
13821 hr = ID2D1Bitmap1_Map(bitmap, D2D1_MAP_OPTIONS_READ, &mapped_rect);
13822 ok(hr == E_INVALIDARG, "Got unexpected hr %#lx.\n", hr);
13823 hr = ID2D1Bitmap1_Map(bitmap, D2D1_MAP_OPTIONS_WRITE, &mapped_rect);
13824 ok(hr == E_INVALIDARG, "Got unexpected hr %#lx.\n", hr);
13825
13826 hr = ID2D1Bitmap1_GetSurface(bitmap, &surface);
13827 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
13828 hr = IDXGISurface_QueryInterface(surface, &IID_ID3D11Texture2D, (void **)&texture);
13829 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
13830 ID3D11Texture2D_GetDesc(texture, &texture_desc);
13831 ok(!texture_desc.CPUAccessFlags, "Unexpected CPU access flags %#x.\n", texture_desc.CPUAccessFlags);
13832 ID3D11Texture2D_Release(texture);
13833 IDXGISurface_Release(surface);
13834
13835 ID2D1Bitmap1_Release(bitmap);
13836
13838 }
13839
13840 for (i = 0; i < ARRAY_SIZE(valid_map_options); ++i)
13841 {
13842 winetest_push_context("Test %u", i);
13843
13844 set_size_u(&size, 4, 4);
13845 bitmap_desc.dpiX = 96.0f;
13846 bitmap_desc.dpiY = 96.0f;
13848 bitmap_desc.pixelFormat.alphaMode = D2D1_ALPHA_MODE_IGNORE;
13849 bitmap_desc.bitmapOptions = valid_map_options[i].options;
13850 bitmap_desc.colorContext = NULL;
13851 hr = ID2D1DeviceContext_CreateBitmap(ctx.context, size, NULL, 0, &bitmap_desc, &bitmap);
13852 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
13853
13854 hr = ID2D1Bitmap1_Map(bitmap, D2D1_MAP_OPTIONS_NONE, &mapped_rect);
13855 ok(hr == E_INVALIDARG, "Got unexpected hr %#lx.\n", hr);
13856
13857 hr = ID2D1Bitmap1_Map(bitmap, D2D1_MAP_OPTIONS_READ, &mapped_rect);
13858 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
13859 hr = ID2D1Bitmap1_Map(bitmap, D2D1_MAP_OPTIONS_READ, &mapped_rect);
13860 ok(hr == D2DERR_WRONG_STATE, "Got unexpected hr %#lx.\n", hr);
13861 hr = ID2D1Bitmap1_Map(bitmap, D2D1_MAP_OPTIONS_WRITE, &mapped_rect);
13862 todo_wine
13863 ok(hr == E_INVALIDARG, "Got unexpected hr %#lx.\n", hr);
13864
13865 hr = ID2D1Bitmap1_Unmap(bitmap);
13866 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
13867 hr = ID2D1Bitmap1_Unmap(bitmap);
13868 ok(hr == D2DERR_WRONG_STATE, "Got unexpected hr %#lx.\n", hr);
13869
13870 hr = ID2D1Bitmap1_Map(bitmap, D2D1_MAP_OPTIONS_WRITE, &mapped_rect);
13871 ok(hr == E_INVALIDARG, "Got unexpected hr %#lx.\n", hr);
13872 hr = ID2D1Bitmap1_Map(bitmap, D2D1_MAP_OPTIONS_READ | D2D1_MAP_OPTIONS_DISCARD, &mapped_rect);
13873 ok(hr == E_INVALIDARG, "Got unexpected hr %#lx.\n", hr);
13874 hr = ID2D1Bitmap1_Map(bitmap, D2D1_MAP_OPTIONS_WRITE | D2D1_MAP_OPTIONS_DISCARD, &mapped_rect);
13875 ok(hr == E_INVALIDARG, "Got unexpected hr %#lx.\n", hr);
13876 hr = ID2D1Bitmap1_Map(bitmap, D2D1_MAP_OPTIONS_READ | D2D1_MAP_OPTIONS_WRITE, &mapped_rect);
13877 ok(hr == E_INVALIDARG, "Got unexpected hr %#lx.\n", hr);
13878
13879 hr = ID2D1Bitmap1_GetSurface(bitmap, &surface);
13880 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
13881 hr = IDXGISurface_QueryInterface(surface, &IID_ID3D11Texture2D, (void **)&texture);
13882 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
13883 ID3D11Texture2D_GetDesc(texture, &texture_desc);
13884 ok(texture_desc.Usage == D3D11_USAGE_STAGING, "Unexpected usage %u.\n", texture_desc.Usage);
13885 ok(!texture_desc.BindFlags, "Unexpected bind flags %#x.\n", texture_desc.BindFlags);
13886 ok(texture_desc.CPUAccessFlags == D3D11_CPU_ACCESS_READ, "Unexpected CPU access flags %#x.\n",
13887 texture_desc.CPUAccessFlags);
13888 ok(!texture_desc.MiscFlags, "Unexpected misc flags %#x.\n", texture_desc.MiscFlags);
13889 ID3D11Texture2D_Release(texture);
13890 IDXGISurface_Release(surface);
13891
13892 ID2D1Bitmap1_Release(bitmap);
13893
13895 }
13896
13897 hr = IDXGIDevice_QueryInterface(ctx.device, &IID_ID3D11Device, (void **)&d3d_device);
13898 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
13899
13900 texture_desc.Width = 4;
13901 texture_desc.Height = 4;
13902 texture_desc.MipLevels = 1;
13903 texture_desc.ArraySize = 1;
13904 texture_desc.Format = DXGI_FORMAT_B8G8R8A8_UNORM;
13905 texture_desc.SampleDesc.Count = 1;
13906 texture_desc.SampleDesc.Quality = 0;
13907 texture_desc.Usage = D3D11_USAGE_STAGING;
13908 texture_desc.BindFlags = 0;
13909 texture_desc.CPUAccessFlags = D3D11_CPU_ACCESS_READ | D3D11_CPU_ACCESS_WRITE;
13910 texture_desc.MiscFlags = 0;
13911
13912 hr = ID3D11Device_CreateTexture2D(d3d_device, &texture_desc, NULL, &texture);
13913 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
13914 hr = ID3D11Texture2D_QueryInterface(texture, &IID_IDXGISurface, (void **)&surface);
13915 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
13916
13918 hr = ID2D1DeviceContext_CreateBitmapFromDxgiSurface(ctx.context, surface, &bitmap_desc, &bitmap);
13919 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
13920
13921 hr = ID2D1Bitmap1_Map(bitmap, D2D1_MAP_OPTIONS_READ | D2D1_MAP_OPTIONS_DISCARD, &mapped_rect);
13922 ok(hr == E_INVALIDARG, "Got unexpected hr %#lx.\n", hr);
13923 hr = ID2D1Bitmap1_Map(bitmap, D2D1_MAP_OPTIONS_READ, &mapped_rect);
13924 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
13925 hr = ID2D1Bitmap1_Unmap(bitmap);
13926 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
13927
13928 hr = ID2D1Bitmap1_Map(bitmap, D2D1_MAP_OPTIONS_WRITE, &mapped_rect);
13929 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
13930 hr = ID2D1Bitmap1_Unmap(bitmap);
13931 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
13932
13933 hr = ID2D1Bitmap1_Map(bitmap, D2D1_MAP_OPTIONS_WRITE | D2D1_MAP_OPTIONS_READ, &mapped_rect);
13934 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
13935 hr = ID2D1Bitmap1_Unmap(bitmap);
13936 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
13937
13938 hr = ID2D1Bitmap1_Map(bitmap, D2D1_MAP_OPTIONS_WRITE | D2D1_MAP_OPTIONS_DISCARD, &mapped_rect);
13939 todo_wine
13940 ok(hr == E_INVALIDARG, "Got unexpected hr %#lx.\n", hr);
13941 if (SUCCEEDED(hr)) ID2D1Bitmap1_Unmap(bitmap);
13942 hr = ID2D1Bitmap1_Map(bitmap, D2D1_MAP_OPTIONS_WRITE | D2D1_MAP_OPTIONS_READ | D2D1_MAP_OPTIONS_DISCARD, &mapped_rect);
13943 ok(hr == E_INVALIDARG, "Got unexpected hr %#lx.\n", hr);
13944
13945 ID2D1Bitmap1_Release(bitmap);
13946
13947 /* Options are derived from the surface properties. */
13949 bitmap_desc.pixelFormat.alphaMode = D2D1_ALPHA_MODE_IGNORE;
13950 bitmap_desc.dpiX = bitmap_desc.dpiY = 0.0f;
13951 hr = ID2D1DeviceContext_CreateSharedBitmap(ctx.context, &IID_IDXGISurface, surface,
13952 (const D2D1_BITMAP_PROPERTIES *)&bitmap_desc, &bitmap2);
13953 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
13955
13956 hr = ID2D1DeviceContext_CreateSharedBitmap(ctx.context, &IID_ID2D1Bitmap, bitmap2, NULL, &bitmap3);
13957 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
13959 ID2D1Bitmap_Release(bitmap3);
13960
13961 ID2D1Bitmap_Release(bitmap2);
13962
13963 hr = ID2D1DeviceContext_CreateBitmapFromDxgiSurface(ctx.context, surface, NULL, &bitmap);
13964 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
13965 options = ID2D1Bitmap1_GetOptions(bitmap);
13967 "Unexpected options %#x.\n", options);
13968 ID2D1Bitmap1_Release(bitmap);
13969
13970 /* Options incompatible with the surface. */
13972 hr = ID2D1DeviceContext_CreateBitmapFromDxgiSurface(ctx.context, surface, &bitmap_desc, &bitmap);
13973 ok(hr == E_INVALIDARG, "Got unexpected hr %#lx.\n", hr);
13975 hr = ID2D1DeviceContext_CreateBitmapFromDxgiSurface(ctx.context, surface, &bitmap_desc, &bitmap);
13976 ok(hr == E_INVALIDARG, "Got unexpected hr %#lx.\n", hr);
13977
13979 hr = ID2D1DeviceContext_CreateBitmapFromDxgiSurface(ctx.context, surface, &bitmap_desc, &bitmap);
13980 ok(hr == E_INVALIDARG, "Got unexpected hr %#lx.\n", hr);
13981
13982 /* Create without D2D1_BITMAP_OPTIONS_CPU_READ, surface supports CPU reads. */
13984 hr = ID2D1DeviceContext_CreateBitmapFromDxgiSurface(ctx.context, surface, &bitmap_desc, &bitmap);
13985 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
13986 hr = ID2D1Bitmap1_Map(bitmap, D2D1_MAP_OPTIONS_READ, &mapped_rect);
13987 ok(hr == E_INVALIDARG, "Got unexpected hr %#lx.\n", hr);
13988 ID2D1Bitmap1_Release(bitmap);
13989
13990 ID3D11Texture2D_Release(texture);
13991 IDXGISurface_Release(surface);
13992
13993 for (i = 0; i < ARRAY_SIZE(options_tests); ++i)
13994 {
13995 winetest_push_context("Test %u", i);
13996
13997 texture_desc.Width = 4;
13998 texture_desc.Height = 4;
13999 texture_desc.MipLevels = 1;
14000 texture_desc.ArraySize = 1;
14001 texture_desc.Format = DXGI_FORMAT_B8G8R8A8_UNORM;
14002 texture_desc.SampleDesc.Count = 1;
14003 texture_desc.SampleDesc.Quality = 0;
14004 texture_desc.Usage = D3D11_USAGE_DEFAULT;
14005 texture_desc.BindFlags = options_tests[i].bind_flags;
14006 texture_desc.CPUAccessFlags = 0;
14007 texture_desc.MiscFlags = 0;
14008
14009 hr = ID3D11Device_CreateTexture2D(d3d_device, &texture_desc, NULL, &texture);
14010 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
14011 hr = ID3D11Texture2D_QueryInterface(texture, &IID_IDXGISurface, (void **)&surface);
14012 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
14013
14014 bitmap = NULL;
14015 bitmap_desc.bitmapOptions = options_tests[i].options;
14016 hr = ID2D1DeviceContext_CreateBitmapFromDxgiSurface(ctx.context, surface, &bitmap_desc, &bitmap);
14017 ok(hr == options_tests[i].hr, "Got unexpected hr %#lx.\n", hr);
14018 if (SUCCEEDED(hr))
14019 {
14020 check_bitmap_options((ID2D1Bitmap *)bitmap, options_tests[i].options);
14021 ID2D1Bitmap1_Release(bitmap);
14022 }
14023
14024 ID3D11Texture2D_Release(texture);
14025 IDXGISurface_Release(surface);
14026
14028 }
14029
14030 ID3D11Device_Release(d3d_device);
14031
14033}
#define check_bitmap_options(b, o)
Definition: d2d1.c:1335
@ D2D1_MAP_OPTIONS_READ
Definition: d2d1_1.idl:99
@ D2D1_MAP_OPTIONS_DISCARD
Definition: d2d1_1.idl:101
@ D2D1_MAP_OPTIONS_NONE
Definition: d2d1_1.idl:98
@ D2D1_MAP_OPTIONS_WRITE
Definition: d2d1_1.idl:100
#define D2DERR_WRONG_STATE
Definition: winerror.h:7352

Referenced by START_TEST().

◆ test_bitmap_surface()

static void test_bitmap_surface ( BOOL  d3d11)
static

Definition at line 9310 of file d2d1.c.

9311{
9312 static const struct bitmap_format_test
9313 {
9314 D2D1_PIXEL_FORMAT original;
9316 HRESULT hr;
9317 }
9318 bitmap_format_tests[] =
9319 {
9320 { { DXGI_FORMAT_UNKNOWN, D2D1_ALPHA_MODE_PREMULTIPLIED },
9321 { DXGI_FORMAT_B8G8R8A8_UNORM, D2D1_ALPHA_MODE_PREMULTIPLIED } },
9322
9323 { { DXGI_FORMAT_B8G8R8A8_UNORM, D2D1_ALPHA_MODE_STRAIGHT }, { 0 }, D2DERR_UNSUPPORTED_PIXEL_FORMAT },
9324
9325 { { DXGI_FORMAT_UNKNOWN, D2D1_ALPHA_MODE_IGNORE },
9326 { DXGI_FORMAT_B8G8R8A8_UNORM, D2D1_ALPHA_MODE_IGNORE } },
9327
9328 { { DXGI_FORMAT_UNKNOWN, D2D1_ALPHA_MODE_UNKNOWN }, { 0 }, D2DERR_UNSUPPORTED_PIXEL_FORMAT },
9329
9330 { { DXGI_FORMAT_B8G8R8A8_UNORM, D2D1_ALPHA_MODE_UNKNOWN }, { 0 }, D2DERR_UNSUPPORTED_PIXEL_FORMAT },
9331
9332 { { DXGI_FORMAT_B8G8R8A8_UNORM, D2D1_ALPHA_MODE_IGNORE },
9333 { DXGI_FORMAT_B8G8R8A8_UNORM, D2D1_ALPHA_MODE_IGNORE } },
9334
9335 { { DXGI_FORMAT_UNKNOWN, D2D1_ALPHA_MODE_STRAIGHT }, { 0 }, D2DERR_UNSUPPORTED_PIXEL_FORMAT },
9336 };
9339 D2D1_BITMAP_PROPERTIES1 bitmap_desc;
9340 ID2D1DeviceContext *device_context;
9341 IDXGISurface *surface2;
9343 struct d2d1_test_context ctx;
9349 D2D1_TAG t1, t2;
9350 unsigned int i;
9351 HRESULT hr;
9352
9353 IWICBitmap *wic_bitmap;
9354 IWICImagingFactory *wic_factory;
9355
9356 if (!init_test_context(&ctx, d3d11))
9357 return;
9358
9359 if (!ctx.factory1)
9360 {
9361 win_skip("ID2D1Factory1 is not supported.\n");
9363 return;
9364 }
9365
9366 /* DXGI target */
9367 hr = ID2D1RenderTarget_QueryInterface(ctx.rt, &IID_ID2D1DeviceContext, (void **)&device_context);
9368 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
9369
9370 bitmap = NULL;
9371 ID2D1DeviceContext_GetTarget(device_context, (ID2D1Image **)&bitmap);
9372 ok(!!bitmap, "Unexpected target.\n");
9374 ID2D1Bitmap1_Release(bitmap);
9375
9377
9378 ID2D1DeviceContext_Release(device_context);
9379
9380 /* Bitmap created from DXGI surface. */
9381 hr = ID2D1Factory1_CreateDevice(ctx.factory1, ctx.device, &device);
9382 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
9383
9384 hr = ID2D1Device_CreateDeviceContext(device, D2D1_DEVICE_CONTEXT_OPTIONS_NONE, &device_context);
9385 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
9386
9387 for (i = 0; i < ARRAY_SIZE(bitmap_format_tests); ++i)
9388 {
9389 memset(&bitmap_desc, 0, sizeof(bitmap_desc));
9390 bitmap_desc.pixelFormat = bitmap_format_tests[i].original;
9392
9393 hr = ID2D1DeviceContext_CreateBitmapFromDxgiSurface(device_context, ctx.surface, &bitmap_desc, &bitmap);
9394 todo_wine_if(bitmap_format_tests[i].hr == D2DERR_UNSUPPORTED_PIXEL_FORMAT)
9395 ok(hr == bitmap_format_tests[i].hr, "%u: Got unexpected hr %#lx.\n", i, hr);
9396
9397 if (SUCCEEDED(hr) && hr == bitmap_format_tests[i].hr)
9398 {
9399 pixel_format = ID2D1Bitmap1_GetPixelFormat(bitmap);
9400
9401 ok(pixel_format.format == bitmap_format_tests[i].result.format, "%u: unexpected pixel format %#x.\n",
9402 i, pixel_format.format);
9403 ok(pixel_format.alphaMode == bitmap_format_tests[i].result.alphaMode, "%u: unexpected alpha mode %d.\n",
9404 i, pixel_format.alphaMode);
9405 }
9406
9407 if (SUCCEEDED(hr))
9408 ID2D1Bitmap1_Release(bitmap);
9409 }
9410
9411 /* A8 surface */
9413
9414 hr = ID2D1DeviceContext_CreateBitmapFromDxgiSurface(device_context, surface2, NULL, &bitmap);
9415 ok(hr == S_OK || broken(hr == D2DERR_UNSUPPORTED_PIXEL_FORMAT) /* Win7 */,
9416 "Got unexpected hr %#lx.\n", hr);
9417
9418 if (SUCCEEDED(hr))
9419 {
9420 pixel_format = ID2D1Bitmap1_GetPixelFormat(bitmap);
9421 ok(pixel_format.alphaMode == D2D1_ALPHA_MODE_PREMULTIPLIED,
9422 "Unexpected alpha mode %#x.\n", pixel_format.alphaMode);
9423
9424 ID2D1Bitmap1_Release(bitmap);
9425 }
9426
9427 IDXGISurface_Release(surface2);
9428
9429 hr = ID2D1DeviceContext_CreateBitmapFromDxgiSurface(device_context, ctx.surface, NULL, &bitmap);
9430 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
9431
9432 pixel_format = ID2D1Bitmap1_GetPixelFormat(bitmap);
9433 ok(pixel_format.alphaMode == D2D1_ALPHA_MODE_PREMULTIPLIED,
9434 "Unexpected alpha mode %#x.\n", pixel_format.alphaMode);
9435
9438
9439 ID2D1DeviceContext_SetTarget(device_context, (ID2D1Image *)bitmap);
9440 ID2D1DeviceContext_GetTarget(device_context, &target);
9441 ok(target == (ID2D1Image *)bitmap, "Unexpected target.\n");
9442 ID2D1Image_Release(target);
9443
9445
9446 ID2D1Bitmap1_Release(bitmap);
9447
9448 /* Without D2D1_BITMAP_OPTIONS_TARGET. */
9449 memset(&bitmap_desc, 0, sizeof(bitmap_desc));
9450 bitmap_desc.pixelFormat = ID2D1DeviceContext_GetPixelFormat(device_context);
9451 size.width = size.height = 4;
9452 hr = ID2D1DeviceContext_CreateBitmap(device_context, size, NULL, 0, &bitmap_desc, &bitmap);
9453 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
9455 ID2D1DeviceContext_SetTags(device_context, 1, 2);
9456
9457 ID2D1DeviceContext_BeginDraw(device_context);
9458 ID2D1DeviceContext_SetTarget(device_context, (ID2D1Image *)bitmap);
9459 hr = ID2D1DeviceContext_EndDraw(device_context, &t1, &t2);
9460 ok(hr == D2DERR_INVALID_TARGET, "Got unexpected hr %#lx.\n", hr);
9461 ok(t1 == 1 && t2 == 2, "Unexpected tags %s:%s.\n", wine_dbgstr_longlong(t1), wine_dbgstr_longlong(t2));
9462
9463 ID2D1Bitmap1_Release(bitmap);
9464
9465 ID2D1DeviceContext_GetTarget(device_context, (ID2D1Image **)&bitmap);
9466 ok(!!bitmap, "Expected target bitmap.\n");
9467 ID2D1Bitmap1_Release(bitmap);
9468
9470 hr = ID2D1DeviceContext_CreateBitmap(device_context, size, NULL, 0, &bitmap_desc, &bitmap);
9471 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
9473 ID2D1DeviceContext_SetTarget(device_context, NULL);
9474 ID2D1DeviceContext_SetTags(device_context, 3, 4);
9475
9476 ID2D1DeviceContext_BeginDraw(device_context);
9477 ID2D1DeviceContext_SetTarget(device_context, (ID2D1Image *)bitmap);
9478 hr = ID2D1DeviceContext_EndDraw(device_context, &t1, &t2);
9479 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
9480 ok(!t1 && !t2, "Unexpected tags %s:%s.\n", wine_dbgstr_longlong(t1), wine_dbgstr_longlong(t2));
9481
9482 ID2D1Bitmap1_Release(bitmap);
9483
9484 ID2D1DeviceContext_Release(device_context);
9485
9486 ID2D1Device_Release(device);
9487
9488 /* DC target */
9491 rt_desc.pixelFormat.alphaMode = D2D1_ALPHA_MODE_PREMULTIPLIED;
9492 rt_desc.dpiX = 96.0f;
9493 rt_desc.dpiY = 96.0f;
9496 hr = ID2D1Factory1_CreateDCRenderTarget(ctx.factory1, &rt_desc, (ID2D1DCRenderTarget **)&rt);
9497 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
9498
9499 hr = ID2D1RenderTarget_QueryInterface(rt, &IID_ID2D1DeviceContext, (void **)&device_context);
9500 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
9501
9502 ID2D1DeviceContext_GetTarget(device_context, (ID2D1Image **)&bitmap);
9503 ok(!bitmap, "Unexpected target.\n");
9504
9505 ID2D1DeviceContext_Release(device_context);
9506 ID2D1RenderTarget_Release(rt);
9507
9508 /* HWND target */
9509 hwnd_rt_desc.hwnd = NULL;
9510 hwnd_rt_desc.pixelSize.width = 64;
9511 hwnd_rt_desc.pixelSize.height = 64;
9513 hwnd_rt_desc.hwnd = CreateWindowA("static", "d2d_test", 0, 0, 0, 0, 0, 0, 0, 0, 0);
9514 ok(!!hwnd_rt_desc.hwnd, "Failed to create target window.\n");
9515
9516 hr = ID2D1Factory1_CreateHwndRenderTarget(ctx.factory1, &rt_desc, &hwnd_rt_desc, (ID2D1HwndRenderTarget **)&rt);
9517 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
9518
9520 ID2D1RenderTarget_Release(rt);
9521 DestroyWindow(hwnd_rt_desc.hwnd);
9522
9523 /* WIC target */
9525
9526 hr = CoCreateInstance(&CLSID_WICImagingFactory, NULL, CLSCTX_INPROC_SERVER,
9527 &IID_IWICImagingFactory, (void **)&wic_factory);
9528 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
9529 hr = IWICImagingFactory_CreateBitmap(wic_factory, 16, 16,
9530 &GUID_WICPixelFormat32bppPBGRA, WICBitmapCacheOnDemand, &wic_bitmap);
9531 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
9532 IWICImagingFactory_Release(wic_factory);
9533
9534 hr = ID2D1Factory1_CreateWicBitmapRenderTarget(ctx.factory1, wic_bitmap, &rt_desc, &rt);
9535 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
9536 IWICBitmap_Release(wic_bitmap);
9537
9539 ID2D1RenderTarget_Release(rt);
9540
9542
9544}
static IDXGISurface * create_surface(IDXGIDevice *dxgi_device, unsigned int width, unsigned int height, unsigned int bind_flags, unsigned int misc_flags, DXGI_FORMAT format)
Definition: d2d1.c:6442
#define check_bitmap_surface(b, s, o)
Definition: d2d1.c:1353
#define check_rt_bitmap_surface(r, s, o)
Definition: d2d1.c:9157
UINT64 D2D1_TAG
Definition: d2d1.idl:48
@ D2D1_PRESENT_OPTIONS_NONE
Definition: d2d1.idl:291
static __inline const char * wine_dbgstr_longlong(ULONGLONG ll)
Definition: compat.h:49
GLuint64EXT * result
Definition: glext.h:11304
#define win_skip
Definition: minitest.h:67
#define todo_wine_if(is_todo)
Definition: minitest.h:81
D2D1_PRESENT_OPTIONS presentOptions
Definition: d2d1.idl:430
#define D2DERR_INVALID_TARGET
Definition: winerror.h:7387

Referenced by START_TEST().

◆ test_bitmap_target()

static void test_bitmap_target ( BOOL  d3d11)
static

Definition at line 6684 of file d2d1.c.

6685{
6688 D2D1_SIZE_U pixel_size, pixel_size2;
6690 ID2D1BitmapRenderTarget *rt, *rt2;
6691 ID2D1HwndRenderTarget *hwnd_rt;
6693 struct d2d1_test_context ctx;
6694 ID2D1DCRenderTarget *dc_rt;
6695 D2D1_SIZE_F size, size2;
6696 ID2D1RenderTarget *rt3;
6697 float dpi[2], dpi2[2];
6699 ULONG refcount;
6700 HRESULT hr;
6701
6702 if (!init_test_context(&ctx, d3d11))
6703 return;
6704
6706 desc.pixelFormat.format = DXGI_FORMAT_B8G8R8A8_UNORM;
6707 desc.pixelFormat.alphaMode = D2D1_ALPHA_MODE_PREMULTIPLIED;
6708 desc.dpiX = 96.0f;
6709 desc.dpiY = 192.0f;
6712
6713 hwnd_rt_desc.hwnd = CreateWindowA("static", "d2d_test", 0, 0, 0, 0, 0, 0, 0, 0, 0);
6714 ok(!!hwnd_rt_desc.hwnd, "Failed to create target window.\n");
6715 hwnd_rt_desc.pixelSize.width = 64;
6716 hwnd_rt_desc.pixelSize.height = 64;
6718
6719 hr = ID2D1Factory_CreateHwndRenderTarget(ctx.factory, &desc, &hwnd_rt_desc, &hwnd_rt);
6720 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
6721
6723
6724 hr = ID2D1HwndRenderTarget_CreateCompatibleRenderTarget(hwnd_rt, NULL, NULL, NULL,
6726 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
6727
6728 hr = ID2D1BitmapRenderTarget_QueryInterface(rt, &IID_ID2D1GdiInteropRenderTarget, (void **)&interop);
6729 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
6730 hr = ID2D1GdiInteropRenderTarget_QueryInterface(interop, &IID_ID2D1RenderTarget, (void **)&rt3);
6731 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
6732 ok(rt3 == (ID2D1RenderTarget *)rt, "Unexpected render target\n");
6733 ID2D1RenderTarget_Release(rt3);
6734 hr = ID2D1GdiInteropRenderTarget_QueryInterface(interop, &IID_ID2D1BitmapRenderTarget, (void **)&rt2);
6735 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
6736 ok(rt2 == rt, "Unexpected render target\n");
6737 ID2D1BitmapRenderTarget_Release(rt2);
6738 ID2D1GdiInteropRenderTarget_Release(interop);
6739
6740 /* See if parent target is referenced. */
6741 ID2D1HwndRenderTarget_AddRef(hwnd_rt);
6742 refcount = ID2D1HwndRenderTarget_Release(hwnd_rt);
6743 ok(refcount == 1, "Target should not have been referenced, got %lu.\n", refcount);
6744
6745 /* Size was not specified, should match parent. */
6746 pixel_size = ID2D1HwndRenderTarget_GetPixelSize(hwnd_rt);
6747 pixel_size2 = ID2D1BitmapRenderTarget_GetPixelSize(rt);
6748 ok(!memcmp(&pixel_size, &pixel_size2, sizeof(pixel_size)), "Got target pixel size mismatch.\n");
6749
6750 size = ID2D1HwndRenderTarget_GetSize(hwnd_rt);
6751 size2 = ID2D1BitmapRenderTarget_GetSize(rt);
6752 ok(!memcmp(&size, &size2, sizeof(size)), "Got target DIP size mismatch.\n");
6753
6754 ID2D1HwndRenderTarget_GetDpi(hwnd_rt, dpi, dpi + 1);
6755 ID2D1BitmapRenderTarget_GetDpi(rt, dpi2, dpi2 + 1);
6756 ok(!memcmp(dpi, dpi2, sizeof(dpi)), "Got dpi mismatch.\n");
6757
6758 ID2D1BitmapRenderTarget_Release(rt);
6759
6760 /* Pixel size specified. */
6761 set_size_u(&pixel_size, 32, 32);
6762 hr = ID2D1HwndRenderTarget_CreateCompatibleRenderTarget(hwnd_rt, NULL, &pixel_size, NULL,
6764 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
6765
6766 pixel_size2 = ID2D1BitmapRenderTarget_GetPixelSize(rt);
6767 ok(!memcmp(&pixel_size, &pixel_size2, sizeof(pixel_size)), "Got target pixel size mismatch.\n");
6768
6769 ID2D1BitmapRenderTarget_GetDpi(rt, dpi2, dpi2 + 1);
6770 ok(!memcmp(dpi, dpi2, sizeof(dpi)), "Got dpi mismatch.\n");
6771
6772 ID2D1BitmapRenderTarget_Release(rt);
6773
6774 /* Both pixel size and DIP size are specified. */
6775 set_size_u(&pixel_size, 128, 128);
6776 hr = ID2D1HwndRenderTarget_CreateCompatibleRenderTarget(hwnd_rt, &size, &pixel_size, NULL,
6778 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
6779
6780 /* Doubled pixel size dimensions with the same DIP size give doubled dpi. */
6781 ID2D1BitmapRenderTarget_GetDpi(rt, dpi2, dpi2 + 1);
6782 ok(dpi[0] == dpi2[0] / 2.0f && dpi[1] == dpi2[1] / 2.0f, "Got dpi mismatch.\n");
6783
6784 ID2D1BitmapRenderTarget_Release(rt);
6785
6786 /* DIP size is specified, fractional. */
6787 set_size_f(&size, 70.1f, 70.4f);
6788 hr = ID2D1HwndRenderTarget_CreateCompatibleRenderTarget(hwnd_rt, &size, NULL, NULL,
6790 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
6791
6792 ID2D1BitmapRenderTarget_GetDpi(rt, dpi2, dpi2 + 1);
6793
6794 pixel_size = ID2D1BitmapRenderTarget_GetPixelSize(rt);
6795 ok(pixel_size.width == ceilf(size.width * dpi[0] / 96.0f)
6796 && pixel_size.height == ceilf(size.height * dpi[1] / 96.0f), "Wrong pixel size %ux%u\n",
6797 pixel_size.width, pixel_size.height);
6798
6799 dpi[0] *= (pixel_size.width / size.width) * (96.0f / dpi[0]);
6800 dpi[1] *= (pixel_size.height / size.height) * (96.0f / dpi[1]);
6801
6802 ok(compare_float(dpi[0], dpi2[0], 1) && compare_float(dpi[1], dpi2[1], 1), "Got dpi mismatch.\n");
6803
6804 ID2D1HwndRenderTarget_Release(hwnd_rt);
6805
6806 /* Check if GetBitmap() returns same instance. */
6807 hr = ID2D1BitmapRenderTarget_GetBitmap(rt, &bitmap);
6808 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
6809 hr = ID2D1BitmapRenderTarget_GetBitmap(rt, &bitmap2);
6810 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
6811 ok(bitmap == bitmap2, "Got different bitmap instances.\n");
6812
6813 /* Draw something, see if bitmap instance is retained. */
6814 ID2D1BitmapRenderTarget_BeginDraw(rt);
6815 set_color(&color, 1.0f, 1.0f, 0.0f, 1.0f);
6816 ID2D1BitmapRenderTarget_Clear(rt, &color);
6817 hr = ID2D1BitmapRenderTarget_EndDraw(rt, NULL, NULL);
6818 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
6819
6820 ID2D1Bitmap_Release(bitmap2);
6821 hr = ID2D1BitmapRenderTarget_GetBitmap(rt, &bitmap2);
6822 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
6823 ok(bitmap == bitmap2, "Got different bitmap instances.\n");
6824
6825 ID2D1Bitmap_Release(bitmap);
6826 ID2D1Bitmap_Release(bitmap2);
6827
6828 refcount = ID2D1BitmapRenderTarget_Release(rt);
6829 ok(!refcount, "Target should be released, got %lu.\n", refcount);
6830
6831 DestroyWindow(hwnd_rt_desc.hwnd);
6832
6833 /* Compatible target created from a DC target without associated HDC */
6835 desc.pixelFormat.format = DXGI_FORMAT_B8G8R8A8_UNORM;
6836 desc.pixelFormat.alphaMode = D2D1_ALPHA_MODE_PREMULTIPLIED;
6837 desc.dpiX = 192.0f;
6838 desc.dpiY = 96.0f;
6841 hr = ID2D1Factory_CreateDCRenderTarget(ctx.factory, &desc, &dc_rt);
6842 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
6843
6845
6846 hr = ID2D1DCRenderTarget_CreateCompatibleRenderTarget(dc_rt, NULL, NULL, NULL,
6848 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
6849
6850 pixel_size = ID2D1BitmapRenderTarget_GetPixelSize(rt);
6851 ok(pixel_size.width == 0 && pixel_size.height == 0, "Got wrong size\n");
6852
6853 hr = ID2D1BitmapRenderTarget_GetBitmap(rt, &bitmap);
6854 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
6855 pixel_size = ID2D1Bitmap_GetPixelSize(bitmap);
6856 ok(pixel_size.width == 0 && pixel_size.height == 0, "Got wrong size\n");
6857 ID2D1Bitmap_Release(bitmap);
6858
6859 ID2D1BitmapRenderTarget_Release(rt);
6860 ID2D1DCRenderTarget_Release(dc_rt);
6861
6863}
static void set_size_f(D2D1_SIZE_F *size, float w, float h)
Definition: d2d1.c:556
#define test_compatible_target_size(r)
Definition: d2d1.c:6591
#define ceilf(x)
Definition: mymath.h:62
#define dpi
Definition: sysparams.c:23

Referenced by START_TEST().

◆ test_bitmap_updates()

static void test_bitmap_updates ( BOOL  d3d11)
static

Definition at line 5406 of file d2d1.c.

5407{
5408 D2D1_BITMAP_PROPERTIES bitmap_desc;
5409 ID2D1Bitmap *bitmap, *dst_bitmap;
5410 D2D1_RECT_U dst_rect, src_rect;
5411 struct d2d1_test_context ctx;
5412 D2D1_POINT_2U dst_point;
5417 HRESULT hr;
5418 BOOL match;
5419
5420 static const DWORD bitmap_data[] =
5421 {
5422 0xffff0000, 0xffffff00, 0xff00ff00, 0xff00ffff,
5423 0xff0000ff, 0xffff00ff, 0xff000000, 0xff7f7f7f,
5424 0xffffffff, 0xffffffff, 0xffffffff, 0xff000000,
5425 0xffffffff, 0xff000000, 0xff000000, 0xff000000,
5426 };
5427
5428 if (!init_test_context(&ctx, d3d11))
5429 return;
5430
5431 rt = ctx.rt;
5432 ID2D1RenderTarget_SetAntialiasMode(rt, D2D1_ANTIALIAS_MODE_ALIASED);
5433
5434 ID2D1RenderTarget_BeginDraw(rt);
5435 set_color(&color, 0.0f, 0.0f, 1.0f, 1.0f);
5436 ID2D1RenderTarget_Clear(rt, &color);
5437
5438 set_size_u(&size, 4, 4);
5440 bitmap_desc.pixelFormat.alphaMode = D2D1_ALPHA_MODE_PREMULTIPLIED;
5441 bitmap_desc.dpiX = 96.0f;
5442 bitmap_desc.dpiY = 96.0f;
5443 hr = ID2D1RenderTarget_CreateBitmap(rt, size, NULL, 0, &bitmap_desc, &bitmap);
5444 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
5445
5446 set_rect(&rect, 0.0f, 0.0f, 320.0f, 240.0f);
5447 ID2D1RenderTarget_DrawBitmap(rt, bitmap, &rect, 1.0f,
5449
5450 ID2D1Bitmap_Release(bitmap);
5451
5452 bitmap_desc.pixelFormat.alphaMode = D2D1_ALPHA_MODE_IGNORE;
5453 hr = ID2D1RenderTarget_CreateBitmap(rt, size, NULL, 0, &bitmap_desc, &bitmap);
5454 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
5455
5456 set_rect(&rect, 0.0f, 240.0f, 320.0f, 480.0f);
5457 ID2D1RenderTarget_DrawBitmap(rt, bitmap, &rect, 1.0f,
5459
5460 set_rect_u(&dst_rect, 1, 1, 3, 3);
5461 hr = ID2D1Bitmap_CopyFromMemory(bitmap, &dst_rect, bitmap_data, 4 * sizeof(*bitmap_data));
5462 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
5463 set_rect_u(&dst_rect, 0, 3, 3, 4);
5464 hr = ID2D1Bitmap_CopyFromMemory(bitmap, &dst_rect, &bitmap_data[6], 4 * sizeof(*bitmap_data));
5465 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
5466 set_rect_u(&dst_rect, 0, 0, 4, 1);
5467 hr = ID2D1Bitmap_CopyFromMemory(bitmap, &dst_rect, &bitmap_data[10], 4 * sizeof(*bitmap_data));
5468 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
5469 set_rect_u(&dst_rect, 0, 1, 1, 3);
5470 hr = ID2D1Bitmap_CopyFromMemory(bitmap, &dst_rect, &bitmap_data[2], sizeof(*bitmap_data));
5471 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
5472 set_rect_u(&dst_rect, 4, 4, 3, 1);
5473 hr = ID2D1Bitmap_CopyFromMemory(bitmap, &dst_rect, bitmap_data, sizeof(*bitmap_data));
5474 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
5475 set_rect(&rect, 320.0f, 240.0f, 640.0f, 480.0f);
5476 ID2D1RenderTarget_DrawBitmap(rt, bitmap, &rect, 1.0f,
5478
5479 hr = ID2D1Bitmap_CopyFromMemory(bitmap, NULL, bitmap_data, 4 * sizeof(*bitmap_data));
5480 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
5481 set_rect(&rect, 320.0f, 0.0f, 640.0f, 240.0f);
5482 ID2D1RenderTarget_DrawBitmap(rt, bitmap, &rect, 1.0f,
5484
5485 hr = ID2D1RenderTarget_EndDraw(rt, NULL, NULL);
5486 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
5487
5488 match = compare_surface(&ctx, "cb8136c91fbbdc76bb83b8c09edc1907b0a5d0a6");
5489 ok(match, "Surface does not match.\n");
5490
5491 ID2D1RenderTarget_BeginDraw(rt);
5492 set_color(&color, 0.0f, 0.0f, 1.0f, 1.0f);
5493 ID2D1RenderTarget_Clear(rt, &color);
5494 bitmap_desc.pixelFormat.alphaMode = D2D1_ALPHA_MODE_IGNORE;
5495 hr = ID2D1RenderTarget_CreateBitmap(rt, size, NULL, 0, &bitmap_desc, &dst_bitmap);
5496 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
5497
5498 hr = ID2D1Bitmap_CopyFromBitmap(dst_bitmap, NULL, bitmap, NULL);
5499 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
5500 dst_point.x = 1; dst_point.y = 1;
5501 hr = ID2D1Bitmap_CopyFromBitmap(dst_bitmap, &dst_point, bitmap, NULL);
5502 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
5503 dst_point.x = 0; dst_point.y = 1;
5504 set_rect_u(&src_rect, 1, 1, 3, 3);
5505 hr = ID2D1Bitmap_CopyFromBitmap(dst_bitmap, &dst_point, bitmap, &src_rect);
5506 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
5507 dst_point.x = 1; dst_point.y = 0;
5508 set_rect_u(&src_rect, 2, 2, 1, 1);
5509 hr = ID2D1Bitmap_CopyFromBitmap(dst_bitmap, &dst_point, bitmap, &src_rect);
5510 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
5511 set_rect_u(&src_rect, 1, 1, 2, 2);
5512 hr = ID2D1Bitmap_CopyFromBitmap(dst_bitmap, NULL, bitmap, &src_rect);
5513 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
5514
5515 set_rect(&rect, 320.0f, 0.0f, 640.0f, 240.0f);
5516 ID2D1RenderTarget_DrawBitmap(rt, dst_bitmap, &rect, 1.0f,
5518
5519 hr = ID2D1RenderTarget_EndDraw(rt, NULL, NULL);
5520 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
5521 match = compare_surface(&ctx, "a1758bd644d897f75d43769ba26456af70cd9056");
5522 ok(match, "Surface does not match.\n");
5523 ID2D1Bitmap_Release(dst_bitmap);
5524
5525 ID2D1Bitmap_Release(bitmap);
5527}
static void set_rect_u(D2D1_RECT_U *rect, UINT32 left, UINT32 top, UINT32 right, UINT32 bottom)
Definition: d2d1.c:519

Referenced by START_TEST().

◆ test_blend_transform()

static void test_blend_transform ( BOOL  d3d11)
static

Definition at line 13082 of file d2d1.c.

13083{
13084 D2D1_BLEND_DESCRIPTION blend_desc, expected= {0};
13086 ID2D1EffectContext *effect_context;
13088 struct d2d1_test_context ctx;
13090 ID2D1Effect *effect;
13091 UINT input_count;
13092 HRESULT hr;
13093
13094 if (!init_test_context(&ctx, d3d11))
13095 return;
13096
13097 factory = ctx.factory1;
13098 if (!factory)
13099 {
13100 win_skip("ID2D1Factory1 is not supported.\n");
13102 return;
13103 }
13104
13105 binding.propertyName = L"Context";
13106 binding.setFunction = NULL;
13107 binding.getFunction = effect_impl_get_context;
13108 hr = ID2D1Factory1_RegisterEffectFromString(factory, &CLSID_TestEffect,
13110 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
13111
13112 hr = ID2D1DeviceContext_CreateEffect(ctx.context, &CLSID_TestEffect, &effect);
13113 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
13114
13115 hr = ID2D1Effect_GetValueByName(effect, L"Context",
13116 D2D1_PROPERTY_TYPE_IUNKNOWN, (BYTE *)&effect_context, sizeof(effect_context));
13117 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
13118
13119 /* Create transform */
13120 transform = (void *)0xdeadbeef;
13121 hr = ID2D1EffectContext_CreateBlendTransform(effect_context, 0, &expected, &transform);
13122 ok(hr == E_INVALIDARG, "Got unexpected hr %#lx.\n", hr);
13123 ok(!transform, "Unexpected pointer %p.\n", transform);
13124 hr = ID2D1EffectContext_CreateBlendTransform(effect_context, 1, &expected, &transform);
13125 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
13126 ID2D1BlendTransform_Release(transform);
13127
13128 hr = ID2D1EffectContext_CreateBlendTransform(effect_context, 4, &expected, &transform);
13129 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
13130
13131 check_interface(transform, &IID_ID2D1BlendTransform, TRUE);
13132 check_interface(transform, &IID_ID2D1ConcreteTransform, TRUE);
13133 check_interface(transform, &IID_ID2D1TransformNode, TRUE);
13134
13135 /* Get description */
13136 ID2D1BlendTransform_GetDescription(transform, &blend_desc);
13137 check_blend_desc(&blend_desc, &expected);
13138
13139 /* Input count */
13140 input_count = ID2D1BlendTransform_GetInputCount(transform);
13141 ok(input_count == 4, "Got unexpected input count %u.\n", input_count);
13142
13143 /* Set output buffer */
13144 hr = ID2D1BlendTransform_SetOutputBuffer(transform, 0xdeadbeef, D2D1_CHANNEL_DEPTH_DEFAULT);
13145 todo_wine
13146 ok(hr == E_INVALIDARG, "Got unexpected hr %#lx.\n", hr);
13147 hr = ID2D1BlendTransform_SetOutputBuffer(transform, D2D1_BUFFER_PRECISION_UNKNOWN, 0xdeadbeef);
13148 todo_wine
13149 ok(hr == E_INVALIDARG, "Got unexpected hr %#lx.\n", hr);
13150 hr = ID2D1BlendTransform_SetOutputBuffer(transform, D2D1_BUFFER_PRECISION_UNKNOWN, D2D1_CHANNEL_DEPTH_DEFAULT);
13151 todo_wine
13152 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
13153
13154 /* Set description */
13155 expected.sourceBlend = D2D1_BLEND_ZERO;
13156 expected.destinationBlend = D2D1_BLEND_ZERO;
13157 expected.blendOperation = D2D1_BLEND_OPERATION_ADD;
13158 expected.sourceBlendAlpha = 0xdeadbeef;
13159 expected.destinationBlendAlpha = 0;
13160 expected.blendOperationAlpha = 12345678;
13161 expected.blendFactor[0] = 0.0f;
13162 expected.blendFactor[1] = 0.0f;
13163 expected.blendFactor[2] = 0.0f;
13164 expected.blendFactor[3] = 0.0f;
13165 ID2D1BlendTransform_SetDescription(transform, &expected);
13166 ID2D1BlendTransform_GetDescription(transform, &blend_desc);
13167 check_blend_desc(&blend_desc, &expected);
13168
13169 ID2D1BlendTransform_Release(transform);
13170 ID2D1Effect_Release(effect);
13171 hr = ID2D1Factory1_UnregisterEffect(factory, &CLSID_TestEffect);
13172 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
13174}
#define check_blend_desc(blend_desc, expected)
Definition: d2d1.c:13046
@ D2D1_BUFFER_PRECISION_UNKNOWN
Definition: d2d1_1.idl:107
@ D2D1_BLEND_ZERO
@ D2D1_BLEND_OPERATION_ADD
@ D2D1_CHANNEL_DEPTH_DEFAULT
GLuint GLenum GLenum transform
Definition: glext.h:9407
static RPC_BINDING_HANDLE binding
Definition: server.c:166

Referenced by START_TEST().

◆ test_border_transform()

static void test_border_transform ( BOOL  d3d11)
static

Definition at line 13176 of file d2d1.c.

13177{
13179 ID2D1EffectContext *effect_context;
13181 struct d2d1_test_context ctx;
13184 ID2D1Effect *effect;
13185 UINT input_count;
13186 HRESULT hr;
13187
13188 if (!init_test_context(&ctx, d3d11))
13189 return;
13190
13191 factory = ctx.factory1;
13192 if (!factory)
13193 {
13194 win_skip("ID2D1Factory1 is not supported.\n");
13196 return;
13197 }
13198
13199 binding.propertyName = L"Context";
13200 binding.setFunction = NULL;
13201 binding.getFunction = effect_impl_get_context;
13202 hr = ID2D1Factory1_RegisterEffectFromString(factory, &CLSID_TestEffect,
13204 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
13205
13206 hr = ID2D1DeviceContext_CreateEffect(ctx.context, &CLSID_TestEffect, &effect);
13207 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
13208
13209 hr = ID2D1Effect_GetValueByName(effect, L"Context",
13210 D2D1_PROPERTY_TYPE_IUNKNOWN, (BYTE *)&effect_context, sizeof(effect_context));
13211 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
13212
13213 /* Create transform with invalid extend mode */
13214 hr = ID2D1EffectContext_CreateBorderTransform(effect_context, 0xdeadbeef, 0xdeadbeef, &transform);
13215 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
13216
13217 check_interface(transform, &IID_ID2D1BorderTransform, TRUE);
13218 check_interface(transform, &IID_ID2D1ConcreteTransform, TRUE);
13219 check_interface(transform, &IID_ID2D1TransformNode, TRUE);
13220
13221 mode = ID2D1BorderTransform_GetExtendModeX(transform);
13222 ok(mode == 0xdeadbeef, "Got unexpected extend mode %u.\n", mode);
13223 mode = ID2D1BorderTransform_GetExtendModeY(transform);
13224 ok(mode == 0xdeadbeef, "Got unexpected extend mode %u.\n", mode);
13225 ID2D1BorderTransform_Release(transform);
13226
13227 /* Create transform */
13228 hr = ID2D1EffectContext_CreateBorderTransform(effect_context, D2D1_EXTEND_MODE_CLAMP, D2D1_EXTEND_MODE_WRAP, &transform);
13229 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
13230
13231 /* Get extend mode */
13232 mode = ID2D1BorderTransform_GetExtendModeX(transform);
13233 ok(mode == D2D1_EXTEND_MODE_CLAMP, "Got unexpected extend mode %u.\n", mode);
13234 mode = ID2D1BorderTransform_GetExtendModeY(transform);
13235 ok(mode == D2D1_EXTEND_MODE_WRAP, "Got unexpected extend mode %u.\n", mode);
13236
13237 /* Input count */
13238 input_count = ID2D1BorderTransform_GetInputCount(transform);
13239 ok(input_count == 1, "Got unexpected input count %u.\n", input_count);
13240
13241 /* Set output buffer */
13242 hr = ID2D1BorderTransform_SetOutputBuffer(transform, 0xdeadbeef, D2D1_CHANNEL_DEPTH_DEFAULT);
13243 todo_wine
13244 ok(hr == E_INVALIDARG, "Got unexpected hr %#lx.\n", hr);
13245 hr = ID2D1BorderTransform_SetOutputBuffer(transform, D2D1_BUFFER_PRECISION_UNKNOWN, 0xdeadbeef);
13246 todo_wine
13247 ok(hr == E_INVALIDARG, "Got unexpected hr %#lx.\n", hr);
13248 hr = ID2D1BorderTransform_SetOutputBuffer(transform, D2D1_BUFFER_PRECISION_UNKNOWN, D2D1_CHANNEL_DEPTH_DEFAULT);
13249 todo_wine
13250 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
13251
13252 /* Set extend mode */
13253 ID2D1BorderTransform_SetExtendModeX(transform, D2D1_EXTEND_MODE_MIRROR);
13254 mode = ID2D1BorderTransform_GetExtendModeX(transform);
13255 ok(mode == D2D1_EXTEND_MODE_MIRROR, "Got unexpected extend mode %u.\n", mode);
13256 ID2D1BorderTransform_SetExtendModeY(transform, D2D1_EXTEND_MODE_CLAMP);
13257 mode = ID2D1BorderTransform_GetExtendModeY(transform);
13258 ok(mode == D2D1_EXTEND_MODE_CLAMP, "Got unexpected extend mode %u.\n", mode);
13259
13260 /* Set extend mode with invalid value */
13261 ID2D1BorderTransform_SetExtendModeX(transform, 0xdeadbeef);
13262 mode = ID2D1BorderTransform_GetExtendModeX(transform);
13263 ok(mode == D2D1_EXTEND_MODE_MIRROR, "Got unexpected extend mode %u.\n", mode);
13264 ID2D1BorderTransform_SetExtendModeY(transform, 0xdeadbeef);
13265 mode = ID2D1BorderTransform_GetExtendModeY(transform);
13266 ok(mode == D2D1_EXTEND_MODE_CLAMP, "Got unexpected extend mode %u.\n", mode);
13267
13268 ID2D1BorderTransform_Release(transform);
13269 ID2D1Effect_Release(effect);
13270 hr = ID2D1Factory1_UnregisterEffect(factory, &CLSID_TestEffect);
13271 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
13273}

Referenced by START_TEST().

◆ test_bounds_adjustment_transform()

static void test_bounds_adjustment_transform ( BOOL  d3d11)
static

Definition at line 13275 of file d2d1.c.

13276{
13278 ID2D1EffectContext *effect_context;
13280 struct d2d1_test_context ctx;
13282 ID2D1Effect *effect;
13283 UINT input_count;
13285 HRESULT hr;
13286
13287 if (!init_test_context(&ctx, d3d11))
13288 return;
13289
13290 factory = ctx.factory1;
13291 if (!factory)
13292 {
13293 win_skip("ID2D1Factory1 is not supported.\n");
13295 return;
13296 }
13297
13298 binding.propertyName = L"Context";
13299 binding.setFunction = NULL;
13300 binding.getFunction = effect_impl_get_context;
13301 hr = ID2D1Factory1_RegisterEffectFromString(factory, &CLSID_TestEffect,
13303 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
13304
13305 hr = ID2D1DeviceContext_CreateEffect(ctx.context, &CLSID_TestEffect, &effect);
13306 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
13307
13308 hr = ID2D1Effect_GetValueByName(effect, L"Context",
13309 D2D1_PROPERTY_TYPE_IUNKNOWN, (BYTE *)&effect_context, sizeof(effect_context));
13310 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
13311
13312 set_rect_l(&rect, -1, 0, 25, -50);
13313 hr = ID2D1EffectContext_CreateBoundsAdjustmentTransform(effect_context, &rect, &transform);
13314 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
13315
13316 check_interface(transform, &IID_ID2D1BoundsAdjustmentTransform, TRUE);
13317 check_interface(transform, &IID_ID2D1TransformNode, TRUE);
13318
13319 memset(&rect, 0, sizeof(rect));
13320 ID2D1BoundsAdjustmentTransform_GetOutputBounds(transform, &rect);
13321 ok(rect.left == -1 && rect.top == 0 && rect.right == 25 && rect.bottom == -50,
13322 "Unexpected rectangle.\n");
13323
13324 set_rect_l(&rect, -50, 25, 0, -1);
13325 ID2D1BoundsAdjustmentTransform_SetOutputBounds(transform, &rect);
13326 memset(&rect, 0, sizeof(rect));
13327 ID2D1BoundsAdjustmentTransform_GetOutputBounds(transform, &rect);
13328 ok(rect.left == -50 && rect.top == 25 && rect.right == 0 && rect.bottom == -1,
13329 "Unexpected rectangle.\n");
13330
13331 /* Input count */
13332 input_count = ID2D1BoundsAdjustmentTransform_GetInputCount(transform);
13333 ok(input_count == 1, "Got unexpected input count %u.\n", input_count);
13334
13335 ID2D1BoundsAdjustmentTransform_Release(transform);
13336 ID2D1Effect_Release(effect);
13337 hr = ID2D1Factory1_UnregisterEffect(factory, &CLSID_TestEffect);
13338 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
13340}
static void set_rect_l(D2D1_RECT_L *rect, LONG left, LONG top, LONG right, LONG bottom)
Definition: d2d1.c:527

Referenced by START_TEST().

◆ test_builtin_effect()

static void test_builtin_effect ( BOOL  d3d11)
static

Definition at line 10967 of file d2d1.c.

10968{
10969 unsigned int i, j, min_inputs, max_inputs, str_size, input_count;
10970 D2D1_BITMAP_PROPERTIES bitmap_desc;
10972 ID2D1Effect *effect, *effect2;
10973 ID2D1Image *image_a, *image_b;
10974 struct d2d1_test_context ctx;
10979 BYTE buffer[256];
10980 IUnknown *unk;
10981 BOOL cached;
10982 CLSID clsid;
10983 HRESULT hr;
10984
10985 const struct effect_test
10986 {
10987 const CLSID *clsid;
10988 UINT32 factory_version;
10989 UINT32 default_input_count;
10990 UINT32 min_inputs;
10991 UINT32 max_inputs;
10992 }
10993 effect_tests[] =
10994 {
10995 {&CLSID_D2D12DAffineTransform, 1, 1, 1, 1},
10996 {&CLSID_D2D13DPerspectiveTransform, 1, 1, 1, 1},
10997 {&CLSID_D2D1Composite, 1, 2, 1, 0xffffffff},
10998 {&CLSID_D2D1Crop, 1, 1, 1, 1},
10999 {&CLSID_D2D1Shadow, 1, 1, 1, 1},
11000 {&CLSID_D2D1Grayscale, 3, 1, 1, 1},
11001 };
11002
11003 if (!init_test_context(&ctx, d3d11))
11004 return;
11005
11006 factory = ctx.factory1;
11007 if (!factory)
11008 {
11009 win_skip("ID2D1Factory1 is not supported.\n");
11011 return;
11012 }
11013 if (!ctx.factory3)
11014 win_skip("ID2D1Factory3 is not supported.\n");
11015
11016 context = ctx.context;
11017
11018 for (i = 0; i < ARRAY_SIZE(effect_tests); ++i)
11019 {
11020 const struct effect_test *test = effect_tests + i;
11021
11022 if (test->factory_version == 3 && !ctx.factory3)
11023 continue;
11024
11025 winetest_push_context("Test %u", i);
11026
11027 hr = ID2D1DeviceContext_CreateEffect(context, test->clsid, &effect);
11028 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
11029
11030 /* Test output image pointer */
11031 hr = ID2D1Effect_QueryInterface(effect, &IID_ID2D1Image, (void **)&image_a);
11032 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
11033 ID2D1Effect_GetOutput(effect, &image_b);
11034 ok(image_b == image_a, "Got unexpected image_b %p, expected %p.\n", image_b, image_a);
11035
11036 hr = ID2D1Image_QueryInterface(image_a, &IID_ID2D1Effect, (void **)&effect2);
11037 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
11038 ok(effect2 == effect, "Unexpected pointer.\n");
11039 ID2D1Effect_Release(effect2);
11040
11041 hr = ID2D1Image_QueryInterface(image_a, &IID_IUnknown, (void **)&unk);
11042 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
11043 ok(unk == (IUnknown *)effect, "Unexpected pointer.\n");
11044 IUnknown_Release(unk);
11045
11046 ID2D1Image_Release(image_b);
11047 ID2D1Image_Release(image_a);
11048
11049 /* Test GetValue() */
11050 hr = ID2D1Effect_GetValue(effect, 0xdeadbeef, D2D1_PROPERTY_TYPE_CLSID, (BYTE *)&clsid, sizeof(clsid));
11051 ok(hr == D2DERR_INVALID_PROPERTY, "Got unexpected hr %#lx.\n", hr);
11052
11053 hr = ID2D1Effect_GetValue(effect, D2D1_PROPERTY_CLSID, D2D1_PROPERTY_TYPE_CLSID, buffer, sizeof(clsid) + 1);
11054 ok(hr == E_INVALIDARG, "Got unexpected hr %#lx.\n", hr);
11055 hr = ID2D1Effect_GetValue(effect, D2D1_PROPERTY_CLSID, D2D1_PROPERTY_TYPE_CLSID, buffer, sizeof(clsid) - 1);
11056 ok(hr == E_INVALIDARG, "Got unexpected hr %#lx.\n", hr);
11057 hr = ID2D1Effect_GetValue(effect, D2D1_PROPERTY_CLSID, D2D1_PROPERTY_TYPE_CLSID, buffer, sizeof(clsid));
11058 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
11059
11060 hr = ID2D1Effect_GetValue(effect, D2D1_PROPERTY_DISPLAYNAME, D2D1_PROPERTY_TYPE_STRING, buffer, sizeof(buffer));
11061 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
11062 str_size = (wcslen((WCHAR *)buffer) + 1) * sizeof(WCHAR);
11063 hr = ID2D1Effect_GetValue(effect, D2D1_PROPERTY_DISPLAYNAME, D2D1_PROPERTY_TYPE_STRING, buffer, str_size);
11064 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
11065 hr = ID2D1Effect_GetValue(effect, D2D1_PROPERTY_DISPLAYNAME, D2D1_PROPERTY_TYPE_STRING, buffer, str_size - 1);
11066 ok(hr == D2DERR_INSUFFICIENT_BUFFER, "Got unexpected hr %#lx.\n", hr);
11067
11068 hr = ID2D1Effect_GetValue(effect, D2D1_PROPERTY_CLSID, 0xdeadbeef, (BYTE *)&clsid, sizeof(clsid));
11069 ok(hr == E_INVALIDARG, "Got unexpected hr %#lx.\n", hr);
11070 hr = ID2D1Effect_GetValue(effect, D2D1_PROPERTY_CLSID, D2D1_PROPERTY_TYPE_UNKNOWN, (BYTE *)&clsid, sizeof(clsid));
11071 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
11072 hr = ID2D1Effect_GetValue(effect, D2D1_PROPERTY_CLSID, D2D1_PROPERTY_TYPE_VECTOR4, (BYTE *)&clsid, sizeof(clsid));
11073 ok(hr == E_INVALIDARG, "Got unexpected hr %#lx.\n", hr);
11074 hr = ID2D1Effect_GetValue(effect, D2D1_PROPERTY_CLSID, D2D1_PROPERTY_TYPE_VECTOR4, buffer, sizeof(buffer));
11075 ok(hr == E_INVALIDARG, "Got unexpected hr %#lx.\n", hr);
11076
11077 hr = ID2D1Effect_GetValue(effect, D2D1_PROPERTY_CLSID,
11079 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
11080 ok(IsEqualGUID(&clsid, test->clsid), "Got unexpected clsid %s, expected %s.\n",
11082
11083 cached = TRUE;
11084 hr = ID2D1Effect_GetValue(effect, D2D1_PROPERTY_CACHED, D2D1_PROPERTY_TYPE_BOOL,
11085 (BYTE *)&cached, sizeof(cached));
11086 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
11087 ok(cached == FALSE, "Got unexpected cached %d.\n", cached);
11088
11089 hr = ID2D1Effect_GetValue(effect, D2D1_PROPERTY_PRECISION,
11091 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
11092 ok(precision == D2D1_BUFFER_PRECISION_UNKNOWN, "Got unexpected precision %u.\n", precision);
11093
11094 hr = ID2D1Effect_GetValue(effect, D2D1_PROPERTY_MIN_INPUTS,
11095 D2D1_PROPERTY_TYPE_UINT32, (BYTE *)&min_inputs, sizeof(min_inputs));
11096 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
11097 ok(min_inputs == test->min_inputs, "Got unexpected min inputs %u, expected %u.\n",
11098 min_inputs, test->min_inputs);
11099
11100 hr = ID2D1Effect_GetValue(effect, D2D1_PROPERTY_MAX_INPUTS,
11101 D2D1_PROPERTY_TYPE_UINT32, (BYTE *)&max_inputs, sizeof(max_inputs));
11102 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
11103 ok(max_inputs == test->max_inputs, "Got unexpected max inputs %u, expected %u.\n",
11104 max_inputs, test->max_inputs);
11105
11106 /* Test default input count */
11107 input_count = ID2D1Effect_GetInputCount(effect);
11108 ok(input_count == test->default_input_count, "Got unexpected input count %u, expected %u.\n",
11109 input_count, test->default_input_count);
11110
11111 /* Test SetInputCount() */
11112 input_count = (test->max_inputs < 16 ? test->max_inputs : 16);
11113 for (j = 0; j < input_count + 4; ++j)
11114 {
11115 winetest_push_context("Input %u", j);
11116 hr = ID2D1Effect_SetInputCount(effect, j);
11117 if (j < test->min_inputs || j > test->max_inputs)
11118 ok(hr == E_INVALIDARG, "Got unexpected hr %#lx.\n", hr);
11119 else
11120 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
11122 }
11123
11124 /* Test GetInput() before any input is set */
11125 input_count = ID2D1Effect_GetInputCount(effect);
11126 for (j = 0; j < input_count + 4; ++j)
11127 {
11128 winetest_push_context("Input %u", j);
11129 ID2D1Effect_GetInput(effect, j, &image_a);
11130 ok(image_a == NULL, "Got unexpected image_a %p.\n", image_a);
11132 }
11133
11134 /* Test GetInput() after an input is set */
11135 set_size_u(&size, 1, 1);
11137 bitmap_desc.pixelFormat.alphaMode = D2D1_ALPHA_MODE_IGNORE;
11138 bitmap_desc.dpiX = 96.0f;
11139 bitmap_desc.dpiY = 96.0f;
11140 hr = ID2D1RenderTarget_CreateBitmap(ctx.rt, size, NULL, 4, &bitmap_desc, &bitmap);
11141 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
11142
11143 ID2D1Effect_SetInput(effect, 0, (ID2D1Image *)bitmap, FALSE);
11144 for (j = 0; j < input_count + 4; ++j)
11145 {
11146 winetest_push_context("Input %u", j);
11147 image_a = (ID2D1Image *)0xdeadbeef;
11148 ID2D1Effect_GetInput(effect, j, &image_a);
11149 if (j == 0)
11150 {
11151 ok(image_a == (ID2D1Image *)bitmap, "Got unexpected image_a %p.\n", image_a);
11152 ID2D1Image_Release(image_a);
11153 }
11154 else
11155 {
11156 ok(image_a == NULL, "Got unexpected image_a %p.\n", image_a);
11157 }
11159 }
11160
11161 /* Test setting inputs with out-of-bounds index */
11162 for (j = input_count; j < input_count + 4; ++j)
11163 {
11164 winetest_push_context("Input %u", j);
11165 image_a = (ID2D1Image *)0xdeadbeef;
11166 ID2D1Effect_SetInput(effect, j, (ID2D1Image *)bitmap, FALSE);
11167 ID2D1Effect_GetInput(effect, j, &image_a);
11168 ok(image_a == NULL, "Got unexpected image_a %p.\n", image_a);
11170 }
11171 ID2D1Bitmap_Release(bitmap);
11172
11173 ID2D1Effect_Release(effect);
11175 }
11176
11178}
@ D2D1_PROPERTY_TYPE_VECTOR4
Definition: d2d1_1.idl:173
D2D1_BUFFER_PRECISION
Definition: d2d1_1.idl:106
GLenum GLint GLint * precision
Definition: glext.h:7539
#define debugstr_guid
Definition: kernel32.h:35
const CLSID * clsid
Definition: msctf.cpp:50

Referenced by START_TEST().

◆ test_clip()

static void test_clip ( BOOL  d3d11)
static

Definition at line 1704 of file d2d1.c.

1705{
1706 struct d2d1_test_context ctx;
1708 D2D1_SIZE_U pixel_size;
1712 float dpi_x, dpi_y;
1715 HRESULT hr;
1716 BOOL match;
1717 static const D2D1_MATRIX_3X2_F identity =
1718 {{{
1719 1.0f, 0.0f,
1720 0.0f, 1.0f,
1721 0.0f, 0.0f,
1722 }}};
1723
1724 if (!init_test_context(&ctx, d3d11))
1725 return;
1726
1727 rt = ctx.rt;
1728 ID2D1RenderTarget_GetDpi(rt, &dpi_x, &dpi_y);
1729 ok(dpi_x == 96.0f, "Got unexpected dpi_x %.8e.\n", dpi_x);
1730 ok(dpi_y == 96.0f, "Got unexpected dpi_x %.8e.\n", dpi_y);
1731 size = ID2D1RenderTarget_GetSize(rt);
1732 ok(size.width == 640.0f, "Got unexpected width %.8e.\n", size.width);
1733 ok(size.height == 480.0f, "Got unexpected height %.8e.\n", size.height);
1734 pixel_size = ID2D1RenderTarget_GetPixelSize(rt);
1735 ok(pixel_size.width == 640, "Got unexpected width %u.\n", pixel_size.width);
1736 ok(pixel_size.height == 480, "Got unexpected height %u.\n", pixel_size.height);
1737
1738 ID2D1RenderTarget_GetTransform(rt, &matrix);
1739 ok(!memcmp(&matrix, &identity, sizeof(matrix)),
1740 "Got unexpected matrix {%.8e, %.8e, %.8e, %.8e, %.8e, %.8e}.\n",
1741 matrix._11, matrix._12, matrix._21, matrix._22, matrix._31, matrix._32);
1742
1743 ID2D1RenderTarget_BeginDraw(rt);
1744
1745 set_color(&color, 1.0f, 1.0f, 0.0f, 1.0f);
1746 ID2D1RenderTarget_Clear(rt, &color);
1747
1748 ID2D1RenderTarget_SetDpi(rt, 48.0f, 192.0f);
1749 ID2D1RenderTarget_GetDpi(rt, &dpi_x, &dpi_y);
1750 ok(dpi_x == 48.0f, "Got unexpected dpi_x %.8e.\n", dpi_x);
1751 ok(dpi_y == 192.0f, "Got unexpected dpi_x %.8e.\n", dpi_y);
1752 size = ID2D1RenderTarget_GetSize(rt);
1753 ok(size.width == 1280.0f, "Got unexpected width %.8e.\n", size.width);
1754 ok(size.height == 240.0f, "Got unexpected height %.8e.\n", size.height);
1755 pixel_size = ID2D1RenderTarget_GetPixelSize(rt);
1756 ok(pixel_size.width == 640, "Got unexpected width %u.\n", pixel_size.width);
1757 ok(pixel_size.height == 480, "Got unexpected height %u.\n", pixel_size.height);
1758
1759 /* The effective clip rect is the intersection of all currently pushed
1760 * clip rects. Clip rects are in DIPs. */
1761 set_rect(&rect, 0.0f, 0.0f, 1280.0f, 80.0f);
1762 ID2D1RenderTarget_PushAxisAlignedClip(rt, &rect, D2D1_ANTIALIAS_MODE_ALIASED);
1763 set_rect(&rect, 0.0f, 0.0f, 426.0f, 240.0f);
1764 ID2D1RenderTarget_PushAxisAlignedClip(rt, &rect, D2D1_ANTIALIAS_MODE_ALIASED);
1765
1766 set_color(&color, 0.0f, 1.0f, 0.0f, 1.0f);
1767 ID2D1RenderTarget_Clear(rt, &color);
1768 ID2D1RenderTarget_PopAxisAlignedClip(rt);
1769 ID2D1RenderTarget_PopAxisAlignedClip(rt);
1770
1771 ID2D1RenderTarget_SetDpi(rt, 0.0f, 0.0f);
1772 ID2D1RenderTarget_GetDpi(rt, &dpi_x, &dpi_y);
1773 ok(dpi_x == 96.0f, "Got unexpected dpi_x %.8e.\n", dpi_x);
1774 ok(dpi_y == 96.0f, "Got unexpected dpi_y %.8e.\n", dpi_y);
1775
1776 ID2D1RenderTarget_SetDpi(rt, 192.0f, 192.0f);
1777 ID2D1RenderTarget_SetDpi(rt, 0.0f, 96.0f);
1778 ID2D1RenderTarget_GetDpi(rt, &dpi_x, &dpi_y);
1779 ok(dpi_x == 192.0f, "Got unexpected dpi_x %.8e.\n", dpi_x);
1780 ok(dpi_y == 192.0f, "Got unexpected dpi_y %.8e.\n", dpi_y);
1781
1782 ID2D1RenderTarget_SetDpi(rt, -10.0f, 96.0f);
1783 ID2D1RenderTarget_GetDpi(rt, &dpi_x, &dpi_y);
1784 ok(dpi_x == 192.0f, "Got unexpected dpi_x %.8e.\n", dpi_x);
1785 ok(dpi_y == 192.0f, "Got unexpected dpi_y %.8e.\n", dpi_y);
1786
1787 ID2D1RenderTarget_SetDpi(rt, 96.0f, -10.0f);
1788 ID2D1RenderTarget_GetDpi(rt, &dpi_x, &dpi_y);
1789 ok(dpi_x == 192.0f, "Got unexpected dpi_x %.8e.\n", dpi_x);
1790 ok(dpi_y == 192.0f, "Got unexpected dpi_y %.8e.\n", dpi_y);
1791
1792 ID2D1RenderTarget_SetDpi(rt, 96.0f, 0.0f);
1793 ID2D1RenderTarget_GetDpi(rt, &dpi_x, &dpi_y);
1794 ok(dpi_x == 192.0f, "Got unexpected dpi_x %.8e.\n", dpi_x);
1795 ok(dpi_y == 192.0f, "Got unexpected dpi_y %.8e.\n", dpi_y);
1796
1797 ID2D1RenderTarget_SetDpi(rt, 96.0f, 96.0f);
1798
1799 /* Transformations apply to clip rects, the effective clip rect is the
1800 * (axis-aligned) bounding box of the transformed clip rect. */
1801 set_point(&point, 320.0f, 240.0f);
1803 ID2D1RenderTarget_SetTransform(rt, &matrix);
1804 set_rect(&rect, 215.0f, 208.0f, 425.0f, 272.0f);
1805 ID2D1RenderTarget_PushAxisAlignedClip(rt, &rect, D2D1_ANTIALIAS_MODE_ALIASED);
1806 set_color(&color, 1.0f, 1.0f, 1.0f, 1.0f);
1807 ID2D1RenderTarget_Clear(rt, &color);
1808 ID2D1RenderTarget_PopAxisAlignedClip(rt);
1809
1810 /* Transformations are applied when pushing the clip rect, transformations
1811 * set afterwards have no effect on the current clip rect. This includes
1812 * SetDpi(). */
1813 ID2D1RenderTarget_SetTransform(rt, &identity);
1814 set_rect(&rect, 427.0f, 320.0f, 640.0f, 480.0f);
1815 ID2D1RenderTarget_PushAxisAlignedClip(rt, &rect, D2D1_ANTIALIAS_MODE_ALIASED);
1816 ID2D1RenderTarget_SetTransform(rt, &matrix);
1817 ID2D1RenderTarget_SetDpi(rt, 48.0f, 192.0f);
1818 set_color(&color, 1.0f, 0.0f, 0.0f, 1.0f);
1819 ID2D1RenderTarget_Clear(rt, &color);
1820 ID2D1RenderTarget_PopAxisAlignedClip(rt);
1821
1822 hr = ID2D1RenderTarget_EndDraw(rt, NULL, NULL);
1823 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
1824 match = compare_surface(&ctx, "035a44d4198d6e422e9de6185b5b2c2bac5e33c9");
1825 ok(match, "Surface does not match.\n");
1826
1827 /* Fractional clip rectangle coordinates, aliased mode. */
1829 ID2D1RenderTarget_SetTransform(rt, &matrix);
1830 ID2D1RenderTarget_SetDpi(rt, 96.0f, 96.0f);
1831
1832 ID2D1RenderTarget_BeginDraw(rt);
1833
1834 set_color(&color, 0.0f, 0.0f, 0.0f, 1.0f);
1835 ID2D1RenderTarget_Clear(rt, &color);
1836
1837 scale_matrix(&matrix, 2.0f, 2.0f);
1838 ID2D1RenderTarget_SetTransform(rt, &matrix);
1839 set_rect(&rect, 0.0f, 0.5f, 200.0f, 100.5f);
1840 set_color(&color, 1.0f, 0.0f, 1.0f, 1.0f);
1841 ID2D1RenderTarget_PushAxisAlignedClip(rt, &rect, D2D1_ANTIALIAS_MODE_ALIASED);
1842 ID2D1RenderTarget_Clear(rt, &color);
1843 ID2D1RenderTarget_PopAxisAlignedClip(rt);
1844
1846 ID2D1RenderTarget_SetTransform(rt, &matrix);
1847 set_rect(&rect, 0.0f, 0.5f, 100.0f, 200.5f);
1848 set_color(&color, 1.0f, 0.0f, 0.0f, 1.0f);
1849 ID2D1RenderTarget_PushAxisAlignedClip(rt, &rect, D2D1_ANTIALIAS_MODE_ALIASED);
1850 ID2D1RenderTarget_Clear(rt, &color);
1851 ID2D1RenderTarget_PopAxisAlignedClip(rt);
1852
1853 ID2D1RenderTarget_SetTransform(rt, &matrix);
1854 set_rect(&rect, 0.5f, 250.0f, 100.5f, 300.0f);
1855 set_color(&color, 1.0f, 1.0f, 0.0f, 1.0f);
1856 ID2D1RenderTarget_PushAxisAlignedClip(rt, &rect, D2D1_ANTIALIAS_MODE_ALIASED);
1857 ID2D1RenderTarget_Clear(rt, &color);
1858 ID2D1RenderTarget_PopAxisAlignedClip(rt);
1859
1860 translate_matrix(&matrix, 0.1f, 0.0f);
1861 ID2D1RenderTarget_SetTransform(rt, &matrix);
1862 set_rect(&rect, 110.0f, 250.25f, 150.0f, 300.25f);
1863 set_color(&color, 0.0f, 1.0f, 0.0f, 1.0f);
1864 ID2D1RenderTarget_PushAxisAlignedClip(rt, &rect, D2D1_ANTIALIAS_MODE_ALIASED);
1865 ID2D1RenderTarget_Clear(rt, &color);
1866 ID2D1RenderTarget_PopAxisAlignedClip(rt);
1867
1868 set_rect(&rect, 160.0f, 250.75f, 200.0f, 300.75f);
1869 set_color(&color, 0.0f, 0.0f, 1.0f, 1.0f);
1870 ID2D1RenderTarget_PushAxisAlignedClip(rt, &rect, D2D1_ANTIALIAS_MODE_ALIASED);
1871 ID2D1RenderTarget_Clear(rt, &color);
1872 ID2D1RenderTarget_PopAxisAlignedClip(rt);
1873
1874 ID2D1RenderTarget_SetDpi(rt, 48.0f, 192.0f);
1875 set_rect(&rect, 160.25f, 0.0f, 200.25f, 100.0f);
1876 set_color(&color, 1.0f, 0.0f, 1.0f, 1.0f);
1877 ID2D1RenderTarget_PushAxisAlignedClip(rt, &rect, D2D1_ANTIALIAS_MODE_ALIASED);
1878 ID2D1RenderTarget_Clear(rt, &color);
1879 ID2D1RenderTarget_PopAxisAlignedClip(rt);
1880
1881 ID2D1RenderTarget_SetDpi(rt, 192.0f, 48.0f);
1882 set_rect(&rect, 160.75f, 100.0f, 200.75f, 120.0f);
1883 set_color(&color, 0.0f, 1.0f, 1.0f, 1.0f);
1884 ID2D1RenderTarget_PushAxisAlignedClip(rt, &rect, D2D1_ANTIALIAS_MODE_ALIASED);
1885 ID2D1RenderTarget_Clear(rt, &color);
1886 ID2D1RenderTarget_PopAxisAlignedClip(rt);
1887
1888 hr = ID2D1RenderTarget_EndDraw(rt, NULL, NULL);
1889 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
1890 match = compare_surface(&ctx, "cb418ec4a7c8407b5e36db06fc6292a06bb8476c");
1891 ok(match, "Surface does not match.\n");
1892
1894}
void WINAPI D2D1MakeRotateMatrix(float angle, D2D1_POINT_2F center, D2D1_MATRIX_3X2_F *matrix)
Definition: factory.c:1391

Referenced by START_TEST().

◆ test_color_brush()

static void test_color_brush ( BOOL  d3d11)
static

Definition at line 2164 of file d2d1.c.

2165{
2166 D2D1_MATRIX_3X2_F matrix, tmp_matrix;
2167 D2D1_BRUSH_PROPERTIES brush_desc;
2168 D2D1_COLOR_F color, tmp_color;
2169 struct d2d1_test_context ctx;
2170 ID2D1SolidColorBrush *brush;
2173 float opacity;
2174 HRESULT hr;
2175 BOOL match;
2176
2177 if (!init_test_context(&ctx, d3d11))
2178 return;
2179
2180 rt = ctx.rt;
2181 ID2D1RenderTarget_SetDpi(rt, 192.0f, 48.0f);
2182 ID2D1RenderTarget_SetAntialiasMode(rt, D2D1_ANTIALIAS_MODE_ALIASED);
2183
2184 set_color(&color, 0.0f, 0.0f, 0.0f, 0.0f);
2185 hr = ID2D1RenderTarget_CreateSolidColorBrush(rt, &color, NULL, &brush);
2186 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
2187 opacity = ID2D1SolidColorBrush_GetOpacity(brush);
2188 ok(opacity == 1.0f, "Got unexpected opacity %.8e.\n", opacity);
2190 ID2D1SolidColorBrush_GetTransform(brush, &tmp_matrix);
2191 ok(!memcmp(&tmp_matrix, &matrix, sizeof(matrix)),
2192 "Got unexpected matrix {%.8e, %.8e, %.8e, %.8e, %.8e, %.8e}.\n",
2193 tmp_matrix._11, tmp_matrix._12, tmp_matrix._21,
2194 tmp_matrix._22, tmp_matrix._31, tmp_matrix._32);
2195 tmp_color = ID2D1SolidColorBrush_GetColor(brush);
2196 ok(!memcmp(&tmp_color, &color, sizeof(color)),
2197 "Got unexpected color {%.8e, %.8e, %.8e, %.8e}.\n",
2198 tmp_color.r, tmp_color.g, tmp_color.b, tmp_color.a);
2199 ID2D1SolidColorBrush_Release(brush);
2200
2201 set_color(&color, 0.0f, 1.0f, 0.0f, 0.8f);
2202 brush_desc.opacity = 0.3f;
2204 scale_matrix(&matrix, 2.0f, 2.0f);
2205 brush_desc.transform = matrix;
2206 hr = ID2D1RenderTarget_CreateSolidColorBrush(rt, &color, &brush_desc, &brush);
2207 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
2208 opacity = ID2D1SolidColorBrush_GetOpacity(brush);
2209 ok(opacity == 0.3f, "Got unexpected opacity %.8e.\n", opacity);
2210 ID2D1SolidColorBrush_GetTransform(brush, &tmp_matrix);
2211 ok(!memcmp(&tmp_matrix, &matrix, sizeof(matrix)),
2212 "Got unexpected matrix {%.8e, %.8e, %.8e, %.8e, %.8e, %.8e}.\n",
2213 tmp_matrix._11, tmp_matrix._12, tmp_matrix._21,
2214 tmp_matrix._22, tmp_matrix._31, tmp_matrix._32);
2215 tmp_color = ID2D1SolidColorBrush_GetColor(brush);
2216 ok(!memcmp(&tmp_color, &color, sizeof(color)),
2217 "Got unexpected color {%.8e, %.8e, %.8e, %.8e}.\n",
2218 tmp_color.r, tmp_color.g, tmp_color.b, tmp_color.a);
2219
2220 ID2D1RenderTarget_BeginDraw(rt);
2221
2222 set_color(&color, 0.0f, 0.0f, 1.0f, 1.0f);
2223 ID2D1RenderTarget_Clear(rt, &color);
2224
2225 ID2D1SolidColorBrush_SetOpacity(brush, 1.0f);
2226 set_rect(&rect, 40.0f, 120.0f, 120.0f, 360.0f);
2227 ID2D1RenderTarget_FillRectangle(rt, &rect, (ID2D1Brush *)brush);
2228
2230 scale_matrix(&matrix, 0.5f, 2.0f);
2231 translate_matrix(&matrix, 320.0f, 240.0f);
2232 rotate_matrix(&matrix, M_PI / 4.0f);
2233 ID2D1RenderTarget_SetTransform(rt, &matrix);
2234 set_color(&color, 1.0f, 0.0f, 0.0f, 0.625f);
2235 ID2D1SolidColorBrush_SetColor(brush, &color);
2236 ID2D1SolidColorBrush_SetOpacity(brush, 0.75f);
2237 set_rect(&rect, -80.0f, -60.0f, 80.0f, 60.0f);
2238 ID2D1RenderTarget_FillRectangle(rt, &rect, (ID2D1Brush *)brush);
2239
2240 hr = ID2D1RenderTarget_EndDraw(rt, NULL, NULL);
2241 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
2242 match = compare_surface(&ctx, "6d1218fca5e21fb7e287b3a439d60dbc251f5ceb");
2243 ok(match, "Surface does not match.\n");
2244
2245 ID2D1SolidColorBrush_Release(brush);
2247}
D2D1_MATRIX_3X2_F transform
Definition: d2d1.idl:377

Referenced by START_TEST().

◆ test_colour_space()

static void test_colour_space ( BOOL  d3d11)
static

Definition at line 10629 of file d2d1.c.

10630{
10631 D2D1_COLOR_F src_colour, dst_colour, expected;
10632 D2D1_COLOR_SPACE src_space, dst_space;
10633 unsigned i, j, k;
10634
10635 static const D2D1_COLOR_SPACE colour_spaces[] =
10636 {
10640 };
10641 static struct
10642 {
10643 D2D1_COLOR_F srgb;
10644 D2D1_COLOR_F scrgb;
10645 }
10646 const test_data[] =
10647 {
10648 {{0.0f, 0.0f, 0.0f, 0.0f}, {0.0f, 0.0f, 0.0f, 0.0f}},
10649 {{0.0f, 0.0f, 0.0f, 1.0f}, {0.0f, 0.0f, 0.0f, 1.0f}},
10650 {{1.0f, 1.0f, 1.0f, 1.0f}, {1.0f, 1.0f, 1.0f, 1.0f}},
10651 /* Samples in the non-linear region. */
10652 {{0.2f, 0.4f, 0.6f, 0.8f}, {0.0331047624f, 0.132868335f, 0.318546832f, 0.8f}},
10653 {{0.3f, 0.5f, 0.7f, 0.9f}, {0.0732389688f, 0.214041144f, 0.447988421f, 0.9f}},
10654 /* Samples in the linear region. */
10655 {{0.0002f, 0.0004f, 0.0006f, 0.0008f}, {1.54798763e-005f, 3.09597526e-005f, 4.64396289e-005f, 0.0008f}},
10656 {{0.0003f, 0.0005f, 0.0007f, 0.0009f}, {2.32198145e-005f, 3.86996908e-005f, 5.41795634e-005f, 0.0009f}},
10657 /* Out of range samples */
10658 {{-0.3f, 1.5f, -0.7f, 2.0f}, { 0.0f, 1.0f, 0.0f, 2.0f}},
10659 {{ 1.5f, -0.3f, 2.0f, -0.7f}, { 1.0f, 0.0f, 1.0f, -0.7f}},
10660 {{ 0.0f, 1.0f, 0.0f, 1.5f}, {-0.7f, 2.0f, -0.3f, 1.5f}},
10661 {{ 1.0f, 0.0f, 1.0f, -0.3f}, { 2.0f, -0.7f, 1.5f, -0.3f}},
10662 };
10663
10664 if (!pD2D1ConvertColorSpace)
10665 {
10666 win_skip("D2D1ConvertColorSpace() not available, skipping test.\n");
10667 return;
10668 }
10669
10670 for (i = 0; i < ARRAY_SIZE(colour_spaces); ++i)
10671 {
10672 src_space = colour_spaces[i];
10673 for (j = 0; j < ARRAY_SIZE(colour_spaces); ++j)
10674 {
10675 dst_space = colour_spaces[j];
10676 for (k = 0; k < ARRAY_SIZE(test_data); ++k)
10677 {
10678 if (src_space == D2D1_COLOR_SPACE_SCRGB)
10679 src_colour = test_data[k].scrgb;
10680 else
10681 src_colour = test_data[k].srgb;
10682
10683 if (dst_space == D2D1_COLOR_SPACE_SCRGB)
10684 expected = test_data[k].scrgb;
10685 else
10686 expected = test_data[k].srgb;
10687
10688 if (src_space == D2D1_COLOR_SPACE_CUSTOM || dst_space == D2D1_COLOR_SPACE_CUSTOM)
10689 {
10690 set_color(&expected, 0.0f, 0.0f, 0.0f, 0.0f);
10691 }
10692 else if (src_space != dst_space)
10693 {
10694 expected.r = clamp_float(expected.r, 0.0f, 1.0f);
10695 expected.g = clamp_float(expected.g, 0.0f, 1.0f);
10696 expected.b = clamp_float(expected.b, 0.0f, 1.0f);
10697 }
10698
10699 dst_colour = pD2D1ConvertColorSpace(src_space, dst_space, &src_colour);
10700 ok(compare_colour_f(&dst_colour, expected.r, expected.g, expected.b, expected.a, 1),
10701 "Got unexpected destination colour {%.8e, %.8e, %.8e, %.8e}, "
10702 "expected destination colour {%.8e, %.8e, %.8e, %.8e} for "
10703 "source colour {%.8e, %.8e, %.8e, %.8e}, "
10704 "source colour space %#x, destination colour space %#x.\n",
10705 dst_colour.r, dst_colour.g, dst_colour.b, dst_colour.a,
10707 src_colour.r, src_colour.g, src_colour.b, src_colour.a,
10708 src_space, dst_space);
10709 }
10710 }
10711 }
10712}
static float clamp_float(float f, float lower, float upper)
Definition: d2d1.c:773
static BOOL compare_colour_f(const D2D1_COLOR_F *colour, float r, float g, float b, float a, unsigned int ulps)
Definition: d2d1.c:806
D2D1_COLOR_SPACE
Definition: d2d1_1.idl:79
@ D2D1_COLOR_SPACE_SCRGB
Definition: d2d1_1.idl:82
@ D2D1_COLOR_SPACE_CUSTOM
Definition: d2d1_1.idl:80
@ D2D1_COLOR_SPACE_SRGB
Definition: d2d1_1.idl:81

Referenced by START_TEST().

◆ test_command_list()

static void test_command_list ( BOOL  d3d11)
static

Definition at line 9882 of file d2d1.c.

9883{
9884 static const DWORD bitmap_data[] =
9885 {
9886 0xffff0000, 0xffffff00, 0xff00ff00, 0xff00ffff,
9887 };
9888 static const D2D1_GRADIENT_STOP stops[] =
9889 {
9890 {0.0f, {1.0f, 0.0f, 0.0f, 1.0f}},
9891 {0.5f, {0.0f, 1.0f, 0.0f, 1.0f}},
9892 {1.0f, {0.0f, 0.0f, 1.0f, 1.0f}},
9893 };
9894 D2D1_RADIAL_GRADIENT_BRUSH_PROPERTIES radial_gradient_properties;
9895 D2D1_LINEAR_GRADIENT_BRUSH_PROPERTIES linear_gradient_properties;
9896 ID2D1DeviceContext *device_context, *device_context2;
9897 D2D1_STROKE_STYLE_PROPERTIES stroke_desc;
9899 D2D1_BITMAP_PROPERTIES bitmap_desc;
9900 ID2D1StrokeStyle *stroke_style;
9901 ID2D1CommandList *command_list;
9902 struct d2d1_test_context ctx;
9904 ID2D1Geometry *geometry;
9906 D2D1_POINT_2F p0, p1;
9910 ID2D1Brush *brush;
9913 ULONG refcount;
9914 HRESULT hr;
9915
9916 if (!init_test_context(&ctx, d3d11))
9917 return;
9918
9919 if (!ctx.factory1)
9920 {
9921 win_skip("Command lists are not supported.\n");
9923 return;
9924 }
9925
9926 device_context = ctx.context;
9927
9928 hr = ID2D1DeviceContext_CreateCommandList(device_context, &command_list);
9929 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
9930
9931 ID2D1DeviceContext_SetTarget(device_context, (ID2D1Image *)command_list);
9932
9933 size = ID2D1DeviceContext_GetPixelSize(device_context);
9934 ok(!size.width, "Got unexpected width %u.\n", size.width);
9935 ok(!size.height, "Got unexpected height %u.\n", size.height);
9936
9937 format = ID2D1DeviceContext_GetPixelFormat(device_context);
9938 ok(format.format == DXGI_FORMAT_UNKNOWN && format.alphaMode == D2D1_ALPHA_MODE_UNKNOWN,
9939 "Unexpected format %u, alpha mode %u.\n", format.format, format.alphaMode);
9940
9941 ID2D1DeviceContext_BeginDraw(device_context);
9942
9943 hr = ID2D1DeviceContext_QueryInterface(device_context, &IID_ID2D1RenderTarget, (void **)&rt);
9944 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
9945
9946 /* Test how resources are referenced by the list. */
9947
9948 /* Bitmap. */
9949 set_size_u(&size, 4, 1);
9951 bitmap_desc.pixelFormat.alphaMode = D2D1_ALPHA_MODE_IGNORE;
9952 bitmap_desc.dpiX = 96.0f;
9953 bitmap_desc.dpiY = 96.0f;
9954 hr = ID2D1RenderTarget_CreateBitmap(rt, size, bitmap_data, 4 * sizeof(*bitmap_data), &bitmap_desc, &bitmap);
9955 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
9956
9957 ID2D1RenderTarget_DrawBitmap(rt, bitmap, NULL, 0.25f, D2D1_BITMAP_INTERPOLATION_MODE_NEAREST_NEIGHBOR, NULL);
9958
9959 refcount = ID2D1Bitmap_Release(bitmap);
9960 ok(refcount == 1, "Got unexpected refcount %lu.\n", refcount);
9961
9962 /* Solid color brush. */
9963 set_color(&color, 0.0f, 0.0f, 0.0f, 0.0f);
9964 hr = ID2D1RenderTarget_CreateSolidColorBrush(rt, &color, NULL, (ID2D1SolidColorBrush **)&brush);
9965 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
9966
9967 set_rect(&rect, 0.0f, 0.0f, 16.0f, 16.0f);
9968 ID2D1RenderTarget_FillRectangle(rt, &rect, brush);
9969
9970 refcount = ID2D1Brush_Release(brush);
9971 ok(refcount == 0, "Got unexpected refcount %lu.\n", refcount);
9972
9973 /* Bitmap brush. */
9974 hr = ID2D1RenderTarget_CreateBitmap(rt, size, bitmap_data, 4 * sizeof(*bitmap_data), &bitmap_desc, &bitmap);
9975 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
9976
9977 hr = ID2D1RenderTarget_CreateBitmapBrush(rt, bitmap, NULL, NULL, (ID2D1BitmapBrush **)&brush);
9978 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
9979
9980 set_rect(&rect, 0.0f, 0.0f, 16.0f, 16.0f);
9981 ID2D1RenderTarget_FillRectangle(rt, &rect, brush);
9982
9983 refcount = ID2D1Brush_Release(brush);
9984 ok(refcount == 0, "Got unexpected refcount %lu.\n", refcount);
9985
9986 refcount = ID2D1Bitmap_Release(bitmap);
9987 ok(refcount == 1, "Got unexpected refcount %lu.\n", refcount);
9988
9989 /* Linear gradient brush. */
9990 hr = ID2D1RenderTarget_CreateGradientStopCollection(rt, stops, ARRAY_SIZE(stops),
9992 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
9993
9994 set_point(&linear_gradient_properties.startPoint, 320.0f, 0.0f);
9995 set_point(&linear_gradient_properties.endPoint, 0.0f, 960.0f);
9996 hr = ID2D1RenderTarget_CreateLinearGradientBrush(rt, &linear_gradient_properties, NULL, gradient,
9997 (ID2D1LinearGradientBrush **)&brush);
9998 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
9999
10000 set_rect(&rect, -1.0f, -1.0f, 1.0f, 1.0f);
10001 hr = ID2D1Factory1_CreateRectangleGeometry(ctx.factory1, &rect, (ID2D1RectangleGeometry **)&geometry);
10002 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
10003
10004 ID2D1RenderTarget_FillGeometry(rt, geometry, brush, NULL);
10005
10006 refcount = ID2D1Brush_Release(brush);
10007 ok(refcount == 0, "Got unexpected refcount %lu.\n", refcount);
10008
10009 refcount = ID2D1Geometry_Release(geometry);
10010 ok(refcount == 1, "Got unexpected refcount %lu.\n", refcount);
10011
10012 refcount = ID2D1GradientStopCollection_Release(gradient);
10013 ok(refcount == 1, "Got unexpected refcount %lu.\n", refcount);
10014
10015 /* Radial gradient brush. */
10016 hr = ID2D1RenderTarget_CreateGradientStopCollection(rt, stops, ARRAY_SIZE(stops),
10018 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
10019
10020 set_point(&radial_gradient_properties.center, 160.0f, 480.0f);
10021 set_point(&radial_gradient_properties.gradientOriginOffset, 40.0f, -120.0f);
10022 radial_gradient_properties.radiusX = 160.0f;
10023 radial_gradient_properties.radiusY = 480.0f;
10024 hr = ID2D1RenderTarget_CreateRadialGradientBrush(rt, &radial_gradient_properties, NULL, gradient,
10025 (ID2D1RadialGradientBrush **)&brush);
10026 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
10027
10028 set_rect(&rect, -1.0f, -1.0f, 1.0f, 1.0f);
10029 hr = ID2D1Factory1_CreateRectangleGeometry(ctx.factory1, &rect, (ID2D1RectangleGeometry **)&geometry);
10030 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
10031
10032 ID2D1RenderTarget_FillGeometry(rt, geometry, brush, NULL);
10033
10034 refcount = ID2D1Brush_Release(brush);
10035 ok(refcount == 0, "Got unexpected refcount %lu.\n", refcount);
10036
10037 refcount = ID2D1Geometry_Release(geometry);
10038 ok(refcount == 1, "Got unexpected refcount %lu.\n", refcount);
10039
10040 refcount = ID2D1GradientStopCollection_Release(gradient);
10041 ok(refcount == 1, "Got unexpected refcount %lu.\n", refcount);
10042
10043 /* Geometry. */
10044 set_rect(&rect, -1.0f, -1.0f, 1.0f, 1.0f);
10045 hr = ID2D1Factory1_CreateRectangleGeometry(ctx.factory1, &rect, (ID2D1RectangleGeometry **)&geometry);
10046 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
10047
10048 set_color(&color, 0.0f, 0.0f, 0.0f, 0.0f);
10049 hr = ID2D1RenderTarget_CreateSolidColorBrush(rt, &color, NULL, (ID2D1SolidColorBrush **)&brush);
10050 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
10051
10052 ID2D1RenderTarget_FillGeometry(rt, geometry, brush, NULL);
10053
10054 refcount = ID2D1Brush_Release(brush);
10055 ok(refcount == 0, "Got unexpected refcount %lu.\n", refcount);
10056
10057 refcount = ID2D1Geometry_Release(geometry);
10058 ok(refcount == 1, "Got unexpected refcount %lu.\n", refcount);
10059
10060 /* Stroke style. */
10061 stroke_desc.startCap = D2D1_CAP_STYLE_SQUARE;
10062 stroke_desc.endCap = D2D1_CAP_STYLE_ROUND;
10063 stroke_desc.dashCap = D2D1_CAP_STYLE_TRIANGLE;
10064 stroke_desc.lineJoin = D2D1_LINE_JOIN_BEVEL;
10065 stroke_desc.miterLimit = 1.5f;
10066 stroke_desc.dashStyle = D2D1_DASH_STYLE_DOT;
10067 stroke_desc.dashOffset = -1.0f;
10068
10069 hr = ID2D1Factory_CreateStrokeStyle(ctx.factory, &stroke_desc, NULL, 0, &stroke_style);
10070 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
10071
10072 set_color(&color, 0.0f, 0.0f, 0.0f, 0.0f);
10073 hr = ID2D1RenderTarget_CreateSolidColorBrush(rt, &color, NULL, (ID2D1SolidColorBrush **)&brush);
10074 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
10075
10076 set_point(&p0, 100.0f, 160.0f);
10077 set_point(&p1, 140.0f, 160.0f);
10078 ID2D1RenderTarget_DrawLine(rt, p0, p1, brush, 1.0f, stroke_style);
10079
10080 refcount = ID2D1Brush_Release(brush);
10081 ok(refcount == 0, "Got unexpected refcount %lu.\n", refcount);
10082
10083 refcount = ID2D1StrokeStyle_Release(stroke_style);
10084 ok(refcount == 1, "Got unexpected refcount %lu.\n", refcount);
10085
10086 /* Close on attached list. */
10087 ID2D1DeviceContext_GetTarget(device_context, &target);
10088 ok(target == (ID2D1Image *)command_list, "Unexpected context target.\n");
10089 ID2D1Image_Release(target);
10090
10091 hr = ID2D1CommandList_Close(command_list);
10092 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
10093
10094 ID2D1DeviceContext_GetTarget(device_context, &target);
10095 todo_wine
10096 ok(target == NULL, "Unexpected context target.\n");
10097 if (target) ID2D1Image_Release(target);
10098
10099 hr = ID2D1CommandList_Close(command_list);
10100 ok(hr == D2DERR_WRONG_STATE, "Got unexpected hr %#lx.\n", hr);
10101
10102 ID2D1CommandList_Release(command_list);
10103
10104 /* Close empty list. */
10105 hr = ID2D1DeviceContext_CreateCommandList(device_context, &command_list);
10106 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
10107
10108 hr = ID2D1CommandList_Close(command_list);
10109 todo_wine
10110 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
10111
10112 ID2D1CommandList_Release(command_list);
10113
10114 /* List created with different context. */
10115 device_context2 = create_device_context(ctx.factory1, ctx.device, d3d11);
10116 ok(device_context2 != NULL, "Failed to create device context.\n");
10117
10118 hr = ID2D1DeviceContext_CreateCommandList(device_context, &command_list);
10119 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
10120
10121 ID2D1DeviceContext_SetTarget(device_context2, (ID2D1Image *)command_list);
10122 ID2D1DeviceContext_GetTarget(device_context2, &target);
10123 todo_wine
10124 ok(target == NULL, "Unexpected target.\n");
10125 if (target) ID2D1Image_Release(target);
10126
10127 ID2D1CommandList_Release(command_list);
10128 ID2D1DeviceContext_Release(device_context2);
10129
10130 ID2D1RenderTarget_Release(rt);
10132}
static ID2D1DeviceContext * create_device_context(ID2D1Factory1 *factory, IDXGIDevice *dxgi_device, BOOL d3d11)
Definition: d2d1.c:9866
@ D2D1_CAP_STYLE_SQUARE
Definition: d2d1.idl:115
@ D2D1_CAP_STYLE_ROUND
Definition: d2d1.idl:116
@ D2D1_CAP_STYLE_TRIANGLE
Definition: d2d1.idl:117
@ D2D1_GAMMA_2_2
Definition: d2d1.idl:214
@ D2D1_LINE_JOIN_BEVEL
Definition: d2d1.idl:124
@ D2D1_DASH_STYLE_DOT
Definition: d2d1.idl:134
D2D1_CAP_STYLE endCap
Definition: d2d1.idl:418
D2D1_CAP_STYLE dashCap
Definition: d2d1.idl:419
D2D1_DASH_STYLE dashStyle
Definition: d2d1.idl:422
D2D1_LINE_JOIN lineJoin
Definition: d2d1.idl:420
D2D1_CAP_STYLE startCap
Definition: d2d1.idl:417

Referenced by START_TEST().

◆ test_compatible_target_size_()

static void test_compatible_target_size_ ( unsigned int  line,
ID2D1RenderTarget *  rt 
)
static

Definition at line 6592 of file d2d1.c.

6593{
6594 static const D2D1_SIZE_F size_1_0 = { 1.0f, 0.0f };
6595 static const D2D1_SIZE_F size_1_1 = { 1.0f, 1.0f };
6596 static const D2D1_SIZE_U px_size_1_1 = { 1, 1 };
6597 static const D2D1_SIZE_U zero_px_size;
6598 static const D2D1_SIZE_F zero_size;
6599 static const struct size_test
6600 {
6601 const D2D1_SIZE_U *pixel_size;
6602 const D2D1_SIZE_F *size;
6603 }
6604 size_tests[] =
6605 {
6606 { &zero_px_size, NULL },
6607 { &zero_px_size, &zero_size },
6608 { NULL, &zero_size },
6609 { NULL, &size_1_0 },
6610 { &px_size_1_1, &size_1_1 },
6611 };
6612 float dpi_x, dpi_y, rt_dpi_x, rt_dpi_y;
6613 D2D1_SIZE_U pixel_size, expected_size;
6614 ID2D1BitmapRenderTarget *bitmap_rt;
6616 unsigned int i;
6617 HRESULT hr;
6618
6619 ID2D1RenderTarget_GetDpi(rt, &rt_dpi_x, &rt_dpi_y);
6620
6621 for (i = 0; i < ARRAY_SIZE(size_tests); ++i)
6622 {
6623 hr = ID2D1RenderTarget_CreateCompatibleRenderTarget(rt, size_tests[i].size, size_tests[i].pixel_size,
6625 ok_(__FILE__, line)(SUCCEEDED(hr), "%u: Failed to create render target, hr %#lx.\n", i, hr);
6626
6627 if (size_tests[i].pixel_size)
6628 {
6629 expected_size = *size_tests[i].pixel_size;
6630 }
6631 else if (size_tests[i].size)
6632 {
6633 expected_size.width = ceilf((size_tests[i].size->width * rt_dpi_x) / 96.0f);
6634 expected_size.height = ceilf((size_tests[i].size->height * rt_dpi_y) / 96.0f);
6635 }
6636 else
6637 {
6638 expected_size = ID2D1RenderTarget_GetPixelSize(rt);
6639 }
6640
6641 pixel_size = ID2D1BitmapRenderTarget_GetPixelSize(bitmap_rt);
6642 ok_(__FILE__, line)(!memcmp(&pixel_size, &expected_size, sizeof(pixel_size)),
6643 "%u: unexpected target size %ux%u.\n", i, pixel_size.width, pixel_size.height);
6644
6645 ID2D1BitmapRenderTarget_GetDpi(bitmap_rt, &dpi_x, &dpi_y);
6646 if (size_tests[i].pixel_size && size_tests[i].size && size_tests[i].size->width != 0.0f
6647 && size_tests[i].size->height != 0.0f)
6648 {
6649 ok_(__FILE__, line)(dpi_x == pixel_size.width * 96.0f / size_tests[i].size->width
6650 && dpi_y == pixel_size.height * 96.0f / size_tests[i].size->height,
6651 "%u: unexpected target dpi %.8ex%.8e.\n", i, dpi_x, dpi_y);
6652 }
6653 else
6654 ok_(__FILE__, line)(dpi_x == rt_dpi_x && dpi_y == rt_dpi_y,
6655 "%u: unexpected target dpi %.8ex%.8e.\n", i, dpi_x, dpi_y);
6656 ID2D1BitmapRenderTarget_Release(bitmap_rt);
6657 }
6658
6659 pixel_size.height = pixel_size.width = 0;
6660 hr = ID2D1RenderTarget_CreateCompatibleRenderTarget(rt, NULL, &pixel_size, NULL,
6662 ok_(__FILE__, line)(SUCCEEDED(hr), "Failed to create render target, hr %#lx.\n", hr);
6663
6664 if (SUCCEEDED(ID2D1BitmapRenderTarget_QueryInterface(bitmap_rt, &IID_ID2D1DeviceContext, (void **)&context)))
6665 {
6667
6668 pixel_size = ID2D1DeviceContext_GetPixelSize(context);
6669 ok_(__FILE__, line)(!pixel_size.width && !pixel_size.height, "Unexpected target size %ux%u.\n",
6670 pixel_size.width, pixel_size.height);
6671
6672 ID2D1DeviceContext_GetTarget(context, (ID2D1Image **)&bitmap);
6673 pixel_size = ID2D1Bitmap_GetPixelSize(bitmap);
6674 ok_(__FILE__, line)(!pixel_size.width && !pixel_size.height, "Unexpected target size %ux%u.\n",
6675 pixel_size.width, pixel_size.height);
6676 ID2D1Bitmap_Release(bitmap);
6677
6678 ID2D1DeviceContext_Release(context);
6679 }
6680
6681 ID2D1BitmapRenderTarget_Release(bitmap_rt);
6682}

◆ test_compute_geometry_area()

static void test_compute_geometry_area ( BOOL  d3d11)
static

Definition at line 15159 of file d2d1.c.

15160{
15161 ID2D1RectangleGeometry *rectangle_geometry;
15162 ID2D1EllipseGeometry *ellipse_geometry;
15163 struct d2d1_test_context ctx;
15165 D2D1_ELLIPSE ellipse;
15167 HRESULT hr;
15168 float area;
15169
15170 if (!init_test_context(&ctx, d3d11))
15171 return;
15172
15173 /* Ellipse */
15174 set_ellipse(&ellipse, 0.0f, 0.0f, 10.0f, 5.0f);
15175 hr = ID2D1Factory_CreateEllipseGeometry(ctx.factory, &ellipse, &ellipse_geometry);
15176 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
15177
15178 hr = ID2D1EllipseGeometry_ComputeArea(ellipse_geometry, NULL, 0.01f, &area);
15179 todo_wine
15180 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
15181 if (hr == S_OK)
15182 ok(compare_float(area, 156.9767f, 0), "Unexpected value %.8e.\n", area);
15183
15184 hr = ID2D1EllipseGeometry_ComputeArea(ellipse_geometry, NULL, 200.0f, &area);
15185 todo_wine
15186 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
15187 if (hr == S_OK)
15188 ok(compare_float(area, 100.0f, 0), "Unexpected value %.8e.\n", area);
15189
15191 scale_matrix(&matrix, 1.0f, 2.0f);
15192 hr = ID2D1EllipseGeometry_ComputeArea(ellipse_geometry, &matrix, 0.01f, &area);
15193 todo_wine
15194 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
15195 if (hr == S_OK)
15196 ok(compare_float(area, 314.12088f, 0), "Unexpected value %.8e.\n", area);
15197
15198 hr = ID2D1EllipseGeometry_ComputeArea(ellipse_geometry, &matrix, 200.0f, &area);
15199 todo_wine
15200 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
15201 if (hr == S_OK)
15202 ok(compare_float(area, 200.0f, 0), "Unexpected value %.8e.\n", area);
15203
15204 ID2D1EllipseGeometry_Release(ellipse_geometry);
15205
15206 /* Rectangle */
15207 set_rect(&rect, -1.0f, -1.0f, 1.0f, 1.0f);
15208 hr = ID2D1Factory_CreateRectangleGeometry(ctx.factory, &rect, &rectangle_geometry);
15209 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
15210
15211 hr = ID2D1RectangleGeometry_ComputeArea(rectangle_geometry, NULL, 0.01f, &area);
15212 todo_wine
15213 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
15214 if (hr == S_OK)
15215 ok(compare_float(area, 4.0f, 0), "Unexpected value %.8e.\n", area);
15216
15217 hr = ID2D1RectangleGeometry_ComputeArea(rectangle_geometry, NULL, 200.0f, &area);
15218 todo_wine
15219 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
15220 if (hr == S_OK)
15221 ok(compare_float(area, 4.0f, 0), "Unexpected value %.8e.\n", area);
15222
15224 scale_matrix(&matrix, 1.0f, 2.0f);
15225 hr = ID2D1RectangleGeometry_ComputeArea(rectangle_geometry, &matrix, 0.01f, &area);
15226 todo_wine
15227 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
15228 if (hr == S_OK)
15229 ok(compare_float(area, 8.0f, 0), "Unexpected value %.8e.\n", area);
15230
15231 rotate_matrix(&matrix, 0.5f);
15232 hr = ID2D1RectangleGeometry_ComputeArea(rectangle_geometry, &matrix, 200.0f, &area);
15233 todo_wine
15234 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
15235 if (hr == S_OK)
15236 ok(compare_float(area, 8.0f, 0), "Unexpected value %.8e.\n", area);
15237
15238 skew_matrix(&matrix, 0.1f, 1.5f);
15239 hr = ID2D1RectangleGeometry_ComputeArea(rectangle_geometry, &matrix, 200.0f, &area);
15240 todo_wine
15241 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
15242 if (hr == S_OK)
15243 ok(compare_float(area, 6.8f, 0), "Unexpected value %.8e.\n", area);
15244
15245 ID2D1RectangleGeometry_Release(rectangle_geometry);
15246
15248}
static void set_ellipse(D2D1_ELLIPSE *ellipse, float x, float y, float rx, float ry)
Definition: d2d1.c:535
static Real area(Real A[2], Real B[2], Real C[2])
Definition: polyDBG.cc:50

Referenced by START_TEST().

◆ test_create_device()

static void test_create_device ( BOOL  d3d11)
static

Definition at line 9115 of file d2d1.c.

9116{
9118 struct d2d1_test_context ctx;
9121 HRESULT hr;
9122
9123 if (!init_test_context(&ctx, d3d11))
9124 return;
9125
9126 if (!ctx.factory1)
9127 {
9128 win_skip("ID2D1Factory1 is not supported.\n");
9130 return;
9131 }
9132
9133 hr = ID2D1Factory1_CreateDevice(ctx.factory1, ctx.device, &device);
9134 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
9135
9136 ID2D1Device_GetFactory(device, &factory2);
9137 ok(factory2 == (ID2D1Factory *)ctx.factory1, "Got unexpected factory.\n");
9138 ID2D1Factory_Release(factory2);
9139 ID2D1Device_Release(device);
9140
9141 if (pD2D1CreateDevice)
9142 {
9143 hr = pD2D1CreateDevice(ctx.device, NULL, &device);
9144 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
9145 ID2D1Device_Release(device);
9146
9147 hr = pD2D1CreateDevice(ctx.device, &properties, &device);
9148 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
9149 ID2D1Device_Release(device);
9150 }
9151 else
9152 win_skip("D2D1CreateDevice() is unavailable.\n");
9153
9155}
static const D2D1_CREATION_PROPERTIES * properties
Definition: d2d1.c:299
ID2D1Factory2 * factory2
Definition: d2d1.c:326

Referenced by START_TEST().

◆ test_create_target()

static void test_create_target ( BOOL  d3d11)
static

Definition at line 5694 of file d2d1.c.

5695{
5696 struct d2d1_test_context ctx;
5698 HRESULT hr;
5699 static const struct
5700 {
5701 float dpi_x, dpi_y;
5702 float rt_dpi_x, rt_dpi_y;
5703 HRESULT hr;
5704 }
5705 create_dpi_tests[] =
5706 {
5707 { 0.0f, 0.0f, 96.0f, 96.0f, S_OK },
5708 { 192.0f, 0.0f, 96.0f, 96.0f, E_INVALIDARG },
5709 { 0.0f, 192.0f, 96.0f, 96.0f, E_INVALIDARG },
5710 { 192.0f, -10.0f, 96.0f, 96.0f, E_INVALIDARG },
5711 { -10.0f, 192.0f, 96.0f, 96.0f, E_INVALIDARG },
5712 { 48.0f, 96.0f, 48.0f, 96.0f, S_OK },
5713 };
5714 unsigned int i;
5715
5716 if (!init_test_context(&ctx, d3d11))
5717 return;
5718
5719 for (i = 0; i < ARRAY_SIZE(create_dpi_tests); ++i)
5720 {
5723 ID2D1RenderTarget *rt2;
5724 float dpi_x, dpi_y;
5725 IUnknown *unk;
5726
5728 desc.pixelFormat.format = DXGI_FORMAT_UNKNOWN;
5729 desc.pixelFormat.alphaMode = D2D1_ALPHA_MODE_PREMULTIPLIED;
5730 desc.dpiX = create_dpi_tests[i].dpi_x;
5731 desc.dpiY = create_dpi_tests[i].dpi_y;
5734
5735 hr = ID2D1Factory_CreateDxgiSurfaceRenderTarget(ctx.factory, ctx.surface, &desc, &rt);
5736 ok(hr == create_dpi_tests[i].hr, "Test %u: Got unexpected hr %#lx, expected %#lx.\n",
5737 i, hr, create_dpi_tests[i].hr);
5738
5739 if (FAILED(hr))
5740 continue;
5741
5742 hr = ID2D1RenderTarget_QueryInterface(rt, &IID_IUnknown, (void **)&unk);
5743 ok(hr == S_OK, "Test %u: Got unexpected hr %#lx.\n", i, hr);
5744 ok(unk == (IUnknown *)rt, "Expected same interface pointer.\n");
5745 IUnknown_Release(unk);
5746
5747 hr = ID2D1RenderTarget_QueryInterface(rt, &IID_ID2D1GdiInteropRenderTarget, (void **)&interop);
5748 ok(hr == S_OK, "Test %u: Got unexpected hr %#lx.\n", i, hr);
5749 hr = ID2D1GdiInteropRenderTarget_QueryInterface(interop, &IID_ID2D1RenderTarget, (void **)&rt2);
5750 ok(hr == S_OK, "Test %u: Got unexpected hr %#lx.\n", i, hr);
5751 ok(rt2 == rt, "Unexpected render target\n");
5752 ID2D1RenderTarget_Release(rt2);
5753 ID2D1GdiInteropRenderTarget_Release(interop);
5754
5755 ID2D1RenderTarget_GetDpi(rt, &dpi_x, &dpi_y);
5756 ok(dpi_x == create_dpi_tests[i].rt_dpi_x, "Wrong dpi_x %.8e, expected %.8e, test %u\n",
5757 dpi_x, create_dpi_tests[i].rt_dpi_x, i);
5758 ok(dpi_y == create_dpi_tests[i].rt_dpi_y, "Wrong dpi_y %.8e, expected %.8e, test %u\n",
5759 dpi_y, create_dpi_tests[i].rt_dpi_y, i);
5760
5761 ID2D1RenderTarget_Release(rt);
5762 }
5763
5765}

Referenced by START_TEST().

◆ test_dc_target()

static void test_dc_target ( BOOL  d3d11)
static

Definition at line 5945 of file d2d1.c.

5946{
5947 static const D2D1_PIXEL_FORMAT invalid_formats[] =
5948 {
5949 { DXGI_FORMAT_UNKNOWN, D2D1_ALPHA_MODE_PREMULTIPLIED },
5950 { DXGI_FORMAT_B8G8R8A8_UNORM, D2D1_ALPHA_MODE_UNKNOWN },
5951 { DXGI_FORMAT_R8G8B8A8_UNORM, D2D1_ALPHA_MODE_PREMULTIPLIED },
5952 };
5953 D2D1_TEXT_ANTIALIAS_MODE text_aa_mode;
5956 D2D1_MATRIX_3X2_F matrix, matrix2;
5957 ID2D1DCRenderTarget *rt, *rt2;
5958 struct d2d1_test_context ctx;
5959 D2D1_ANTIALIAS_MODE aa_mode;
5960 ID2D1SolidColorBrush *brush;
5961 ID2D1RenderTarget *rt3;
5962 FLOAT dpi_x, dpi_y;
5964 HENHMETAFILE hemf;
5965 D2D1_SIZE_U sizeu;
5967 D2D1_TAG t1, t2;
5968 unsigned int i;
5969 HDC hdc, hdc2;
5970 HMETAFILE hmf;
5971 D2D_RECT_F r;
5972 COLORREF clr;
5973 HRESULT hr;
5974 RECT rect;
5975 HWND hwnd;
5976
5977 if (!init_test_context(&ctx, d3d11))
5978 return;
5979
5980 for (i = 0; i < ARRAY_SIZE(invalid_formats); ++i)
5981 {
5983 desc.pixelFormat = invalid_formats[i];
5984 desc.dpiX = 96.0f;
5985 desc.dpiY = 96.0f;
5988
5989 hr = ID2D1Factory_CreateDCRenderTarget(ctx.factory, &desc, &rt);
5990 ok(hr == D2DERR_UNSUPPORTED_PIXEL_FORMAT, "Got unexpected hr %#lx.\n", hr);
5991 }
5992
5994 desc.pixelFormat.format = DXGI_FORMAT_B8G8R8A8_UNORM;
5995 desc.pixelFormat.alphaMode = D2D1_ALPHA_MODE_PREMULTIPLIED;
5996 desc.dpiX = 96.0f;
5997 desc.dpiY = 96.0f;
6000 hr = ID2D1Factory_CreateDCRenderTarget(ctx.factory, &desc, &rt);
6001 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
6002
6003 hr = ID2D1DCRenderTarget_QueryInterface(rt, &IID_ID2D1GdiInteropRenderTarget, (void **)&interop);
6004 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
6005 hr = ID2D1GdiInteropRenderTarget_QueryInterface(interop, &IID_ID2D1RenderTarget, (void **)&rt3);
6006 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
6007 ok(rt3 == (ID2D1RenderTarget *)rt, "Unexpected render target\n");
6008 ID2D1RenderTarget_Release(rt3);
6009 hr = ID2D1GdiInteropRenderTarget_QueryInterface(interop, &IID_ID2D1DCRenderTarget, (void **)&rt2);
6010 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
6011 ok(rt2 == rt, "Unexpected render target\n");
6012 ID2D1DCRenderTarget_Release(rt2);
6013 ID2D1GdiInteropRenderTarget_Release(interop);
6014
6015 size = ID2D1DCRenderTarget_GetSize(rt);
6016 ok(size.width == 0.0f, "got width %.08e.\n", size.width);
6017 ok(size.height == 0.0f, "got height %.08e.\n", size.height);
6018
6019 sizeu = ID2D1DCRenderTarget_GetPixelSize(rt);
6020 ok(sizeu.width == 0, "got width %u.\n", sizeu.width);
6021 ok(sizeu.height == 0, "got height %u.\n", sizeu.height);
6022
6023 /* object creation methods work without BindDC() */
6024 set_color(&color, 0.0f, 0.0f, 0.0f, 0.0f);
6025 hr = ID2D1DCRenderTarget_CreateSolidColorBrush(rt, &color, NULL, &brush);
6026 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
6027 ID2D1SolidColorBrush_Release(brush);
6028
6029 ID2D1DCRenderTarget_BeginDraw(rt);
6030 hr = ID2D1DCRenderTarget_EndDraw(rt, NULL, NULL);
6031 ok(hr == D2DERR_WRONG_STATE, "Got unexpected hr %#lx.\n", hr);
6032
6033 ID2D1DCRenderTarget_Release(rt);
6034
6035 /* BindDC() */
6036 hr = ID2D1Factory_CreateDCRenderTarget(ctx.factory, &desc, &rt);
6037 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
6038
6039 aa_mode = ID2D1DCRenderTarget_GetAntialiasMode(rt);
6040 ok(aa_mode == D2D1_ANTIALIAS_MODE_PER_PRIMITIVE, "Got wrong default aa mode %d.\n", aa_mode);
6041 text_aa_mode = ID2D1DCRenderTarget_GetTextAntialiasMode(rt);
6042 ok(text_aa_mode == D2D1_TEXT_ANTIALIAS_MODE_DEFAULT, "Got wrong default text aa mode %d.\n", text_aa_mode);
6043
6044 ID2D1DCRenderTarget_GetDpi(rt, &dpi_x, &dpi_y);
6045 ok(dpi_x == 96.0f && dpi_y == 96.0f, "Got dpi_x %f, dpi_y %f.\n", dpi_x, dpi_y);
6046
6048 ok(hdc != NULL, "Failed to create an HDC.\n");
6049
6051
6052 SetRect(&rect, 0, 0, 32, 32);
6053 hr = ID2D1DCRenderTarget_BindDC(rt, NULL, &rect);
6054 ok(hr == E_INVALIDARG, "Got unexpected hr %#lx.\n", hr);
6055
6056 /* Target properties are retained during BindDC() */
6057 ID2D1DCRenderTarget_SetTags(rt, 1, 2);
6058 ID2D1DCRenderTarget_SetAntialiasMode(rt, D2D1_ANTIALIAS_MODE_ALIASED);
6059 ID2D1DCRenderTarget_SetTextAntialiasMode(rt, D2D1_TEXT_ANTIALIAS_MODE_CLEARTYPE);
6060
6062 translate_matrix(&matrix, 200.0f, 600.0f);
6063 ID2D1DCRenderTarget_SetTransform(rt, &matrix);
6064
6065 hr = ID2D1DCRenderTarget_BindDC(rt, hdc, &rect);
6066 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
6067
6068 ID2D1DCRenderTarget_GetTags(rt, &t1, &t2);
6069 ok(t1 == 1 && t2 == 2, "Got wrong tags.\n");
6070
6071 aa_mode = ID2D1DCRenderTarget_GetAntialiasMode(rt);
6072 ok(aa_mode == D2D1_ANTIALIAS_MODE_ALIASED, "Got wrong aa mode %d.\n", aa_mode);
6073
6074 text_aa_mode = ID2D1DCRenderTarget_GetTextAntialiasMode(rt);
6075 ok(text_aa_mode == D2D1_TEXT_ANTIALIAS_MODE_CLEARTYPE, "Got wrong text aa mode %d.\n", text_aa_mode);
6076
6077 ID2D1DCRenderTarget_GetTransform(rt, &matrix2);
6078 ok(!memcmp(&matrix, &matrix2, sizeof(matrix)), "Got wrong target transform.\n");
6079
6081 ID2D1DCRenderTarget_SetTransform(rt, &matrix);
6082
6083 /* target size comes from specified dimensions, not from selected bitmap size */
6084 size = ID2D1DCRenderTarget_GetSize(rt);
6085 ok(size.width == 32.0f, "got width %.08e.\n", size.width);
6086 ok(size.height == 32.0f, "got height %.08e.\n", size.height);
6087
6088 /* clear one HDC to red, switch to another one, partially fill it and test contents */
6089 ID2D1DCRenderTarget_BeginDraw(rt);
6090
6091 set_color(&color, 1.0f, 0.0f, 0.0f, 1.0f);
6092 ID2D1DCRenderTarget_Clear(rt, &color);
6093
6094 hr = ID2D1DCRenderTarget_EndDraw(rt, NULL, NULL);
6095 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
6096
6097 clr = GetPixel(hdc, 0, 0);
6098 ok(clr == RGB(255, 0, 0), "Got unexpected colour 0x%08lx.\n", clr);
6099
6101 ok(hdc2 != NULL, "Failed to create an HDC.\n");
6102
6104
6105 hr = ID2D1DCRenderTarget_BindDC(rt, hdc2, &rect);
6106 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
6107
6108 clr = GetPixel(hdc2, 0, 0);
6109 ok(clr == 0, "Got unexpected colour 0x%08lx.\n", clr);
6110
6111 set_color(&color, 0.0f, 1.0f, 0.0f, 1.0f);
6112 hr = ID2D1DCRenderTarget_CreateSolidColorBrush(rt, &color, NULL, &brush);
6113 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
6114
6115 ID2D1DCRenderTarget_BeginDraw(rt);
6116
6117 r.left = r.top = 0.0f;
6118 r.bottom = 16.0f;
6119 r.right = 8.0f;
6120 ID2D1DCRenderTarget_FillRectangle(rt, &r, (ID2D1Brush*)brush);
6121
6122 hr = ID2D1DCRenderTarget_EndDraw(rt, NULL, NULL);
6123 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
6124
6125 ID2D1SolidColorBrush_Release(brush);
6126
6127 clr = GetPixel(hdc2, 0, 0);
6128 ok(clr == RGB(0, 255, 0), "Got unexpected colour 0x%08lx.\n", clr);
6129
6130 clr = GetPixel(hdc2, 10, 0);
6131 ok(clr == 0, "Got unexpected colour 0x%08lx.\n", clr);
6132
6133 /* Invalid DC. */
6134 hr = ID2D1DCRenderTarget_BindDC(rt, (HDC)0xdeadbeef, &rect);
6135 ok(hr == E_INVALIDARG, "Got unexpected hr %#lx.\n", hr);
6136
6137 ID2D1DCRenderTarget_BeginDraw(rt);
6138
6139 set_color(&color, 1.0f, 0.0f, 0.0f, 1.0f);
6140 ID2D1DCRenderTarget_Clear(rt, &color);
6141
6142 hr = ID2D1DCRenderTarget_EndDraw(rt, NULL, NULL);
6143 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
6144
6145 clr = GetPixel(hdc2, 0, 0);
6146 ok(clr == RGB(255, 0, 0), "Got unexpected colour 0x%08lx.\n", clr);
6147
6148 hr = ID2D1DCRenderTarget_BindDC(rt, NULL, &rect);
6149 ok(hr == E_INVALIDARG, "Got unexpected hr %#lx.\n", hr);
6150
6151 ID2D1DCRenderTarget_BeginDraw(rt);
6152
6153 set_color(&color, 0.0f, 0.0f, 1.0f, 1.0f);
6154 ID2D1DCRenderTarget_Clear(rt, &color);
6155
6156 hr = ID2D1DCRenderTarget_EndDraw(rt, NULL, NULL);
6157 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
6158
6159 clr = GetPixel(hdc2, 0, 0);
6160 ok(clr == RGB(0, 0, 255), "Got unexpected colour 0x%08lx.\n", clr);
6161
6162 DeleteDC(hdc);
6163 DeleteDC(hdc2);
6164
6165 /* Metafile context. */
6167 ok(!!hdc, "Failed to create a device context.\n");
6168
6169 hr = ID2D1DCRenderTarget_BindDC(rt, hdc, &rect);
6170 ok(hr == E_INVALIDARG, "Got unexpected hr %#lx.\n", hr);
6171
6172 hmf = CloseMetaFile(hdc);
6173 ok(!!hmf, "Failed to close a metafile, error %ld.\n", GetLastError());
6174 DeleteMetaFile(hmf);
6175
6176 /* Enhanced metafile context. */
6178 ok(!!hdc, "Failed to create a device context.\n");
6179
6180 hr = ID2D1DCRenderTarget_BindDC(rt, hdc, &rect);
6181 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
6182
6183 hemf = CloseEnhMetaFile(hdc);
6184 ok(!!hemf, "Failed to close a metafile, error %ld.\n", GetLastError());
6185 DeleteEnhMetaFile(hemf);
6186
6187 /* Window context. */
6188 hwnd = CreateWindowExA(0, "static", NULL, WS_POPUP|WS_VISIBLE, 0, 0, 100, 100, 0, 0, 0, NULL);
6189 ok(!!hwnd, "Failed to create a test window.\n");
6190
6191 hdc = GetDC(hwnd);
6192 ok(!!hdc, "Failed to get a context.\n");
6193
6194 hr = ID2D1DCRenderTarget_BindDC(rt, hdc, &rect);
6195 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
6196
6197 ReleaseDC(hwnd, hdc);
6199
6200 ID2D1DCRenderTarget_Release(rt);
6202}
HDC hdc2
Definition: SelectObject.c:10
DWORD GetPixel(LPDIRECTDRAWSURFACE7 Surface, UINT x, UINT y)
Definition: blt.cpp:2
static void create_target_dibsection(HDC hdc, UINT32 width, UINT32 height)
Definition: d2d1.c:5921
D2D1_TEXT_ANTIALIAS_MODE
Definition: d2d1.idl:189
@ D2D1_TEXT_ANTIALIAS_MODE_DEFAULT
Definition: d2d1.idl:190
@ D2D1_TEXT_ANTIALIAS_MODE_CLEARTYPE
Definition: d2d1.idl:191
D2D1_ANTIALIAS_MODE
Definition: d2d1.idl:182
@ D2D1_ANTIALIAS_MODE_PER_PRIMITIVE
Definition: d2d1.idl:183
#define RGB(r, g, b)
Definition: precomp.h:67
static HDC
Definition: imagelist.c:88
#define WS_POPUP
Definition: pedump.c:616
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
HWND WINAPI CreateWindowExA(_In_ DWORD dwExStyle, _In_opt_ LPCSTR lpClassName, _In_opt_ LPCSTR lpWindowName, _In_ DWORD dwStyle, _In_ int X, _In_ int Y, _In_ int nWidth, _In_ int nHeight, _In_opt_ HWND hWndParent, _In_opt_ HMENU hMenu, _In_opt_ HINSTANCE hInstance, _In_opt_ LPVOID lpParam)
HDC WINAPI GetDC(_In_opt_ HWND)
BOOL WINAPI SetRect(_Out_ LPRECT, _In_ int, _In_ int, _In_ int, _In_ int)
float FLOAT
Definition: typedefs.h:69
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
DWORD COLORREF
Definition: windef.h:100
BOOL WINAPI DeleteMetaFile(_In_ HMETAFILE)
BOOL WINAPI DeleteEnhMetaFile(_In_opt_ HENHMETAFILE)
HDC WINAPI CreateMetaFileA(_In_opt_ LPCSTR)
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
HMETAFILE WINAPI CloseMetaFile(_In_ HDC hdc)
HDC WINAPI CreateEnhMetaFileA(_In_opt_ HDC, _In_opt_ LPCSTR, _In_opt_ LPCRECT, _In_opt_ LPCSTR)
HENHMETAFILE WINAPI CloseEnhMetaFile(_In_ HDC hdc)
BOOL WINAPI DeleteDC(_In_ HDC)

Referenced by START_TEST().

◆ test_dc_target_gdi_interop()

static void test_dc_target_gdi_interop ( BOOL  d3d11)
static

Definition at line 6204 of file d2d1.c.

6205{
6208 struct d2d1_test_context ctx;
6210 HDC hdc, target_hdc;
6211 HRESULT hr;
6212 RECT rect;
6213
6214 if (!init_test_context(&ctx, d3d11))
6215 return;
6216
6217 target_hdc = CreateCompatibleDC(NULL);
6218 ok(!!target_hdc, "Failed to create an HDC.\n");
6219 create_target_dibsection(target_hdc, 16, 16);
6220
6222 desc.pixelFormat.format = DXGI_FORMAT_B8G8R8A8_UNORM;
6223 desc.pixelFormat.alphaMode = D2D1_ALPHA_MODE_PREMULTIPLIED;
6224 desc.dpiX = 96.0f;
6225 desc.dpiY = 96.0f;
6228 hr = ID2D1Factory_CreateDCRenderTarget(ctx.factory, &desc, &rt);
6229 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
6230
6231 /* Default usage. */
6232 hr = ID2D1DCRenderTarget_QueryInterface(rt, &IID_ID2D1GdiInteropRenderTarget, (void **)&interop);
6233 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
6234
6235 ID2D1DCRenderTarget_BeginDraw(rt);
6236 hdc = (void *)0xdeadbeef;
6237 hr = ID2D1GdiInteropRenderTarget_GetDC(interop, D2D1_DC_INITIALIZE_MODE_COPY, &hdc);
6238 todo_wine
6239 ok(hr == D2DERR_WRONG_STATE, "Got unexpected hr %#lx.\n", hr);
6240 ok(!hdc, "Got unexpected DC %p.\n", hdc);
6241 hr = ID2D1DCRenderTarget_EndDraw(rt, NULL, NULL);
6242 ok(hr == D2DERR_WRONG_STATE, "Got unexpected hr %#lx.\n", hr);
6243
6244 /* Default usage with set target context. */
6245
6246 SetRect(&rect, 0, 0, 16, 16);
6247 hr = ID2D1DCRenderTarget_BindDC(rt, target_hdc, &rect);
6248 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
6249
6250 ID2D1DCRenderTarget_BeginDraw(rt);
6251 hdc = NULL;
6252 hr = ID2D1GdiInteropRenderTarget_GetDC(interop, D2D1_DC_INITIALIZE_MODE_COPY, &hdc);
6253 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
6254 ok(!!hdc, "Got unexpected DC %p.\n", hdc);
6255 hr = ID2D1GdiInteropRenderTarget_ReleaseDC(interop, NULL);
6256 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
6257 hr = ID2D1DCRenderTarget_EndDraw(rt, NULL, NULL);
6258 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
6259
6260 ID2D1GdiInteropRenderTarget_Release(interop);
6261
6262 DeleteDC(target_hdc);
6263
6264 ID2D1DCRenderTarget_Release(rt);
6266}
@ D2D1_DC_INITIALIZE_MODE_COPY
Definition: d2d1.idl:284

Referenced by START_TEST().

◆ test_dc_target_is_supported()

static void test_dc_target_is_supported ( BOOL  d3d11)
static

Definition at line 14344 of file d2d1.c.

14345{
14346 static const unsigned int target_types[] =
14347 {
14351 };
14352 static const unsigned int usages[] =
14353 {
14358 };
14359 static const D2D1_PIXEL_FORMAT pixel_formats[] =
14360 {
14361 { DXGI_FORMAT_UNKNOWN, D2D1_ALPHA_MODE_UNKNOWN },
14362 { DXGI_FORMAT_UNKNOWN, D2D1_ALPHA_MODE_PREMULTIPLIED },
14363 { DXGI_FORMAT_UNKNOWN, D2D1_ALPHA_MODE_IGNORE },
14364 { DXGI_FORMAT_UNKNOWN, D2D1_ALPHA_MODE_STRAIGHT },
14365
14366 { DXGI_FORMAT_R8G8B8A8_UNORM, D2D1_ALPHA_MODE_UNKNOWN },
14367 { DXGI_FORMAT_B8G8R8A8_UNORM, D2D1_ALPHA_MODE_UNKNOWN },
14368
14369 { DXGI_FORMAT_B8G8R8A8_UNORM, D2D1_ALPHA_MODE_PREMULTIPLIED },
14370 { DXGI_FORMAT_B8G8R8A8_UNORM, D2D1_ALPHA_MODE_IGNORE },
14371 };
14372 static const D2D1_PIXEL_FORMAT unsupported_pixel_formats[] =
14373 {
14374 { DXGI_FORMAT_R8G8B8A8_UNORM, D2D1_ALPHA_MODE_PREMULTIPLIED },
14375 { DXGI_FORMAT_R8G8B8A8_UNORM, D2D1_ALPHA_MODE_IGNORE },
14376 { DXGI_FORMAT_R8G8B8A8_UNORM, D2D1_ALPHA_MODE_STRAIGHT },
14377
14378 { DXGI_FORMAT_B8G8R8A8_UNORM, D2D1_ALPHA_MODE_STRAIGHT },
14379
14380 { DXGI_FORMAT_R16G16B16A16_UNORM, D2D1_ALPHA_MODE_UNKNOWN },
14381 };
14382 D2D1_RENDER_TARGET_PROPERTIES desc, template_desc, test_desc;
14383 D2D1_BITMAP_PROPERTIES1 bitmap_desc;
14384 ID2D1DeviceContext *device_context;
14386 struct d2d1_test_context ctx;
14387 BOOL expected, supported;
14390 unsigned int i, j;
14392 HRESULT hr;
14393
14394 if (!init_test_context(&ctx, d3d11))
14395 return;
14396
14397 template_desc.type = D2D1_RENDER_TARGET_TYPE_DEFAULT;
14399 template_desc.pixelFormat.alphaMode = D2D1_ALPHA_MODE_PREMULTIPLIED;
14400 template_desc.dpiX = 96.0f;
14401 template_desc.dpiY = 96.0f;
14402 template_desc.usage = D2D1_RENDER_TARGET_USAGE_NONE;
14403 template_desc.minLevel = D2D1_FEATURE_LEVEL_DEFAULT;
14404
14405 /* Make sure the render target description template is valid. */
14406 hr = ID2D1Factory_CreateDCRenderTarget(ctx.factory, &template_desc, &rt);
14407 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
14408 supported = ID2D1DCRenderTarget_IsSupported(rt, &template_desc);
14409 ok(supported, "Expected supported.\n");
14410 ID2D1DCRenderTarget_Release(rt);
14411
14412 /* Test that SetTarget() with a bitmap of a different usage doesn't change the render target usage. */
14413 hr = ID2D1Factory_CreateDCRenderTarget(ctx.factory, &template_desc, &rt);
14414 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
14415 hr = ID2D1DCRenderTarget_QueryInterface(rt, &IID_ID2D1DeviceContext, (void **)&device_context);
14416 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
14417
14418 test_desc = template_desc;
14420 supported = ID2D1DCRenderTarget_IsSupported(rt, &test_desc);
14421 ok(supported, "Expected unsupported.\n");
14422
14423 memset(&bitmap_desc, 0, sizeof(bitmap_desc));
14424 bitmap_desc.pixelFormat = ID2D1DeviceContext_GetPixelFormat(device_context);
14426 size.width = 4;
14427 size.height = 4;
14428 hr = ID2D1DeviceContext_CreateBitmap(device_context, size, NULL, 0, &bitmap_desc, &bitmap);
14429 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
14430 ID2D1DeviceContext_SetTarget(device_context, (ID2D1Image *)bitmap);
14431 supported = ID2D1DCRenderTarget_IsSupported(rt, &test_desc);
14432 ok(supported, "Expected unsupported.\n");
14433 ID2D1Bitmap1_Release(bitmap);
14434
14435 /* Test that SetTarget() with a bitmap of a different format changes the render target format. */
14436 test_desc = template_desc;
14438 test_desc.pixelFormat.alphaMode = D2D1_ALPHA_MODE_PREMULTIPLIED;
14439 supported = ID2D1DCRenderTarget_IsSupported(rt, &test_desc);
14440 ok(!supported, "Expected unsupported.\n");
14441
14442 memset(&bitmap_desc, 0, sizeof(bitmap_desc));
14444 bitmap_desc.pixelFormat.alphaMode = D2D1_ALPHA_MODE_PREMULTIPLIED;
14446 size.width = 4;
14447 size.height = 4;
14448 hr = ID2D1DeviceContext_CreateBitmap(device_context, size, NULL, 0, &bitmap_desc, &bitmap);
14449 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
14450 ID2D1DeviceContext_SetTarget(device_context, (ID2D1Image *)bitmap);
14451 pixel_format = ID2D1DeviceContext_GetPixelFormat(device_context);
14452 ok(pixel_format.format == DXGI_FORMAT_R8G8B8A8_UNORM, "Got unexpected format %#x.\n", pixel_format.format);
14453 ok(pixel_format.alphaMode == D2D1_ALPHA_MODE_PREMULTIPLIED, "Got unexpected alpha %u.\n", pixel_format.alphaMode);
14454 supported = ID2D1DCRenderTarget_IsSupported(rt, &test_desc);
14455 ok(supported, "Expected supported.\n");
14456 ID2D1Bitmap1_Release(bitmap);
14457
14458 ID2D1DeviceContext_Release(device_context);
14459 ID2D1DCRenderTarget_Release(rt);
14460
14461 /* Target type. */
14462 for (i = 0; i < ARRAY_SIZE(target_types); ++i)
14463 {
14464 /* Default target type resolves to either HW or SW, there is no way to tell. */
14465 desc = template_desc;
14466 desc.type = target_types[i];
14467 hr = ID2D1Factory_CreateDCRenderTarget(ctx.factory, &desc, &rt);
14469 {
14470 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
14471
14472 test_desc = template_desc;
14474 supported = ID2D1DCRenderTarget_IsSupported(rt, &test_desc);
14475 ok(supported, "Unexpected return value %d.\n", supported);
14476 }
14477 else
14478 {
14479 if (FAILED(hr))
14480 continue;
14481
14482 for (j = 0; j < ARRAY_SIZE(target_types); ++j)
14483 {
14484 winetest_push_context("type test %u/%u", i, j);
14485
14486 test_desc = template_desc;
14487 test_desc.type = target_types[j];
14488 supported = ID2D1DCRenderTarget_IsSupported(rt, &test_desc);
14489 expected = target_types[j] == D2D1_RENDER_TARGET_TYPE_DEFAULT
14490 || target_types[i] == target_types[j];
14491 ok(supported == expected, "Unexpected return value %d.\n", supported);
14492
14494 }
14495 }
14496
14497 ID2D1DCRenderTarget_Release(rt);
14498 }
14499
14500 /* Pixel formats. */
14501 for (i = 0; i < ARRAY_SIZE(pixel_formats); ++i)
14502 {
14503 desc = template_desc;
14504 desc.pixelFormat = pixel_formats[i];
14505 hr = ID2D1Factory_CreateDCRenderTarget(ctx.factory, &desc, &rt);
14507 || pixel_formats[i].alphaMode == D2D1_ALPHA_MODE_UNKNOWN)
14508 {
14509 ok(hr == D2DERR_UNSUPPORTED_PIXEL_FORMAT, "%u: unexpected hr %#lx.\n", i, hr);
14510 continue;
14511 }
14512 ok(hr == S_OK, "%u: unexpected hr %#lx.\n", i, hr);
14513
14514 for (j = 0; j < ARRAY_SIZE(pixel_formats); ++j)
14515 {
14516 BOOL format_supported, alpha_mode_supported;
14517
14518 winetest_push_context("format test %u/%u.", i, j);
14519
14520 test_desc = template_desc;
14521 test_desc.pixelFormat = pixel_formats[j];
14522 supported = ID2D1DCRenderTarget_IsSupported(rt, &test_desc);
14523
14525 || pixel_formats[j].format == desc.pixelFormat.format;
14526 alpha_mode_supported = pixel_formats[j].alphaMode == D2D1_ALPHA_MODE_UNKNOWN
14527 || pixel_formats[j].alphaMode == desc.pixelFormat.alphaMode;
14528 expected = format_supported && alpha_mode_supported;
14529 ok(supported == expected, "Unexpected return value.\n");
14530
14532 }
14533
14534 for (j = 0; j < ARRAY_SIZE(unsupported_pixel_formats); ++j)
14535 {
14536 winetest_push_context("unsupported format test %u/%u.", i, j);
14537
14538 test_desc = template_desc;
14539 test_desc.pixelFormat = unsupported_pixel_formats[j];
14540 supported = ID2D1DCRenderTarget_IsSupported(rt, &test_desc);
14541 ok(!supported, "Unexpected return value.\n");
14542
14544 }
14545
14546 ID2D1DCRenderTarget_Release(rt);
14547 }
14548
14549 /* Target usage. */
14550 for (i = 0; i < ARRAY_SIZE(usages); ++i)
14551 {
14552 desc = template_desc;
14553 desc.usage = usages[i];
14554 hr = ID2D1Factory_CreateDCRenderTarget(ctx.factory, &desc, &rt);
14555 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
14556
14557 for (j = 0; j < ARRAY_SIZE(usages); ++j)
14558 {
14559 winetest_push_context("usage %#x testing usage %#x", usages[i], usages[j]);
14560
14561 desc = template_desc;
14562 desc.usage = usages[j];
14563 supported = ID2D1DCRenderTarget_IsSupported(rt, &desc);
14565 ok(supported == expected, "Unexpected result %d.\n", supported);
14566
14568 }
14569
14570 ID2D1DCRenderTarget_Release(rt);
14571 }
14572
14574}
@ D2D1_RENDER_TARGET_TYPE_SOFTWARE
Definition: d2d1.idl:254
@ D2D1_RENDER_TARGET_TYPE_HARDWARE
Definition: d2d1.idl:255
@ D2D1_RENDER_TARGET_USAGE_GDI_COMPATIBLE
Definition: d2d1.idl:263
@ D2D1_RENDER_TARGET_USAGE_FORCE_BITMAP_REMOTING
Definition: d2d1.idl:262
static BOOL format_supported(const D2D1_PIXEL_FORMAT *format)
Definition: bitmap.c:331
static const struct @510 pixel_formats[]
static PCCRYPT_OID_INFO ** usages
Definition: softpub.c:81

Referenced by START_TEST().

◆ test_desktop_dpi()

static void test_desktop_dpi ( BOOL  d3d11)
static

Definition at line 6865 of file d2d1.c.

6866{
6868 float dpi_x, dpi_y;
6869 HRESULT hr;
6870
6871 hr = D2D1CreateFactory(D2D1_FACTORY_TYPE_SINGLE_THREADED, &IID_ID2D1Factory, NULL, (void **)&factory);
6872 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
6873
6874 dpi_x = dpi_y = 0.0f;
6875 ID2D1Factory_GetDesktopDpi(factory, &dpi_x, &dpi_y);
6876 ok(dpi_x > 0.0f && dpi_y > 0.0f, "Got wrong dpi %f x %f.\n", dpi_x, dpi_y);
6877
6878 ID2D1Factory_Release(factory);
6879}

Referenced by START_TEST().

◆ test_device_context()

static void test_device_context ( BOOL  d3d11)
static

Definition at line 9546 of file d2d1.c.

9547{
9550 ID2D1DeviceContext *device_context;
9551 IDXGISurface *surface, *surface2;
9552 ID2D1Device *device, *device2;
9553 struct d2d1_test_context ctx;
9555 ID2D1DCRenderTarget *dc_rt;
9556 D2D1_UNIT_MODE unit_mode;
9560 HRESULT hr;
9561 RECT rect;
9562 HDC hdc;
9563
9564 IWICBitmap *wic_bitmap;
9565 IWICImagingFactory *wic_factory;
9566
9567 if (!init_test_context(&ctx, d3d11))
9568 return;
9569
9570 if (!ctx.factory1)
9571 {
9572 win_skip("ID2D1Factory1 is not supported.\n");
9574 return;
9575 }
9576
9577 hr = ID2D1Factory1_CreateDevice(ctx.factory1, ctx.device, &device);
9578 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
9579
9580 hr = ID2D1Device_CreateDeviceContext(device, D2D1_DEVICE_CONTEXT_OPTIONS_NONE, &device_context);
9581 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
9582
9583 ID2D1DeviceContext_GetDevice(device_context, &device2);
9584 ok(device2 == device, "Unexpected device instance.\n");
9585 ID2D1Device_Release(device2);
9586
9587 target = (void *)0xdeadbeef;
9588 ID2D1DeviceContext_GetTarget(device_context, &target);
9589 ok(target == NULL, "Unexpected target instance %p.\n", target);
9590
9591 unit_mode = ID2D1DeviceContext_GetUnitMode(device_context);
9592 ok(unit_mode == D2D1_UNIT_MODE_DIPS, "Unexpected unit mode %d.\n", unit_mode);
9593
9594 ID2D1DeviceContext_Release(device_context);
9595
9596 if (ctx.factory2)
9597 {
9598 ID2D1Device1 *device1;
9599 ID2D1DeviceContext1 *device_context1;
9600
9601 hr = ID2D1Factory2_CreateDevice(ctx.factory2, ctx.device, &device1);
9602 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
9603
9604 hr = ID2D1Device1_CreateDeviceContext(device1, D2D1_DEVICE_CONTEXT_OPTIONS_NONE, &device_context1);
9605 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
9606
9607 ID2D1DeviceContext1_Release(device_context1);
9608 ID2D1Device1_Release(device1);
9609 }
9610
9611 /* DXGI target */
9612 rt = ctx.rt;
9613 hr = ID2D1RenderTarget_QueryInterface(rt, &IID_ID2D1DeviceContext, (void **)&device_context);
9614 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
9615 ID2D1DeviceContext_GetTarget(device_context, (ID2D1Image **)&bitmap);
9616 options = ID2D1Bitmap1_GetOptions(bitmap);
9618 "Unexpected bitmap options %#x.\n", options);
9619 hr = ID2D1Bitmap1_GetSurface(bitmap, &surface2);
9620 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
9621 ok(surface2 == ctx.surface, "Unexpected surface instance.\n");
9622 IDXGISurface_Release(surface2);
9623
9624 ID2D1DeviceContext_BeginDraw(device_context);
9625 hr = ID2D1Bitmap1_GetSurface(bitmap, &surface2);
9626 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
9627 ok(surface2 == ctx.surface, "Unexpected surface instance.\n");
9628 IDXGISurface_Release(surface2);
9629 ID2D1DeviceContext_EndDraw(device_context, NULL, NULL);
9630 ID2D1Bitmap1_Release(bitmap);
9631
9632 ID2D1DeviceContext_SetTarget(device_context, NULL);
9633 ID2D1DeviceContext_GetTarget(device_context, (ID2D1Image **)&bitmap);
9634 ok(bitmap == NULL, "Unexpected target instance.\n");
9635
9636 ID2D1DeviceContext_Release(device_context);
9637
9638 /* WIC target */
9640
9641 hr = CoCreateInstance(&CLSID_WICImagingFactory, NULL, CLSCTX_INPROC_SERVER,
9642 &IID_IWICImagingFactory, (void **)&wic_factory);
9643 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
9644 hr = IWICImagingFactory_CreateBitmap(wic_factory, 16, 16,
9645 &GUID_WICPixelFormat32bppPBGRA, WICBitmapCacheOnDemand, &wic_bitmap);
9646 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
9647 IWICImagingFactory_Release(wic_factory);
9648
9651 rt_desc.pixelFormat.alphaMode = D2D1_ALPHA_MODE_PREMULTIPLIED;
9652 rt_desc.dpiX = 96.0f;
9653 rt_desc.dpiY = 96.0f;
9656 hr = ID2D1Factory1_CreateWicBitmapRenderTarget(ctx.factory1, wic_bitmap, &rt_desc, &rt);
9657 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
9658
9659 hr = ID2D1RenderTarget_QueryInterface(rt, &IID_ID2D1DeviceContext, (void **)&device_context);
9660 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
9661 ID2D1DeviceContext_GetTarget(device_context, (ID2D1Image **)&bitmap);
9662 options = ID2D1Bitmap1_GetOptions(bitmap);
9664 "Unexpected bitmap options %#x.\n", options);
9665 hr = ID2D1Bitmap1_GetSurface(bitmap, &surface);
9666 todo_wine ok(hr == E_FAIL, "Got unexpected hr %#lx.\n", hr);
9667 ID2D1Bitmap1_Release(bitmap);
9668
9669 ID2D1DeviceContext_SetTarget(device_context, NULL);
9670 ID2D1DeviceContext_GetTarget(device_context, (ID2D1Image **)&bitmap);
9671 ok(bitmap == NULL, "Unexpected target instance.\n");
9672
9673 ID2D1DeviceContext_Release(device_context);
9674 ID2D1RenderTarget_Release(rt);
9675
9677
9678 /* HWND target */
9679 hwnd_rt_desc.hwnd = NULL;
9680 hwnd_rt_desc.pixelSize.width = 64;
9681 hwnd_rt_desc.pixelSize.height = 64;
9683 hwnd_rt_desc.hwnd = CreateWindowA("static", "d2d_test", 0, 0, 0, 0, 0, 0, 0, 0, 0);
9684 ok(!!hwnd_rt_desc.hwnd, "Failed to create target window.\n");
9685
9686 hr = ID2D1Factory1_CreateHwndRenderTarget(ctx.factory1, &rt_desc, &hwnd_rt_desc, (ID2D1HwndRenderTarget **)&rt);
9687 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
9688
9689 hr = ID2D1RenderTarget_QueryInterface(rt, &IID_ID2D1DeviceContext, (void **)&device_context);
9690 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
9691 ID2D1DeviceContext_GetTarget(device_context, (ID2D1Image **)&bitmap);
9692 options = ID2D1Bitmap1_GetOptions(bitmap);
9694 "Unexpected bitmap options %#x.\n", options);
9695 hr = ID2D1Bitmap1_GetSurface(bitmap, &surface);
9696 ok(hr == D2DERR_INVALID_CALL, "Got unexpected hr %#lx.\n", hr);
9697 ID2D1Bitmap1_Release(bitmap);
9698
9699 ID2D1DeviceContext_SetTarget(device_context, NULL);
9700 ID2D1DeviceContext_GetTarget(device_context, (ID2D1Image **)&bitmap);
9701 ok(bitmap == NULL, "Unexpected target instance.\n");
9702
9703 ID2D1DeviceContext_Release(device_context);
9704 ID2D1RenderTarget_Release(rt);
9705 DestroyWindow(hwnd_rt_desc.hwnd);
9706
9707 /* DC target */
9708 hr = ID2D1Factory1_CreateDCRenderTarget(ctx.factory1, &rt_desc, &dc_rt);
9709 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
9710
9711 hr = ID2D1DCRenderTarget_QueryInterface(dc_rt, &IID_ID2D1DeviceContext, (void **)&device_context);
9712 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
9713 ID2D1DeviceContext_GetTarget(device_context, (ID2D1Image **)&bitmap);
9714 ok(bitmap == NULL, "Unexpected bitmap instance.\n");
9715
9717 ok(hdc != NULL, "Failed to create an HDC.\n");
9718
9720
9721 SetRect(&rect, 0, 0, 16, 16);
9722 hr = ID2D1DCRenderTarget_BindDC(dc_rt, hdc, &rect);
9723 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
9724
9725 ID2D1DeviceContext_GetTarget(device_context, (ID2D1Image **)&bitmap);
9726 options = ID2D1Bitmap1_GetOptions(bitmap);
9728 "Unexpected bitmap options %#x.\n", options);
9729 hr = ID2D1Bitmap1_GetSurface(bitmap, &surface);
9730 ok(hr == D2DERR_INVALID_CALL, "Got unexpected hr %#lx.\n", hr);
9731 ID2D1Bitmap1_Release(bitmap);
9732
9733 ID2D1DeviceContext_SetTarget(device_context, NULL);
9734 ID2D1DeviceContext_GetTarget(device_context, (ID2D1Image **)&bitmap);
9735 ok(bitmap == NULL, "Unexpected target instance.\n");
9736
9737 ID2D1DeviceContext_Release(device_context);
9738 ID2D1DCRenderTarget_Release(dc_rt);
9739 DeleteDC(hdc);
9740
9741 ID2D1Device_Release(device);
9743}
D2D1_UNIT_MODE
Definition: d2d1_1.idl:64
@ D2D1_UNIT_MODE_DIPS
Definition: d2d1_1.idl:65
#define E_FAIL
Definition: ddrawi.h:102

Referenced by START_TEST().

◆ test_dpi()

static void test_dpi ( BOOL  d3d11)
static

Definition at line 10251 of file d2d1.c.

10252{
10253 D2D1_BITMAP_PROPERTIES1 bitmap_desc;
10254 ID2D1DeviceContext *device_context;
10255 IWICImagingFactory *wic_factory;
10256 struct d2d1_test_context ctx;
10258 float dpi_x, dpi_y;
10259 HRESULT hr;
10260
10261 static const struct
10262 {
10263 float dpi_x, dpi_y;
10264 HRESULT hr;
10265 }
10266 create_dpi_tests[] =
10267 {
10268 { 0.0f, 0.0f, S_OK},
10269 {192.0f, 0.0f, E_INVALIDARG},
10270 { 0.0f, 192.0f, E_INVALIDARG},
10271 {192.0f, -10.0f, E_INVALIDARG},
10272 {-10.0f, 192.0f, E_INVALIDARG},
10273 {-10.0f, -10.0f, E_INVALIDARG},
10274 { 48.0f, 96.0f, S_OK},
10275 { 96.0f, 48.0f, S_OK},
10276 };
10277 static const float init_dpi_x = 60.0f, init_dpi_y = 288.0f;
10278 static const float dc_dpi_x = 120.0f, dc_dpi_y = 144.0f;
10279 unsigned int i;
10280
10281 if (!init_test_context(&ctx, d3d11))
10282 return;
10283
10284 if (!ctx.factory1)
10285 {
10286 win_skip("ID2D1Factory1 is not supported.\n");
10288 return;
10289 }
10290
10291 device_context = create_device_context(ctx.factory1, ctx.device, d3d11);
10292 ok(!!device_context, "Failed to create device context.\n");
10293
10294 ID2D1DeviceContext_GetDpi(device_context, &dpi_x, &dpi_y);
10295 ok(dpi_x == 96.0f, "Got unexpected dpi_x %.8e.\n", dpi_x);
10296 ok(dpi_y == 96.0f, "Got unexpected dpi_y %.8e.\n", dpi_y);
10297
10298 /* DXGI surface */
10299 for (i = 0; i < ARRAY_SIZE(create_dpi_tests); ++i)
10300 {
10301 ID2D1DeviceContext_SetDpi(device_context, init_dpi_x, init_dpi_y);
10302
10304 bitmap_desc.pixelFormat.alphaMode = D2D1_ALPHA_MODE_PREMULTIPLIED;
10305 bitmap_desc.dpiX = create_dpi_tests[i].dpi_x;
10306 bitmap_desc.dpiY = create_dpi_tests[i].dpi_y;
10308 bitmap_desc.colorContext = NULL;
10309 hr = ID2D1DeviceContext_CreateBitmapFromDxgiSurface(device_context, ctx.surface, &bitmap_desc, &bitmap);
10310 /* Native accepts negative DPI values for DXGI surface bitmap. */
10311 ok(hr == S_OK, "Test %u: Got unexpected hr %#lx.\n", i, hr);
10312
10313 ID2D1DeviceContext_SetDpi(device_context, dc_dpi_x, dc_dpi_y);
10314
10315 ID2D1Bitmap1_GetDpi(bitmap, &dpi_x, &dpi_y);
10316 todo_wine_if(bitmap_desc.dpiX == 0.0f)
10317 ok(dpi_x == bitmap_desc.dpiX, "Test %u: Got unexpected dpi_x %.8e, expected %.8e.\n",
10318 i, dpi_x, bitmap_desc.dpiX);
10319 todo_wine_if(bitmap_desc.dpiY == 0.0f)
10320 ok(dpi_y == bitmap_desc.dpiY, "Test %u: Got unexpected dpi_y %.8e, expected %.8e.\n",
10321 i, dpi_y, bitmap_desc.dpiY);
10322
10323 ID2D1DeviceContext_BeginDraw(device_context);
10324 ID2D1DeviceContext_SetTarget(device_context, (ID2D1Image *)bitmap);
10325 hr = ID2D1DeviceContext_EndDraw(device_context, NULL, NULL);
10326 ok(hr == S_OK, "Test %u: Got unexpected hr %#lx.\n", i, hr);
10327
10328 /* Device context DPI values aren't updated by SetTarget. */
10329 ID2D1DeviceContext_GetDpi(device_context, &dpi_x, &dpi_y);
10330 ok(dpi_x == dc_dpi_x, "Test %u: Got unexpected dpi_x %.8e, expected %.8e.\n", i, dpi_x, dc_dpi_x);
10331 ok(dpi_y == dc_dpi_y, "Test %u: Got unexpected dpi_y %.8e, expected %.8e.\n", i, dpi_y, dc_dpi_y);
10332
10333 ID2D1Bitmap1_Release(bitmap);
10334 }
10335
10336 /* WIC bitmap */
10337 CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
10338 hr = CoCreateInstance(&CLSID_WICImagingFactory, NULL, CLSCTX_INPROC_SERVER,
10339 &IID_IWICImagingFactory, (void **)&wic_factory);
10340 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
10341 for (i = 0; i < ARRAY_SIZE(create_dpi_tests); ++i)
10342 {
10343 IWICBitmapSource *wic_bitmap_src;
10344 IWICBitmap *wic_bitmap;
10345
10346 ID2D1DeviceContext_SetDpi(device_context, init_dpi_x, init_dpi_y);
10347
10348 hr = IWICImagingFactory_CreateBitmap(wic_factory, 16, 16,
10349 &GUID_WICPixelFormat32bppPBGRA, WICBitmapCacheOnDemand, &wic_bitmap);
10350 ok(hr == S_OK, "Test %u: Got unexpected hr %#lx.\n", i, hr);
10351 hr = IWICBitmap_QueryInterface(wic_bitmap, &IID_IWICBitmapSource, (void **)&wic_bitmap_src);
10352 ok(hr == S_OK, "Test %u: Got unexpected hr %#lx.\n", i, hr);
10353 IWICBitmap_Release(wic_bitmap);
10354
10355 bitmap_desc.pixelFormat.format = DXGI_FORMAT_UNKNOWN;
10356 bitmap_desc.pixelFormat.alphaMode = D2D1_ALPHA_MODE_PREMULTIPLIED;
10357 bitmap_desc.dpiX = create_dpi_tests[i].dpi_x;
10358 bitmap_desc.dpiY = create_dpi_tests[i].dpi_y;
10359 bitmap_desc.bitmapOptions = D2D1_BITMAP_OPTIONS_TARGET | D2D1_BITMAP_OPTIONS_CANNOT_DRAW;
10360 bitmap_desc.colorContext = NULL;
10361 hr = ID2D1DeviceContext_CreateBitmapFromWicBitmap(device_context, wic_bitmap_src, &bitmap_desc, &bitmap);
10362 ok(hr == create_dpi_tests[i].hr, "Test %u: Got unexpected hr %#lx, expected %#lx.\n",
10363 i, hr, create_dpi_tests[i].hr);
10364 IWICBitmapSource_Release(wic_bitmap_src);
10365
10366 if (FAILED(hr))
10367 continue;
10368
10369 ID2D1DeviceContext_SetDpi(device_context, dc_dpi_x, dc_dpi_y);
10370
10371 ID2D1Bitmap1_GetDpi(bitmap, &dpi_x, &dpi_y);
10372 if (bitmap_desc.dpiX == 0.0f && bitmap_desc.dpiY == 0.0f)
10373 {
10374 /* Bitmap DPI values are inherited at creation time. */
10375 ok(dpi_x == init_dpi_x, "Test %u: Got unexpected dpi_x %.8e, expected %.8e.\n", i, dpi_x, init_dpi_x);
10376 ok(dpi_y == init_dpi_y, "Test %u: Got unexpected dpi_y %.8e, expected %.8e.\n", i, dpi_y, init_dpi_y);
10377 }
10378 else
10379 {
10380 ok(dpi_x == bitmap_desc.dpiX, "Test %u: Got unexpected dpi_x %.8e, expected %.8e.\n",
10381 i, dpi_x, bitmap_desc.dpiX);
10382 ok(dpi_y == bitmap_desc.dpiY, "Test %u: Got unexpected dpi_y %.8e, expected %.8e.\n",
10383 i, dpi_y, bitmap_desc.dpiY);
10384 }
10385
10386 ID2D1DeviceContext_BeginDraw(device_context);
10387 ID2D1DeviceContext_SetTarget(device_context, (ID2D1Image *)bitmap);
10388 hr = ID2D1DeviceContext_EndDraw(device_context, NULL, NULL);
10389 ok(hr == S_OK, "Test %u: Got unexpected hr %#lx.\n", i, hr);
10390
10391 /* Device context DPI values aren't updated by SetTarget. */
10392 ID2D1DeviceContext_GetDpi(device_context, &dpi_x, &dpi_y);
10393 ok(dpi_x == dc_dpi_x, "Test %u: Got unexpected dpi_x %.8e, expected %.8e.\n", i, dpi_x, dc_dpi_x);
10394 ok(dpi_y == dc_dpi_y, "Test %u: Got unexpected dpi_y %.8e, expected %.8e.\n", i, dpi_y, dc_dpi_y);
10395
10396 ID2D1Bitmap1_Release(bitmap);
10397 }
10398 IWICImagingFactory_Release(wic_factory);
10399 CoUninitialize();
10400
10401 /* D2D bitmap */
10402 for (i = 0; i < ARRAY_SIZE(create_dpi_tests); ++i)
10403 {
10404 const D2D1_SIZE_U size = {16, 16};
10405
10406 ID2D1DeviceContext_SetDpi(device_context, init_dpi_x, init_dpi_y);
10407
10408 bitmap_desc.pixelFormat.format = DXGI_FORMAT_B8G8R8A8_UNORM;
10409 bitmap_desc.pixelFormat.alphaMode = D2D1_ALPHA_MODE_PREMULTIPLIED;
10410 bitmap_desc.dpiX = create_dpi_tests[i].dpi_x;
10411 bitmap_desc.dpiY = create_dpi_tests[i].dpi_y;
10412 bitmap_desc.bitmapOptions = D2D1_BITMAP_OPTIONS_TARGET | D2D1_BITMAP_OPTIONS_CANNOT_DRAW;
10413 bitmap_desc.colorContext = NULL;
10414 hr = ID2D1DeviceContext_CreateBitmap(device_context, size, NULL, 0, &bitmap_desc, &bitmap);
10415 ok(hr == create_dpi_tests[i].hr, "Test %u: Got unexpected hr %#lx, expected %#lx.\n",
10416 i, hr, create_dpi_tests[i].hr);
10417
10418 if (FAILED(hr))
10419 continue;
10420
10421 ID2D1DeviceContext_SetDpi(device_context, dc_dpi_x, dc_dpi_y);
10422
10423 ID2D1Bitmap1_GetDpi(bitmap, &dpi_x, &dpi_y);
10424 if (bitmap_desc.dpiX == 0.0f && bitmap_desc.dpiY == 0.0f)
10425 {
10426 /* Bitmap DPI values are inherited at creation time. */
10427 ok(dpi_x == init_dpi_x, "Test %u: Got unexpected dpi_x %.8e, expected %.8e.\n", i, dpi_x, init_dpi_x);
10428 ok(dpi_y == init_dpi_y, "Test %u: Got unexpected dpi_y %.8e, expected %.8e.\n", i, dpi_y, init_dpi_y);
10429 }
10430 else
10431 {
10432 ok(dpi_x == bitmap_desc.dpiX, "Test %u: Got unexpected dpi_x %.8e, expected %.8e.\n",
10433 i, dpi_x, bitmap_desc.dpiX);
10434 ok(dpi_y == bitmap_desc.dpiY, "Test %u: Got unexpected dpi_y %.8e, expected %.8e.\n",
10435 i, dpi_y, bitmap_desc.dpiY);
10436 }
10437
10438 ID2D1DeviceContext_BeginDraw(device_context);
10439 ID2D1DeviceContext_SetTarget(device_context, (ID2D1Image *)bitmap);
10440 hr = ID2D1DeviceContext_EndDraw(device_context, NULL, NULL);
10441 ok(hr == S_OK, "Test %u: Got unexpected hr %#lx.\n", i, hr);
10442
10443 /* Device context DPI values aren't updated by SetTarget. */
10444 ID2D1DeviceContext_GetDpi(device_context, &dpi_x, &dpi_y);
10445 ok(dpi_x == dc_dpi_x, "Test %u: Got unexpected dpi_x %.8e, expected %.8e.\n", i, dpi_x, dc_dpi_x);
10446 ok(dpi_y == dc_dpi_y, "Test %u: Got unexpected dpi_y %.8e, expected %.8e.\n", i, dpi_y, dc_dpi_y);
10447
10448 ID2D1Bitmap1_Release(bitmap);
10449 }
10450
10451 ID2D1DeviceContext_SetTarget(device_context, NULL);
10452 ID2D1DeviceContext_GetDpi(device_context, &dpi_x, &dpi_y);
10453 ok(dpi_x == dc_dpi_x, "Got unexpected dpi_x %.8e, expected %.8e.\n", dpi_x, dc_dpi_x);
10454 ok(dpi_y == dc_dpi_y, "Got unexpected dpi_y %.8e, expected %.8e.\n", dpi_y, dc_dpi_y);
10455
10456 ID2D1DeviceContext_Release(device_context);
10457 release_test_context(&ctx);
10458}
void CDECL unexpected(void)
Definition: cpp.c:711
GLdouble n
Definition: glext.h:7729
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble * u
Definition: glfuncs.h:240
#define e
Definition: ke_i.h:82

Referenced by START_TEST().

◆ test_draw_geometry()

static void test_draw_geometry ( BOOL  d3d11)
static

Definition at line 7068 of file d2d1.c.

7069{
7070 ID2D1TransformedGeometry *transformed_geometry[4];
7071 ID2D1RectangleGeometry *rect_geometry[2];
7072 D2D1_POINT_2F point = {0.0f, 0.0f};
7073 D2D1_ROUNDED_RECT rounded_rect;
7074 struct d2d1_test_context ctx;
7075 ID2D1SolidColorBrush *brush;
7076 ID2D1PathGeometry *geometry;
7081 D2D1_POINT_2F p0, p1;
7082 D2D1_ELLIPSE ellipse;
7085 HRESULT hr;
7086 BOOL match;
7087
7088 if (!init_test_context(&ctx, d3d11))
7089 return;
7090
7091 rt = ctx.rt;
7092 factory = ctx.factory;
7093
7094 ID2D1RenderTarget_SetDpi(rt, 192.0f, 48.0f);
7095 ID2D1RenderTarget_SetAntialiasMode(rt, D2D1_ANTIALIAS_MODE_ALIASED);
7096 set_color(&color, 0.890f, 0.851f, 0.600f, 1.0f);
7097 hr = ID2D1RenderTarget_CreateSolidColorBrush(rt, &color, NULL, &brush);
7098 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
7099
7100 ID2D1RenderTarget_BeginDraw(rt);
7101 set_color(&color, 0.396f, 0.180f, 0.537f, 1.0f);
7102 ID2D1RenderTarget_Clear(rt, &color);
7103
7104 set_point(&p0, 40.0f, 160.0f);
7105 ID2D1RenderTarget_DrawLine(rt, p0, p0, (ID2D1Brush *)brush, 10.0f, NULL);
7106 set_point(&p0, 100.0f, 160.0f);
7107 set_point(&p1, 140.0f, 160.0f);
7108 ID2D1RenderTarget_DrawLine(rt, p0, p1, (ID2D1Brush *)brush, 10.0f, NULL);
7109 set_point(&p0, 200.0f, 80.0f);
7110 set_point(&p1, 200.0f, 240.0f);
7111 ID2D1RenderTarget_DrawLine(rt, p0, p1, (ID2D1Brush *)brush, 10.0f, NULL);
7112 set_point(&p0, 260.0f, 240.0f);
7113 set_point(&p1, 300.0f, 80.0f);
7114 ID2D1RenderTarget_DrawLine(rt, p0, p1, (ID2D1Brush *)brush, 10.0f, NULL);
7115
7116 set_rect(&rect, 40.0f, 480.0f, 40.0f, 480.0f);
7117 ID2D1RenderTarget_DrawRectangle(rt, &rect, (ID2D1Brush *)brush, 10.0f, NULL);
7118 set_rect(&rect, 100.0f, 480.0f, 140.0f, 480.0f);
7119 ID2D1RenderTarget_DrawRectangle(rt, &rect, (ID2D1Brush *)brush, 10.0f, NULL);
7120 set_rect(&rect, 200.0f, 400.0f, 200.0f, 560.0f);
7121 ID2D1RenderTarget_DrawRectangle(rt, &rect, (ID2D1Brush *)brush, 10.0f, NULL);
7122 set_rect(&rect, 260.0f, 560.0f, 300.0f, 400.0f);
7123 ID2D1RenderTarget_DrawRectangle(rt, &rect, (ID2D1Brush *)brush, 10.0f, NULL);
7124
7125 set_ellipse(&ellipse, 40.0f, 800.0f, 0.0f, 0.0f);
7126 ID2D1RenderTarget_DrawEllipse(rt, &ellipse, (ID2D1Brush *)brush, 10.0f, NULL);
7127 set_ellipse(&ellipse, 120.0f, 800.0f, 20.0f, 0.0f);
7128 ID2D1RenderTarget_DrawEllipse(rt, &ellipse, (ID2D1Brush *)brush, 10.0f, NULL);
7129 set_ellipse(&ellipse, 200.0f, 800.0f, 0.0f, 80.0f);
7130 ID2D1RenderTarget_DrawEllipse(rt, &ellipse, (ID2D1Brush *)brush, 10.0f, NULL);
7131 set_ellipse(&ellipse, 280.0f, 800.0f, 20.0f, 80.0f);
7132 ID2D1RenderTarget_DrawEllipse(rt, &ellipse, (ID2D1Brush *)brush, 10.0f, NULL);
7133
7134 hr = ID2D1RenderTarget_EndDraw(rt, NULL, NULL);
7135 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
7136
7137 match = compare_figure(&ctx, 0, 0, 160, 160, 0xff652e89, 0, "");
7138 ok(match, "Figure does not match.\n");
7139 match = compare_figure(&ctx, 160, 0, 160, 160, 0xff652e89, 0, "yGBQUFBQUFBQUFDoYQAA");
7140 ok(match, "Figure does not match.\n");
7141 match = compare_figure(&ctx, 320, 0, 160, 160, 0xff652e89, 0,
7142 "xjIUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEU"
7143 "jAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEU"
7144 "jAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEU"
7145 "jAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEU"
7146 "jAEUjAEUjAEUjAEUxjIA");
7147 ok(match, "Figure does not match.\n");
7148 match = compare_figure(&ctx, 480, 0, 160, 160, 0xff652e89, 2,
7149 "zjECnQETjAEVigEVigEVigEVigEVigEVigEVigEVigEVigEVigEVigEVigEVigEVigEVigEVigEV"
7150 "igEVigEVigEVigEVigEVigEVigEVigEVigEVigEVigEVigEVigEVigEVigEVigEVigEVigEVigEV"
7151 "igEVigEVigEVigEVigEVigEVigEVigEVigEVigEVigEVigEVigEVigEVigEVigEVigEVigEVigEV"
7152 "igEVigEVigEVigEVigEVigEVigEVigEVigEVigEVigEVigEVigEVigEVigEVigEVigEVigEVigEV"
7153 "igEVigEVigEVigEVjAETnQECzjEA");
7154 ok(match, "Figure does not match.\n");
7155
7156 match = compare_figure(&ctx, 0, 160, 160, 160, 0xff652e89, 0, "5mAUjAEUjAEUjAEUjAEUhmIA");
7157 ok(match, "Figure does not match.\n");
7158 match = compare_figure(&ctx, 160, 160, 160, 160, 0xff652e89, 0, "vmBkPGQ8ZDxkPGTeYQAA");
7159 ok(match, "Figure does not match.\n");
7160 match = compare_figure(&ctx, 320, 160, 160, 160, 0xff652e89, 0,
7161 "5i4UjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEU"
7162 "jAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEU"
7163 "jAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEU"
7164 "jAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEU"
7165 "jAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUhjAA");
7166 ok(match, "Figure does not match.\n");
7167 match = compare_figure(&ctx, 480, 160, 160, 160, 0xff652e89, 0,
7168 "vi5kPGQ8ZDxkPGQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwU"
7169 "PBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8"
7170 "FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwU"
7171 "PBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8"
7172 "FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwU"
7173 "PBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8ZDxkPGQ8ZDxk3i8A");
7174 ok(match, "Figure does not match.\n");
7175
7176 match = compare_figure(&ctx, 0, 320, 160, 160, 0xff652e89, 0, "iGIQjgEUjAEUjgEQiGIA");
7177 todo_wine ok(match, "Figure does not match.\n");
7178 match = compare_figure(&ctx, 160, 320, 160, 160, 0xff652e89, 0, "yGBQSGA+ZDxkPmDgYQAA");
7179 todo_wine ok(match, "Figure does not match.\n");
7180 match = compare_figure(&ctx, 320, 320, 160, 160, 0xff652e89, 0,
7181 "iDAQjgEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEU"
7182 "jAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEU"
7183 "jAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEU"
7184 "jAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEU"
7185 "jAEUjAEUjAEUjAEUjAEUjAEUjAEUjgEQiDAA");
7186 todo_wine ok(match, "Figure does not match.\n");
7187 match = compare_figure(&ctx, 480, 320, 160, 160, 0xff652e89, 10,
7188 "hDAYgwEieyh1LnAybBcIF2gWDhZkFhIWYRUWFV4VGhVbFRwVWRUeFVcVIBVVFCQUUxQmFFEUKBRP"
7189 "FSgVTRUqFUwULBRLFC4USRQwFEgUMBRHFDIURhQyFEUUNBREFDQUQxQ2FEIUNhRBFDgUQBQ4FEAU"
7190 "OBQ/FDoUPhQ6FD4UOhQ+FDoUPhQ6FD0UPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8"
7191 "FDwUPBQ8FDwUPBQ8FD0UOhQ+FDoUPhQ6FD4UOhQ+FDoUPxQ4FEAUOBRAFDgUQRQ2FEIUNhRDFDQU"
7192 "RBQ0FEUUMhRGFDIURxQwFEgUMBRJFC4USxQsFEwVKhVNFSgVTxQoFFEUJhRTFCQUVRUgFVcVHhVZ"
7193 "FRwVWxUaFV4VFhVhFhIWZBYOFmgXCBdsMnAudSh7IoMBGIQw");
7194 todo_wine ok(match, "Figure does not match.\n");
7195
7196 ID2D1RenderTarget_BeginDraw(rt);
7197 set_color(&color, 0.396f, 0.180f, 0.537f, 1.0f);
7198 ID2D1RenderTarget_Clear(rt, &color);
7199
7200 set_rounded_rect(&rounded_rect, 40.0f, 160.0f, 40.0f, 160.0f, 10.0f, 10.0f);
7201 ID2D1RenderTarget_DrawRoundedRectangle(rt, &rounded_rect, (ID2D1Brush *)brush, 10.0f, NULL);
7202 set_rounded_rect(&rounded_rect, 100.0f, 160.0f, 140.0f, 160.0f, 10.0f, 10.0f);
7203 ID2D1RenderTarget_DrawRoundedRectangle(rt, &rounded_rect, (ID2D1Brush *)brush, 10.0f, NULL);
7204 set_rounded_rect(&rounded_rect, 200.0f, 80.0f, 200.0f, 240.0f, 10.0f, 10.0f);
7205 ID2D1RenderTarget_DrawRoundedRectangle(rt, &rounded_rect, (ID2D1Brush *)brush, 10.0f, NULL);
7206 set_rounded_rect(&rounded_rect, 260.0f, 240.0f, 300.0f, 80.0f, 10.0f, 10.0f);
7207 ID2D1RenderTarget_DrawRoundedRectangle(rt, &rounded_rect, (ID2D1Brush *)brush, 10.0f, NULL);
7208
7209 set_rounded_rect(&rounded_rect, 40.0f, 480.0f, 40.0f, 480.0f, 10.0f, 20.0f);
7210 ID2D1RenderTarget_DrawRoundedRectangle(rt, &rounded_rect, (ID2D1Brush *)brush, 10.0f, NULL);
7211 set_rounded_rect(&rounded_rect, 100.0f, 480.0f, 140.0f, 480.0f, 10.0f, 20.0f);
7212 ID2D1RenderTarget_DrawRoundedRectangle(rt, &rounded_rect, (ID2D1Brush *)brush, 10.0f, NULL);
7213 set_rounded_rect(&rounded_rect, 200.0f, 400.0f, 200.0f, 560.0f, 10.0f, 20.0f);
7214 ID2D1RenderTarget_DrawRoundedRectangle(rt, &rounded_rect, (ID2D1Brush *)brush, 10.0f, NULL);
7215 set_rounded_rect(&rounded_rect, 260.0f, 560.0f, 300.0f, 400.0f, 10.0f, 20.0f);
7216 ID2D1RenderTarget_DrawRoundedRectangle(rt, &rounded_rect, (ID2D1Brush *)brush, 10.0f, NULL);
7217
7218 set_rounded_rect(&rounded_rect, 40.0f, 800.0f, 40.0f, 800.0f, 10.0f, 5.0f);
7219 ID2D1RenderTarget_DrawRoundedRectangle(rt, &rounded_rect, (ID2D1Brush *)brush, 10.0f, NULL);
7220 set_rounded_rect(&rounded_rect, 100.0f, 800.0f, 140.0f, 800.0f, 10.0f, 5.0f);
7221 ID2D1RenderTarget_DrawRoundedRectangle(rt, &rounded_rect, (ID2D1Brush *)brush, 10.0f, NULL);
7222 set_rounded_rect(&rounded_rect, 200.0f, 720.0f, 200.0f, 880.0f, 10.0f, 5.0f);
7223 ID2D1RenderTarget_DrawRoundedRectangle(rt, &rounded_rect, (ID2D1Brush *)brush, 10.0f, NULL);
7224 set_rounded_rect(&rounded_rect, 260.0f, 880.0f, 300.0f, 720.0f, 10.0f, 5.0f);
7225 ID2D1RenderTarget_DrawRoundedRectangle(rt, &rounded_rect, (ID2D1Brush *)brush, 10.0f, NULL);
7226
7227 hr = ID2D1RenderTarget_EndDraw(rt, NULL, NULL);
7228 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
7229
7230 match = compare_figure(&ctx, 0, 0, 160, 160, 0xff652e89, 0, "iGIQjgEUjAEUjgEQiGIA");
7231 todo_wine ok(match, "Figure does not match.\n");
7232 match = compare_figure(&ctx, 160, 0, 160, 160, 0xff652e89, 0, "yGBQSGA+ZDxkPmDgYQAA");
7233 todo_wine ok(match, "Figure does not match.\n");
7234 match = compare_figure(&ctx, 320, 0, 160, 160, 0xff652e89, 0,
7235 "iDAQjgEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEU"
7236 "jAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEU"
7237 "jAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEU"
7238 "jAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEU"
7239 "jAEUjAEUjAEUjAEUjAEUjAEUjAEUjgEQiDAA");
7240 todo_wine ok(match, "Figure does not match.\n");
7241 match = compare_figure(&ctx, 480, 0, 160, 160, 0xff652e89, 0,
7242 "3C4oaUZVUExYRlxCHCgcPxU4FT0UPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwU"
7243 "PBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8"
7244 "FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwU"
7245 "PBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8"
7246 "FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwU"
7247 "PBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FD0VOBU/YEJcRlhMUFVG7S8A");
7248 todo_wine ok(match, "Figure does not match.\n");
7249
7250 match = compare_figure(&ctx, 0, 160, 160, 160, 0xff652e89, 0, "iGIQjgEUjAEUjgEQiGIA");
7251 todo_wine ok(match, "Figure does not match.\n");
7252 match = compare_figure(&ctx, 160, 160, 160, 160, 0xff652e89, 0, "yGBQSGA+ZDxkPmDgYQAA");
7253 todo_wine ok(match, "Figure does not match.\n");
7254 match = compare_figure(&ctx, 320, 160, 160, 160, 0xff652e89, 0,
7255 "iDAQjgEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEU"
7256 "jAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEU"
7257 "jAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEU"
7258 "jAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEU"
7259 "jAEUjAEUjAEUjAEUjAEUjAEUjAEUjgEQiDAA");
7260 todo_wine ok(match, "Figure does not match.\n");
7261 match = compare_figure(&ctx, 480, 160, 160, 160, 0xff652e89, 8,
7262 "3C4obT5dSFRQTlRKGCgYRhYwFkMVNBVBFTYVPxU5FD4UOhQ9FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwU"
7263 "PBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8"
7264 "FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwU"
7265 "PBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8"
7266 "FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwU"
7267 "PBQ8FDwUPRQ6FD4UOhQ/FTYVQRU0FUMWMBZGWEpVTVBTSltA8C8A");
7268 todo_wine ok(match, "Figure does not match.\n");
7269
7270 match = compare_figure(&ctx, 0, 320, 160, 160, 0xff652e89, 0, "iGIQjgEUjAEUjgEQiGIA");
7271 todo_wine ok(match, "Figure does not match.\n");
7272 match = compare_figure(&ctx, 160, 320, 160, 160, 0xff652e89, 0, "yGBQSGA+ZDxkPmDgYQAA");
7273 todo_wine ok(match, "Figure does not match.\n");
7274 match = compare_figure(&ctx, 320, 320, 160, 160, 0xff652e89, 0,
7275 "iDAQjgEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEU"
7276 "jAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEU"
7277 "jAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEU"
7278 "jAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEU"
7279 "jAEUjAEUjAEUjAEUjAEUjAEUjAEUjgEQiDAA");
7280 todo_wine ok(match, "Figure does not match.\n");
7281 match = compare_figure(&ctx, 480, 320, 160, 160, 0xff652e89, 0,
7282 "3C4oZU5NWERgP2I9HigePBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwU"
7283 "PBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8"
7284 "FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwU"
7285 "PBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8"
7286 "FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwU"
7287 "PBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8ZD1iP2BEWE1O6S8A");
7288 todo_wine ok(match, "Figure does not match.\n");
7289
7290 ID2D1RenderTarget_BeginDraw(rt);
7291 set_color(&color, 0.396f, 0.180f, 0.537f, 1.0f);
7292 ID2D1RenderTarget_Clear(rt, &color);
7293
7294 set_rounded_rect(&rounded_rect, 40.0f, 160.0f, 40.0f, 160.0f, 1000.0f, 1000.0f);
7295 ID2D1RenderTarget_DrawRoundedRectangle(rt, &rounded_rect, (ID2D1Brush *)brush, 10.0f, NULL);
7296 set_rounded_rect(&rounded_rect, 100.0f, 160.0f, 140.0f, 160.0f, 1000.0f, 1000.0f);
7297 ID2D1RenderTarget_DrawRoundedRectangle(rt, &rounded_rect, (ID2D1Brush *)brush, 10.0f, NULL);
7298 set_rounded_rect(&rounded_rect, 200.0f, 80.0f, 200.0f, 240.0f, 1000.0f, 1000.0f);
7299 ID2D1RenderTarget_DrawRoundedRectangle(rt, &rounded_rect, (ID2D1Brush *)brush, 10.0f, NULL);
7300 set_rounded_rect(&rounded_rect, 260.0f, 240.0f, 300.0f, 80.0f, 1000.0f, 1000.0f);
7301 ID2D1RenderTarget_DrawRoundedRectangle(rt, &rounded_rect, (ID2D1Brush *)brush, 10.0f, NULL);
7302
7303 set_rounded_rect(&rounded_rect, 40.0f, 480.0f, 40.0f, 480.0f, 10.0f, 1000.0f);
7304 ID2D1RenderTarget_DrawRoundedRectangle(rt, &rounded_rect, (ID2D1Brush *)brush, 10.0f, NULL);
7305 set_rounded_rect(&rounded_rect, 100.0f, 480.0f, 140.0f, 480.0f, 10.0f, 1000.0f);
7306 ID2D1RenderTarget_DrawRoundedRectangle(rt, &rounded_rect, (ID2D1Brush *)brush, 10.0f, NULL);
7307 set_rounded_rect(&rounded_rect, 200.0f, 400.0f, 200.0f, 560.0f, 10.0f, 1000.0f);
7308 ID2D1RenderTarget_DrawRoundedRectangle(rt, &rounded_rect, (ID2D1Brush *)brush, 10.0f, NULL);
7309 set_rounded_rect(&rounded_rect, 260.0f, 560.0f, 300.0f, 400.0f, 10.0f, 1000.0f);
7310 ID2D1RenderTarget_DrawRoundedRectangle(rt, &rounded_rect, (ID2D1Brush *)brush, 10.0f, NULL);
7311
7312 set_rounded_rect(&rounded_rect, 40.0f, 800.0f, 40.0f, 800.0f, 1000.0f, 10.0f);
7313 ID2D1RenderTarget_DrawRoundedRectangle(rt, &rounded_rect, (ID2D1Brush *)brush, 10.0f, NULL);
7314 set_rounded_rect(&rounded_rect, 100.0f, 800.0f, 140.0f, 800.0f, 1000.0f, 10.0f);
7315 ID2D1RenderTarget_DrawRoundedRectangle(rt, &rounded_rect, (ID2D1Brush *)brush, 10.0f, NULL);
7316 set_rounded_rect(&rounded_rect, 200.0f, 720.0f, 200.0f, 880.0f, 1000.0f, 10.0f);
7317 ID2D1RenderTarget_DrawRoundedRectangle(rt, &rounded_rect, (ID2D1Brush *)brush, 10.0f, NULL);
7318 set_rounded_rect(&rounded_rect, 260.0f, 880.0f, 300.0f, 720.0f, 1000.0f, 10.0f);
7319 ID2D1RenderTarget_DrawRoundedRectangle(rt, &rounded_rect, (ID2D1Brush *)brush, 10.0f, NULL);
7320
7321 hr = ID2D1RenderTarget_EndDraw(rt, NULL, NULL);
7322 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
7323
7324 match = compare_figure(&ctx, 0, 0, 160, 160, 0xff652e89, 0, "iGIQjgEUjAEUjgEQiGIA");
7325 todo_wine ok(match, "Figure does not match.\n");
7326 match = compare_figure(&ctx, 160, 0, 160, 160, 0xff652e89, 0, "yGBQSGA+ZDxkPmDgYQAA");
7327 todo_wine ok(match, "Figure does not match.\n");
7328 match = compare_figure(&ctx, 320, 0, 160, 160, 0xff652e89, 0,
7329 "iDAQjgEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEU"
7330 "jAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEU"
7331 "jAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEU"
7332 "jAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEU"
7333 "jAEUjAEUjAEUjAEUjAEUjAEUjAEUjgEQiDAA");
7334 todo_wine ok(match, "Figure does not match.\n");
7335 match = compare_figure(&ctx, 480, 0, 160, 160, 0xff652e89, 16,
7336 "hDAYgwEieyh1LnAybBcIF2gWDhZkFhIWYRUWFV4WGRVbFRwVWRUeFVcVIBVVFSMUUxQmFFEVJxRP"
7337 "FSgVTRUqFUwULBRLFC4USRUvFEgUMBRHFDIURhQyFEUUNBREFDQUQxQ2FEIUNhRBFDgUQBQ4FEAU"
7338 "OBQ/FTkUPhQ6FD4UOhQ+FDoUPhQ6FD0UPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8"
7339 "FDwUPBQ8FDwUPBQ8FD0UOhQ+FDoUPhQ6FD4UOhQ+FDoUPxQ4FEAUOBRAFDgUQRQ2FEIUNhRDFDQU"
7340 "RBQ0FEUUMhRGFDIURxQwFEgUMBRJFC4USxQsFEwVKhVNFSgVTxQoFFEUJhRTFCQUVRUgFVcVHhVZ"
7341 "FRwVWxUaFV4VFhVhFhIWZBYOFmgWChZsMnAudCp6IoMBGIQw");
7342 todo_wine ok(match, "Figure does not match.\n");
7343
7344 match = compare_figure(&ctx, 0, 160, 160, 160, 0xff652e89, 0, "iGIQjgEUjAEUjgEQiGIA");
7345 todo_wine ok(match, "Figure does not match.\n");
7346 match = compare_figure(&ctx, 160, 160, 160, 160, 0xff652e89, 0, "yGBQSGA+ZDxkPmDgYQAA");
7347 todo_wine ok(match, "Figure does not match.\n");
7348 match = compare_figure(&ctx, 320, 160, 160, 160, 0xff652e89, 0,
7349 "iDAQjgEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEU"
7350 "jAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEU"
7351 "jAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEU"
7352 "jAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEU"
7353 "jAEUjAEUjAEUjAEUjAEUjAEUjAEUjgEQiDAA");
7354 todo_wine ok(match, "Figure does not match.\n");
7355 match = compare_figure(&ctx, 480, 160, 160, 160, 0xff652e89, 16,
7356 "3C4obzpjQF5EWkhXFSAVVRQkFFMUJhRRFCgUTxQqFE0VKhVMFCwUSxQuFEoULhVIFDAUSBQwFUYU"
7357 "MhRGFDIURRQ0FEQUNBRDFTQVQhQ2FEIUNhRCFDYUQRQ4FEAUOBRAFDgUQBQ4FD8UOhQ+FDoUPhQ6"
7358 "FD4UOhQ+FDoUPhQ6FD0VOxQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwU"
7359 "PBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBU7FD0UOhQ+FDoUPhQ6FD4UOhQ+FDoUPhQ6FD8UOBRA"
7360 "FDgUQBQ4FEAUOBRBFDYUQhQ2FEIUNhRCFTQVQxQ0FEQUNBRFFDIURhQyFEYVMBVHFDAUSBUuFUkU"
7361 "LhRLFCwUTBUrFE0UKhRPFCgUURQmFFMUJBRVSldIWUZdQWI78i8A");
7362 todo_wine ok(match, "Figure does not match.\n");
7363
7364 match = compare_figure(&ctx, 0, 320, 160, 160, 0xff652e89, 0, "iGIQjgEUjAEUjgEQiGIA");
7365 todo_wine ok(match, "Figure does not match.\n");
7366 match = compare_figure(&ctx, 160, 320, 160, 160, 0xff652e89, 0, "yGBQSGA+ZDxkPmDgYQAA");
7367 todo_wine ok(match, "Figure does not match.\n");
7368 match = compare_figure(&ctx, 320, 320, 160, 160, 0xff652e89, 0,
7369 "iDAQjgEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEU"
7370 "jAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEU"
7371 "jAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEU"
7372 "jAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEUjAEU"
7373 "jAEUjAEUjAEUjAEUjAEUjAEUjAEUjgEQiDAA");
7374 todo_wine ok(match, "Figure does not match.\n");
7375 match = compare_figure(&ctx, 480, 320, 160, 160, 0xff652e89, 8,
7376 "9i80ZERWUExYRV5AHCocPRY4FjwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwU"
7377 "PBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8"
7378 "FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwU"
7379 "PBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8"
7380 "FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwU"
7381 "PBQ8FDwUPBQ8FDwUPBQ8FToVPRssG0BeRFpLUFVGYzT2LwAA");
7382 todo_wine ok(match, "Figure does not match.\n");
7383
7384 hr = ID2D1Factory_CreatePathGeometry(factory, &geometry);
7385 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
7386 hr = ID2D1PathGeometry_Open(geometry, &sink);
7387 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
7388
7389 set_point(&point, 40.0f, 160.0f);
7390 ID2D1GeometrySink_BeginFigure(sink, point, D2D1_FIGURE_BEGIN_FILLED);
7391 ID2D1GeometrySink_EndFigure(sink, D2D1_FIGURE_END_OPEN);
7392
7393 set_point(&point, 120.0f, 160.0f);
7394 ID2D1GeometrySink_BeginFigure(sink, point, D2D1_FIGURE_BEGIN_FILLED);
7395 line_to(sink, 120.0f, 160.0f);
7396 ID2D1GeometrySink_EndFigure(sink, D2D1_FIGURE_END_OPEN);
7397
7398 set_point(&point, 200.0f, 160.0f);
7399 ID2D1GeometrySink_BeginFigure(sink, point, D2D1_FIGURE_BEGIN_FILLED);
7400 ID2D1GeometrySink_EndFigure(sink, D2D1_FIGURE_END_CLOSED);
7401
7402 set_point(&point, 280.0f, 160.0f);
7403 ID2D1GeometrySink_BeginFigure(sink, point, D2D1_FIGURE_BEGIN_FILLED);
7404 line_to(sink, 280.0f, 160.0f);
7405 ID2D1GeometrySink_EndFigure(sink, D2D1_FIGURE_END_CLOSED);
7406
7407 set_point(&point, 20.0f, 480.0f);
7408 ID2D1GeometrySink_BeginFigure(sink, point, D2D1_FIGURE_BEGIN_FILLED);
7409 line_to(sink, 60.0f, 480.0f);
7410 ID2D1GeometrySink_EndFigure(sink, D2D1_FIGURE_END_OPEN);
7411
7412 set_point(&point, 120.0f, 400.0f);
7413 ID2D1GeometrySink_BeginFigure(sink, point, D2D1_FIGURE_BEGIN_FILLED);
7414 line_to(sink, 120.0f, 560.0f);
7415 line_to(sink, 120.0f, 400.0f);
7416 line_to(sink, 120.0f, 560.0f);
7417 ID2D1GeometrySink_EndFigure(sink, D2D1_FIGURE_END_OPEN);
7418
7419 set_point(&point, 180.0f, 480.0f);
7420 ID2D1GeometrySink_BeginFigure(sink, point, D2D1_FIGURE_BEGIN_FILLED);
7421 line_to(sink, 220.0f, 480.0f);
7422 ID2D1GeometrySink_EndFigure(sink, D2D1_FIGURE_END_CLOSED);
7423
7424 set_point(&point, 280.0f, 400.0f);
7425 ID2D1GeometrySink_BeginFigure(sink, point, D2D1_FIGURE_BEGIN_FILLED);
7426 line_to(sink, 280.0f, 560.0f);
7427 line_to(sink, 280.0f, 400.0f);
7428 line_to(sink, 280.0f, 560.0f);
7429 ID2D1GeometrySink_EndFigure(sink, D2D1_FIGURE_END_CLOSED);
7430
7431 set_point(&point, 20.0f, 880.0f);
7432 ID2D1GeometrySink_BeginFigure(sink, point, D2D1_FIGURE_BEGIN_FILLED);
7433 line_to(sink, 40.0f, 720.0f);
7434 line_to(sink, 60.0f, 880.0f);
7435 ID2D1GeometrySink_EndFigure(sink, D2D1_FIGURE_END_OPEN);
7436
7437 set_point(&point, 100.0f, 720.0f);
7438 ID2D1GeometrySink_BeginFigure(sink, point, D2D1_FIGURE_BEGIN_FILLED);
7439 line_to(sink, 120.0f, 880.0f);
7440 line_to(sink, 140.0f, 720.0f);
7441 ID2D1GeometrySink_EndFigure(sink, D2D1_FIGURE_END_OPEN);
7442
7443 set_point(&point, 180.0f, 880.0f);
7444 ID2D1GeometrySink_BeginFigure(sink, point, D2D1_FIGURE_BEGIN_FILLED);
7445 line_to(sink, 200.0f, 720.0f);
7446 line_to(sink, 220.0f, 880.0f);
7447 ID2D1GeometrySink_EndFigure(sink, D2D1_FIGURE_END_CLOSED);
7448
7449 set_point(&point, 260.0f, 720.0f);
7450 ID2D1GeometrySink_BeginFigure(sink, point, D2D1_FIGURE_BEGIN_FILLED);
7451 line_to(sink, 280.0f, 880.0f);
7452 line_to(sink, 300.0f, 720.0f);
7453 ID2D1GeometrySink_EndFigure(sink, D2D1_FIGURE_END_CLOSED);
7454
7455 ID2D1GeometrySink_SetFillMode(sink, D2D1_FILL_MODE_ALTERNATE);
7456 hr = ID2D1GeometrySink_Close(sink);
7457 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
7458 ID2D1GeometrySink_Release(sink);
7459
7460 ID2D1RenderTarget_BeginDraw(rt);
7461 ID2D1RenderTarget_Clear(rt, &color);
7462 ID2D1RenderTarget_DrawGeometry(rt, (ID2D1Geometry *)geometry, (ID2D1Brush *)brush, 5.0f, NULL);
7463 hr = ID2D1RenderTarget_EndDraw(rt, NULL, NULL);
7464 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
7465 ID2D1PathGeometry_Release(geometry);
7466
7467 match = compare_figure(&ctx, 0, 0, 160, 160, 0xff652e89, 0, "");
7468 ok(match, "Figure does not match.\n");
7469 match = compare_figure(&ctx, 160, 0, 160, 160, 0xff652e89, 0, "");
7470 ok(match, "Figure does not match.\n");
7471 match = compare_figure(&ctx, 320, 0, 160, 160, 0xff652e89, 0, "");
7472 ok(match, "Figure does not match.\n");
7473 match = compare_figure(&ctx, 480, 0, 160, 160, 0xff652e89, 0, "q2MKlgEKq2MA");
7474 todo_wine ok(match, "Figure does not match.\n");
7475
7476 match = compare_figure(&ctx, 0, 160, 160, 160, 0xff652e89, 0, "iGNQUFCIYwAA");
7477 ok(match, "Figure does not match.\n");
7478 match = compare_figure(&ctx, 160, 160, 160, 160, 0xff652e89, 0,
7479 "qyIKlgEKlgEKlgEKlgEKlgEKlgEKlgEKlgEKlgEKlgEKlgEKlgEKlgEKlgEKlgEKlgEKlgEKlgEK"
7480 "lgEKlgEKlgEKlgEKlgEKlgEKlgEKlgEKlgEKlgEKlgEKlgEKlgEKlgEKlgEKlgEKlgEKlgEKlgEK"
7481 "lgEKlgEKlgEKlgEKlgEKlgEKlgEKlgEKlgEKlgEKlgEKlgEKlgEKlgEKlgEKQQpLCkEKSwqWAQqW"
7482 "AQqWAQqWAQqWAQqWAQqWAQqWAQqWAQqWAQqWAQqWAQqWAQqWAQqWAQqWAQqWAQqWAQqWAQqWAQqW"
7483 "AQqWAQqWAQqWAQqWAQqWAQqWAQqWAQqWAQqWAQqWAQqWAQqWAQqWAQqWAQqWAQqWAQqWAQqWAQqW"
7484 "AQqWAQqWAQqWAQqWAQqWAQqWAQqWAQqWAQqWAQqWAQrLIwAA");
7485 ok(match, "Figure does not match.\n");
7486 match = compare_figure(&ctx, 320, 160, 160, 160, 0xff652e89, 0, "4GLAAuBi");
7487 ok(match, "Figure does not match.\n");
7488 match = compare_figure(&ctx, 480, 160, 160, 160, 0xff652e89, 0,
7489 "qyIKlgEKlgEKlgEKlgEKlgEKlgEKlgEKlgEKlgEKlgEKlgEKlgEKlgEKlgEKlgEKlgEKlgEKlgEK"
7490 "lgEKlgEKlgEKlgEKlgEKlgEKlgEKlgEKlgEKlgEKlgEKlgEKlgEKlgEKlgEKlgEKlgEKlgEKlgEK"
7491 "lgEKlgEKlgEKlgEKlgEKlgEKlgEKlgEKlgEKlgEKlgEKlgEKlgEKlgEKSwpBCksKQQqWAQqWAQqW"
7492 "AQqWAQqWAQqWAQqWAQqWAQqWAQqWAQqWAQqWAQqWAQqWAQqWAQqWAQqWAQqWAQqWAQqWAQqWAQqW"
7493 "AQqWAQqWAQqWAQqWAQqWAQqWAQqWAQqWAQqWAQqWAQqWAQqWAQqWAQqWAQqWAQqWAQqWAQqWAQqW"
7494 "AQqWAQqWAQqWAQqWAQqWAQqWAQqWAQqWAQqWAQqWAQrLIwAA");
7495 ok(match, "Figure does not match.\n");
7496
7497 match = compare_figure(&ctx, 0, 320, 160, 160, 0xff652e89, 0,
7498 "rycCngECnQEEnAEEmwEGmgEGmQEImAEIlwEKlgEKlQEMlAEMkwEOkgEOkQEQkAEQjwESjgESjQEU"
7499 "jAEUiwEKAgqKAQoCCokBCgQKiAEKBAqHAQoGCoYBCgYKhQEKCAqEAQoICoMBCgoKggEKCgqBAQoM"
7500 "CoABCgwKfwoOCn4KDgp9ChAKfAoQCnsKEgp6ChIKeQoUCngKFAp3ChYKdgoWCnUKGAp0ChgKcwoa"
7501 "CnIKGgpxChwKcAocCm8KHgpuCh4KbQogCmwKIAprCiIKagoiCmkKJApoCiQKZwomCmYKJgplCigK"
7502 "ZAooCmMKKgpiCioKYQosCmAKLApfCi4KXgouCl0KMApcCjAKWwoyCloKMgpZCjQKWAo0ClcKNgpW"
7503 "CjYKVQo4ClQKOApTCjoKUgo6ClEKPApQCjwKTwo+Ck4KPgpNCkAKTApACksKQgpKCkIKSQpECkgK"
7504 "RApHCkYKozIA");
7505 ok(match, "Figure does not match.\n");
7506 match = compare_figure(&ctx, 160, 320, 160, 160, 0xff652e89, 0,
7507 "ozIKRgpHCkQKSApECkkKQgpKCkIKSwpACkwKQApNCj4KTgo+Ck8KPApQCjwKUQo6ClIKOgpTCjgK"
7508 "VAo4ClUKNgpWCjYKVwo0ClgKNApZCjIKWgoyClsKMApcCjAKXQouCl4KLgpfCiwKYAosCmEKKgpi"
7509 "CioKYwooCmQKKAplCiYKZgomCmcKJApoCiQKaQoiCmoKIgprCiAKbAogCm0KHgpuCh4KbwocCnAK"
7510 "HApxChoKcgoaCnMKGAp0ChgKdQoWCnYKFgp3ChQKeAoUCnkKEgp6ChIKewoQCnwKEAp9Cg4KfgoO"
7511 "Cn8KDAqAAQoMCoEBCgoKggEKCgqDAQoICoQBCggKhQEKBgqGAQoGCocBCgQKiAEKBAqJAQoCCooB"
7512 "CgIKiwEUjAEUjQESjgESjwEQkAEQkQEOkgEOkwEMlAEMlQEKlgEKlwEImAEImQEGmgEGmwEEnAEE"
7513 "nQECngECrycA");
7514 ok(match, "Figure does not match.\n");
7515 match = compare_figure(&ctx, 320, 320, 160, 160, 0xff652e89, 0,
7516 "rycCngECnQEEnAEEmwEGmgEGmQEImAEIlwEKlgEKlQEMlAEMkwEOkgEOkQEQkAEQjwESjgESjQEU"
7517 "jAEUiwEKAgqKAQoCCokBCgQKiAEKBAqHAQoGCoYBCgYKhQEKCAqEAQoICoMBCgoKggEKCgqBAQoM"
7518 "CoABCgwKfwoOCn4KDgp9ChAKfAoQCnsKEgp6ChIKeQoUCngKFAp3ChYKdgoWCnUKGAp0ChgKcwoa"
7519 "CnIKGgpxChwKcAocCm8KHgpuCh4KbQogCmwKIAprCiIKagoiCmkKJApoCiQKZwomCmYKJgplCigK"
7520 "ZAooCmMKKgpiCioKYQosCmAKLApfCi4KXgouCl0KMApcCjAKWwoyCloKMgpZCjQKWAo0ClcKNgpW"
7521 "CjYKVQo4ClQKOApTCjoKUgo6ClEKPApQCjwKTwo+Ck4KPgpNCkAKTApACksKQgpKCkIKSQpECkgK"
7522 "RApHWkZagzEA");
7523 ok(match, "Figure does not match.\n");
7524 match = compare_figure(&ctx, 480, 320, 160, 160, 0xff652e89, 0,
7525 "gzFaRlpHCkQKSApECkkKQgpKCkIKSwpACkwKQApNCj4KTgo+Ck8KPApQCjwKUQo6ClIKOgpTCjgK"
7526 "VAo4ClUKNgpWCjYKVwo0ClgKNApZCjIKWgoyClsKMApcCjAKXQouCl4KLgpfCiwKYAosCmEKKgpi"
7527 "CioKYwooCmQKKAplCiYKZgomCmcKJApoCiQKaQoiCmoKIgprCiAKbAogCm0KHgpuCh4KbwocCnAK"
7528 "HApxChoKcgoaCnMKGAp0ChgKdQoWCnYKFgp3ChQKeAoUCnkKEgp6ChIKewoQCnwKEAp9Cg4KfgoO"
7529 "Cn8KDAqAAQoMCoEBCgoKggEKCgqDAQoICoQBCggKhQEKBgqGAQoGCocBCgQKiAEKBAqJAQoCCooB"
7530 "CgIKiwEUjAEUjQESjgESjwEQkAEQkQEOkgEOkwEMlAEMlQEKlgEKlwEImAEImQEGmgEGmwEEnAEE"
7531 "nQECngECrycA");
7532 ok(match, "Figure does not match.\n");
7533
7534 set_rect(&rect, 20.0f, 80.0f, 60.0f, 240.0f);
7535 hr = ID2D1Factory_CreateRectangleGeometry(factory, &rect, &rect_geometry[0]);
7536 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
7537
7538 set_rect(&rect, -1.0f, -1.0f, 1.0f, 1.0f);
7539 hr = ID2D1Factory_CreateRectangleGeometry(factory, &rect, &rect_geometry[1]);
7540 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
7541
7543 translate_matrix(&matrix, 160.0f, 640.0f);
7544 scale_matrix(&matrix, 40.0f, 160.0f);
7545 rotate_matrix(&matrix, M_PI / -5.0f);
7546 hr = ID2D1Factory_CreateTransformedGeometry(factory,
7547 (ID2D1Geometry *)rect_geometry[1], &matrix, &transformed_geometry[0]);
7548 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
7549
7551 scale_matrix(&matrix, 0.5f, 1.0f);
7552 translate_matrix(&matrix, -80.0f, 0.0f);
7553 hr = ID2D1Factory_CreateTransformedGeometry(factory,
7554 (ID2D1Geometry *)transformed_geometry[0], &matrix, &transformed_geometry[1]);
7555 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
7556
7558 rotate_matrix(&matrix, M_PI / 2.0f);
7559 translate_matrix(&matrix, 80.0f, -320.0f);
7560 scale_matrix(&matrix, 2.0f, 0.25f);
7561 hr = ID2D1Factory_CreateTransformedGeometry(factory,
7562 (ID2D1Geometry *)transformed_geometry[1], &matrix, &transformed_geometry[2]);
7563 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
7564
7565 ID2D1RenderTarget_BeginDraw(rt);
7566 ID2D1RenderTarget_Clear(rt, &color);
7567 ID2D1RenderTarget_DrawGeometry(rt, (ID2D1Geometry *)rect_geometry[0], (ID2D1Brush *)brush, 10.0f, NULL);
7568 ID2D1RenderTarget_DrawGeometry(rt, (ID2D1Geometry *)transformed_geometry[0], (ID2D1Brush *)brush, 10.0f, NULL);
7569 ID2D1RenderTarget_DrawGeometry(rt, (ID2D1Geometry *)transformed_geometry[1], (ID2D1Brush *)brush, 5.0f, NULL);
7570 ID2D1RenderTarget_DrawGeometry(rt, (ID2D1Geometry *)transformed_geometry[2], (ID2D1Brush *)brush, 15.0f, NULL);
7571 hr = ID2D1RenderTarget_EndDraw(rt, NULL, NULL);
7572 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
7573 ID2D1TransformedGeometry_Release(transformed_geometry[2]);
7574 ID2D1TransformedGeometry_Release(transformed_geometry[1]);
7575 ID2D1TransformedGeometry_Release(transformed_geometry[0]);
7576 ID2D1RectangleGeometry_Release(rect_geometry[1]);
7577 ID2D1RectangleGeometry_Release(rect_geometry[0]);
7578
7579 match = compare_figure(&ctx, 0, 0, 160, 160, 0xff652e89, 0,
7580 "vi5kPGQ8ZDxkPGQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwU"
7581 "PBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8"
7582 "FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwU"
7583 "PBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8"
7584 "FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwU"
7585 "PBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8ZDxkPGQ8ZDxk3i8A");
7586 ok(match, "Figure does not match.\n");
7587 match = compare_figure(&ctx, 160, 0, 320, 160, 0xff652e89, 32,
7588 "8XYGtQIOrAIXpAIfmwIokwIwigI4gwJA+gFJ8gFR6QEzAiXhATMKJdgBMxMl0AEzGyXHATMkJb8B"
7589 "MysmtgEzNCWvATM8JaYBM0UlngEzTSWVATNWJY0BM14lhAEzZyV8M28lczN4JWszgAElYjOIASZa"
7590 "M5ABJVgtmQElWCWhASVYJaEBJVgloQElWCWhASVYJaEBJVgloQElWCWhASVYJaEBJVglmQEtWCWQ"
7591 "ATNaJogBM2IlgAEzayV4M3MlbzN8JWczhAElXjONASVWM5UBJU0zngElRTOmASU8M68BJTQztgEm"
7592 "KzO/ASUkM8cBJRsz0AElEzPYASUKM+EBJQIz6QFR8gFJ+gFAgwI4igIwkwIomwIfpAIXrAIOtQIG"
7593 "8XYA");
7594 ok(match, "Figure does not match.\n");
7595 match = compare_figure(&ctx, 0, 160, 160, 320, 0xff652e89, 32,
7596 "ujEBngECnQEDnQEEmwEFmgEHmQEHmAEIlwEKlgEKlQELlAENkwENkgEOkQEQjwERjwESjQETjAEU"
7597 "jAEKAQqKAQoCCokBCgMKiQEKBAqHAQoFCoYBCgYKhgEKBwqEAQoICoMBCgkKgwEKCgqBAQoLCoAB"
7598 "Cg0KfgsNCn4KDgp9ChAKewsQCnsKEQp6ChMKeAoUCngKFAp3ChYKdQoXCnUKGApzChkKcgoaCnIK"
7599 "GwpwChwKbwodCm4LHgptCh8KbAogCmsLIQpqCiIKaQokCmcKJQpnCiUKZgonCmQKKApkCigKYwoq"
7600 "CmEKKwphCisKYAotCl4KLgpdCy8KXAowClsKMQpaCzIKWQozClgKNApXCjYKVgo2ClUKNwpUCjkK"
7601 "Uwo5ClIKOwpQCjwKTws8Ck8KPgpNCj8KTAs/CkwKQQpKCkIKSQtCCkkKRApHCkUKRgpHCkUKRwpE"
7602 "CkgKQwpKCkIKSgpBCksKQApNCj4LTQo+Ck4KPQpQCjsLUAo7ClIKOQpTCjgLUwo4ClUKNgpWCjUK"
7603 "Vwo1ClgKMwpZCjQKWAo0ClkKMwpZCjQKWQozClkKMwpZCjQKWQozClkKMwpZCjQKWQozClkKNApY"
7604 "CjQKWQozClkKNApZCjMKWQozClkKNApZCjMKWQozClkKNApZCjMKWQo0ClgKNApZCjMKWQo0ClkK"
7605 "MwpZCjMKWQo0ClkKMwpZCjMKWQo0ClkKMwpZCjQKWAo0ClkKMwpYCjUKVwo1ClYKNgpVCjgKUws4"
7606 "ClMKOQpSCjsKUAs7ClAKPQpOCj4KTQs+Ck0KQApLCkEKSgpCCkoKQwpICkQKRwpFCkcKRgpFCkcK"
7607 "RApJCkILSQpCCkoKQQpMCj8LTAo/Ck0KPgpPCjwLTwo8ClAKOwpSCjkKUwo5ClQKNwpVCjYKVgo2"
7608 "ClcKNApYCjMKWQoyC1oKMQpbCjAKXAovC10KLgpeCi0KYAorCmEKKwphCioKYwooCmQKKApkCicK"
7609 "ZgolCmcKJQpnCiQKaQoiCmoKIQtrCiAKbAofCm0KHgtuCh0KbwocCnAKGwpyChoKcgoZCnMKGAp1"
7610 "ChcKdQoWCncKFAp4ChQKeAoTCnoKEQp7ChALewoQCn0KDgp+Cg0LfgoNCoABCgsKgQEKCgqDAQoJ"
7611 "CoMBCggKhAEKBwqGAQoGCoYBCgUKhwEKBAqJAQoDCokBCgIKigEKAQqMARSMARONARKPARGPARCR"
7612 "AQ6SAQ2TAQ2UAQuVAQqWAQqXAQiYAQeZAQeaAQWbAQSdAQOdAQKeAQG6MQAA");
7613 ok(match, "Figure does not match.\n");
7614 match = compare_figure(&ctx, 160, 160, 320, 320, 0xff652e89, 64,
7615 "82ICvQIEugIHuAIJtgIKtAINsgIPsAIRrQITrAIVqQIYpwIZpgIbowIeoQIgnwIhnQIkmwImmAIp"
7616 "lgIVARSVAhUDFJICFQUVkAIVBxSPAhUJFIwCFQwUigIVDRWHAhYPFIYCFRIUhAIVFBSBAhUWFf8B"
7617 "FRgU/gEVGhT7ARUcFfkBFR4U9wEWIBT1ARUjFPMBFSQV8AEVJxTvARUpFOwBFisU6gEVLRXoARUv"
7618 "FOYBFjEU5AEVMxXiARU1FOABFTgU3gEVOhTbARY7FdkBFT4U2AEVQBTVARZCFNMBFUQV0QEVRhTP"
7619 "ARVJFM0BFUoVygEWTBTJARVPFMcBFVEUxAEVUxXCARVVFMEBFVcUvgEVWRW8ARVbFbkBFl0UuAEV"
7620 "YBS2ARVhFbMBFWQUsgEVZhSwARVoFK0BFWoVqwEVbBSpARZuFKcBFXAVpQEVchWiARV1FKEBFXcU"
7621 "nwEVeBWcARV7FJsBFX0UmAEWfxSWARWBARWUARWDARSSARWGARSQARWHARWOARWJARWLARWMARSK"
7622 "ARWOARSHARaPARWFARWSARSEARWUARSBARWXARR/FZgBFX0VmgEUexWdARR5FZ4BFXYWoAEVdBWj"
7623 "ARRzFaUBFHAVpwEVbhWpARRtFasBFGoVrgEUaBWvARVmFbEBFGcUsgEUZxSxARVmFbEBFWYUsgEU"
7624 "ZxSyARRnFLEBFWYVsQEUZxSyARRnFLIBFGcUsQEVZhWxARRnFLIBFGcUsQEVZhWxARVmFLIBFGcU"
7625 "sgEUZxSxARVmFbEBFGcUsgEUZxSyARRmFbEBFWYVsQEUZxSyARRnFLEBFWYVsQEUZxSyARRnFLIB"
7626 "FGcUsQEVZhWxARRnFLIBFGcUsgEUZhWxARVmFbEBFGcUsgEUZxSxARVmFa8BFWgUrgEVahSrARVt"
7627 "FKkBFW4VpwEVcBSlARVzFKMBFXQVoAEWdhWeARV5FJ0BFXsUmgEVfRWYARV/FJcBFYEBFJQBFYQB"
7628 "FJIBFYUBFY8BFocBFI4BFYoBFIwBFYsBFYkBFY4BFYcBFZABFIYBFZIBFIMBFZQBFYEBFZYBFH8W"
7629 "mAEUfRWbARR7FZwBFXgVnwEUdxWhARR1FaIBFXIVpQEVcBWnARRuFqkBFGwVqwEVahWtARRoFbAB"
7630 "FGYVsgEUZBWzARVhFbYBFGAVuAEUXRa5ARVbFbwBFVkVvgEUVxXBARRVFcIBFVMVxAEUURXHARRP"
7631 "FckBFEwWygEVShXNARRJFc8BFEYV0QEVRBXTARRCFtUBFEAV2AEUPhXZARU7FtsBFDoV3gEUOBXg"
7632 "ARQ1FeIBFTMV5AEUMRbmARQvFegBFS0V6gEUKxbsARQpFe8BFCcV8AEVJBXzARQjFfUBFCAW9wEU"
7633 "HhX5ARUcFfsBFBoV/gEUGBX/ARUWFYECFBQVhAIUEhWGAhQPFocCFQ0VigIUDBWMAhQJFY8CFAcV"
7634 "kAIVBRWSAhQDFZUCFAEVlgIpmAImmwIknQIhnwIgoQIeowIbpgIZpwIYqQIVrAITrQIRsAIPsgIN"
7635 "tAIKtgIJuAIHugIEvQIC82IA");
7636 ok(match, "Figure does not match.\n");
7637
7638 hr = ID2D1Factory_CreatePathGeometry(factory, &geometry);
7639 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
7640 hr = ID2D1PathGeometry_Open(geometry, &sink);
7641 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
7642
7643 set_point(&point, 20.0f, 79.5f);
7644 ID2D1GeometrySink_BeginFigure(sink, point, D2D1_FIGURE_BEGIN_HOLLOW);
7645 quadratic_to(sink, 40.0f, 79.5f, 60.0f, 79.5f);
7646 quadratic_to(sink, 60.0f, 159.5f, 60.0f, 239.5f);
7647 quadratic_to(sink, 40.0f, 239.5f, 20.0f, 239.5f);
7648 quadratic_to(sink, 20.0f, 159.5f, 20.0f, 79.5f);
7649 ID2D1GeometrySink_EndFigure(sink, D2D1_FIGURE_END_CLOSED);
7650
7651 set_point(&point, 100.0f, 79.5f);
7652 ID2D1GeometrySink_BeginFigure(sink, point, D2D1_FIGURE_BEGIN_HOLLOW);
7653 quadratic_to(sink, 105.0f, 79.5f, 140.0f, 79.5f);
7654 quadratic_to(sink, 140.0f, 99.5f, 140.0f, 239.5f);
7655 quadratic_to(sink, 135.0f, 239.5f, 100.0f, 239.5f);
7656 quadratic_to(sink, 100.0f, 219.5f, 100.0f, 79.5f);
7657 ID2D1GeometrySink_EndFigure(sink, D2D1_FIGURE_END_CLOSED);
7658
7659 set_point(&point, 180.0f, 79.5f);
7660 ID2D1GeometrySink_BeginFigure(sink, point, D2D1_FIGURE_BEGIN_HOLLOW);
7661 quadratic_to(sink, 215.0f, 79.5f, 220.0f, 79.5f);
7662 quadratic_to(sink, 220.0f, 219.5f, 220.0f, 239.5f);
7663 quadratic_to(sink, 185.0f, 239.5f, 180.0f, 239.5f);
7664 quadratic_to(sink, 180.0f, 99.5f, 180.0f, 79.5f);
7665 ID2D1GeometrySink_EndFigure(sink, D2D1_FIGURE_END_CLOSED);
7666
7667 set_point(&point, 260.0f, 79.5f);
7668 ID2D1GeometrySink_BeginFigure(sink, point, D2D1_FIGURE_BEGIN_HOLLOW);
7669 quadratic_to(sink, 280.0f, 79.5f, 300.0f, 79.5f);
7670 quadratic_to(sink, 300.0f, 159.5f, 300.0f, 239.5f);
7671 quadratic_to(sink, 280.0f, 239.5f, 260.0f, 239.5f);
7672 quadratic_to(sink, 260.0f, 159.5f, 260.0f, 79.5f);
7673 ID2D1GeometrySink_EndFigure(sink, D2D1_FIGURE_END_OPEN);
7674
7675 set_point(&point, 20.0f, 400.0f);
7676 ID2D1GeometrySink_BeginFigure(sink, point, D2D1_FIGURE_BEGIN_HOLLOW);
7677 quadratic_to(sink, 40.0f, 420.0f, 60.0f, 400.0f);
7678 quadratic_to(sink, 55.0f, 480.0f, 60.0f, 560.0f);
7679 quadratic_to(sink, 40.0f, 540.0f, 20.0f, 560.0f);
7680 quadratic_to(sink, 25.0f, 480.0f, 20.0f, 400.0f);
7681 ID2D1GeometrySink_EndFigure(sink, D2D1_FIGURE_END_CLOSED);
7682
7683 set_point(&point, 100.0f, 400.0f);
7684 ID2D1GeometrySink_BeginFigure(sink, point, D2D1_FIGURE_BEGIN_HOLLOW);
7685 quadratic_to(sink, 105.0f, 420.0f, 140.0f, 400.0f);
7686 quadratic_to(sink, 135.0f, 420.0f, 140.0f, 560.0f);
7687 quadratic_to(sink, 135.0f, 540.0f, 100.0f, 560.0f);
7688 quadratic_to(sink, 105.0f, 540.0f, 100.0f, 400.0f);
7689 ID2D1GeometrySink_EndFigure(sink, D2D1_FIGURE_END_CLOSED);
7690
7691 set_point(&point, 180.0f, 400.0f);
7692 ID2D1GeometrySink_BeginFigure(sink, point, D2D1_FIGURE_BEGIN_HOLLOW);
7693 quadratic_to(sink, 215.0f, 420.0f, 220.0f, 400.0f);
7694 quadratic_to(sink, 215.0f, 540.0f, 220.0f, 560.0f);
7695 quadratic_to(sink, 185.0f, 540.0f, 180.0f, 560.0f);
7696 quadratic_to(sink, 185.0f, 420.0f, 180.0f, 400.0f);
7697 ID2D1GeometrySink_EndFigure(sink, D2D1_FIGURE_END_CLOSED);
7698
7699 set_point(&point, 260.0f, 400.0f);
7700 ID2D1GeometrySink_BeginFigure(sink, point, D2D1_FIGURE_BEGIN_HOLLOW);
7701 quadratic_to(sink, 280.0f, 420.0f, 300.0f, 400.0f);
7702 quadratic_to(sink, 295.0f, 480.0f, 300.0f, 560.0f);
7703 quadratic_to(sink, 280.0f, 540.0f, 260.0f, 560.0f);
7704 quadratic_to(sink, 265.0f, 480.0f, 260.0f, 400.0f);
7705 ID2D1GeometrySink_EndFigure(sink, D2D1_FIGURE_END_OPEN);
7706
7707 set_point(&point, 20.0f, 720.0f);
7708 ID2D1GeometrySink_BeginFigure(sink, point, D2D1_FIGURE_BEGIN_HOLLOW);
7709 quadratic_to(sink, 40.0f, 700.0f, 60.0f, 720.0f);
7710 quadratic_to(sink, 65.0f, 800.0f, 60.0f, 880.0f);
7711 quadratic_to(sink, 40.0f, 900.0f, 20.0f, 880.0f);
7712 quadratic_to(sink, 15.0f, 800.0f, 20.0f, 720.0f);
7713 ID2D1GeometrySink_EndFigure(sink, D2D1_FIGURE_END_CLOSED);
7714
7715 set_point(&point, 100.0f, 720.0f);
7716 ID2D1GeometrySink_BeginFigure(sink, point, D2D1_FIGURE_BEGIN_HOLLOW);
7717 quadratic_to(sink, 105.0f, 700.0f, 140.0f, 720.0f);
7718 quadratic_to(sink, 145.0f, 740.0f, 140.0f, 880.0f);
7719 quadratic_to(sink, 135.0f, 900.0f, 100.0f, 880.0f);
7720 quadratic_to(sink, 95.0f, 860.0f, 100.0f, 720.0f);
7721 ID2D1GeometrySink_EndFigure(sink, D2D1_FIGURE_END_CLOSED);
7722
7723 set_point(&point, 180.0f, 720.0f);
7724 ID2D1GeometrySink_BeginFigure(sink, point, D2D1_FIGURE_BEGIN_HOLLOW);
7725 quadratic_to(sink, 215.0f, 700.0f, 220.0f, 720.0f);
7726 quadratic_to(sink, 225.0f, 860.0f, 220.0f, 880.0f);
7727 quadratic_to(sink, 185.0f, 900.0f, 180.0f, 880.0f);
7728 quadratic_to(sink, 175.0f, 740.0f, 180.0f, 720.0f);
7729 ID2D1GeometrySink_EndFigure(sink, D2D1_FIGURE_END_CLOSED);
7730
7731 set_point(&point, 260.0f, 720.0f);
7732 ID2D1GeometrySink_BeginFigure(sink, point, D2D1_FIGURE_BEGIN_HOLLOW);
7733 quadratic_to(sink, 280.0f, 700.0f, 300.0f, 720.0f);
7734 quadratic_to(sink, 305.0f, 800.0f, 300.0f, 880.0f);
7735 quadratic_to(sink, 280.0f, 900.0f, 260.0f, 880.0f);
7736 quadratic_to(sink, 255.0f, 800.0f, 260.0f, 720.0f);
7737 ID2D1GeometrySink_EndFigure(sink, D2D1_FIGURE_END_OPEN);
7738
7739 hr = ID2D1GeometrySink_Close(sink);
7740 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
7741 ID2D1GeometrySink_Release(sink);
7742
7743 ID2D1RenderTarget_BeginDraw(rt);
7744 ID2D1RenderTarget_Clear(rt, &color);
7745 ID2D1RenderTarget_DrawGeometry(rt, (ID2D1Geometry *)geometry, (ID2D1Brush *)brush, 10.0f, NULL);
7746 hr = ID2D1RenderTarget_EndDraw(rt, NULL, NULL);
7747 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
7748 ID2D1PathGeometry_Release(geometry);
7749
7750 match = compare_figure(&ctx, 0, 0, 160, 160, 0xff652e89, 0,
7751 "vi5kPGQ8ZDxkPGQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwU"
7752 "PBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8"
7753 "FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwU"
7754 "PBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8"
7755 "FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwU"
7756 "PBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8ZDxkPGQ8ZDxk3i8A");
7757 ok(match, "Figure does not match.\n");
7758 match = compare_figure(&ctx, 160, 0, 160, 160, 0xff652e89, 0,
7759 "vi5kPGQ8ZDxkPGQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwU"
7760 "PBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8"
7761 "FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwU"
7762 "PBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8"
7763 "FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwU"
7764 "PBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8ZDxkPGQ8ZDxk3i8A");
7765 ok(match, "Figure does not match.\n");
7766 match = compare_figure(&ctx, 320, 0, 160, 160, 0xff652e89, 0,
7767 "vi5kPGQ8ZDxkPGQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwU"
7768 "PBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8"
7769 "FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwU"
7770 "PBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8"
7771 "FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwU"
7772 "PBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8ZDxkPGQ8ZDxk3i8A");
7773 ok(match, "Figure does not match.\n");
7774 match = compare_figure(&ctx, 480, 0, 160, 160, 0xff652e89, 0,
7775 "yC5aRlpGWjxkPGQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwU"
7776 "PBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8"
7777 "FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwU"
7778 "PBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8"
7779 "FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwU"
7780 "PBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8FDwUPBQ8ZDxkPGQ8ZDxk3i8A");
7781 ok(match, "Figure does not match.\n");
7782
7783 match = compare_figure(&ctx, 0, 160, 160, 160, 0xff652e89, 64,
7784 "3SoDYAM6B1gHOgtQCzoPSA87EkASPBc2FzwcLBw8IiAiPWI+Yj5iPhQBOAEUPhQKJgoUPxQ4FEAU"
7785 "OBRAFDgUQBQ4FEAUOBRBFDYUQhQ2FEIUNhRCFDYUQhQ2FEIUNhRDFDQURBQ0FEQUNBREFDQURBQ0"
7786 "FEQUNBREFDQURBQ0FEQUNBREFDQURRQyFEYUMhRGFDIURhQyFEYUMhRGFDIURhQyFEYUMhRGFDIU"
7787 "RhQyFEYUMhRGFDIURhQyFEYUMhRGFDIURhQyFEYUMhRGFDIURhQyFEYUMhRGFDIURhQyFEYUMhRG"
7788 "FDIURRQ0FEQUNBREFDQURBQ0FEQUNBREFDQURBQ0FEQUNBREFDQURBQ0FEMUNhRCFDYUQhQ2FEIU"
7789 "NhRCFDYUQhQ2FEEUOBRAFDgUQBQ4FEAUOBRAFDgUPxQKJgoUPhQBOAEUPmI+Yj5iPSIgIjwcLBw8"
7790 "FzYXPBJAEjsPSA86C1ALOgdYBzoDYAPdKgAA");
7791 ok(match, "Figure does not match.\n");
7792 match = compare_figure(&ctx, 160, 160, 160, 160, 0xff652e89, 1024,
7793 "uxUBnwECngEDnQEEnAEFmwEGmwEGmgEHmQEImAEJlwEKlgELlQEMlQEMlAENkwEOkgEPkQEQkAER"
7794 "VQQ2Ek0KOBJFEDkTPRY6FDUcOxUrJDwYHi09Yj5iP2BAQwkUQDgUFEAUOBRAFDcUQRQ3FEEUNxRC"
7795 "FDYUQhQ2FEIUNhRCFDUUQxQ1FEMUNRRDFDUUQxQ1FEQUNBREFDQURBQ0FEQUNBREFDQURBQ0FEQU"
7796 "NBREFDQURBQ0FEQUNBRFFDMURRQzFEUUMxRFFDMURRQzFEUUMxRFFDMURRQzFEUUMxRFFDMURRQ0"
7797 "FEQUNBRFFDMURRQzFEUUMxRFFDMURRQzFEUUMxRFFDMURRQzFEUUMxRFFDMURRQ0FEQUNBREFDQU"
7798 "RBQ0FEQUNBREFDQURBQ0FEQUNBREFDQURBQ0FEQUNRRDFDUUQxQ1FEMUNRRDFDUUQhQ2FEIUNhRC"
7799 "FDYUQhQ3FEEUNxRBFDcUQBQ4FEAUFDhAFAlDQGA/Yj5iPS0eGDwkKxU7HDUUOhY9EzkQRRI4Ck0S"
7800 "NgRVEZABEJEBD5IBDpMBDZQBDJUBDJUBC5YBCpcBCZgBCJkBB5oBBpsBBpsBBZwBBJ0BA54BAp8B"
7801 "AbsV");
7802 ok(match, "Figure does not match.\n");
7803 match = compare_figure(&ctx, 320, 160, 160, 160, 0xff652e89, 1024,
7804 "pBYBngECnQEDnAEEmwEFmgEGmQEGmQEHmAEIlwEJlgEKlQELlAEMkwEMkwENkgEOkQEPkAEQNgRV"
7805 "ETcKTRI4EEUSOhY9EzscNRQ8JCsVPS0eGD5iPmI/YEAUCUNAFBQ4QBQ4FEEUNxRBFDcUQRQ3FEEU"
7806 "NhRCFDYUQhQ2FEMUNRRDFDUUQxQ1FEMUNRRDFDUUQxQ0FEQUNBREFDQURBQ0FEQUNBREFDQURBQ0"
7807 "FEQUNBREFDQURBQ0FEQUMxRFFDMURRQzFEUUMxRFFDMURRQzFEUUMxRFFDMURRQzFEUUMxREFDQU"
7808 "RBQ0FEQUMxRFFDMURRQzFEUUMxRFFDMURRQzFEUUMxRFFDMURRQzFEUUMxREFDQURBQ0FEQUNBRE"
7809 "FDQURBQ0FEQUNBREFDQURBQ0FEQUNBREFDQUQxQ1FEMUNRRDFDUUQxQ1FEMUNRRDFDYUQhQ2FEIU"
7810 "NhRBFDcUQRQ3FEEUNxRBFDgUQDgUFEBDCRRAYD9iPmI+GB4tPRUrJDwUNRw7Ez0WOhJFEDgSTQo3"
7811 "EVUENhCQAQ+RAQ6SAQ2TAQyTAQyUAQuVAQqWAQmXAQiYAQeZAQaZAQaaAQWbAQScAQOdAQKeAQGk"
7812 "FgAA");
7813 ok(match, "Figure does not match.\n");
7814 match = compare_figure(&ctx, 480, 160, 160, 160, 0xff652e89, 64,
7815 "wCsDmQEHlQELkQEPSwJAEkgLNhc8HCwcPCIgIj1iPmI+Yj4UATgBFD4UCiYKFD8UOBRAFDgUQBQ4"
7816 "FEAUOBRAFDgUQRQ2FEIUNhRCFDYUQhQ2FEIUNhRCFDYUQxQ0FEQUNBREFDQURBQ0FEQUNBREFDQU"
7817 "RBQ0FEQUNBREFDQURBQ0FEUUMhRGFDIURhQyFEYUMhRGFDIURhQyFEYUMhRGFDIURhQyFEYUMhRG"
7818 "FDIURhQyFEYUMhRGFDIURhQyFEYUMhRGFDIURhQyFEYUMhRGFDIURhQyFEYUMhRGFDIURhQyFEUU"
7819 "NBREFDQURBQ0FEQUNBREFDQURBQ0FEQUNBREFDQURBQ0FEQUNBRDFDYUQhQ2FEIUNhRCFDYUQhQ2"
7820 "FEIUNhRBFDgUQBQ4FEAUOBRAFDgUQBQ4FD8UCiYKFD4UATgBFD5iPmI+Yj0iICI8HCwcPBc2FzwS"
7821 "QBI7D0gPOgtQCzoHWAc6A2AD3SoA");
7822 ok(match, "Figure does not match.\n");
7823
7824 match = compare_figure(&ctx, 0, 320, 160, 160, 0xff652e89, 64,
7825 "3SkmcThiRFdOTVhEICAgPhwsHDwXNhc8FDwUOxQ+FDoUPhQ6FD4UOhQ+FDoUPhQ5FEAUOBRAFDgU"
7826 "QBQ4FEAUOBRAFDcUQhQ2FEIUNhRCFDYUQhQ2FEIUNhRCFDUURBQ0FEQUNBREFDQURBQ0FEQUNBRE"
7827 "FDQURBQ0FEQUNBREFDQURBQzFEYUMhRGFDIURhQyFEYUMhRGFDIURhQyFEYUMhRGFDIURhQyFEYU"
7828 "MhRGFDIURhQyFEYUMhRGFDIURhQyFEYUMhRGFDIURhQyFEYUMhRGFDIURhQyFEYUMhRGFDIURhQz"
7829 "FEQUNBREFDQURBQ0FEQUNBREFDQURBQ0FEQUNBREFDQURBQ0FEQUNRRCFDYUQhQ2FEIUNhRCFDYU"
7830 "QhQ2FEIUNxRAFDgUQBQ4FEAUOBRAFDgUQBQ5FD4UOhQ+FDoUPhQ6FD4UOhQ+FDsUPBQ8FzYXPBws"
7831 "HD4gICBEWE1OV0RiOHEm3SkA");
7832 ok(match, "Figure does not match.\n");
7833 match = compare_figure(&ctx, 160, 320, 160, 160, 0xff652e89, 1024,
7834 "zykoczhkRVhQTlpEFx4tPRUrJDwUNRw7FDwVOxQ+FDoUPhQ5FEAUOBRAFDgUQBQ4FEAUOBRBFDcU"
7835 "QRQ3FEEUNhRCFDYUQhQ2FEIUNhRDFDUUQxQ1FEMUNRRDFDUUQxQ0FEQUNBREFDQURBQ0FEQUNBRE"
7836 "FDQURBQ0FEQUNBREFDQURBQ0FEQUMxRFFDMURRQzFEUUMxRFFDMURRQzFEUUMxRFFDMURRQzFEUU"
7837 "MxRFFDMURBQ0FEQUMxRFFDMURRQzFEUUMxRFFDMURRQzFEUUMxRFFDMURRQzFEUUMxRFFDMURBQ0"
7838 "FEQUNBREFDQURBQ0FEQUNBREFDQURBQ0FEQUNBREFDQURBQ0FEMUNRRDFDUUQxQ1FEMUNRRDFDYU"
7839 "QhQ2FEIUNhRCFDYUQRQ3FEEUNxRBFDgUQBQ4FEAUOBRAFDgUQBQ5FD4UOhQ+FDsVPBQ7HDUUPCQr"
7840 "FT0tHhdEWk5QWEVkOHMozykA");
7841 ok(match, "Figure does not match.\n");
7842 match = compare_figure(&ctx, 320, 320, 160, 160, 0xff652e89, 1024,
7843 "6SkobThfRVNQSFpALR4XPSQrFTscNRQ7FTwUOhQ+FDoUPhQ5FEAUOBRAFDgUQBQ4FEAUNxRBFDcU"
7844 "QRQ3FEEUNxRCFDYUQhQ2FEIUNRRDFDUUQxQ1FEMUNRRDFDUUQxQ1FEQUNBREFDQURBQ0FEQUNBRE"
7845 "FDQURBQ0FEQUNBREFDQURBQ0FEQUNBRFFDMURRQzFEUUMxRFFDMURRQzFEUUMxRFFDMURRQzFEUU"
7846 "MxRFFDQURBQ0FEQUNBRFFDMURRQzFEUUMxRFFDMURRQzFEUUMxRFFDMURRQzFEUUMxRFFDQURBQ0"
7847 "FEQUNBREFDQURBQ0FEQUNBREFDQURBQ0FEQUNBREFDQURBQ1FEMUNRRDFDUUQxQ1FEMUNRRDFDUU"
7848 "QhQ2FEIUNhRCFDcUQRQ3FEEUNxRBFDcUQBQ4FEAUOBRAFDgUQBQ5FD4UOhQ+FDoUPBU7FDUcOxUr"
7849 "JD0XHi1AWkhQU0VfOG0o6SkA");
7850 ok(match, "Figure does not match.\n");
7851 match = compare_figure(&ctx, 480, 320, 160, 160, 0xff652e89, 64,
7852 "3SkmcThiRFdOTVhGHiAgRhQsHDwXNhc8FDwUOxQ+FDoUPhQ6FD4UOhQ+FDoUPhQ5FEAUOBRAFDgU"
7853 "QBQ4FEAUOBRAFDcUQhQ2FEIUNhRCFDYUQhQ2FEIUNhRCFDUURBQ0FEQUNBREFDQURBQ0FEQUNBRE"
7854 "FDQURBQ0FEQUNBREFDQURBQzFEYUMhRGFDIURhQyFEYUMhRGFDIURhQyFEYUMhRGFDIURhQyFEYU"
7855 "MhRGFDIURhQyFEYUMhRGFDIURhQyFEYUMhRGFDIURhQyFEYUMhRGFDIURhQyFEYUMhRGFDIURhQz"
7856 "FEQUNBREFDQURBQ0FEQUNBREFDQURBQ0FEQUNBREFDQURBQ0FEQUNRRCFDYUQhQ2FEIUNhRCFDYU"
7857 "QhQ2FEIUNxRAFDgUQBQ4FEAUOBRAFDgUQBQ5FD4UOhQ+FDoUPhQ6FD4UOhQ+FDsUPBQ8FzYXPBws"
7858 "HD4gICBEWE1OV0RiOHEm3SkA");
7859 ok(match, "Figure does not match.\n");
7860
7861 hr = ID2D1Factory_CreatePathGeometry(factory, &geometry);
7862 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
7863 hr = ID2D1PathGeometry_Open(geometry, &sink);
7864 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
7865
7866 set_point(&point, -0.402914f, 0.915514f);
7867 ID2D1GeometrySink_BeginFigure(sink, point, D2D1_FIGURE_BEGIN_HOLLOW);
7868 quadratic_to(sink, -0.310379f, 0.882571f, -0.116057f, 0.824000f);
7869 quadratic_to(sink, 0.008350f, 0.693614f, -0.052343f, 0.448886f);
7870 quadratic_to(sink, -0.154236f, 0.246072f, -0.279229f, 0.025343f);
7871 quadratic_to(sink, -0.370064f, -0.588586f, -0.383029f, -0.924114f);
7872 quadratic_to(sink, -0.295479f, -0.958764f, -0.017086f, -0.988400f);
7873 quadratic_to(sink, 0.208836f, -0.954157f, 0.272200f, -0.924114f);
7874 quadratic_to(sink, 0.295614f, -0.569071f, 0.230143f, 0.022886f);
7875 quadratic_to(sink, 0.101664f, 0.220643f, 0.012057f, 0.451571f);
7876 quadratic_to(sink, -0.028764f, 0.709014f, 0.104029f, 0.833943f);
7877 quadratic_to(sink, 0.319414f, 0.913057f, 0.403229f, 0.942628f);
7878 quadratic_to(sink, 0.317721f, 1.023450f, -0.017086f, 1.021771f);
7879 quadratic_to(sink, -0.310843f, 1.007472f, -0.402914f, 0.915514f);
7880 ID2D1GeometrySink_EndFigure(sink, D2D1_FIGURE_END_CLOSED);
7881
7882 hr = ID2D1GeometrySink_Close(sink);
7883 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
7884 ID2D1GeometrySink_Release(sink);
7885
7887 translate_matrix(&matrix, 40.0f, 160.0f);
7888 scale_matrix(&matrix, 20.0f, 80.0f);
7889 hr = ID2D1Factory_CreateTransformedGeometry(factory,
7890 (ID2D1Geometry *)geometry, &matrix, &transformed_geometry[0]);
7891 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
7892
7894 translate_matrix(&matrix, 160.0f, 640.0f);
7895 scale_matrix(&matrix, 40.0f, 160.0f);
7896 rotate_matrix(&matrix, M_PI / -5.0f);
7897 hr = ID2D1Factory_CreateTransformedGeometry(factory,
7898 (ID2D1Geometry *)geometry, &matrix, &transformed_geometry[1]);
7899 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
7900 ID2D1PathGeometry_Release(geometry);
7901
7903 scale_matrix(&matrix, 0.5f, 1.0f);
7904 translate_matrix(&matrix, -80.0f, 0.0f);
7905 hr = ID2D1Factory_CreateTransformedGeometry(factory,
7906 (ID2D1Geometry *)transformed_geometry[1], &matrix, &transformed_geometry[2]);
7907 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
7908
7910 rotate_matrix(&matrix, M_PI / 2.0f);
7911 translate_matrix(&matrix, 80.0f, -320.0f);
7912 scale_matrix(&matrix, 2.0f, 0.25f);
7913 hr = ID2D1Factory_CreateTransformedGeometry(factory,
7914 (ID2D1Geometry *)transformed_geometry[2], &matrix, &transformed_geometry[3]);
7915 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
7916
7917 ID2D1RenderTarget_BeginDraw(rt);
7918 ID2D1RenderTarget_Clear(rt, &color);
7919 ID2D1RenderTarget_DrawGeometry(rt, (ID2D1Geometry *)transformed_geometry[0], (ID2D1Brush *)brush, 2.0f, NULL);
7920 ID2D1RenderTarget_DrawGeometry(rt, (ID2D1Geometry *)transformed_geometry[1], (ID2D1Brush *)brush, 10.0f, NULL);
7921 ID2D1RenderTarget_DrawGeometry(rt, (ID2D1Geometry *)transformed_geometry[2], (ID2D1Brush *)brush, 5.0f, NULL);
7922 ID2D1RenderTarget_DrawGeometry(rt, (ID2D1Geometry *)transformed_geometry[3], (ID2D1Brush *)brush, 15.0f, NULL);
7923 hr = ID2D1RenderTarget_EndDraw(rt, NULL, NULL);
7924 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
7925 ID2D1TransformedGeometry_Release(transformed_geometry[3]);
7926 ID2D1TransformedGeometry_Release(transformed_geometry[2]);
7927 ID2D1TransformedGeometry_Release(transformed_geometry[1]);
7928 ID2D1TransformedGeometry_Release(transformed_geometry[0]);
7929
7930 match = compare_figure(&ctx, 0, 0, 160, 160, 0xff652e89, 128,
7931 "yjIJkQEHBwaIAQUSBYMBBBYEggEEFgSCAQQWBIIBBBYEggEEFgSCAQQWBIIBBBYEggEEFgSCAQQW"
7932 "BIIBBBYEggEEFgSDAQQVBIMBBBUEgwEEFQSDAQQVBIMBBBUEgwEEFQSDAQQVBIMBBBUEgwEEFQSD"
7933 "AQQVBIQBBBQEhAEEFASEAQQTBIUBBBMEhQEEEwSFAQQTBIUBBBMEhQEEEwSGAQQSBIYBBBIEhgEE"
7934 "EgSGAQQSBIYBBBIEhgEEEgSGAQQRBIgBBBAEiAEEEASIAQQQBIkBBA4EigEEDgSLAQQMBIwBBAwE"
7935 "jQEECgSOAQQJBJABBAgEkAEFBgSSAQQGBJMBBAQElAEEBASVAQQDBJUBBAIElwEEAQSXAQiZAQeZ"
7936 "AQaaAQaaAQaaAQabAQWbAQWbAQWbAQWaAQeZAQeZAQeZAQiXAQQBBJYBBAMElQEEAwWRAQUGBY0B"
7937 "BQwFhwEFEgSCAQUXBYABBBoFfgUYBIIBBhEFiAEUpTEA");
7938 ok(match, "Figure does not match.\n");
7939 match = compare_figure(&ctx, 160, 0, 320, 160, 0xff652e89, 512,
7940 "yJIBArkCDa4CGKMCIZoCK5ECM4gCO4ECQ/gBS/EBUesBLAYl5QEsDiPeASwWIdkBLBwh0wEsISHO"
7941 "ASsgKMsBKR4vyAEnHDPIASUaNMsBIxg1mQEFMCIUN54BCygiDzijAREhIgY9qAEYGWGuAR4RXbMB"
7942 "JAhbuQGAAcABesYBc84Ba9YBTvQBP4MCOIoCNI4CM5ACMZICL5QCLZYCK5kCKJsCJ54CI6MCHq8C"
7943 "EraSAQAA");
7944 ok(match, "Figure does not match.\n");
7945 match = compare_figure(&ctx, 0, 160, 160, 320, 0xff652e89, 512,
7946 "xWkCmwEFmAEJlQELlAENkgEOkQEPjwESjQETjAEVigELAQqJAQsCCogBCwQKhwEKBQqGAQoGCoYB"
7947 "CgcKhAEKCAqEAQoIC4IBCgoKggEKCgqBAQoMCoABCgwKfwoNCn8KDgp9Cg8KfQoPCnwKEQp7ChEK"
7948 "egoSCnoKEwp4ChQKeAoUCncLFQp2ChYKdgoWCnYKFwp2ChYKdgoWCncKFgp2ChYKdgoWCncKFQt2"
7949 "ChYKdwoVCncKFQp4ChUKdwoVCncKFQp4ChUKdwoVCngKFAp4ChUKeAoUCngKFAp4CxMKeQoUCngK"
7950 "FAp5ChMKeQoUCnkKEwp5ChMKegoSC3kKEwp6ChIKegoSCnoLEgp6ChIKegoSCnsKEQp7ChEKfAoQ"
7951 "CnwKEAp9Cg8KfQoPCn4KDgp+Cg4KfwoOCn4KDgp/Cg0KfwoNCoABCgwKgAEKDAqBAQoLCoEBCgsK"
7952 "gQELCgqCAQoKCoIBCwkKgwEKCQqDAQoJCoQBCggKhAEKCQqEAQsHCoUBCwYKhgELBQqHAQsECogB"
7953 "CwMKiQELAgqLAQoBCowBFI0BE44BE44BEo8BEZABEJEBD5IBDpMBDpMBDZMBDZQBDJQBDZQBDJQB"
7954 "DBUCfgwSBH4MEQV/DA4GgAEMDAiAAQ0KCYEBDAgLgQENBQ2BAQ0EDoIBDQEPgwEdgwEdgwEdgwEc"
7955 "hAEKAgQCCoUBCgYKhgEKBgqGAQoFC4YBCgUKhwEKBAqIAQoECogBCgMKiQEKAwqIAQoDCokBCgMK"
7956 "iQEKAgqJAQoCCooBCgIKiQEKAgqKAQoBCosBCgEKigEKAQqLARSMARSLARSMAROMARONARKOARGO"
7957 "ARGPARCQAQ6RAQ2YAQTEZAAA");
7958 ok(match, "Figure does not match.\n");
7959 match = compare_figure(&ctx, 160, 160, 320, 320, 0xff652e89, 1024,
7960 "ytABA7gCCbICD60CFKkCF6cCGqMCHqACIZ0CJJoCJpgCKZUCFgIUkgIWBBWPAhYHFI4CFQoUjAIV"
7961 "DBSKAhUNFYgCFQ8UhwIVERSFAhUTFIMCFRQVgQIUFxSAAhQZFP4BFBoV/AEUHBT7ARQeFPkBFB8V"
7962 "9wEUIRT2ARQjFPQBFSMV8gEVJRTxARUnFPABFCgV7gEUKhTtARQsFOwBFCwV7AEULBTsARUsFOwB"
7963 "FSsV7AEULBTtARQsFO0BFCsU7QEVKxTtARUqFe0BFSoU7gEUKxTuARQqFe4BFCoU7wEUKhTuARUp"
7964 "FO8BFSkU7wEVKBXvARUoFPABFCkU8AEUKBTxARQoFPEBFCcV8QEUJxTxARUnFPEBFSYU8gEVJhTy"
7965 "ARUlFfIBFSUU8wEUJRXzARQlFPQBFCUU9AEUJBT1ARQkFPUBFCMU9gEUIhT2ARUhFPcBFSAU+AEV"
7966 "HxT5ARUeFPoBFR4U+gEVHRT7ARUcFPwBFRsU/QEVGhT+ARUZFP8BFBkUgAIUGBSBAhQXFIICFBcU"
7967 "ggIUFhSDAhQVFIQCFBQUhQIUExSGAhQSFIcCFBIUhwIUERSIAhUPFIkCFg0UigIXCxSNAhYJFI8C"
7968 "FggUkAIXBRSSAhcDFJQCFwEUlgIrlwIpmgImnAIkngIjnwIhoQIfowIepAIcpgIbpgIaqAIZqAIZ"
7969 "qAIYKwP7ARgnBf0BGCMI/QEZHgz+ARgbD/8BGBcSgAIYEhaAAhoNGIICGggcgwIaBB+DAjyEAjyF"
7970 "AjqGAjmIAjiIAiECFIkCFAIIBBSKAhQNFIsCFAwUjAIUCxSNAhQKFI4CFAkUjwIUBxWQAhQGFZEC"
7971 "FAUVkQIUBRWRAhQFFZECFQMVkwIUAxWTAhQDFZMCFAIVlAIVARWVAiqVAimWAimWAiiYAiaZAiaZ"
7972 "AiWaAiScAiKdAiGeAh+hAhyjAhmuAg3GxgEA");
7973 ok(match, "Figure does not match.\n");
7974
7975 hr = ID2D1Factory_CreatePathGeometry(factory, &geometry);
7976 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
7977 hr = ID2D1PathGeometry_Open(geometry, &sink);
7978 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
7979
7980 set_point(&point, 20.0f, 80.0f);
7981 ID2D1GeometrySink_BeginFigure(sink, point, D2D1_FIGURE_BEGIN_HOLLOW);
7982 quadratic_to(sink, 20.0f, 160.0f, 60.0f, 160.0f);
7983 ID2D1GeometrySink_EndFigure(sink, D2D1_FIGURE_END_CLOSED);
7984
7985 set_point(&point, 100.0f, 80.0f);
7986 ID2D1GeometrySink_BeginFigure(sink, point, D2D1_FIGURE_BEGIN_HOLLOW);
7987 quadratic_to(sink, 100.0f, 160.0f, 140.0f, 160.0f);
7988 ID2D1GeometrySink_EndFigure(sink, D2D1_FIGURE_END_OPEN);
7989
7990 hr = ID2D1GeometrySink_Close(sink);
7991 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
7992 ID2D1GeometrySink_Release(sink);
7993
7994 ID2D1RenderTarget_BeginDraw(rt);
7995 ID2D1RenderTarget_Clear(rt, &color);
7996 ID2D1RenderTarget_DrawGeometry(rt, (ID2D1Geometry *)geometry, (ID2D1Brush *)brush, 10.0f, NULL);
7997 hr = ID2D1RenderTarget_EndDraw(rt, NULL, NULL);
7998 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
7999 ID2D1PathGeometry_Release(geometry);
8000
8001 match = compare_figure(&ctx, 0, 0, 160, 160, 0xff652e89, 32,
8002 "3iUCngEEnAEGmgEImAEKlgEMlAEOkgEQkAESjgEUjAEWigEYiAEahgEchAEeggEggQEhfyN9JXsn"
8003 "eih4KnYUAhZ1FAMWcxQFFnIUBhZwFQcWbxQJFm4UChZsFQsWaxUMFmoVDRZpFQ4WaBUPFmcVEBZm"
8004 "FREWZhURFmUVEhZkFhIWZBYSFmQXERZkFxEWZBgQFmQaDhZlGwwWZh0JFmchBBZpOWw2bzN0Lnsn"
8005 "2mEA");
8006 ok(match, "Figure does not match.\n");
8007
8008 match = compare_figure(&ctx, 160, 0, 160, 160, 0xff652e89, 32,
8009 "njIUjAEUjAEUjAEUjAEUjAEUjQEUjAEUjAEUjAEUjQEUjAEUjAEUjQEUjAEUjQEUjAEVjAEUjQEU"
8010 "jAEVjAEVjAEVjAEVjAEVjAEVjAEVjQEVjAEVjAEWjAEWjAEXiwEXiwEYigEaiQEbiAEdhgEhgwEz"
8011 "ci53KX4ihwEZ6GEA");
8012 ok(match, "Figure does not match.\n");
8013
8014 ID2D1SolidColorBrush_Release(brush);
8016}
static void set_rounded_rect(D2D1_ROUNDED_RECT *rect, float left, float top, float right, float bottom, float radius_x, float radius_y)
Definition: d2d1.c:511
@ D2D1_FILL_MODE_ALTERNATE
Definition: d2d1.idl:85
@ D2D1_FIGURE_END_OPEN
Definition: d2d1.idl:107

Referenced by START_TEST().

◆ test_draw_text_layout()

static void test_draw_text_layout ( BOOL  d3d11)
static

Definition at line 5767 of file d2d1.c.

5768{
5769 static const struct
5770 {
5772 DWRITE_RENDERING_MODE rendering_mode;
5773 HRESULT hr;
5774 }
5775 antialias_mode_tests[] =
5776 {
5799 };
5801 ID2D1RenderTarget *rt, *rt2;
5802 HRESULT hr;
5803 IDWriteFactory *dwrite_factory;
5804 IDWriteTextFormat *text_format;
5805 IDWriteTextLayout *text_layout;
5806 struct d2d1_test_context ctx;
5811 ID2D1SolidColorBrush *brush, *brush2;
5812 ID2D1RectangleGeometry *geometry;
5814 unsigned int i;
5815
5816 if (!init_test_context(&ctx, d3d11))
5817 return;
5818
5819 hr = D2D1CreateFactory(D2D1_FACTORY_TYPE_SINGLE_THREADED, &IID_ID2D1Factory, NULL, (void **)&factory2);
5820 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
5821 ok(ctx.factory != factory2, "got same factory\n");
5822
5824 desc.pixelFormat.format = DXGI_FORMAT_UNKNOWN;
5825 desc.pixelFormat.alphaMode = D2D1_ALPHA_MODE_PREMULTIPLIED;
5826 desc.dpiX = 0.0f;
5827 desc.dpiY = 0.0f;
5830
5831 hr = ID2D1Factory_CreateDxgiSurfaceRenderTarget(ctx.factory, ctx.surface, &desc, &rt);
5832 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
5833
5834 hr = ID2D1Factory_CreateDxgiSurfaceRenderTarget(factory2, ctx.surface, &desc, &rt2);
5835 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
5836
5837 hr = DWriteCreateFactory(DWRITE_FACTORY_TYPE_SHARED, &IID_IDWriteFactory, (IUnknown **)&dwrite_factory);
5838 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
5839
5840 hr = IDWriteFactory_CreateTextFormat(dwrite_factory, L"Tahoma", NULL, DWRITE_FONT_WEIGHT_NORMAL,
5841 DWRITE_FONT_STYLE_NORMAL, DWRITE_FONT_STRETCH_NORMAL, 10.0f, L"", &text_format);
5842 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
5843
5844 hr = IDWriteFactory_CreateTextLayout(dwrite_factory, L"text", 4, text_format, 100.0f, 100.0f, &text_layout);
5845 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
5846
5847 set_color(&color, 0.0f, 0.0f, 0.0f, 0.0f);
5848 hr = ID2D1RenderTarget_CreateSolidColorBrush(rt, &color, NULL, &brush);
5849 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
5850
5851 hr = ID2D1RenderTarget_CreateSolidColorBrush(rt2, &color, NULL, &brush2);
5852 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
5853
5854 /* effect brush is created from different factory */
5855 range.startPosition = 0;
5856 range.length = 4;
5857 hr = IDWriteTextLayout_SetDrawingEffect(text_layout, (IUnknown*)brush2, range);
5858 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
5859
5860 ID2D1RenderTarget_BeginDraw(rt);
5861
5862 origin.x = origin.y = 0.0f;
5863 ID2D1RenderTarget_DrawTextLayout(rt, origin, text_layout, (ID2D1Brush*)brush, D2D1_DRAW_TEXT_OPTIONS_NONE);
5864
5865 hr = ID2D1RenderTarget_EndDraw(rt, NULL, NULL);
5866 todo_wine ok(hr == D2DERR_WRONG_FACTORY, "Got unexpected hr %#lx.\n", hr);
5867
5868 /* Effect is d2d resource, but not a brush. */
5869 set_rect(&rect, 0.0f, 0.0f, 10.0f, 10.0f);
5870 hr = ID2D1Factory_CreateRectangleGeometry(ctx.factory, &rect, &geometry);
5871 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
5872
5873 range.startPosition = 0;
5874 range.length = 4;
5875 hr = IDWriteTextLayout_SetDrawingEffect(text_layout, (IUnknown*)geometry, range);
5876 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
5877 ID2D1RectangleGeometry_Release(geometry);
5878
5879 ID2D1RenderTarget_BeginDraw(rt);
5880
5881 origin.x = origin.y = 0.0f;
5882 ID2D1RenderTarget_DrawTextLayout(rt, origin, text_layout, (ID2D1Brush*)brush, D2D1_DRAW_TEXT_OPTIONS_NONE);
5883
5884 hr = ID2D1RenderTarget_EndDraw(rt, NULL, NULL);
5885 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
5886
5887 for (i = 0; i < ARRAY_SIZE(antialias_mode_tests); ++i)
5888 {
5889 IDWriteRenderingParams *rendering_params;
5890
5891 ID2D1RenderTarget_SetTextAntialiasMode(rt, antialias_mode_tests[i].aa_mode);
5892
5893 hr = IDWriteFactory_CreateCustomRenderingParams(dwrite_factory, 2.0f, 1.0f, 0.0f, DWRITE_PIXEL_GEOMETRY_FLAT,
5894 antialias_mode_tests[i].rendering_mode, &rendering_params);
5895 ok(hr == S_OK, "Test %u: Got unexpected hr %#lx.\n", i, hr);
5896
5897 ID2D1RenderTarget_SetTextRenderingParams(rt, rendering_params);
5898
5899 ID2D1RenderTarget_BeginDraw(rt);
5900
5901 ID2D1RenderTarget_DrawTextLayout(rt, origin, text_layout, (ID2D1Brush *)brush, D2D1_DRAW_TEXT_OPTIONS_NONE);
5902
5903 hr = ID2D1RenderTarget_EndDraw(rt, NULL, NULL);
5904 ok(hr == antialias_mode_tests[i].hr, "Test %u: Got unexpected hr %#lx.\n", i, hr);
5905
5906 IDWriteRenderingParams_Release(rendering_params);
5907 }
5908
5909 ID2D1SolidColorBrush_Release(brush2);
5910 ID2D1SolidColorBrush_Release(brush);
5911 IDWriteTextFormat_Release(text_format);
5912 IDWriteTextLayout_Release(text_layout);
5913 IDWriteFactory_Release(dwrite_factory);
5914 ID2D1RenderTarget_Release(rt);
5915 ID2D1RenderTarget_Release(rt2);
5916
5917 ID2D1Factory_Release(factory2);
5919}
@ D2D1_DRAW_TEXT_OPTIONS_NONE
Definition: d2d1.idl:240
@ D2D1_TEXT_ANTIALIAS_MODE_ALIASED
Definition: d2d1.idl:193
@ D2D1_TEXT_ANTIALIAS_MODE_GRAYSCALE
Definition: d2d1.idl:192
range
Definition: d3dx9_private.h:58
HRESULT WINAPI DWriteCreateFactory(DWRITE_FACTORY_TYPE type, REFIID riid, IUnknown **ret)
Definition: main.c:2110
@ DWRITE_PIXEL_GEOMETRY_FLAT
Definition: dwrite.idl:154
DWRITE_RENDERING_MODE
Definition: dwrite.idl:160
@ DWRITE_RENDERING_MODE_CLEARTYPE_NATURAL
Definition: dwrite.idl:170
@ DWRITE_RENDERING_MODE_OUTLINE
Definition: dwrite.idl:167
@ DWRITE_RENDERING_MODE_CLEARTYPE_NATURAL_SYMMETRIC
Definition: dwrite.idl:171
@ DWRITE_RENDERING_MODE_CLEARTYPE_GDI_NATURAL
Definition: dwrite.idl:169
@ DWRITE_RENDERING_MODE_DEFAULT
Definition: dwrite.idl:161
@ DWRITE_RENDERING_MODE_CLEARTYPE_GDI_CLASSIC
Definition: dwrite.idl:168
@ DWRITE_RENDERING_MODE_ALIASED
Definition: dwrite.idl:162
@ DWRITE_FONT_WEIGHT_NORMAL
Definition: dwrite.idl:79
@ DWRITE_FONT_STYLE_NORMAL
Definition: dwrite.idl:110
@ DWRITE_FACTORY_TYPE_SHARED
Definition: dwrite.idl:42
@ DWRITE_FONT_STRETCH_NORMAL
Definition: dwrite.idl:100
voidpf uLong int origin
Definition: ioapi.h:144
#define D2DERR_WRONG_FACTORY
Definition: winerror.h:7369

Referenced by START_TEST().

◆ test_dxgi_surface_target_gdi_interop()

static void test_dxgi_surface_target_gdi_interop ( BOOL  d3d11)
static

Definition at line 6478 of file d2d1.c.

6479{
6482 ID2D1DeviceContext *device_context;
6483 struct d2d1_test_context ctx;
6487 ULONG refcount;
6488 HRESULT hr;
6489 HDC dc;
6490
6491 if (!init_test_context(&ctx, d3d11))
6492 return;
6493
6496 ok(!!surface, "Failed to create a surface.\n");
6497
6499 desc.pixelFormat.format = DXGI_FORMAT_UNKNOWN;
6500 desc.pixelFormat.alphaMode = D2D1_ALPHA_MODE_IGNORE;
6501 desc.dpiX = 0.0f;
6502 desc.dpiY = 0.0f;
6505
6506 hr = ID2D1Factory_CreateDxgiSurfaceRenderTarget(ctx.factory, surface, &desc, &rt);
6507 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
6508
6509 hr = ID2D1RenderTarget_QueryInterface(rt, &IID_ID2D1GdiInteropRenderTarget, (void **)&interop);
6510 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
6511 ID2D1RenderTarget_BeginDraw(rt);
6512 dc = (void *)0xdeadbeef;
6513 hr = ID2D1GdiInteropRenderTarget_GetDC(interop, D2D1_DC_INITIALIZE_MODE_COPY, &dc);
6514 ok(hr == D2DERR_TARGET_NOT_GDI_COMPATIBLE, "Got unexpected hr %#lx.\n", hr);
6515 ok(!dc, "Got unexpected DC %p.\n", dc);
6516 hr = ID2D1GdiInteropRenderTarget_ReleaseDC(interop, NULL);
6517 ok(hr == D2DERR_WRONG_STATE, "Got unexpected hr %#lx.\n", hr);
6518 hr = ID2D1RenderTarget_EndDraw(rt, NULL, NULL);
6519 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
6520 ID2D1GdiInteropRenderTarget_Release(interop);
6521 ID2D1RenderTarget_Release(rt);
6522
6523 /* GDI-compatible, requested usage does not match the surface. */
6525
6526 hr = ID2D1Factory_CreateDxgiSurfaceRenderTarget(ctx.factory, surface, &desc, &rt);
6527 ok(hr == E_INVALIDARG, "Got unexpected hr %#lx.\n", hr);
6528
6529 refcount = IDXGISurface_Release(surface);
6530 ok(!refcount, "Unexpected refcount %lu.\n", refcount);
6531
6532 /* GDI-compatible, surface is GDI-compatible. */
6535 ok(!!surface, "Failed to create a surface.\n");
6536
6537 hr = ID2D1Factory_CreateDxgiSurfaceRenderTarget(ctx.factory, surface, &desc, &rt);
6538 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
6539
6540 if (SUCCEEDED(ID2D1RenderTarget_QueryInterface(rt, &IID_ID2D1DeviceContext, (void **)&device_context)))
6541 {
6542 ID2D1DeviceContext_GetTarget(device_context, (ID2D1Image **)&bitmap);
6544 ID2D1Bitmap_Release(bitmap);
6545 ID2D1DeviceContext_Release(device_context);
6546 }
6547
6548 hr = ID2D1RenderTarget_QueryInterface(rt, &IID_ID2D1GdiInteropRenderTarget, (void **)&interop);
6549 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
6550 ID2D1RenderTarget_BeginDraw(rt);
6551 dc = (void *)0xdeadbeef;
6552 hr = ID2D1GdiInteropRenderTarget_GetDC(interop, D2D1_DC_INITIALIZE_MODE_COPY, &dc);
6553 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
6554 ok(!!dc, "Got unexpected DC %p.\n", dc);
6555 hr = ID2D1GdiInteropRenderTarget_GetDC(interop, D2D1_DC_INITIALIZE_MODE_COPY, &dc);
6556 ok(hr == D2DERR_WRONG_STATE, "Got unexpected hr %#lx.\n", hr);
6557 ok(!dc, "Got unexpected DC %p.\n", dc);
6558 hr = ID2D1GdiInteropRenderTarget_ReleaseDC(interop, NULL);
6559 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
6560 hr = ID2D1RenderTarget_EndDraw(rt, NULL, NULL);
6561 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
6562 ID2D1GdiInteropRenderTarget_Release(interop);
6563 ID2D1RenderTarget_Release(rt);
6564
6565 /* GDI-compatible target wasn't requested, used surface is compatible. */
6567
6568 hr = ID2D1Factory_CreateDxgiSurfaceRenderTarget(ctx.factory, surface, &desc, &rt);
6569 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
6570
6571 hr = ID2D1RenderTarget_QueryInterface(rt, &IID_ID2D1GdiInteropRenderTarget, (void **)&interop);
6572 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
6573 ID2D1RenderTarget_BeginDraw(rt);
6574 dc = (void *)0xdeadbeef;
6575 hr = ID2D1GdiInteropRenderTarget_GetDC(interop, D2D1_DC_INITIALIZE_MODE_COPY, &dc);
6576 ok(hr == D2DERR_TARGET_NOT_GDI_COMPATIBLE, "Got unexpected hr %#lx.\n", hr);
6577 ok(!dc, "Got unexpected DC %p.\n", dc);
6578 hr = ID2D1GdiInteropRenderTarget_ReleaseDC(interop, NULL);
6579 ok(hr == D2DERR_WRONG_STATE, "Got unexpected hr %#lx.\n", hr);
6580 hr = ID2D1RenderTarget_EndDraw(rt, NULL, NULL);
6581 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
6582 ID2D1GdiInteropRenderTarget_Release(interop);
6583 ID2D1RenderTarget_Release(rt);
6584
6585 refcount = IDXGISurface_Release(surface);
6586 ok(!refcount, "Unexpected refcount %lu.\n", refcount);
6587
6589}
HDC dc
Definition: cylfrac.c:34
#define D2DERR_TARGET_NOT_GDI_COMPATIBLE
Definition: winerror.h:7377

Referenced by START_TEST().

◆ test_effect_2d_affine()

static void test_effect_2d_affine ( BOOL  d3d11)
static

Definition at line 12386 of file d2d1.c.

12387{
12389 D2D1_BITMAP_PROPERTIES1 bitmap_desc;
12390 unsigned int i, x, y, w, h, count;
12391 D2D_RECT_F output_bounds = {0};
12392 struct d2d1_test_context ctx;
12394 D2D1_SIZE_U input_size;
12398 ID2D1Effect *effect;
12399 ID2D1Image *output;
12400 UINT32 value;
12401 BOOL match;
12402 HRESULT hr;
12403
12404 static const DWORD image_4x4[] =
12405 {
12406 0xfdcba987, 0xffff0000, 0x98765432, 0xffffffff,
12407 0x4b4b4b4b, 0x89abcdef, 0xdeadbeef, 0xabcdef01,
12408 0x7f000011, 0x40ffffff, 0x12345678, 0xaabbccdd,
12409 0x44444444, 0xff7f7f7f, 0x1221abba, 0x00000000
12410 };
12411 DWORD image_16x16[16 * 16];
12412
12413 const struct effect_2d_affine_test
12414 {
12415 const DWORD *img_data;
12416 unsigned int img_width;
12417 unsigned int img_height;
12418
12420
12421 D2D_RECT_F bounds;
12422 const char *figure;
12423 }
12424 effect_2d_affine_tests[] =
12425 {
12426 {image_4x4, 4, 4, &rotate, {-6.0f, -3.0f, 2.0f, 4.0f},
12427 "ASgBAQkBAQEBBwEBAQEBAQYBAQEBAQEHAQEBASgA"},
12428 {image_4x4, 4, 4, &scale, {-2.0f, -3.0f, 1.0f, 9.0f},
12429 "AQ8BAQEEAQEBBAEBAQQBAQEEAQEBBAEBAQQBAQEEAQEBBAEBAQQBAQEEAQEBBAEBARAA/"},
12430 {image_4x4, 4, 4, &skew, {-7.0f, -3.0f, 3.0f, 7.0f},
12431 "AS8CCwEBAQEJAQEBAQEBBwEBAQEBAQEBBgEBAQEBAQEBBwEBAQEBAQkCAj0A"},
12432 {image_16x16, 16, 16, &rotate, {-14.0f, -3.0f, 10.0f, 21.0f},
12433 "AWACGQECARcBBAEVAQYBEwEIAREBCgEPAQwBDQEOAQsBEAEJARIBBwEUAQUBARQBAQUBARIBAQcB"
12434 "ARABAQkBAQ4BAQsBAQwBAQ0BAQoBAQ8BAQgBAREBAQYBARMBAQQBARUBAQIBARcBAgEZAkUA"},
12435 {image_16x16, 16, 16, &scale, {-2.0f, -3.0f, 10.0f, 39.0f},
12436 "ASEMBAwEDAQMBAwEDAQMBAwEDAQMBAwEDAQMBAwEDAQMBAwEDAQMBAwEDAQMBAwEDAQMBAwEDAQM"
12437 "BAwEDAQMBAwEDAQMBAwEDAQMBAwEDAQMBAwEDCIA"},
12438 {image_16x16, 16, 16, &skew, {-19.0f, -3.0f, 15.0f, 31.0f},
12439 "AYMBAiMBAgEhAQQBHwEGAR0BCAEbAQoBGQEMARcBDgEVARABEwESAREBFAEPARYBDQEYAQsBGgEJ"
12440 "ARwBBwEeAQYBHgEHARwBCQEaAQsBGAENARYBDwEUAREBEgETARABFQEOARcBDAEZAQoBGwEIAR0B"
12441 "BgEfAQQBIQECASMChAEA"},
12442 };
12443
12444 static const unsigned int border_modes[] =
12445 {
12448 };
12449
12450 static const unsigned int interp_modes[] =
12451 {
12458 };
12459
12460 memset(image_16x16, 0xff, sizeof(image_16x16));
12463 set_matrix_identity(&skew);
12464 translate_matrix(&rotate, -2.0f, -2.0f);
12465 translate_matrix(&scale, -2.0f, -2.0f);
12466 translate_matrix(&skew, -2.0f, -2.0f);
12468 scale_matrix(&scale, 0.75f, 2.5f);
12469 skew_matrix(&skew, -1.0f, 1.0f);
12470
12471 if (!init_test_context(&ctx, d3d11))
12472 return;
12473
12474 factory = ctx.factory1;
12475 if (!factory)
12476 {
12477 win_skip("ID2D1Factory1 is not supported.\n");
12479 return;
12480 }
12481
12482 context = ctx.context;
12483
12484 hr = ID2D1DeviceContext_CreateEffect(context, &CLSID_D2D12DAffineTransform, &effect);
12485 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
12486
12488
12489 count = ID2D1Effect_GetPropertyCount(effect);
12490 todo_wine ok(count == 4, "Got unexpected property count %u.\n", count);
12491
12492 hr = ID2D1Effect_GetValue(effect, D2D1_2DAFFINETRANSFORM_PROP_INTERPOLATION_MODE,
12493 D2D1_PROPERTY_TYPE_ENUM, (BYTE *)&value, sizeof(value));
12494 todo_wine
12495 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
12496 if (SUCCEEDED(hr))
12497 {
12498 ok(value == D2D1_2DAFFINETRANSFORM_INTERPOLATION_MODE_LINEAR, "Unexpected value %u.\n", value);
12500 ARRAY_SIZE(interp_modes));
12501 }
12502
12504 (BYTE *)&value, sizeof(value));
12505 todo_wine
12506 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
12507 if (SUCCEEDED(hr))
12508 {
12509 ok(value == D2D1_BORDER_MODE_SOFT, "Unexpected value %u.\n", value);
12511 ARRAY_SIZE(border_modes));
12512 }
12513
12514 for (i = 0; i < ARRAY_SIZE(effect_2d_affine_tests); ++i)
12515 {
12516 const struct effect_2d_affine_test *test = &effect_2d_affine_tests[i];
12517 winetest_push_context("Test %u", i);
12518
12519 set_size_u(&input_size, test->img_width, test->img_height);
12521 bitmap_desc.pixelFormat.alphaMode = D2D1_ALPHA_MODE_IGNORE;
12522 bitmap_desc.dpiX = 96.0f;
12523 bitmap_desc.dpiY = 96.0f;
12525 bitmap_desc.colorContext = NULL;
12526 hr = ID2D1DeviceContext_CreateBitmap(context, input_size, test->img_data,
12527 sizeof(*test->img_data) * test->img_width, &bitmap_desc, &bitmap);
12528 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
12529
12530 ID2D1Effect_SetInput(effect, 0, (ID2D1Image *)bitmap, FALSE);
12531 hr = ID2D1Effect_SetValue(effect, D2D1_2DAFFINETRANSFORM_PROP_TRANSFORM_MATRIX,
12532 D2D1_PROPERTY_TYPE_MATRIX_3X2, (const BYTE *)test->matrix, sizeof(*test->matrix));
12533 todo_wine
12534 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
12536 {
12537 ID2D1Bitmap1_Release(bitmap);
12539 continue;
12540 }
12541 ID2D1Effect_GetOutput(effect, &output);
12542
12543 hr = ID2D1DeviceContext_GetImageLocalBounds(context, output, &output_bounds);
12544 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
12545 todo_wine
12546 ok(compare_rect(&output_bounds, test->bounds.left, test->bounds.top, test->bounds.right, test->bounds.bottom, 1),
12547 "Got unexpected output bounds {%.8e, %.8e, %.8e, %.8e}, expected {%.8e, %.8e, %.8e, %.8e}.\n",
12548 output_bounds.left, output_bounds.top, output_bounds.right, output_bounds.bottom,
12549 test->bounds.left, test->bounds.top, test->bounds.right, test->bounds.bottom);
12550 if (output_bounds.left == output_bounds.right || output_bounds.top == output_bounds.bottom)
12551 {
12552 ID2D1Image_Release(output);
12553 ID2D1Bitmap1_Release(bitmap);
12555 continue;
12556 }
12557
12558 ID2D1DeviceContext_BeginDraw(context);
12559 ID2D1DeviceContext_Clear(context, 0);
12560 offset.x = 320.0f;
12561 offset.y = 240.0f;
12562 ID2D1DeviceContext_DrawImage(context, output, &offset, NULL, 0, 0);
12563 hr = ID2D1DeviceContext_EndDraw(context, NULL, NULL);
12564 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
12565
12566 x = offset.x + output_bounds.left - 2.0f;
12567 y = offset.y + output_bounds.top - 2.0f;
12568 w = (output_bounds.right - output_bounds.left) + 4.0f;
12569 h = (output_bounds.bottom - output_bounds.top) + 4.0f;
12570 match = compare_figure(&ctx, x, y, w, h, 0xff652e89, 0, test->figure);
12571 todo_wine
12572 ok(match, "Figure does not match.\n");
12573
12574 ID2D1Image_Release(output);
12575 ID2D1Bitmap1_Release(bitmap);
12577 }
12578
12579 ID2D1Effect_Release(effect);
12581}
_STLP_MOVE_TO_STD_NAMESPACE void rotate(_ForwardIter __first, _ForwardIter __middle, _ForwardIter __last)
Definition: _algo.c:519
static void check_enum_property(ID2D1Effect *effect, UINT32 property, const UINT32 *values, UINT32 count)
Definition: d2d1.c:12320
#define check_system_properties(effect)
Definition: d2d1.c:10881
static BOOL compare_rect(const D2D1_RECT_F *rect, float left, float top, float right, float bottom, unsigned int ulps)
Definition: d2d1.c:820
@ D2D1_PROPERTY_TYPE_MATRIX_3X2
Definition: d2d1_1.idl:179
@ D2D1_2DAFFINETRANSFORM_PROP_BORDER_MODE
Definition: d2d1effects.idl:71
@ D2D1_2DAFFINETRANSFORM_PROP_INTERPOLATION_MODE
Definition: d2d1effects.idl:70
@ D2D1_2DAFFINETRANSFORM_PROP_TRANSFORM_MATRIX
Definition: d2d1effects.idl:72
@ D2D1_2DAFFINETRANSFORM_INTERPOLATION_MODE_CUBIC
Definition: d2d1effects.idl:81
@ D2D1_2DAFFINETRANSFORM_INTERPOLATION_MODE_NEAREST_NEIGHBOR
Definition: d2d1effects.idl:79
@ D2D1_2DAFFINETRANSFORM_INTERPOLATION_MODE_MULTI_SAMPLE_LINEAR
Definition: d2d1effects.idl:82
@ D2D1_2DAFFINETRANSFORM_INTERPOLATION_MODE_HIGH_QUALITY_CUBIC
Definition: d2d1effects.idl:84
@ D2D1_2DAFFINETRANSFORM_INTERPOLATION_MODE_LINEAR
Definition: d2d1effects.idl:80
@ D2D1_2DAFFINETRANSFORM_INTERPOLATION_MODE_ANISOTROPIC
Definition: d2d1effects.idl:83
@ D2D1_BORDER_MODE_HARD
Definition: d2d1effects.idl:64
@ D2D1_BORDER_MODE_SOFT
Definition: d2d1effects.idl:63
#define M_PI_4
Definition: math.h:411
GLenum GLenum GLenum GLenum GLenum scale
Definition: glext.h:9032
float top
Definition: dcommon.idl:106
float bottom
Definition: dcommon.idl:108
float right
Definition: dcommon.idl:107
float left
Definition: dcommon.idl:105

Referenced by START_TEST().

◆ test_effect_blob_property()

static void test_effect_blob_property ( BOOL  d3d11)
static

Definition at line 15357 of file d2d1.c.

15358{
15359 static const D2D1_PROPERTY_BINDING bindings[] =
15360 {
15362 };
15363 struct d2d1_test_context ctx;
15365 ID2D1Effect *effect;
15366 UINT32 index, size;
15367 BYTE buffer[64];
15368 HRESULT hr;
15369
15370 if (!init_test_context(&ctx, d3d11))
15371 return;
15372
15373 factory = ctx.factory1;
15374 if (!factory)
15375 {
15376 win_skip("ID2D1Factory1 is not supported.\n");
15378 return;
15379 }
15380
15381 hr = ID2D1Factory1_RegisterEffectFromString(factory, &CLSID_TestEffect,
15382 effect_xml_a, bindings, ARRAY_SIZE(bindings), effect_impl_create);
15383 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
15384
15385 hr = ID2D1DeviceContext_CreateEffect(ctx.context, &CLSID_TestEffect, &effect);
15386 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
15387
15388 index = ID2D1Effect_GetPropertyIndex(effect, L"BlobProp");
15389 ok(index != D2D1_INVALID_PROPERTY_INDEX, "Invalid property index.\n");
15390
15391 size = ID2D1Effect_GetValueSize(effect, index);
15392 ok(!size, "Unexpected property size %u.\n", size);
15393
15394 hr = ID2D1Effect_SetValue(effect, index, D2D1_PROPERTY_TYPE_BLOB,
15395 (const BYTE *)"blob-value", 11);
15396 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
15397
15398 size = ID2D1Effect_GetValueSize(effect, index);
15399 ok(size == 11, "Unexpected property size %u.\n", size);
15400
15401 ID2D1Effect_Release(effect);
15402
15403 /* Without property binding. */
15404 hr = ID2D1Factory1_RegisterEffectFromString(factory, &CLSID_TestEffect2,
15406 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
15407
15408 hr = ID2D1DeviceContext_CreateEffect(ctx.context, &CLSID_TestEffect2, &effect);
15409 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
15410
15411 index = ID2D1Effect_GetPropertyIndex(effect, L"BlobProp");
15412 ok(index != D2D1_INVALID_PROPERTY_INDEX, "Invalid property index.\n");
15413
15414 size = ID2D1Effect_GetValueSize(effect, index);
15415 ok(!size, "Unexpected property size %u.\n", size);
15416
15417 hr = ID2D1Effect_SetValue(effect, index, D2D1_PROPERTY_TYPE_BLOB,
15418 (const BYTE *)"blob-value", 11);
15419 ok(hr == E_INVALIDARG, "Got unexpected hr %#lx.\n", hr);
15420
15421 size = ID2D1Effect_GetValueSize(effect, index);
15422 ok(!size, "Unexpected property size %u.\n", size);
15423
15424 memset(buffer, 0xa, sizeof(buffer));
15425 hr = ID2D1Effect_GetValue(effect, index, D2D1_PROPERTY_TYPE_BLOB, buffer, 4);
15426 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
15427 ok(!*buffer, "Unexpected buffer contents.\n");
15428 ok(!*(buffer+1), "Unexpected buffer contents.\n");
15429 ok(!*(buffer+2), "Unexpected buffer contents.\n");
15430 ok(!*(buffer+3), "Unexpected buffer contents.\n");
15431 ok(*(buffer+4) == 0xa, "Unexpected buffer contents.\n");
15432
15433 hr = ID2D1Effect_SetValue(effect, index, D2D1_PROPERTY_TYPE_BLOB,
15434 (const BYTE *)"new-value", 0);
15435 ok(hr == E_INVALIDARG, "Got unexpected hr %#lx.\n", hr);
15436
15437 hr = ID2D1Effect_SetValue(effect, index, D2D1_PROPERTY_TYPE_BLOB,
15438 (const BYTE *)"new-value", 1);
15439 ok(hr == E_INVALIDARG, "Got unexpected hr %#lx.\n", hr);
15440
15441 size = ID2D1Effect_GetValueSize(effect, index);
15442 ok(!size, "Unexpected property size %u.\n", size);
15443
15444 ID2D1Effect_Release(effect);
15445
15447}
static HRESULT STDMETHODCALLTYPE effect_impl_get_blob(const IUnknown *iface, BYTE *data, UINT32 data_size, UINT32 *actual_size)
Definition: d2d1.c:11334
static const WCHAR * effect_xml_a
Definition: d2d1.c:66
static HRESULT STDMETHODCALLTYPE effect_impl_set_blob(IUnknown *iface, const BYTE *data, UINT32 data_size)
Definition: d2d1.c:11317
@ D2D1_PROPERTY_TYPE_BLOB
Definition: d2d1_1.idl:174
GLuint index
Definition: glext.h:6031

Referenced by START_TEST().

◆ test_effect_context()

static void test_effect_context ( BOOL  d3d11)
static

Definition at line 11659 of file d2d1.c.

11660{
11661 ID2D1EffectContext *effect_context, *effect_context2;
11662 ID2D1Effect *effect = NULL, *effect2 = NULL;
11663 ID2D1DeviceContext *device_context;
11665 struct d2d1_test_context ctx;
11668 ID3D10Blob *vs, *ps;
11669 ULONG refcount;
11670 BOOL loaded;
11671 HRESULT hr;
11672
11673 if (!init_test_context(&ctx, d3d11))
11674 return;
11675
11676 factory = ctx.factory1;
11677 if (!factory)
11678 {
11679 win_skip("ID2D1Factory1 is not supported.\n");
11681 return;
11682 }
11683
11684 hr = D3DCompile(test_vs_code, sizeof(test_vs_code) - 1, "test_vs", NULL, NULL,
11685 "main", "vs_4_0", 0, 0, &vs, NULL);
11686 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
11687
11688 hr = D3DCompile(test_ps_code, sizeof(test_ps_code) - 1, "test_ps", NULL, NULL,
11689 "main", "ps_4_0", 0, 0, &ps, NULL);
11690 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
11691
11692 binding.propertyName = L"Context";
11693 binding.setFunction = NULL;
11694 binding.getFunction = effect_impl_get_context;
11695 hr = ID2D1Factory1_RegisterEffectFromString(factory, &CLSID_TestEffect,
11697 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
11698
11699 hr = ID2D1DeviceContext_CreateEffect(ctx.context, &CLSID_TestEffect, &effect);
11700 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
11701
11702 effect_context = NULL;
11703 hr = ID2D1Effect_GetValueByName(effect, L"Context",
11704 D2D1_PROPERTY_TYPE_IUNKNOWN, (BYTE *)&effect_context, sizeof(effect_context));
11705 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
11706
11707 /* Test shader loading */
11708 loaded = ID2D1EffectContext_IsShaderLoaded(effect_context, &GUID_TestVertexShader);
11709 ok(!loaded, "Unexpected shader loaded state.\n");
11710 loaded = ID2D1EffectContext_IsShaderLoaded(effect_context, &GUID_TestPixelShader);
11711 ok(!loaded, "Unexpected shader loaded state.\n");
11712
11713 hr = ID2D1EffectContext_LoadVertexShader(effect_context,
11714 &GUID_TestVertexShader, ID3D10Blob_GetBufferPointer(ps), ID3D10Blob_GetBufferSize(ps));
11715 ok(hr == E_INVALIDARG, "Got unexpected hr %#lx.\n", hr);
11716 hr = ID2D1EffectContext_LoadVertexShader(effect_context,
11717 &GUID_TestVertexShader, ID3D10Blob_GetBufferPointer(vs), ID3D10Blob_GetBufferSize(vs));
11718 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
11719 loaded = ID2D1EffectContext_IsShaderLoaded(effect_context, &GUID_TestVertexShader);
11720 ok(loaded, "Unexpected shader loaded state.\n");
11721
11722 hr = ID2D1EffectContext_LoadVertexShader(effect_context,
11723 &GUID_TestVertexShader, ID3D10Blob_GetBufferPointer(ps), ID3D10Blob_GetBufferSize(ps));
11724 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
11725 hr = ID2D1EffectContext_LoadVertexShader(effect_context,
11726 &GUID_TestVertexShader, ID3D10Blob_GetBufferPointer(vs), ID3D10Blob_GetBufferSize(vs));
11727 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
11728
11729 hr = ID2D1EffectContext_LoadPixelShader(effect_context,
11730 &GUID_TestPixelShader, ID3D10Blob_GetBufferPointer(vs), ID3D10Blob_GetBufferSize(vs));
11731 ok(hr == E_INVALIDARG, "Got unexpected hr %#lx.\n", hr);
11732 hr = ID2D1EffectContext_LoadPixelShader(effect_context,
11733 &GUID_TestPixelShader, ID3D10Blob_GetBufferPointer(ps), ID3D10Blob_GetBufferSize(ps));
11734 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
11735 loaded = ID2D1EffectContext_IsShaderLoaded(effect_context, &GUID_TestPixelShader);
11736 ok(loaded, "Unexpected shader loaded state.\n");
11737
11738 /* Same shader id, using different context. */
11739 hr = ID2D1DeviceContext_CreateEffect(ctx.context, &CLSID_TestEffect, &effect2);
11740 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
11741
11742 effect_context2 = NULL;
11743 hr = ID2D1Effect_GetValueByName(effect2, L"Context",
11744 D2D1_PROPERTY_TYPE_IUNKNOWN, (BYTE *)&effect_context2, sizeof(effect_context2));
11745 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
11746
11747 loaded = ID2D1EffectContext_IsShaderLoaded(effect_context2, &GUID_TestPixelShader);
11748 ok(loaded, "Unexpected shader loaded state.\n");
11749
11750 ID2D1Effect_Release(effect2);
11751
11752 /* Same shader id, using different device. */
11753 hr = ID2D1Factory1_CreateDevice(factory, ctx.device, &device);
11754 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
11755
11756 hr = ID2D1Device_CreateDeviceContext(device, D2D1_DEVICE_CONTEXT_OPTIONS_NONE, &device_context);
11757 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
11758
11759 hr = ID2D1DeviceContext_CreateEffect(device_context, &CLSID_TestEffect, &effect2);
11760 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
11761
11762 effect_context = NULL;
11763 hr = ID2D1Effect_GetValueByName(effect2, L"Context",
11764 D2D1_PROPERTY_TYPE_IUNKNOWN, (BYTE *)&effect_context, sizeof(effect_context));
11765 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
11766
11767 loaded = ID2D1EffectContext_IsShaderLoaded(effect_context, &GUID_TestPixelShader);
11768 ok(!loaded, "Unexpected shader loaded state.\n");
11769
11770 ID2D1Effect_Release(effect2);
11771
11772 ID2D1DeviceContext_Release(device_context);
11773 ID2D1Device_Release(device);
11774
11775 /* Release all created effects, check shader map. */
11776 refcount = ID2D1Effect_Release(effect);
11777 ok(!refcount, "Unexpected refcount %lu.\n", refcount);
11778
11779 hr = ID2D1DeviceContext_CreateEffect(ctx.context, &CLSID_TestEffect, &effect);
11780 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
11781
11782 effect_context = NULL;
11783 hr = ID2D1Effect_GetValueByName(effect, L"Context",
11784 D2D1_PROPERTY_TYPE_IUNKNOWN, (BYTE *)&effect_context, sizeof(effect_context));
11785 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
11786
11787 loaded = ID2D1EffectContext_IsShaderLoaded(effect_context, &GUID_TestPixelShader);
11788 ok(loaded, "Unexpected shader loaded state.\n");
11789
11790 ID2D1Effect_Release(effect);
11791
11792 hr = ID2D1Factory1_UnregisterEffect(factory, &CLSID_TestEffect);
11793 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
11794
11795 ID3D10Blob_Release(vs);
11796 ID3D10Blob_Release(ps);
11797
11799}
static const char test_ps_code[]
Definition: d2d1.c:292
static const char test_vs_code[]
Definition: d2d1.c:286
BOOL loaded
Definition: xmlview.c:54
static vector_t * vs
Definition: server.c:146

Referenced by START_TEST().

◆ test_effect_crop()

static void test_effect_crop ( BOOL  d3d11)
static

Definition at line 12583 of file d2d1.c.

12584{
12585 D2D1_BITMAP_PROPERTIES1 bitmap_desc;
12586 struct d2d1_test_context ctx;
12588 D2D_RECT_F output_bounds;
12589 D2D1_SIZE_U input_size;
12591 unsigned int count, i;
12593 DWORD image[16 * 16];
12594 ID2D1Effect *effect;
12595 ID2D1Image *output;
12596 HRESULT hr;
12597
12598 const struct crop_effect_test
12599 {
12600 D2D_VECTOR_4F crop_rect; /* {x: left, y: top, z: right, w: bottom} */
12601 D2D_RECT_F bounds;
12602 }
12603 crop_effect_tests[] =
12604 {
12605 {{0.0f, 0.0f, 8.0f, 8.0f}, {0.0f, 0.0f, 8.0f, 8.0f}},
12606 {{4.0f, 4.0f, 8.0f, 8.0f}, {4.0f, 4.0f, 8.0f, 8.0f}},
12607 {{10.0f, 10.0f, 20.0f, 20.0f}, {10.0f, 10.0f, 16.0f, 16.0f}},
12608 {{-10.0f, 10.0f, 20.0f, 12.0f}, {0.0f, 10.0f, 16.0f, 12.0f}},
12609 {{3.0f, -2.0f, 5.0f, 1.0f}, {3.0f, 0.0f, 5.0f, 1.0f}},
12610 {{-1.0f, -1.0f, 20.0f, 20.0f}, {0.0f, 0.0f, 16.0f, 16.0f}},
12611 {{-5.0f, -5.0f, -1.0f, -1.0f}, {0.0f, 0.0f, 0.0f, 0.0f}},
12612 };
12613 memset(image, 0xff, sizeof(image));
12614
12615 if (!init_test_context(&ctx, d3d11))
12616 return;
12617
12618 factory = ctx.factory1;
12619 if (!factory)
12620 {
12621 win_skip("ID2D1Factory1 is not supported.\n");
12623 return;
12624 }
12625
12626 context = ctx.context;
12627
12628 hr = ID2D1DeviceContext_CreateEffect(context, &CLSID_D2D1Crop, &effect);
12629 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
12630
12632
12633 count = ID2D1Effect_GetPropertyCount(effect);
12634 todo_wine ok(count == 2, "Got unexpected property count %u.\n", count);
12635
12636 for (i = 0; i < ARRAY_SIZE(crop_effect_tests); ++i)
12637 {
12638 const struct crop_effect_test *test = &crop_effect_tests[i];
12639 winetest_push_context("Test %u", i);
12640
12641 set_size_u(&input_size, 16, 16);
12643 bitmap_desc.pixelFormat.alphaMode = D2D1_ALPHA_MODE_IGNORE;
12644 bitmap_desc.dpiX = 96.0f;
12645 bitmap_desc.dpiY = 96.0f;
12647 bitmap_desc.colorContext = NULL;
12648 hr = ID2D1DeviceContext_CreateBitmap(context, input_size, image,
12649 sizeof(*image) * 16, &bitmap_desc, &bitmap);
12650 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
12651
12652 ID2D1Effect_SetInput(effect, 0, (ID2D1Image *)bitmap, FALSE);
12653 hr = ID2D1Effect_SetValue(effect, D2D1_CROP_PROP_RECT, D2D1_PROPERTY_TYPE_VECTOR4,
12654 (const BYTE *)&test->crop_rect, sizeof(test->crop_rect));
12655 todo_wine
12656 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
12658 {
12659 ID2D1Bitmap1_Release(bitmap);
12661 continue;
12662 }
12663 ID2D1Effect_GetOutput(effect, &output);
12664
12665 set_rect(&output_bounds, -1.0f, -1.0f, -1.0f, -1.0f);
12666 hr = ID2D1DeviceContext_GetImageLocalBounds(context, output, &output_bounds);
12667 todo_wine
12668 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
12669 todo_wine
12670 ok(compare_rect(&output_bounds, test->bounds.left, test->bounds.top, test->bounds.right, test->bounds.bottom, 0),
12671 "Got unexpected output bounds {%.8e, %.8e, %.8e, %.8e}, expected {%.8e, %.8e, %.8e, %.8e}.\n",
12672 output_bounds.left, output_bounds.top, output_bounds.right, output_bounds.bottom,
12673 test->bounds.left, test->bounds.top, test->bounds.right, test->bounds.bottom);
12674
12675 ID2D1Image_Release(output);
12676 ID2D1Bitmap1_Release(bitmap);
12678 }
12679
12680 ID2D1Effect_Release(effect);
12682}
@ D2D1_CROP_PROP_RECT

Referenced by START_TEST().

◆ test_effect_custom_pixel_shader()

static void test_effect_custom_pixel_shader ( BOOL  d3d11)
static

Definition at line 14773 of file d2d1.c.

14774{
14775 static const WCHAR *description =
14776 L"<?xml version='1.0'?> \
14777 <Effect> \
14778 <Property name='DisplayName' type='string' value='PSEffect'/> \
14779 <Property name='Author' type='string' value='The Wine Project'/> \
14780 <Property name='Category' type='string' value='Test'/> \
14781 <Property name='Description' type='string' value='Test effect.'/> \
14782 <Inputs> \
14783 <Input name='Source'/> \
14784 </Inputs> \
14785 <Property name='Context' type='iunknown'> \
14786 <Property name='DisplayName' type='string' value='Context'/> \
14787 </Property> \
14788 </Effect> \
14789 ";
14790
14791 static const char ps_code[] =
14792 "float4 main() : sv_target\n"
14793 "{\n"
14794 " return float4(0.1, 0.2, 0.3, 0.4);\n"
14795 "}";
14796
14797 D2D1_PROPERTY_BINDING bindings[1] = { 0 };
14798 D2D1_BITMAP_PROPERTIES1 bitmap_desc;
14799 DWORD colour, expected_colour;
14800 struct d2d1_test_context ctx;
14801 struct resource_readback rb;
14803 D2D1_SIZE_U input_size;
14806 ID2D1Effect *effect;
14807 ID2D1Image *output;
14808 DWORD pixel;
14809 HRESULT hr;
14810
14811 if (!init_test_context(&ctx, d3d11))
14812 return;
14813
14814 context = ctx.context;
14815 factory = ctx.factory1;
14816 if (!factory)
14817 {
14818 win_skip("ID2D1Factory1 is not supported.\n");
14820 return;
14821 }
14822
14823 preload_shader("ps_4_0", ps_code, &GUID_TestPixelShader, &ctx);
14824
14825 bindings[0].propertyName = L"Context";
14827 hr = ID2D1Factory1_RegisterEffectFromString(factory, &CLSID_TestEffect, description, bindings,
14829 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
14830
14831 hr = ID2D1DeviceContext_CreateEffect(context, &CLSID_TestEffect, &effect);
14832 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
14833
14834 set_size_u(&input_size, 1, 1);
14835 pixel = 0xabcd00ff;
14837 bitmap_desc.pixelFormat.alphaMode = D2D1_ALPHA_MODE_IGNORE;
14838 bitmap_desc.dpiX = 96.0f;
14839 bitmap_desc.dpiY = 96.0f;
14841 bitmap_desc.colorContext = NULL;
14842 hr = ID2D1DeviceContext_CreateBitmap(context, input_size, &pixel, sizeof(pixel),
14843 &bitmap_desc, &bitmap);
14844 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
14845
14846 ID2D1Effect_SetInput(effect, 0, (ID2D1Image *)bitmap, FALSE);
14847 ID2D1Effect_GetOutput(effect, &output);
14848
14849 ID2D1DeviceContext_BeginDraw(context);
14850 ID2D1DeviceContext_Clear(context, 0);
14851 ID2D1DeviceContext_DrawImage(context, output, NULL, NULL, 0, 0);
14852 hr = ID2D1DeviceContext_EndDraw(context, NULL, NULL);
14853 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
14854
14856 colour = get_readback_colour(&rb, 0, 0);
14857 expected_colour = 0x661a334c;
14858 todo_wine ok(compare_colour(colour, expected_colour, 1),
14859 "Got unexpected colour %#lx, expected %#lx.\n", colour, expected_colour);
14861
14862 ID2D1Image_Release(output);
14863 ID2D1Bitmap1_Release(bitmap);
14864
14865 ID2D1Effect_Release(effect);
14866
14868}
static HRESULT STDMETHODCALLTYPE custom_effect_impl_create(IUnknown **effect_impl)
Definition: d2d1.c:14720
static void preload_shader(const char *target, const char *code, const GUID *id, struct d2d1_test_context *ctx)
Definition: d2d1.c:14725
static DWORD get_readback_colour(struct resource_readback *rb, unsigned int x, unsigned int y)
Definition: d2d1.c:768
static BOOL compare_colour(DWORD c1, DWORD c2, BYTE max_diff)
Definition: d2d1.c:785

Referenced by START_TEST().

◆ test_effect_grayscale()

static void test_effect_grayscale ( BOOL  d3d11)
static

Definition at line 12684 of file d2d1.c.

12685{
12686 DWORD colour, expected_colour, luminance;
12687 D2D1_BITMAP_PROPERTIES1 bitmap_desc;
12688 struct d2d1_test_context ctx;
12689 struct resource_readback rb;
12691 D2D1_SIZE_U input_size;
12693 unsigned int count, i;
12695 ID2D1Effect *effect;
12696 ID2D1Image *output;
12697 HRESULT hr;
12698
12699 const DWORD test_pixels[] = {0xffffffff, 0x12345678, 0x89abcdef, 0x77777777, 0xdeadbeef};
12700
12701 if (!init_test_context(&ctx, d3d11))
12702 return;
12703
12704 factory = ctx.factory3;
12705 if (!factory)
12706 {
12707 win_skip("ID2D1Factory3 is not supported.\n");
12709 return;
12710 }
12711
12712 context = ctx.context;
12713
12714 hr = ID2D1DeviceContext_CreateEffect(context, &CLSID_D2D1Grayscale, &effect);
12715 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
12716
12718
12719 count = ID2D1Effect_GetPropertyCount(effect);
12720 ok(!count, "Got unexpected property count %u.\n", count);
12721
12722 for (i = 0; i < ARRAY_SIZE(test_pixels); ++i)
12723 {
12724 DWORD pixel = test_pixels[i];
12725 winetest_push_context("Test %u", i);
12726
12727 set_size_u(&input_size, 1, 1);
12729 bitmap_desc.pixelFormat.alphaMode = D2D1_ALPHA_MODE_IGNORE;
12730 bitmap_desc.dpiX = 96.0f;
12731 bitmap_desc.dpiY = 96.0f;
12733 bitmap_desc.colorContext = NULL;
12734 hr = ID2D1DeviceContext_CreateBitmap(context, input_size, &pixel, sizeof(pixel), &bitmap_desc, &bitmap);
12735 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
12736
12737 ID2D1Effect_SetInput(effect, 0, (ID2D1Image *)bitmap, FALSE);
12738 ID2D1Effect_GetOutput(effect, &output);
12739
12740 ID2D1DeviceContext_BeginDraw(context);
12741 ID2D1DeviceContext_Clear(context, 0);
12742 ID2D1DeviceContext_DrawImage(context, output, NULL, NULL, 0, 0);
12743 hr = ID2D1DeviceContext_EndDraw(context, NULL, NULL);
12744 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
12745
12747 colour = get_readback_colour(&rb, 0, 0);
12748 luminance = (DWORD)(0.299f * ((pixel >> 16) & 0xff)
12749 + 0.587f * ((pixel >> 8) & 0xff)
12750 + 0.114f * ((pixel >> 0) & 0xff) + 0.5f);
12751 expected_colour = (pixel & 0xff000000) | (luminance << 16) | (luminance << 8) | luminance;
12752 todo_wine ok(compare_colour(colour, expected_colour, 1),
12753 "Got unexpected colour %#lx, expected %#lx.\n", colour, expected_colour);
12755
12756 ID2D1Image_Release(output);
12757 ID2D1Bitmap1_Release(bitmap);
12759 }
12760
12761 ID2D1Effect_Release(effect);
12763}
#define DWORD
Definition: nt_native.h:44

Referenced by START_TEST().

◆ test_effect_properties()

static void test_effect_properties ( BOOL  d3d11)
static

Definition at line 11814 of file d2d1.c.

11815{
11816 UINT32 i, min_inputs, max_inputs, integer, index, size;
11817 ID2D1EffectContext *effect_context;
11819 ID2D1Properties *subproperties;
11820 D2D1_PROPERTY_TYPE prop_type;
11821 struct d2d1_test_context ctx;
11822 D2D_MATRIX_3X2_F mat3x2;
11823 D2D_MATRIX_4X3_F mat4x3;
11824 D2D_MATRIX_4X4_F mat4x4;
11825 D2D_MATRIX_5X4_F mat5x4;
11827 ID2D1Effect *effect;
11828 UINT32 count, data;
11832 WCHAR buffer[128];
11833 BYTE value[128];
11834 CLSID clsid;
11835 BOOL cached;
11836 HRESULT hr;
11837 float *ptr;
11838 INT32 val;
11839
11840 static const WCHAR *effect_author = L"The Wine Project";
11841 static const WCHAR *effect_category = L"Test";
11842 static const WCHAR *effect_description = L"Test effect.";
11843
11845 {
11847 {L"Context", NULL, effect_impl_get_context},
11848 };
11849
11850 const struct system_property_test
11851 {
11852 const WCHAR *xml;
11853 const WCHAR *display_name;
11854 const WCHAR *author;
11855 const WCHAR *category;
11856 const WCHAR *description;
11857 UINT32 min_inputs;
11858 UINT32 max_inputs;
11859 }
11860 system_property_tests[] =
11861 {
11862 {effect_xml_a, L"TestEffectA", effect_author, effect_category, effect_description, 1, 1},
11863 {effect_xml_b, L"TestEffectB", effect_author, effect_category, effect_description, 1, 1},
11864 {effect_xml_c, L"TestEffectC", effect_author, effect_category, effect_description, 1, 1},
11865 {effect_xml_minimum, L"", L"" ,L"", L"", 0, 0},
11866 };
11867
11868 if (!init_test_context(&ctx, d3d11))
11869 return;
11870
11871 factory = ctx.factory1;
11872 if (!factory)
11873 {
11874 win_skip("ID2D1Factory1 is not supported.\n");
11876 return;
11877 }
11878
11879 /* Inputs array */
11880 hr = ID2D1Factory1_RegisterEffectFromString(factory, &CLSID_TestEffect, effect_xml_a,
11882 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
11883
11884 hr = ID2D1DeviceContext_CreateEffect(ctx.context, &CLSID_TestEffect, &effect);
11885 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
11886
11887 size = ID2D1Effect_GetValueSize(effect, D2D1_PROPERTY_INPUTS);
11888 ok(size == 4, "Unexpected size %u.\n", size);
11889 prop_type = ID2D1Effect_GetType(effect, D2D1_PROPERTY_INPUTS);
11890 ok(prop_type == D2D1_PROPERTY_TYPE_ARRAY, "Unexpected type %u.\n", prop_type);
11891 hr = ID2D1Effect_GetPropertyName(effect, D2D1_PROPERTY_INPUTS, buffer, ARRAY_SIZE(buffer));
11892 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
11893 ok(!wcscmp(buffer, L"Inputs"), "Unexpected name %s.\n", wine_dbgstr_w(buffer));
11894
11895 /* Value is the number of elements. */
11896 data = 123;
11897 hr = ID2D1Effect_GetValue(effect, D2D1_PROPERTY_INPUTS, D2D1_PROPERTY_TYPE_ARRAY,
11898 (BYTE *)&data, sizeof(data));
11899 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
11900 ok(data == 1, "Unexpected data %u.\n", data);
11901
11902 hr = ID2D1Effect_GetSubProperties(effect, D2D1_PROPERTY_INPUTS, &subproperties);
11903 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
11904
11905 count = ID2D1Properties_GetPropertyCount(subproperties);
11906 ok(count == 1, "Unexpected count %u.\n", count);
11907
11908 hr = ID2D1Properties_GetPropertyName(subproperties, 0, buffer, ARRAY_SIZE(buffer));
11909 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
11910 ok(!wcscmp(buffer, L"0"), "Unexpected name %s.\n", wine_dbgstr_w(buffer));
11911 hr = ID2D1Properties_GetValue(subproperties, 0, D2D1_PROPERTY_TYPE_STRING,
11912 (BYTE *)buffer, sizeof(buffer));
11913 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
11914 ok(!wcscmp(buffer, L"Source"), "Unexpected value %s.\n", wine_dbgstr_w(buffer));
11915
11916 hr = ID2D1Properties_GetValue(subproperties, D2D1_SUBPROPERTY_ISREADONLY, D2D1_PROPERTY_TYPE_BOOL,
11917 (BYTE *)&data, sizeof(data));
11918 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
11919 ok(data == TRUE, "Unexpected value %u.\n", data);
11920 hr = ID2D1Properties_GetPropertyName(subproperties, D2D1_SUBPROPERTY_ISREADONLY,
11922 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
11923 ok(!wcscmp(buffer, L"IsReadOnly"), "Unexpected name %s.\n", wine_dbgstr_w(buffer));
11924
11925 ID2D1Properties_Release(subproperties);
11926
11927 /* Int32 property. */
11928 index = ID2D1Effect_GetPropertyIndex(effect, L"Int32Prop");
11929 hr = ID2D1Effect_GetPropertyName(effect, index, buffer, ARRAY_SIZE(buffer));
11930 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
11931 ok(!wcscmp(buffer, L"Int32Prop"), "Unexpected name %s.\n", wine_dbgstr_w(buffer));
11932 prop_type = ID2D1Effect_GetType(effect, index);
11933 ok(prop_type == D2D1_PROPERTY_TYPE_INT32, "Unexpected type %u.\n", prop_type);
11934 hr = ID2D1Effect_GetValue(effect, index, D2D1_PROPERTY_TYPE_INT32, (BYTE *)&val, sizeof(val));
11935 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
11936 ok(val == -2, "Unexpected value %d.\n", val);
11937
11938 /* Int32 property, hex literal. */
11939 index = ID2D1Effect_GetPropertyIndex(effect, L"Int32PropHex");
11940 hr = ID2D1Effect_GetPropertyName(effect, index, buffer, ARRAY_SIZE(buffer));
11941 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
11942 ok(!wcscmp(buffer, L"Int32PropHex"), "Unexpected name %s.\n", wine_dbgstr_w(buffer));
11943 prop_type = ID2D1Effect_GetType(effect, index);
11944 ok(prop_type == D2D1_PROPERTY_TYPE_INT32, "Unexpected type %u.\n", prop_type);
11945 hr = ID2D1Effect_GetValue(effect, index, D2D1_PROPERTY_TYPE_INT32, (BYTE *)&val, sizeof(val));
11946 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
11947 ok(val == -65535, "Unexpected value %d.\n", val);
11948
11949 /* Int32 property, octal literal. */
11950 index = ID2D1Effect_GetPropertyIndex(effect, L"Int32PropOct");
11951 hr = ID2D1Effect_GetPropertyName(effect, index, buffer, ARRAY_SIZE(buffer));
11952 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
11953 ok(!wcscmp(buffer, L"Int32PropOct"), "Unexpected name %s.\n", wine_dbgstr_w(buffer));
11954 prop_type = ID2D1Effect_GetType(effect, index);
11955 ok(prop_type == D2D1_PROPERTY_TYPE_INT32, "Unexpected type %u.\n", prop_type);
11956 hr = ID2D1Effect_GetValue(effect, index, D2D1_PROPERTY_TYPE_INT32, (BYTE *)&val, sizeof(val));
11957 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
11958 ok(val == 10, "Unexpected value %d.\n", val);
11959
11960 /* UInt32 property. */
11961 index = ID2D1Effect_GetPropertyIndex(effect, L"UInt32Prop");
11962 hr = ID2D1Effect_GetPropertyName(effect, index, buffer, ARRAY_SIZE(buffer));
11963 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
11964 ok(!wcscmp(buffer, L"UInt32Prop"), "Unexpected name %s.\n", wine_dbgstr_w(buffer));
11965 prop_type = ID2D1Effect_GetType(effect, index);
11966 ok(prop_type == D2D1_PROPERTY_TYPE_UINT32, "Unexpected type %u.\n", prop_type);
11967 hr = ID2D1Effect_GetValue(effect, index, D2D1_PROPERTY_TYPE_UINT32, (BYTE *)&integer, sizeof(integer));
11968 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
11969 ok(integer == -3, "Unexpected value %u.\n", integer);
11970
11971 /* UInt32 property, hex literal. */
11972 index = ID2D1Effect_GetPropertyIndex(effect, L"UInt32PropHex");
11973 hr = ID2D1Effect_GetPropertyName(effect, index, buffer, ARRAY_SIZE(buffer));
11974 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
11975 ok(!wcscmp(buffer, L"UInt32PropHex"), "Unexpected name %s.\n", wine_dbgstr_w(buffer));
11976 prop_type = ID2D1Effect_GetType(effect, index);
11977 ok(prop_type == D2D1_PROPERTY_TYPE_UINT32, "Unexpected type %u.\n", prop_type);
11978 hr = ID2D1Effect_GetValue(effect, index, D2D1_PROPERTY_TYPE_UINT32, (BYTE *)&integer, sizeof(integer));
11979 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
11980 ok(integer == 0xfff, "Unexpected value %x.\n", integer);
11981
11982 /* Vector2 property. */
11983 index = ID2D1Effect_GetPropertyIndex(effect, L"Vec2Prop");
11984 hr = ID2D1Effect_GetPropertyName(effect, index, buffer, ARRAY_SIZE(buffer));
11985 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
11986 ok(!wcscmp(buffer, L"Vec2Prop"), "Unexpected name %s.\n", wine_dbgstr_w(buffer));
11987 prop_type = ID2D1Effect_GetType(effect, index);
11988 ok(prop_type == D2D1_PROPERTY_TYPE_VECTOR2, "Unexpected type %u.\n", prop_type);
11989 hr = ID2D1Effect_GetValue(effect, index, D2D1_PROPERTY_TYPE_VECTOR2, (BYTE *)&vec2, sizeof(vec2));
11990 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
11991 ok(vec2.x == 3.0f, "Unexpected value %.8e.\n", vec2.x);
11992 ok(vec2.y == 4.0f, "Unexpected value %.8e.\n", vec2.y);
11993
11994 /* Vector3 property. */
11995 index = ID2D1Effect_GetPropertyIndex(effect, L"Vec3Prop");
11996 hr = ID2D1Effect_GetPropertyName(effect, index, buffer, ARRAY_SIZE(buffer));
11997 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
11998 ok(!wcscmp(buffer, L"Vec3Prop"), "Unexpected name %s.\n", wine_dbgstr_w(buffer));
11999 prop_type = ID2D1Effect_GetType(effect, index);
12000 ok(prop_type == D2D1_PROPERTY_TYPE_VECTOR3, "Unexpected type %u.\n", prop_type);
12001 hr = ID2D1Effect_GetValue(effect, index, D2D1_PROPERTY_TYPE_VECTOR3, (BYTE *)&vec3, sizeof(vec3));
12002 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
12003 ok(vec3.x == 5.0f, "Unexpected value %.8e.\n", vec3.x);
12004 ok(vec3.y == 6.0f, "Unexpected value %.8e.\n", vec3.y);
12005 ok(vec3.z == 7.0f, "Unexpected value %.8e.\n", vec3.z);
12006
12007 /* Vector4 property. */
12008 index = ID2D1Effect_GetPropertyIndex(effect, L"Vec4Prop");
12009 hr = ID2D1Effect_GetPropertyName(effect, index, buffer, ARRAY_SIZE(buffer));
12010 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
12011 ok(!wcscmp(buffer, L"Vec4Prop"), "Unexpected name %s.\n", wine_dbgstr_w(buffer));
12012 prop_type = ID2D1Effect_GetType(effect, index);
12013 ok(prop_type == D2D1_PROPERTY_TYPE_VECTOR4, "Unexpected type %u.\n", prop_type);
12014 hr = ID2D1Effect_GetValue(effect, index, D2D1_PROPERTY_TYPE_VECTOR4, (BYTE *)&vec4, sizeof(vec4));
12015 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
12016 ok(vec4.x == 8.0f, "Unexpected value %.8e.\n", vec4.x);
12017 ok(vec4.y == 9.0f, "Unexpected value %.8e.\n", vec4.y);
12018 ok(vec4.z == 10.0f, "Unexpected value %.8e.\n", vec4.z);
12019 ok(vec4.w == 11.0f, "Unexpected value %.8e.\n", vec4.w);
12020
12021 /* Matrix3x2 property. */
12022 index = ID2D1Effect_GetPropertyIndex(effect, L"Mat3x2Prop");
12023 hr = ID2D1Effect_GetPropertyName(effect, index, buffer, ARRAY_SIZE(buffer));
12024 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
12025 ok(!wcscmp(buffer, L"Mat3x2Prop"), "Unexpected name %s.\n", wine_dbgstr_w(buffer));
12026 prop_type = ID2D1Effect_GetType(effect, index);
12027 ok(prop_type == D2D1_PROPERTY_TYPE_MATRIX_3X2, "Unexpected type %u.\n", prop_type);
12028 hr = ID2D1Effect_GetValue(effect, index, D2D1_PROPERTY_TYPE_MATRIX_3X2, (BYTE *)&mat3x2, sizeof(mat3x2));
12029 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
12030 for (i = 0, ptr = (float *)&mat3x2; i < sizeof(mat3x2) / sizeof(*ptr); ++i, ++ptr)
12031 ok(*ptr == 1.0f + i, "Unexpected value %.8e.\n", *ptr);
12032
12033 /* Matrix4x3 property. */
12034 index = ID2D1Effect_GetPropertyIndex(effect, L"Mat4x3Prop");
12035 hr = ID2D1Effect_GetPropertyName(effect, index, buffer, ARRAY_SIZE(buffer));
12036 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
12037 ok(!wcscmp(buffer, L"Mat4x3Prop"), "Unexpected name %s.\n", wine_dbgstr_w(buffer));
12038 prop_type = ID2D1Effect_GetType(effect, index);
12039 ok(prop_type == D2D1_PROPERTY_TYPE_MATRIX_4X3, "Unexpected type %u.\n", prop_type);
12040 hr = ID2D1Effect_GetValue(effect, index, D2D1_PROPERTY_TYPE_MATRIX_4X3, (BYTE *)&mat4x3, sizeof(mat4x3));
12041 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
12042 for (i = 0, ptr = (float *)&mat4x3; i < sizeof(mat4x3) / sizeof(*ptr); ++i, ++ptr)
12043 ok(*ptr == 1.0f + i, "Unexpected value %.8e.\n", *ptr);
12044
12045 /* Matrix4x4 property. */
12046 index = ID2D1Effect_GetPropertyIndex(effect, L"Mat4x4Prop");
12047 hr = ID2D1Effect_GetPropertyName(effect, index, buffer, ARRAY_SIZE(buffer));
12048 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
12049 ok(!wcscmp(buffer, L"Mat4x4Prop"), "Unexpected name %s.\n", wine_dbgstr_w(buffer));
12050 prop_type = ID2D1Effect_GetType(effect, index);
12051 ok(prop_type == D2D1_PROPERTY_TYPE_MATRIX_4X4, "Unexpected type %u.\n", prop_type);
12052 hr = ID2D1Effect_GetValue(effect, index, D2D1_PROPERTY_TYPE_MATRIX_4X4, (BYTE *)&mat4x4, sizeof(mat4x4));
12053 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
12054 for (i = 0, ptr = (float *)&mat4x4; i < sizeof(mat4x4) / sizeof(*ptr); ++i, ++ptr)
12055 ok(*ptr == 1.0f + i, "Unexpected value %.8e.\n", *ptr);
12056
12057 /* Matrix5x4 property. */
12058 index = ID2D1Effect_GetPropertyIndex(effect, L"Mat5x4Prop");
12059 hr = ID2D1Effect_GetPropertyName(effect, index, buffer, ARRAY_SIZE(buffer));
12060 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
12061 ok(!wcscmp(buffer, L"Mat5x4Prop"), "Unexpected name %s.\n", wine_dbgstr_w(buffer));
12062 prop_type = ID2D1Effect_GetType(effect, index);
12063 ok(prop_type == D2D1_PROPERTY_TYPE_MATRIX_5X4, "Unexpected type %u.\n", prop_type);
12064 hr = ID2D1Effect_GetValue(effect, index, D2D1_PROPERTY_TYPE_MATRIX_5X4, (BYTE *)&mat5x4, sizeof(mat5x4));
12065 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
12066 for (i = 0, ptr = (float *)&mat5x4; i < sizeof(mat5x4) / sizeof(*ptr); ++i, ++ptr)
12067 ok(*ptr == 1.0f + i, "Unexpected value %.8e.\n", *ptr);
12068
12069 ID2D1Effect_Release(effect);
12070
12071 hr = ID2D1Factory1_UnregisterEffect(factory, &CLSID_TestEffect);
12072 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
12073
12074 /* Test system properties */
12075
12076 for (i = 0; i < ARRAY_SIZE(system_property_tests); ++i)
12077 {
12078 const struct system_property_test *test = &system_property_tests[i];
12079 winetest_push_context("Test %u", i);
12080
12081 hr = ID2D1Factory1_RegisterEffectFromString(factory, &CLSID_TestEffect, test->xml, NULL, 0, effect_impl_create);
12082 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
12083
12084 effect = NULL;
12085 hr = ID2D1DeviceContext_CreateEffect(ctx.context, &CLSID_TestEffect, &effect);
12086 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
12087
12089
12090 hr = ID2D1Effect_GetValue(effect, D2D1_PROPERTY_CLSID,
12092 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
12093 ok(IsEqualGUID(&clsid, &CLSID_TestEffect), "Got unexpected clsid %s, expected %s.\n",
12094 debugstr_guid(&clsid), debugstr_guid(&CLSID_TestEffect));
12095
12096 hr = ID2D1Effect_GetValue(effect, D2D1_PROPERTY_DISPLAYNAME,
12098 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
12099 ok(!wcscmp(buffer, test->display_name), "Got unexpected display name %s, expected %s.\n",
12100 debugstr_w(buffer), debugstr_w(test->display_name));
12101
12102 hr = ID2D1Effect_GetValue(effect, D2D1_PROPERTY_AUTHOR,
12104 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
12105 ok(!wcscmp(buffer, test->author), "Got unexpected author %s, expected %s.\n",
12106 debugstr_w(buffer), debugstr_w(test->author));
12107
12108 hr = ID2D1Effect_GetValue(effect, D2D1_PROPERTY_CATEGORY,
12110 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
12111 ok(!wcscmp(buffer, test->category), "Got unexpected category %s, expected %s.\n",
12112 debugstr_w(buffer), debugstr_w(test->category));
12113
12114 hr = ID2D1Effect_GetValue(effect, D2D1_PROPERTY_DESCRIPTION,
12116 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
12117 ok(!wcscmp(buffer, test->description), "Got unexpected description %s, expected %s.\n",
12118 debugstr_w(buffer), debugstr_w(test->description));
12119
12120 hr = ID2D1Effect_GetValue(effect, D2D1_PROPERTY_CACHED,
12121 D2D1_PROPERTY_TYPE_BOOL, (BYTE *)&cached, sizeof(cached));
12122 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
12123 ok(cached == FALSE, "Got unexpected cached %d.\n", cached);
12124
12125 hr = ID2D1Effect_GetValue(effect, D2D1_PROPERTY_PRECISION,
12127 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
12128 ok(precision == D2D1_BUFFER_PRECISION_UNKNOWN, "Got unexpected precision %#x.\n", precision);
12129
12130 hr = ID2D1Effect_GetValue(effect, D2D1_PROPERTY_MIN_INPUTS,
12131 D2D1_PROPERTY_TYPE_UINT32, (BYTE *)&min_inputs, sizeof(min_inputs));
12132 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
12133 ok(min_inputs == test->min_inputs, "Got unexpected min inputs %u, expected %u.\n",
12134 min_inputs, test->min_inputs);
12135
12136 hr = ID2D1Effect_GetValue(effect, D2D1_PROPERTY_MAX_INPUTS,
12137 D2D1_PROPERTY_TYPE_UINT32, (BYTE *)&max_inputs, sizeof(max_inputs));
12138 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
12139 ok(max_inputs == test->max_inputs, "Got unexpected max inputs %u, expected %u.\n",
12140 max_inputs, test->max_inputs);
12141
12142 hr = ID2D1Effect_SetValue(effect, D2D1_PROPERTY_CLSID,
12144 ok(hr == E_INVALIDARG || broken(hr == S_OK) /* win8 */, "Got unexpected hr %#lx.\n", hr);
12145 hr = ID2D1Effect_SetValue(effect, D2D1_PROPERTY_DISPLAYNAME,
12147 ok(hr == E_INVALIDARG, "Got unexpected hr %#lx.\n", hr);
12148 hr = ID2D1Effect_SetValue(effect, D2D1_PROPERTY_AUTHOR,
12150 ok(hr == E_INVALIDARG, "Got unexpected hr %#lx.\n", hr);
12151 hr = ID2D1Effect_SetValue(effect, D2D1_PROPERTY_CATEGORY,
12153 ok(hr == E_INVALIDARG, "Got unexpected hr %#lx.\n", hr);
12154 hr = ID2D1Effect_SetValue(effect, D2D1_PROPERTY_DISPLAYNAME,
12156 ok(hr == E_INVALIDARG, "Got unexpected hr %#lx.\n", hr);
12157 hr = ID2D1Effect_SetValue(effect, D2D1_PROPERTY_CACHED,
12158 D2D1_PROPERTY_TYPE_BOOL, (BYTE *)&cached, sizeof(cached));
12159 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
12160 hr = ID2D1Effect_SetValue(effect, D2D1_PROPERTY_PRECISION,
12162 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
12163 hr = ID2D1Effect_SetValue(effect, D2D1_PROPERTY_MIN_INPUTS,
12164 D2D1_PROPERTY_TYPE_UINT32, (BYTE *)&min_inputs, sizeof(min_inputs));
12165 ok(hr == E_INVALIDARG || broken(hr == S_OK) /* win8 */, "Got unexpected hr %#lx.\n", hr);
12166 hr = ID2D1Effect_SetValue(effect, D2D1_PROPERTY_MAX_INPUTS,
12167 D2D1_PROPERTY_TYPE_UINT32, (BYTE *)&max_inputs, sizeof(max_inputs));
12168 ok(hr == E_INVALIDARG || broken(hr == S_OK) /* win8 */, "Got unexpected hr %#lx.\n", hr);
12169
12170 ID2D1Effect_Release(effect);
12171 hr = ID2D1Factory1_UnregisterEffect(factory, &CLSID_TestEffect);
12172 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
12174 }
12175
12176 /* Test custom properties */
12177
12178 hr = ID2D1Factory1_RegisterEffectFromString(factory, &CLSID_TestEffect,
12180 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
12181
12182 effect = NULL;
12183 hr = ID2D1DeviceContext_CreateEffect(ctx.context, &CLSID_TestEffect, &effect);
12184 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
12185
12186 count = ID2D1Effect_GetPropertyCount(effect);
12187 ok(count == 3, "Got unexpected property count %u.\n", count);
12188
12189 index = ID2D1Effect_GetPropertyIndex(effect, L"Context");
12190 ok(index == 0, "Got unexpected index %u.\n", index);
12191 index = ID2D1Effect_GetPropertyIndex(effect, L"Integer");
12192 ok(index == 1, "Got unexpected index %u.\n", index);
12193
12194 /* On type mismatch output buffer is zeroed. */
12195 memset(value, 0xcc, sizeof(value));
12196 hr = ID2D1Effect_GetValueByName(effect, L"Context", D2D1_PROPERTY_TYPE_UINT32, value, sizeof(void *));
12197 ok(hr == E_INVALIDARG, "Got unexpected hr %#lx.\n", hr);
12198 check_zero_buffer(value, sizeof(void *));
12199
12200 /* On size mismatch output buffer is zeroed. */
12201 memset(value, 0xcc, sizeof(value));
12202 hr = ID2D1Effect_GetValueByName(effect, L"Context", D2D1_PROPERTY_TYPE_IUNKNOWN, value, sizeof(void *) - 1);
12203 ok(hr == E_INVALIDARG, "Got unexpected hr %#lx.\n", hr);
12204 check_zero_buffer(value, sizeof(void *) - 1);
12205
12206 memset(value, 0xcc, sizeof(value));
12207 hr = ID2D1Effect_GetValueByName(effect, L"Context", D2D1_PROPERTY_TYPE_IUNKNOWN, value, sizeof(void *) + 1);
12208 ok(hr == E_INVALIDARG, "Got unexpected hr %#lx.\n", hr);
12209 check_zero_buffer(value, sizeof(void *) + 1);
12210
12211 effect_context = NULL;
12212 hr = ID2D1Effect_GetValueByName(effect,
12213 L"Context", D2D1_PROPERTY_TYPE_IUNKNOWN, (BYTE *)&effect_context, sizeof(effect_context));
12214 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
12215 ok(!!effect_context, "Got unexpected effect context %p.\n", effect_context);
12216
12217 memset(value, 0xcc, sizeof(value));
12218 hr = ID2D1Effect_GetValue(effect, 0, D2D1_PROPERTY_TYPE_IUNKNOWN, value, sizeof(void *) - 1);
12219 ok(hr == E_INVALIDARG, "Got unexpected hr %#lx.\n", hr);
12220 check_zero_buffer(value, sizeof(void *) - 1);
12221
12222 memset(value, 0xcc, sizeof(value));
12223 hr = ID2D1Effect_GetValue(effect, 0, D2D1_PROPERTY_TYPE_IUNKNOWN, value, sizeof(void *) + 1);
12224 ok(hr == E_INVALIDARG, "Got unexpected hr %#lx.\n", hr);
12225 check_zero_buffer(value, sizeof(void *) + 1);
12226
12227 effect_context = NULL;
12228 hr = ID2D1Effect_GetValue(effect, 0, D2D1_PROPERTY_TYPE_IUNKNOWN, (BYTE *)&effect_context, sizeof(effect_context));
12229 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
12230 ok(!!effect_context, "Got unexpected effect context %p.\n", effect_context);
12231
12232 hr = ID2D1Effect_SetValue(effect, 0, D2D1_PROPERTY_TYPE_IUNKNOWN, (BYTE *)&effect_context, sizeof(effect_context));
12233 ok(hr == E_INVALIDARG, "Got unexpected hr %#lx.\n", hr);
12234
12235 memset(value, 0xcc, sizeof(value));
12236 hr = ID2D1Effect_GetValueByName(effect, L"Integer", D2D1_PROPERTY_TYPE_UINT32, value, 3);
12237 ok(hr == E_INVALIDARG, "Got unexpected hr %#lx.\n", hr);
12239
12240 memset(value, 0xcc, sizeof(value));
12241 hr = ID2D1Effect_GetValueByName(effect, L"Integer", D2D1_PROPERTY_TYPE_UINT32, value, 5);
12242 ok(hr == E_INVALIDARG, "Got unexpected hr %#lx.\n", hr);
12244
12245 integer = 0;
12246 hr = ID2D1Effect_GetValueByName(effect, L"Integer", D2D1_PROPERTY_TYPE_UINT32, (BYTE *)&integer, sizeof(integer));
12247 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
12248 ok(integer == 10, "Got unexpected integer %u.", integer);
12249
12250 memset(value, 0xcc, sizeof(value));
12251 hr = ID2D1Effect_GetValue(effect, 1, D2D1_PROPERTY_TYPE_UINT32, value, 3);
12252 ok(hr == E_INVALIDARG, "Got unexpected hr %#lx.\n", hr);
12254
12255 memset(value, 0xcc, sizeof(value));
12256 hr = ID2D1Effect_GetValue(effect, 1, D2D1_PROPERTY_TYPE_UINT32, value, 5);
12257 ok(hr == E_INVALIDARG, "Got unexpected hr %#lx.\n", hr);
12259
12260 integer = 0;
12261 hr = ID2D1Effect_GetValue(effect, 1, D2D1_PROPERTY_TYPE_UINT32, (BYTE *)&integer, sizeof(integer));
12262 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
12263 ok(integer == 10, "Got unexpected integer %u.", integer);
12264
12265 memset(value, 0, sizeof(value));
12266 hr = ID2D1Effect_SetValue(effect, 1, D2D1_PROPERTY_TYPE_UINT32, value, 3);
12267 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
12268 hr = ID2D1Effect_SetValue(effect, 1, D2D1_PROPERTY_TYPE_UINT32, value, 5);
12269 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
12270
12271 integer = 20;
12272 hr = ID2D1Effect_SetValue(effect, 1, D2D1_PROPERTY_TYPE_UINT32, (BYTE *)&integer, sizeof(integer));
12273 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
12274 integer = 0xdeadbeef;
12275 hr = ID2D1Effect_GetValue(effect, 1, D2D1_PROPERTY_TYPE_UINT32, (BYTE *)&integer, sizeof(integer));
12276 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
12277 ok(integer == 20, "Got unexpected integer %u\n.", integer);
12278
12279 ID2D1Effect_Release(effect);
12280 hr = ID2D1Factory1_UnregisterEffect(factory, &CLSID_TestEffect);
12281 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
12282
12283 /* Test custom properties without binding */
12284
12285 hr = ID2D1Factory1_RegisterEffectFromString(factory, &CLSID_TestEffect, effect_xml_c, NULL, 0, effect_impl_create);
12286 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
12287 hr = ID2D1DeviceContext_CreateEffect(ctx.context, &CLSID_TestEffect, &effect);
12288 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
12289
12290 index = ID2D1Effect_GetPropertyIndex(effect, L"Context");
12291 ok(index == 0, "Got unexpected index %u.\n", index);
12292 index = ID2D1Effect_GetPropertyIndex(effect, L"Integer");
12293 ok(index == 1, "Got unexpected index %u.\n", index);
12294
12295 hr = ID2D1Effect_GetValueByName(effect, L"DeadBeef", D2D1_PROPERTY_TYPE_UINT32, (BYTE *)&integer, sizeof(integer));
12296 ok(hr == D2DERR_INVALID_PROPERTY, "Got unexpected hr %#lx.\n", hr);
12297
12298 effect_context = (ID2D1EffectContext *)0xdeadbeef;
12299 hr = ID2D1Effect_GetValue(effect, 0, D2D1_PROPERTY_TYPE_IUNKNOWN, (BYTE *)&effect_context, sizeof(effect_context));
12300 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
12301 ok(effect_context == NULL, "Got unexpected effect context %p.\n", effect_context);
12302
12303 integer = 0xdeadbeef;
12304 hr = ID2D1Effect_GetValue(effect, 1, D2D1_PROPERTY_TYPE_UINT32, (BYTE *)&integer, sizeof(integer));
12305 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
12306 ok(integer == 0, "Got unexpected integer %u.", integer);
12307
12308 hr = ID2D1Effect_SetValue(effect, 0, D2D1_PROPERTY_TYPE_IUNKNOWN, (BYTE *)&effect_context, sizeof(effect_context));
12309 ok(hr == E_INVALIDARG, "Got unexpected hr %#lx.\n", hr);
12310 hr = ID2D1Effect_SetValue(effect, 1, D2D1_PROPERTY_TYPE_UINT32, (BYTE *)&integer, sizeof(integer));
12311 ok(hr == E_INVALIDARG || broken(hr == S_OK) /* win8 */, "Got unexpected hr %#lx.\n", hr);
12312
12313 ID2D1Effect_Release(effect);
12314 hr = ID2D1Factory1_UnregisterEffect(factory, &CLSID_TestEffect);
12315 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
12316
12318}
static HRESULT STDMETHODCALLTYPE effect_impl_set_integer(IUnknown *iface, const BYTE *data, UINT32 data_size)
Definition: d2d1.c:11290
#define check_zero_buffer(a, b)
Definition: d2d1.c:11801
static const WCHAR * effect_xml_c
Definition: d2d1.c:164
static HRESULT STDMETHODCALLTYPE effect_impl_get_integer(const IUnknown *iface, BYTE *data, UINT32 data_size, UINT32 *actual_size)
Definition: d2d1.c:11302
static const WCHAR * effect_xml_minimum
Definition: d2d1.c:186
@ D2D1_PROPERTY_TYPE_MATRIX_5X4
Definition: d2d1_1.idl:182
@ D2D1_PROPERTY_TYPE_MATRIX_4X4
Definition: d2d1_1.idl:181
@ D2D1_PROPERTY_TYPE_MATRIX_4X3
Definition: d2d1_1.idl:180
@ D2D1_PROPERTY_TYPE_VECTOR2
Definition: d2d1_1.idl:171
@ D2D1_PROPERTY_TYPE_VECTOR3
Definition: d2d1_1.idl:172
@ D2D1_PROPERTY_TYPE_INT32
Definition: d2d1_1.idl:169
@ D2D1_SUBPROPERTY_ISREADONLY
Definition: d2d1_1.idl:205
void * description
GLuint GLfloat * val
Definition: glext.h:7180
float x
Definition: hlsl_d3d11.c:34
float y
Definition: hlsl_d3d11.c:34
Definition: shader.c:383
float x
Definition: shader.c:384
float y
Definition: shader.c:384
float z
Definition: shader.c:384
float w
Definition: d3dx9_private.h:55
float z
Definition: d3dx9_private.h:55
float x
Definition: d3dx9_private.h:55
float y
Definition: d3dx9_private.h:55
int32_t INT32
Definition: typedefs.h:58

Referenced by START_TEST().

◆ test_effect_register()

static void test_effect_register ( BOOL  d3d11)
static

Definition at line 11383 of file d2d1.c.

11384{
11385 ID2D1DeviceContext *device_context;
11386 ID2D1EffectContext *effect_context;
11387 struct d2d1_test_context ctx;
11389 unsigned int i, integer;
11391 WCHAR display_name[64];
11392 ID2D1Effect *effect;
11393 UINT32 count;
11394 HRESULT hr;
11395
11396 const struct xml_test
11397 {
11398 const WCHAR *xml;
11399 HRESULT hr;
11400 }
11401 xml_tests[] =
11402 {
11403 {effect_xml_a, S_OK},
11404 {effect_xml_b, S_OK},
11405 {effect_xml_c, S_OK},
11414 };
11415
11417 {
11419 {L"Context", NULL, effect_impl_get_context},
11420 {L"Integer", NULL, effect_impl_get_integer},
11421 {L"Integer", effect_impl_set_integer, NULL},
11422 {L"Integer", NULL, NULL},
11424 };
11425
11426 static const D2D1_PROPERTY_BINDING bindings2[] =
11427 {
11428 {L"Graph", NULL, effect_impl_get_graph},
11429 };
11430
11431 const struct binding_test
11432 {
11434 UINT32 binding_count;
11435 const WCHAR *effect_xml;
11436 HRESULT hr;
11437 }
11438 binding_tests[] =
11439 {
11440 {NULL, 0, effect_xml_a, S_OK},
11441 {NULL, 0, effect_xml_b, S_OK},
11442 {binding, 1, effect_xml_a, S_OK},
11444 {binding + 1, 1, effect_xml_b, S_OK},
11445 {binding + 2, 1, effect_xml_a, S_OK},
11446 {binding + 3, 1, effect_xml_a, S_OK},
11447 {binding + 4, 1, effect_xml_a, S_OK},
11451 {binding, 2, effect_xml_c, S_OK},
11452 };
11453
11454 if (!init_test_context(&ctx, d3d11))
11455 return;
11456
11457 device_context = ctx.context;
11458 factory = ctx.factory1;
11459 if (!factory)
11460 {
11461 win_skip("ID2D1Factory1 is not supported.\n");
11463 return;
11464 }
11465
11466 /* Using builtin effect CLSID. */
11467 hr = ID2D1Factory1_RegisterEffectFromString(factory, &CLSID_D2D1Crop, effect_xml_a, NULL,
11469 ok(hr == E_INVALIDARG, "Got unexpected hr %#lx.\n", hr);
11470
11471 /* Register effect once */
11472 for (i = 0; i < ARRAY_SIZE(xml_tests); ++i)
11473 {
11474 const struct xml_test *test = &xml_tests[i];
11475 winetest_push_context("Test %u", i);
11476
11477 hr = ID2D1Factory1_RegisterEffectFromString(factory, &CLSID_TestEffect, test->xml, NULL, 0, effect_impl_create);
11478 ok(hr == test->hr, "Got unexpected hr %#lx, expected %#lx.\n", hr, test->hr);
11479 if (hr == S_OK)
11480 {
11481 hr = ID2D1DeviceContext_CreateEffect(device_context, &CLSID_TestEffect, &effect);
11482 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
11483 hr = ID2D1Factory1_UnregisterEffect(factory, &CLSID_TestEffect);
11484 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
11485 hr = ID2D1Factory1_UnregisterEffect(factory, &CLSID_TestEffect);
11486 ok(hr == D2DERR_EFFECT_IS_NOT_REGISTERED, "Got unexpected hr %#lx.\n", hr);
11487 ID2D1Effect_Release(effect);
11488 }
11489
11491 }
11492
11493 /* Register effect multiple times */
11494 for (i = 0; i < ARRAY_SIZE(xml_tests); ++i)
11495 {
11496 const struct xml_test *test = &xml_tests[i];
11497
11498 if (test->hr != S_OK)
11499 continue;
11500
11501 winetest_push_context("Test %u", i);
11502
11503 hr = ID2D1Factory1_RegisterEffectFromString(factory, &CLSID_TestEffect, test->xml, NULL, 0, effect_impl_create);
11504 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
11505 hr = ID2D1Factory1_RegisterEffectFromString(factory, &CLSID_TestEffect, test->xml, NULL, 0, effect_impl_create);
11506 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
11507 hr = ID2D1Factory1_UnregisterEffect(factory, &CLSID_TestEffect);
11508 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
11509 hr = ID2D1Factory1_UnregisterEffect(factory, &CLSID_TestEffect);
11510 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
11511 hr = ID2D1Factory1_UnregisterEffect(factory, &CLSID_TestEffect);
11512 ok(hr == D2DERR_EFFECT_IS_NOT_REGISTERED, "Got unexpected hr %#lx.\n", hr);
11513
11515 }
11516
11517 /* Register effect multiple times with different xml */
11518 hr = ID2D1Factory1_RegisterEffectFromString(factory, &CLSID_TestEffect,
11520 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
11521 hr = ID2D1DeviceContext_CreateEffect(device_context, &CLSID_TestEffect, &effect);
11522 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
11523
11524 hr = ID2D1Effect_GetValue(effect, D2D1_PROPERTY_DISPLAYNAME,
11525 D2D1_PROPERTY_TYPE_STRING, (BYTE *)display_name, sizeof(display_name));
11526 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
11527 ok(!wcscmp(display_name, L"TestEffectA"), "Got unexpected display name %s.\n", debugstr_w(display_name));
11528 ID2D1Effect_Release(effect);
11529
11530 hr = ID2D1Factory1_RegisterEffectFromString(factory, &CLSID_TestEffect,
11532 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
11533 hr = ID2D1DeviceContext_CreateEffect(device_context, &CLSID_TestEffect, &effect);
11534 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
11535
11536 hr = ID2D1Effect_GetValue(effect, D2D1_PROPERTY_DISPLAYNAME,
11537 D2D1_PROPERTY_TYPE_STRING, (BYTE *)display_name, sizeof(display_name));
11538 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
11539 ok(!wcscmp(display_name, L"TestEffectA"), "Got unexpected display name %s.\n", debugstr_w(display_name));
11540 ID2D1Effect_Release(effect);
11541
11542 hr = ID2D1Factory1_UnregisterEffect(factory, &CLSID_TestEffect);
11543 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
11544 hr = ID2D1Factory1_UnregisterEffect(factory, &CLSID_TestEffect);
11545 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
11546
11547 /* Register effect with property binding */
11548 for (i = 0; i < ARRAY_SIZE(binding_tests); ++i)
11549 {
11550 const struct binding_test *test = &binding_tests[i];
11551 winetest_push_context("Test %u", i);
11552
11553 hr = ID2D1Factory1_RegisterEffectFromString(factory, &CLSID_TestEffect,
11554 test->effect_xml, test->binding, test->binding_count, effect_impl_create);
11555 ok(hr == test->hr, "Got unexpected hr %#lx, expected %#lx.\n", hr, test->hr);
11556 if (SUCCEEDED(hr))
11557 {
11558 hr = ID2D1Factory1_UnregisterEffect(factory, &CLSID_TestEffect);
11559 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
11560 }
11561
11563 }
11564
11565 /* Register effect multiple times with different binding */
11566 hr = ID2D1Factory1_RegisterEffectFromString(factory, &CLSID_TestEffect,
11568 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
11569 hr = ID2D1DeviceContext_CreateEffect(device_context, &CLSID_TestEffect, &effect);
11570 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
11571
11572 integer = 0xdeadbeef;
11573 effect_context = (ID2D1EffectContext *)0xdeadbeef;
11574 hr = ID2D1Effect_GetValueByName(effect, L"Integer",
11576 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
11577 hr = ID2D1Effect_GetValueByName(effect, L"Context",
11578 D2D1_PROPERTY_TYPE_IUNKNOWN, (BYTE *)&effect_context, sizeof(effect_context));
11579 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
11580 ok(integer == 10, "Got unexpected integer %u.\n", integer);
11581 ok(effect_context == NULL, "Got unexpected effect context %p.\n", effect_context);
11582 ID2D1Effect_Release(effect);
11583
11584 hr = ID2D1Factory1_RegisterEffectFromString(factory, &CLSID_TestEffect,
11586 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
11587 hr = ID2D1DeviceContext_CreateEffect(device_context, &CLSID_TestEffect, &effect);
11588 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
11589
11590 integer = 0xdeadbeef;
11591 effect_context = (ID2D1EffectContext *)0xdeadbeef;
11592 hr = ID2D1Effect_GetValueByName(effect, L"Integer",
11594 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
11595 hr = ID2D1Effect_GetValueByName(effect, L"Context",
11596 D2D1_PROPERTY_TYPE_IUNKNOWN, (BYTE *)&effect_context, sizeof(effect_context));
11597 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
11598 ok(integer == 10, "Got unexpected integer %u.\n", integer);
11599 ok(effect_context == NULL, "Got unexpected effect context %p.\n", effect_context);
11600 ID2D1Effect_Release(effect);
11601
11602 hr = ID2D1Factory1_UnregisterEffect(factory, &CLSID_TestEffect);
11603 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
11604 hr = ID2D1Factory1_UnregisterEffect(factory, &CLSID_TestEffect);
11605 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
11606
11607 /* Unregister builtin effect */
11608 hr = ID2D1Factory1_UnregisterEffect(factory, &CLSID_D2D1Composite);
11609 ok(hr == D2DERR_EFFECT_IS_NOT_REGISTERED, "Got unexpected hr %#lx.\n", hr);
11610
11611 /* Variable input count. */
11612 hr = ID2D1Factory1_RegisterEffectFromString(factory, &CLSID_TestEffect,
11614 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
11615 hr = ID2D1DeviceContext_CreateEffect(device_context, &CLSID_TestEffect, &effect);
11616 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
11617 integer = ID2D1Effect_GetInputCount(effect);
11618 ok(integer == 3, "Unexpected input count %u.\n", integer);
11619
11620 hr = ID2D1Effect_GetValueByName(effect, L"Graph", D2D1_PROPERTY_TYPE_IUNKNOWN, (BYTE *)&graph, sizeof(graph));
11621 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
11622
11623 count = ID2D1TransformGraph_GetInputCount(graph);
11624 ok(count == 3, "Unexpected input count %u.\n", count);
11625
11626 integer = 0;
11627 hr = ID2D1Effect_GetValue(effect, D2D1_PROPERTY_MIN_INPUTS, D2D1_PROPERTY_TYPE_UINT32,
11628 (BYTE *)&integer, sizeof(integer));
11629 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
11630 ok(integer == 2, "Unexpected value %u.\n", integer);
11631 hr = ID2D1Effect_GetValue(effect, D2D1_PROPERTY_MAX_INPUTS, D2D1_PROPERTY_TYPE_UINT32,
11632 (BYTE *)&integer, sizeof(integer));
11633 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
11634 ok(integer == 5, "Unexpected value %u.\n", integer);
11635 hr = ID2D1Effect_GetValue(effect, D2D1_PROPERTY_INPUTS, D2D1_PROPERTY_TYPE_ARRAY,
11636 (BYTE *)&integer, sizeof(integer));
11637 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
11638 ok(integer == 3, "Unexpected data %u.\n", integer);
11639 hr = ID2D1Effect_SetInputCount(effect, 4);
11640 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
11641 hr = ID2D1Effect_GetValue(effect, D2D1_PROPERTY_INPUTS, D2D1_PROPERTY_TYPE_ARRAY,
11642 (BYTE *)&integer, sizeof(integer));
11643 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
11644 ok(integer == 3, "Unexpected data %u.\n", integer);
11645
11646 hr = ID2D1Effect_GetValueByName(effect, L"Graph", D2D1_PROPERTY_TYPE_IUNKNOWN, (BYTE *)&graph, sizeof(graph));
11647 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
11648 count = ID2D1TransformGraph_GetInputCount(graph);
11649 ok(count == 4, "Unexpected input count %u.\n", count);
11650
11651 ID2D1Effect_Release(effect);
11652
11653 hr = ID2D1Factory1_UnregisterEffect(factory, &CLSID_TestEffect);
11654 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
11655
11657}
static HRESULT STDMETHODCALLTYPE effect_impl_get_graph(const IUnknown *iface, BYTE *data, UINT32 data_size, UINT32 *actual_size)
Definition: d2d1.c:11368
static const WCHAR * effect_xml_without_author
Definition: d2d1.c:227
static const WCHAR * effect_xml_without_inputs
Definition: d2d1.c:207
static const WCHAR * effect_xml_without_description
Definition: d2d1.c:247
static const WCHAR * effect_xml_without_category
Definition: d2d1.c:237
static const WCHAR * effect_xml_without_version
Definition: d2d1.c:197
static const WCHAR * effect_xml_without_type
Definition: d2d1.c:257
static const WCHAR * effect_variable_input_count
Definition: d2d1.c:268
static const WCHAR * effect_xml_without_name
Definition: d2d1.c:217
static const mhtml_binding_test_t binding_tests[]
Definition: mimeole.c:1179
static BOOL binding_test
Definition: protocol.c:162
#define D2DERR_EFFECT_IS_NOT_REGISTERED
Definition: winerror.h:7391
static HRESULT HRESULT_FROM_WIN32(unsigned int x)
Definition: winerror.h:210
#define ERROR_NOT_FOUND
Definition: winerror.h:1014

Referenced by START_TEST().

◆ test_effect_vertex_buffer()

static void test_effect_vertex_buffer ( BOOL  d3d11)
static

Definition at line 14962 of file d2d1.c.

14963{
14964 static const char custom_vs_code[] =
14965 "struct vs_out"
14966 "{"
14967 " float4 clipSpaceOutput : SV_POSITION;"
14968 " float4 sceneSpaceOutput : SCENE_POSITION;"
14969 " float4 texelSpaceInput0 : TEXCOORD0;"
14970 "};"
14971 "vs_out main(float2 position : CUSTOM_POSITION)"
14972 "{"
14973 " vs_out output = (vs_out)0;"
14974 " return output;"
14975 "}";
14976
14977 static const D2D1_INPUT_ELEMENT_DESC custom_layout[] =
14978 {
14979 {"CUSTOM_POSITION", 0, DXGI_FORMAT_R32G32_FLOAT, 0, 0},
14980 };
14981
14982 D2D1_CUSTOM_VERTEX_BUFFER_PROPERTIES custom_buffer_desc;
14984 ID2D1VertexBuffer *buffer, *buffer2;
14985 ID2D1EffectContext *effect_context;
14986 ID2D1DeviceContext *device_context;
14987 ID2D1Effect *effect, *effect2;
14989 struct d2d1_test_context ctx;
14990 D2D_VECTOR_4F data[3 * 6];
14993 BYTE *ptr, *ptr2;
14994 ID3D10Blob *vs;
14995 HRESULT hr;
14996
14997 if (!init_test_context(&ctx, d3d11))
14998 return;
14999
15000 factory = ctx.factory1;
15001 if (!factory)
15002 {
15003 win_skip("ID2D1Factory1 is not supported.\n");
15005 return;
15006 }
15007
15008 binding.propertyName = L"Context";
15009 binding.setFunction = NULL;
15010 binding.getFunction = effect_impl_get_context;
15011 hr = ID2D1Factory1_RegisterEffectFromString(factory, &CLSID_TestEffect,
15013 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
15014
15015 create_effect(ctx.context, &CLSID_TestEffect, &effect_context, &effect);
15016
15017 buffer_desc.inputCount = 1;
15018 buffer_desc.usage = D2D1_VERTEX_USAGE_STATIC;
15019 buffer_desc.data = (const BYTE *)data;
15020 buffer_desc.byteWidth = sizeof(data);
15021
15022 hr = ID2D1EffectContext_CreateVertexBuffer(effect_context, &buffer_desc, NULL, NULL, &buffer);
15023 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
15024 hr = ID2D1EffectContext_CreateVertexBuffer(effect_context, &buffer_desc, NULL, NULL, &buffer2);
15025 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
15026 ok(buffer != buffer2, "Unexpected buffer instance.\n");
15027 ID2D1VertexBuffer_Release(buffer2);
15028
15029 /* Mapping static buffer. */
15030 ptr = NULL;
15031 hr = ID2D1VertexBuffer_Map(buffer, &ptr, buffer_desc.byteWidth);
15032 todo_wine
15033 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
15034 todo_wine
15035 ok(!!ptr, "Unexpected pointer.\n");
15036 hr = ID2D1VertexBuffer_Unmap(buffer);
15037 todo_wine
15038 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
15039
15040 hr = ID2D1VertexBuffer_Map(buffer, &ptr, buffer_desc.byteWidth + 1);
15041 todo_wine
15042 ok(hr == E_INVALIDARG, "Got unexpected hr %#lx.\n", hr);
15043 hr = ID2D1VertexBuffer_Map(buffer, &ptr, buffer_desc.byteWidth - 1);
15044 todo_wine
15045 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
15046 todo_wine
15047 ok(!!ptr, "Unexpected pointer.\n");
15048 hr = ID2D1VertexBuffer_Unmap(buffer);
15049 todo_wine
15050 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
15051
15052 /* Map already mapped. */
15053 hr = ID2D1VertexBuffer_Map(buffer, &ptr, buffer_desc.byteWidth);
15054 todo_wine
15055 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
15056 todo_wine
15057 ok(!!ptr, "Unexpected pointer.\n");
15058 ptr2 = NULL;
15059 hr = ID2D1VertexBuffer_Map(buffer, &ptr2, buffer_desc.byteWidth);
15060 todo_wine
15061 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
15062 ok(ptr == ptr2, "Unexpected pointer.\n");
15063 hr = ID2D1VertexBuffer_Unmap(buffer);
15064 todo_wine
15065 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
15066
15067 ID2D1VertexBuffer_Release(buffer);
15068
15069 /* With an id. */
15070 buffer = (void *)0xdeadbeef;
15071 hr = ID2D1EffectContext_FindVertexBuffer(effect_context, &GUID_NULL, &buffer);
15072 ok(hr == HRESULT_FROM_WIN32(ERROR_NOT_FOUND), "Got unexpected hr %#lx.\n", hr);
15073 ok(!buffer, "Unexpected pointer %p.\n", buffer);
15074
15075 hr = ID2D1EffectContext_CreateVertexBuffer(effect_context, &buffer_desc, &GUID_NULL, NULL, &buffer);
15076 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
15077 hr = ID2D1EffectContext_FindVertexBuffer(effect_context, &GUID_NULL, &buffer2);
15078 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
15079 ok(buffer == buffer2, "Unexpected buffer instance.\n");
15080 ID2D1VertexBuffer_Release(buffer2);
15081
15082 /* Try to create with the same id.*/
15083 hr = ID2D1EffectContext_CreateVertexBuffer(effect_context, &buffer_desc, &GUID_NULL, NULL, &buffer2);
15084 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
15085 ok(buffer == buffer2, "Unexpected buffer instance.\n");
15086 ID2D1VertexBuffer_Release(buffer2);
15087
15088 buffer_desc.usage = D2D1_VERTEX_USAGE_DYNAMIC;
15089 hr = ID2D1EffectContext_CreateVertexBuffer(effect_context, &buffer_desc, &GUID_NULL, NULL, &buffer2);
15090 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
15091 ok(buffer == buffer2, "Unexpected buffer instance.\n");
15092 ID2D1VertexBuffer_Release(buffer2);
15093
15094 ID2D1VertexBuffer_Release(buffer);
15095
15096 /* Custom input layout. */
15097 hr = D3DCompile(custom_vs_code, sizeof(custom_vs_code) - 1, "test_vs", NULL, NULL,
15098 "main", "vs_4_0", 0, 0, &vs, NULL);
15099 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
15100
15101 custom_buffer_desc.elementCount = ARRAYSIZE(custom_layout);
15102 custom_buffer_desc.inputElements = custom_layout;
15103 custom_buffer_desc.stride = sizeof(D2D_VECTOR_2F);
15104 custom_buffer_desc.shaderBufferWithInputSignature = ID3D10Blob_GetBufferPointer(vs);
15105 custom_buffer_desc.shaderBufferSize = ID3D10Blob_GetBufferSize(vs);
15106
15107 hr = ID2D1EffectContext_CreateVertexBuffer(effect_context, &buffer_desc,
15108 &GUID_CustomVertexBuffer, &custom_buffer_desc, &buffer);
15109 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
15110
15111 hr = ID2D1EffectContext_FindVertexBuffer(effect_context, &GUID_CustomVertexBuffer, &buffer2);
15112 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
15113 ID2D1VertexBuffer_Release(buffer2);
15114
15115 ID2D1VertexBuffer_Release(buffer);
15116
15117 ID3D10Blob_Release(vs);
15118
15119 /* Buffer is not accessible using different device. */
15120 hr = ID2D1Factory1_CreateDevice(factory, ctx.device, &device);
15121 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
15122
15123 hr = ID2D1Device_CreateDeviceContext(device, D2D1_DEVICE_CONTEXT_OPTIONS_NONE, &device_context);
15124 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
15125
15126 create_effect(device_context, &CLSID_TestEffect, &effect_context, &effect2);
15127
15128 hr = ID2D1EffectContext_FindVertexBuffer(effect_context, &GUID_CustomVertexBuffer, &buffer);
15129 ok(hr == HRESULT_FROM_WIN32(ERROR_NOT_FOUND), "Got unexpected hr %#lx.\n", hr);
15130
15131 ID2D1Effect_Release(effect2);
15132
15133 ID2D1DeviceContext_Release(device_context);
15134 ID2D1Device_Release(device);
15135
15136 /* Using same device and different device context. */
15137 ID2D1DeviceContext_GetDevice(ctx.context, &device);
15138
15139 hr = ID2D1Device_CreateDeviceContext(device, D2D1_DEVICE_CONTEXT_OPTIONS_NONE, &device_context);
15140 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
15141
15142 create_effect(device_context, &CLSID_TestEffect, &effect_context, &effect2);
15143
15144 hr = ID2D1EffectContext_FindVertexBuffer(effect_context, &GUID_CustomVertexBuffer, &buffer);
15145 ok(hr == HRESULT_FROM_WIN32(ERROR_NOT_FOUND), "Got unexpected hr %#lx.\n", hr);
15146
15147 ID2D1Effect_Release(effect2);
15148
15149 ID2D1DeviceContext_Release(device_context);
15150
15151 ID2D1Device_Release(device);
15152
15153 ID2D1Effect_Release(effect);
15154 hr = ID2D1Factory1_UnregisterEffect(factory, &CLSID_TestEffect);
15155 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
15157}
#define ARRAYSIZE(a)
Definition: cat.c:25
static void create_effect(ID2D1DeviceContext *device_context, const GUID *id, ID2D1EffectContext **effect_context, ID2D1Effect **effect)
Definition: d2d1.c:14945
@ D2D1_VERTEX_USAGE_STATIC
@ D2D1_VERTEX_USAGE_DYNAMIC
@ DXGI_FORMAT_R32G32_FLOAT
Definition: dxgiformat.idl:39
#define GUID_NULL
Definition: ks.h:106
const D2D1_INPUT_ELEMENT_DESC * inputElements

Referenced by START_TEST().

◆ test_fill_geometry()

static void test_fill_geometry ( BOOL  d3d11)
static

Definition at line 8018 of file d2d1.c.

8019{
8020 ID2D1TransformedGeometry *transformed_geometry[4];
8021 ID2D1RectangleGeometry *rect_geometry[2];
8022 D2D1_POINT_2F point = {0.0f, 0.0f};
8023 D2D1_ROUNDED_RECT rounded_rect;
8024 struct d2d1_test_context ctx;
8025 ID2D1SolidColorBrush *brush;
8026 ID2D1PathGeometry *geometry;
8031 D2D1_ELLIPSE ellipse;
8034 HRESULT hr;
8035 BOOL match;
8036
8037 if (!init_test_context(&ctx, d3d11))
8038 return;
8039
8040 rt = ctx.rt;
8041 factory = ctx.factory;
8042
8043 ID2D1RenderTarget_SetDpi(rt, 192.0f, 48.0f);
8044 ID2D1RenderTarget_SetAntialiasMode(rt, D2D1_ANTIALIAS_MODE_ALIASED);
8045 set_color(&color, 0.890f, 0.851f, 0.600f, 1.0f);
8046 hr = ID2D1RenderTarget_CreateSolidColorBrush(rt, &color, NULL, &brush);
8047 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
8048
8049 ID2D1RenderTarget_BeginDraw(rt);
8050 set_color(&color, 0.396f, 0.180f, 0.537f, 1.0f);
8051 ID2D1RenderTarget_Clear(rt, &color);
8052
8053 set_rect(&rect, 40.0f, 480.0f, 40.0f, 480.0f);
8054 ID2D1RenderTarget_FillRectangle(rt, &rect, (ID2D1Brush *)brush);
8055 set_rect(&rect, 100.0f, 480.0f, 140.0f, 480.0f);
8056 ID2D1RenderTarget_FillRectangle(rt, &rect, (ID2D1Brush *)brush);
8057 set_rect(&rect, 200.0f, 400.0f, 200.0f, 560.0f);
8058 ID2D1RenderTarget_FillRectangle(rt, &rect, (ID2D1Brush *)brush);
8059 set_rect(&rect, 260.0f, 560.0f, 300.0f, 400.0f);
8060 ID2D1RenderTarget_FillRectangle(rt, &rect, (ID2D1Brush *)brush);
8061
8062 set_ellipse(&ellipse, 40.0f, 800.0f, 0.0f, 0.0f);
8063 ID2D1RenderTarget_FillEllipse(rt, &ellipse, (ID2D1Brush *)brush);
8064 set_ellipse(&ellipse, 120.0f, 800.0f, 20.0f, 0.0f);
8065 ID2D1RenderTarget_FillEllipse(rt, &ellipse, (ID2D1Brush *)brush);
8066 set_ellipse(&ellipse, 200.0f, 800.0f, 0.0f, 80.0f);
8067 ID2D1RenderTarget_FillEllipse(rt, &ellipse, (ID2D1Brush *)brush);
8068 set_ellipse(&ellipse, 280.0f, 800.0f, 20.0f, 80.0f);
8069 ID2D1RenderTarget_FillEllipse(rt, &ellipse, (ID2D1Brush *)brush);
8070
8071 hr = ID2D1RenderTarget_EndDraw(rt, NULL, NULL);
8072 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
8073
8074 match = compare_figure(&ctx, 0, 160, 160, 160, 0xff652e89, 0, "gMgB");
8075 ok(match, "Figure does not match.\n");
8076 match = compare_figure(&ctx, 160, 160, 160, 160, 0xff652e89, 0, "gMgB");
8077 ok(match, "Figure does not match.\n");
8078 match = compare_figure(&ctx, 320, 160, 160, 160, 0xff652e89, 0, "gMgB");
8079 ok(match, "Figure does not match.\n");
8080 match = compare_figure(&ctx, 480, 160, 160, 160, 0xff652e89, 0,
8081 "qDJQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQ"
8082 "UFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQ"
8083 "UFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFCoMgAA");
8084 ok(match, "Figure does not match.\n");
8085
8086 match = compare_figure(&ctx, 0, 320, 160, 160, 0xff652e89, 0, "gMgB");
8087 ok(match, "Figure does not match.\n");
8088 match = compare_figure(&ctx, 160, 320, 160, 160, 0xff652e89, 0, "gMgB");
8089 ok(match, "Figure does not match.\n");
8090 match = compare_figure(&ctx, 320, 320, 160, 160, 0xff652e89, 0, "gMgB");
8091 ok(match, "Figure does not match.\n");
8092 match = compare_figure(&ctx, 480, 320, 160, 160, 0xff652e89, 8,
8093 "yjIMjwEWhwEcggEgfiR6KHYscy5xMG40azZpOGc6ZTxjPmI+YUBfQl1EXERbRlpGWUhYSFdKVkpV"
8094 "TFRMVExTTlJOUk5STlJOUVBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUU5STlJOUk5STlNMVExUTFVK"
8095 "VkpXSFhIWUZaRltEXERdQl9AYT5iPmM8ZTpnOGk2azRuMHEucyx2KHokfiCCARyHARaPAQzKMgAA");
8096 ok(match, "Figure does not match.\n");
8097
8098 ID2D1RenderTarget_BeginDraw(rt);
8099 set_color(&color, 0.396f, 0.180f, 0.537f, 1.0f);
8100 ID2D1RenderTarget_Clear(rt, &color);
8101
8102 set_rounded_rect(&rounded_rect, 40.0f, 160.0f, 40.0f, 160.0f, 10.0f, 10.0f);
8103 ID2D1RenderTarget_FillRoundedRectangle(rt, &rounded_rect, (ID2D1Brush *)brush);
8104 set_rounded_rect(&rounded_rect, 100.0f, 160.0f, 140.0f, 160.0f, 10.0f, 10.0f);
8105 ID2D1RenderTarget_FillRoundedRectangle(rt, &rounded_rect, (ID2D1Brush *)brush);
8106 set_rounded_rect(&rounded_rect, 200.0f, 80.0f, 200.0f, 240.0f, 10.0f, 10.0f);
8107 ID2D1RenderTarget_FillRoundedRectangle(rt, &rounded_rect, (ID2D1Brush *)brush);
8108 set_rounded_rect(&rounded_rect, 260.0f, 240.0f, 300.0f, 80.0f, 10.0f, 10.0f);
8109 ID2D1RenderTarget_FillRoundedRectangle(rt, &rounded_rect, (ID2D1Brush *)brush);
8110
8111 set_rounded_rect(&rounded_rect, 40.0f, 480.0f, 40.0f, 480.0f, 10.0f, 20.0f);
8112 ID2D1RenderTarget_FillRoundedRectangle(rt, &rounded_rect, (ID2D1Brush *)brush);
8113 set_rounded_rect(&rounded_rect, 100.0f, 480.0f, 140.0f, 480.0f, 10.0f, 20.0f);
8114 ID2D1RenderTarget_FillRoundedRectangle(rt, &rounded_rect, (ID2D1Brush *)brush);
8115 set_rounded_rect(&rounded_rect, 200.0f, 400.0f, 200.0f, 560.0f, 10.0f, 20.0f);
8116 ID2D1RenderTarget_FillRoundedRectangle(rt, &rounded_rect, (ID2D1Brush *)brush);
8117 set_rounded_rect(&rounded_rect, 260.0f, 560.0f, 300.0f, 400.0f, 10.0f, 20.0f);
8118 ID2D1RenderTarget_FillRoundedRectangle(rt, &rounded_rect, (ID2D1Brush *)brush);
8119
8120 set_rounded_rect(&rounded_rect, 40.0f, 800.0f, 40.0f, 800.0f, 10.0f, 5.0f);
8121 ID2D1RenderTarget_FillRoundedRectangle(rt, &rounded_rect, (ID2D1Brush *)brush);
8122 set_rounded_rect(&rounded_rect, 100.0f, 800.0f, 140.0f, 800.0f, 10.0f, 5.0f);
8123 ID2D1RenderTarget_FillRoundedRectangle(rt, &rounded_rect, (ID2D1Brush *)brush);
8124 set_rounded_rect(&rounded_rect, 200.0f, 720.0f, 200.0f, 880.0f, 10.0f, 5.0f);
8125 ID2D1RenderTarget_FillRoundedRectangle(rt, &rounded_rect, (ID2D1Brush *)brush);
8126 set_rounded_rect(&rounded_rect, 260.0f, 880.0f, 300.0f, 720.0f, 10.0f, 5.0f);
8127 ID2D1RenderTarget_FillRoundedRectangle(rt, &rounded_rect, (ID2D1Brush *)brush);
8128
8129 hr = ID2D1RenderTarget_EndDraw(rt, NULL, NULL);
8130 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
8131
8132 match = compare_figure(&ctx, 0, 0, 160, 160, 0xff652e89, 0, "gMgB");
8133 ok(match, "Figure does not match.\n");
8134 match = compare_figure(&ctx, 160, 0, 160, 160, 0xff652e89, 0, "gMgB");
8135 ok(match, "Figure does not match.\n");
8136 match = compare_figure(&ctx, 320, 0, 160, 160, 0xff652e89, 0, "gMgB");
8137 ok(match, "Figure does not match.\n");
8138 match = compare_figure(&ctx, 480, 0, 160, 160, 0xff652e89, 0,
8139 "szI6YURZSlROUVBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQ"
8140 "UFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQ"
8141 "UFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUU5USllEYTqzMgAA");
8142 ok(match, "Figure does not match.\n");
8143
8144 match = compare_figure(&ctx, 0, 160, 160, 160, 0xff652e89, 0, "gMgB");
8145 ok(match, "Figure does not match.\n");
8146 match = compare_figure(&ctx, 160, 160, 160, 160, 0xff652e89, 0, "gMgB");
8147 ok(match, "Figure does not match.\n");
8148 match = compare_figure(&ctx, 320, 160, 160, 160, 0xff652e89, 0, "gMgB");
8149 ok(match, "Figure does not match.\n");
8150 match = compare_figure(&ctx, 480, 160, 160, 160, 0xff652e89, 2,
8151 "tjI0aDxhQlxGWEpVTFNOUk5RUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQ"
8152 "UFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQ"
8153 "UFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFFOUk5TTFVKWEZcQmA+ZzS2MgAA");
8154 ok(match, "Figure does not match.\n");
8155
8156 match = compare_figure(&ctx, 0, 320, 160, 160, 0xff652e89, 0, "gMgB");
8157 ok(match, "Figure does not match.\n");
8158 match = compare_figure(&ctx, 160, 320, 160, 160, 0xff652e89, 0, "gMgB");
8159 ok(match, "Figure does not match.\n");
8160 match = compare_figure(&ctx, 320, 320, 160, 160, 0xff652e89, 0, "gMgB");
8161 ok(match, "Figure does not match.\n");
8162 match = compare_figure(&ctx, 480, 320, 160, 160, 0xff652e89, 0,
8163 "sDJAWkxSUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQ"
8164 "UFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQ"
8165 "UFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFJMWkCwMgAA");
8166 ok(match, "Figure does not match.\n");
8167
8168 ID2D1RenderTarget_BeginDraw(rt);
8169 set_color(&color, 0.396f, 0.180f, 0.537f, 1.0f);
8170 ID2D1RenderTarget_Clear(rt, &color);
8171
8172 set_rounded_rect(&rounded_rect, 40.0f, 160.0f, 40.0f, 160.0f, 1000.0f, 1000.0f);
8173 ID2D1RenderTarget_FillRoundedRectangle(rt, &rounded_rect, (ID2D1Brush *)brush);
8174 set_rounded_rect(&rounded_rect, 100.0f, 160.0f, 140.0f, 160.0f, 1000.0f, 1000.0f);
8175 ID2D1RenderTarget_FillRoundedRectangle(rt, &rounded_rect, (ID2D1Brush *)brush);
8176 set_rounded_rect(&rounded_rect, 200.0f, 80.0f, 200.0f, 240.0f, 1000.0f, 1000.0f);
8177 ID2D1RenderTarget_FillRoundedRectangle(rt, &rounded_rect, (ID2D1Brush *)brush);
8178 set_rounded_rect(&rounded_rect, 260.0f, 240.0f, 300.0f, 80.0f, 1000.0f, 1000.0f);
8179 ID2D1RenderTarget_FillRoundedRectangle(rt, &rounded_rect, (ID2D1Brush *)brush);
8180
8181 set_rounded_rect(&rounded_rect, 40.0f, 480.0f, 40.0f, 480.0f, 10.0f, 1000.0f);
8182 ID2D1RenderTarget_FillRoundedRectangle(rt, &rounded_rect, (ID2D1Brush *)brush);
8183 set_rounded_rect(&rounded_rect, 100.0f, 480.0f, 140.0f, 480.0f, 10.0f, 1000.0f);
8184 ID2D1RenderTarget_FillRoundedRectangle(rt, &rounded_rect, (ID2D1Brush *)brush);
8185 set_rounded_rect(&rounded_rect, 200.0f, 400.0f, 200.0f, 560.0f, 10.0f, 1000.0f);
8186 ID2D1RenderTarget_FillRoundedRectangle(rt, &rounded_rect, (ID2D1Brush *)brush);
8187 set_rounded_rect(&rounded_rect, 260.0f, 560.0f, 300.0f, 400.0f, 10.0f, 1000.0f);
8188 ID2D1RenderTarget_FillRoundedRectangle(rt, &rounded_rect, (ID2D1Brush *)brush);
8189
8190 set_rounded_rect(&rounded_rect, 40.0f, 800.0f, 40.0f, 800.0f, 1000.0f, 10.0f);
8191 ID2D1RenderTarget_FillRoundedRectangle(rt, &rounded_rect, (ID2D1Brush *)brush);
8192 set_rounded_rect(&rounded_rect, 100.0f, 800.0f, 140.0f, 800.0f, 1000.0f, 10.0f);
8193 ID2D1RenderTarget_FillRoundedRectangle(rt, &rounded_rect, (ID2D1Brush *)brush);
8194 set_rounded_rect(&rounded_rect, 200.0f, 720.0f, 200.0f, 880.0f, 1000.0f, 10.0f);
8195 ID2D1RenderTarget_FillRoundedRectangle(rt, &rounded_rect, (ID2D1Brush *)brush);
8196 set_rounded_rect(&rounded_rect, 260.0f, 880.0f, 300.0f, 720.0f, 1000.0f, 10.0f);
8197 ID2D1RenderTarget_FillRoundedRectangle(rt, &rounded_rect, (ID2D1Brush *)brush);
8198
8199 hr = ID2D1RenderTarget_EndDraw(rt, NULL, NULL);
8200 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
8201
8202 match = compare_figure(&ctx, 0, 0, 160, 160, 0xff652e89, 0, "gMgB");
8203 ok(match, "Figure does not match.\n");
8204 match = compare_figure(&ctx, 160, 0, 160, 160, 0xff652e89, 0, "gMgB");
8205 ok(match, "Figure does not match.\n");
8206 match = compare_figure(&ctx, 320, 0, 160, 160, 0xff652e89, 0, "gMgB");
8207 ok(match, "Figure does not match.\n");
8208 match = compare_figure(&ctx, 480, 0, 160, 160, 0xff652e89, 10,
8209 "yjIMjwEWhwEcggEgfiR6KHYscy5xMG40azZpOGc6ZTxjPmI+YUBfQl1EXERbRlpGWUhYSFdKVkpV"
8210 "TFRMVExTTlJOUk5STlJOUVBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUU5STlJOUk5STlNMVExUTFVK"
8211 "VkpXSFhIWUZaRltEXERdQl9AYT5iPmM8ZTpnOGk2azRuMHEucyx2KHokfiCCARyHARaPAQzKMgAA");
8212 ok(match, "Figure does not match.\n");
8213
8214 match = compare_figure(&ctx, 0, 160, 160, 160, 0xff652e89, 0, "gMgB");
8215 ok(match, "Figure does not match.\n");
8216 match = compare_figure(&ctx, 160, 160, 160, 160, 0xff652e89, 0, "gMgB");
8217 ok(match, "Figure does not match.\n");
8218 match = compare_figure(&ctx, 320, 160, 160, 160, 0xff652e89, 0, "gMgB");
8219 ok(match, "Figure does not match.\n");
8220 match = compare_figure(&ctx, 480, 160, 160, 160, 0xff652e89, 10,
8221 "uTIucDJsNmk4ZzplPGM+YUBgQF9CXkJdRFxEW0ZaRllIWEhXSlZKVkpWSlVMVExUTFRMU05STlJO"
8222 "Uk5STlJOUk9QUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFFPUU5STlJOUk5STlJOU0xU"
8223 "TFRMVExVSlZKVkpWSldIWEhZRlpGW0RcRF1CXkJfQGBAYT5jPGU6ZzhpNmwycC65MgAA");
8224 ok(match, "Figure does not match.\n");
8225
8226 match = compare_figure(&ctx, 0, 320, 160, 160, 0xff652e89, 0, "gMgB");
8227 ok(match, "Figure does not match.\n");
8228 match = compare_figure(&ctx, 160, 320, 160, 160, 0xff652e89, 0, "gMgB");
8229 ok(match, "Figure does not match.\n");
8230 match = compare_figure(&ctx, 320, 320, 160, 160, 0xff652e89, 0, "gMgB");
8231 ok(match, "Figure does not match.\n");
8232 match = compare_figure(&ctx, 480, 320, 160, 160, 0xff652e89, 10,
8233 "vzIiczhhRldMUlBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQ"
8234 "UFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQ"
8235 "UFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUkxXRmA6cSS+MgAA");
8236 ok(match, "Figure does not match.\n");
8237
8238 hr = ID2D1Factory_CreatePathGeometry(factory, &geometry);
8239 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
8240 hr = ID2D1PathGeometry_Open(geometry, &sink);
8241 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
8242
8243 set_point(&point, 40.0f, 160.0f);
8244 ID2D1GeometrySink_BeginFigure(sink, point, D2D1_FIGURE_BEGIN_FILLED);
8245 ID2D1GeometrySink_EndFigure(sink, D2D1_FIGURE_END_OPEN);
8246
8247 set_point(&point, 120.0f, 160.0f);
8248 ID2D1GeometrySink_BeginFigure(sink, point, D2D1_FIGURE_BEGIN_FILLED);
8249 line_to(sink, 120.0f, 160.0f);
8250 ID2D1GeometrySink_EndFigure(sink, D2D1_FIGURE_END_OPEN);
8251
8252 set_point(&point, 200.0f, 160.0f);
8253 ID2D1GeometrySink_BeginFigure(sink, point, D2D1_FIGURE_BEGIN_FILLED);
8254 ID2D1GeometrySink_EndFigure(sink, D2D1_FIGURE_END_CLOSED);
8255
8256 set_point(&point, 280.0f, 160.0f);
8257 ID2D1GeometrySink_BeginFigure(sink, point, D2D1_FIGURE_BEGIN_FILLED);
8258 line_to(sink, 280.0f, 160.0f);
8259 ID2D1GeometrySink_EndFigure(sink, D2D1_FIGURE_END_CLOSED);
8260
8261 set_point(&point, 20.0f, 480.0f);
8262 ID2D1GeometrySink_BeginFigure(sink, point, D2D1_FIGURE_BEGIN_FILLED);
8263 line_to(sink, 60.0f, 480.0f);
8264 ID2D1GeometrySink_EndFigure(sink, D2D1_FIGURE_END_OPEN);
8265
8266 set_point(&point, 120.0f, 400.0f);
8267 ID2D1GeometrySink_BeginFigure(sink, point, D2D1_FIGURE_BEGIN_FILLED);
8268 line_to(sink, 120.0f, 560.0f);
8269 line_to(sink, 120.0f, 400.0f);
8270 line_to(sink, 120.0f, 560.0f);
8271 ID2D1GeometrySink_EndFigure(sink, D2D1_FIGURE_END_OPEN);
8272
8273 set_point(&point, 180.0f, 480.0f);
8274 ID2D1GeometrySink_BeginFigure(sink, point, D2D1_FIGURE_BEGIN_FILLED);
8275 line_to(sink, 220.0f, 480.0f);
8276 ID2D1GeometrySink_EndFigure(sink, D2D1_FIGURE_END_CLOSED);
8277
8278 set_point(&point, 280.0f, 400.0f);
8279 ID2D1GeometrySink_BeginFigure(sink, point, D2D1_FIGURE_BEGIN_FILLED);
8280 line_to(sink, 280.0f, 560.0f);
8281 line_to(sink, 280.0f, 400.0f);
8282 line_to(sink, 280.0f, 560.0f);
8283 ID2D1GeometrySink_EndFigure(sink, D2D1_FIGURE_END_CLOSED);
8284
8285 set_point(&point, 20.0f, 880.0f);
8286 ID2D1GeometrySink_BeginFigure(sink, point, D2D1_FIGURE_BEGIN_FILLED);
8287 line_to(sink, 40.0f, 720.0f);
8288 line_to(sink, 60.0f, 880.0f);
8289 ID2D1GeometrySink_EndFigure(sink, D2D1_FIGURE_END_OPEN);
8290
8291 set_point(&point, 100.0f, 720.0f);
8292 ID2D1GeometrySink_BeginFigure(sink, point, D2D1_FIGURE_BEGIN_FILLED);
8293 line_to(sink, 120.0f, 880.0f);
8294 line_to(sink, 140.0f, 720.0f);
8295 ID2D1GeometrySink_EndFigure(sink, D2D1_FIGURE_END_OPEN);
8296
8297 set_point(&point, 180.0f, 880.0f);
8298 ID2D1GeometrySink_BeginFigure(sink, point, D2D1_FIGURE_BEGIN_FILLED);
8299 line_to(sink, 200.0f, 720.0f);
8300 line_to(sink, 220.0f, 880.0f);
8301 ID2D1GeometrySink_EndFigure(sink, D2D1_FIGURE_END_CLOSED);
8302
8303 set_point(&point, 260.0f, 720.0f);
8304 ID2D1GeometrySink_BeginFigure(sink, point, D2D1_FIGURE_BEGIN_FILLED);
8305 line_to(sink, 280.0f, 880.0f);
8306 line_to(sink, 300.0f, 720.0f);
8307 ID2D1GeometrySink_EndFigure(sink, D2D1_FIGURE_END_CLOSED);
8308
8309 ID2D1GeometrySink_SetFillMode(sink, D2D1_FILL_MODE_ALTERNATE);
8310 hr = ID2D1GeometrySink_Close(sink);
8311 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
8312 ID2D1GeometrySink_Release(sink);
8313
8314 ID2D1RenderTarget_BeginDraw(rt);
8315 ID2D1RenderTarget_Clear(rt, &color);
8316 ID2D1RenderTarget_FillGeometry(rt, (ID2D1Geometry *)geometry, (ID2D1Brush *)brush, NULL);
8317 hr = ID2D1RenderTarget_EndDraw(rt, NULL, NULL);
8318 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
8319 ID2D1PathGeometry_Release(geometry);
8320
8321 match = compare_figure(&ctx, 0, 0, 160, 160, 0xff652e89, 0, "gMgB");
8322 ok(match, "Figure does not match.\n");
8323 match = compare_figure(&ctx, 160, 0, 160, 160, 0xff652e89, 0, "gMgB");
8324 ok(match, "Figure does not match.\n");
8325 match = compare_figure(&ctx, 320, 0, 160, 160, 0xff652e89, 0, "gMgB");
8326 ok(match, "Figure does not match.\n");
8327 match = compare_figure(&ctx, 480, 0, 160, 160, 0xff652e89, 0, "gMgB");
8328 ok(match, "Figure does not match.\n");
8329
8330 match = compare_figure(&ctx, 0, 160, 160, 160, 0xff652e89, 0, "gMgB");
8331 ok(match, "Figure does not match.\n");
8332 match = compare_figure(&ctx, 160, 160, 160, 160, 0xff652e89, 0, "gMgB");
8333 ok(match, "Figure does not match.\n");
8334 match = compare_figure(&ctx, 320, 160, 160, 160, 0xff652e89, 0, "gMgB");
8335 ok(match, "Figure does not match.\n");
8336 match = compare_figure(&ctx, 480, 160, 160, 160, 0xff652e89, 0, "gMgB");
8337 ok(match, "Figure does not match.\n");
8338
8339 match = compare_figure(&ctx, 0, 320, 160, 160, 0xff652e89, 0,
8340 "7zMCngECnQEEnAEEmwEGmgEGmQEImAEIlwEKlgEKlQEMlAEMkwEOkgEOkQEQkAEQjwESjgESjQEU"
8341 "jAEUiwEWigEWiQEYiAEYhwEahgEahQEchAEcgwEeggEegQEggAEgfyJ+In0kfCR7JnomeSh4KHcq"
8342 "dip1LHQscy5yLnEwcDBvMm4ybTRsNGs2ajZpOGg4ZzpmOmU8ZDxjPmI+YUBgQF9CXkJdRFxEW0Za"
8343 "RllIWEhXSlZKVUxUTFNOUk5RUKgy");
8344 ok(match, "Figure does not match.\n");
8345 match = compare_figure(&ctx, 160, 320, 160, 160, 0xff652e89, 0,
8346 "qDJQUU5STlNMVExVSlZKV0hYSFlGWkZbRFxEXUJeQl9AYEBhPmI+YzxkPGU6ZjpnOGg4aTZqNms0"
8347 "bDRtMm4ybzBwMHEuci5zLHQsdSp2KncoeCh5JnomeyR8JH0ifiJ/IIABIIEBHoIBHoMBHIQBHIUB"
8348 "GoYBGocBGIgBGIkBFooBFosBFIwBFI0BEo4BEo8BEJABEJEBDpIBDpMBDJQBDJUBCpYBCpcBCJgB"
8349 "CJkBBpoBBpsBBJwBBJ0BAp4BAu8z");
8350 ok(match, "Figure does not match.\n");
8351 match = compare_figure(&ctx, 320, 320, 160, 160, 0xff652e89, 0,
8352 "7zMCngECnQEEnAEEmwEGmgEGmQEImAEIlwEKlgEKlQEMlAEMkwEOkgEOkQEQkAEQjwESjgESjQEU"
8353 "jAEUiwEWigEWiQEYiAEYhwEahgEahQEchAEcgwEeggEegQEggAEgfyJ+In0kfCR7JnomeSh4KHcq"
8354 "dip1LHQscy5yLnEwcDBvMm4ybTRsNGs2ajZpOGg4ZzpmOmU8ZDxjPmI+YUBgQF9CXkJdRFxEW0Za"
8355 "RllIWEhXSlZKVUxUTFNOUk5RUKgy");
8356 ok(match, "Figure does not match.\n");
8357 match = compare_figure(&ctx, 480, 320, 160, 160, 0xff652e89, 0,
8358 "qDJQUU5STlNMVExVSlZKV0hYSFlGWkZbRFxEXUJeQl9AYEBhPmI+YzxkPGU6ZjpnOGg4aTZqNms0"
8359 "bDRtMm4ybzBwMHEuci5zLHQsdSp2KncoeCh5JnomeyR8JH0ifiJ/IIABIIEBHoIBHoMBHIQBHIUB"
8360 "GoYBGocBGIgBGIkBFooBFosBFIwBFI0BEo4BEo8BEJABEJEBDpIBDpMBDJQBDJUBCpYBCpcBCJgB"
8361 "CJkBBpoBBpsBBJwBBJ0BAp4BAu8z");
8362 ok(match, "Figure does not match.\n");
8363
8364 set_rect(&rect, 20.0f, 80.0f, 60.0f, 240.0f);
8365 hr = ID2D1Factory_CreateRectangleGeometry(factory, &rect, &rect_geometry[0]);
8366 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
8367
8368 set_rect(&rect, -1.0f, -1.0f, 1.0f, 1.0f);
8369 hr = ID2D1Factory_CreateRectangleGeometry(factory, &rect, &rect_geometry[1]);
8370 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
8371
8373 translate_matrix(&matrix, 160.0f, 640.0f);
8374 scale_matrix(&matrix, 40.0f, 160.0f);
8375 rotate_matrix(&matrix, M_PI / -5.0f);
8376 hr = ID2D1Factory_CreateTransformedGeometry(factory,
8377 (ID2D1Geometry *)rect_geometry[1], &matrix, &transformed_geometry[0]);
8378 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
8379
8381 scale_matrix(&matrix, 0.5f, 1.0f);
8382 translate_matrix(&matrix, -80.0f, 0.0f);
8383 hr = ID2D1Factory_CreateTransformedGeometry(factory,
8384 (ID2D1Geometry *)transformed_geometry[0], &matrix, &transformed_geometry[1]);
8385 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
8386
8388 rotate_matrix(&matrix, M_PI / 2.0f);
8389 translate_matrix(&matrix, 80.0f, -320.0f);
8390 scale_matrix(&matrix, 2.0f, 0.25f);
8391 hr = ID2D1Factory_CreateTransformedGeometry(factory,
8392 (ID2D1Geometry *)transformed_geometry[1], &matrix, &transformed_geometry[2]);
8393 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
8394
8395 ID2D1RenderTarget_BeginDraw(rt);
8396 ID2D1RenderTarget_Clear(rt, &color);
8397 ID2D1RenderTarget_FillGeometry(rt, (ID2D1Geometry *)rect_geometry[0], (ID2D1Brush *)brush, NULL);
8398 ID2D1RenderTarget_FillGeometry(rt, (ID2D1Geometry *)transformed_geometry[0], (ID2D1Brush *)brush, NULL);
8399 ID2D1RenderTarget_FillGeometry(rt, (ID2D1Geometry *)transformed_geometry[1], (ID2D1Brush *)brush, NULL);
8400 ID2D1RenderTarget_FillGeometry(rt, (ID2D1Geometry *)transformed_geometry[2], (ID2D1Brush *)brush, NULL);
8401 hr = ID2D1RenderTarget_EndDraw(rt, NULL, NULL);
8402 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
8403 ID2D1TransformedGeometry_Release(transformed_geometry[2]);
8404 ID2D1TransformedGeometry_Release(transformed_geometry[1]);
8405 ID2D1TransformedGeometry_Release(transformed_geometry[0]);
8406 ID2D1RectangleGeometry_Release(rect_geometry[1]);
8407 ID2D1RectangleGeometry_Release(rect_geometry[0]);
8408
8409 match = compare_figure(&ctx, 0, 0, 160, 160, 0xff652e89, 0,
8410 "qDJQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQ"
8411 "UFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQ"
8412 "UFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFCoMgAA");
8413 ok(match, "Figure does not match.\n");
8414 match = compare_figure(&ctx, 160, 0, 320, 160, 0xff652e89, 32,
8415 "sIMBA7cCDK8CFKYCHZ4CJJYCLY4CNYUCPv0BRvQBT+wBV+MBYNsBaNIBccoBecEBgQG6AYkBsQGS"
8416 "AakBmgGgAaMBmAGrAY8BtAGHAbwBfsUBfcYBfcYBfcUBfsUBfcYBfcYBfcYBfcYBfcUBfr0BhgG0"
8417 "AY8BrAGXAaMBoAGbAagBkgGwAYsBuAGCAcEBeskBcdIBadoBYOMBWOsBT/QBR/wBPoUCNowCLpUC"
8418 "Jp0CHaYCFa4CDLcCBK+DAQAA");
8419 ok(match, "Figure does not match.\n");
8420 match = compare_figure(&ctx, 0, 160, 160, 320, 0xff652e89, 32,
8421 "+D0BngEDnQEDnAEEmwEGmgEGmQEHmAEJlwEJlgELlAEMkwENkwEOkQEPkAEQkAERjgESjQETjQEU"
8422 "iwEVigEXiQEXiAEYhwEahgEahQEbhAEdggEeggEegQEgfyF/In0jfCR8JXomeSd5KHcpdip2K3Qs"
8423 "cy5xL3EvcDFuMm4ybTRrNWs1ajdoOGg5ZjplO2U8Yz1iPmFAYEBfQV5DXUNcRVpGWkZZSFdJV0lW"
8424 "S1RMVExTTlFPUFFPUU5STVRMVEtVSldJV0hYR1pGWkVcQ11CXkJfQGA/YT9iPWM+Yj5jPWM+Yz1j"
8425 "PWM+Yz1jPmI+Yz1jPmI+Yz1jPmM9Yz1jPmM9Yz5iPmM9Yz5iPmM9Yz5jPWM9Yz5jPWM+Yj5jPWM+"
8426 "Yj5jPWI/YT9gQF9CXkJdRFtFW0VaR1hIV0lXSlVLVExUTVJOUVBQUE9RTlNNU0xUS1ZKVklXSFlG"
8427 "WkZaRVxDXUNeQV9AYEBhPmI9Yz1kO2U6ZjpnOGg3ajVrNWs0bTJuMm4xcC9xL3Eucyx0LHUqdil3"
8428 "KXgneSZ6JXwkfCN9In8hfyCBAR6CAR6CAR2EARuFARuFARqHARiIAReJAReKARWLARSNARONARKO"
8429 "ARGQARCQAQ+RAQ6TAQ2TAQyUAQuWAQqWAQmYAQeZAQaaAQabAQScAQOdAQOeAQH4PQAA");
8430 ok(match, "Figure does not match.\n");
8431 match = compare_figure(&ctx, 160, 160, 320, 320, 0xff652e89, 32,
8432 "sXkBvgIDvAIEugIHuAIJtgILswINsgIPrwISrQITrAIVqQIYpwIapQIbowIeoQIgngIjnAIkmwIm"
8433 "mAIplgIqlQIskgIvkAIxjQIzjAI1igI3hwI5hgI7hAI9gQJA/wFB/QFE+wFG+QFI9gFK9QFM8wFO"
8434 "8AFQ7wFS7AFV6gFX6AFY5gFb5AFd4gFf3wFh3gFj2wFm2QFn2AFp1QFs0wFu0QFvzwFyzQF0ygF3"
8435 "yAF4xwF6xAF9wgF+wAGBAb4BgwG8AYUBuQGHAbgBiQG2AYsBswGOAbEBjwGvAZIBrQGUAasBlQGp"
8436 "AZgBpwGaAaUBnAGiAZ4BoQGgAZ4BowGcAaUBmgGmAZgBqQGWAasBlAGsAZIBrwGQAbEBjQG0AYsB"
8437 "tQGKAbcBhwG6AYUBvAGDAb0BgQHAAX/CAXzEAXvGAXvGAXvGAXvFAXvGAXvGAXvGAXvFAXvGAXvG"
8438 "AXvFAXvGAXvGAXvGAXvFAXvGAXvGAXvFAXzFAXvGAXvGAXvFAXvGAXvGAXvGAXvFAXvGAXvGAXvF"
8439 "AXzFAXvGAXvGAXvFAXvGAXvGAXvGAXvEAXzCAX/AAYEBvgGCAbwBhQG6AYcBtwGKAbUBiwG0AY0B"
8440 "sQGQAa8BkgGtAZMBqwGWAakBmAGmAZoBpQGcAaMBngGgAaEBngGiAZ0BpAGaAacBmAGpAZUBqwGU"
8441 "Aa0BkgGvAY8BsQGOAbMBjAG1AYkBuAGHAbkBhQG8AYMBvgGBAcABfsIBfcQBe8YBeMgBd8oBdM0B"
8442 "cs8BcNABbtMBbNUBatcBZ9kBZtsBY94BYd8BYOEBXeQBW+YBWOgBV+oBVewBUu8BUPABT/IBTPUB"
8443 "SvYBSPkBRvsBRP0BQf8BQIECPoMCO4YCOYcCN4oCNYwCM40CMZACL5ICLZQCKpYCKZgCJpsCJJ0C"
8444 "Ip4CIKECHqMCHKQCGqcCGKkCFawCE60CEq8CD7ICDbMCDLUCCbgCB7oCBLwCA74CAbF5");
8445 ok(match, "Figure does not match.\n");
8446
8447 hr = ID2D1Factory_CreatePathGeometry(factory, &geometry);
8448 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
8449 hr = ID2D1PathGeometry_Open(geometry, &sink);
8450 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
8451
8452 set_point(&point, 20.0f, 80.0f);
8453 ID2D1GeometrySink_BeginFigure(sink, point, D2D1_FIGURE_BEGIN_FILLED);
8454 quadratic_to(sink, 40.0f, 80.0f, 60.0f, 80.0f);
8455 quadratic_to(sink, 60.0f, 160.0f, 60.0f, 240.0f);
8456 quadratic_to(sink, 40.0f, 240.0f, 20.0f, 240.0f);
8457 quadratic_to(sink, 20.0f, 160.0f, 20.0f, 80.0f);
8458 ID2D1GeometrySink_EndFigure(sink, D2D1_FIGURE_END_CLOSED);
8459
8460 set_point(&point, 100.0f, 80.0f);
8461 ID2D1GeometrySink_BeginFigure(sink, point, D2D1_FIGURE_BEGIN_FILLED);
8462 quadratic_to(sink, 105.0f, 80.0f, 140.0f, 80.0f);
8463 quadratic_to(sink, 140.0f, 100.0f, 140.0f, 240.0f);
8464 quadratic_to(sink, 135.0f, 240.0f, 100.0f, 240.0f);
8465 quadratic_to(sink, 100.0f, 220.0f, 100.0f, 80.0f);
8466 ID2D1GeometrySink_EndFigure(sink, D2D1_FIGURE_END_CLOSED);
8467
8468 set_point(&point, 180.0f, 80.0f);
8469 ID2D1GeometrySink_BeginFigure(sink, point, D2D1_FIGURE_BEGIN_FILLED);
8470 quadratic_to(sink, 215.0f, 80.0f, 220.0f, 80.0f);
8471 quadratic_to(sink, 220.0f, 220.0f, 220.0f, 240.0f);
8472 quadratic_to(sink, 185.0f, 240.0f, 180.0f, 240.0f);
8473 quadratic_to(sink, 180.0f, 100.0f, 180.0f, 80.0f);
8474 ID2D1GeometrySink_EndFigure(sink, D2D1_FIGURE_END_CLOSED);
8475
8476 set_point(&point, 260.0f, 80.0f);
8477 ID2D1GeometrySink_BeginFigure(sink, point, D2D1_FIGURE_BEGIN_FILLED);
8478 quadratic_to(sink, 280.0f, 80.0f, 300.0f, 80.0f);
8479 quadratic_to(sink, 300.0f, 160.0f, 300.0f, 240.0f);
8480 quadratic_to(sink, 280.0f, 240.0f, 260.0f, 240.0f);
8481 quadratic_to(sink, 260.0f, 160.0f, 260.0f, 80.0f);
8482 ID2D1GeometrySink_EndFigure(sink, D2D1_FIGURE_END_OPEN);
8483
8484 set_point(&point, 20.0f, 400.0f);
8485 ID2D1GeometrySink_BeginFigure(sink, point, D2D1_FIGURE_BEGIN_FILLED);
8486 quadratic_to(sink, 40.0f, 420.0f, 60.0f, 400.0f);
8487 quadratic_to(sink, 55.0f, 480.0f, 60.0f, 560.0f);
8488 quadratic_to(sink, 40.0f, 540.0f, 20.0f, 560.0f);
8489 quadratic_to(sink, 25.0f, 480.0f, 20.0f, 400.0f);
8490 ID2D1GeometrySink_EndFigure(sink, D2D1_FIGURE_END_CLOSED);
8491
8492 set_point(&point, 100.0f, 400.0f);
8493 ID2D1GeometrySink_BeginFigure(sink, point, D2D1_FIGURE_BEGIN_FILLED);
8494 quadratic_to(sink, 105.0f, 420.0f, 140.0f, 400.0f);
8495 quadratic_to(sink, 135.0f, 420.0f, 140.0f, 560.0f);
8496 quadratic_to(sink, 135.0f, 540.0f, 100.0f, 560.0f);
8497 quadratic_to(sink, 105.0f, 540.0f, 100.0f, 400.0f);
8498 ID2D1GeometrySink_EndFigure(sink, D2D1_FIGURE_END_CLOSED);
8499
8500 set_point(&point, 180.0f, 400.0f);
8501 ID2D1GeometrySink_BeginFigure(sink, point, D2D1_FIGURE_BEGIN_FILLED);
8502 quadratic_to(sink, 215.0f, 420.0f, 220.0f, 400.0f);
8503 quadratic_to(sink, 215.0f, 540.0f, 220.0f, 560.0f);
8504 quadratic_to(sink, 185.0f, 540.0f, 180.0f, 560.0f);
8505 quadratic_to(sink, 185.0f, 420.0f, 180.0f, 400.0f);
8506 ID2D1GeometrySink_EndFigure(sink, D2D1_FIGURE_END_CLOSED);
8507
8508 set_point(&point, 260.0f, 400.0f);
8509 ID2D1GeometrySink_BeginFigure(sink, point, D2D1_FIGURE_BEGIN_FILLED);
8510 quadratic_to(sink, 280.0f, 420.0f, 300.0f, 400.0f);
8511 quadratic_to(sink, 295.0f, 480.0f, 300.0f, 560.0f);
8512 quadratic_to(sink, 280.0f, 540.0f, 260.0f, 560.0f);
8513 quadratic_to(sink, 265.0f, 480.0f, 260.0f, 400.0f);
8514 ID2D1GeometrySink_EndFigure(sink, D2D1_FIGURE_END_OPEN);
8515
8516 set_point(&point, 20.0f, 720.0f);
8517 ID2D1GeometrySink_BeginFigure(sink, point, D2D1_FIGURE_BEGIN_FILLED);
8518 quadratic_to(sink, 40.0f, 700.0f, 60.0f, 720.0f);
8519 quadratic_to(sink, 65.0f, 800.0f, 60.0f, 880.0f);
8520 quadratic_to(sink, 40.0f, 900.0f, 20.0f, 880.0f);
8521 quadratic_to(sink, 15.0f, 800.0f, 20.0f, 720.0f);
8522 ID2D1GeometrySink_EndFigure(sink, D2D1_FIGURE_END_CLOSED);
8523
8524 set_point(&point, 100.0f, 720.0f);
8525 ID2D1GeometrySink_BeginFigure(sink, point, D2D1_FIGURE_BEGIN_FILLED);
8526 quadratic_to(sink, 105.0f, 700.0f, 140.0f, 720.0f);
8527 quadratic_to(sink, 145.0f, 740.0f, 140.0f, 880.0f);
8528 quadratic_to(sink, 135.0f, 900.0f, 100.0f, 880.0f);
8529 quadratic_to(sink, 95.0f, 860.0f, 100.0f, 720.0f);
8530 ID2D1GeometrySink_EndFigure(sink, D2D1_FIGURE_END_CLOSED);
8531
8532 set_point(&point, 180.0f, 720.0f);
8533 ID2D1GeometrySink_BeginFigure(sink, point, D2D1_FIGURE_BEGIN_FILLED);
8534 quadratic_to(sink, 215.0f, 700.0f, 220.0f, 720.0f);
8535 quadratic_to(sink, 225.0f, 860.0f, 220.0f, 880.0f);
8536 quadratic_to(sink, 185.0f, 900.0f, 180.0f, 880.0f);
8537 quadratic_to(sink, 175.0f, 740.0f, 180.0f, 720.0f);
8538 ID2D1GeometrySink_EndFigure(sink, D2D1_FIGURE_END_CLOSED);
8539
8540 set_point(&point, 260.0f, 720.0f);
8541 ID2D1GeometrySink_BeginFigure(sink, point, D2D1_FIGURE_BEGIN_FILLED);
8542 quadratic_to(sink, 280.0f, 700.0f, 300.0f, 720.0f);
8543 quadratic_to(sink, 305.0f, 800.0f, 300.0f, 880.0f);
8544 quadratic_to(sink, 280.0f, 900.0f, 260.0f, 880.0f);
8545 quadratic_to(sink, 255.0f, 800.0f, 260.0f, 720.0f);
8546 ID2D1GeometrySink_EndFigure(sink, D2D1_FIGURE_END_OPEN);
8547
8548 hr = ID2D1GeometrySink_Close(sink);
8549 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
8550 ID2D1GeometrySink_Release(sink);
8551
8552 ID2D1RenderTarget_BeginDraw(rt);
8553 ID2D1RenderTarget_Clear(rt, &color);
8554 ID2D1RenderTarget_FillGeometry(rt, (ID2D1Geometry *)geometry, (ID2D1Brush *)brush, NULL);
8555 hr = ID2D1RenderTarget_EndDraw(rt, NULL, NULL);
8556 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
8557 ID2D1PathGeometry_Release(geometry);
8558
8559 match = compare_figure(&ctx, 0, 0, 160, 160, 0xff652e89, 0,
8560 "qDJQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQ"
8561 "UFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQ"
8562 "UFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFCoMgAA");
8563 ok(match, "Figure does not match.\n");
8564 match = compare_figure(&ctx, 160, 0, 160, 160, 0xff652e89, 0,
8565 "qDJQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQ"
8566 "UFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQ"
8567 "UFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFCoMgAA");
8568 match = compare_figure(&ctx, 320, 0, 160, 160, 0xff652e89, 0,
8569 "qDJQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQ"
8570 "UFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQ"
8571 "UFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFCoMgAA");
8572 ok(match, "Figure does not match.\n");
8573 match = compare_figure(&ctx, 480, 0, 160, 160, 0xff652e89, 0,
8574 "qDJQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQ"
8575 "UFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQ"
8576 "UFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFCoMgAA");
8577 ok(match, "Figure does not match.\n");
8578
8579 match = compare_figure(&ctx, 0, 160, 160, 160, 0xff652e89, 16,
8580 "qDICTAJQB0IHUQs4C1IRLBFSGxgbUk5STlNMVExUTFRMVExVSlZKVkpWSlZKVkpXSFhIWEhYSFhI"
8581 "WEhYSFhIWEhYSFlGWkZaRlpGWkZaRlpGWkZaRlpGWkZaRlpGWkZaRlpGWkZaRlpGWkZaRlpGWkZa"
8582 "RllIWEhYSFhIWEhYSFhIWEhYSFhIV0pWSlZKVkpWSlZKVUxUTFRMVExUTFNOUk5SGxgbUhEsEVIL"
8583 "OAtRB0IHUAJMAqgy");
8584 ok(match, "Figure does not match.\n");
8585 match = compare_figure(&ctx, 160, 160, 160, 160, 0xff652e89, 16,
8586 "qDIBSwRQAkMKUQQ5EVIIKxtTDRkmVExUTFRMVEtVS1VLVkpWSlZKVklXSVdJV0lXSVhIWEhYSFhI"
8587 "WEhYSFhIWEhYSFhIWUdZR1lHWUdZR1lHWUdZR1lHWUdZSFhIWUdZR1lHWUdZR1lHWUdZR1lHWUdZ"
8588 "SFhIWEhYSFhIWEhYSFhIWEhYSFhJV0lXSVdJV0lWSlZKVkpWS1VLVUtUTFRMVExUJhkNUxsrCFIR"
8589 "OQRRCkMCUARLAagy");
8590 ok(match, "Figure does not match.\n");
8591 match = compare_figure(&ctx, 320, 160, 160, 160, 0xff652e89, 16,
8592 "qDIESwFRCkMCUhE5BFIbKwhTJhkNVExUTFRMVUtVS1VLVUpWSlZKV0lXSVdJV0lXSVdIWEhYSFhI"
8593 "WEhYSFhIWEhYSFhIWEdZR1lHWUdZR1lHWUdZR1lHWUdYSFhIWEdZR1lHWUdZR1lHWUdZR1lHWUdY"
8594 "SFhIWEhYSFhIWEhYSFhIWEhYSFdJV0lXSVdJV0lXSlZKVkpVS1VLVUtVTFRMVExUDRkmUwgrG1IE"
8595 "ORFSAkMKUQFLBKgy");
8596 ok(match, "Figure does not match.\n");
8597 match = compare_figure(&ctx, 480, 160, 160, 160, 0xff652e89, 16,
8598 "qDICTAJQB0IHUQs4C1IRLBFSGxgbUk5STlNMVExUTFRMVExVSlZKVkpWSlZKVkpXSFhIWEhYSFhI"
8599 "WEhYSFhIWEhYSFlGWkZaRlpGWkZaRlpGWkZaRlpGWkZaRlpGWkZaRlpGWkZaRlpGWkZaRlpGWkZa"
8600 "RllIWEhYSFhIWEhYSFhIWEhYSFhIV0pWSlZKVkpWSlZKVUxUTFRMVExUTFNOUk5SGxgbUhEsEVIL"
8601 "OAtRB0IHUAJMAqgy");
8602 ok(match, "Figure does not match.\n");
8603
8604 match = compare_figure(&ctx, 0, 320, 160, 160, 0xff652e89, 16,
8605 "pCwYfixuOGNCWUxSUFBQT1JOUk5STlJOUk1UTFRMVExUTFRLVkpWSlZKVkpWSlZJWEhYSFhIWEhY"
8606 "SFhIWEhYSFhIWEdaRlpGWkZaRlpGWkZaRlpGWkZaRlpGWkZaRlpGWkZaRlpGWkZaRlpGWkZaRlpG"
8607 "WkdYSFhIWEhYSFhIWEhYSFhIWEhYSVZKVkpWSlZKVkpWS1RMVExUTFRMVE1STlJOUk5STlJPUFBQ"
8608 "UkxZQmM4bix+GKQs");
8609 ok(match, "Figure does not match.\n");
8610 match = compare_figure(&ctx, 160, 320, 160, 160, 0xff652e89, 16,
8611 "liwZgQErcTllQ1xLVFBQUU9STlJNVExUTFRMVExVS1VLVUpWSlZKVkpXSVdJV0lXSVdIWEhYSFhI"
8612 "WEhYSFhIWEhYSFhIWEdZR1lHWUdZR1lHWUdZR1lHWUdZR1hIWEdZR1lHWUdZR1lHWUdZR1lHWUdZ"
8613 "R1hIWEhYSFhIWEhYSFhIWEhYSFhIV0lXSVdJV0lXSlZKVkpWSlVLVUtVTFRMVExUTFRNUk5ST1FQ"
8614 "UFRLXENlOXErgQEZliwA");
8615 ok(match, "Figure does not match.\n");
8616 match = compare_figure(&ctx, 320, 320, 160, 160, 0xff652e89, 16,
8617 "sSwZeytrOV9DVktRUE9RTlJOUk1UTFRMVExUS1VLVUtVS1ZKVkpWSVdJV0lXSVdJV0lYSFhIWEhY"
8618 "SFhIWEhYSFhIWEhYSFlHWUdZR1lHWUdZR1lHWUdZR1lIWEhYSFlHWUdZR1lHWUdZR1lHWUdZR1lI"
8619 "WEhYSFhIWEhYSFhIWEhYSFhIWElXSVdJV0lXSVdJVkpWSlZLVUtVS1VLVExUTFRMVE1STlJOUU9Q"
8620 "UUtWQ185ayt7GbEs");
8621 ok(match, "Figure does not match.\n");
8622 match = compare_figure(&ctx, 480, 320, 160, 160, 0xff652e89, 16,
8623 "pCwYfixuOGNCWUxSUFBQT1JOUk5STlJOUk1UTFRMVExUTFRLVkpWSlZKVkpWSlZJWEhYSFhIWEhY"
8624 "SFhIWEhYSFhIWEdaRlpGWkZaRlpGWkZaRlpGWkZaRlpGWkZaRlpGWkZaRlpGWkZaRlpGWkZaRlpG"
8625 "WkdYSFhIWEhYSFhIWEhYSFhIWEhYSVZKVkpWSlZKVkpWS1RMVExUTFRMVE1STlJOUk5STlJPUFBQ"
8626 "UkxZQmM4bix+GKQs");
8627 ok(match, "Figure does not match.\n");
8628
8629 hr = ID2D1Factory_CreatePathGeometry(factory, &geometry);
8630 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
8631 hr = ID2D1PathGeometry_Open(geometry, &sink);
8632 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
8633
8634 set_point(&point, -0.402914f, 0.915514f);
8635 ID2D1GeometrySink_BeginFigure(sink, point, D2D1_FIGURE_BEGIN_FILLED);
8636 quadratic_to(sink, -0.310379f, 0.882571f, -0.116057f, 0.824000f);
8637 quadratic_to(sink, 0.008350f, 0.693614f, -0.052343f, 0.448886f);
8638 quadratic_to(sink, -0.154236f, 0.246072f, -0.279229f, 0.025343f);
8639 quadratic_to(sink, -0.370064f, -0.588586f, -0.383029f, -0.924114f);
8640 quadratic_to(sink, -0.295479f, -0.958764f, -0.017086f, -0.988400f);
8641 quadratic_to(sink, 0.208836f, -0.954157f, 0.272200f, -0.924114f);
8642 quadratic_to(sink, 0.295614f, -0.569071f, 0.230143f, 0.022886f);
8643 quadratic_to(sink, 0.101664f, 0.220643f, 0.012057f, 0.451571f);
8644 quadratic_to(sink, -0.028764f, 0.709014f, 0.104029f, 0.833943f);
8645 quadratic_to(sink, 0.319414f, 0.913057f, 0.403229f, 0.942628f);
8646 quadratic_to(sink, 0.317721f, 1.023450f, -0.017086f, 1.021771f);
8647 quadratic_to(sink, -0.310843f, 1.007472f, -0.402914f, 0.915514f);
8648 ID2D1GeometrySink_EndFigure(sink, D2D1_FIGURE_END_CLOSED);
8649
8650 hr = ID2D1GeometrySink_Close(sink);
8651 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
8652 ID2D1GeometrySink_Release(sink);
8653
8655 translate_matrix(&matrix, 40.0f, 160.0f);
8656 scale_matrix(&matrix, 20.0f, 80.0f);
8657 hr = ID2D1Factory_CreateTransformedGeometry(factory,
8658 (ID2D1Geometry *)geometry, &matrix, &transformed_geometry[0]);
8659 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
8660
8662 translate_matrix(&matrix, 160.0f, 640.0f);
8663 scale_matrix(&matrix, 40.0f, 160.0f);
8664 rotate_matrix(&matrix, M_PI / -5.0f);
8665 hr = ID2D1Factory_CreateTransformedGeometry(factory,
8666 (ID2D1Geometry *)geometry, &matrix, &transformed_geometry[1]);
8667 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
8668 ID2D1PathGeometry_Release(geometry);
8669
8671 scale_matrix(&matrix, 0.5f, 1.0f);
8672 translate_matrix(&matrix, -80.0f, 0.0f);
8673 hr = ID2D1Factory_CreateTransformedGeometry(factory,
8674 (ID2D1Geometry *)transformed_geometry[1], &matrix, &transformed_geometry[2]);
8675 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
8676
8678 rotate_matrix(&matrix, M_PI / 2.0f);
8679 translate_matrix(&matrix, 80.0f, -320.0f);
8680 scale_matrix(&matrix, 2.0f, 0.25f);
8681 hr = ID2D1Factory_CreateTransformedGeometry(factory,
8682 (ID2D1Geometry *)transformed_geometry[2], &matrix, &transformed_geometry[3]);
8683 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
8684
8685 ID2D1RenderTarget_BeginDraw(rt);
8686 ID2D1RenderTarget_Clear(rt, &color);
8687 ID2D1RenderTarget_FillGeometry(rt, (ID2D1Geometry *)transformed_geometry[0], (ID2D1Brush *)brush, NULL);
8688 ID2D1RenderTarget_FillGeometry(rt, (ID2D1Geometry *)transformed_geometry[1], (ID2D1Brush *)brush, NULL);
8689 ID2D1RenderTarget_FillGeometry(rt, (ID2D1Geometry *)transformed_geometry[2], (ID2D1Brush *)brush, NULL);
8690 ID2D1RenderTarget_FillGeometry(rt, (ID2D1Geometry *)transformed_geometry[3], (ID2D1Brush *)brush, NULL);
8691 hr = ID2D1RenderTarget_EndDraw(rt, NULL, NULL);
8692 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
8693 ID2D1TransformedGeometry_Release(transformed_geometry[3]);
8694 ID2D1TransformedGeometry_Release(transformed_geometry[2]);
8695 ID2D1TransformedGeometry_Release(transformed_geometry[1]);
8696 ID2D1TransformedGeometry_Release(transformed_geometry[0]);
8697
8698 match = compare_figure(&ctx, 0, 0, 160, 160, 0xff652e89, 32,
8699 "6DMNjgEWiAEahgEahgEahgEahgEahgEahgEahgEahgEahgEahgEahwEZhwEZhwEZhwEZhwEZhwEZ"
8700 "hwEZhwEZhwEZiAEYiAEYiAEYiAEYiAEXiQEXiQEXiQEXigEWigEWigEWigEWigEWigEWigEWiwEU"
8701 "jAEUjAEUjAEUjQESjgESjwEQkAEQkQEOkgENlAEMlQEKlgEKlwEImAEImQEHmQEGmwEFmwEEnQED"
8702 "nQECngECngECnwEBnwEBnwEBnwEBnwEBnwECnQEDnQEDnQEEmwEFmgEHmQEHlwELkQERjAEXhgEd"
8703 "hAEfgwEchgEXjwEMqTEA");
8704 ok(match, "Figure does not match.\n");
8705 match = compare_figure(&ctx, 160, 0, 320, 160, 0xff652e89, 32,
8706 "h58BBrYCDq0CF6QCIJwCKJMCMIwCNoUCPf8BQ/kBSPQBTu4BTe8BTPEBSfUBRvgBQf0BPYECOYUC"
8707 "NIoCMI4CK+UBAS0W/AEHIwiPAgsaBZcCEAwIngIepAIaqAIWrAITsAIRsgIPtQIMtwILugIHwAIB"
8708 "ypwB");
8709 ok(match, "Figure does not match.\n");
8710 match = compare_figure(&ctx, 0, 160, 160, 320, 0xff652e89, 32,
8711 "wW4DnAEEmwEFmgEHmAEIlwEKlQELlAEMkwEOkQEPkAEQkAERjgESjgETjAEUjAEUiwEWigEWiQEX"
8712 "iQEYhwEZhwEZhgEbhQEbhAEchAEdggEeggEeggEfgAEggAEggAEhgAEggAEggQEggAEggAEggQEg"
8713 "gAEggQEfgQEfggEfgQEfgQEfggEfgQEfggEeggEfggEeggEegwEdgwEeggEegwEdgwEegwEdgwEd"
8714 "hAEchAEdhAEchAEchAEdhAEchAEchQEbhQEbhgEahgEahwEZhwEZiAEYiAEYiQEYiAEYiQEXiQEX"
8715 "igEWigEWiwEViwEViwEVjAEUjAEUjQETjQETjgESjgETjgESjwERkAEQkQEPkwENlAEMlQELlgEK"
8716 "lwEKlwEJmAEImQEHmgEGmwEFnAEEnQEEnQEDnQEDngECngEDngECngECnwECngECnwECngECngED"
8717 "ngECEgGLAQMQAosBAw4EjAEDCwaMAQQJBo0BBQYIjQEHAgqNARKOARKPARCQARCQARCQAQ+RAQ6S"
8718 "AQ6SAQ2TAQ2SAQ2TAQ2TAQyTAQyUAQyUAQuUAQuVAQuUAQuVAQqWAQmWAQqWAQmXAQiXAQiYAQeY"
8719 "AQeZAQWbAQSDZwAA");
8720 ok(match, "Figure does not match.\n");
8721 match = compare_figure(&ctx, 160, 160, 320, 320, 0xff652e89, 32,
8722 "g90BBLkCCLYCC7ICDrACEa0CFKoCF6cCGqQCHKMCHqECIJ8CIpwCJJsCJpkCKJcCKZYCK5QCLZIC"
8723 "L5ACMI8CMo0CNIsCNYoCN4gCOYcCOYYCO4QCPYICPoECQIACQYACQIECQIACQIECQIECQIECP4IC"
8724 "P4ICP4ECP4ICP4ICPoMCPoMCPoMCPYQCPYMCPYQCPYQCPYQCPIUCPIUCPIUCO4YCO4YCOoYCO4YC"
8725 "OocCOocCOocCOYgCOYgCOIkCOIkCN4oCNosCNYwCNI0CM44CMo4CM44CMo8CMZACMJECL5ICLpMC"
8726 "LZQCLJUCK5YCK5YCKpcCKZgCKJkCJ5oCJpsCJpsCJZwCJJ4CIqACIKICH6MCHaUCG6cCGakCF6wC"
8727 "Fa0CE68CEbECD7MCDrQCDLYCCrgCCbkCB7sCBrsCBbwCBbwCBL0CBL0CBL0CBL0CA70CBL0CBL0C"
8728 "BLwCBSUBlgIFIQSXAgYbCJcCBxcKmQIIEQ6ZAgoMEJoCDQUTnAIknAIjnQIingIhnwIgoAIfoQIe"
8729 "ogIdowIcpAIbpQIapQIZpgIZpgIZpwIYpwIXqAIXqAIXqQIVqgIVqgIUqwITrQISrQIRrgIQsAIO"
8730 "sQIMswILtQIIhs4B");
8731 ok(match, "Figure does not match.\n");
8732
8733 hr = ID2D1Factory_CreatePathGeometry(factory, &geometry);
8734 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
8735 hr = ID2D1PathGeometry_Open(geometry, &sink);
8736 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
8737
8738 set_point(&point, -0.402914f, 0.915514f);
8739 ID2D1GeometrySink_BeginFigure(sink, point, D2D1_FIGURE_BEGIN_HOLLOW);
8740 quadratic_to(sink, -0.310379f, 0.882571f, -0.116057f, 0.824000f);
8741 quadratic_to(sink, 0.008350f, 0.693614f, -0.052343f, 0.448886f);
8742 quadratic_to(sink, -0.154236f, 0.246072f, -0.279229f, 0.025343f);
8743 quadratic_to(sink, -0.370064f, -0.588586f, -0.383029f, -0.924114f);
8744 quadratic_to(sink, -0.295479f, -0.958764f, -0.017086f, -0.988400f);
8745 quadratic_to(sink, 0.208836f, -0.954157f, 0.272200f, -0.924114f);
8746 quadratic_to(sink, 0.295614f, -0.569071f, 0.230143f, 0.022886f);
8747 quadratic_to(sink, 0.101664f, 0.220643f, 0.012057f, 0.451571f);
8748 quadratic_to(sink, -0.028764f, 0.709014f, 0.104029f, 0.833943f);
8749 quadratic_to(sink, 0.319414f, 0.913057f, 0.403229f, 0.942628f);
8750 quadratic_to(sink, 0.317721f, 1.023450f, -0.017086f, 1.021771f);
8751 quadratic_to(sink, -0.310843f, 1.007472f, -0.402914f, 0.915514f);
8752 ID2D1GeometrySink_EndFigure(sink, D2D1_FIGURE_END_CLOSED);
8753
8754 hr = ID2D1GeometrySink_Close(sink);
8755 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
8756 ID2D1GeometrySink_Release(sink);
8757
8759 translate_matrix(&matrix, 40.0f, 160.0f);
8760 scale_matrix(&matrix, 20.0f, 80.0f);
8761 hr = ID2D1Factory_CreateTransformedGeometry(factory,
8762 (ID2D1Geometry *)geometry, &matrix, &transformed_geometry[0]);
8763 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
8764
8766 translate_matrix(&matrix, 160.0f, 640.0f);
8767 scale_matrix(&matrix, 40.0f, 160.0f);
8768 rotate_matrix(&matrix, M_PI / -5.0f);
8769 hr = ID2D1Factory_CreateTransformedGeometry(factory,
8770 (ID2D1Geometry *)geometry, &matrix, &transformed_geometry[1]);
8771 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
8772 ID2D1PathGeometry_Release(geometry);
8773
8775 scale_matrix(&matrix, 0.5f, 1.0f);
8776 translate_matrix(&matrix, -80.0f, 0.0f);
8777 hr = ID2D1Factory_CreateTransformedGeometry(factory,
8778 (ID2D1Geometry *)transformed_geometry[1], &matrix, &transformed_geometry[2]);
8779 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
8780
8782 rotate_matrix(&matrix, M_PI / 2.0f);
8783 translate_matrix(&matrix, 80.0f, -320.0f);
8784 scale_matrix(&matrix, 2.0f, 0.25f);
8785 hr = ID2D1Factory_CreateTransformedGeometry(factory,
8786 (ID2D1Geometry *)transformed_geometry[2], &matrix, &transformed_geometry[3]);
8787 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
8788
8789 ID2D1RenderTarget_BeginDraw(rt);
8790 ID2D1RenderTarget_Clear(rt, &color);
8791 ID2D1RenderTarget_FillGeometry(rt, (ID2D1Geometry *)transformed_geometry[0], (ID2D1Brush *)brush, NULL);
8792 ID2D1RenderTarget_FillGeometry(rt, (ID2D1Geometry *)transformed_geometry[1], (ID2D1Brush *)brush, NULL);
8793 ID2D1RenderTarget_FillGeometry(rt, (ID2D1Geometry *)transformed_geometry[2], (ID2D1Brush *)brush, NULL);
8794 ID2D1RenderTarget_FillGeometry(rt, (ID2D1Geometry *)transformed_geometry[3], (ID2D1Brush *)brush, NULL);
8795 hr = ID2D1RenderTarget_EndDraw(rt, NULL, NULL);
8796 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
8797 ID2D1TransformedGeometry_Release(transformed_geometry[3]);
8798 ID2D1TransformedGeometry_Release(transformed_geometry[2]);
8799 ID2D1TransformedGeometry_Release(transformed_geometry[1]);
8800 ID2D1TransformedGeometry_Release(transformed_geometry[0]);
8801
8802 match = compare_figure(&ctx, 0, 0, 160, 160, 0xff652e89, 0, "gMgB");
8803 ok(match, "Figure does not match.\n");
8804 match = compare_figure(&ctx, 160, 0, 320, 160, 0xff652e89, 0, "gJAD");
8805 ok(match, "Figure does not match.\n");
8806 match = compare_figure(&ctx, 0, 160, 160, 320, 0xff652e89, 0, "gJAD");
8807 ok(match, "Figure does not match.\n");
8808 match = compare_figure(&ctx, 160, 160, 320, 320, 0xff652e89, 0, "gKAG");
8809 ok(match, "Figure does not match.\n");
8810
8811 ID2D1SolidColorBrush_Release(brush);
8813}

Referenced by START_TEST().

◆ test_geometry_group()

static void test_geometry_group ( BOOL  d3d11)
static

Definition at line 10714 of file d2d1.c.

10715{
10716 struct d2d1_test_context ctx;
10717 ID2D1Geometry *geometries[2];
10721 HRESULT hr;
10722 BOOL match;
10723
10724 if (!init_test_context(&ctx, d3d11))
10725 return;
10726
10727 set_rect(&rect, -1.0f, -1.0f, 1.0f, 1.0f);
10728 hr = ID2D1Factory_CreateRectangleGeometry(ctx.factory, &rect, (ID2D1RectangleGeometry **)&geometries[0]);
10729 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
10730
10731 set_rect(&rect, -2.0f, -2.0f, 0.0f, 2.0f);
10732 hr = ID2D1Factory_CreateRectangleGeometry(ctx.factory, &rect, (ID2D1RectangleGeometry **)&geometries[1]);
10733 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
10734
10735 hr = ID2D1Factory_CreateGeometryGroup(ctx.factory, D2D1_FILL_MODE_ALTERNATE, geometries, 2, &group);
10736 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
10737
10738 set_rect(&rect, 0.0f, 0.0f, 0.0f, 0.0f);
10739 hr = ID2D1GeometryGroup_GetBounds(group, NULL, &rect);
10740 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
10741 match = compare_rect(&rect, -2.0f, -2.0f, 1.0f, 2.0f, 0);
10742 ok(match, "Got unexpected rectangle {%.8e, %.8e, %.8e, %.8e}.\n",
10744
10746 translate_matrix(&matrix, 80.0f, 640.0f);
10747 scale_matrix(&matrix, 2.0f, 0.5f);
10748 hr = ID2D1GeometryGroup_GetBounds(group, &matrix, &rect);
10749 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
10750 match = compare_rect(&rect, 76.0f, 639.0f, 82.0f, 641.0f, 0);
10751 ok(match, "Got unexpected rectangle {%.8e, %.8e, %.8e, %.8e}.\n",
10753
10754 ID2D1GeometryGroup_Release(group);
10755
10756 ID2D1Geometry_Release(geometries[0]);
10757 ID2D1Geometry_Release(geometries[1]);
10758
10760}
GLboolean GLuint group
Definition: glext.h:11120

Referenced by START_TEST().

◆ test_get_effect_properties()

static void test_get_effect_properties ( BOOL  d3d11)
static

Definition at line 14870 of file d2d1.c.

14871{
14872 ID2D1Properties *properties, *properties2;
14873 struct d2d1_test_context ctx;
14878 WCHAR buffW[64];
14879 ULONG refcount;
14880 HRESULT hr;
14881
14882 if (!init_test_context(&ctx, d3d11))
14883 return;
14884
14885 factory = ctx.factory1;
14886 if (!factory)
14887 {
14889 return;
14890 }
14891
14892 hr = ID2D1Factory1_GetEffectProperties(factory, &GUID_NULL, &properties);
14893 ok(hr == HRESULT_FROM_WIN32(ERROR_NOT_FOUND), "Unexpected hr %#lx.\n", hr);
14894
14895 hr = ID2D1Factory1_GetEffectProperties(factory, &CLSID_D2D1Crop, &properties);
14896 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
14897 refcount = get_refcount(properties);
14898 ok(refcount == 2, "Unexpected refcount %lu.\n", refcount);
14899
14900 hr = ID2D1Factory1_GetEffectProperties(factory, &CLSID_D2D1Crop, &properties2);
14901 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
14902 ok(properties == properties2, "Unexpected instance.\n");
14903 refcount = get_refcount(properties);
14904 ok(refcount == 3, "Unexpected refcount %lu.\n", refcount);
14905 ID2D1Properties_Release(properties2);
14906
14907 count = ID2D1Properties_GetPropertyCount(properties);
14908 todo_wine
14909 ok(count == 2, "Unexpected property count %u.\n", count);
14910
14911 hr = ID2D1Properties_GetPropertyName(properties, 0, buffW, ARRAY_SIZE(buffW));
14912 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
14913 ok(!wcscmp(buffW, L"Rect"), "Unexpected name %s.\n", debugstr_w(buffW));
14914
14915 count = ID2D1Properties_GetPropertyNameLength(properties, 0);
14916 ok(count == 4, "Unexpected name length %u.\n", count);
14917
14918 type = ID2D1Properties_GetType(properties, 0);
14919 ok(type == D2D1_PROPERTY_TYPE_VECTOR4, "Unexpected property type %u.\n", type);
14920
14921 index = ID2D1Properties_GetPropertyIndex(properties, L"prop");
14922 ok(index == ~0u, "Unexpected index %u.\n", index);
14923
14924 set_vec4(&rect, 0.0f, 2.0f, 10.0f, 20.0f);
14925 hr = ID2D1Properties_SetValue(properties, D2D1_CROP_PROP_RECT, D2D1_PROPERTY_TYPE_VECTOR4,
14926 (const BYTE *)&rect, sizeof(rect));
14927 ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
14928
14929 hr = ID2D1Properties_SetValue(properties, 1000, D2D1_PROPERTY_TYPE_VECTOR4,
14930 (const BYTE *)&rect, sizeof(rect));
14931 ok(hr == D2DERR_INVALID_PROPERTY, "Unexpected hr %#lx.\n", hr);
14932
14933 set_vec4(&rect2, 1.0f, 2.0f, 3.0f, 4.0f);
14934 set_vec4(&rect, 0.0f, .0f, 0.0f, 0.0f);
14935 hr = ID2D1Properties_GetValue(properties, D2D1_CROP_PROP_RECT, D2D1_PROPERTY_TYPE_VECTOR4,
14936 (BYTE *)&rect2, sizeof(rect2));
14937 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
14938 ok(!memcmp(&rect, &rect2, sizeof(rect)), "Unexpected value.\n");
14939
14940 ID2D1Properties_Release(properties);
14941
14943}
static void set_vec4(D2D_VECTOR_4F *vec, float x, float y, float z, float w)
Definition: d2d1.c:503
RECT rect2
Definition: edittest.c:51

Referenced by START_TEST().

◆ test_gradient()

static void test_gradient ( BOOL  d3d11)
static

Definition at line 7025 of file d2d1.c.

7026{
7028 D2D1_GRADIENT_STOP stops[3], stops2[3];
7029 struct d2d1_test_context ctx;
7032 unsigned int i;
7033 UINT32 count;
7034 HRESULT hr;
7035
7036 if (!init_test_context(&ctx, d3d11))
7037 return;
7038
7039 rt = ctx.rt;
7040 stops2[0].position = 0.5f;
7041 set_color(&stops2[0].color, 1.0f, 1.0f, 0.0f, 1.0f);
7042 stops2[1] = stops2[0];
7043 hr = ID2D1RenderTarget_CreateGradientStopCollection(rt, stops2, 2, D2D1_GAMMA_2_2,
7044 D2D1_EXTEND_MODE_CLAMP, &gradient);
7045 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
7046
7047 count = ID2D1GradientStopCollection_GetGradientStopCount(gradient);
7048 ok(count == 2, "Unexpected stop count %u.\n", count);
7049
7050 /* Request more stops than collection has. */
7051 stops[0].position = 123.4f;
7052 set_color(&stops[0].color, 1.0f, 0.5f, 0.4f, 1.0f);
7053 color = stops[0].color;
7054 stops[2] = stops[1] = stops[0];
7055 ID2D1GradientStopCollection_GetGradientStops(gradient, stops, ARRAY_SIZE(stops));
7056 ok(!memcmp(stops, stops2, sizeof(*stops) * count), "Unexpected gradient stops array.\n");
7057 for (i = count; i < ARRAY_SIZE(stops); ++i)
7058 {
7059 ok(stops[i].position == 123.4f, "%u: unexpected stop position %f.\n", i, stops[i].position);
7060 ok(!memcmp(&stops[i].color, &color, sizeof(color)), "%u: unexpected stop color.\n", i);
7061 }
7062
7063 ID2D1GradientStopCollection_Release(gradient);
7064
7066}
D2D1_COLOR_F color
Definition: d2d1.idl:357

Referenced by START_TEST().

◆ test_hwnd_target()

static void test_hwnd_target ( BOOL  d3d11)
static

Definition at line 6268 of file d2d1.c.

6269{
6273 ID2D1HwndRenderTarget *rt, *rt2;
6275 struct d2d1_test_context ctx;
6276 ID2D1RenderTarget *rt3;
6278 unsigned int i;
6279 HRESULT hr;
6280
6281 static const struct format_test
6282 {
6284 D2D1_PIXEL_FORMAT expected_format;
6285 BOOL expected_failure;
6286 }
6287 format_tests[] =
6288 {
6289 {{DXGI_FORMAT_UNKNOWN, D2D1_ALPHA_MODE_UNKNOWN}, {DXGI_FORMAT_B8G8R8A8_UNORM, D2D1_ALPHA_MODE_IGNORE}},
6290 {{DXGI_FORMAT_UNKNOWN, D2D1_ALPHA_MODE_PREMULTIPLIED}, {DXGI_FORMAT_B8G8R8A8_UNORM, D2D1_ALPHA_MODE_PREMULTIPLIED}},
6291 {{DXGI_FORMAT_UNKNOWN, D2D1_ALPHA_MODE_STRAIGHT}, {DXGI_FORMAT_B8G8R8A8_UNORM, D2D1_ALPHA_MODE_STRAIGHT}, TRUE},
6292 {{DXGI_FORMAT_UNKNOWN, D2D1_ALPHA_MODE_IGNORE}, {DXGI_FORMAT_B8G8R8A8_UNORM, D2D1_ALPHA_MODE_IGNORE}},
6293 {{DXGI_FORMAT_B8G8R8A8_UNORM, D2D1_ALPHA_MODE_UNKNOWN}, {DXGI_FORMAT_B8G8R8A8_UNORM, D2D1_ALPHA_MODE_IGNORE}},
6294 {{DXGI_FORMAT_B8G8R8A8_UNORM, D2D1_ALPHA_MODE_PREMULTIPLIED}, {DXGI_FORMAT_B8G8R8A8_UNORM, D2D1_ALPHA_MODE_PREMULTIPLIED}},
6295 {{DXGI_FORMAT_B8G8R8A8_UNORM, D2D1_ALPHA_MODE_STRAIGHT}, {DXGI_FORMAT_B8G8R8A8_UNORM, D2D1_ALPHA_MODE_STRAIGHT}, TRUE},
6296 {{DXGI_FORMAT_B8G8R8A8_UNORM, D2D1_ALPHA_MODE_IGNORE}, {DXGI_FORMAT_B8G8R8A8_UNORM, D2D1_ALPHA_MODE_IGNORE}},
6297 };
6298
6299 if (!init_test_context(&ctx, d3d11))
6300 return;
6301
6303 desc.pixelFormat.format = DXGI_FORMAT_B8G8R8A8_UNORM;
6304 desc.pixelFormat.alphaMode = D2D1_ALPHA_MODE_PREMULTIPLIED;
6305 desc.dpiX = 0.0f;
6306 desc.dpiY = 0.0f;
6309
6310 hwnd_rt_desc.hwnd = NULL;
6311 hwnd_rt_desc.pixelSize.width = 64;
6312 hwnd_rt_desc.pixelSize.height = 64;
6314
6315 hr = ID2D1Factory_CreateHwndRenderTarget(ctx.factory, &desc, &hwnd_rt_desc, &rt);
6316 ok(hr != S_OK, "Got unexpected hr %#lx.\n", hr);
6317
6318 hwnd_rt_desc.hwnd = (HWND)0xdeadbeef;
6319 hr = ID2D1Factory_CreateHwndRenderTarget(ctx.factory, &desc, &hwnd_rt_desc, &rt);
6320 ok(hr != S_OK, "Got unexpected hr %#lx.\n", hr);
6321
6322 hwnd_rt_desc.hwnd = CreateWindowA("static", "d2d_test", 0, 0, 0, 0, 0, 0, 0, 0, 0);
6323 ok(!!hwnd_rt_desc.hwnd, "Failed to create target window.\n");
6324 hr = ID2D1Factory_CreateHwndRenderTarget(ctx.factory, &desc, &hwnd_rt_desc, &rt);
6325 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
6326
6327 hr = ID2D1HwndRenderTarget_QueryInterface(rt, &IID_ID2D1GdiInteropRenderTarget, (void **)&interop);
6328 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
6329 hr = ID2D1GdiInteropRenderTarget_QueryInterface(interop, &IID_ID2D1RenderTarget, (void **)&rt3);
6330 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
6331 ok(rt3 == (ID2D1RenderTarget *)rt, "Unexpected render target\n");
6332 ID2D1RenderTarget_Release(rt3);
6333 hr = ID2D1GdiInteropRenderTarget_QueryInterface(interop, &IID_ID2D1HwndRenderTarget, (void **)&rt2);
6334 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
6335 ok(rt2 == rt, "Unexpected render target\n");
6336 ID2D1HwndRenderTarget_Release(rt2);
6337 ID2D1GdiInteropRenderTarget_Release(interop);
6338
6339 size.width = 128;
6340 size.height = 64;
6341 hr = ID2D1HwndRenderTarget_Resize(rt, &size);
6342 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
6343
6344 ID2D1HwndRenderTarget_Release(rt);
6345
6346 /* Test render target format */
6347 for (i = 0; i < ARRAY_SIZE(format_tests); ++i)
6348 {
6349 winetest_push_context("test %d", i);
6350
6351 desc.pixelFormat = format_tests[i].format;
6352 hr = ID2D1Factory_CreateHwndRenderTarget(ctx.factory, &desc, &hwnd_rt_desc, &rt);
6353 if (format_tests[i].expected_failure)
6354 {
6355 ok(hr == D2DERR_UNSUPPORTED_PIXEL_FORMAT, "Got unexpected hr %#lx.\n", hr);
6357 continue;
6358 }
6359 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
6360
6361 pixel_format = ID2D1HwndRenderTarget_GetPixelFormat(rt);
6362 ok(pixel_format.format == format_tests[i].expected_format.format,
6363 "Got unexpected format %#x.\n", pixel_format.format);
6364 ok(pixel_format.alphaMode == format_tests[i].expected_format.alphaMode,
6365 "Got unexpected alpha mode %d.\n", pixel_format.alphaMode);
6366
6367 ID2D1HwndRenderTarget_Release(rt);
6369 }
6370
6371 DestroyWindow(hwnd_rt_desc.hwnd);
6373}
HANDLE HWND
Definition: compat.h:19

Referenced by START_TEST().

◆ test_hwnd_target_gdi_interop()

static void test_hwnd_target_gdi_interop ( BOOL  d3d11)
static

Definition at line 6375 of file d2d1.c.

6376{
6380 struct d2d1_test_context ctx;
6382 HRESULT hr;
6383 HDC dc;
6384
6385 if (!init_test_context(&ctx, d3d11))
6386 return;
6387
6389 desc.pixelFormat.format = DXGI_FORMAT_B8G8R8A8_UNORM;
6390 desc.pixelFormat.alphaMode = D2D1_ALPHA_MODE_PREMULTIPLIED;
6391 desc.dpiX = 0.0f;
6392 desc.dpiY = 0.0f;
6395
6396 hwnd_rt_desc.hwnd = create_window();
6397 hwnd_rt_desc.pixelSize.width = 64;
6398 hwnd_rt_desc.pixelSize.height = 64;
6400
6401 hr = ID2D1Factory_CreateHwndRenderTarget(ctx.factory, &desc, &hwnd_rt_desc, &rt);
6402 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
6403
6404 hr = ID2D1HwndRenderTarget_QueryInterface(rt, &IID_ID2D1GdiInteropRenderTarget, (void **)&interop);
6405 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
6406 ID2D1HwndRenderTarget_BeginDraw(rt);
6407 dc = (void *)0xdeadbeef;
6408 hr = ID2D1GdiInteropRenderTarget_GetDC(interop, D2D1_DC_INITIALIZE_MODE_COPY, &dc);
6409 ok(hr == D2DERR_TARGET_NOT_GDI_COMPATIBLE, "Got unexpected hr %#lx.\n", hr);
6410 ok(!dc, "Got unexpected DC %p.\n", dc);
6411 hr = ID2D1HwndRenderTarget_EndDraw(rt, NULL, NULL);
6412 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
6413 ID2D1GdiInteropRenderTarget_Release(interop);
6414
6415 ID2D1HwndRenderTarget_Release(rt);
6416
6417 /* GDI-compatible. */
6419
6420 hr = ID2D1Factory_CreateHwndRenderTarget(ctx.factory, &desc, &hwnd_rt_desc, &rt);
6421 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
6422
6423 hr = ID2D1HwndRenderTarget_QueryInterface(rt, &IID_ID2D1GdiInteropRenderTarget, (void **)&interop);
6424 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
6425 ID2D1HwndRenderTarget_BeginDraw(rt);
6426 dc = (void *)0xdeadbeef;
6427 hr = ID2D1GdiInteropRenderTarget_GetDC(interop, D2D1_DC_INITIALIZE_MODE_COPY, &dc);
6428 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
6429 ok(!!dc, "Got unexpected DC %p.\n", dc);
6430 hr = ID2D1GdiInteropRenderTarget_ReleaseDC(interop, NULL);
6431 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
6432 hr = ID2D1HwndRenderTarget_EndDraw(rt, NULL, NULL);
6433 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
6434 ID2D1GdiInteropRenderTarget_Release(interop);
6435
6436 ID2D1HwndRenderTarget_Release(rt);
6437
6438 DestroyWindow(hwnd_rt_desc.hwnd);
6440}

Referenced by START_TEST().

◆ test_hwnd_target_is_supported()

static void test_hwnd_target_is_supported ( BOOL  d3d11)
static

Definition at line 14106 of file d2d1.c.

14107{
14108 static const unsigned int target_types[] =
14109 {
14113 };
14114 static const unsigned int usages[] =
14115 {
14120 };
14121 static const D2D1_PIXEL_FORMAT pixel_formats[] =
14122 {
14123 { DXGI_FORMAT_UNKNOWN, D2D1_ALPHA_MODE_UNKNOWN },
14124 { DXGI_FORMAT_UNKNOWN, D2D1_ALPHA_MODE_PREMULTIPLIED },
14125 { DXGI_FORMAT_UNKNOWN, D2D1_ALPHA_MODE_IGNORE },
14126
14127 { DXGI_FORMAT_R8G8B8A8_UNORM, D2D1_ALPHA_MODE_UNKNOWN },
14128 { DXGI_FORMAT_R8G8B8A8_UNORM, D2D1_ALPHA_MODE_PREMULTIPLIED },
14129 { DXGI_FORMAT_R8G8B8A8_UNORM, D2D1_ALPHA_MODE_IGNORE },
14130
14131 { DXGI_FORMAT_B8G8R8A8_UNORM, D2D1_ALPHA_MODE_UNKNOWN },
14132 { DXGI_FORMAT_B8G8R8A8_UNORM, D2D1_ALPHA_MODE_PREMULTIPLIED },
14133 { DXGI_FORMAT_B8G8R8A8_UNORM, D2D1_ALPHA_MODE_IGNORE },
14134 };
14135 static const D2D1_PIXEL_FORMAT unsupported_pixel_formats[] =
14136 {
14137 { DXGI_FORMAT_UNKNOWN, D2D1_ALPHA_MODE_STRAIGHT },
14138 { DXGI_FORMAT_R8G8B8A8_UNORM, D2D1_ALPHA_MODE_STRAIGHT },
14139 { DXGI_FORMAT_B8G8R8A8_UNORM, D2D1_ALPHA_MODE_STRAIGHT },
14140 { DXGI_FORMAT_R16G16B16A16_UNORM, D2D1_ALPHA_MODE_UNKNOWN },
14141 };
14142 D2D1_RENDER_TARGET_PROPERTIES desc, template_desc, test_desc;
14144 D2D1_BITMAP_PROPERTIES1 bitmap_desc;
14145 ID2D1DeviceContext *device_context;
14147 struct d2d1_test_context ctx;
14149 BOOL expected, supported;
14151 unsigned int i, j;
14153 HWND window;
14154 HRESULT hr;
14155
14156 if (!init_test_context(&ctx, d3d11))
14157 return;
14158
14160 ok(!!window, "Failed to create test window.\n");
14161
14162 template_desc.type = D2D1_RENDER_TARGET_TYPE_DEFAULT;
14163 template_desc.pixelFormat.format = DXGI_FORMAT_UNKNOWN;
14164 template_desc.pixelFormat.alphaMode = D2D1_ALPHA_MODE_IGNORE;
14165 template_desc.dpiX = 96.0f;
14166 template_desc.dpiY = 96.0f;
14167 template_desc.usage = D2D1_RENDER_TARGET_USAGE_NONE;
14168 template_desc.minLevel = D2D1_FEATURE_LEVEL_DEFAULT;
14169
14170 hwnd_rt_desc.hwnd = window;
14171 hwnd_rt_desc.pixelSize.width = 64;
14172 hwnd_rt_desc.pixelSize.height = 64;
14174
14175 /* Make sure the template render target description is valid */
14176 hr = ID2D1Factory_CreateHwndRenderTarget(ctx.factory, &template_desc, &hwnd_rt_desc, &rt);
14177 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
14178 supported = ID2D1HwndRenderTarget_IsSupported(rt, &template_desc);
14179 ok(supported, "Expected supported.\n");
14180 ID2D1HwndRenderTarget_Release(rt);
14181
14182 /* Test that SetTarget() with a bitmap of a different usage doesn't change the render target usage. */
14183 hr = ID2D1Factory_CreateHwndRenderTarget(ctx.factory, &template_desc, &hwnd_rt_desc, &rt);
14184 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
14185 hr = ID2D1HwndRenderTarget_QueryInterface(rt, &IID_ID2D1DeviceContext, (void **)&device_context);
14186 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
14187
14188 test_desc = template_desc;
14190 supported = ID2D1HwndRenderTarget_IsSupported(rt, &test_desc);
14191 ok(!supported, "Expected unsupported.\n");
14192
14193 memset(&bitmap_desc, 0, sizeof(bitmap_desc));
14194 bitmap_desc.pixelFormat = ID2D1DeviceContext_GetPixelFormat(device_context);
14196 size.width = 4;
14197 size.height = 4;
14198 hr = ID2D1DeviceContext_CreateBitmap(device_context, size, NULL, 0, &bitmap_desc, &bitmap);
14199 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
14200 ID2D1DeviceContext_SetTarget(device_context, (ID2D1Image *)bitmap);
14201 supported = ID2D1HwndRenderTarget_IsSupported(rt, &test_desc);
14202 ok(!supported, "Expected unsupported.\n");
14203 ID2D1Bitmap1_Release(bitmap);
14204
14205 /* Test that SetTarget() with a bitmap of a different format changes the render target format */
14206 test_desc = template_desc;
14208 test_desc.pixelFormat.alphaMode = D2D1_ALPHA_MODE_PREMULTIPLIED;
14209 supported = ID2D1HwndRenderTarget_IsSupported(rt, &test_desc);
14210 ok(!supported, "Expected unsupported.\n");
14211
14212 memset(&bitmap_desc, 0, sizeof(bitmap_desc));
14214 bitmap_desc.pixelFormat.alphaMode = D2D1_ALPHA_MODE_PREMULTIPLIED;
14216 size.width = 4;
14217 size.height = 4;
14218 hr = ID2D1DeviceContext_CreateBitmap(device_context, size, NULL, 0, &bitmap_desc, &bitmap);
14219 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
14220 ID2D1DeviceContext_SetTarget(device_context, (ID2D1Image *)bitmap);
14221 pixel_format = ID2D1DeviceContext_GetPixelFormat(device_context);
14222 ok(pixel_format.format == DXGI_FORMAT_R8G8B8A8_UNORM, "Got unexpected format %#x.\n", pixel_format.format);
14223 ok(pixel_format.alphaMode == D2D1_ALPHA_MODE_PREMULTIPLIED, "Got unexpected alpha %u.\n", pixel_format.alphaMode);
14224 supported = ID2D1HwndRenderTarget_IsSupported(rt, &test_desc);
14225 ok(supported, "Expected supported.\n");
14226 ID2D1Bitmap1_Release(bitmap);
14227
14228 ID2D1DeviceContext_Release(device_context);
14229 ID2D1HwndRenderTarget_Release(rt);
14230
14231 /* Target type. */
14232 for (i = 0; i < ARRAY_SIZE(target_types); ++i)
14233 {
14234 /* Default target type resolves to either HW or SW, there is no way to tell. */
14235 desc = template_desc;
14236 desc.type = target_types[i];
14237 hr = ID2D1Factory_CreateHwndRenderTarget(ctx.factory, &desc, &hwnd_rt_desc, &rt);
14239 {
14240 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
14241
14242 test_desc = template_desc;
14244 supported = ID2D1HwndRenderTarget_IsSupported(rt, &test_desc);
14245 ok(supported, "Unexpected return value %d.\n", supported);
14246 }
14247 else
14248 {
14249 if (FAILED(hr))
14250 continue;
14251
14252 for (j = 0; j < ARRAY_SIZE(target_types); ++j)
14253 {
14254 winetest_push_context("type test %u/%u", i, j);
14255
14256 test_desc = template_desc;
14257 test_desc.type = target_types[j];
14258 supported = ID2D1HwndRenderTarget_IsSupported(rt, &test_desc);
14259 expected = target_types[j] == D2D1_RENDER_TARGET_TYPE_DEFAULT
14260 || target_types[i] == target_types[j];
14261 ok(supported == expected, "Unexpected return value %d.\n", supported);
14262
14264 }
14265 }
14266
14267 ID2D1HwndRenderTarget_Release(rt);
14268 }
14269
14270 /* Pixel formats. */
14271 for (i = 0; i < ARRAY_SIZE(pixel_formats); ++i)
14272 {
14273 desc = template_desc;
14274 desc.pixelFormat = pixel_formats[i];
14275 hr = ID2D1Factory_CreateHwndRenderTarget(ctx.factory, &desc, &hwnd_rt_desc, &rt);
14276 ok(hr == S_OK, "%u: unexpected hr %#lx.\n", i, hr);
14277
14278 /* Resolve to default format. */
14279 if (desc.pixelFormat.format == DXGI_FORMAT_UNKNOWN)
14280 desc.pixelFormat.format = DXGI_FORMAT_B8G8R8A8_UNORM;
14281 if (desc.pixelFormat.alphaMode == D2D1_ALPHA_MODE_UNKNOWN)
14282 desc.pixelFormat.alphaMode = D2D1_ALPHA_MODE_IGNORE;
14283
14284 for (j = 0; j < ARRAY_SIZE(pixel_formats); ++j)
14285 {
14286 BOOL format_supported, alpha_mode_supported;
14287
14288 winetest_push_context("format test %u/%u.", i, j);
14289
14290 test_desc = template_desc;
14291 test_desc.pixelFormat = pixel_formats[j];
14292 supported = ID2D1HwndRenderTarget_IsSupported(rt, &test_desc);
14293
14295 || pixel_formats[j].format == desc.pixelFormat.format;
14296 alpha_mode_supported = pixel_formats[j].alphaMode == D2D1_ALPHA_MODE_UNKNOWN
14297 || pixel_formats[j].alphaMode == desc.pixelFormat.alphaMode;
14298 expected = format_supported && alpha_mode_supported;
14299 ok(supported == expected, "Unexpected return value.\n");
14300
14302 }
14303
14304 for (j = 0; j < ARRAY_SIZE(unsupported_pixel_formats); ++j)
14305 {
14306 test_desc = template_desc;
14307 test_desc.pixelFormat = unsupported_pixel_formats[j];
14308 supported = ID2D1HwndRenderTarget_IsSupported(rt, &test_desc);
14309 ok(!supported, "Unexpected return value.\n");
14310 }
14311
14312 ID2D1HwndRenderTarget_Release(rt);
14313 }
14314
14315 /* Target usage. */
14316 for (i = 0; i < ARRAY_SIZE(usages); ++i)
14317 {
14318 desc = template_desc;
14319 desc.usage = usages[i];
14320 hr = ID2D1Factory_CreateHwndRenderTarget(ctx.factory, &desc, &hwnd_rt_desc, &rt);
14321 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
14322
14323 for (j = 0; j < ARRAY_SIZE(usages); ++j)
14324 {
14325 winetest_push_context("usage %#x testing usage %#x", usages[i], usages[j]);
14326
14327 desc = template_desc;
14328 desc.usage = usages[j];
14329 supported = ID2D1HwndRenderTarget_IsSupported(rt, &desc);
14330 expected = (usages[i] & usages[j]) == usages[j];
14331 ok(supported == expected, "Unexpected result %d.\n", supported);
14332
14334 }
14335
14336 ID2D1HwndRenderTarget_Release(rt);
14337 }
14338
14340
14342}

Referenced by START_TEST().

◆ test_image_bounds()

static void test_image_bounds ( BOOL  d3d11)
static

Definition at line 13658 of file d2d1.c.

13659{
13660 D2D1_BITMAP_PROPERTIES bitmap_desc;
13661 struct d2d1_test_context ctx;
13663 D2D1_UNIT_MODE unit_mode;
13666 float dpi_x, dpi_y;
13667 D2D_RECT_F bounds;
13669 unsigned int i;
13670 HRESULT hr;
13671
13672 const struct bitmap_bounds_test
13673 {
13674 float dpi_x;
13675 float dpi_y;
13676 D2D_SIZE_U pixel_size;
13677 }
13678 bitmap_bounds_tests[] =
13679 {
13680 {96.0f, 96.0f, {100, 100}},
13681 {48.0f, 48.0f, {100, 100}},
13682 {192.0f, 192.0f, {100, 100}},
13683 {96.0f, 10.0f, {100, 100}},
13684 {50.0f, 100.0f, {100, 100}},
13685 {150.0f, 150.0f, {100, 100}},
13686 {48.0f, 48.0f, {1, 1}},
13687 {192.0f, 192.0f, {1, 1}},
13688 };
13689
13690 if (!init_test_context(&ctx, d3d11))
13691 return;
13692
13693 factory = ctx.factory1;
13694 if (!factory)
13695 {
13696 win_skip("ID2D1Factory1 is not supported.\n");
13698 return;
13699 }
13700
13701 context = ctx.context;
13702
13703 for (i = 0; i < ARRAY_SIZE(bitmap_bounds_tests); ++i)
13704 {
13705 const struct bitmap_bounds_test *test = &bitmap_bounds_tests[i];
13706 winetest_push_context("Test %u", i);
13707
13708 bitmap_desc.dpiX = test->dpi_x;
13709 bitmap_desc.dpiY = test->dpi_y;
13711 bitmap_desc.pixelFormat.alphaMode = D2D1_ALPHA_MODE_IGNORE;
13712 hr = ID2D1RenderTarget_CreateBitmap(ctx.rt, test->pixel_size, NULL, 0, &bitmap_desc, &bitmap);
13713 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
13714
13715 set_rect(&bounds, 0.0f, 0.0f, 0.0f, 0.0f);
13716 size = ID2D1Bitmap_GetSize(bitmap);
13717 hr = ID2D1DeviceContext_GetImageLocalBounds(context, (ID2D1Image *)bitmap, &bounds);
13718 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
13719 ok(compare_rect(&bounds, 0.0f, 0.0f, size.width, size.height, 0),
13720 "Got unexpected bounds {%.8e, %.8e, %.8e, %.8e}, expected {%.8e, %.8e, %.8e, %.8e}.\n",
13721 bounds.left, bounds.top, bounds.right, bounds.bottom, 0.0f, 0.0f, size.width, size.height);
13722
13723 /* Test bitmap local bounds after changing context dpi */
13724 ID2D1DeviceContext_GetDpi(context, &dpi_x, &dpi_y);
13725 ID2D1DeviceContext_SetDpi(context, dpi_x * 2.0f, dpi_y * 2.0f);
13726 hr = ID2D1DeviceContext_GetImageLocalBounds(context, (ID2D1Image *)bitmap, &bounds);
13727 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
13728 ok(compare_rect(&bounds, 0.0f, 0.0f, size.width, size.height, 0),
13729 "Got unexpected bounds {%.8e, %.8e, %.8e, %.8e}, expected {%.8e, %.8e, %.8e, %.8e}.\n",
13730 bounds.left, bounds.top, bounds.right, bounds.bottom, 0.0f, 0.0f, size.width, size.height);
13731 ID2D1DeviceContext_SetDpi(context, dpi_x, dpi_y);
13732
13733 /* Test bitmap local bounds after changing context unit mode */
13734 unit_mode = ID2D1DeviceContext_GetUnitMode(context);
13735 ok(unit_mode == D2D1_UNIT_MODE_DIPS, "Got unexpected unit mode %#x.\n", unit_mode);
13736 ID2D1DeviceContext_SetUnitMode(context, D2D1_UNIT_MODE_PIXELS);
13737 hr = ID2D1DeviceContext_GetImageLocalBounds(context, (ID2D1Image *)bitmap, &bounds);
13738 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
13739 ok(compare_rect(&bounds, 0.0f, 0.0f, test->pixel_size.width, test->pixel_size.height, 0),
13740 "Got unexpected bounds {%.8e, %.8e, %.8e, %.8e}, expected {%.8e, %.8e, %.8e, %.8e}.\n",
13741 bounds.left, bounds.top, bounds.right, bounds.bottom, 0.0f, 0.0f,
13742 (float)test->pixel_size.width, (float)test->pixel_size.height);
13743 ID2D1DeviceContext_SetUnitMode(context, unit_mode);
13744
13745 ID2D1Bitmap_Release(bitmap);
13747 }
13748
13750}
@ D2D1_UNIT_MODE_PIXELS
Definition: d2d1_1.idl:66

Referenced by START_TEST().

◆ test_image_brush()

static void test_image_brush ( BOOL  d3d11)
static

Definition at line 2636 of file d2d1.c.

2637{
2638 D2D1_IMAGE_BRUSH_PROPERTIES image_brush_desc;
2639 D2D1_INTERPOLATION_MODE interp_mode;
2640 ID2D1DeviceContext *device_context;
2641 D2D1_BITMAP_PROPERTIES bitmap_desc;
2642 D2D1_BRUSH_PROPERTIES brush_desc;
2643 ID2D1Image *image, *tmp_image;
2644 D2D1_RECT_F dst_rect;
2645 struct d2d1_test_context ctx;
2646 D2D1_EXTEND_MODE extend_mode;
2648 ID2D1ImageBrush *brush;
2653 ULONG refcount;
2654 float opacity;
2655 HRESULT hr;
2656 BOOL match;
2657
2658 static const DWORD bitmap_data[] =
2659 {
2660 0xffff0000, 0xffffff00, 0xff00ff00, 0xff00ffff,
2661 0xff0000ff, 0xffff00ff, 0xff000000, 0xff7f7f7f,
2662 0xffffffff, 0xffffffff, 0xffffffff, 0xff000000,
2663 0xffffffff, 0xff000000, 0xff000000, 0xff000000,
2664 };
2665 static const D2D1_MATRIX_3X2_F identity =
2666 {{{
2667 1.0f, 0.0f,
2668 0.0f, 1.0f,
2669 0.0f, 0.0f,
2670 }}};
2671
2672 if (!init_test_context(&ctx, d3d11))
2673 return;
2674
2675 device_context = ctx.context;
2676
2677 set_size_u(&size, 4, 4);
2679 bitmap_desc.pixelFormat.alphaMode = D2D1_ALPHA_MODE_IGNORE;
2680 bitmap_desc.dpiX = 96.0f;
2681 bitmap_desc.dpiY = 96.0f;
2682 hr = ID2D1RenderTarget_CreateBitmap(ctx.rt, size, bitmap_data, 4 * sizeof(*bitmap_data), &bitmap_desc, &bitmap);
2683 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
2684
2685 hr = ID2D1Bitmap_QueryInterface(bitmap, &IID_ID2D1Image, (void **)&image);
2686 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
2687
2688 /* Only image brush description is required. */
2689 set_rect(&image_brush_desc.sourceRectangle, 1.0f, 2.0f, 3.0f, 4.0f);
2690 image_brush_desc.extendModeX = D2D1_EXTEND_MODE_WRAP;
2691 image_brush_desc.extendModeY = D2D1_EXTEND_MODE_MIRROR;
2693
2694 hr = ID2D1DeviceContext_CreateImageBrush(device_context, NULL, &image_brush_desc, NULL, &brush);
2695 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
2696
2697 tmp_image = (void *)0xdeadbeef;
2698 ID2D1ImageBrush_GetImage(brush, &tmp_image);
2699 ok(!tmp_image, "Unexpected image %p.\n", image);
2700
2701 opacity = ID2D1ImageBrush_GetOpacity(brush);
2702 ok(opacity == 1.0f, "Unexpected opacity %.8e.\n", opacity);
2703 ID2D1ImageBrush_GetTransform(brush, &matrix);
2704 ok(!memcmp(&matrix, &identity, sizeof(matrix)),
2705 "Got unexpected matrix {%.8e, %.8e, %.8e, %.8e, %.8e, %.8e}.\n",
2706 matrix._11, matrix._12, matrix._21, matrix._22, matrix._31, matrix._32);
2707
2708 ID2D1ImageBrush_GetSourceRectangle(brush, &rect);
2709 match = compare_rect(&rect, 1.0f, 2.0f, 3.0f, 4.0f, 0);
2710 ok(match, "Got unexpected rectangle {%.8e, %.8e, %.8e, %.8e}.\n",
2712
2713 extend_mode = ID2D1ImageBrush_GetExtendModeX(brush);
2714 ok(extend_mode == D2D1_EXTEND_MODE_WRAP, "Unexpected extend mode %u.\n", extend_mode);
2715 extend_mode = ID2D1ImageBrush_GetExtendModeY(brush);
2716 ok(extend_mode == D2D1_EXTEND_MODE_MIRROR, "Unexpected extend mode %u.\n", extend_mode);
2717 interp_mode = ID2D1ImageBrush_GetInterpolationMode(brush);
2718 ok(interp_mode == D2D1_INTERPOLATION_MODE_LINEAR, "Unexpected interpolation mode %u.\n", interp_mode);
2719
2720 ID2D1ImageBrush_Release(brush);
2721
2722 /* FillRectangle */
2723 set_rect(&image_brush_desc.sourceRectangle, 0.0f, 0.0f, 4.0f, 4.0f);
2724 hr = ID2D1DeviceContext_CreateImageBrush(device_context, image, &image_brush_desc, NULL, &brush);
2725 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
2726
2727 ID2D1ImageBrush_SetInterpolationMode(brush, D2D1_INTERPOLATION_MODE_NEAREST_NEIGHBOR);
2728
2729 ID2D1RenderTarget_BeginDraw(ctx.rt);
2730
2731 set_color(&color, 0.0f, 0.0f, 1.0f, 1.0f);
2732 ID2D1RenderTarget_Clear(ctx.rt, &color);
2733
2734 set_rect(&dst_rect, 40.0f, 120.0f, 120.0f, 360.0f);
2735 ID2D1RenderTarget_FillRectangle(ctx.rt, &dst_rect, (ID2D1Brush *)brush);
2736
2737 hr = ID2D1RenderTarget_EndDraw(ctx.rt, NULL, NULL);
2738 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
2739 match = compare_surface(&ctx, "89917481db82e6d683a75f068d3984fe2703cce5");
2740 ok(match, "Surface does not match.\n");
2741
2742 ID2D1ImageBrush_Release(brush);
2743
2744 set_rect(&image_brush_desc.sourceRectangle, 0.0f, 0.0f, 1.0f, 1.0f);
2745 hr = ID2D1DeviceContext_CreateImageBrush(device_context, image, &image_brush_desc, NULL, &brush);
2746 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
2747
2748 ID2D1ImageBrush_SetInterpolationMode(brush, D2D1_INTERPOLATION_MODE_NEAREST_NEIGHBOR);
2749
2750 ID2D1RenderTarget_BeginDraw(ctx.rt);
2751
2752 set_color(&color, 0.0f, 0.0f, 1.0f, 1.0f);
2753 ID2D1RenderTarget_Clear(ctx.rt, &color);
2754
2755 set_rect(&dst_rect, 40.0f, 120.0f, 120.0f, 360.0f);
2756 ID2D1RenderTarget_FillRectangle(ctx.rt, &dst_rect, (ID2D1Brush *)brush);
2757
2758 hr = ID2D1RenderTarget_EndDraw(ctx.rt, NULL, NULL);
2759 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
2760 match = compare_surface(&ctx, "23544adf9695a51428c194a1cffd531be3416e65");
2761 todo_wine
2762 ok(match, "Surface does not match.\n");
2763
2764 ID2D1ImageBrush_Release(brush);
2765
2766 /* Custom brush description and image pointer. */
2767 brush_desc.opacity = 2.0f;
2768 set_matrix_identity(&brush_desc.transform);
2769 scale_matrix(&brush_desc.transform, 2.0f, 3.0f);
2770
2771 hr = ID2D1DeviceContext_CreateImageBrush(device_context, image, &image_brush_desc, &brush_desc, &brush);
2772 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
2773
2774 ID2D1ImageBrush_GetImage(brush, &tmp_image);
2775 ok(tmp_image == image, "Got unexpected image %p, expected %p.\n", tmp_image, image);
2776 ID2D1Image_Release(tmp_image);
2777
2778 opacity = ID2D1ImageBrush_GetOpacity(brush);
2779 ok(opacity == 2.0f, "Unexpected opacity %.8e.\n", opacity);
2780 ID2D1ImageBrush_GetTransform(brush, &matrix);
2781 ok(!memcmp(&matrix, &brush_desc.transform, sizeof(matrix)),
2782 "Got unexpected matrix {%.8e, %.8e, %.8e, %.8e, %.8e, %.8e}.\n",
2783 matrix._11, matrix._12, matrix._21, matrix._22, matrix._31, matrix._32);
2784
2785 ID2D1ImageBrush_Release(brush);
2786
2787 ID2D1Image_Release(image);
2788 refcount = ID2D1Bitmap_Release(bitmap);
2789 ok(!refcount, "Bitmap has %lu references left.\n", refcount);
2790
2792}
@ D2D1_INTERPOLATION_MODE_LINEAR
Definition: d2d1_1.idl:126
D2D1_INTERPOLATION_MODE interpolationMode
Definition: d2d1_1.idl:278
D2D1_EXTEND_MODE extendModeX
Definition: d2d1_1.idl:276
D2D1_EXTEND_MODE extendModeY
Definition: d2d1_1.idl:277
D2D1_RECT_F sourceRectangle
Definition: d2d1_1.idl:275

Referenced by START_TEST().

◆ test_invert_matrix()

static void test_invert_matrix ( BOOL  d3d11)
static

Definition at line 9745 of file d2d1.c.

9746{
9747 static const struct
9748 {
9750 D2D1_MATRIX_3X2_F inverse;
9751 BOOL invertible;
9752 }
9753 invert_tests[] =
9754 {
9755 { {{{ 0 }}}, {{{ 0 }}}, FALSE },
9756 {
9757 {{{
9758 1.0f, 2.0f,
9759 1.0f, 2.0f,
9760 4.0f, 8.0f
9761 }}},
9762 {{{
9763 1.0f, 2.0f,
9764 1.0f, 2.0f,
9765 4.0f, 8.0f
9766 }}},
9767 FALSE
9768 },
9769 {
9770 {{{
9771 2.0f, 0.0f,
9772 0.0f, 2.0f,
9773 4.0f, 8.0f
9774 }}},
9775 {{{
9776 0.5f, -0.0f,
9777 -0.0f, 0.5f,
9778 -2.0f, -4.0f
9779 }}},
9780 TRUE
9781 },
9782 {
9783 {{{
9784 2.0f, 1.0f,
9785 2.0f, 2.0f,
9786 4.0f, 8.0f
9787 }}},
9788 {{{
9789 1.0f, -0.5f,
9790 -1.0f, 1.0f,
9791 4.0f, -6.0f
9792 }}},
9793 TRUE
9794 },
9795 {
9796 {{{
9797 2.0f, 1.0f,
9798 3.0f, 1.0f,
9799 4.0f, 8.0f
9800 }}},
9801 {{{
9802 -1.0f, 1.0f,
9803 3.0f, -2.0f,
9804 -20.0f, 12.0f
9805 }}},
9806 TRUE
9807 },
9808 };
9809 unsigned int i;
9810
9811 for (i = 0; i < ARRAY_SIZE(invert_tests); ++i)
9812 {
9814 BOOL ret;
9815
9816 m = invert_tests[i].matrix;
9818 ok(ret == invert_tests[i].invertible, "%u: unexpected return value %d.\n", i, ret);
9819 ok(!memcmp(&m, &invert_tests[i].inverse, sizeof(m)),
9820 "%u: unexpected matrix value {%.8e, %.8e, %.8e, %.8e, %.8e, %.8e}.\n", i,
9821 m._11, m._12, m._21, m._22, m._31, m._32);
9822
9823 ret = D2D1IsMatrixInvertible(&invert_tests[i].matrix);
9824 ok(ret == invert_tests[i].invertible, "%u: unexpected return value %d.\n", i, ret);
9825 }
9826}
BOOL WINAPI D2D1IsMatrixInvertible(const D2D1_MATRIX_3X2_F *matrix)
Definition: factory.c:1428
BOOL WINAPI D2D1InvertMatrix(D2D1_MATRIX_3X2_F *matrix)
Definition: factory.c:1435
const GLfloat * m
Definition: glext.h:10848

Referenced by START_TEST().

◆ test_layer()

static void test_layer ( BOOL  d3d11)
static

Definition at line 8943 of file d2d1.c.

8944{
8945 ID2D1Factory *factory, *layer_factory;
8946 struct d2d1_test_context ctx;
8950 HRESULT hr;
8951
8952 if (!init_test_context(&ctx, d3d11))
8953 return;
8954
8955 rt = ctx.rt;
8956 factory = ctx.factory;
8957
8958 ID2D1RenderTarget_SetDpi(rt, 192.0f, 48.0f);
8959 ID2D1RenderTarget_SetAntialiasMode(rt, D2D1_ANTIALIAS_MODE_ALIASED);
8960
8961 hr = ID2D1RenderTarget_CreateLayer(rt, NULL, &layer);
8962 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
8963 ID2D1Layer_GetFactory(layer, &layer_factory);
8964 ok(layer_factory == factory, "Got unexpected layer factory %p, expected %p.\n", layer_factory, factory);
8965 ID2D1Factory_Release(layer_factory);
8966 size = ID2D1Layer_GetSize(layer);
8967 ok(size.width == 0.0f, "Got unexpected width %.8e.\n", size.width);
8968 ok(size.height == 0.0f, "Got unexpected height %.8e.\n", size.height);
8969 ID2D1Layer_Release(layer);
8970
8971 set_size_f(&size, 800.0f, 600.0f);
8972 hr = ID2D1RenderTarget_CreateLayer(rt, &size, &layer);
8973 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
8974 size = ID2D1Layer_GetSize(layer);
8975 ok(size.width == 800.0f, "Got unexpected width %.8e.\n", size.width);
8976 ok(size.height == 600.0f, "Got unexpected height %.8e.\n", size.height);
8977 ID2D1Layer_Release(layer);
8978
8980}
GLenum GLuint GLint GLint layer
Definition: glext.h:7007

Referenced by START_TEST().

◆ test_linear_brush()

static void test_linear_brush ( BOOL  d3d11)
static

Definition at line 2794 of file d2d1.c.

2795{
2796 D2D1_LINEAR_GRADIENT_BRUSH_PROPERTIES gradient_properties;
2797 ID2D1GradientStopCollection *gradient, *tmp_gradient;
2798 ID2D1TransformedGeometry *transformed_geometry;
2799 ID2D1RectangleGeometry *rectangle_geometry;
2800 D2D1_MATRIX_3X2_F matrix, tmp_matrix;
2802 struct d2d1_test_context ctx;
2803 struct resource_readback rb;
2808 unsigned int i;
2809 ULONG refcount;
2810 D2D1_RECT_F r;
2811 float opacity;
2812 HRESULT hr;
2813
2814 static const D2D1_GRADIENT_STOP stops[] =
2815 {
2816 {0.0f, {1.0f, 0.0f, 0.0f, 1.0f}},
2817 {0.5f, {0.0f, 1.0f, 0.0f, 1.0f}},
2818 {1.0f, {0.0f, 0.0f, 1.0f, 1.0f}},
2819 };
2820 static const struct
2821 {
2822 unsigned int x, y;
2823 DWORD colour;
2824 }
2825 test1[] =
2826 {
2827 {80, 80, 0xff857a00}, {240, 80, 0xff926d00}, {400, 80, 0xff9f6000}, {560, 80, 0xffac5300},
2828 {80, 240, 0xff00eb14}, {240, 240, 0xff00f807}, {400, 240, 0xff06f900}, {560, 240, 0xff13ec00},
2829 {80, 400, 0xff0053ac}, {240, 400, 0xff005fa0}, {400, 400, 0xff006c93}, {560, 400, 0xff007986},
2830 },
2831 test2[] =
2832 {
2833 { 40, 30, 0xff005ba4}, {120, 30, 0xffffffff}, { 40, 60, 0xffffffff}, { 80, 60, 0xff00b44b},
2834 {120, 60, 0xff006c93}, {200, 60, 0xffffffff}, { 40, 90, 0xffffffff}, {120, 90, 0xff0ef100},
2835 {160, 90, 0xff00c53a}, {200, 90, 0xffffffff}, { 80, 120, 0xffffffff}, {120, 120, 0xffaf5000},
2836 {160, 120, 0xff679800}, {200, 120, 0xff1fe000}, {240, 120, 0xffffffff}, {160, 150, 0xffffffff},
2837 {200, 150, 0xffc03e00}, {240, 150, 0xffffffff}, {280, 150, 0xffffffff}, {320, 150, 0xffffffff},
2838 {240, 180, 0xffffffff}, {280, 180, 0xffff4040}, {320, 180, 0xffff4040}, {380, 180, 0xffffffff},
2839 {200, 210, 0xffffffff}, {240, 210, 0xffa99640}, {280, 210, 0xffb28d40}, {320, 210, 0xffbb8440},
2840 {360, 210, 0xffc47b40}, {400, 210, 0xffffffff}, {200, 240, 0xffffffff}, {280, 240, 0xff41fe40},
2841 {320, 240, 0xff49f540}, {360, 240, 0xff52ec40}, {440, 240, 0xffffffff}, {240, 270, 0xffffffff},
2842 {280, 270, 0xff408eb0}, {320, 270, 0xff4097a7}, {360, 270, 0xff40a19e}, {440, 270, 0xffffffff},
2843 {280, 300, 0xffffffff}, {320, 300, 0xff4040ff}, {360, 300, 0xff4040ff}, {400, 300, 0xff406ad4},
2844 {440, 300, 0xff4061de}, {480, 300, 0xff4057e7}, {520, 300, 0xff404ef1}, {280, 330, 0xffffffff},
2845 {360, 330, 0xffffffff}, {400, 330, 0xff40c17e}, {440, 330, 0xff40b788}, {480, 330, 0xff40ae91},
2846 {520, 330, 0xff40a49b}, {400, 360, 0xff57e740}, {440, 360, 0xff4ef140}, {480, 360, 0xff44fb40},
2847 {520, 360, 0xff40fa45}, {400, 390, 0xffae9140}, {440, 390, 0xffa49b40}, {480, 390, 0xff9aa540},
2848 {520, 390, 0xff90ae40},
2849 };
2850
2851 if (!init_test_context(&ctx, d3d11))
2852 return;
2853
2854 rt = ctx.rt;
2855 ID2D1RenderTarget_SetDpi(rt, 192.0f, 48.0f);
2856 ID2D1RenderTarget_SetAntialiasMode(rt, D2D1_ANTIALIAS_MODE_ALIASED);
2857
2858 hr = ID2D1RenderTarget_CreateGradientStopCollection(rt, stops, ARRAY_SIZE(stops),
2860 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
2861
2862 set_point(&gradient_properties.startPoint, 320.0f, 0.0f);
2863 set_point(&gradient_properties.endPoint, 0.0f, 960.0f);
2864 hr = ID2D1RenderTarget_CreateLinearGradientBrush(rt, &gradient_properties, NULL, gradient, &brush);
2865 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
2866
2867 opacity = ID2D1LinearGradientBrush_GetOpacity(brush);
2868 ok(opacity == 1.0f, "Got unexpected opacity %.8e.\n", opacity);
2870 ID2D1LinearGradientBrush_GetTransform(brush, &tmp_matrix);
2871 ok(!memcmp(&tmp_matrix, &matrix, sizeof(matrix)),
2872 "Got unexpected matrix {%.8e, %.8e, %.8e, %.8e, %.8e, %.8e}.\n",
2873 tmp_matrix._11, tmp_matrix._12, tmp_matrix._21,
2874 tmp_matrix._22, tmp_matrix._31, tmp_matrix._32);
2875 p = ID2D1LinearGradientBrush_GetStartPoint(brush);
2876 ok(compare_point(&p, 320.0f, 0.0f, 0), "Got unexpected start point {%.8e, %.8e}.\n", p.x, p.y);
2877 p = ID2D1LinearGradientBrush_GetEndPoint(brush);
2878 ok(compare_point(&p, 0.0f, 960.0f, 0), "Got unexpected end point {%.8e, %.8e}.\n", p.x, p.y);
2879 ID2D1LinearGradientBrush_GetGradientStopCollection(brush, &tmp_gradient);
2880 ok(tmp_gradient == gradient, "Got unexpected gradient %p, expected %p.\n", tmp_gradient, gradient);
2881 ID2D1GradientStopCollection_Release(tmp_gradient);
2882
2883 ID2D1RenderTarget_BeginDraw(rt);
2884
2885 set_color(&colour, 1.0f, 1.0f, 1.0f, 1.0f);
2886 ID2D1RenderTarget_Clear(rt, &colour);
2887
2888 set_rect(&r, 0.0f, 0.0f, 320.0f, 960.0f);
2889 ID2D1RenderTarget_FillRectangle(rt, &r, (ID2D1Brush *)brush);
2890
2891 hr = ID2D1RenderTarget_EndDraw(rt, NULL, NULL);
2892 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
2893
2895 for (i = 0; i < ARRAY_SIZE(test1); ++i)
2896 {
2897 DWORD colour;
2898
2901 "Got unexpected colour 0x%08lx at position {%u, %u}.\n",
2902 colour, test1[i].x, test1[i].y);
2903 }
2905
2906 ID2D1RenderTarget_BeginDraw(rt);
2907
2908 ID2D1RenderTarget_Clear(rt, &colour);
2909
2911 skew_matrix(&matrix, 0.2146f, 1.575f);
2912 ID2D1RenderTarget_SetTransform(rt, &matrix);
2913
2915 translate_matrix(&matrix, 0.0f, 240.0f);
2916 scale_matrix(&matrix, 0.25f, -0.25f);
2917 ID2D1LinearGradientBrush_SetTransform(brush, &matrix);
2918
2919 set_rect(&r, 0.0f, 0.0f, 80.0f, 240.0f);
2920 ID2D1RenderTarget_FillRectangle(rt, &r, (ID2D1Brush *)brush);
2921
2923 scale_matrix(&matrix, 0.5f, 2.0f);
2924 translate_matrix(&matrix, 320.0f, 240.0f);
2925 rotate_matrix(&matrix, M_PI / 4.0f);
2926 ID2D1RenderTarget_SetTransform(rt, &matrix);
2927
2929 translate_matrix(&matrix, 0.0f, -50.0f);
2930 scale_matrix(&matrix, 0.1f, 0.1f);
2931 rotate_matrix(&matrix, -M_PI / 3.0f);
2932 ID2D1LinearGradientBrush_SetTransform(brush, &matrix);
2933
2934 ID2D1LinearGradientBrush_SetOpacity(brush, 0.75f);
2935 set_rect(&r, -80.0f, -60.0f, 80.0f, 60.0f);
2936 ID2D1RenderTarget_FillRectangle(rt, &r, (ID2D1Brush *)brush);
2937
2938 factory = ctx.factory;
2939
2940 set_rect(&r, -1.0f, -1.0f, 1.0f, 1.0f);
2941 hr = ID2D1Factory_CreateRectangleGeometry(factory, &r, &rectangle_geometry);
2942 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
2943
2945 translate_matrix(&matrix, 228.5f, 714.0f);
2946 scale_matrix(&matrix, 40.0f, 120.0f);
2947 hr = ID2D1Factory_CreateTransformedGeometry(factory, (ID2D1Geometry *)rectangle_geometry,
2948 &matrix, &transformed_geometry);
2949 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
2950 ID2D1RectangleGeometry_Release(rectangle_geometry);
2951
2953 ID2D1RenderTarget_SetTransform(rt, &matrix);
2954 ID2D1LinearGradientBrush_SetTransform(brush, &matrix);
2955 set_point(&p, 188.5f, 834.0f);
2956 ID2D1LinearGradientBrush_SetStartPoint(brush, p);
2957 set_point(&p, 268.5f, 594.0f);
2958 ID2D1LinearGradientBrush_SetEndPoint(brush, p);
2959 ID2D1RenderTarget_FillGeometry(rt, (ID2D1Geometry *)transformed_geometry, (ID2D1Brush *)brush, NULL);
2960 ID2D1TransformedGeometry_Release(transformed_geometry);
2961
2962 hr = ID2D1RenderTarget_EndDraw(rt, NULL, NULL);
2963 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
2964
2966 for (i = 0; i < ARRAY_SIZE(test2); ++i)
2967 {
2968 DWORD colour;
2969
2972 "Got unexpected colour 0x%08lx at position {%u, %u}.\n",
2973 colour, test2[i].x, test2[i].y);
2974 }
2976
2977 ID2D1LinearGradientBrush_Release(brush);
2978 refcount = ID2D1GradientStopCollection_Release(gradient);
2979 ok(!refcount, "Gradient has %lu references left.\n", refcount);
2981}
void test2()
Definition: ehthrow.cxx:284
void test1()
Definition: ehthrow.cxx:277

Referenced by START_TEST().

◆ test_math()

static void test_math ( BOOL  d3d11)
static

Definition at line 10547 of file d2d1.c.

10548{
10549 float s, c, t, l;
10550 unsigned int i;
10551
10552 static const struct
10553 {
10554 float x;
10555 float s;
10556 float c;
10557 }
10558 sc_data[] =
10559 {
10560 {0.0f, 0.0f, 1.0f},
10561 {1.0f, 8.41470957e-001f, 5.40302277e-001f},
10562 {2.0f, 9.09297407e-001f, -4.16146845e-001f},
10563 {M_PI / 2.0f, 1.0f, -4.37113883e-008f},
10564 {M_PI, -8.74227766e-008f, -1.0f},
10565 };
10566
10567 static const struct
10568 {
10569 float x;
10570 float t;
10571 }
10572 t_data[] =
10573 {
10574 {0.0f, 0.0f},
10575 {1.0f, 1.55740774f},
10576 {2.0f, -2.18503976f},
10577 {M_PI / 2.0f, -2.28773320e+007f},
10578 {M_PI, 8.74227766e-008f},
10579 };
10580
10581 static const struct
10582 {
10583 float x;
10584 float y;
10585 float z;
10586 float l;
10587 }
10588 l_data[] =
10589 {
10590 {0.0f, 0.0f, 0.0f, 0.0f},
10591 {1.0f, 0.0f, 0.0f, 1.0f},
10592 {0.0f, 1.0f, 0.0f, 1.0f},
10593 {0.0f, 0.0f, 1.0f, 1.0f},
10594 {1.0f, 1.0f, 1.0f, 1.73205078f},
10595 {1.0f, 2.0f, 2.0f, 3.0f},
10596 {1.0f, 2.0f, 3.0f, 3.74165750f},
10597 };
10598
10599 if (!pD2D1SinCos || !pD2D1Tan || !pD2D1Vec3Length)
10600 {
10601 win_skip("D2D1SinCos/D2D1Tan/D2D1Vec3Length not available, skipping test.\n");
10602 return;
10603 }
10604
10605 for (i = 0; i < ARRAY_SIZE(sc_data); ++i)
10606 {
10607 pD2D1SinCos(sc_data[i].x, &s, &c);
10608 ok(compare_float(s, sc_data[i].s, 0),
10609 "Test %u: Got unexpected sin %.8e, expected %.8e.\n", i, s, sc_data[i].s);
10610 ok(compare_float(c, sc_data[i].c, 0),
10611 "Test %u: Got unexpected cos %.8e, expected %.8e.\n", i, c, sc_data[i].c);
10612 }
10613
10614 for (i = 0; i < ARRAY_SIZE(t_data); ++i)
10615 {
10616 t = pD2D1Tan(t_data[i].x);
10617 ok(compare_float(t, t_data[i].t, 1),
10618 "Test %u: Got unexpected tan %.8e, expected %.8e.\n", i, t, t_data[i].t);
10619 }
10620
10621 for (i = 0; i < ARRAY_SIZE(l_data); ++i)
10622 {
10623 l = pD2D1Vec3Length(l_data[i].x, l_data[i].y, l_data[i].z);
10624 ok(compare_float(l, l_data[i].l, 0),
10625 "Test %u: Got unexpected length %.8e, expected %.8e.\n", i, l, l_data[i].l);
10626 }
10627}
r l[0]
Definition: byte_order.h:168
static float * s
Definition: d2d1.c:300
static float float * c
Definition: d2d1.c:300
GLdouble GLdouble z
Definition: glext.h:5874

◆ test_max_bitmap_size()

static void test_max_bitmap_size ( BOOL  d3d11)
static

Definition at line 10134 of file d2d1.c.

10135{
10137 D2D1_BITMAP_PROPERTIES bitmap_desc;
10138 struct d2d1_test_context ctx;
10144 UINT32 bitmap_size;
10145 unsigned int i, j;
10146 HWND window;
10147 HRESULT hr;
10148
10149 static const struct
10150 {
10151 const char *name;
10152 DWORD type;
10153 }
10154 device_types[] =
10155 {
10157 { "WARP", D3D10_DRIVER_TYPE_WARP },
10158 { "REF", D3D10_DRIVER_TYPE_REFERENCE },
10159 };
10160 static const struct
10161 {
10162 const char *name;
10163 DWORD type;
10164 }
10165 target_types[] =
10166 {
10167 { "DEFAULT", D2D1_RENDER_TARGET_TYPE_DEFAULT },
10169 };
10170
10171 if (!init_test_context(&ctx, d3d11))
10172 return;
10173
10174 for (i = 0; i < ARRAY_SIZE(device_types); ++i)
10175 {
10178 {
10179 skip("Failed to create %s d3d device, hr %#lx.\n", device_types[i].name, hr);
10180 continue;
10181 }
10182
10185 hr = IDXGISwapChain_GetBuffer(swapchain, 0, &IID_IDXGISurface, (void **)&surface);
10186 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
10187
10188 for (j = 0; j < ARRAY_SIZE(target_types); ++j)
10189 {
10190 D3D10_TEXTURE2D_DESC texture_desc;
10193
10194 desc.type = target_types[j].type;
10195 desc.pixelFormat.format = DXGI_FORMAT_UNKNOWN;
10196 desc.pixelFormat.alphaMode = D2D1_ALPHA_MODE_PREMULTIPLIED;
10197 desc.dpiX = 0.0f;
10198 desc.dpiY = 0.0f;
10201
10202 hr = ID2D1Factory_CreateDxgiSurfaceRenderTarget(ctx.factory, surface, &desc, &rt);
10203 ok(hr == S_OK, "%s/%s: Got unexpected hr %#lx.\n", device_types[i].name, target_types[j].name, hr);
10204
10205 bitmap_size = ID2D1RenderTarget_GetMaximumBitmapSize(rt);
10206 ok(bitmap_size >= D3D10_REQ_TEXTURE2D_U_OR_V_DIMENSION, "%s/%s: unexpected bitmap size %u.\n",
10207 device_types[i].name, target_types[j].name, bitmap_size);
10208
10209 bitmap_desc.dpiX = 96.0f;
10210 bitmap_desc.dpiY = 96.0f;
10212 bitmap_desc.pixelFormat.alphaMode = D2D1_ALPHA_MODE_PREMULTIPLIED;
10213
10214 size.width = bitmap_size;
10215 size.height = 1;
10216 hr = ID2D1RenderTarget_CreateBitmap(rt, size, NULL, 0, &bitmap_desc, &bitmap);
10217 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
10218 ID2D1Bitmap_Release(bitmap);
10219
10220 ID2D1RenderTarget_Release(rt);
10221
10222 texture_desc.Width = bitmap_size;
10223 texture_desc.Height = 1;
10224 texture_desc.MipLevels = 1;
10225 texture_desc.ArraySize = 1;
10226 texture_desc.Format = DXGI_FORMAT_B8G8R8A8_UNORM;
10227 texture_desc.SampleDesc.Count = 1;
10228 texture_desc.SampleDesc.Quality = 0;
10229 texture_desc.Usage = D3D10_USAGE_DEFAULT;
10230 texture_desc.BindFlags = 0;
10231 texture_desc.CPUAccessFlags = 0;
10232 texture_desc.MiscFlags = 0;
10233
10234 hr = ID3D10Device1_CreateTexture2D(device, &texture_desc, NULL, &texture);
10235 ok(hr == S_OK || broken(hr == E_INVALIDARG && device_types[i].type == D3D10_DRIVER_TYPE_WARP) /* Vista */,
10236 "%s/%s: Got unexpected hr %#lx.\n", device_types[i].name, target_types[j].name, hr);
10237 if (SUCCEEDED(hr))
10238 ID3D10Texture2D_Release(texture);
10239 }
10240
10241 IDXGISurface_Release(surface);
10242 IDXGISwapChain_Release(swapchain);
10244
10245 ID3D10Device1_Release(device);
10246 }
10247
10249}
#define skip(...)
Definition: atltest.h:64
static IDXGISwapChain * create_d3d10_swapchain(ID3D10Device1 *device, HWND window, BOOL windowed)
Definition: d2d1.c:1221
const unsigned int D3D10_REQ_TEXTURE2D_U_OR_V_DIMENSION
Definition: d3d10.idl:195
IDXGISwapChain * swapchain
Definition: d2d1.c:320

Referenced by START_TEST().

◆ test_mt_factory()

static void test_mt_factory ( BOOL  d3d11)
static

Definition at line 10786 of file d2d1.c.

10787{
10788 struct d2d1_test_context ctx;
10789 ID2D1Multithread *multithread;
10791 HANDLE thread;
10792 HRESULT hr;
10793 DWORD ret;
10794
10795 hr = D2D1CreateFactory(D2D1_FACTORY_TYPE_MULTI_THREADED + 1, &IID_ID2D1Factory, NULL, (void **)&factory);
10796 ok(hr == E_INVALIDARG, "Got unexpected hr %#lx.\n", hr);
10797
10798 hr = D2D1CreateFactory(D2D1_FACTORY_TYPE_SINGLE_THREADED, &IID_ID2D1Factory, NULL, (void **)&factory);
10799 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
10800
10801 hr = ID2D1Factory_QueryInterface(factory, &IID_ID2D1Multithread, (void **)&multithread);
10802 if (hr == E_NOINTERFACE)
10803 {
10804 win_skip("ID2D1Multithread is not supported.\n");
10805 ID2D1Factory_Release(factory);
10806 return;
10807 }
10808 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
10809
10810 ret = ID2D1Multithread_GetMultithreadProtected(multithread);
10811 ok(!ret, "Unexpected return value.\n");
10812
10813 ID2D1Multithread_Enter(multithread);
10815 ok(!!thread, "Failed to create a thread.\n");
10818
10819 ID2D1Multithread_Release(multithread);
10820 ID2D1Factory_Release(factory);
10821
10822 hr = D2D1CreateFactory(D2D1_FACTORY_TYPE_MULTI_THREADED, &IID_ID2D1Factory, NULL, (void **)&factory);
10823 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
10824
10825 hr = ID2D1Factory_QueryInterface(factory, &IID_ID2D1Multithread, (void **)&multithread);
10826 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
10827
10828 ret = ID2D1Multithread_GetMultithreadProtected(multithread);
10829 ok(!!ret, "Unexpected return value.\n");
10830
10831 ID2D1Multithread_Enter(multithread);
10833 ok(!!thread, "Failed to create a thread.\n");
10835 ok(ret == WAIT_TIMEOUT, "Expected timeout.\n");
10836 ID2D1Multithread_Leave(multithread);
10839
10840 ID2D1Multithread_Release(multithread);
10841
10842 ID2D1Factory_Release(factory);
10843
10845 return;
10846
10847 hr = ID2D1Factory_QueryInterface(ctx.factory, &IID_ID2D1Multithread, (void **)&multithread);
10848 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
10849
10850 ID2D1Multithread_Enter(multithread);
10852 ok(!!thread, "Failed to create a thread.\n");
10854 ok(ret == WAIT_TIMEOUT, "Expected timeout.\n");
10855 ID2D1Multithread_Leave(multithread);
10858
10859 ID2D1Multithread_Release(multithread);
10861
10862 if (!init_test_context(&ctx, d3d11))
10863 return;
10864
10865 hr = ID2D1Factory_QueryInterface(ctx.factory, &IID_ID2D1Multithread, (void **)&multithread);
10866 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
10867
10868 ID2D1Multithread_Enter(multithread);
10870 ok(!!thread, "Failed to create a thread.\n");
10872 ok(ret == WAIT_OBJECT_0, "Didn't expect timeout.\n");
10873 ID2D1Multithread_Leave(multithread);
10876
10877 ID2D1Multithread_Release(multithread);
10879}
static HANDLE thread
Definition: service.c:33
static DWORD WINAPI mt_factory_test_thread_func(void *param)
Definition: d2d1.c:10762
#define init_test_multithreaded_context(ctx, d3d11)
Definition: d2d1.c:1289
static DWORD WINAPI mt_factory_test_thread_draw_func(void *param)
Definition: d2d1.c:10771
@ D2D1_FACTORY_TYPE_MULTI_THREADED
Definition: d2d1.idl:79
#define WAIT_TIMEOUT
Definition: dderror.h:14
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
#define WAIT_OBJECT_0
Definition: winbase.h:383

Referenced by START_TEST().

◆ test_offset_transform()

static void test_offset_transform ( BOOL  d3d11)
static

Definition at line 12980 of file d2d1.c.

12981{
12983 ID2D1EffectContext *effect_context;
12985 struct d2d1_test_context ctx;
12988 ID2D1Effect *effect;
12989 UINT input_count;
12990 HRESULT hr;
12991
12992 if (!init_test_context(&ctx, d3d11))
12993 return;
12994
12995 factory = ctx.factory1;
12996 if (!factory)
12997 {
12998 win_skip("ID2D1Factory1 is not supported.\n");
13000 return;
13001 }
13002
13003 binding.propertyName = L"Context";
13004 binding.setFunction = NULL;
13005 binding.getFunction = effect_impl_get_context;
13006 hr = ID2D1Factory1_RegisterEffectFromString(factory, &CLSID_TestEffect,
13008 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
13009
13010 hr = ID2D1DeviceContext_CreateEffect(ctx.context, &CLSID_TestEffect, &effect);
13011 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
13012
13013 hr = ID2D1Effect_GetValueByName(effect, L"Context",
13014 D2D1_PROPERTY_TYPE_IUNKNOWN, (BYTE *)&effect_context, sizeof(effect_context));
13015 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
13016
13017 /* Create transform */
13018 offset.x = 1;
13019 offset.y = 2;
13020 hr = ID2D1EffectContext_CreateOffsetTransform(effect_context, offset, &transform);
13021 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
13022 offset = ID2D1OffsetTransform_GetOffset(transform);
13023 ok(offset.x == 1 && offset.y == 2, "Got unexpected offset {%ld, %ld}.\n", offset.x, offset.y);
13024
13025 check_interface(transform, &IID_ID2D1OffsetTransform, TRUE);
13026 check_interface(transform, &IID_ID2D1TransformNode, TRUE);
13027
13028 /* Input count */
13029 input_count = ID2D1OffsetTransform_GetInputCount(transform);
13030 ok(input_count == 1, "Got unexpected input count %u.\n", input_count);
13031
13032 /* Set offset */
13033 offset.x = -10;
13034 offset.y = 20;
13035 ID2D1OffsetTransform_SetOffset(transform, offset);
13036 offset = ID2D1OffsetTransform_GetOffset(transform);
13037 ok(offset.x == -10 && offset.y == 20, "Got unexpected offset {%ld, %ld}.\n", offset.x, offset.y);
13038
13039 ID2D1OffsetTransform_Release(transform);
13040 ID2D1Effect_Release(effect);
13041 hr = ID2D1Factory1_UnregisterEffect(factory, &CLSID_TestEffect);
13042 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
13044}

Referenced by START_TEST().

◆ test_opacity_brush()

static void test_opacity_brush ( BOOL  d3d11)
static

Definition at line 5529 of file d2d1.c.

5530{
5531 ID2D1BitmapBrush *bitmap_brush, *opacity_brush;
5532 D2D1_BITMAP_PROPERTIES bitmap_desc;
5533 ID2D1RectangleGeometry *geometry;
5534 ID2D1SolidColorBrush *color_brush;
5535 struct d2d1_test_context ctx;
5543 ULONG refcount;
5544 HRESULT hr;
5545 BOOL match;
5546
5547 static const DWORD bitmap_data[] =
5548 {
5549 0xffff0000, 0x40ffff00, 0x4000ff00, 0xff00ffff,
5550 0x7f0000ff, 0x00ff00ff, 0x00000000, 0x7f7f7f7f,
5551 0x7fffffff, 0x00ffffff, 0x00ffffff, 0x7f000000,
5552 0xffffffff, 0x40000000, 0x40000000, 0xff000000,
5553 };
5554
5555 if (!init_test_context(&ctx, d3d11))
5556 return;
5557
5558 rt = ctx.rt;
5559 factory = ctx.factory;
5560
5561 ID2D1RenderTarget_SetDpi(rt, 192.0f, 48.0f);
5562 ID2D1RenderTarget_SetAntialiasMode(rt, D2D1_ANTIALIAS_MODE_ALIASED);
5563
5564 set_color(&color, 0.0f, 1.0f, 0.0f, 0.8f);
5565 hr = ID2D1RenderTarget_CreateSolidColorBrush(rt, &color, NULL, &color_brush);
5566 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
5567
5568 set_size_u(&size, 4, 4);
5570 bitmap_desc.pixelFormat.alphaMode = D2D1_ALPHA_MODE_PREMULTIPLIED;
5571 bitmap_desc.dpiX = 96.0f;
5572 bitmap_desc.dpiY = 96.0f;
5573 hr = ID2D1RenderTarget_CreateBitmap(rt, size, bitmap_data, 4 * sizeof(*bitmap_data), &bitmap_desc, &bitmap);
5574 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
5575 hr = ID2D1RenderTarget_CreateBitmapBrush(rt, bitmap, NULL, NULL, &opacity_brush);
5576 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
5577 ID2D1BitmapBrush_SetInterpolationMode(opacity_brush, D2D1_BITMAP_INTERPOLATION_MODE_NEAREST_NEIGHBOR);
5578 refcount = ID2D1Bitmap_Release(bitmap);
5579 ok(refcount == 1, "Got unexpected refcount %lu.\n", refcount);
5580
5581 set_size_u(&size, 1, 1);
5583 bitmap_desc.pixelFormat.alphaMode = D2D1_ALPHA_MODE_IGNORE;
5584 bitmap_desc.dpiX = 96.0f;
5585 bitmap_desc.dpiY = 96.0f;
5586 hr = ID2D1RenderTarget_CreateBitmap(rt, size, &bitmap_data[2], sizeof(*bitmap_data), &bitmap_desc, &bitmap);
5587 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
5588 hr = ID2D1RenderTarget_CreateBitmapBrush(rt, bitmap, NULL, NULL, &bitmap_brush);
5589 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
5590 ID2D1BitmapBrush_SetInterpolationMode(bitmap_brush, D2D1_BITMAP_INTERPOLATION_MODE_NEAREST_NEIGHBOR);
5591 refcount = ID2D1Bitmap_Release(bitmap);
5592 ok(refcount == 1, "Got unexpected refcount %lu.\n", refcount);
5593
5594 ID2D1RenderTarget_BeginDraw(rt);
5595
5596 set_color(&color, 0.0f, 0.0f, 1.0f, 1.0f);
5597 ID2D1RenderTarget_Clear(rt, &color);
5598
5599 set_rect(&rect, 40.0f, 120.0f, 120.0f, 360.0f);
5600 ID2D1RenderTarget_FillRectangle(rt, &rect, (ID2D1Brush *)color_brush);
5601
5603 translate_matrix(&matrix, 120.0f, 120.0f);
5604 scale_matrix(&matrix, 20.0f, 60.0f);
5605 ID2D1BitmapBrush_SetTransform(opacity_brush, &matrix);
5606 set_rect(&rect, 120.0f, 120.0f, 200.0f, 360.0f);
5607 ID2D1RenderTarget_FillRectangle(rt, &rect, (ID2D1Brush *)opacity_brush);
5608
5609 set_rect(&rect, 200.0f, 120.0f, 280.0f, 360.0f);
5610 ID2D1RenderTarget_FillRectangle(rt, &rect, (ID2D1Brush *)bitmap_brush);
5611
5613 translate_matrix(&matrix, 40.0f, 360.0f);
5614 scale_matrix(&matrix, 20.0f, 60.0f);
5615 ID2D1BitmapBrush_SetTransform(opacity_brush, &matrix);
5616 set_rect(&rect, 40.0f, 360.0f, 120.0f, 600.0f);
5617 ID2D1Factory_CreateRectangleGeometry(factory, &rect, &geometry);
5618 ID2D1RenderTarget_FillGeometry(rt, (ID2D1Geometry *)geometry,
5619 (ID2D1Brush *)opacity_brush, (ID2D1Brush *)color_brush);
5620 ID2D1RectangleGeometry_Release(geometry);
5621
5623 translate_matrix(&matrix, 120.0f, 360.0f);
5624 scale_matrix(&matrix, 20.0f, 60.0f);
5625 ID2D1BitmapBrush_SetTransform(opacity_brush, &matrix);
5626 set_rect(&rect, 120.0f, 360.0f, 200.0f, 600.0f);
5627 ID2D1Factory_CreateRectangleGeometry(factory, &rect, &geometry);
5628 ID2D1RenderTarget_FillGeometry(rt, (ID2D1Geometry *)geometry,
5629 (ID2D1Brush *)color_brush, (ID2D1Brush *)opacity_brush);
5630 ID2D1RectangleGeometry_Release(geometry);
5631
5633 translate_matrix(&matrix, 200.0f, 360.0f);
5634 scale_matrix(&matrix, 20.0f, 60.0f);
5635 ID2D1BitmapBrush_SetTransform(opacity_brush, &matrix);
5636 set_rect(&rect, 200.0f, 360.0f, 280.0f, 600.0f);
5637 ID2D1Factory_CreateRectangleGeometry(factory, &rect, &geometry);
5638 ID2D1RenderTarget_FillGeometry(rt, (ID2D1Geometry *)geometry,
5639 (ID2D1Brush *)bitmap_brush, (ID2D1Brush *)opacity_brush);
5640
5641 hr = ID2D1RenderTarget_EndDraw(rt, NULL, NULL);
5642 ok(hr == D2DERR_INCOMPATIBLE_BRUSH_TYPES, "Got unexpected hr %#lx.\n", hr);
5643 match = compare_surface(&ctx, "7141c6c7b3decb91196428efb1856bcbf9872935");
5644 ok(match, "Surface does not match.\n");
5645 ID2D1RenderTarget_BeginDraw(rt);
5646
5647 ID2D1RenderTarget_FillGeometry(rt, (ID2D1Geometry *)geometry,
5648 (ID2D1Brush *)bitmap_brush, (ID2D1Brush *)opacity_brush);
5649 ID2D1RectangleGeometry_Release(geometry);
5650
5651 ID2D1SolidColorBrush_SetOpacity(color_brush, 0.5f);
5653 translate_matrix(&matrix, 40.0f, 600.0f);
5654 scale_matrix(&matrix, 20.0f, 60.0f);
5655 ID2D1BitmapBrush_SetTransform(opacity_brush, &matrix);
5656 set_rect(&rect, 40.0f, 600.0f, 120.0f, 840.0f);
5657 ID2D1Factory_CreateRectangleGeometry(factory, &rect, &geometry);
5658 ID2D1RenderTarget_FillGeometry(rt, (ID2D1Geometry *)geometry,
5659 (ID2D1Brush *)opacity_brush, (ID2D1Brush *)color_brush);
5660 ID2D1RectangleGeometry_Release(geometry);
5661
5662 ID2D1BitmapBrush_SetOpacity(opacity_brush, 0.8f);
5664 translate_matrix(&matrix, 120.0f, 600.0f);
5665 scale_matrix(&matrix, 20.0f, 60.0f);
5666 ID2D1BitmapBrush_SetTransform(opacity_brush, &matrix);
5667 set_rect(&rect, 120.0f, 600.0f, 200.0f, 840.0f);
5668 ID2D1Factory_CreateRectangleGeometry(factory, &rect, &geometry);
5669 ID2D1RenderTarget_FillGeometry(rt, (ID2D1Geometry *)geometry,
5670 (ID2D1Brush *)opacity_brush, (ID2D1Brush *)bitmap_brush);
5671 ID2D1RectangleGeometry_Release(geometry);
5672
5674 translate_matrix(&matrix, 200.0f, 600.0f);
5675 scale_matrix(&matrix, 20.0f, 60.0f);
5676 ID2D1BitmapBrush_SetTransform(opacity_brush, &matrix);
5677 set_rect(&rect, 200.0f, 600.0f, 280.0f, 840.0f);
5678 ID2D1Factory_CreateRectangleGeometry(factory, &rect, &geometry);
5679 ID2D1RenderTarget_FillGeometry(rt, (ID2D1Geometry *)geometry,
5680 (ID2D1Brush *)bitmap_brush, (ID2D1Brush *)opacity_brush);
5681 ID2D1RectangleGeometry_Release(geometry);
5682
5683 hr = ID2D1RenderTarget_EndDraw(rt, NULL, NULL);
5684 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
5685 match = compare_surface(&ctx, "c3a5802d1750efa3e9122c1a92f6064df3872732");
5686 ok(match, "Surface does not match.\n");
5687
5688 ID2D1BitmapBrush_Release(bitmap_brush);
5689 ID2D1BitmapBrush_Release(opacity_brush);
5690 ID2D1SolidColorBrush_Release(color_brush);
5692}
#define D2DERR_INCOMPATIBLE_BRUSH_TYPES
Definition: winerror.h:7375

Referenced by START_TEST().

◆ test_path_geometry()

static void test_path_geometry ( BOOL  d3d11)
static

Definition at line 3295 of file d2d1.c.

3296{
3297 ID2D1TransformedGeometry *transformed_geometry;
3298 D2D1_MATRIX_3X2_F matrix, tmp_matrix;
3299 ID2D1GeometrySink *sink, *tmp_sink;
3300 struct geometry_sink simplify_sink;
3301 D2D1_POINT_2F point = {0.0f, 0.0f};
3302 struct d2d1_test_context ctx;
3303 ID2D1SolidColorBrush *brush;
3304 ID2D1PathGeometry *geometry;
3305 ID2D1Geometry *tmp_geometry;
3308 BOOL match, contains;
3311 UINT32 count;
3312 HRESULT hr;
3313
3314 static const struct geometry_segment expected_segments[] =
3315 {
3316 /* Figure 0. */
3317 {SEGMENT_LINE, {{{ 55.0f, 20.0f}}}},
3318 {SEGMENT_LINE, {{{ 55.0f, 220.0f}}}},
3319 {SEGMENT_LINE, {{{ 25.0f, 220.0f}}}},
3320 {SEGMENT_LINE, {{{ 25.0f, 100.0f}}}},
3321 {SEGMENT_LINE, {{{ 75.0f, 100.0f}}}},
3322 {SEGMENT_LINE, {{{ 75.0f, 300.0f}}}},
3323 {SEGMENT_LINE, {{{ 5.0f, 300.0f}}}},
3324 {SEGMENT_LINE, {{{ 5.0f, 60.0f}}}},
3325 {SEGMENT_LINE, {{{ 45.0f, 60.0f}}}},
3326 {SEGMENT_LINE, {{{ 45.0f, 180.0f}}}},
3327 {SEGMENT_LINE, {{{ 35.0f, 180.0f}}}},
3328 {SEGMENT_LINE, {{{ 35.0f, 140.0f}}}},
3329 {SEGMENT_LINE, {{{ 65.0f, 140.0f}}}},
3330 {SEGMENT_LINE, {{{ 65.0f, 260.0f}}}},
3331 {SEGMENT_LINE, {{{ 15.0f, 260.0f}}}},
3332 /* Figure 1. */
3333 {SEGMENT_LINE, {{{155.0f, 160.0f}}}},
3334 {SEGMENT_LINE, {{{ 85.0f, 160.0f}}}},
3335 {SEGMENT_LINE, {{{ 85.0f, 300.0f}}}},
3336 {SEGMENT_LINE, {{{120.0f, 300.0f}}}},
3337 {SEGMENT_LINE, {{{120.0f, 20.0f}}}},
3338 {SEGMENT_LINE, {{{155.0f, 20.0f}}}},
3339 {SEGMENT_LINE, {{{155.0f, 160.0f}}}},
3340 {SEGMENT_LINE, {{{ 85.0f, 160.0f}}}},
3341 {SEGMENT_LINE, {{{ 85.0f, 20.0f}}}},
3342 {SEGMENT_LINE, {{{120.0f, 20.0f}}}},
3343 {SEGMENT_LINE, {{{120.0f, 300.0f}}}},
3344 /* Figure 2. */
3345 {SEGMENT_LINE, {{{165.0f, 300.0f}}}},
3346 {SEGMENT_LINE, {{{235.0f, 300.0f}}}},
3347 {SEGMENT_LINE, {{{235.0f, 20.0f}}}},
3348 /* Figure 3. */
3349 {SEGMENT_LINE, {{{225.0f, 260.0f}}}},
3350 {SEGMENT_LINE, {{{175.0f, 260.0f}}}},
3351 {SEGMENT_LINE, {{{175.0f, 60.0f}}}},
3352 /* Figure 4. */
3353 {SEGMENT_LINE, {{{185.0f, 220.0f}}}},
3354 {SEGMENT_LINE, {{{185.0f, 100.0f}}}},
3355 {SEGMENT_LINE, {{{215.0f, 100.0f}}}},
3356 /* Figure 5. */
3357 {SEGMENT_LINE, {{{205.0f, 180.0f}}}},
3358 {SEGMENT_LINE, {{{205.0f, 140.0f}}}},
3359 {SEGMENT_LINE, {{{195.0f, 140.0f}}}},
3360 /* Figure 6. */
3361 {SEGMENT_LINE, {{{135.0f, 620.0f}}}},
3362 {SEGMENT_LINE, {{{135.0f, 420.0f}}}},
3363 {SEGMENT_LINE, {{{105.0f, 420.0f}}}},
3364 {SEGMENT_LINE, {{{105.0f, 540.0f}}}},
3365 {SEGMENT_LINE, {{{155.0f, 540.0f}}}},
3366 {SEGMENT_LINE, {{{155.0f, 340.0f}}}},
3367 {SEGMENT_LINE, {{{ 85.0f, 340.0f}}}},
3368 {SEGMENT_LINE, {{{ 85.0f, 580.0f}}}},
3369 {SEGMENT_LINE, {{{125.0f, 580.0f}}}},
3370 {SEGMENT_LINE, {{{125.0f, 460.0f}}}},
3371 {SEGMENT_LINE, {{{115.0f, 460.0f}}}},
3372 {SEGMENT_LINE, {{{115.0f, 500.0f}}}},
3373 {SEGMENT_LINE, {{{145.0f, 500.0f}}}},
3374 {SEGMENT_LINE, {{{145.0f, 380.0f}}}},
3375 {SEGMENT_LINE, {{{ 95.0f, 380.0f}}}},
3376 /* Figure 7. */
3377 {SEGMENT_LINE, {{{235.0f, 480.0f}}}},
3378 {SEGMENT_LINE, {{{165.0f, 480.0f}}}},
3379 {SEGMENT_LINE, {{{165.0f, 340.0f}}}},
3380 {SEGMENT_LINE, {{{200.0f, 340.0f}}}},
3381 {SEGMENT_LINE, {{{200.0f, 620.0f}}}},
3382 {SEGMENT_LINE, {{{235.0f, 620.0f}}}},
3383 {SEGMENT_LINE, {{{235.0f, 480.0f}}}},
3384 {SEGMENT_LINE, {{{165.0f, 480.0f}}}},
3385 {SEGMENT_LINE, {{{165.0f, 620.0f}}}},
3386 {SEGMENT_LINE, {{{200.0f, 620.0f}}}},
3387 {SEGMENT_LINE, {{{200.0f, 340.0f}}}},
3388 /* Figure 8. */
3389 {SEGMENT_LINE, {{{245.0f, 340.0f}}}},
3390 {SEGMENT_LINE, {{{315.0f, 340.0f}}}},
3391 {SEGMENT_LINE, {{{315.0f, 620.0f}}}},
3392 /* Figure 9. */
3393 {SEGMENT_LINE, {{{305.0f, 380.0f}}}},
3394 {SEGMENT_LINE, {{{255.0f, 380.0f}}}},
3395 {SEGMENT_LINE, {{{255.0f, 580.0f}}}},
3396 /* Figure 10. */
3397 {SEGMENT_LINE, {{{265.0f, 420.0f}}}},
3398 {SEGMENT_LINE, {{{265.0f, 540.0f}}}},
3399 {SEGMENT_LINE, {{{295.0f, 540.0f}}}},
3400 /* Figure 11. */
3401 {SEGMENT_LINE, {{{285.0f, 460.0f}}}},
3402 {SEGMENT_LINE, {{{285.0f, 500.0f}}}},
3403 {SEGMENT_LINE, {{{275.0f, 500.0f}}}},
3404 /* Figure 12. */
3405 {SEGMENT_BEZIER, {{{2.83333340e+01f, 1.60000000e+02f},
3406 {4.00000000e+01f, 1.13333336e+02f},
3407 {4.00000000e+01f, 2.00000000e+01f}}}},
3408 {SEGMENT_BEZIER, {{{4.00000000e+01f, 1.13333336e+02f},
3409 {5.16666641e+01f, 1.60000000e+02f},
3410 {7.50000000e+01f, 1.60000000e+02f}}}},
3411 {SEGMENT_BEZIER, {{{5.16666641e+01f, 1.60000000e+02f},
3412 {4.00000000e+01f, 2.06666656e+02f},
3413 {4.00000000e+01f, 3.00000000e+02f}}}},
3414 {SEGMENT_BEZIER, {{{4.00000000e+01f, 2.06666656e+02f},
3415 {2.83333340e+01f, 1.60000000e+02f},
3416 {5.00000000e+00f, 1.60000000e+02f}}}},
3417 /* Figure 13. */
3418 {SEGMENT_BEZIER, {{{2.00000000e+01f, 1.06666664e+02f},
3419 {2.66666660e+01f, 8.00000000e+01f},
3420 {4.00000000e+01f, 8.00000000e+01f}}}},
3421 {SEGMENT_BEZIER, {{{5.33333321e+01f, 8.00000000e+01f},
3422 {6.00000000e+01f, 1.06666664e+02f},
3423 {6.00000000e+01f, 1.60000000e+02f}}}},
3424 {SEGMENT_BEZIER, {{{6.00000000e+01f, 2.13333328e+02f},
3425 {5.33333321e+01f, 2.40000000e+02f},
3426 {4.00000000e+01f, 2.40000000e+02f}}}},
3427 {SEGMENT_BEZIER, {{{2.66666660e+01f, 2.40000000e+02f},
3428 {2.00000000e+01f, 2.13333328e+02f},
3429 {2.00000000e+01f, 1.60000000e+02f}}}},
3430 /* Figure 14. */
3431 {SEGMENT_BEZIER, {{{2.83333340e+01f, 6.12000000e+02f},
3432 {4.00000000e+01f, 6.58666687e+02f},
3433 {4.00000000e+01f, 7.52000000e+02f}}}},
3434 {SEGMENT_BEZIER, {{{4.00000000e+01f, 6.58666687e+02f},
3435 {5.16666641e+01f, 6.12000000e+02f},
3436 {7.50000000e+01f, 6.12000000e+02f}}}},
3437 {SEGMENT_BEZIER, {{{5.16666641e+01f, 6.12000000e+02f},
3438 {4.00000000e+01f, 5.65333313e+02f},
3439 {4.00000000e+01f, 4.72000000e+02f}}}},
3440 {SEGMENT_BEZIER, {{{4.00000000e+01f, 5.65333313e+02f},
3441 {2.83333340e+01f, 6.12000000e+02f},
3442 {5.00000000e+00f, 6.12000000e+02f}}}},
3443 /* Figure 15. */
3444 {SEGMENT_BEZIER, {{{2.00000000e+01f, 6.65333313e+02f},
3445 {2.66666660e+01f, 6.92000000e+02f},
3446 {4.00000000e+01f, 6.92000000e+02f}}}},
3447 {SEGMENT_BEZIER, {{{5.33333321e+01f, 6.92000000e+02f},
3448 {6.00000000e+01f, 6.65333313e+02f},
3449 {6.00000000e+01f, 6.12000000e+02f}}}},
3450 {SEGMENT_BEZIER, {{{6.00000000e+01f, 5.58666687e+02f},
3451 {5.33333321e+01f, 5.32000000e+02f},
3452 {4.00000000e+01f, 5.32000000e+02f}}}},
3453 {SEGMENT_BEZIER, {{{2.66666660e+01f, 5.32000000e+02f},
3454 {2.00000000e+01f, 5.58666687e+02f},
3455 {2.00000000e+01f, 6.12000000e+02f}}}},
3456 /* Figure 16. */
3457 {SEGMENT_BEZIER, {{{1.91750427e+02f, 1.27275856e+02f},
3458 {2.08249573e+02f, 1.27275856e+02f},
3459 {2.24748734e+02f, 6.12792168e+01f}}}},
3460 {SEGMENT_BEZIER, {{{2.08249573e+02f, 1.27275856e+02f},
3461 {2.08249573e+02f, 1.93272476e+02f},
3462 {2.24748734e+02f, 2.59269104e+02f}}}},
3463 {SEGMENT_BEZIER, {{{2.08249573e+02f, 1.93272476e+02f},
3464 {1.91750427e+02f, 1.93272476e+02f},
3465 {1.75251266e+02f, 2.59269104e+02f}}}},
3466 {SEGMENT_BEZIER, {{{1.91750427e+02f, 1.93272476e+02f},
3467 {1.91750427e+02f, 1.27275856e+02f},
3468 {1.75251266e+02f, 6.12792168e+01f}}}},
3469 /* Figure 17. */
3470 {SEGMENT_BEZIER, {{{1.95285950e+02f, 6.59932632e+01f},
3471 {2.04714050e+02f, 6.59932632e+01f},
3472 {2.14142136e+02f, 1.03705627e+02f}}}},
3473 {SEGMENT_BEZIER, {{{2.23570221e+02f, 1.41417984e+02f},
3474 {2.23570221e+02f, 1.79130356e+02f},
3475 {2.14142136e+02f, 2.16842712e+02f}}}},
3476 {SEGMENT_BEZIER, {{{2.04714050e+02f, 2.54555069e+02f},
3477 {1.95285950e+02f, 2.54555069e+02f},
3478 {1.85857864e+02f, 2.16842712e+02f}}}},
3479 {SEGMENT_BEZIER, {{{1.76429779e+02f, 1.79130356e+02f},
3480 {1.76429779e+02f, 1.41417984e+02f},
3481 {1.85857864e+02f, 1.03705627e+02f}}}},
3482 /* Figure 18. */
3483 {SEGMENT_BEZIER, {{{1.11847351e+02f, 4.46888092e+02f},
3484 {1.11847351e+02f, 5.12884705e+02f},
3485 {9.53481979e+01f, 5.78881348e+02f}}}},
3486 {SEGMENT_BEZIER, {{{1.11847351e+02f, 5.12884705e+02f},
3487 {1.28346512e+02f, 5.12884705e+02f},
3488 {1.44845673e+02f, 5.78881348e+02f}}}},
3489 {SEGMENT_BEZIER, {{{1.28346512e+02f, 5.12884705e+02f},
3490 {1.28346512e+02f, 4.46888092e+02f},
3491 {1.44845673e+02f, 3.80891479e+02f}}}},
3492 {SEGMENT_BEZIER, {{{1.28346512e+02f, 4.46888092e+02f},
3493 {1.11847351e+02f, 4.46888092e+02f},
3494 {9.53481979e+01f, 3.80891479e+02f}}}},
3495 /* Figure 19. */
3496 {SEGMENT_BEZIER, {{{9.65267105e+01f, 4.61030243e+02f},
3497 {9.65267105e+01f, 4.98742584e+02f},
3498 {1.05954803e+02f, 5.36454956e+02f}}}},
3499 {SEGMENT_BEZIER, {{{1.15382889e+02f, 5.74167297e+02f},
3500 {1.24810982e+02f, 5.74167297e+02f},
3501 {1.34239075e+02f, 5.36454956e+02f}}}},
3502 {SEGMENT_BEZIER, {{{1.43667160e+02f, 4.98742584e+02f},
3503 {1.43667160e+02f, 4.61030243e+02f},
3504 {1.34239075e+02f, 4.23317871e+02f}}}},
3505 {SEGMENT_BEZIER, {{{1.24810982e+02f, 3.85605499e+02f},
3506 {1.15382889e+02f, 3.85605499e+02f},
3507 {1.05954803e+02f, 4.23317871e+02f}}}},
3508 /* Figure 20. */
3509 {SEGMENT_LINE, {{{ 40.0f, 20.0f}}}},
3510 {SEGMENT_LINE, {{{ 75.0f, 160.0f}}}},
3511 {SEGMENT_LINE, {{{ 40.0f, 300.0f}}}},
3512 {SEGMENT_LINE, {{{ 5.0f, 160.0f}}}},
3513 /* Figure 21. */
3514 {SEGMENT_LINE, {{{ 40.0f, 80.0f}}}},
3515 {SEGMENT_LINE, {{{ 60.0f, 160.0f}}}},
3516 {SEGMENT_LINE, {{{ 40.0f, 240.0f}}}},
3517 {SEGMENT_LINE, {{{ 20.0f, 160.0f}}}},
3518 /* Figure 22. */
3519 {SEGMENT_LINE, {{{ 40.0f, 752.0f}}}},
3520 {SEGMENT_LINE, {{{ 75.0f, 612.0f}}}},
3521 {SEGMENT_LINE, {{{ 40.0f, 472.0f}}}},
3522 {SEGMENT_LINE, {{{ 5.0f, 612.0f}}}},
3523 /* Figure 23. */
3524 {SEGMENT_LINE, {{{ 40.0f, 692.0f}}}},
3525 {SEGMENT_LINE, {{{ 60.0f, 612.0f}}}},
3526 {SEGMENT_LINE, {{{ 40.0f, 532.0f}}}},
3527 {SEGMENT_LINE, {{{ 20.0f, 612.0f}}}},
3528 /* Figure 24. */
3529 {SEGMENT_LINE, {{{2.03125019e+01f, 1.51250000e+02f}}}},
3530 {SEGMENT_LINE, {{{3.12500019e+01f, 1.25000008e+02f}}}, D2D1_PATH_SEGMENT_FORCE_ROUND_LINE_JOIN},
3531 {SEGMENT_LINE, {{{3.78125000e+01f, 8.12500076e+01f}}}, D2D1_PATH_SEGMENT_FORCE_ROUND_LINE_JOIN},
3532 {SEGMENT_LINE, {{{4.00000000e+01f, 2.00000000e+01f}}}, D2D1_PATH_SEGMENT_FORCE_ROUND_LINE_JOIN},
3533 {SEGMENT_LINE, {{{4.21875000e+01f, 8.12500076e+01f}}}},
3534 {SEGMENT_LINE, {{{4.87500000e+01f, 1.25000008e+02f}}}, D2D1_PATH_SEGMENT_FORCE_ROUND_LINE_JOIN},
3535 {SEGMENT_LINE, {{{5.96875000e+01f, 1.51250000e+02f}}}, D2D1_PATH_SEGMENT_FORCE_ROUND_LINE_JOIN},
3536 {SEGMENT_LINE, {{{7.50000000e+01f, 1.60000000e+02f}}}, D2D1_PATH_SEGMENT_FORCE_ROUND_LINE_JOIN},
3537 {SEGMENT_LINE, {{{5.96875000e+01f, 1.68750000e+02f}}}},
3538 {SEGMENT_LINE, {{{4.87500000e+01f, 1.95000000e+02f}}}, D2D1_PATH_SEGMENT_FORCE_ROUND_LINE_JOIN},
3539 {SEGMENT_LINE, {{{4.21875000e+01f, 2.38750000e+02f}}}, D2D1_PATH_SEGMENT_FORCE_ROUND_LINE_JOIN},
3540 {SEGMENT_LINE, {{{4.00000000e+01f, 3.00000000e+02f}}}, D2D1_PATH_SEGMENT_FORCE_ROUND_LINE_JOIN},
3541 {SEGMENT_LINE, {{{3.78125000e+01f, 2.38750000e+02f}}}},
3542 {SEGMENT_LINE, {{{3.12500019e+01f, 1.95000000e+02f}}}, D2D1_PATH_SEGMENT_FORCE_ROUND_LINE_JOIN},
3543 {SEGMENT_LINE, {{{2.03125019e+01f, 1.68750000e+02f}}}, D2D1_PATH_SEGMENT_FORCE_ROUND_LINE_JOIN},
3544 {SEGMENT_LINE, {{{5.00000000e+00f, 1.60000000e+02f}}}, D2D1_PATH_SEGMENT_FORCE_ROUND_LINE_JOIN},
3545 /* Figure 25. */
3546 {SEGMENT_LINE, {{{2.50000000e+01f, 1.00000000e+02f}}}},
3547 {SEGMENT_LINE, {{{4.00000000e+01f, 8.00000000e+01f}}}, D2D1_PATH_SEGMENT_FORCE_ROUND_LINE_JOIN},
3548 {SEGMENT_LINE, {{{5.50000000e+01f, 1.00000000e+02f}}}},
3549 {SEGMENT_LINE, {{{6.00000000e+01f, 1.60000000e+02f}}}, D2D1_PATH_SEGMENT_FORCE_ROUND_LINE_JOIN},
3550 {SEGMENT_LINE, {{{5.50000000e+01f, 2.20000000e+02f}}}},
3551 {SEGMENT_LINE, {{{4.00000000e+01f, 2.40000000e+02f}}}, D2D1_PATH_SEGMENT_FORCE_ROUND_LINE_JOIN},
3552 {SEGMENT_LINE, {{{2.50000000e+01f, 2.20000000e+02f}}}},
3553 {SEGMENT_LINE, {{{2.00000000e+01f, 1.60000000e+02f}}}, D2D1_PATH_SEGMENT_FORCE_ROUND_LINE_JOIN},
3554 /* Figure 26. */
3555 {SEGMENT_LINE, {{{2.03125019e+01f, 6.20750000e+02f}}}},
3556 {SEGMENT_LINE, {{{3.12500019e+01f, 6.47000000e+02f}}}, D2D1_PATH_SEGMENT_FORCE_ROUND_LINE_JOIN},
3557 {SEGMENT_LINE, {{{3.78125000e+01f, 6.90750000e+02f}}}, D2D1_PATH_SEGMENT_FORCE_ROUND_LINE_JOIN},
3558 {SEGMENT_LINE, {{{4.00000000e+01f, 7.52000000e+02f}}}, D2D1_PATH_SEGMENT_FORCE_ROUND_LINE_JOIN},
3559 {SEGMENT_LINE, {{{4.21875000e+01f, 6.90750000e+02f}}}},
3560 {SEGMENT_LINE, {{{4.87500000e+01f, 6.47000000e+02f}}}, D2D1_PATH_SEGMENT_FORCE_ROUND_LINE_JOIN},
3561 {SEGMENT_LINE, {{{5.96875000e+01f, 6.20750000e+02f}}}, D2D1_PATH_SEGMENT_FORCE_ROUND_LINE_JOIN},
3562 {SEGMENT_LINE, {{{7.50000000e+01f, 6.12000000e+02f}}}, D2D1_PATH_SEGMENT_FORCE_ROUND_LINE_JOIN},
3563 {SEGMENT_LINE, {{{5.96875000e+01f, 6.03250000e+02f}}}},
3564 {SEGMENT_LINE, {{{4.87500000e+01f, 5.77000000e+02f}}}, D2D1_PATH_SEGMENT_FORCE_ROUND_LINE_JOIN},
3565 {SEGMENT_LINE, {{{4.21875000e+01f, 5.33250000e+02f}}}, D2D1_PATH_SEGMENT_FORCE_ROUND_LINE_JOIN},
3566 {SEGMENT_LINE, {{{4.00000000e+01f, 4.72000000e+02f}}}, D2D1_PATH_SEGMENT_FORCE_ROUND_LINE_JOIN},
3567 {SEGMENT_LINE, {{{3.78125000e+01f, 5.33250000e+02f}}}},
3568 {SEGMENT_LINE, {{{3.12500019e+01f, 5.77000000e+02f}}}, D2D1_PATH_SEGMENT_FORCE_ROUND_LINE_JOIN},
3569 {SEGMENT_LINE, {{{2.03125019e+01f, 6.03250000e+02f}}}, D2D1_PATH_SEGMENT_FORCE_ROUND_LINE_JOIN},
3570 {SEGMENT_LINE, {{{5.00000000e+00f, 6.12000000e+02f}}}, D2D1_PATH_SEGMENT_FORCE_ROUND_LINE_JOIN},
3571 /* Figure 27. */
3572 {SEGMENT_LINE, {{{2.50000000e+01f, 6.72000000e+02f}}}},
3573 {SEGMENT_LINE, {{{4.00000000e+01f, 6.92000000e+02f}}}, D2D1_PATH_SEGMENT_FORCE_ROUND_LINE_JOIN},
3574 {SEGMENT_LINE, {{{5.50000000e+01f, 6.72000000e+02f}}}},
3575 {SEGMENT_LINE, {{{6.00000000e+01f, 6.12000000e+02f}}}, D2D1_PATH_SEGMENT_FORCE_ROUND_LINE_JOIN},
3576 {SEGMENT_LINE, {{{5.50000000e+01f, 5.52000000e+02f}}}},
3577 {SEGMENT_LINE, {{{4.00000000e+01f, 5.32000000e+02f}}}, D2D1_PATH_SEGMENT_FORCE_ROUND_LINE_JOIN},
3578 {SEGMENT_LINE, {{{2.50000000e+01f, 5.52000000e+02f}}}},
3579 {SEGMENT_LINE, {{{2.00000000e+01f, 6.12000000e+02f}}}, D2D1_PATH_SEGMENT_FORCE_ROUND_LINE_JOIN},
3580 /* Figure 28. */
3581 {SEGMENT_LINE, {{{ 75.0f, 300.0f}}}},
3582 {SEGMENT_LINE, {{{ 5.0f, 300.0f}}}},
3583 /* Figure 29. */
3584 {SEGMENT_LINE, {{{ 40.0f, 100.0f}}}},
3585 {SEGMENT_BEZIER, {{{4.00000000e+01f, 7.66666666e+01f},
3586 {3.33333333e+01f, 7.00000000e+01f},
3587 {2.00000000e+01f, 8.00000000e+01f}}}},
3588 {SEGMENT_LINE, {{{ 60.0f, 40.0f}}}},
3589 {SEGMENT_BEZIER, {{{8.33333333e+01f, 4.00000000e+01f},
3590 {9.00000000e+01f, 3.33333333e+01f},
3591 {8.00000000e+01f, 2.00000000e+01f}}}},
3592 {SEGMENT_LINE, {{{140.0f, 160.0f}}}},
3593 {SEGMENT_BEZIER, {{{1.16666666e+02f, 1.60000000e+02f},
3594 {1.10000000e+02f, 1.66666666e+02f},
3595 {1.20000000e+02f, 1.80000000e+02f}}}},
3596 {SEGMENT_LINE, {{{170.0f, 110.0f}}}},
3597 {SEGMENT_BEZIER, {{{1.70000000e+02f, 1.26666666e+02f},
3598 {1.73333333e+02f, 1.30000000e+02f},
3599 {1.80000000e+02f, 1.20000000e+02f}}}},
3600 };
3601 static const struct expected_geometry_figure expected_figures[] =
3602 {
3603 /* 0 */
3604 {D2D1_FIGURE_BEGIN_FILLED, D2D1_FIGURE_END_CLOSED, { 15.0f, 20.0f}, 15, &expected_segments[0]},
3605 {D2D1_FIGURE_BEGIN_FILLED, D2D1_FIGURE_END_CLOSED, {155.0f, 300.0f}, 11, &expected_segments[15]},
3606 {D2D1_FIGURE_BEGIN_FILLED, D2D1_FIGURE_END_CLOSED, {165.0f, 20.0f}, 3, &expected_segments[26]},
3607 {D2D1_FIGURE_BEGIN_FILLED, D2D1_FIGURE_END_CLOSED, {225.0f, 60.0f}, 3, &expected_segments[29]},
3608 {D2D1_FIGURE_BEGIN_FILLED, D2D1_FIGURE_END_CLOSED, {215.0f, 220.0f}, 3, &expected_segments[32]},
3609 {D2D1_FIGURE_BEGIN_FILLED, D2D1_FIGURE_END_CLOSED, {195.0f, 180.0f}, 3, &expected_segments[35]},
3610 /* 6 */
3611 {D2D1_FIGURE_BEGIN_FILLED, D2D1_FIGURE_END_CLOSED, { 95.0f, 620.0f}, 15, &expected_segments[38]},
3612 {D2D1_FIGURE_BEGIN_FILLED, D2D1_FIGURE_END_CLOSED, {235.0f, 340.0f}, 11, &expected_segments[53]},
3613 {D2D1_FIGURE_BEGIN_FILLED, D2D1_FIGURE_END_CLOSED, {245.0f, 620.0f}, 3, &expected_segments[64]},
3614 {D2D1_FIGURE_BEGIN_FILLED, D2D1_FIGURE_END_CLOSED, {305.0f, 580.0f}, 3, &expected_segments[67]},
3615 {D2D1_FIGURE_BEGIN_FILLED, D2D1_FIGURE_END_CLOSED, {295.0f, 420.0f}, 3, &expected_segments[70]},
3616 {D2D1_FIGURE_BEGIN_FILLED, D2D1_FIGURE_END_CLOSED, {275.0f, 460.0f}, 3, &expected_segments[73]},
3617 /* 12 */
3618 {D2D1_FIGURE_BEGIN_FILLED, D2D1_FIGURE_END_CLOSED, { 5.0f, 160.0f}, 4, &expected_segments[76]},
3619 {D2D1_FIGURE_BEGIN_FILLED, D2D1_FIGURE_END_CLOSED, { 20.0f, 160.0f}, 4, &expected_segments[80]},
3620 {D2D1_FIGURE_BEGIN_FILLED, D2D1_FIGURE_END_CLOSED, { 5.0f, 612.0f}, 4, &expected_segments[84]},
3621 {D2D1_FIGURE_BEGIN_FILLED, D2D1_FIGURE_END_CLOSED, { 20.0f, 612.0f}, 4, &expected_segments[88]},
3622 /* 16 */
3624 {1.75251266e+02f, 6.12792168e+01f}, 4, &expected_segments[92]},
3626 {1.85857864e+02f, 1.03705627e+02f}, 4, &expected_segments[96]},
3628 {9.53481979e+01f, 3.80891479e+02f}, 4, &expected_segments[100]},
3630 {1.05954803e+02f, 4.23317871e+02f}, 4, &expected_segments[104]},
3631 /* 20 */
3632 {D2D1_FIGURE_BEGIN_FILLED, D2D1_FIGURE_END_CLOSED, { 5.0f, 160.0f}, 4, &expected_segments[108]},
3633 {D2D1_FIGURE_BEGIN_FILLED, D2D1_FIGURE_END_CLOSED, { 20.0f, 160.0f}, 4, &expected_segments[112]},
3634 {D2D1_FIGURE_BEGIN_FILLED, D2D1_FIGURE_END_CLOSED, { 5.0f, 612.0f}, 4, &expected_segments[116]},
3635 {D2D1_FIGURE_BEGIN_FILLED, D2D1_FIGURE_END_CLOSED, { 20.0f, 612.0f}, 4, &expected_segments[120]},
3636 /* 24 */
3637 {D2D1_FIGURE_BEGIN_FILLED, D2D1_FIGURE_END_CLOSED, { 5.0f, 160.0f}, 16, &expected_segments[124]},
3638 {D2D1_FIGURE_BEGIN_FILLED, D2D1_FIGURE_END_CLOSED, { 20.0f, 160.0f}, 8, &expected_segments[140]},
3639 {D2D1_FIGURE_BEGIN_FILLED, D2D1_FIGURE_END_CLOSED, { 5.0f, 612.0f}, 16, &expected_segments[148]},
3640 {D2D1_FIGURE_BEGIN_FILLED, D2D1_FIGURE_END_CLOSED, { 20.0f, 612.0f}, 8, &expected_segments[164]},
3641 /* 28 */
3642 {D2D1_FIGURE_BEGIN_HOLLOW, D2D1_FIGURE_END_OPEN, { 40.0f, 20.0f}, 2, &expected_segments[172]},
3643 /* 29 */
3644 {D2D1_FIGURE_BEGIN_FILLED, D2D1_FIGURE_END_OPEN, { 20.0f, 80.0f}, 2, &expected_segments[174]},
3645 {D2D1_FIGURE_BEGIN_FILLED, D2D1_FIGURE_END_OPEN, { 80.0f, 20.0f}, 2, &expected_segments[176]},
3646 {D2D1_FIGURE_BEGIN_FILLED, D2D1_FIGURE_END_CLOSED, { 120.0f, 180.0f}, 2, &expected_segments[178]},
3647 {D2D1_FIGURE_BEGIN_FILLED, D2D1_FIGURE_END_CLOSED, { 180.0f, 120.0f}, 2, &expected_segments[180]},
3648 };
3649
3650 if (!init_test_context(&ctx, d3d11))
3651 return;
3652
3653 rt = ctx.rt;
3654 factory = ctx.factory;
3655
3656 ID2D1RenderTarget_SetDpi(rt, 192.0f, 48.0f);
3657 ID2D1RenderTarget_SetAntialiasMode(rt, D2D1_ANTIALIAS_MODE_ALIASED);
3658 set_color(&color, 0.890f, 0.851f, 0.600f, 1.0f);
3659 hr = ID2D1RenderTarget_CreateSolidColorBrush(rt, &color, NULL, &brush);
3660 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
3661
3662 /* Close() when closed. */
3663 hr = ID2D1Factory_CreatePathGeometry(factory, &geometry);
3664 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
3665 hr = ID2D1PathGeometry_GetFigureCount(geometry, &count);
3666 ok(hr == D2DERR_WRONG_STATE, "Got unexpected hr %#lx.\n", hr);
3667 hr = ID2D1PathGeometry_GetSegmentCount(geometry, &count);
3668 ok(hr == D2DERR_WRONG_STATE, "Got unexpected hr %#lx.\n", hr);
3669 hr = ID2D1PathGeometry_Open(geometry, &sink);
3670 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
3671 hr = ID2D1PathGeometry_GetFigureCount(geometry, &count);
3672 ok(hr == D2DERR_WRONG_STATE, "Got unexpected hr %#lx.\n", hr);
3673 hr = ID2D1PathGeometry_GetSegmentCount(geometry, &count);
3674 ok(hr == D2DERR_WRONG_STATE, "Got unexpected hr %#lx.\n", hr);
3675 hr = ID2D1GeometrySink_Close(sink);
3676 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
3677 hr = ID2D1PathGeometry_GetFigureCount(geometry, &count);
3678 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
3679 ok(!count, "Got unexpected figure count %u.\n", count);
3680 hr = ID2D1PathGeometry_GetSegmentCount(geometry, &count);
3681 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
3682 ok(!count, "Got unexpected segment count %u.\n", count);
3683 hr = ID2D1GeometrySink_Close(sink);
3684 ok(hr == D2DERR_WRONG_STATE, "Got unexpected hr %#lx.\n", hr);
3685 ID2D1GeometrySink_Release(sink);
3686 hr = ID2D1PathGeometry_GetFigureCount(geometry, &count);
3687 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
3688 ok(!count, "Got unexpected figure count %u.\n", count);
3689 hr = ID2D1PathGeometry_GetSegmentCount(geometry, &count);
3690 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
3691 ok(!count, "Got unexpected segment count %u.\n", count);
3692 ID2D1PathGeometry_Release(geometry);
3693
3694 /* Open() when closed. */
3695 hr = ID2D1Factory_CreatePathGeometry(factory, &geometry);
3696 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
3697 hr = ID2D1PathGeometry_Open(geometry, &sink);
3698 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
3699 hr = ID2D1GeometrySink_Close(sink);
3700 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
3701 ID2D1GeometrySink_Release(sink);
3702 hr = ID2D1PathGeometry_Open(geometry, &sink);
3703 ok(hr == D2DERR_WRONG_STATE, "Got unexpected hr %#lx.\n", hr);
3704 hr = ID2D1PathGeometry_GetFigureCount(geometry, &count);
3705 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
3706 ok(!count, "Got unexpected figure count %u.\n", count);
3707 hr = ID2D1PathGeometry_GetSegmentCount(geometry, &count);
3708 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
3709 ok(!count, "Got unexpected segment count %u.\n", count);
3710 ID2D1PathGeometry_Release(geometry);
3711
3712 /* Open() when open. */
3713 hr = ID2D1Factory_CreatePathGeometry(factory, &geometry);
3714 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
3715 hr = ID2D1PathGeometry_Open(geometry, &sink);
3716 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
3717 hr = ID2D1PathGeometry_Open(geometry, &tmp_sink);
3718 ok(hr == D2DERR_WRONG_STATE, "Got unexpected hr %#lx.\n", hr);
3719 hr = ID2D1GeometrySink_Close(sink);
3720 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
3721 ID2D1GeometrySink_Release(sink);
3722 hr = ID2D1PathGeometry_GetFigureCount(geometry, &count);
3723 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
3724 ok(!count, "Got unexpected figure count %u.\n", count);
3725 hr = ID2D1PathGeometry_GetSegmentCount(geometry, &count);
3726 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
3727 ok(!count, "Got unexpected segment count %u.\n", count);
3728 ID2D1PathGeometry_Release(geometry);
3729
3730 /* BeginFigure() without EndFigure(). */
3731 hr = ID2D1Factory_CreatePathGeometry(factory, &geometry);
3732 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
3733 hr = ID2D1PathGeometry_Open(geometry, &sink);
3734 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
3735 ID2D1GeometrySink_BeginFigure(sink, point, D2D1_FIGURE_BEGIN_FILLED);
3736 hr = ID2D1GeometrySink_Close(sink);
3737 ok(hr == D2DERR_WRONG_STATE, "Got unexpected hr %#lx.\n", hr);
3738 ID2D1GeometrySink_EndFigure(sink, D2D1_FIGURE_END_CLOSED);
3739 hr = ID2D1GeometrySink_Close(sink);
3740 ok(hr == D2DERR_WRONG_STATE, "Got unexpected hr %#lx.\n", hr);
3741 ID2D1GeometrySink_Release(sink);
3742 hr = ID2D1PathGeometry_GetFigureCount(geometry, &count);
3743 ok(hr == D2DERR_WRONG_STATE, "Got unexpected hr %#lx.\n", hr);
3744 hr = ID2D1PathGeometry_GetSegmentCount(geometry, &count);
3745 ok(hr == D2DERR_WRONG_STATE, "Got unexpected hr %#lx.\n", hr);
3746 ID2D1PathGeometry_Release(geometry);
3747
3748 /* EndFigure() without BeginFigure(). */
3749 hr = ID2D1Factory_CreatePathGeometry(factory, &geometry);
3750 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
3751 hr = ID2D1PathGeometry_Open(geometry, &sink);
3752 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
3753 ID2D1GeometrySink_EndFigure(sink, D2D1_FIGURE_END_CLOSED);
3754 hr = ID2D1GeometrySink_Close(sink);
3755 ok(hr == D2DERR_WRONG_STATE, "Got unexpected hr %#lx.\n", hr);
3756 ID2D1GeometrySink_Release(sink);
3757 hr = ID2D1PathGeometry_GetFigureCount(geometry, &count);
3758 ok(hr == D2DERR_WRONG_STATE, "Got unexpected hr %#lx.\n", hr);
3759 hr = ID2D1PathGeometry_GetSegmentCount(geometry, &count);
3760 ok(hr == D2DERR_WRONG_STATE, "Got unexpected hr %#lx.\n", hr);
3761 ID2D1PathGeometry_Release(geometry);
3762
3763 /* BeginFigure()/EndFigure() mismatch. */
3764 hr = ID2D1Factory_CreatePathGeometry(factory, &geometry);
3765 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
3766 hr = ID2D1PathGeometry_Open(geometry, &sink);
3767 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
3768 ID2D1GeometrySink_BeginFigure(sink, point, D2D1_FIGURE_BEGIN_FILLED);
3769 ID2D1GeometrySink_BeginFigure(sink, point, D2D1_FIGURE_BEGIN_FILLED);
3770 ID2D1GeometrySink_EndFigure(sink, D2D1_FIGURE_END_CLOSED);
3771 ID2D1GeometrySink_EndFigure(sink, D2D1_FIGURE_END_CLOSED);
3772 hr = ID2D1GeometrySink_Close(sink);
3773 ok(hr == D2DERR_WRONG_STATE, "Got unexpected hr %#lx.\n", hr);
3774 ID2D1GeometrySink_EndFigure(sink, D2D1_FIGURE_END_CLOSED);
3775 hr = ID2D1GeometrySink_Close(sink);
3776 ok(hr == D2DERR_WRONG_STATE, "Got unexpected hr %#lx.\n", hr);
3777 ID2D1GeometrySink_Release(sink);
3778 ID2D1PathGeometry_Release(geometry);
3779
3780 /* AddLine() outside BeginFigure()/EndFigure(). */
3781 hr = ID2D1Factory_CreatePathGeometry(factory, &geometry);
3782 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
3783 hr = ID2D1PathGeometry_Open(geometry, &sink);
3784 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
3785 ID2D1GeometrySink_AddLine(sink, point);
3786 hr = ID2D1GeometrySink_Close(sink);
3787 ok(hr == D2DERR_WRONG_STATE, "Got unexpected hr %#lx.\n", hr);
3788 ID2D1GeometrySink_AddLine(sink, point);
3789 ID2D1GeometrySink_Release(sink);
3790 hr = ID2D1PathGeometry_GetFigureCount(geometry, &count);
3791 ok(hr == D2DERR_WRONG_STATE, "Got unexpected hr %#lx.\n", hr);
3792 hr = ID2D1PathGeometry_GetSegmentCount(geometry, &count);
3793 ok(hr == D2DERR_WRONG_STATE, "Got unexpected hr %#lx.\n", hr);
3794 ID2D1PathGeometry_Release(geometry);
3795
3796 /* Empty figure. */
3797 hr = ID2D1Factory_CreatePathGeometry(factory, &geometry);
3798 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
3799 hr = ID2D1PathGeometry_Open(geometry, &sink);
3800 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
3801 set_point(&point, 123.0f, 456.0f);
3802 ID2D1GeometrySink_BeginFigure(sink, point, D2D1_FIGURE_BEGIN_FILLED);
3803 ID2D1GeometrySink_EndFigure(sink, D2D1_FIGURE_END_CLOSED);
3804 hr = ID2D1GeometrySink_Close(sink);
3805 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
3806 ID2D1GeometrySink_Release(sink);
3807 hr = ID2D1PathGeometry_GetFigureCount(geometry, &count);
3808 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
3809 ok(count == 1, "Got unexpected figure count %u.\n", count);
3810 hr = ID2D1PathGeometry_GetSegmentCount(geometry, &count);
3811 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
3812 ok(count == 1, "Got unexpected segment count %u.\n", count);
3813
3814 set_rect(&rect, 0.0f, 0.0f, 0.0f, 0.0f);
3815 hr = ID2D1PathGeometry_GetBounds(geometry, NULL, &rect);
3816 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
3817 match = compare_rect(&rect, 123.0f, 456.0f, 123.0f, 456.0f, 0);
3818 ok(match, "Got unexpected rectangle {%.8e, %.8e, %.8e, %.8e}.\n",
3820
3822 translate_matrix(&matrix, 80.0f, 640.0f);
3823 scale_matrix(&matrix, 2.0f, 0.5f);
3824 hr = ID2D1PathGeometry_GetBounds(geometry, &matrix, &rect);
3825 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
3826 match = compare_rect(&rect, 326.0f, 868.0f, 326.0f, 868.0f, 0);
3827 ok(match, "Got unexpected rectangle {%.8e, %.8e, %.8e, %.8e}.\n",
3829
3830 ID2D1PathGeometry_Release(geometry);
3831
3832 /* Degenerate figure. */
3833 hr = ID2D1Factory_CreatePathGeometry(factory, &geometry);
3834 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
3835 hr = ID2D1PathGeometry_Open(geometry, &sink);
3836 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
3837 set_point(&point, 123.0f, 456.0f);
3838 ID2D1GeometrySink_BeginFigure(sink, point, D2D1_FIGURE_BEGIN_FILLED);
3839 quadratic_to(sink, 123.0f, 456.0f, 123.0f, 456.0f);
3840 quadratic_to(sink, 123.0f, 456.0f, 123.0f, 456.0f);
3841 quadratic_to(sink, 123.0f, 456.0f, 123.0f, 456.0f);
3842 ID2D1GeometrySink_EndFigure(sink, D2D1_FIGURE_END_CLOSED);
3843 hr = ID2D1GeometrySink_Close(sink);
3844 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
3845 ID2D1GeometrySink_Release(sink);
3846 hr = ID2D1PathGeometry_GetFigureCount(geometry, &count);
3847 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
3848 ok(count == 1, "Got unexpected figure count %u.\n", count);
3849 hr = ID2D1PathGeometry_GetSegmentCount(geometry, &count);
3850 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
3851 ok(count == 4, "Got unexpected segment count %u.\n", count);
3852 ID2D1PathGeometry_Release(geometry);
3853
3854 /* Close right after Open(). */
3855 hr = ID2D1Factory_CreatePathGeometry(factory, &geometry);
3856 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
3857
3858 /* Not open yet. */
3859 set_rect(&rect, 1.0f, 2.0f, 3.0f, 4.0f);
3860 hr = ID2D1PathGeometry_GetBounds(geometry, NULL, &rect);
3861 ok(hr == D2DERR_WRONG_STATE, "Got unexpected hr %#lx.\n", hr);
3862 match = compare_rect(&rect, 1.0f, 2.0f, 3.0f, 4.0f, 0);
3863 ok(match, "Got unexpected rectangle {%.8e, %.8e, %.8e, %.8e}.\n",
3865
3866 hr = ID2D1PathGeometry_Open(geometry, &sink);
3867 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
3868
3869 /* Open, not closed. */
3870 set_rect(&rect, 1.0f, 2.0f, 3.0f, 4.0f);
3871 hr = ID2D1PathGeometry_GetBounds(geometry, NULL, &rect);
3872 ok(hr == D2DERR_WRONG_STATE, "Got unexpected hr %#lx.\n", hr);
3873 match = compare_rect(&rect, 1.0f, 2.0f, 3.0f, 4.0f, 0);
3874 ok(match, "Got unexpected rectangle {%.8e, %.8e, %.8e, %.8e}.\n",
3876
3877 hr = ID2D1GeometrySink_Close(sink);
3878 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
3879 ID2D1GeometrySink_Release(sink);
3880 hr = ID2D1PathGeometry_GetFigureCount(geometry, &count);
3881 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
3882 ok(count == 0, "Got unexpected figure count %u.\n", count);
3883 hr = ID2D1PathGeometry_GetSegmentCount(geometry, &count);
3884 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
3885 ok(count == 0, "Got unexpected segment count %u.\n", count);
3886
3887 set_rect(&rect, 0.0f, 0.0f, 0.0f, 0.0f);
3888 hr = ID2D1PathGeometry_GetBounds(geometry, NULL, &rect);
3889 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
3891 "Got unexpected rectangle {%.8e, %.8e, %.8e, %.8e}.\n", rect.left, rect.top, rect.right, rect.bottom);
3892
3894 translate_matrix(&matrix, 10.0f, 20.0f);
3895 scale_matrix(&matrix, 10.0f, 20.0f);
3896 set_rect(&rect, 0.0f, 0.0f, 0.0f, 0.0f);
3897 hr = ID2D1PathGeometry_GetBounds(geometry, &matrix, &rect);
3898 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
3900 "Got unexpected rectangle {%.8e, %.8e, %.8e, %.8e}.\n", rect.left, rect.top, rect.right, rect.bottom);
3901
3902 ID2D1PathGeometry_Release(geometry);
3903
3904 /* GetBounds() with bezier segments. */
3905 hr = ID2D1Factory_CreatePathGeometry(factory, &geometry);
3906 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
3907 hr = ID2D1PathGeometry_Open(geometry, &sink);
3908 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
3910 hr = ID2D1GeometrySink_Close(sink);
3911 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
3912 ID2D1GeometrySink_Release(sink);
3913
3914 set_rect(&rect, 0.0f, 0.0f, 0.0f, 0.0f);
3915 hr = ID2D1PathGeometry_GetBounds(geometry, NULL, &rect);
3916 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
3917 match = compare_rect(&rect, 5.0f, 20.0f, 75.0f, 752.0f, 0);
3918 ok(match, "Got unexpected rectangle {%.8e, %.8e, %.8e, %.8e}.\n",
3920
3922 translate_matrix(&matrix, 80.0f, 640.0f);
3923 scale_matrix(&matrix, 2.0f, 0.5f);
3924 set_rect(&rect, 0.0f, 0.0f, 0.0f, 0.0f);
3925 hr = ID2D1PathGeometry_GetBounds(geometry, &matrix, &rect);
3926 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
3927 match = compare_rect(&rect, 90.0f, 650.0f, 230.0f, 1016.0f, 0);
3928 ok(match, "Got unexpected rectangle {%.8e, %.8e, %.8e, %.8e}.\n",
3930
3931 ID2D1PathGeometry_Release(geometry);
3932
3933 /* GetBounds() with bezier segments and some hollow components. */
3934 hr = ID2D1Factory_CreatePathGeometry(factory, &geometry);
3935 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
3936 hr = ID2D1PathGeometry_Open(geometry, &sink);
3937 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
3939 hr = ID2D1GeometrySink_Close(sink);
3940 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
3941 ID2D1GeometrySink_Release(sink);
3942
3943 set_rect(&rect, 0.0f, 0.0f, 0.0f, 0.0f);
3944 hr = ID2D1PathGeometry_GetBounds(geometry, NULL, &rect);
3945 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
3946 match = compare_rect(&rect, 5.0f, 472.0f, 75.0f, 752.0f, 0);
3947 ok(match, "Got unexpected rectangle {%.8e, %.8e, %.8e, %.8e}.\n",
3949
3951 translate_matrix(&matrix, 80.0f, 640.0f);
3952 scale_matrix(&matrix, 2.0f, 0.5f);
3953 set_rect(&rect, 0.0f, 0.0f, 0.0f, 0.0f);
3954 hr = ID2D1PathGeometry_GetBounds(geometry, &matrix, &rect);
3955 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
3956 match = compare_rect(&rect, 90.0f, 876.0f, 230.0f, 1016.0f, 0);
3957 ok(match, "Got unexpected rectangle {%.8e, %.8e, %.8e, %.8e}.\n",
3959
3960 ID2D1PathGeometry_Release(geometry);
3961
3962 /* GetBounds() with bezier segments and all hollow components. */
3963 hr = ID2D1Factory_CreatePathGeometry(factory, &geometry);
3964 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
3965 hr = ID2D1PathGeometry_Open(geometry, &sink);
3966 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
3968 hr = ID2D1GeometrySink_Close(sink);
3969 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
3970 ID2D1GeometrySink_Release(sink);
3971
3972 set_rect(&rect, 0.0f, 0.0f, 0.0f, 0.0f);
3973 hr = ID2D1PathGeometry_GetBounds(geometry, NULL, &rect);
3974 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
3976 ok(match, "Got unexpected rectangle {%.8e, %.8e, %.8e, %.8e}.\n",
3978
3980 translate_matrix(&matrix, 80.0f, 640.0f);
3981 scale_matrix(&matrix, 2.0f, 0.5f);
3982 set_rect(&rect, 0.0f, 0.0f, 0.0f, 0.0f);
3983 hr = ID2D1PathGeometry_GetBounds(geometry, &matrix, &rect);
3984 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
3986 ok(match, "Got unexpected rectangle {%.8e, %.8e, %.8e, %.8e}.\n",
3988
3989 ID2D1PathGeometry_Release(geometry);
3990
3991 hr = ID2D1Factory_CreatePathGeometry(factory, &geometry);
3992 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
3993 hr = ID2D1PathGeometry_Open(geometry, &sink);
3994 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
3995 /* The fillmode that's used is the last one set before the sink is closed. */
3996 ID2D1GeometrySink_SetFillMode(sink, D2D1_FILL_MODE_WINDING);
3998 ID2D1GeometrySink_SetFillMode(sink, D2D1_FILL_MODE_ALTERNATE);
3999 hr = ID2D1GeometrySink_Close(sink);
4000 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
4001 hr = ID2D1PathGeometry_GetFigureCount(geometry, &count);
4002 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
4003 ok(count == 6, "Got unexpected figure count %u.\n", count);
4004 hr = ID2D1PathGeometry_GetSegmentCount(geometry, &count);
4005 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
4006 /* Intersections don't create extra segments. */
4007 ok(count == 44, "Got unexpected segment count %u.\n", count);
4008 ID2D1GeometrySink_SetFillMode(sink, D2D1_FILL_MODE_WINDING);
4009 ID2D1GeometrySink_Release(sink);
4010
4011 geometry_sink_init(&simplify_sink);
4012 hr = ID2D1PathGeometry_Simplify(geometry, D2D1_GEOMETRY_SIMPLIFICATION_OPTION_LINES,
4013 NULL, 0.0f, &simplify_sink.ID2D1SimplifiedGeometrySink_iface);
4014 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
4015 geometry_sink_check(&simplify_sink, D2D1_FILL_MODE_ALTERNATE, 6, &expected_figures[0], 0);
4016 geometry_sink_cleanup(&simplify_sink);
4017 geometry_sink_init(&simplify_sink);
4018 hr = ID2D1PathGeometry_Simplify(geometry, D2D1_GEOMETRY_SIMPLIFICATION_OPTION_CUBICS_AND_LINES,
4019 NULL, 0.0f, &simplify_sink.ID2D1SimplifiedGeometrySink_iface);
4020 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
4021 geometry_sink_check(&simplify_sink, D2D1_FILL_MODE_ALTERNATE, 6, &expected_figures[0], 0);
4022 geometry_sink_cleanup(&simplify_sink);
4023
4025 translate_matrix(&matrix, 80.0f, 640.0f);
4026 scale_matrix(&matrix, 1.0f, -1.0f);
4027 hr = ID2D1Factory_CreateTransformedGeometry(factory, (ID2D1Geometry *)geometry, &matrix, &transformed_geometry);
4028 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
4029
4030 geometry_sink_init(&simplify_sink);
4031 hr = ID2D1TransformedGeometry_Simplify(transformed_geometry, D2D1_GEOMETRY_SIMPLIFICATION_OPTION_LINES,
4032 NULL, 0.0f, &simplify_sink.ID2D1SimplifiedGeometrySink_iface);
4033 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
4034 geometry_sink_check(&simplify_sink, D2D1_FILL_MODE_ALTERNATE, 6, &expected_figures[6], 0);
4035 geometry_sink_cleanup(&simplify_sink);
4036
4037 ID2D1TransformedGeometry_GetSourceGeometry(transformed_geometry, &tmp_geometry);
4038 ok(tmp_geometry == (ID2D1Geometry *)geometry,
4039 "Got unexpected source geometry %p, expected %p.\n", tmp_geometry, geometry);
4040 ID2D1TransformedGeometry_GetTransform(transformed_geometry, &tmp_matrix);
4041 ok(!memcmp(&tmp_matrix, &matrix, sizeof(matrix)),
4042 "Got unexpected matrix {%.8e, %.8e, %.8e, %.8e, %.8e, %.8e}.\n",
4043 tmp_matrix._11, tmp_matrix._12, tmp_matrix._21,
4044 tmp_matrix._22, tmp_matrix._31, tmp_matrix._32);
4045 geometry_sink_init(&simplify_sink);
4046 hr = ID2D1Geometry_Simplify(tmp_geometry, D2D1_GEOMETRY_SIMPLIFICATION_OPTION_LINES,
4047 &tmp_matrix, 0.0f, &simplify_sink.ID2D1SimplifiedGeometrySink_iface);
4048 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
4049 geometry_sink_check(&simplify_sink, D2D1_FILL_MODE_ALTERNATE, 6, &expected_figures[6], 0);
4050 geometry_sink_cleanup(&simplify_sink);
4051 ID2D1Geometry_Release(tmp_geometry);
4052
4053 ID2D1RenderTarget_BeginDraw(rt);
4054 set_color(&color, 0.396f, 0.180f, 0.537f, 1.0f);
4055 ID2D1RenderTarget_Clear(rt, &color);
4056 ID2D1RenderTarget_FillGeometry(rt, (ID2D1Geometry *)geometry, (ID2D1Brush *)brush, NULL);
4057 ID2D1RenderTarget_FillGeometry(rt, (ID2D1Geometry *)transformed_geometry, (ID2D1Brush *)brush, NULL);
4058 hr = ID2D1RenderTarget_EndDraw(rt, NULL, NULL);
4059 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
4060 match = compare_surface(&ctx, "3aace1b22aae111cb577614fed16e4eb1650dba5");
4061 ok(match, "Surface does not match.\n");
4062
4063 /* Edge test. */
4064 set_point(&point, 94.0f, 620.0f);
4065 contains = TRUE;
4066 hr = ID2D1TransformedGeometry_FillContainsPoint(transformed_geometry, point, NULL, 0.0f, &contains);
4067 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
4068 ok(!contains, "Got unexpected contains %#x.\n", contains);
4069
4070 set_point(&point, 95.0f, 620.0f);
4071 contains = FALSE;
4072 hr = ID2D1TransformedGeometry_FillContainsPoint(transformed_geometry, point, NULL, 0.0f, &contains);
4073 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
4074 ok(contains == TRUE, "Got unexpected contains %#x.\n", contains);
4075
4076 /* With transformation matrix. */
4078 translate_matrix(&matrix, -10.0f, 0.0f);
4079 set_point(&point, 85.0f, 620.0f);
4080 contains = FALSE;
4081 hr = ID2D1TransformedGeometry_FillContainsPoint(transformed_geometry, point, &matrix, 0.0f, &contains);
4082 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
4083 ok(contains == TRUE, "Got unexpected contains %#x.\n", contains);
4084
4085 ID2D1TransformedGeometry_Release(transformed_geometry);
4086 ID2D1PathGeometry_Release(geometry);
4087
4088 hr = ID2D1Factory_CreatePathGeometry(factory, &geometry);
4089 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
4090 hr = ID2D1PathGeometry_Open(geometry, &sink);
4091 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
4093 ID2D1GeometrySink_SetFillMode(sink, D2D1_FILL_MODE_WINDING);
4094 hr = ID2D1GeometrySink_Close(sink);
4095 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
4096 hr = ID2D1PathGeometry_GetFigureCount(geometry, &count);
4097 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
4098 ok(count == 6, "Got unexpected figure count %u.\n", count);
4099 hr = ID2D1PathGeometry_GetSegmentCount(geometry, &count);
4100 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
4101 ok(count == 44, "Got unexpected segment count %u.\n", count);
4102 ID2D1GeometrySink_Release(sink);
4103
4104 set_rect(&rect, 0.0f, 0.0f, 0.0f, 0.0f);
4105 hr = ID2D1PathGeometry_GetBounds(geometry, NULL, &rect);
4106 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
4107 match = compare_rect(&rect, 5.0f, 20.0f, 235.0f, 300.0f, 0);
4108 ok(match, "Got unexpected rectangle {%.8e, %.8e, %.8e, %.8e}.\n",
4110
4112 translate_matrix(&matrix, 100.0f, 50.0f);
4113 scale_matrix(&matrix, 2.0f, 1.5f);
4114 rotate_matrix(&matrix, M_PI / 4.0f);
4115 set_rect(&rect, 0.0f, 0.0f, 0.0f, 0.0f);
4116 hr = ID2D1PathGeometry_GetBounds(geometry, &matrix, &rect);
4117 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
4118 match = compare_rect(&rect, -3.17192993e+02f, 8.71231079e+01f, 4.04055908e+02f, 6.17453125e+02f, 1);
4119 ok(match, "Got unexpected rectangle {%.8e, %.8e, %.8e, %.8e}.\n",
4121
4122 geometry_sink_init(&simplify_sink);
4123 hr = ID2D1PathGeometry_Simplify(geometry, D2D1_GEOMETRY_SIMPLIFICATION_OPTION_LINES,
4124 NULL, 0.0f, &simplify_sink.ID2D1SimplifiedGeometrySink_iface);
4125 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
4126 geometry_sink_check(&simplify_sink, D2D1_FILL_MODE_WINDING, 6, &expected_figures[0], 0);
4127 geometry_sink_cleanup(&simplify_sink);
4128
4130 translate_matrix(&matrix, 320.0f, 320.0f);
4131 scale_matrix(&matrix, -1.0f, 1.0f);
4132 hr = ID2D1Factory_CreateTransformedGeometry(factory, (ID2D1Geometry *)geometry, &matrix, &transformed_geometry);
4133 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
4134
4135 ID2D1RenderTarget_BeginDraw(rt);
4136 ID2D1RenderTarget_Clear(rt, &color);
4137 ID2D1RenderTarget_FillGeometry(rt, (ID2D1Geometry *)geometry, (ID2D1Brush *)brush, NULL);
4138 ID2D1RenderTarget_FillGeometry(rt, (ID2D1Geometry *)transformed_geometry, (ID2D1Brush *)brush, NULL);
4139 hr = ID2D1RenderTarget_EndDraw(rt, NULL, NULL);
4140 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
4141 match = compare_surface(&ctx, "bfb40a1f007694fa07dbd3b854f3f5d9c3e1d76b");
4142 ok(match, "Surface does not match.\n");
4143 ID2D1TransformedGeometry_Release(transformed_geometry);
4144 ID2D1PathGeometry_Release(geometry);
4145
4146 hr = ID2D1Factory_CreatePathGeometry(factory, &geometry);
4147 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
4148 hr = ID2D1PathGeometry_Open(geometry, &sink);
4149 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
4151 hr = ID2D1GeometrySink_Close(sink);
4152 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
4153 hr = ID2D1PathGeometry_GetFigureCount(geometry, &count);
4154 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
4155 ok(count == 4, "Got unexpected figure count %u.\n", count);
4156 hr = ID2D1PathGeometry_GetSegmentCount(geometry, &count);
4157 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
4158 ok(count == 20, "Got unexpected segment count %u.\n", count);
4159 ID2D1GeometrySink_Release(sink);
4160
4161 geometry_sink_init(&simplify_sink);
4162 hr = ID2D1PathGeometry_Simplify(geometry, D2D1_GEOMETRY_SIMPLIFICATION_OPTION_CUBICS_AND_LINES,
4163 NULL, 0.0f, &simplify_sink.ID2D1SimplifiedGeometrySink_iface);
4164 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
4165 geometry_sink_check(&simplify_sink, D2D1_FILL_MODE_ALTERNATE, 4, &expected_figures[12], 1);
4166 geometry_sink_cleanup(&simplify_sink);
4167 geometry_sink_init(&simplify_sink);
4168 hr = ID2D1PathGeometry_Simplify(geometry, D2D1_GEOMETRY_SIMPLIFICATION_OPTION_LINES,
4169 NULL, 100.0f, &simplify_sink.ID2D1SimplifiedGeometrySink_iface);
4170 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
4171 geometry_sink_check(&simplify_sink, D2D1_FILL_MODE_ALTERNATE, 4, &expected_figures[20], 1);
4172 geometry_sink_cleanup(&simplify_sink);
4173 geometry_sink_init(&simplify_sink);
4174 hr = ID2D1PathGeometry_Simplify(geometry, D2D1_GEOMETRY_SIMPLIFICATION_OPTION_LINES,
4175 NULL, 10.0f, &simplify_sink.ID2D1SimplifiedGeometrySink_iface);
4176 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
4177 geometry_sink_check(&simplify_sink, D2D1_FILL_MODE_ALTERNATE, 4, &expected_figures[24], 1);
4178 geometry_sink_cleanup(&simplify_sink);
4179
4181 scale_matrix(&matrix, 0.5f, 2.0f);
4182 translate_matrix(&matrix, 400.0f, -33.0f);
4183 rotate_matrix(&matrix, M_PI / 4.0f);
4184 scale_matrix(&matrix, 2.0f, 0.5f);
4185 hr = ID2D1Factory_CreateTransformedGeometry(factory, (ID2D1Geometry *)geometry, &matrix, &transformed_geometry);
4186 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
4187
4188 geometry_sink_init(&simplify_sink);
4189 hr = ID2D1TransformedGeometry_Simplify(transformed_geometry, D2D1_GEOMETRY_SIMPLIFICATION_OPTION_CUBICS_AND_LINES,
4190 NULL, 0.0f, &simplify_sink.ID2D1SimplifiedGeometrySink_iface);
4191 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
4192 geometry_sink_check(&simplify_sink, D2D1_FILL_MODE_ALTERNATE, 4, &expected_figures[16], 4);
4193 geometry_sink_cleanup(&simplify_sink);
4194
4195 ID2D1RenderTarget_BeginDraw(rt);
4196 ID2D1RenderTarget_Clear(rt, &color);
4197 ID2D1RenderTarget_FillGeometry(rt, (ID2D1Geometry *)geometry, (ID2D1Brush *)brush, NULL);
4198 ID2D1RenderTarget_FillGeometry(rt, (ID2D1Geometry *)transformed_geometry, (ID2D1Brush *)brush, NULL);
4199 hr = ID2D1RenderTarget_EndDraw(rt, NULL, NULL);
4200 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
4201 match = compare_figure(&ctx, 0, 0, 160, 160, 0xff652e89, 64,
4202 "7xoCngECngECngECngECngECngECngECnQEEnAEEnAEEnAEEnAEEmwEGmgEGmgEGmgEGmQEImAEI"
4203 "lAEECASLAQgKCIEBDQoMew8KD3YQDBByEgwSbhMOEmwUDhRpFBAUZxUQFWUVEhVjFhIWYRYUFl8X"
4204 "FBddFxYWXRYYFlsXGBdaFhoWWRYcFlgVHhVXFSAVVhQiFFUUIxRVEyYTVBIoElQRKhFUECwQUxAu"
4205 "EFIOMg5SDTQNUgs4C1IJPAlRCEAIUAZEBlAESARQAU4BTgJQAkgGUAY/C1ALMhNQEyoTUBMyC1AL"
4206 "PwZQBkgCUAJOAU4BUARIBFAGRAZQCEAIUQk8CVILOAtSDTQNUg4yDlIQLhBTECwQVBEqEVQSKBJU"
4207 "EyYTVBQjFFYUIhRWFSAVVxUeFVgWHBZZFhoWWhcYF1sWGBZcFxYWXhcUF18WFBZhFhIWYxUSFWUV"
4208 "EBVnFBAUaRQOFGsTDhJvEgwSchAMEHYPCg96DQoMggEICgiLAQQIBJQBCJgBCJkBBpoBBpoBBpoB"
4209 "BpsBBJwBBJwBBJwBBJwBBJ0BAp4BAp4BAp4BAp4BAp4BAp4BAp4BAgAA");
4210 ok(match, "Figure does not match.\n");
4211 match = compare_figure(&ctx, 0, 226, 160, 160, 0xff652e89, 64,
4212 "7xoCngECngECngECngECngECngECngECnQEEnAEEnAEEnAEEnAEEmwEGmgEGmgEGmgEGmQEImAEI"
4213 "lAEECASLAQgKCIEBDQoMew8KD3YQDBByEgwSbhMOEmwUDhRpFBAUZxUQFWUVEhVjFhIWYRYUFl8X"
4214 "FBddFxYWXRYYFlsXGBdaFhoWWRYcFlgVHhVXFSAVVhQiFFUUIxRVEyYTVBIoElQRKhFUECwQUxAu"
4215 "EFIOMg5SDTQNUgs4C1IJPAlRCEAIUAZEBlAESARQAU4BTgJQAkgGUAY/C1ALMhNQEyoTUBMyC1AL"
4216 "PwZQBkgCUAJOAU4BUARIBFAGRAZQCEAIUQk8CVILOAtSDTQNUg4yDlIQLhBTECwQVBEqEVQSKBJU"
4217 "EyYTVBQjFFYUIhRWFSAVVxUeFVgWHBZZFhoWWhcYF1sWGBZcFxYWXhcUF18WFBZhFhIWYxUSFWUV"
4218 "EBVnFBAUaRQOFGsTDhJvEgwSchAMEHYPCg96DQoMggEICgiLAQQIBJQBCJgBCJkBBpoBBpoBBpoB"
4219 "BpsBBJwBBJwBBJwBBJwBBJ0BAp4BAp4BAp4BAp4BAp4BAp4BAp4BAgAA");
4220 ok(match, "Figure does not match.\n");
4221 match = compare_figure(&ctx, 160, 0, 320, 160, 0xff652e89, 64,
4222 "gVQBwAIBWgHlAQFYAecBAVYB6QEBVAHrAQEjDCMB7AECHhQeAu0BAxoYGgPvAQMWHhYD8QEDFCAU"
4223 "A/MBBBAkEAT0AQUOJw0F9QEGCioKBvcBBggsCAb4AQgFLgUI+QEJATIBCfsBCAIwAgj8AQcFLAUH"
4224 "/QEFCCgIBf4BBAwiDAT/AQIQHBAClwISlwIBPgGAAgI8Av8BAzwD/QEEPAT7AQY6BvkBBzoH+AEI"
4225 "OAj3AQk4CfYBCTgK9AELNgvzAQw2DPIBDDYM8QEONA7wAQ40DvABDjQO7wEPNA/uAQ80D+4BEDIQ"
4226 "7QERMhHsAREyEewBETIR7AERMhHsAREyEewBETIR7AERMhHsAREyEewBETIR7AERMhHsAREyEewB"
4227 "ETIR7AERMhHsAREyEe0BEDIQ7gEQMw/uAQ80D+4BDzQP7wEONA7wAQ40DvEBDDYM8gEMNgzzAQs2"
4228 "C/QBCzcK9QEJOAn3AQg4CfcBBzoH+QEGOgb7AQU6BfwBBDwE/QEDPAP/AQE+AZkCDpkCAhIYEgKA"
4229 "AgMNIA0D/wEFCSYJBf4BBgYqBgf8AQgDLgMI+wFG+gEIAzADCPkBBwYuBgf3AQYKKgoG9gEFDCgM"
4230 "BfUBBBAlDwTzAQQSIhIE8QEDFh4WA/ABAhkaGQLvAQIcFhwC7QECIBAgAusBASgEKAHpAQFWAecB"
4231 "AVgB5QEBWgHAAgHhUgAA");
4232 ok(match, "Figure does not match.\n");
4233 match = compare_figure(&ctx, 160, 160, 320, 160, 0xff652e89, 64,
4234 "/VUB5QEBWAHnAQFWAekBAVQB6wECIQ8hAe0BAh0VHQLuAQIZGhkD7wEDFh4WA/EBBBMhEwPzAQQQ"
4235 "JQ8F9AEFDCgNBfUBBgoqCgb3AQcHLQcG+QEIBC8ECPkBPAEJ+wEIAy8CCP0BBgYrBQf9AQUJJgkF"
4236 "/wEDDSANBP8BAhEaEQKYAhAXAYACAT4BgAICPQL+AQM8BPwBBTsE+wEGOgb6AQc5B/gBCDgJ9gEJ"
4237 "OAn2AQo3CvQBCzcK8wEMNgzyAQ01DPIBDTUN8AEONA7wAQ40D+4BDzQP7gEQMw/uARAzEO0BEDIR"
4238 "7AERMhHsAREyEewBETIR7AERMhLrAREyEusBETIS6wERMhLrAREyEusBETIS6wERMhHsAREyEewB"
4239 "ETIR7QEQMhHtARAzEO0BEDMP7gEPNA/vAQ40D+8BDjQO8QENNQ3xAQ01DPMBCzYM8wELNwr1AQo3"
4240 "CvUBCTgJ9wEIOAn4AQc5B/kBBjoG+wEFOwT9AQM8BP4BAj0C/wEBPgGYAhAXAYACAhEaEQKAAgMN"
4241 "IA0E/gEFCSYJBf4BBgYrBQf8AQgDLwII+wE8AQn6AQgELwQI+AEHBy0HBvcBBgoqCgb2AQUNJw0F"
4242 "9AEEECQQBfIBBBMhEwPxAQMWHhYD8AECGRoZA+4BAh0VHQLsAQIhDiIB6wEBVAHpAQFWAecBAVgB"
4243 "wAIBwlYA");
4244 ok(match, "Figure does not match.\n");
4245 ID2D1TransformedGeometry_Release(transformed_geometry);
4246 ID2D1PathGeometry_Release(geometry);
4247
4248 hr = ID2D1Factory_CreatePathGeometry(factory, &geometry);
4249 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
4250 hr = ID2D1PathGeometry_Open(geometry, &sink);
4251 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
4253 ID2D1GeometrySink_SetFillMode(sink, D2D1_FILL_MODE_WINDING);
4254 hr = ID2D1GeometrySink_Close(sink);
4255 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
4256 hr = ID2D1PathGeometry_GetFigureCount(geometry, &count);
4257 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
4258 ok(count == 4, "Got unexpected figure count %u.\n", count);
4259 hr = ID2D1PathGeometry_GetSegmentCount(geometry, &count);
4260 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
4261 ok(count == 20, "Got unexpected segment count %u.\n", count);
4262 ID2D1GeometrySink_Release(sink);
4263
4264 geometry_sink_init(&simplify_sink);
4265 hr = ID2D1PathGeometry_Simplify(geometry, D2D1_GEOMETRY_SIMPLIFICATION_OPTION_CUBICS_AND_LINES,
4266 NULL, 0.0f, &simplify_sink.ID2D1SimplifiedGeometrySink_iface);
4267 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
4268 geometry_sink_check(&simplify_sink, D2D1_FILL_MODE_WINDING, 4, &expected_figures[12], 1);
4269 geometry_sink_cleanup(&simplify_sink);
4270 geometry_sink_init(&simplify_sink);
4271 hr = ID2D1PathGeometry_Simplify(geometry, D2D1_GEOMETRY_SIMPLIFICATION_OPTION_LINES,
4272 NULL, 100.0f, &simplify_sink.ID2D1SimplifiedGeometrySink_iface);
4273 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
4274 geometry_sink_check(&simplify_sink, D2D1_FILL_MODE_WINDING, 4, &expected_figures[20], 1);
4275 geometry_sink_cleanup(&simplify_sink);
4276 geometry_sink_init(&simplify_sink);
4277 hr = ID2D1PathGeometry_Simplify(geometry, D2D1_GEOMETRY_SIMPLIFICATION_OPTION_LINES,
4278 NULL, 10.0f, &simplify_sink.ID2D1SimplifiedGeometrySink_iface);
4279 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
4280 geometry_sink_check(&simplify_sink, D2D1_FILL_MODE_WINDING, 4, &expected_figures[24], 1);
4281 geometry_sink_cleanup(&simplify_sink);
4282
4284 scale_matrix(&matrix, 0.5f, 2.0f);
4285 translate_matrix(&matrix, 127.0f, 80.0f);
4286 rotate_matrix(&matrix, M_PI / -4.0f);
4287 scale_matrix(&matrix, 2.0f, 0.5f);
4288 hr = ID2D1Factory_CreateTransformedGeometry(factory, (ID2D1Geometry *)geometry, &matrix, &transformed_geometry);
4289 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
4290
4291 ID2D1RenderTarget_BeginDraw(rt);
4292 ID2D1RenderTarget_Clear(rt, &color);
4293 ID2D1RenderTarget_FillGeometry(rt, (ID2D1Geometry *)geometry, (ID2D1Brush *)brush, NULL);
4294 ID2D1RenderTarget_FillGeometry(rt, (ID2D1Geometry *)transformed_geometry, (ID2D1Brush *)brush, NULL);
4295 hr = ID2D1RenderTarget_EndDraw(rt, NULL, NULL);
4296 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
4297 match = compare_figure(&ctx, 0, 0, 160, 160, 0xff652e89, 64,
4298 "7xoCngECngECngECngECngECngECngECnQEEnAEEnAEEnAEEnAEEmwEGmgEGmgEGmgEGmQEImAEI"
4299 "lAEQiwEagQEjeyh2LHIwbjNsNmk4ZzplPGM+YUBfQl1DXURbRlpGWUhYSFdKVkpVS1VMVExUTFRM"
4300 "U05STlJOUk5STlFQUFBQUFBQTlRIXD9mMnYqdjJmP1xIVE5QUFBQUFBQUU5STlJOUk5STlNMVExU"
4301 "TFRMVEtWSlZKV0hYSFlGWkZbRFxDXkJfQGE+YzxlOmc4aTZrM28wcix2KHojggEaiwEQlAEImAEI"
4302 "mQEGmgEGmgEGmgEGmwEEnAEEnAEEnAEEnAEEnQECngECngECngECngECngECngECngEC");
4303 ok(match, "Figure does not match.\n");
4304 match = compare_figure(&ctx, 0, 226, 160, 160, 0xff652e89, 64,
4305 "7xoCngECngECngECngECngECngECngECnQEEnAEEnAEEnAEEnAEEmwEGmgEGmgEGmgEGmQEImAEI"
4306 "lAEQiwEagQEjeyh2LHIwbjNsNmk4ZzplPGM+YUBfQl1DXURbRlpGWUhYSFdKVkpVS1VMVExUTFRM"
4307 "U05STlJOUk5STlFQUFBQUFBQTlRIXD9mMnYqdjJmP1xIVE5QUFBQUFBQUU5STlJOUk5STlNMVExU"
4308 "TFRMVEtWSlZKV0hYSFlGWkZbRFxDXkJfQGE+YzxlOmc4aTZrM28wcix2KHojggEaiwEQlAEImAEI"
4309 "mQEGmgEGmgEGmgEGmwEEnAEEnAEEnAEEnAEEnQECngECngECngECngECngECngECngEC");
4310 ok(match, "Figure does not match.\n");
4311 match = compare_figure(&ctx, 160, 0, 320, 160, 0xff652e89, 64,
4312 "4VIBwAIBWgHlAQFYAecBAVYB6QEBVAHrAQIhDiIB7QECHRUdAu4BAhkaGQPvAQMWHhYD8QEEEyET"
4313 "A/MBBBAkEAT1AQUMKA0F9QEGCioKBvcBBwctBwb5AQgELwQI+QEJATIBCfsBRP0BQ/0BQv8BQf8B"
4314 "QIECP4ACQIACQf4BQ/wBRPsBRvoBR/gBSPcBSvYBS/QBTPMBTvIBTvIBT/ABUPABUe4BUu4BUu4B"
4315 "U+0BU+wBVOwBVOwBVOwBVOwBVesBVesBVesBVesBVOwBVOwBVOwBVO0BU+0BU+0BUu4BUu8BUe8B"
4316 "UPEBT/EBTvIBTvMBTPUBS/UBSvcBSfcBSPkBRvsBRP0BQ/4BQf8BQIECP4ACQIACQf4BQv4BQ/wB"
4317 "RPsBCQEyAQn6AQgELwQI+AEHBy0GB/cBBgoqCgb2AQUMKA0F9AEEECUPBPMBBBIiEwPxAQMWHhYD"
4318 "8AECGRoZA+4BAh0VHQLsAQIhDiIB6wEBVAHpAQFWAecBAVgB5QEBWgHAAgEA");
4319 ok(match, "Figure does not match.\n");
4320 match = compare_figure(&ctx, 160, 160, 320, 160, 0xff652e89, 64,
4321 "gVQBXAHjAQFaAeUBAVgB5wEBVgHpAQEpAikB6wECIBAgAu0BAhwWHALvAQIZGhkC8AEDFh4WA/EB"
4322 "BBIiEgTzAQQPJRAE9QEFDCgMBfYBBgoqCgb3AQcGLgYH+QEIAzADCPoBRvsBRPwBRP0BQv8BQIAC"
4323 "QIECPoECQP8BQv0BRPwBRPsBRvkBSPgBSPcBSvUBTPQBTPMBTvIBTvEBUPABUO8BUu4BUu4BUu4B"
4324 "Uu0BVOwBVOwBVOwBVOwBVOwBVOwBVOwBVOwBVOwBVOwBVOwBVOwBVOwBVO0BUu4BUu4BUu8BUPAB"
4325 "UPABUPEBTvIBTvMBTPQBS/YBSvcBSPgBSPkBRvsBRP0BQv8BQIACQIECPoECQP8BQv4BQv0BRPwB"
4326 "RPsBCQEyAQn5AQgFLgUI+AEGCCwIBvcBBgoqCgb1AQUNJw4F9AEEECQQBPMBAxQgFAPxAQMWHhYD"
4327 "7wEDGhgaA+0BAh4UHgLsAQEjDCMB6wEBVAHpAQFWAecBAVgB5QEBWgGiVQAA");
4328 ok(match, "Figure does not match.\n");
4329 ID2D1TransformedGeometry_Release(transformed_geometry);
4330 ID2D1PathGeometry_Release(geometry);
4331
4332 hr = ID2D1Factory_CreatePathGeometry(factory, &geometry);
4333 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
4334 hr = ID2D1PathGeometry_Open(geometry, &sink);
4335 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
4336
4337 set_point(&point, 40.0f, 20.0f);
4338 ID2D1GeometrySink_BeginFigure(sink, point, D2D1_FIGURE_BEGIN_FILLED);
4339 line_to(sink, 75.0f, 300.0f);
4340 line_to(sink, 5.0f, 300.0f);
4341 ID2D1GeometrySink_EndFigure(sink, D2D1_FIGURE_END_CLOSED);
4342
4343 set_point(&point, 40.0f, 290.0f);
4344 ID2D1GeometrySink_BeginFigure(sink, point, D2D1_FIGURE_BEGIN_FILLED);
4345 line_to(sink, 55.0f, 160.0f);
4346 line_to(sink, 25.0f, 160.0f);
4347 ID2D1GeometrySink_EndFigure(sink, D2D1_FIGURE_END_CLOSED);
4348
4349 hr = ID2D1GeometrySink_Close(sink);
4350 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
4351 hr = ID2D1PathGeometry_GetFigureCount(geometry, &count);
4352 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
4353 ok(count == 2, "Got unexpected figure count %u.\n", count);
4354 hr = ID2D1PathGeometry_GetSegmentCount(geometry, &count);
4355 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
4356 ok(count == 6, "Got unexpected segment count %u.\n", count);
4357 ID2D1GeometrySink_Release(sink);
4358
4359 ID2D1RenderTarget_BeginDraw(rt);
4360 ID2D1RenderTarget_Clear(rt, &color);
4361 ID2D1RenderTarget_FillGeometry(rt, (ID2D1Geometry *)geometry, (ID2D1Brush *)brush, NULL);
4362 hr = ID2D1RenderTarget_EndDraw(rt, NULL, NULL);
4363 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
4364 match = compare_surface(&ctx, "a875e68e0cb9c055927b1b50b879f90b24e38470");
4365 ok(match, "Surface does not match.\n");
4366 ID2D1PathGeometry_Release(geometry);
4367
4368 hr = ID2D1Factory_CreatePathGeometry(factory, &geometry);
4369 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
4370 hr = ID2D1PathGeometry_Open(geometry, &sink);
4371 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
4372 set_point(&point, 40.0f, 20.0f);
4373 ID2D1GeometrySink_BeginFigure(sink, point, D2D1_FIGURE_BEGIN_HOLLOW);
4374 line_to(sink, 75.0f, 300.0f);
4375 line_to(sink, 5.0f, 300.0f);
4376 ID2D1GeometrySink_EndFigure(sink, D2D1_FIGURE_END_OPEN);
4377 hr = ID2D1GeometrySink_Close(sink);
4378 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
4379 ID2D1GeometrySink_Release(sink);
4380 hr = ID2D1PathGeometry_GetSegmentCount(geometry, &count);
4381 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
4382 ok(count == 2, "Got unexpected segment count %u.\n", count);
4383
4384 geometry_sink_init(&simplify_sink);
4385 hr = ID2D1PathGeometry_Simplify(geometry, D2D1_GEOMETRY_SIMPLIFICATION_OPTION_LINES,
4386 NULL, 0.0f, &simplify_sink.ID2D1SimplifiedGeometrySink_iface);
4387 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
4388 geometry_sink_check(&simplify_sink, D2D1_FILL_MODE_ALTERNATE, 1, &expected_figures[28], 1);
4389 geometry_sink_cleanup(&simplify_sink);
4390
4391 ID2D1PathGeometry_Release(geometry);
4392
4393 hr = ID2D1Factory_CreatePathGeometry(factory, &geometry);
4394 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
4395 hr = ID2D1PathGeometry_Open(geometry, &sink);
4396 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
4397
4398 set_point(&point, 20.0f, 80.0f);
4399 ID2D1GeometrySink_BeginFigure(sink, point, D2D1_FIGURE_BEGIN_FILLED);
4400 line_to(sink, 40.0f, 100.0f);
4401 quadratic_to(sink, 40.0f, 65.0f, 20.0f, 80.0f);
4402 ID2D1GeometrySink_EndFigure(sink, D2D1_FIGURE_END_OPEN);
4403
4404 set_point(&point, 80.0f, 20.0f);
4405 ID2D1GeometrySink_BeginFigure(sink, point, D2D1_FIGURE_BEGIN_FILLED);
4406 line_to(sink, 60.0f, 40.0f);
4407 quadratic_to(sink, 95.0f, 40.0f, 80.0f, 20.0f);
4408 ID2D1GeometrySink_EndFigure(sink, D2D1_FIGURE_END_OPEN);
4409
4410 set_point(&point, 120.0f, 180.0f);
4411 ID2D1GeometrySink_BeginFigure(sink, point, D2D1_FIGURE_BEGIN_FILLED);
4412 line_to(sink, 140.0f, 160.0f);
4413 quadratic_to(sink, 105.0f, 160.0f, 120.0f, 180.0f);
4414 ID2D1GeometrySink_EndFigure(sink, D2D1_FIGURE_END_CLOSED);
4415
4416 set_point(&point, 180.0f, 120.0f);
4417 ID2D1GeometrySink_BeginFigure(sink, point, D2D1_FIGURE_BEGIN_FILLED);
4418 line_to(sink, 170.0f, 110.0f);
4419 quadratic_to(sink, 170.0f, 135.0f, 180.0f, 120.0f);
4420 ID2D1GeometrySink_EndFigure(sink, D2D1_FIGURE_END_CLOSED);
4421
4422 hr = ID2D1GeometrySink_Close(sink);
4423 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
4424 ID2D1GeometrySink_Release(sink);
4425
4426 set_rect(&rect, 0.0f, 0.0f, 0.0f, 0.0f);
4427 hr = ID2D1PathGeometry_GetBounds(geometry, NULL, &rect);
4428 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
4429 match = compare_rect(&rect, 20.0f, 20.0f, 180.0f, 180.0f, 0);
4430 ok(match, "Got unexpected rectangle {%.8e, %.8e, %.8e, %.8e}.\n",
4432
4433 geometry_sink_init(&simplify_sink);
4434 hr = ID2D1PathGeometry_Simplify(geometry, D2D1_GEOMETRY_SIMPLIFICATION_OPTION_CUBICS_AND_LINES,
4435 NULL, 0.0f, &simplify_sink.ID2D1SimplifiedGeometrySink_iface);
4436 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
4437 geometry_sink_check(&simplify_sink, D2D1_FILL_MODE_ALTERNATE, 4, &expected_figures[29], 1);
4438 geometry_sink_cleanup(&simplify_sink);
4439
4440 ID2D1PathGeometry_Release(geometry);
4441
4442 ID2D1SolidColorBrush_Release(brush);
4444}
static void geometry_sink_init(struct geometry_sink *sink)
Definition: d2d1.c:1564
static void geometry_sink_cleanup(struct geometry_sink *sink)
Definition: d2d1.c:1573
static void fill_geometry_sink_bezier(ID2D1GeometrySink *sink, unsigned int hollow_count)
Definition: d2d1.c:3252
static void fill_geometry_sink(ID2D1GeometrySink *sink, unsigned int hollow_count)
Definition: d2d1.c:3180
#define geometry_sink_check(a, b, c, d, e)
Definition: d2d1.c:1584
@ D2D1_FILL_MODE_WINDING
Definition: d2d1.idl:86
@ D2D1_GEOMETRY_SIMPLIFICATION_OPTION_LINES
Definition: d2d1.idl:154
@ D2D1_GEOMETRY_SIMPLIFICATION_OPTION_CUBICS_AND_LINES
Definition: d2d1.idl:153
@ D2D1_PATH_SEGMENT_FORCE_ROUND_LINE_JOIN
Definition: d2d1.idl:94
#define FLT_MAX
Definition: float.h:37
#define INFINITY
Definition: math.h:272

Referenced by START_TEST().

◆ test_radial_brush()

static void test_radial_brush ( BOOL  d3d11)
static

Definition at line 2983 of file d2d1.c.

2984{
2985 D2D1_RADIAL_GRADIENT_BRUSH_PROPERTIES gradient_properties;
2986 ID2D1GradientStopCollection *gradient, *tmp_gradient;
2987 ID2D1TransformedGeometry *transformed_geometry;
2988 ID2D1RectangleGeometry *rectangle_geometry;
2989 D2D1_MATRIX_3X2_F matrix, tmp_matrix;
2991 struct d2d1_test_context ctx;
2992 struct resource_readback rb;
2997 unsigned int i;
2998 ULONG refcount;
2999 D2D1_RECT_F r;
3000 HRESULT hr;
3001 float f;
3002
3003 static const D2D1_GRADIENT_STOP stops[] =
3004 {
3005 {0.0f, {1.0f, 0.0f, 0.0f, 1.0f}},
3006 {0.5f, {0.0f, 1.0f, 0.0f, 1.0f}},
3007 {1.0f, {0.0f, 0.0f, 1.0f, 1.0f}},
3008 };
3009 static const struct
3010 {
3011 unsigned int x, y;
3012 DWORD colour;
3013 }
3014 test1[] =
3015 {
3016 {80, 80, 0xff0000ff}, {240, 80, 0xff00a857}, {400, 80, 0xff00d728}, {560, 80, 0xff0000ff},
3017 {80, 240, 0xff006699}, {240, 240, 0xff29d600}, {400, 240, 0xff966900}, {560, 240, 0xff00a55a},
3018 {80, 400, 0xff0000ff}, {240, 400, 0xff006e91}, {400, 400, 0xff007d82}, {560, 400, 0xff0000ff},
3019 },
3020 test2[] =
3021 {
3022 { 40, 30, 0xff000df2}, {120, 30, 0xffffffff}, { 40, 60, 0xffffffff}, { 80, 60, 0xff00b04f},
3023 {120, 60, 0xff007689}, {200, 60, 0xffffffff}, { 40, 90, 0xffffffff}, {120, 90, 0xff47b800},
3024 {160, 90, 0xff00c13e}, {200, 90, 0xffffffff}, { 80, 120, 0xffffffff}, {120, 120, 0xff0000ff},
3025 {160, 120, 0xff6f9000}, {200, 120, 0xff00718e}, {240, 120, 0xffffffff}, {160, 150, 0xffffffff},
3026 {200, 150, 0xff00609f}, {240, 150, 0xffffffff}, {280, 150, 0xffffffff}, {320, 150, 0xffffffff},
3027 {240, 180, 0xffffffff}, {280, 180, 0xff4040ff}, {320, 180, 0xff40b788}, {380, 180, 0xffffffff},
3028 {200, 210, 0xffffffff}, {240, 210, 0xff4040ff}, {280, 210, 0xff4040ff}, {320, 210, 0xff76c940},
3029 {360, 210, 0xff40cc73}, {400, 210, 0xffffffff}, {200, 240, 0xffffffff}, {280, 240, 0xff4061de},
3030 {320, 240, 0xff9fa040}, {360, 240, 0xff404af5}, {440, 240, 0xffffffff}, {240, 270, 0xffffffff},
3031 {280, 270, 0xff40aa95}, {320, 270, 0xff4ef140}, {360, 270, 0xff4040ff}, {440, 270, 0xffffffff},
3032 {280, 300, 0xffffffff}, {320, 300, 0xff4093ac}, {360, 300, 0xff4040ff}, {400, 300, 0xff4040ff},
3033 {440, 300, 0xff404af5}, {480, 300, 0xff4045fa}, {520, 300, 0xff4040ff}, {280, 330, 0xffffffff},
3034 {360, 330, 0xffffffff}, {400, 330, 0xff4069d6}, {440, 330, 0xff40c579}, {480, 330, 0xff40e956},
3035 {520, 330, 0xff4072cd}, {400, 360, 0xff408ab4}, {440, 360, 0xff49f540}, {480, 360, 0xffb98640},
3036 {520, 360, 0xff40dc62}, {400, 390, 0xff405ee1}, {440, 390, 0xff40d56a}, {480, 390, 0xff62dd40},
3037 {520, 390, 0xff4059e6},
3038 };
3039
3040 if (!init_test_context(&ctx, d3d11))
3041 return;
3042
3043 rt = ctx.rt;
3044 ID2D1RenderTarget_SetDpi(rt, 192.0f, 48.0f);
3045 ID2D1RenderTarget_SetAntialiasMode(rt, D2D1_ANTIALIAS_MODE_ALIASED);
3046
3047 hr = ID2D1RenderTarget_CreateGradientStopCollection(rt, stops, ARRAY_SIZE(stops),
3049 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
3050
3051 set_point(&gradient_properties.center, 160.0f, 480.0f);
3052 set_point(&gradient_properties.gradientOriginOffset, 40.0f, -120.0f);
3053 gradient_properties.radiusX = 160.0f;
3054 gradient_properties.radiusY = 480.0f;
3055 hr = ID2D1RenderTarget_CreateRadialGradientBrush(rt, &gradient_properties, NULL, gradient, &brush);
3056 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
3057
3058 f = ID2D1RadialGradientBrush_GetOpacity(brush);
3059 ok(f == 1.0f, "Got unexpected opacity %.8e.\n", f);
3061 ID2D1RadialGradientBrush_GetTransform(brush, &tmp_matrix);
3062 ok(!memcmp(&tmp_matrix, &matrix, sizeof(matrix)),
3063 "Got unexpected matrix {%.8e, %.8e, %.8e, %.8e, %.8e, %.8e}.\n",
3064 tmp_matrix._11, tmp_matrix._12, tmp_matrix._21,
3065 tmp_matrix._22, tmp_matrix._31, tmp_matrix._32);
3066 p = ID2D1RadialGradientBrush_GetCenter(brush);
3067 ok(compare_point(&p, 160.0f, 480.0f, 0), "Got unexpected center {%.8e, %.8e}.\n", p.x, p.y);
3068 p = ID2D1RadialGradientBrush_GetGradientOriginOffset(brush);
3069 ok(compare_point(&p, 40.0f, -120.0f, 0), "Got unexpected origin offset {%.8e, %.8e}.\n", p.x, p.y);
3070 f = ID2D1RadialGradientBrush_GetRadiusX(brush);
3071 ok(compare_float(f, 160.0f, 0), "Got unexpected x-radius %.8e.\n", f);
3072 f = ID2D1RadialGradientBrush_GetRadiusY(brush);
3073 ok(compare_float(f, 480.0f, 0), "Got unexpected y-radius %.8e.\n", f);
3074 ID2D1RadialGradientBrush_GetGradientStopCollection(brush, &tmp_gradient);
3075 ok(tmp_gradient == gradient, "Got unexpected gradient %p, expected %p.\n", tmp_gradient, gradient);
3076 ID2D1GradientStopCollection_Release(tmp_gradient);
3077
3078 ID2D1RenderTarget_BeginDraw(rt);
3079
3080 set_color(&colour, 1.0f, 1.0f, 1.0f, 1.0f);
3081 ID2D1RenderTarget_Clear(rt, &colour);
3082
3083 set_rect(&r, 0.0f, 0.0f, 320.0f, 960.0f);
3084 ID2D1RenderTarget_FillRectangle(rt, &r, (ID2D1Brush *)brush);
3085
3086 hr = ID2D1RenderTarget_EndDraw(rt, NULL, NULL);
3087 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
3088
3090 for (i = 0; i < ARRAY_SIZE(test1); ++i)
3091 {
3092 DWORD colour;
3093
3096 "Got unexpected colour 0x%08lx at position {%u, %u}.\n",
3097 colour, test1[i].x, test1[i].y);
3098 }
3100
3101 ID2D1RenderTarget_BeginDraw(rt);
3102
3103 ID2D1RenderTarget_Clear(rt, &colour);
3104
3106 skew_matrix(&matrix, 0.2146f, 1.575f);
3107 ID2D1RenderTarget_SetTransform(rt, &matrix);
3108
3110 translate_matrix(&matrix, 0.0f, 240.0f);
3111 scale_matrix(&matrix, 0.25f, -0.25f);
3112 ID2D1RadialGradientBrush_SetTransform(brush, &matrix);
3113
3114 set_rect(&r, 0.0f, 0.0f, 80.0f, 240.0f);
3115 ID2D1RenderTarget_FillRectangle(rt, &r, (ID2D1Brush *)brush);
3116
3118 scale_matrix(&matrix, 0.5f, 2.0f);
3119 translate_matrix(&matrix, 320.0f, 240.0f);
3120 rotate_matrix(&matrix, M_PI / 4.0f);
3121 ID2D1RenderTarget_SetTransform(rt, &matrix);
3122
3124 translate_matrix(&matrix, -75.0f, -50.0f);
3125 scale_matrix(&matrix, 0.15f, 0.5f);
3126 rotate_matrix(&matrix, -M_PI / 3.0f);
3127 ID2D1RadialGradientBrush_SetTransform(brush, &matrix);
3128
3129 ID2D1RadialGradientBrush_SetOpacity(brush, 0.75f);
3130 set_rect(&r, -80.0f, -60.0f, 80.0f, 60.0f);
3131 ID2D1RenderTarget_FillRectangle(rt, &r, (ID2D1Brush *)brush);
3132
3133 factory = ctx.factory;
3134
3135 set_rect(&r, -1.0f, -1.0f, 1.0f, 1.0f);
3136 hr = ID2D1Factory_CreateRectangleGeometry(factory, &r, &rectangle_geometry);
3137 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
3138
3140 translate_matrix(&matrix, 228.5f, 714.0f);
3141 scale_matrix(&matrix, 40.0f, 120.0f);
3142 hr = ID2D1Factory_CreateTransformedGeometry(factory, (ID2D1Geometry *)rectangle_geometry,
3143 &matrix, &transformed_geometry);
3144 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
3145 ID2D1RectangleGeometry_Release(rectangle_geometry);
3146
3148 ID2D1RenderTarget_SetTransform(rt, &matrix);
3149 ID2D1RadialGradientBrush_SetTransform(brush, &matrix);
3150 set_point(&p, 228.5f, 714.0f);
3151 ID2D1RadialGradientBrush_SetCenter(brush, p);
3152 ID2D1RadialGradientBrush_SetRadiusX(brush, -40.0f);
3153 ID2D1RadialGradientBrush_SetRadiusY(brush, 120.0f);
3154 set_point(&p, 20.0f, 30.0f);
3155 ID2D1RadialGradientBrush_SetGradientOriginOffset(brush, p);
3156 ID2D1RenderTarget_FillGeometry(rt, (ID2D1Geometry *)transformed_geometry, (ID2D1Brush *)brush, NULL);
3157 ID2D1TransformedGeometry_Release(transformed_geometry);
3158
3159 hr = ID2D1RenderTarget_EndDraw(rt, NULL, NULL);
3160 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
3161
3163 for (i = 0; i < ARRAY_SIZE(test2); ++i)
3164 {
3165 DWORD colour;
3166
3169 "Got unexpected colour 0x%08lx at position {%u, %u}.\n",
3170 colour, test2[i].x, test2[i].y);
3171 }
3173
3174 ID2D1RadialGradientBrush_Release(brush);
3175 refcount = ID2D1GradientStopCollection_Release(gradient);
3176 ok(!refcount, "Gradient has %lu references left.\n", refcount);
3178}

Referenced by START_TEST().

◆ test_rectangle_geometry()

static void test_rectangle_geometry ( BOOL  d3d11)
static

Definition at line 4446 of file d2d1.c.

4447{
4448 ID2D1TransformedGeometry *transformed_geometry;
4449 ID2D1RectangleGeometry *geometry;
4450 struct d2d1_test_context ctx;
4451 struct geometry_sink sink;
4455 BOOL contains;
4456 HRESULT hr;
4457 BOOL match;
4458
4459 static const struct geometry_segment expected_segments[] =
4460 {
4461 /* Figure 0. */
4462 {SEGMENT_LINE, {{{10.0f, 0.0f}}}},
4463 {SEGMENT_LINE, {{{10.0f, 20.0f}}}},
4464 {SEGMENT_LINE, {{{ 0.0f, 20.0f}}}},
4465 /* Figure 1. */
4466 {SEGMENT_LINE, {{{4.42705116e+01f, 1.82442951e+01f}}}},
4467 {SEGMENT_LINE, {{{7.95376282e+01f, 5.06049728e+01f}}}},
4468 {SEGMENT_LINE, {{{5.52671127e+01f, 6.23606796e+01f}}}},
4469 /* Figure 2. */
4470 {SEGMENT_LINE, {{{25.0f, 15.0f}}}},
4471 {SEGMENT_LINE, {{{25.0f, 55.0f}}}},
4472 {SEGMENT_LINE, {{{25.0f, 55.0f}}}},
4473 /* Figure 3. */
4474 {SEGMENT_LINE, {{{35.0f, 45.0f}}}},
4475 {SEGMENT_LINE, {{{35.0f, 45.0f}}}},
4476 {SEGMENT_LINE, {{{30.0f, 45.0f}}}},
4477 /* Figure 4. */
4478 {SEGMENT_LINE, {{{ 1.07179585e+01f, 2.23205078e+02f}}}},
4479 {SEGMENT_LINE, {{{-5.85640755e+01f, 2.73205078e+02f}}}},
4480 {SEGMENT_LINE, {{{-7.85640717e+01f, 2.29903809e+02f}}}},
4481 /* Figure 5. */
4482 {SEGMENT_LINE, {{{40.0f, 20.0f}}}},
4483 {SEGMENT_LINE, {{{40.0f, 40.0f}}}},
4484 {SEGMENT_LINE, {{{30.0f, 40.0f}}}},
4485 /* Figure 6. */
4486 {SEGMENT_LINE, {{{ 2.14359169e+01f, 0.0f}}}},
4487 {SEGMENT_LINE, {{{-1.17128151e+02f, 0.0f}}}},
4488 {SEGMENT_LINE, {{{-1.57128143e+02f, 0.0f}}}},
4489 /* Figure 7. */
4490 {SEGMENT_LINE, {{{0.0f, 1.11602539e+02f}}}},
4491 {SEGMENT_LINE, {{{0.0f, 1.36602539e+02f}}}},
4492 {SEGMENT_LINE, {{{0.0f, 1.14951904e+02f}}}},
4493 };
4494 static const struct expected_geometry_figure expected_figures[] =
4495 {
4496 {D2D1_FIGURE_BEGIN_FILLED, D2D1_FIGURE_END_CLOSED, { 0.0f, 0.0f}, 3, &expected_segments[0]},
4497 {D2D1_FIGURE_BEGIN_FILLED, D2D1_FIGURE_END_CLOSED, {20.0f, 30.0f}, 3, &expected_segments[3]},
4498 {D2D1_FIGURE_BEGIN_FILLED, D2D1_FIGURE_END_CLOSED, {25.0f, 15.0f}, 3, &expected_segments[6]},
4499 {D2D1_FIGURE_BEGIN_FILLED, D2D1_FIGURE_END_CLOSED, {30.0f, 45.0f}, 3, &expected_segments[9]},
4500 {D2D1_FIGURE_BEGIN_FILLED, D2D1_FIGURE_END_CLOSED, {-9.28203964e+00f, 1.79903809e+02f},
4501 3, &expected_segments[12]},
4502 {D2D1_FIGURE_BEGIN_FILLED, D2D1_FIGURE_END_CLOSED, {30.0f, 20.0f}, 3, &expected_segments[15]},
4503 {D2D1_FIGURE_BEGIN_FILLED, D2D1_FIGURE_END_CLOSED, {-1.85640793e+01f, 0.0f}, 3, &expected_segments[18]},
4504 {D2D1_FIGURE_BEGIN_FILLED, D2D1_FIGURE_END_CLOSED, {0.0f, 8.99519043e+01f}, 3, &expected_segments[21]},
4505 };
4506
4507 if (!init_test_context(&ctx, d3d11))
4508 return;
4509
4510 set_rect(&rect, 0.0f, 0.0f, 0.0f, 0.0f);
4511 hr = ID2D1Factory_CreateRectangleGeometry(ctx.factory, &rect, &geometry);
4512 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
4513 ID2D1RectangleGeometry_GetRect(geometry, &rect2);
4514 match = compare_rect(&rect2, 0.0f, 0.0f, 0.0f, 0.0f, 0);
4515 ok(match, "Got unexpected rectangle {%.8e, %.8e, %.8e, %.8e}.\n",
4517 ID2D1RectangleGeometry_Release(geometry);
4518
4519 set_rect(&rect, 50.0f, 0.0f, 40.0f, 100.0f);
4520 hr = ID2D1Factory_CreateRectangleGeometry(ctx.factory, &rect, &geometry);
4521 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
4522 ID2D1RectangleGeometry_GetRect(geometry, &rect2);
4523 match = compare_rect(&rect2, 50.0f, 0.0f, 40.0f, 100.0f, 0);
4524 ok(match, "Got unexpected rectangle {%.8e, %.8e, %.8e, %.8e}.\n",
4526 ID2D1RectangleGeometry_Release(geometry);
4527
4528 set_rect(&rect, 0.0f, 100.0f, 40.0f, 50.0f);
4529 hr = ID2D1Factory_CreateRectangleGeometry(ctx.factory, &rect, &geometry);
4530 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
4531 ID2D1RectangleGeometry_GetRect(geometry, &rect2);
4532 match = compare_rect(&rect2, 0.0f, 100.0f, 40.0f, 50.0f, 0);
4533 ok(match, "Got unexpected rectangle {%.8e, %.8e, %.8e, %.8e}.\n",
4535 ID2D1RectangleGeometry_Release(geometry);
4536
4537 set_rect(&rect, 50.0f, 100.0f, 40.0f, 50.0f);
4538 hr = ID2D1Factory_CreateRectangleGeometry(ctx.factory, &rect, &geometry);
4539 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
4540 ID2D1RectangleGeometry_GetRect(geometry, &rect2);
4541 match = compare_rect(&rect2, 50.0f, 100.0f, 40.0f, 50.0f, 0);
4542 ok(match, "Got unexpected rectangle {%.8e, %.8e, %.8e, %.8e}.\n",
4544 ID2D1RectangleGeometry_Release(geometry);
4545
4546 set_rect(&rect, 0.0f, 0.0f, 10.0f, 20.0f);
4547 hr = ID2D1Factory_CreateRectangleGeometry(ctx.factory, &rect, &geometry);
4548 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
4549
4550 /* Edge. */
4551 contains = FALSE;
4552 set_point(&point, 0.0f, 0.0f);
4553 hr = ID2D1RectangleGeometry_FillContainsPoint(geometry, point, NULL, 0.0f, &contains);
4554 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
4555 ok(!!contains, "Got wrong hit test result %d.\n", contains);
4556
4557 /* Within tolerance limit around corner. */
4558 contains = TRUE;
4559 set_point(&point, -D2D1_DEFAULT_FLATTENING_TOLERANCE, 0.0f);
4560 hr = ID2D1RectangleGeometry_FillContainsPoint(geometry, point, NULL, 0.0f, &contains);
4561 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
4562 ok(!contains, "Got wrong hit test result %d.\n", contains);
4563
4564 contains = FALSE;
4565 set_point(&point, -D2D1_DEFAULT_FLATTENING_TOLERANCE + 0.01f, 0.0f);
4566 hr = ID2D1RectangleGeometry_FillContainsPoint(geometry, point, NULL, 0.0f, &contains);
4567 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
4568 ok(!!contains, "Got wrong hit test result %d.\n", contains);
4569
4570 contains = TRUE;
4571 set_point(&point, -D2D1_DEFAULT_FLATTENING_TOLERANCE - 0.01f, 0.0f);
4572 hr = ID2D1RectangleGeometry_FillContainsPoint(geometry, point, NULL, 0.0f, &contains);
4573 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
4574 ok(!contains, "Got wrong hit test result %d.\n", contains);
4575
4576 contains = TRUE;
4577 set_point(&point, -D2D1_DEFAULT_FLATTENING_TOLERANCE, -D2D1_DEFAULT_FLATTENING_TOLERANCE);
4578 hr = ID2D1RectangleGeometry_FillContainsPoint(geometry, point, NULL, 0.0f, &contains);
4579 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
4580 ok(!contains, "Got wrong hit test result %d.\n", contains);
4581
4582 /* Inside. */
4583 contains = FALSE;
4584 set_point(&point, 5.0f, 5.0f);
4585 hr = ID2D1RectangleGeometry_FillContainsPoint(geometry, point, NULL, 0.0f, &contains);
4586 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
4587 ok(!!contains, "Got wrong hit test result %d.\n", contains);
4588
4589 /* Test GetBounds() and Simplify(). */
4590 hr = ID2D1RectangleGeometry_GetBounds(geometry, NULL, &rect);
4591 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
4592 match = compare_rect(&rect, 0.0f, 0.0f, 10.0f, 20.0f, 0);
4593 ok(match, "Got unexpected bounds {%.8e, %.8e, %.8e, %.8e}.\n",
4596 hr = ID2D1RectangleGeometry_Simplify(geometry, D2D1_GEOMETRY_SIMPLIFICATION_OPTION_CUBICS_AND_LINES,
4597 NULL, 0.0f, &sink.ID2D1SimplifiedGeometrySink_iface);
4598 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
4599 geometry_sink_check(&sink, D2D1_FILL_MODE_ALTERNATE, 1, &expected_figures[0], 0);
4602 hr = ID2D1RectangleGeometry_Simplify(geometry, D2D1_GEOMETRY_SIMPLIFICATION_OPTION_LINES,
4603 NULL, 0.0f, &sink.ID2D1SimplifiedGeometrySink_iface);
4604 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
4605 geometry_sink_check(&sink, D2D1_FILL_MODE_ALTERNATE, 1, &expected_figures[0], 0);
4607
4609 translate_matrix(&matrix, 20.0f, 30.0f);
4610 scale_matrix(&matrix, 3.0f, 2.0f);
4611 rotate_matrix(&matrix, M_PI / -5.0f);
4612 hr = ID2D1RectangleGeometry_GetBounds(geometry, &matrix, &rect);
4613 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
4614 match = compare_rect(&rect, 2.00000000e+01f, 1.82442951e+01f, 7.95376282e+01f, 6.23606796e+01f, 0);
4615 ok(match, "Got unexpected bounds {%.8e, %.8e, %.8e, %.8e}.\n",
4618 hr = ID2D1RectangleGeometry_Simplify(geometry, D2D1_GEOMETRY_SIMPLIFICATION_OPTION_CUBICS_AND_LINES,
4619 &matrix, 0.0f, &sink.ID2D1SimplifiedGeometrySink_iface);
4620 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
4621 geometry_sink_check(&sink, D2D1_FILL_MODE_ALTERNATE, 1, &expected_figures[1], 1);
4623
4625 translate_matrix(&matrix, 25.0f, 15.0f);
4626 scale_matrix(&matrix, 0.0f, 2.0f);
4627 hr = ID2D1RectangleGeometry_GetBounds(geometry, &matrix, &rect);
4628 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
4629 match = compare_rect(&rect, 25.0f, 15.0f, 25.0f, 55.0f, 0);
4630 ok(match, "Got unexpected bounds {%.8e, %.8e, %.8e, %.8e}.\n",
4633 hr = ID2D1RectangleGeometry_Simplify(geometry, D2D1_GEOMETRY_SIMPLIFICATION_OPTION_LINES,
4634 &matrix, 0.0f, &sink.ID2D1SimplifiedGeometrySink_iface);
4635 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
4636 geometry_sink_check(&sink, D2D1_FILL_MODE_ALTERNATE, 1, &expected_figures[2], 0);
4638
4640 translate_matrix(&matrix, 30.0f, 45.0f);
4641 scale_matrix(&matrix, 0.5f, 0.0f);
4642 hr = ID2D1RectangleGeometry_GetBounds(geometry, &matrix, &rect);
4643 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
4644 match = compare_rect(&rect, 30.0f, 45.0f, 35.0f, 45.0f, 0);
4645 ok(match, "Got unexpected bounds {%.8e, %.8e, %.8e, %.8e}.\n",
4648 hr = ID2D1RectangleGeometry_Simplify(geometry, D2D1_GEOMETRY_SIMPLIFICATION_OPTION_LINES,
4649 &matrix, 0.0f, &sink.ID2D1SimplifiedGeometrySink_iface);
4650 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
4651 geometry_sink_check(&sink, D2D1_FILL_MODE_ALTERNATE, 1, &expected_figures[3], 0);
4653
4655 scale_matrix(&matrix, 4.0f, 5.0f);
4656 rotate_matrix(&matrix, M_PI / 3.0f);
4657 translate_matrix(&matrix, 30.0f, 20.0f);
4658 hr = ID2D1Factory_CreateTransformedGeometry(ctx.factory, (ID2D1Geometry *)geometry, &matrix, &transformed_geometry);
4659 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
4660
4661 hr = ID2D1TransformedGeometry_GetBounds(transformed_geometry, NULL, &rect);
4662 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
4663 match = compare_rect(&rect, -7.85640717e+01f, 1.79903809e+02f, 1.07179594e+01f, 2.73205078e+02f, 1);
4664 ok(match, "Got unexpected bounds {%.8e, %.8e, %.8e, %.8e}.\n",
4667 hr = ID2D1TransformedGeometry_Simplify(transformed_geometry, D2D1_GEOMETRY_SIMPLIFICATION_OPTION_CUBICS_AND_LINES,
4668 NULL, 0.0f, &sink.ID2D1SimplifiedGeometrySink_iface);
4669 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
4670 geometry_sink_check(&sink, D2D1_FILL_MODE_ALTERNATE, 1, &expected_figures[4], 1);
4673 hr = ID2D1TransformedGeometry_Simplify(transformed_geometry, D2D1_GEOMETRY_SIMPLIFICATION_OPTION_LINES,
4674 NULL, 0.0f, &sink.ID2D1SimplifiedGeometrySink_iface);
4675 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
4676 geometry_sink_check(&sink, D2D1_FILL_MODE_ALTERNATE, 1, &expected_figures[4], 1);
4678
4680 rotate_matrix(&matrix, M_PI / -3.0f);
4681 scale_matrix(&matrix, 0.25f, 0.2f);
4682 hr = ID2D1TransformedGeometry_GetBounds(transformed_geometry, &matrix, &rect);
4683 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
4684 match = compare_rect(&rect, 30.0f, 20.0f, 40.0f, 40.0f, 2);
4685 ok(match, "Got unexpected bounds {%.8e, %.8e, %.8e, %.8e}.\n",
4688 hr = ID2D1TransformedGeometry_Simplify(transformed_geometry, D2D1_GEOMETRY_SIMPLIFICATION_OPTION_LINES,
4689 &matrix, 0.0f, &sink.ID2D1SimplifiedGeometrySink_iface);
4690 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
4691 geometry_sink_check(&sink, D2D1_FILL_MODE_ALTERNATE, 1, &expected_figures[5], 4);
4693
4695 scale_matrix(&matrix, 2.0f, 0.0f);
4696 hr = ID2D1TransformedGeometry_GetBounds(transformed_geometry, &matrix, &rect);
4697 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
4698 match = compare_rect(&rect, -1.57128143e+02f, 0.00000000e+00f, 2.14359188e+01f, 0.00000000e+00f, 1);
4699 ok(match, "Got unexpected bounds {%.8e, %.8e, %.8e, %.8e}.\n",
4702 hr = ID2D1TransformedGeometry_Simplify(transformed_geometry, D2D1_GEOMETRY_SIMPLIFICATION_OPTION_CUBICS_AND_LINES,
4703 &matrix, 0.0f, &sink.ID2D1SimplifiedGeometrySink_iface);
4704 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
4705 geometry_sink_check(&sink, D2D1_FILL_MODE_ALTERNATE, 1, &expected_figures[6], 1);
4707
4709 scale_matrix(&matrix, 0.0f, 0.5f);
4710 hr = ID2D1TransformedGeometry_GetBounds(transformed_geometry, &matrix, &rect);
4711 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
4712 match = compare_rect(&rect, 0.00000000e+00f, 8.99519043e+01f, 0.00000000e+00, 1.36602539e+02f, 1);
4713 ok(match, "Got unexpected bounds {%.8e, %.8e, %.8e, %.8e}.\n",
4716 hr = ID2D1TransformedGeometry_Simplify(transformed_geometry, D2D1_GEOMETRY_SIMPLIFICATION_OPTION_CUBICS_AND_LINES,
4717 &matrix, 0.0f, &sink.ID2D1SimplifiedGeometrySink_iface);
4718 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
4719 geometry_sink_check(&sink, D2D1_FILL_MODE_ALTERNATE, 1, &expected_figures[7], 1);
4721
4722 ID2D1TransformedGeometry_Release(transformed_geometry);
4723 ID2D1RectangleGeometry_Release(geometry);
4724
4726}

Referenced by START_TEST().

◆ test_registered_effects()

static void test_registered_effects ( BOOL  d3d11)
static

Definition at line 12765 of file d2d1.c.

12766{
12767 UINT32 ret, count, count2, count3;
12768 struct d2d1_test_context ctx;
12770 CLSID *effects;
12771 HRESULT hr;
12772
12773 if (!init_test_context(&ctx, d3d11))
12774 return;
12775
12776 factory = ctx.factory1;
12777
12778 count = 0;
12779 hr = ID2D1Factory1_GetRegisteredEffects(factory, NULL, 0, NULL, &count);
12780 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
12781 ok(count > 0, "Unexpected effect count %u.\n", count);
12782
12783 hr = ID2D1Factory1_RegisterEffectFromString(factory, &CLSID_TestEffect, effect_xml_a,
12785 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
12786
12787 count2 = 0;
12788 hr = ID2D1Factory1_GetRegisteredEffects(factory, NULL, 0, NULL, &count2);
12789 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
12790 ok(count2 == count + 1, "Unexpected effect count %u.\n", count2);
12791
12792 effects = calloc(count2, sizeof(*effects));
12793
12794 count3 = 0;
12795 hr = ID2D1Factory1_GetRegisteredEffects(factory, effects, 0, NULL, &count3);
12796 ok(hr == D2DERR_INSUFFICIENT_BUFFER, "Unexpected hr %#lx.\n", hr);
12797 ok(count2 == count3, "Unexpected effect count %u.\n", count3);
12798
12799 ret = 999;
12800 hr = ID2D1Factory1_GetRegisteredEffects(factory, effects, 0, &ret, NULL);
12801 ok(hr == D2DERR_INSUFFICIENT_BUFFER, "Unexpected hr %#lx.\n", hr);
12802 ok(!ret, "Unexpected count %u.\n", ret);
12803
12804 ret = 0;
12805 hr = ID2D1Factory1_GetRegisteredEffects(factory, effects, 1, &ret, NULL);
12806 ok(hr == D2DERR_INSUFFICIENT_BUFFER, "Unexpected hr %#lx.\n", hr);
12807 ok(ret == 1, "Unexpected count %u.\n", ret);
12808 ok(!IsEqualGUID(effects, &CLSID_TestEffect), "Unexpected clsid.\n");
12809
12810 ret = 0;
12811 hr = ID2D1Factory1_GetRegisteredEffects(factory, effects, count2, &ret, NULL);
12812 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
12813 ok(ret == count2, "Unexpected count %u.\n", ret);
12814 ok(IsEqualGUID(&effects[ret - 1], &CLSID_TestEffect), "Unexpected clsid.\n");
12815
12816 free(effects);
12817
12818 hr = ID2D1Factory1_UnregisterEffect(factory, &CLSID_TestEffect);
12819 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
12820
12821 count2 = 0;
12822 hr = ID2D1Factory1_GetRegisteredEffects(factory, NULL, 0, NULL, &count2);
12823 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
12824 ok(count2 == count, "Unexpected effect count %u.\n", count2);
12825
12827}

Referenced by START_TEST().

◆ test_rounded_rectangle_geometry()

static void test_rounded_rectangle_geometry ( BOOL  d3d11)
static

Definition at line 4728 of file d2d1.c.

4729{
4732 struct d2d1_test_context ctx;
4733 HRESULT hr;
4734
4735 if (!init_test_context(&ctx, d3d11))
4736 return;
4737
4738 set_rounded_rect(&rect, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f);
4739 hr = ID2D1Factory_CreateRoundedRectangleGeometry(ctx.factory, &rect, &geometry);
4740 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
4741
4742 ID2D1RoundedRectangleGeometry_GetRoundedRect(geometry, &rect2);
4743 ok(!memcmp(&rect, &rect2, sizeof(rect)), "Got unexpected rectangle {%.8e, %.8e, %.8e, %.8e, %.8e, %.8e}.\n",
4744 rect2.rect.left, rect2.rect.top, rect2.rect.right, rect2.rect.bottom, rect2.radiusX, rect2.radiusY);
4745 ID2D1RoundedRectangleGeometry_Release(geometry);
4746
4747 /* X radius larger than half width. */
4748 set_rounded_rect(&rect, 0.0f, 0.0f, 50.0f, 40.0f, 30.0f, 5.0f);
4749 hr = ID2D1Factory_CreateRoundedRectangleGeometry(ctx.factory, &rect, &geometry);
4750 ID2D1RoundedRectangleGeometry_GetRoundedRect(geometry, &rect2);
4751 ok(!memcmp(&rect, &rect2, sizeof(rect)), "Got unexpected rectangle {%.8e, %.8e, %.8e, %.8e, %.8e, %.8e}.\n",
4752 rect2.rect.left, rect2.rect.top, rect2.rect.right, rect2.rect.bottom, rect2.radiusX, rect2.radiusY);
4753 ID2D1RoundedRectangleGeometry_Release(geometry);
4754
4755 /* Y radius larger than half height. */
4756 set_rounded_rect(&rect, 0.0f, 0.0f, 50.0f, 40.0f, 5.0f, 30.0f);
4757 hr = ID2D1Factory_CreateRoundedRectangleGeometry(ctx.factory, &rect, &geometry);
4758 ID2D1RoundedRectangleGeometry_GetRoundedRect(geometry, &rect2);
4759 ok(!memcmp(&rect, &rect2, sizeof(rect)), "Got unexpected rectangle {%.8e, %.8e, %.8e, %.8e, %.8e, %.8e}.\n",
4760 rect2.rect.left, rect2.rect.top, rect2.rect.right, rect2.rect.bottom, rect2.radiusX, rect2.radiusY);
4761 ID2D1RoundedRectangleGeometry_Release(geometry);
4762
4763 /* Both exceed rectangle size. */
4764 set_rounded_rect(&rect, 0.0f, 0.0f, 50.0f, 40.0f, 30.0f, 25.0f);
4765 hr = ID2D1Factory_CreateRoundedRectangleGeometry(ctx.factory, &rect, &geometry);
4766 ID2D1RoundedRectangleGeometry_GetRoundedRect(geometry, &rect2);
4767 ok(!memcmp(&rect, &rect2, sizeof(rect)), "Got unexpected rectangle {%.8e, %.8e, %.8e, %.8e, %.8e, %.8e}.\n",
4768 rect2.rect.left, rect2.rect.top, rect2.rect.right, rect2.rect.bottom, rect2.radiusX, rect2.radiusY);
4769 ID2D1RoundedRectangleGeometry_Release(geometry);
4770
4772}

Referenced by START_TEST().

◆ test_shared_bitmap()

static void test_shared_bitmap ( BOOL  d3d11)
static

Definition at line 5096 of file d2d1.c.

5097{
5098 IWICBitmap *wic_bitmap1, *wic_bitmap2;
5101 D2D1_BITMAP_PROPERTIES bitmap_desc;
5102 ID2D1RenderTarget *rt1, *rt2, *rt3;
5103 IDXGISurface *surface2;
5104 ID2D1Factory *factory1, *factory2;
5105 IWICImagingFactory *wic_factory;
5106 ID2D1Bitmap *bitmap1, *bitmap2;
5107 DXGI_SURFACE_DESC surface_desc;
5109 struct d2d1_test_context ctx;
5110 IDXGISwapChain *swapchain2;
5111 D2D1_SIZE_U size = {4, 4};
5112 IDXGISurface1 *surface3;
5113 IDXGIDevice *device2;
5114 HWND window2;
5115 HRESULT hr;
5116
5117 if (!init_test_context(&ctx, d3d11))
5118 return;
5119
5120 window2 = create_window();
5121 swapchain2 = create_swapchain(ctx.device, window2, TRUE);
5122 hr = IDXGISwapChain_GetBuffer(swapchain2, 0, &IID_IDXGISurface, (void **)&surface2);
5123 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
5124
5126 hr = CoCreateInstance(&CLSID_WICImagingFactory, NULL, CLSCTX_INPROC_SERVER,
5127 &IID_IWICImagingFactory, (void **)&wic_factory);
5128 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
5129 hr = IWICImagingFactory_CreateBitmap(wic_factory, 640, 480,
5130 &GUID_WICPixelFormat32bppPBGRA, WICBitmapCacheOnDemand, &wic_bitmap1);
5131 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
5132 hr = IWICImagingFactory_CreateBitmap(wic_factory, 640, 480,
5133 &GUID_WICPixelFormat32bppPBGRA, WICBitmapCacheOnDemand, &wic_bitmap2);
5134 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
5135 IWICImagingFactory_Release(wic_factory);
5136
5138 desc.pixelFormat.format = DXGI_FORMAT_UNKNOWN;
5139 desc.pixelFormat.alphaMode = D2D1_ALPHA_MODE_PREMULTIPLIED;
5140 desc.dpiX = 0.0f;
5141 desc.dpiY = 0.0f;
5144
5146 bitmap_desc.pixelFormat.alphaMode = D2D1_ALPHA_MODE_PREMULTIPLIED;
5147 bitmap_desc.dpiX = 96.0f;
5148 bitmap_desc.dpiY = 96.0f;
5149
5150 hr = D2D1CreateFactory(D2D1_FACTORY_TYPE_SINGLE_THREADED, &IID_ID2D1Factory, NULL, (void **)&factory1);
5151 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
5152 hr = D2D1CreateFactory(D2D1_FACTORY_TYPE_SINGLE_THREADED, &IID_ID2D1Factory, NULL, (void **)&factory2);
5153 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
5154
5155 /* DXGI surface render targets with the same device and factory. */
5156 hr = ID2D1Factory_CreateDxgiSurfaceRenderTarget(factory1, ctx.surface, &desc, &rt1);
5157 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
5158 hr = ID2D1RenderTarget_CreateBitmap(rt1, size, NULL, 0, &bitmap_desc, &bitmap1);
5159 check_bitmap_surface(bitmap1, TRUE, 0);
5160 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
5161
5162 hr = ID2D1Factory_CreateDxgiSurfaceRenderTarget(factory1, surface2, &desc, &rt2);
5163 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
5164 hr = ID2D1RenderTarget_CreateSharedBitmap(rt2, &IID_ID2D1Bitmap, bitmap1, NULL, &bitmap2);
5165 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
5167 ID2D1Bitmap_Release(bitmap2);
5168 hr = ID2D1RenderTarget_CreateSharedBitmap(rt2, &IID_IUnknown, bitmap1, NULL, &bitmap2);
5169 ok(hr == E_INVALIDARG, "Got unexpected hr %#lx.\n", hr);
5170 ID2D1RenderTarget_Release(rt2);
5171
5172 /* DXGI surface render targets with the same device but different factories. */
5173 hr = ID2D1Factory_CreateDxgiSurfaceRenderTarget(factory2, surface2, &desc, &rt2);
5174 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
5175 hr = ID2D1RenderTarget_CreateSharedBitmap(rt2, &IID_ID2D1Bitmap, bitmap1, NULL, &bitmap2);
5176 ok(hr == D2DERR_WRONG_FACTORY, "Got unexpected hr %#lx.\n", hr);
5177 ID2D1RenderTarget_Release(rt2);
5178
5179 /* DXGI surface render targets with different devices but the same factory. */
5180 IDXGISurface_Release(surface2);
5181 IDXGISwapChain_Release(swapchain2);
5182 device2 = create_device(d3d11);
5183 ok(!!device2, "Failed to create device.\n");
5184 swapchain2 = create_swapchain(device2, window2, TRUE);
5185 hr = IDXGISwapChain_GetBuffer(swapchain2, 0, &IID_IDXGISurface, (void **)&surface2);
5186 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
5187
5188 hr = ID2D1Factory_CreateDxgiSurfaceRenderTarget(factory1, surface2, &desc, &rt2);
5189 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
5190 hr = ID2D1RenderTarget_CreateSharedBitmap(rt2, &IID_ID2D1Bitmap, bitmap1, NULL, &bitmap2);
5191 ok(hr == D2DERR_UNSUPPORTED_OPERATION, "Got unexpected hr %#lx.\n", hr);
5192 ID2D1RenderTarget_Release(rt2);
5193
5194 /* DXGI surface render targets with different devices and different factories. */
5195 hr = ID2D1Factory_CreateDxgiSurfaceRenderTarget(factory2, surface2, &desc, &rt2);
5196 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
5197 hr = ID2D1RenderTarget_CreateSharedBitmap(rt2, &IID_ID2D1Bitmap, bitmap1, NULL, &bitmap2);
5198 ok(hr == D2DERR_WRONG_FACTORY, "Got unexpected hr %#lx.\n", hr);
5199 ID2D1RenderTarget_Release(rt2);
5200
5201 /* DXGI surface render target and WIC bitmap render target, same factory. */
5202 hr = ID2D1Factory_CreateWicBitmapRenderTarget(factory1, wic_bitmap2, &desc, &rt2);
5203 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
5204 hr = ID2D1RenderTarget_CreateSharedBitmap(rt2, &IID_ID2D1Bitmap, bitmap1, NULL, &bitmap2);
5205 ok(hr == D2DERR_UNSUPPORTED_OPERATION, "Got unexpected hr %#lx.\n", hr);
5206 ID2D1RenderTarget_Release(rt2);
5207
5208 /* WIC bitmap render targets on different D2D factories. */
5209 ID2D1Bitmap_Release(bitmap1);
5210 ID2D1RenderTarget_Release(rt1);
5211 hr = ID2D1Factory_CreateWicBitmapRenderTarget(factory1, wic_bitmap1, &desc, &rt1);
5212 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
5213 hr = ID2D1RenderTarget_CreateBitmap(rt1, size, NULL, 0, &bitmap_desc, &bitmap1);
5214 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
5215
5216 hr = ID2D1RenderTarget_QueryInterface(rt1, &IID_ID2D1GdiInteropRenderTarget, (void **)&interop);
5217 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
5218 hr = ID2D1GdiInteropRenderTarget_QueryInterface(interop, &IID_ID2D1RenderTarget, (void **)&rt3);
5219 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
5220 ok(rt3 == rt1, "Unexpected render target\n");
5221 ID2D1RenderTarget_Release(rt3);
5222 ID2D1GdiInteropRenderTarget_Release(interop);
5223
5224 hr = ID2D1Factory_CreateWicBitmapRenderTarget(factory2, wic_bitmap2, &desc, &rt2);
5225 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
5226 hr = ID2D1RenderTarget_CreateSharedBitmap(rt2, &IID_ID2D1Bitmap, bitmap1, NULL, &bitmap2);
5227 ok(hr == D2DERR_WRONG_FACTORY, "Got unexpected hr %#lx.\n", hr);
5228 ID2D1RenderTarget_Release(rt2);
5229
5230 /* WIC bitmap render targets on the same D2D factory. */
5231 hr = ID2D1Factory_CreateWicBitmapRenderTarget(factory1, wic_bitmap2, &desc, &rt2);
5232 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
5233 hr = ID2D1RenderTarget_CreateSharedBitmap(rt2, &IID_ID2D1Bitmap, bitmap1, NULL, &bitmap2);
5234 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
5236 ID2D1Bitmap_Release(bitmap2);
5237 ID2D1RenderTarget_Release(rt2);
5238
5239 /* Shared DXGI surface. */
5241 desc.pixelFormat.format = DXGI_FORMAT_B8G8R8A8_UNORM;
5242 desc.pixelFormat.alphaMode = D2D1_ALPHA_MODE_PREMULTIPLIED;
5243 desc.dpiX = 0.0f;
5244 desc.dpiY = 0.0f;
5247
5248 hr = ID2D1Factory_CreateDxgiSurfaceRenderTarget(factory1, surface2, &desc, &rt2);
5249 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
5250
5252 bitmap_desc.pixelFormat.alphaMode = D2D1_ALPHA_MODE_PREMULTIPLIED;
5253 bitmap_desc.dpiX = 0.0f;
5254 bitmap_desc.dpiY = 0.0f;
5255
5256 hr = ID2D1RenderTarget_CreateSharedBitmap(rt2, &IID_IDXGISurface, surface2, &bitmap_desc, &bitmap2);
5257 ok(hr == S_OK || broken(hr == E_INVALIDARG) /* vista */, "Got unexpected hr %#lx.\n", hr);
5258
5259 if (SUCCEEDED(hr))
5260 {
5261 static const struct bitmap_format_test
5262 {
5263 D2D1_PIXEL_FORMAT original;
5265 HRESULT hr;
5266 }
5267 bitmap_format_tests[] =
5268 {
5269 { { DXGI_FORMAT_UNKNOWN, D2D1_ALPHA_MODE_PREMULTIPLIED },
5270 { DXGI_FORMAT_B8G8R8A8_UNORM, D2D1_ALPHA_MODE_PREMULTIPLIED } },
5271
5272 { { DXGI_FORMAT_UNKNOWN, D2D1_ALPHA_MODE_IGNORE },
5273 { DXGI_FORMAT_B8G8R8A8_UNORM, D2D1_ALPHA_MODE_IGNORE } },
5274
5275 { { DXGI_FORMAT_UNKNOWN, D2D1_ALPHA_MODE_UNKNOWN }, { 0 }, D2DERR_UNSUPPORTED_PIXEL_FORMAT },
5276
5277 { { DXGI_FORMAT_B8G8R8A8_UNORM, D2D1_ALPHA_MODE_UNKNOWN }, { 0 }, D2DERR_UNSUPPORTED_PIXEL_FORMAT },
5278
5279 { { DXGI_FORMAT_B8G8R8A8_UNORM, D2D1_ALPHA_MODE_IGNORE },
5280 { DXGI_FORMAT_B8G8R8A8_UNORM, D2D1_ALPHA_MODE_IGNORE } },
5281
5282 { { DXGI_FORMAT_UNKNOWN, D2D1_ALPHA_MODE_STRAIGHT }, { 0 }, D2DERR_UNSUPPORTED_PIXEL_FORMAT },
5283 { { DXGI_FORMAT_B8G8R8A8_UNORM, D2D1_ALPHA_MODE_STRAIGHT }, { 0 }, D2DERR_UNSUPPORTED_PIXEL_FORMAT },
5284 };
5285 unsigned int i;
5286
5287 size = ID2D1Bitmap_GetPixelSize(bitmap2);
5288 hr = IDXGISurface_GetDesc(surface2, &surface_desc);
5289 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
5290 ok(size.width == surface_desc.Width && size.height == surface_desc.Height, "Got wrong bitmap size.\n");
5291
5293
5294 ID2D1Bitmap_Release(bitmap2);
5295
5296 /* IDXGISurface1 is supported too. */
5297 if (IDXGISurface_QueryInterface(surface2, &IID_IDXGISurface1, (void **)&surface3) == S_OK)
5298 {
5299 hr = ID2D1RenderTarget_CreateSharedBitmap(rt2, &IID_IDXGISurface1, surface3, &bitmap_desc, &bitmap2);
5300 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
5301
5302 ID2D1Bitmap_Release(bitmap2);
5303 IDXGISurface1_Release(surface3);
5304 }
5305
5306 for (i = 0; i < ARRAY_SIZE(bitmap_format_tests); ++i)
5307 {
5308 bitmap_desc.pixelFormat = bitmap_format_tests[i].original;
5309
5310 hr = ID2D1RenderTarget_CreateSharedBitmap(rt2, &IID_IDXGISurface, surface2, &bitmap_desc, &bitmap2);
5311 todo_wine_if(i == 2 || i == 3 || i == 5 || i == 6)
5312 ok(hr == bitmap_format_tests[i].hr, "%u: Got unexpected hr %#lx.\n", i, hr);
5313
5314 if (SUCCEEDED(hr) && hr == bitmap_format_tests[i].hr)
5315 {
5316 pixel_format = ID2D1Bitmap_GetPixelFormat(bitmap2);
5317 ok(pixel_format.format == bitmap_format_tests[i].result.format, "%u: unexpected pixel format %#x.\n",
5318 i, pixel_format.format);
5319 ok(pixel_format.alphaMode == bitmap_format_tests[i].result.alphaMode, "%u: unexpected alpha mode %d.\n",
5320 i, pixel_format.alphaMode);
5321 }
5322
5323 if (SUCCEEDED(hr))
5324 ID2D1Bitmap_Release(bitmap2);
5325 }
5326 }
5327
5328 ID2D1Bitmap_Release(bitmap1);
5329
5330 /* Create from another bitmap, with a different description. */
5331 set_size_u(&size, 4, 4);
5332 bitmap_desc.pixelFormat.format = DXGI_FORMAT_B8G8R8A8_UNORM;
5333 bitmap_desc.pixelFormat.alphaMode = D2D1_ALPHA_MODE_PREMULTIPLIED;
5334 bitmap_desc.dpiX = 96.0f;
5335 bitmap_desc.dpiY = 96.0f;
5336 hr = ID2D1RenderTarget_CreateBitmap(rt2, size, NULL, 0, &bitmap_desc, &bitmap1);
5337 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
5338
5339 if (SUCCEEDED(hr))
5340 {
5341 static const struct bitmap_format_test
5342 {
5343 D2D1_PIXEL_FORMAT original;
5344 D2D1_PIXEL_FORMAT result;
5345 HRESULT hr;
5346 }
5347 bitmap_format_tests[] =
5348 {
5349 { { DXGI_FORMAT_UNKNOWN, D2D1_ALPHA_MODE_PREMULTIPLIED },
5350 { DXGI_FORMAT_B8G8R8A8_UNORM, D2D1_ALPHA_MODE_PREMULTIPLIED } },
5351
5352 { { DXGI_FORMAT_UNKNOWN, D2D1_ALPHA_MODE_IGNORE },
5353 { DXGI_FORMAT_B8G8R8A8_UNORM, D2D1_ALPHA_MODE_IGNORE } },
5354
5355 { { DXGI_FORMAT_UNKNOWN, D2D1_ALPHA_MODE_UNKNOWN },
5356 { DXGI_FORMAT_B8G8R8A8_UNORM, D2D1_ALPHA_MODE_PREMULTIPLIED } },
5357
5358 { { DXGI_FORMAT_B8G8R8A8_UNORM, D2D1_ALPHA_MODE_UNKNOWN },
5359 { DXGI_FORMAT_B8G8R8A8_UNORM, D2D1_ALPHA_MODE_PREMULTIPLIED } },
5360
5361 { { DXGI_FORMAT_B8G8R8A8_UNORM, D2D1_ALPHA_MODE_IGNORE },
5362 { DXGI_FORMAT_B8G8R8A8_UNORM, D2D1_ALPHA_MODE_IGNORE } },
5363
5364 { { DXGI_FORMAT_UNKNOWN, D2D1_ALPHA_MODE_STRAIGHT }, { 0 }, D2DERR_UNSUPPORTED_PIXEL_FORMAT },
5365 { { DXGI_FORMAT_B8G8R8A8_UNORM, D2D1_ALPHA_MODE_STRAIGHT }, { 0 }, D2DERR_UNSUPPORTED_PIXEL_FORMAT },
5366 };
5367 unsigned int i;
5368
5369 for (i = 0; i < ARRAY_SIZE(bitmap_format_tests); ++i)
5370 {
5371 bitmap_desc.pixelFormat = bitmap_format_tests[i].original;
5372
5373 hr = ID2D1RenderTarget_CreateSharedBitmap(rt2, &IID_ID2D1Bitmap, bitmap1, &bitmap_desc, &bitmap2);
5374 ok(hr == bitmap_format_tests[i].hr, "%u: Got unexpected hr %#lx.\n", i, hr);
5375
5376 if (SUCCEEDED(hr) && hr == bitmap_format_tests[i].hr)
5377 {
5378 pixel_format = ID2D1Bitmap_GetPixelFormat(bitmap2);
5379 ok(pixel_format.format == bitmap_format_tests[i].result.format, "%u: unexpected pixel format %#x.\n",
5380 i, pixel_format.format);
5381 ok(pixel_format.alphaMode == bitmap_format_tests[i].result.alphaMode, "%u: unexpected alpha mode %d.\n",
5382 i, pixel_format.alphaMode);
5383 }
5384
5385 if (SUCCEEDED(hr))
5386 ID2D1Bitmap_Release(bitmap2);
5387 }
5388 }
5389
5390 ID2D1RenderTarget_Release(rt2);
5391
5392 ID2D1Bitmap_Release(bitmap1);
5393 ID2D1RenderTarget_Release(rt1);
5394 ID2D1Factory_Release(factory2);
5395 ID2D1Factory_Release(factory1);
5396 IWICBitmap_Release(wic_bitmap2);
5397 IWICBitmap_Release(wic_bitmap1);
5398 IDXGISurface_Release(surface2);
5399 IDXGISwapChain_Release(swapchain2);
5400 IDXGIDevice_Release(device2);
5401 release_test_context(&ctx);
5402 DestroyWindow(window2);
5403 CoUninitialize();
5404}
ID2D1Factory1 * factory1
Definition: d2d1.c:325
#define D2DERR_UNSUPPORTED_OPERATION
Definition: winerror.h:7354

Referenced by START_TEST().

◆ test_skew_matrix()

static void test_skew_matrix ( BOOL  d3d11)
static

Definition at line 9828 of file d2d1.c.

9829{
9830 static const struct
9831 {
9832 float angle_x;
9833 float angle_y;
9834 D2D1_POINT_2F center;
9836 }
9837 skew_tests[] =
9838 {
9839 { 0.0f, 0.0f, { 0.0f, 0.0f }, {{{ 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f }}} },
9840 { 45.0f, 0.0f, { 0.0f, 0.0f }, {{{ 1.0f, 0.0f, 1.0f, 1.0f, 0.0f, 0.0f }}} },
9841 { 0.0f, 0.0f, { 10.0f, -3.0f }, {{{ 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f }}} },
9842 { -45.0f, 45.0f, { 0.1f, 0.5f }, {{{ 1.0f, 1.0f, -1.0f, 1.0f, 0.5f, -0.1f }}} },
9843 { -45.0f, 45.0f, { 1.0f, 2.0f }, {{{ 1.0f, 1.0f, -1.0f, 1.0f, 2.0f, -1.0f }}} },
9844 { 45.0f, -45.0f, { 1.0f, 2.0f }, {{{ 1.0f, -1.0f, 1.0f, 1.0f, -2.0f, 1.0f }}} },
9845 { 30.0f, -60.0f, { 12.0f, -5.0f }, {{{ 1.0f, -1.7320509f, 0.577350259f, 1.0f, 2.88675117f, 20.7846107f }}} },
9846 };
9847 unsigned int i;
9848
9849 for (i = 0; i < ARRAY_SIZE(skew_tests); ++i)
9850 {
9851 const D2D1_MATRIX_3X2_F *expected = &skew_tests[i].matrix;
9853 BOOL ret;
9854
9855 D2D1MakeSkewMatrix(skew_tests[i].angle_x, skew_tests[i].angle_y, skew_tests[i].center, &m);
9856 ret = compare_float(m._11, expected->_11, 3) && compare_float(m._12, expected->_12, 3)
9857 && compare_float(m._21, expected->_21, 3) && compare_float(m._22, expected->_22, 3)
9858 && compare_float(m._31, expected->_31, 3) && compare_float(m._32, expected->_32, 3);
9859
9860 ok(ret, "%u: unexpected matrix value {%.8e, %.8e, %.8e, %.8e, %.8e, %.8e}, expected "
9861 "{%.8e, %.8e, %.8e, %.8e, %.8e, %.8e}.\n", i, m._11, m._12, m._21, m._22, m._31, m._32,
9862 expected->_11, expected->_12, expected->_21, expected->_22, expected->_31, expected->_32);
9863 }
9864}
void WINAPI D2D1MakeSkewMatrix(float angle_x, float angle_y, D2D1_POINT_2F center, D2D1_MATRIX_3X2_F *matrix)
Definition: factory.c:1410

Referenced by START_TEST().

◆ test_state_block()

static void test_state_block ( BOOL  d3d11)
static

Definition at line 1896 of file d2d1.c.

1897{
1898 IDWriteRenderingParams *text_rendering_params1, *text_rendering_params2;
1899 D2D1_DRAWING_STATE_DESCRIPTION drawing_state;
1900 ID2D1DrawingStateBlock *state_block;
1901 IDWriteFactory *dwrite_factory;
1902 struct d2d1_test_context ctx;
1906 ULONG refcount;
1907 HRESULT hr;
1908 void *ptr;
1909 static const D2D1_MATRIX_3X2_F identity =
1910 {{{
1911 1.0f, 0.0f,
1912 0.0f, 1.0f,
1913 0.0f, 0.0f,
1914 }}};
1915 static const D2D1_MATRIX_3X2_F transform1 =
1916 {{{
1917 1.0f, 2.0f,
1918 3.0f, 4.0f,
1919 5.0f, 6.0f,
1920 }}};
1921 static const D2D1_MATRIX_3X2_F transform2 =
1922 {{{
1923 7.0f, 8.0f,
1924 9.0f, 10.0f,
1925 11.0f, 12.0f,
1926 }}};
1927
1928 if (!init_test_context(&ctx, d3d11))
1929 return;
1930
1931 rt = ctx.rt;
1932 factory = ctx.factory;
1933 factory1 = ctx.factory1;
1934 hr = DWriteCreateFactory(DWRITE_FACTORY_TYPE_SHARED, &IID_IDWriteFactory, (IUnknown **)&dwrite_factory);
1935 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
1936 hr = IDWriteFactory_CreateRenderingParams(dwrite_factory, &text_rendering_params1);
1937 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
1938 IDWriteFactory_Release(dwrite_factory);
1939
1940 drawing_state.antialiasMode = ID2D1RenderTarget_GetAntialiasMode(rt);
1942 "Got unexpected antialias mode %#x.\n", drawing_state.antialiasMode);
1943 drawing_state.textAntialiasMode = ID2D1RenderTarget_GetTextAntialiasMode(rt);
1945 "Got unexpected text antialias mode %#x.\n", drawing_state.textAntialiasMode);
1946 ID2D1RenderTarget_GetTags(rt, &drawing_state.tag1, &drawing_state.tag2);
1947 ok(!drawing_state.tag1 && !drawing_state.tag2, "Got unexpected tags %s:%s.\n",
1948 wine_dbgstr_longlong(drawing_state.tag1), wine_dbgstr_longlong(drawing_state.tag2));
1949 ID2D1RenderTarget_GetTransform(rt, &drawing_state.transform);
1950 ok(!memcmp(&drawing_state.transform, &identity, sizeof(drawing_state.transform)),
1951 "Got unexpected matrix {%.8e, %.8e, %.8e, %.8e, %.8e, %.8e}.\n",
1952 drawing_state.transform._11, drawing_state.transform._12, drawing_state.transform._21,
1953 drawing_state.transform._22, drawing_state.transform._31, drawing_state.transform._32);
1954 ID2D1RenderTarget_GetTextRenderingParams(rt, &text_rendering_params2);
1955 ok(!text_rendering_params2, "Got unexpected text rendering params %p.\n", text_rendering_params2);
1956
1957 hr = ID2D1Factory_CreateDrawingStateBlock(factory, NULL, NULL, &state_block);
1958 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
1959 ID2D1DrawingStateBlock_GetDescription(state_block, &drawing_state);
1961 "Got unexpected antialias mode %#x.\n", drawing_state.antialiasMode);
1963 "Got unexpected text antialias mode %#x.\n", drawing_state.textAntialiasMode);
1964 ok(!drawing_state.tag1 && !drawing_state.tag2, "Got unexpected tags %s:%s.\n",
1965 wine_dbgstr_longlong(drawing_state.tag1), wine_dbgstr_longlong(drawing_state.tag2));
1966 ok(!memcmp(&drawing_state.transform, &identity, sizeof(drawing_state.transform)),
1967 "Got unexpected matrix {%.8e, %.8e, %.8e, %.8e, %.8e, %.8e}.\n",
1968 drawing_state.transform._11, drawing_state.transform._12, drawing_state.transform._21,
1969 drawing_state.transform._22, drawing_state.transform._31, drawing_state.transform._32);
1970 ID2D1DrawingStateBlock_GetTextRenderingParams(state_block, &text_rendering_params2);
1971 ok(!text_rendering_params2, "Got unexpected text rendering params %p.\n", text_rendering_params2);
1972 ID2D1DrawingStateBlock_Release(state_block);
1973
1976 drawing_state.tag1 = 0xdead;
1977 drawing_state.tag2 = 0xbeef;
1978 drawing_state.transform = transform1;
1979 hr = ID2D1Factory_CreateDrawingStateBlock(factory, &drawing_state, text_rendering_params1, &state_block);
1980 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
1981
1982 ID2D1DrawingStateBlock_GetDescription(state_block, &drawing_state);
1984 "Got unexpected antialias mode %#x.\n", drawing_state.antialiasMode);
1986 "Got unexpected text antialias mode %#x.\n", drawing_state.textAntialiasMode);
1987 ok(drawing_state.tag1 == 0xdead && drawing_state.tag2 == 0xbeef, "Got unexpected tags %s:%s.\n",
1988 wine_dbgstr_longlong(drawing_state.tag1), wine_dbgstr_longlong(drawing_state.tag2));
1989 ok(!memcmp(&drawing_state.transform, &transform1, sizeof(drawing_state.transform)),
1990 "Got unexpected matrix {%.8e, %.8e, %.8e, %.8e, %.8e, %.8e}.\n",
1991 drawing_state.transform._11, drawing_state.transform._12, drawing_state.transform._21,
1992 drawing_state.transform._22, drawing_state.transform._31, drawing_state.transform._32);
1993 ID2D1DrawingStateBlock_GetTextRenderingParams(state_block, &text_rendering_params2);
1994 ok(text_rendering_params2 == text_rendering_params1, "Got unexpected text rendering params %p, expected %p.\n",
1995 text_rendering_params2, text_rendering_params1);
1996 IDWriteRenderingParams_Release(text_rendering_params2);
1997
1998 ID2D1RenderTarget_RestoreDrawingState(rt, state_block);
1999
2000 drawing_state.antialiasMode = ID2D1RenderTarget_GetAntialiasMode(rt);
2002 "Got unexpected antialias mode %#x.\n", drawing_state.antialiasMode);
2003 drawing_state.textAntialiasMode = ID2D1RenderTarget_GetTextAntialiasMode(rt);
2005 "Got unexpected text antialias mode %#x.\n", drawing_state.textAntialiasMode);
2006 ID2D1RenderTarget_GetTags(rt, &drawing_state.tag1, &drawing_state.tag2);
2007 ok(drawing_state.tag1 == 0xdead && drawing_state.tag2 == 0xbeef, "Got unexpected tags %s:%s.\n",
2008 wine_dbgstr_longlong(drawing_state.tag1), wine_dbgstr_longlong(drawing_state.tag2));
2009 ID2D1RenderTarget_GetTransform(rt, &drawing_state.transform);
2010 ok(!memcmp(&drawing_state.transform, &transform1, sizeof(drawing_state.transform)),
2011 "Got unexpected matrix {%.8e, %.8e, %.8e, %.8e, %.8e, %.8e}.\n",
2012 drawing_state.transform._11, drawing_state.transform._12, drawing_state.transform._21,
2013 drawing_state.transform._22, drawing_state.transform._31, drawing_state.transform._32);
2014 ID2D1RenderTarget_GetTextRenderingParams(rt, &text_rendering_params2);
2015 ok(text_rendering_params2 == text_rendering_params1, "Got unexpected text rendering params %p, expected %p.\n",
2016 text_rendering_params2, text_rendering_params1);
2017 IDWriteRenderingParams_Release(text_rendering_params2);
2018
2019 ID2D1RenderTarget_SetAntialiasMode(rt, D2D1_ANTIALIAS_MODE_PER_PRIMITIVE);
2020 ID2D1RenderTarget_SetTextAntialiasMode(rt, D2D1_TEXT_ANTIALIAS_MODE_GRAYSCALE);
2021 ID2D1RenderTarget_SetTags(rt, 1, 2);
2022 ID2D1RenderTarget_SetTransform(rt, &transform2);
2023 ID2D1RenderTarget_SetTextRenderingParams(rt, NULL);
2024
2025 drawing_state.antialiasMode = ID2D1RenderTarget_GetAntialiasMode(rt);
2027 "Got unexpected antialias mode %#x.\n", drawing_state.antialiasMode);
2028 drawing_state.textAntialiasMode = ID2D1RenderTarget_GetTextAntialiasMode(rt);
2030 "Got unexpected text antialias mode %#x.\n", drawing_state.textAntialiasMode);
2031 ID2D1RenderTarget_GetTags(rt, &drawing_state.tag1, &drawing_state.tag2);
2032 ok(drawing_state.tag1 == 1 && drawing_state.tag2 == 2, "Got unexpected tags %s:%s.\n",
2033 wine_dbgstr_longlong(drawing_state.tag1), wine_dbgstr_longlong(drawing_state.tag2));
2034 ID2D1RenderTarget_GetTransform(rt, &drawing_state.transform);
2035 ok(!memcmp(&drawing_state.transform, &transform2, sizeof(drawing_state.transform)),
2036 "Got unexpected matrix {%.8e, %.8e, %.8e, %.8e, %.8e, %.8e}.\n",
2037 drawing_state.transform._11, drawing_state.transform._12, drawing_state.transform._21,
2038 drawing_state.transform._22, drawing_state.transform._31, drawing_state.transform._32);
2039 ID2D1RenderTarget_GetTextRenderingParams(rt, &text_rendering_params2);
2040 ok(!text_rendering_params2, "Got unexpected text rendering params %p.\n", text_rendering_params2);
2041
2042 ID2D1RenderTarget_SaveDrawingState(rt, state_block);
2043
2044 ID2D1DrawingStateBlock_GetDescription(state_block, &drawing_state);
2046 "Got unexpected antialias mode %#x.\n", drawing_state.antialiasMode);
2048 "Got unexpected text antialias mode %#x.\n", drawing_state.textAntialiasMode);
2049 ok(drawing_state.tag1 == 1 && drawing_state.tag2 == 2, "Got unexpected tags %s:%s.\n",
2050 wine_dbgstr_longlong(drawing_state.tag1), wine_dbgstr_longlong(drawing_state.tag2));
2051 ok(!memcmp(&drawing_state.transform, &transform2, sizeof(drawing_state.transform)),
2052 "Got unexpected matrix {%.8e, %.8e, %.8e, %.8e, %.8e, %.8e}.\n",
2053 drawing_state.transform._11, drawing_state.transform._12, drawing_state.transform._21,
2054 drawing_state.transform._22, drawing_state.transform._31, drawing_state.transform._32);
2055 ID2D1DrawingStateBlock_GetTextRenderingParams(state_block, &text_rendering_params2);
2056 ok(!text_rendering_params2, "Got unexpected text rendering params %p.\n", text_rendering_params2);
2057
2060 drawing_state.tag1 = 3;
2061 drawing_state.tag2 = 4;
2062 drawing_state.transform = transform1;
2063 ID2D1DrawingStateBlock_SetDescription(state_block, &drawing_state);
2064 ID2D1DrawingStateBlock_SetTextRenderingParams(state_block, text_rendering_params1);
2065
2066 ID2D1DrawingStateBlock_GetDescription(state_block, &drawing_state);
2068 "Got unexpected antialias mode %#x.\n", drawing_state.antialiasMode);
2070 "Got unexpected text antialias mode %#x.\n", drawing_state.textAntialiasMode);
2071 ok(drawing_state.tag1 == 3 && drawing_state.tag2 == 4, "Got unexpected tags %s:%s.\n",
2072 wine_dbgstr_longlong(drawing_state.tag1), wine_dbgstr_longlong(drawing_state.tag2));
2073 ok(!memcmp(&drawing_state.transform, &transform1, sizeof(drawing_state.transform)),
2074 "Got unexpected matrix {%.8e, %.8e, %.8e, %.8e, %.8e, %.8e}.\n",
2075 drawing_state.transform._11, drawing_state.transform._12, drawing_state.transform._21,
2076 drawing_state.transform._22, drawing_state.transform._31, drawing_state.transform._32);
2077 ID2D1DrawingStateBlock_GetTextRenderingParams(state_block, &text_rendering_params2);
2078 ok(text_rendering_params2 == text_rendering_params1, "Got unexpected text rendering params %p, expected %p.\n",
2079 text_rendering_params2, text_rendering_params1);
2080 IDWriteRenderingParams_Release(text_rendering_params2);
2081
2082 if (factory1)
2083 {
2084 D2D1_DRAWING_STATE_DESCRIPTION1 drawing_state1;
2085 ID2D1DrawingStateBlock1 *state_block1;
2086
2087 hr = ID2D1DrawingStateBlock_QueryInterface(state_block, &IID_ID2D1DrawingStateBlock1, (void **)&state_block1);
2088 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
2089
2090 ID2D1DrawingStateBlock1_GetDescription(state_block1, &drawing_state1);
2092 "Got unexpected antialias mode %#x.\n", drawing_state1.antialiasMode);
2094 "Got unexpected text antialias mode %#x.\n", drawing_state1.textAntialiasMode);
2095 ok(drawing_state1.tag1 == 3 && drawing_state1.tag2 == 4, "Got unexpected tags %s:%s.\n",
2096 wine_dbgstr_longlong(drawing_state1.tag1), wine_dbgstr_longlong(drawing_state1.tag2));
2097 ok(!memcmp(&drawing_state1.transform, &transform1, sizeof(drawing_state1.transform)),
2098 "Got unexpected matrix {%.8e, %.8e, %.8e, %.8e, %.8e, %.8e}.\n",
2099 drawing_state1.transform._11, drawing_state1.transform._12, drawing_state1.transform._21,
2100 drawing_state1.transform._22, drawing_state1.transform._31, drawing_state1.transform._32);
2102 "Got unexpected primitive blend mode %#x.\n", drawing_state1.primitiveBlend);
2103 ok(drawing_state1.unitMode == D2D1_UNIT_MODE_DIPS, "Got unexpected unit mode %#x.\n", drawing_state1.unitMode);
2104 ID2D1DrawingStateBlock1_GetTextRenderingParams(state_block1, &text_rendering_params2);
2105 ok(text_rendering_params2 == text_rendering_params1, "Got unexpected text rendering params %p, expected %p.\n",
2106 text_rendering_params2, text_rendering_params1);
2107 IDWriteRenderingParams_Release(text_rendering_params2);
2108
2110 drawing_state1.unitMode = D2D1_UNIT_MODE_PIXELS;
2111 ID2D1DrawingStateBlock1_SetDescription(state_block1, &drawing_state1);
2112 ID2D1DrawingStateBlock1_GetDescription(state_block1, &drawing_state1);
2114 "Got unexpected primitive blend mode %#x.\n", drawing_state1.primitiveBlend);
2115 ok(drawing_state1.unitMode == D2D1_UNIT_MODE_PIXELS,
2116 "Got unexpected unit mode %#x.\n", drawing_state1.unitMode);
2117
2118 ID2D1DrawingStateBlock_SetDescription(state_block, &drawing_state);
2119 ID2D1DrawingStateBlock1_GetDescription(state_block1, &drawing_state1);
2121 "Got unexpected primitive blend mode %#x.\n", drawing_state1.primitiveBlend);
2122 ok(drawing_state1.unitMode == D2D1_UNIT_MODE_PIXELS,
2123 "Got unexpected unit mode %#x.\n", drawing_state1.unitMode);
2124
2125 ID2D1DrawingStateBlock1_Release(state_block1);
2126
2127 hr = ID2D1Factory1_CreateDrawingStateBlock(factory1, NULL, NULL, &state_block1);
2128 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
2129 ID2D1DrawingStateBlock1_GetDescription(state_block1, &drawing_state1);
2131 "Got unexpected antialias mode %#x.\n", drawing_state1.antialiasMode);
2133 "Got unexpected text antialias mode %#x.\n", drawing_state1.textAntialiasMode);
2134 ok(drawing_state1.tag1 == 0 && drawing_state1.tag2 == 0, "Got unexpected tags %s:%s.\n",
2135 wine_dbgstr_longlong(drawing_state1.tag1), wine_dbgstr_longlong(drawing_state1.tag2));
2136 ok(!memcmp(&drawing_state1.transform, &identity, sizeof(drawing_state1.transform)),
2137 "Got unexpected matrix {%.8e, %.8e, %.8e, %.8e, %.8e, %.8e}.\n",
2138 drawing_state1.transform._11, drawing_state1.transform._12, drawing_state1.transform._21,
2139 drawing_state1.transform._22, drawing_state1.transform._31, drawing_state1.transform._32);
2141 "Got unexpected primitive blend mode %#x.\n", drawing_state1.primitiveBlend);
2142 ok(drawing_state1.unitMode == D2D1_UNIT_MODE_DIPS, "Got unexpected unit mode %#x.\n", drawing_state1.unitMode);
2143 ID2D1DrawingStateBlock1_GetTextRenderingParams(state_block1, &text_rendering_params2);
2144 ok(!text_rendering_params2, "Got unexpected text rendering params %p.\n", text_rendering_params2);
2145 ID2D1DrawingStateBlock1_Release(state_block1);
2146 }
2147
2148 ID2D1DrawingStateBlock_Release(state_block);
2149
2150 refcount = IDWriteRenderingParams_Release(text_rendering_params1);
2151 ok(!refcount, "Rendering params %lu references left.\n", refcount);
2152
2153 /* State block object pointer is validated, but does not result in an error state. */
2154 ptr = (void *)0xdeadbeef;
2155 ID2D1RenderTarget_BeginDraw(rt);
2156 ID2D1RenderTarget_SaveDrawingState(rt, (ID2D1DrawingStateBlock *)&ptr);
2157 ID2D1RenderTarget_RestoreDrawingState(rt, (ID2D1DrawingStateBlock *)&ptr);
2158 hr = ID2D1RenderTarget_EndDraw(rt, NULL, NULL);
2159 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
2160
2162}
@ D2D1_PRIMITIVE_BLEND_SOURCE_OVER
Definition: d2d1_1.idl:55
@ D2D1_PRIMITIVE_BLEND_COPY
Definition: d2d1_1.idl:56
D2D1_TEXT_ANTIALIAS_MODE textAntialiasMode
Definition: d2d1_1.idl:243
D2D1_ANTIALIAS_MODE antialiasMode
Definition: d2d1_1.idl:242
D2D1_MATRIX_3X2_F transform
Definition: d2d1_1.idl:246
D2D1_PRIMITIVE_BLEND primitiveBlend
Definition: d2d1_1.idl:247
D2D1_ANTIALIAS_MODE antialiasMode
Definition: d2d1.idl:347
D2D1_TEXT_ANTIALIAS_MODE textAntialiasMode
Definition: d2d1.idl:348
D2D1_MATRIX_3X2_F transform
Definition: d2d1.idl:351

Referenced by START_TEST().

◆ test_stroke_contains_point()

static void test_stroke_contains_point ( BOOL  d3d11)
static

Definition at line 13342 of file d2d1.c.

13343{
13344 ID2D1TransformedGeometry *transformed_geometry;
13345 ID2D1RectangleGeometry *rectangle;
13346 struct d2d1_test_context ctx;
13352 unsigned int i;
13353 BOOL contains;
13354 HRESULT hr;
13355
13356 static const struct contains_point_test
13357 {
13360 float tolerance;
13361 float stroke_width;
13362 BOOL matrix;
13363 BOOL contains;
13364 }
13365 rectangle_tests[] =
13366 {
13367 /* 0. Stroked area hittesting. Edge. */
13368 {{{{0.0f}}}, { 0.4f, 10.0f}, 0.0f, 1.0f, FALSE, TRUE},
13369 {{{{0.0f}}}, { 0.5f, 10.0f}, 0.0f, 1.0f, FALSE, FALSE},
13370 {{{{0.0f}}}, { 0.6f, 10.0f}, 0.0f, 1.0f, FALSE, FALSE},
13371
13372 /* 3. Negative tolerance. */
13373 {{{{0.0f}}}, {-0.6f, 10.0f}, -1.0f, 1.0f, FALSE, TRUE},
13374 {{{{0.0f}}}, { 0.6f, 10.0f}, -1.0f, 1.0f, FALSE, TRUE},
13375 {{{{0.0f}}}, { 1.4f, 10.0f}, -1.0f, 1.0f, FALSE, TRUE},
13376 {{{{0.0f}}}, { 1.5f, 10.0f}, -1.0f, 1.0f, FALSE, FALSE},
13377
13378 /* 7. Within tolerance limit around corner. */
13379 {{{{0.0f}}}, {-D2D1_DEFAULT_FLATTENING_TOLERANCE - 1.00f, 0.0f}, 0.0f, 2.0f, FALSE, FALSE},
13380 {{{{0.0f}}}, {-D2D1_DEFAULT_FLATTENING_TOLERANCE - 1.01f, 0.0f}, 0.0f, 2.0f, FALSE, FALSE},
13381 {{{{0.0f}}}, {-D2D1_DEFAULT_FLATTENING_TOLERANCE, -D2D1_DEFAULT_FLATTENING_TOLERANCE},
13382 0.0f, 2.0f, FALSE, TRUE},
13383 {{{{0.0f}}}, {-D2D1_DEFAULT_FLATTENING_TOLERANCE, -D2D1_DEFAULT_FLATTENING_TOLERANCE - 1.01f},
13384 0.0f, 2.0f, FALSE, FALSE},
13385
13386 /* 11. Center point. */
13387 {{{{0.0f}}}, { 5.0f, 10.0f}, 0.0f, 1.0f, FALSE, FALSE},
13388
13389 /* 12. Center point, large stroke width. */
13390 {{{{0.0f}}}, { 5.0f, 10.0f}, 0.0f, 100.0f, FALSE, TRUE},
13391
13392 /* 13. Center point, large tolerance. */
13393 {{{{0.0f}}}, { 5.0f, 10.0f}, 50.0f, 10.0f, FALSE, TRUE},
13394
13395 /* With transformation matrix. */
13396
13397 /* 14. */
13398 {{{{0.0f, 0.0f, 0.0f, 1.0f}}}, {0.1f, 10.0f}, 0.0f, 1.0f, TRUE, FALSE},
13399 {{{{0.0f, 0.0f, 0.0f, 1.0f}}}, {5.0f, 10.0f}, 5.0f, 1.0f, TRUE, FALSE},
13400 {{{{0.0f, 0.0f, 0.0f, 1.0f}}}, {4.9f, 10.0f}, 5.0f, 1.0f, TRUE, TRUE},
13401 {{{{0.0f, 0.0f, 0.0f, 1.0f}}}, {5.0f, 10.0f}, -5.0f, 1.0f, TRUE, FALSE},
13402 {{{{0.0f, 0.0f, 0.0f, 1.0f}}}, {4.9f, 10.0f}, -5.0f, 1.0f, TRUE, TRUE},
13403
13404 /* 19. */
13405 {{{{1.0f, 0.0f, 0.0f, 1.0f}}}, {0.0f, 10.0f}, 0.0f, 1.0f, TRUE, TRUE},
13406 {{{{1.0f, 0.0f, 0.0f, 1.0f}}}, {0.1f, 10.0f}, 0.0f, 1.0f, TRUE, TRUE},
13407 {{{{1.0f, 0.0f, 0.0f, 1.0f}}}, {0.5f, 10.0f}, 0.0f, 1.0f, TRUE, FALSE},
13408 {{{{1.0f, 0.0f, 0.0f, 1.0f}}}, {0.0f, 10.0f}, 1.0f, 1.0f, TRUE, TRUE},
13409 {{{{1.0f, 0.0f, 0.0f, 1.0f}}}, {0.59f, 10.0f}, 1.0f, 1.0f, TRUE, TRUE},
13410 {{{{1.0f, 0.0f, 0.0f, 1.0f}}}, {-0.59f, 10.0f}, 1.0f, 1.0f, TRUE, TRUE},
13411 {{{{1.0f, 0.0f, 0.0f, 1.0f}}}, {0.59f, 10.0f}, -1.0f, 1.0f, TRUE, TRUE},
13412 {{{{1.0f, 0.0f, 0.0f, 1.0f}}}, {-0.59f, 10.0f}, -1.0f, 1.0f, TRUE, TRUE},
13413
13414 /* 27. */
13415 {{{{1.0f, 1.0f, 0.0f, 1.0f}}}, {5.0f, 4.4f}, 0.0f, 1.0f, TRUE, FALSE},
13416 {{{{1.0f, 1.0f, 0.0f, 1.0f}}}, {5.0f, 4.6f}, 0.0f, 1.0f, TRUE, TRUE},
13417 {{{{1.0f, 1.0f, 0.0f, 1.0f}}}, {5.0f, 5.4f}, 0.0f, 1.0f, TRUE, TRUE},
13418 {{{{1.0f, 1.0f, 0.0f, 1.0f}}}, {5.0f, 5.6f}, 0.0f, 1.0f, TRUE, FALSE},
13419
13420 /* 31. */
13421 {{{{1.0f, 1.0f, 0.0f, 1.0f}}}, {5.0f, 6.9f}, 1.0f, 1.0f, TRUE, TRUE},
13422 {{{{1.0f, 1.0f, 0.0f, 1.0f}}}, {5.0f, 7.0f}, 1.0f, 1.0f, TRUE, FALSE},
13423
13424 /* 33. Offset matrix */
13425 {{{{1.0f, 0.0f, 0.0f, 1.0f, -11.0f, 0.0f}}}, { 5.0f, 20.0f}, 0.0f, 1.0f, TRUE, FALSE},
13426 {{{{1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 21.0f}}}, {10.0f, 10.0f}, 0.0f, 1.0f, TRUE, FALSE},
13427 {{{{1.0f, 0.0f, 0.0f, 1.0f, 11.0f, 0.0f}}}, { 5.0f, 0.0f}, 0.0f, 1.0f, TRUE, FALSE},
13428 {{{{1.0f, 0.0f, 0.0f, 1.0f, 0.0f, -21.0f}}}, { 0.0f, 10.0f}, 0.0f, 1.0f, TRUE, FALSE},
13429 {{{{1.0f, 0.0f, 0.0f, 1.0f, -11.0f, 0.0f}}}, {-6.0f, 20.0f}, 0.0f, 1.0f, TRUE, TRUE},
13430 {{{{1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 21.0f}}}, {10.0f, 31.0f}, 0.0f, 1.0f, TRUE, TRUE},
13431 {{{{1.0f, 0.0f, 0.0f, 1.0f, 11.0f, 0.0f}}}, {16.0f, 0.0f}, 0.0f, 1.0f, TRUE, TRUE},
13432 {{{{1.0f, 0.0f, 0.0f, 1.0f, 0.0f, -21.0f}}}, { 0.0f, -11.0f}, 0.0f, 1.0f, TRUE, TRUE},
13433 },
13434 path_tests[] =
13435 {
13436 /* 0. Stroked area hittesting. Edge. */
13437 {{{{0.0f}}}, {160.0f, 600.0f}, 0.0f, 1.0f, FALSE, FALSE},
13438 {{{{0.0f}}}, {239.24f, 600.0f}, 0.0f, 1.0f, FALSE, FALSE},
13439 {{{{0.0f}}}, {239.26f, 600.0f}, 0.0f, 1.0f, FALSE, TRUE},
13440 {{{{0.0f}}}, {240.74f, 600.0f}, 0.0f, 1.0f, FALSE, TRUE},
13441 {{{{0.0f}}}, {240.76f, 600.0f}, 0.0f, 1.0f, FALSE, FALSE},
13442
13443 /* 5. Negative tolerance. */
13444 {{{{0.0f}}}, {239.24f, 600.0f}, -1.0f, 1.0f, FALSE, FALSE},
13445 {{{{0.0f}}}, {239.26f, 600.0f}, -1.0f, 1.0f, FALSE, TRUE},
13446 {{{{0.0f}}}, {240.74f, 600.0f}, -1.0f, 1.0f, FALSE, TRUE},
13447 {{{{0.0f}}}, {240.76f, 600.0f}, -1.0f, 1.0f, FALSE, FALSE},
13448
13449 /* 9. Less than default tolerance. */
13450 {{{{0.0f}}}, {239.39f, 600.0f}, 0.1f, 1.0f, FALSE, FALSE},
13451 {{{{0.0f}}}, {239.41f, 600.0f}, 0.1f, 1.0f, FALSE, TRUE},
13452 {{{{0.0f}}}, {240.59f, 600.0f}, 0.1f, 1.0f, FALSE, TRUE},
13453 {{{{0.0f}}}, {240.61f, 600.0f}, 0.1f, 1.0f, FALSE, FALSE},
13454
13455 /* 13. Curves. */
13456 {{{{1.0f, 0.0f, 0.0f, 1.0f, 10.0f, 10.0f}}}, {170.0f, 418.6f}, 0.0f, 1.0f, TRUE, TRUE},
13457 {{{{1.0f, 0.0f, 0.0f, 1.0f, 10.0f, 10.0f}}}, {170.0f, 420.1f}, 0.0f, 1.0f, TRUE, FALSE},
13458 {{{{1.0f, 0.0f, 0.0f, 1.0f, 10.0f, 10.0f}}}, {170.0f, 417.7f}, 0.0f, 1.0f, TRUE, FALSE},
13459 {{{{1.0f, 0.0f, 0.0f, 1.0f, 10.0f, 10.0f}}}, { 89.5f, 485.3f}, 0.1f, 1.0f, TRUE, TRUE},
13460 {{{{1.0f, 0.0f, 0.0f, 1.0f, 10.0f, 10.0f}}}, { 90.5f, 485.3f}, 0.1f, 1.0f, TRUE, TRUE},
13461 {{{{1.0f, 0.0f, 0.0f, 1.0f, 10.0f, 10.0f}}}, { 91.5f, 485.3f}, 0.1f, 1.0f, TRUE, FALSE},
13462 {{{{1.0f, 0.0f, 0.0f, 1.0f, 10.0f, 10.0f}}}, { 89.0f, 485.3f}, 0.1f, 1.0f, TRUE, FALSE},
13463 {{{{1.0f, 0.0f, 0.0f, 1.0f, 10.0f, 10.0f}}}, {167.0f, 729.8f}, 0.0f, 1.0f, TRUE, TRUE},
13464 {{{{1.0f, 0.0f, 0.0f, 1.0f, 10.0f, 10.0f}}}, {167.0f, 728.6f}, 0.0f, 1.0f, TRUE, FALSE},
13465 {{{{1.0f, 0.0f, 0.0f, 1.0f, 10.0f, 10.0f}}}, {167.0f, 731.0f}, 0.0f, 1.0f, TRUE, FALSE},
13466 {{{{1.0f, 0.0f, 0.0f, 1.0f, 10.0f, 10.0f}}}, {173.0f, 729.8f}, 0.0f, 1.0f, TRUE, TRUE},
13467 {{{{1.0f, 0.0f, 0.0f, 1.0f, 10.0f, 10.0f}}}, {173.0f, 728.6f}, 0.0f, 1.0f, TRUE, FALSE},
13468 {{{{1.0f, 0.0f, 0.0f, 1.0f, 10.0f, 10.0f}}}, {173.0f, 731.0f}, 0.0f, 1.0f, TRUE, FALSE},
13469
13470 /* 26. A curve where the control points project beyond the endpoints
13471 * onto the line through the endpoints. */
13472 {{{{0.0f}}}, {306.97f, 791.67f}, 0.0f, 1.0f, FALSE, FALSE},
13473 {{{{0.0f}}}, {307.27f, 791.67f}, 0.0f, 1.0f, FALSE, TRUE},
13474 {{{{0.0f}}}, {308.47f, 791.67f}, 0.0f, 1.0f, FALSE, TRUE},
13475 {{{{0.0f}}}, {308.77f, 791.67f}, 0.0f, 1.0f, FALSE, FALSE},
13476
13477 {{{{0.0f}}}, {350.00f, 824.10f}, 0.0f, 1.0f, FALSE, FALSE},
13478 {{{{0.0f}}}, {350.00f, 824.40f}, 0.0f, 1.0f, FALSE, TRUE},
13479 {{{{0.0f}}}, {350.00f, 825.60f}, 0.0f, 1.0f, FALSE, TRUE},
13480 {{{{0.0f}}}, {350.00f, 825.90f}, 0.0f, 1.0f, FALSE, FALSE},
13481
13482 {{{{0.0f}}}, {391.23f, 791.67f}, 0.0f, 1.0f, FALSE, FALSE},
13483 {{{{0.0f}}}, {391.53f, 791.67f}, 0.0f, 1.0f, FALSE, TRUE},
13484 {{{{0.0f}}}, {392.73f, 791.67f}, 0.0f, 1.0f, FALSE, TRUE},
13485 {{{{0.0f}}}, {393.03f, 791.67f}, 0.0f, 1.0f, FALSE, FALSE},
13486
13487 /* 38. A curve where the endpoints coincide. */
13488 {{{{0.0f}}}, {570.23f, 799.77f}, 0.0f, 1.0f, FALSE, FALSE},
13489 {{{{0.0f}}}, {570.53f, 799.77f}, 0.0f, 1.0f, FALSE, TRUE},
13490 {{{{0.0f}}}, {571.73f, 799.77f}, 0.0f, 1.0f, FALSE, TRUE},
13491 {{{{0.0f}}}, {572.03f, 799.77f}, 0.0f, 1.0f, FALSE, FALSE},
13492
13493 {{{{0.0f}}}, {600.00f, 824.10f}, 0.0f, 1.0f, FALSE, FALSE},
13494 {{{{0.0f}}}, {600.00f, 824.40f}, 0.0f, 1.0f, FALSE, TRUE},
13495 {{{{0.0f}}}, {600.00f, 825.60f}, 0.0f, 1.0f, FALSE, TRUE},
13496 {{{{0.0f}}}, {600.00f, 825.90f}, 0.0f, 1.0f, FALSE, FALSE},
13497
13498 {{{{0.0f}}}, {627.97f, 799.77f}, 0.0f, 1.0f, FALSE, FALSE},
13499 {{{{0.0f}}}, {628.27f, 799.77f}, 0.0f, 1.0f, FALSE, TRUE},
13500 {{{{0.0f}}}, {629.47f, 799.77f}, 0.0f, 1.0f, FALSE, TRUE},
13501 {{{{0.0f}}}, {629.77f, 799.77f}, 0.0f, 1.0f, FALSE, FALSE},
13502
13503 /* 50. A curve with coinciding endpoints, as well as coinciding
13504 * control points. */
13505 {{{{0.0f}}}, {825.00f, 800.00f}, 0.0f, 1.0f, FALSE, TRUE},
13506 {{{{0.0f}}}, {861.00f, 824.00f}, 0.0f, 1.0f, FALSE, TRUE},
13507 {{{{0.0f}}}, {861.00f, 826.00f}, 0.0f, 1.0f, FALSE, FALSE},
13508 {{{{0.0f}}}, {862.50f, 825.00f}, 0.0f, 1.0f, FALSE, TRUE},
13509 {{{{0.0f}}}, {864.00f, 824.00f}, 0.0f, 1.0f, FALSE, FALSE},
13510 {{{{0.0f}}}, {864.00f, 826.00f}, 0.0f, 1.0f, FALSE, FALSE},
13511
13512 /* 56. Shear transforms. */
13513 {{{{1.0f, 0.0f, 1.0f, 1.0f}}}, { 837.2f, 600.0f}, 0.1f, 5.0f, TRUE, FALSE},
13514 {{{{1.0f, 0.0f, 1.0f, 1.0f}}}, { 837.5f, 600.0f}, 0.1f, 5.0f, TRUE, TRUE},
13515 {{{{1.0f, 0.0f, 1.0f, 1.0f}}}, {1186.3f, 791.7f}, 0.1f, 5.0f, TRUE, TRUE},
13516 {{{{1.0f, 0.0f, 1.0f, 1.0f}}}, {1186.6f, 791.7f}, 0.1f, 5.0f, TRUE, FALSE},
13517 {{{{1.0f, 0.0f, 1.0f, 1.0f}}}, {1425.0f, 827.3f}, 0.1f, 5.0f, TRUE, TRUE},
13518 {{{{1.0f, 0.0f, 1.0f, 1.0f}}}, {1425.0f, 827.6f}, 0.1f, 5.0f, TRUE, FALSE},
13519 {{{{1.0f, 0.0f, 1.0f, 1.0f}}}, {1620.1f, 800.0f}, 0.1f, 5.0f, TRUE, FALSE},
13520 {{{{1.0f, 0.0f, 1.0f, 1.0f}}}, {1620.4f, 800.0f}, 0.1f, 5.0f, TRUE, TRUE},
13521 },
13522 transformed_tests[] =
13523 {
13524 /* 0. Stroked area hittesting. Edge. Tolerance is 0.0f */
13525 {{{{0.0f}}}, {0.74f, 2.5f}, 0.0f, 1.0f, FALSE, TRUE},
13526 {{{{0.0f}}}, {0.75f, 2.5f}, 0.0f, 1.0f, FALSE, FALSE},
13527
13528 /* 2. Stroked area hittesting. Edge. Tolerance is negative */
13529 {{{{0.0f}}}, {0.74f, 2.5f}, -1.0f, 1.0f, FALSE, TRUE},
13530 {{{{0.0f}}}, {0.75f, 2.5f}, -1.0f, 1.0f, FALSE, FALSE},
13531
13532 /* 4. Stroked area hittesting. Edge. Tolerance is close to zero */
13533 {{{{0.0f}}}, {0.501f, 2.5f}, 0.001f, 1.0f, FALSE, TRUE},
13534 {{{{0.0f}}}, {0.502f, 2.5f}, 0.001f, 1.0f, FALSE, FALSE},
13535
13536 /* 6. Stroked area hittesting. Edge. Tolerance is D2D1_DEFAULT_FLATTENING_TOLERANCE */
13537 {{{{0.0f}}}, {0.74f, 2.5f}, 0.25f, 1.0f, FALSE, TRUE},
13538 {{{{0.0f}}}, {0.75f, 2.5f}, 0.25f, 1.0f, FALSE, FALSE},
13539 };
13540
13541 if (!init_test_context(&ctx, d3d11))
13542 return;
13543
13544 set_rect(&rect, 0.0f, 0.0f, 10.0f, 20.0f);
13545 hr = ID2D1Factory_CreateRectangleGeometry(ctx.factory, &rect, &rectangle);
13546 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
13547 for (i = 0; i < ARRAY_SIZE(rectangle_tests); ++i)
13548 {
13549 const struct contains_point_test *test = &rectangle_tests[i];
13550
13551 winetest_push_context("Test %u", i);
13552
13553 contains = !test->contains;
13554 hr = ID2D1RectangleGeometry_StrokeContainsPoint(rectangle, test->point, test->stroke_width,
13555 NULL, test->matrix ? &test->transform : NULL, test->tolerance, &contains);
13556 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
13557 ok(contains == test->contains, "Got unexpected result %#x.\n", contains);
13558
13560 }
13561 ID2D1RectangleGeometry_Release(rectangle);
13562
13563 hr = ID2D1Factory_CreatePathGeometry(ctx.factory, &path);
13564 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
13565 hr = ID2D1PathGeometry_Open(path, &sink);
13566 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
13567
13568 /* A limaçon. */
13569 set_point(&point, 160.0f, 720.0f);
13570 ID2D1GeometrySink_BeginFigure(sink, point, D2D1_FIGURE_BEGIN_FILLED);
13571 cubic_to(sink, 119.0f, 720.0f, 83.0f, 600.0f, 80.0f, 474.0f);
13572 cubic_to(sink, 78.0f, 349.0f, 108.0f, 245.0f, 135.0f, 240.0f);
13573 cubic_to(sink, 163.0f, 235.0f, 180.0f, 318.0f, 176.0f, 370.0f);
13574 cubic_to(sink, 171.0f, 422.0f, 149.0f, 422.0f, 144.0f, 370.0f);
13575 cubic_to(sink, 140.0f, 318.0f, 157.0f, 235.0f, 185.0f, 240.0f);
13576 cubic_to(sink, 212.0f, 245.0f, 242.0f, 349.0f, 240.0f, 474.0f);
13577 cubic_to(sink, 238.0f, 600.0f, 201.0f, 720.0f, 160.0f, 720.0f);
13578 ID2D1GeometrySink_EndFigure(sink, D2D1_FIGURE_END_CLOSED);
13579
13580 /* Some straight lines. */
13581 set_point(&point, 160.0f, 240.0f);
13582 ID2D1GeometrySink_BeginFigure(sink, point, D2D1_FIGURE_BEGIN_FILLED);
13583 line_to(sink, 240.0f, 240.0f);
13584 line_to(sink, 240.0f, 720.0f);
13585 line_to(sink, 160.0f, 720.0f);
13586 ID2D1GeometrySink_EndFigure(sink, D2D1_FIGURE_END_OPEN);
13587
13588 /* Projected control points extending beyond the line segment through the
13589 * endpoints. */
13590 set_point(&point, 325.0f, 750.0f);
13591 ID2D1GeometrySink_BeginFigure(sink, point, D2D1_FIGURE_BEGIN_FILLED);
13592 cubic_to(sink, 250.0f, 850.0f, 450.0f, 850.0f, 375.0f, 750.0f);
13593 ID2D1GeometrySink_EndFigure(sink, D2D1_FIGURE_END_OPEN);
13594
13595 /* Coinciding endpoints. */
13596 set_point(&point, 600.0f, 750.0f);
13597 ID2D1GeometrySink_BeginFigure(sink, point, D2D1_FIGURE_BEGIN_FILLED);
13598 cubic_to(sink, 500.0f, 850.0f, 700.0f, 850.0f, 600.0f, 750.0f);
13599 ID2D1GeometrySink_EndFigure(sink, D2D1_FIGURE_END_OPEN);
13600
13601 /* Coinciding endpoints, as well as coinciding control points. */
13602 set_point(&point, 750.0f, 750.0f);
13603 ID2D1GeometrySink_BeginFigure(sink, point, D2D1_FIGURE_BEGIN_FILLED);
13604 cubic_to(sink, 900.0f, 850.0f, 900.0f, 850.0f, 750.0f, 750.0f);
13605 ID2D1GeometrySink_EndFigure(sink, D2D1_FIGURE_END_OPEN);
13606
13607 hr = ID2D1GeometrySink_Close(sink);
13608 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
13609 ID2D1GeometrySink_Release(sink);
13610
13611 for (i = 0; i < ARRAY_SIZE(path_tests); ++i)
13612 {
13613 const struct contains_point_test *test = &path_tests[i];
13614
13615 winetest_push_context("Test %u", i);
13616
13617 contains = !test->contains;
13618 hr = ID2D1PathGeometry_StrokeContainsPoint(path, test->point, test->stroke_width,
13619 NULL, test->matrix ? &test->transform : NULL, test->tolerance, &contains);
13620 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
13621 ok(contains == test->contains, "Got unexpected result %#x.\n", contains);
13622
13624 }
13625
13626 ID2D1PathGeometry_Release(path);
13627
13628 set_rect(&rect, 0.0f, 0.0f, 5.0f, 5.0f);
13629 hr = ID2D1Factory_CreateRectangleGeometry(ctx.factory, &rect, &rectangle);
13630 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
13632 scale_matrix(&matrix, 2.0f, 4.0f);
13633 hr = ID2D1Factory_CreateTransformedGeometry(ctx.factory, (ID2D1Geometry *)rectangle, &matrix,
13634 &transformed_geometry);
13635 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
13636
13637 for (i = 0; i < ARRAY_SIZE(transformed_tests); ++i)
13638 {
13639 const struct contains_point_test *test = &transformed_tests[i];
13640
13641 winetest_push_context("Test %u", i);
13642
13643 contains = !test->contains;
13644 hr = ID2D1TransformedGeometry_StrokeContainsPoint(transformed_geometry, test->point,
13645 test->stroke_width, NULL, test->matrix ? &test->transform : NULL, test->tolerance,
13646 &contains);
13647 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
13648 ok(contains == test->contains, "Got unexpected result %#x.\n", contains);
13649
13651 }
13652 ID2D1TransformedGeometry_Release(transformed_geometry);
13653 ID2D1RectangleGeometry_Release(rectangle);
13654
13656}

Referenced by START_TEST().

◆ test_stroke_style()

static void test_stroke_style ( BOOL  d3d11)
static

Definition at line 6881 of file d2d1.c.

6882{
6883 static const struct
6884 {
6885 D2D1_DASH_STYLE dash_style;
6886 UINT32 dash_count;
6887 float dashes[6];
6888 }
6889 dash_style_tests[] =
6890 {
6892 {D2D1_DASH_STYLE_DASH, 2, {2.0f, 2.0f}},
6893 {D2D1_DASH_STYLE_DOT, 2, {0.0f, 2.0f}},
6894 {D2D1_DASH_STYLE_DASH_DOT, 4, {2.0f, 2.0f, 0.0f, 2.0f}},
6895 {D2D1_DASH_STYLE_DASH_DOT_DOT, 6, {2.0f, 2.0f, 0.0f, 2.0f, 0.0f, 2.0f}},
6896 };
6898 struct d2d1_test_context ctx;
6900 UINT32 count;
6901 HRESULT hr;
6902 D2D1_CAP_STYLE cap_style;
6903 D2D1_LINE_JOIN line_join;
6904 float miter_limit, dash_offset;
6905 D2D1_DASH_STYLE dash_style;
6906 unsigned int i;
6907 float dashes[2];
6908
6909 if (!init_test_context(&ctx, d3d11))
6910 return;
6911
6912 desc.startCap = D2D1_CAP_STYLE_SQUARE;
6913 desc.endCap = D2D1_CAP_STYLE_ROUND;
6914 desc.dashCap = D2D1_CAP_STYLE_TRIANGLE;
6915 desc.lineJoin = D2D1_LINE_JOIN_BEVEL;
6916 desc.miterLimit = 1.5f;
6917 desc.dashStyle = D2D1_DASH_STYLE_DOT;
6918 desc.dashOffset = -1.0f;
6919
6920 hr = ID2D1Factory_CreateStrokeStyle(ctx.factory, &desc, NULL, 0, &style);
6921 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
6922
6923 cap_style = ID2D1StrokeStyle_GetStartCap(style);
6924 ok(cap_style == D2D1_CAP_STYLE_SQUARE, "Unexpected cap style %d.\n", cap_style);
6925 cap_style = ID2D1StrokeStyle_GetEndCap(style);
6926 ok(cap_style == D2D1_CAP_STYLE_ROUND, "Unexpected cap style %d.\n", cap_style);
6927 cap_style = ID2D1StrokeStyle_GetDashCap(style);
6928 ok(cap_style == D2D1_CAP_STYLE_TRIANGLE, "Unexpected cap style %d.\n", cap_style);
6929 line_join = ID2D1StrokeStyle_GetLineJoin(style);
6930 ok(line_join == D2D1_LINE_JOIN_BEVEL, "Unexpected line joind %d.\n", line_join);
6931 miter_limit = ID2D1StrokeStyle_GetMiterLimit(style);
6932 ok(miter_limit == 1.5f, "Unexpected miter limit %f.\n", miter_limit);
6933 dash_style = ID2D1StrokeStyle_GetDashStyle(style);
6934 ok(dash_style == D2D1_DASH_STYLE_DOT, "Unexpected dash style %d.\n", dash_style);
6935 dash_offset = ID2D1StrokeStyle_GetDashOffset(style);
6936 ok(dash_offset == -1.0f, "Unexpected dash offset %f.\n", dash_offset);
6937
6938 /* Custom dash pattern, no dashes data specified. */
6939 desc.startCap = D2D1_CAP_STYLE_SQUARE;
6940 desc.endCap = D2D1_CAP_STYLE_ROUND;
6941 desc.dashCap = D2D1_CAP_STYLE_TRIANGLE;
6942 desc.lineJoin = D2D1_LINE_JOIN_BEVEL;
6943 desc.miterLimit = 1.5f;
6944 desc.dashStyle = D2D1_DASH_STYLE_CUSTOM;
6945 desc.dashOffset = 0.0f;
6946
6947 ID2D1StrokeStyle_Release(style);
6948
6949 hr = ID2D1Factory_CreateStrokeStyle(ctx.factory, &desc, NULL, 0, &style);
6950 ok(hr == E_INVALIDARG, "Got unexpected hr %#lx.\n", hr);
6951
6952 hr = ID2D1Factory_CreateStrokeStyle(ctx.factory, &desc, dashes, 0, &style);
6953 ok(hr == E_INVALIDARG, "Got unexpected hr %#lx.\n", hr);
6954
6955 hr = ID2D1Factory_CreateStrokeStyle(ctx.factory, &desc, dashes, 1, &style);
6956 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
6957 ID2D1StrokeStyle_Release(style);
6958
6959 /* Builtin style, dashes are specified. */
6960 desc.dashStyle = D2D1_DASH_STYLE_DOT;
6961 hr = ID2D1Factory_CreateStrokeStyle(ctx.factory, &desc, dashes, 1, &style);
6962 ok(hr == E_INVALIDARG, "Got unexpected hr %#lx.\n", hr);
6963
6964 /* Invalid style. */
6965 desc.dashStyle = 100;
6966 hr = ID2D1Factory_CreateStrokeStyle(ctx.factory, &desc, NULL, 0, &style);
6967 ok(hr == E_INVALIDARG, "Got unexpected hr %#lx.\n", hr);
6968
6969 /* Test returned dash pattern for builtin styles. */
6970 desc.startCap = D2D1_CAP_STYLE_SQUARE;
6971 desc.endCap = D2D1_CAP_STYLE_ROUND;
6972 desc.dashCap = D2D1_CAP_STYLE_TRIANGLE;
6973 desc.lineJoin = D2D1_LINE_JOIN_BEVEL;
6974 desc.miterLimit = 1.5f;
6975 desc.dashOffset = 0.0f;
6976
6977 for (i = 0; i < ARRAY_SIZE(dash_style_tests); ++i)
6978 {
6979 float dashes[10];
6980 UINT dash_count;
6981
6982 desc.dashStyle = dash_style_tests[i].dash_style;
6983
6984 hr = ID2D1Factory_CreateStrokeStyle(ctx.factory, &desc, NULL, 0, &style);
6985 ok(hr == S_OK, "Test %u: Got unexpected hr %#lx.\n", i, hr);
6986
6987 dash_count = ID2D1StrokeStyle_GetDashesCount(style);
6988 ok(dash_count == dash_style_tests[i].dash_count, "%u: unexpected dash count %u, expected %u.\n",
6989 i, dash_count, dash_style_tests[i].dash_count);
6990 ok(dash_count < ARRAY_SIZE(dashes), "%u: unexpectedly large dash count %u.\n", i, dash_count);
6991 if (dash_count == dash_style_tests[i].dash_count)
6992 {
6993 unsigned int j;
6994
6995 ID2D1StrokeStyle_GetDashes(style, dashes, dash_count);
6996 ok(!memcmp(dashes, dash_style_tests[i].dashes, sizeof(*dashes) * dash_count),
6997 "%u: unexpected dash array.\n", i);
6998
6999 /* Ask for more dashes than style actually has. */
7000 memset(dashes, 0xcc, sizeof(dashes));
7001 ID2D1StrokeStyle_GetDashes(style, dashes, ARRAY_SIZE(dashes));
7002 ok(!memcmp(dashes, dash_style_tests[i].dashes, sizeof(*dashes) * dash_count),
7003 "%u: unexpected dash array.\n", i);
7004
7005 for (j = dash_count; j < ARRAY_SIZE(dashes); ++j)
7006 ok(dashes[j] == 0.0f, "%u: unexpected dash value at %u.\n", i, j);
7007 }
7008
7009 ID2D1StrokeStyle_Release(style);
7010 }
7011
7012 /* NULL dashes array, non-zero length. */
7013 memset(&desc, 0, sizeof(desc));
7014 hr = ID2D1Factory_CreateStrokeStyle(ctx.factory, &desc, NULL, 1, &style);
7015 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
7016
7017 count = ID2D1StrokeStyle_GetDashesCount(style);
7018 ok(count == 0, "Unexpected dashes count %u.\n", count);
7019
7020 ID2D1StrokeStyle_Release(style);
7021
7023}
D2D1_CAP_STYLE
Definition: d2d1.idl:113
D2D1_LINE_JOIN
Definition: d2d1.idl:122
D2D1_DASH_STYLE
Definition: d2d1.idl:131
@ D2D1_DASH_STYLE_DASH_DOT
Definition: d2d1.idl:135
@ D2D1_DASH_STYLE_DASH
Definition: d2d1.idl:133
@ D2D1_DASH_STYLE_CUSTOM
Definition: d2d1.idl:137
@ D2D1_DASH_STYLE_SOLID
Definition: d2d1.idl:132
@ D2D1_DASH_STYLE_DASH_DOT_DOT
Definition: d2d1.idl:136
Definition: style.c:91

Referenced by START_TEST().

◆ test_transform_graph()

static void test_transform_graph ( BOOL  d3d11)
static

Definition at line 12829 of file d2d1.c.

12830{
12831 ID2D1OffsetTransform *offset_transform = NULL;
12832 ID2D1BlendTransform *blend_transform = NULL;
12833 D2D1_BLEND_DESCRIPTION blend_desc = {0};
12834 ID2D1EffectContext *effect_context;
12835 struct d2d1_test_context ctx;
12838 POINT point = {0 ,0};
12839 ID2D1Effect *effect;
12840 UINT i, count;
12841 HRESULT hr;
12842
12844 {
12845 {L"Context", NULL, effect_impl_get_context},
12846 {L"Graph", NULL, effect_impl_get_graph},
12847 };
12848
12849 if (!init_test_context(&ctx, d3d11))
12850 return;
12851
12852 factory = ctx.factory1;
12853 if (!factory)
12854 {
12855 win_skip("ID2D1Factory1 is not supported.\n");
12857 return;
12858 }
12859
12860 hr = ID2D1Factory1_RegisterEffectFromString(factory, &CLSID_TestEffect,
12862 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
12863
12864 hr = ID2D1DeviceContext_CreateEffect(ctx.context, &CLSID_TestEffect, &effect);
12865 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
12866
12867 hr = ID2D1Effect_GetValueByName(effect, L"Graph", D2D1_PROPERTY_TYPE_IUNKNOWN, (BYTE *)&graph, sizeof(graph));
12868 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
12869 hr = ID2D1Effect_GetValueByName(effect, L"Context",
12870 D2D1_PROPERTY_TYPE_IUNKNOWN, (BYTE *)&effect_context, sizeof(effect_context));
12871 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
12872
12873 count = ID2D1TransformGraph_GetInputCount(graph);
12874 ok(count == 1, "Unexpected input count %u.\n", count);
12875
12876 /* Create transforms */
12877 hr = ID2D1EffectContext_CreateOffsetTransform(effect_context, point, &offset_transform);
12878 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
12879 hr = ID2D1EffectContext_CreateBlendTransform(effect_context, 2, &blend_desc, &blend_transform);
12880 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
12881
12882 /* Add nodes */
12883 hr = ID2D1TransformGraph_ConnectToEffectInput(graph, 1, (ID2D1TransformNode *)offset_transform, 0);
12884 ok(hr == HRESULT_FROM_WIN32(ERROR_NOT_FOUND), "Got unexpected hr %#lx.\n", hr);
12885 hr = ID2D1TransformGraph_SetOutputNode(graph, (ID2D1TransformNode *)offset_transform);
12886 ok(hr == HRESULT_FROM_WIN32(ERROR_NOT_FOUND), "Got unexpected hr %#lx.\n", hr);
12887
12888 /* Single input effect, single input node. */
12889 hr = ID2D1TransformGraph_SetSingleTransformNode(graph, (ID2D1TransformNode *)offset_transform);
12890 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
12891
12892 /* Single input effect, two-input node. */
12893 hr = ID2D1TransformGraph_SetSingleTransformNode(graph, (ID2D1TransformNode *)blend_transform);
12894 ok(hr == E_INVALIDARG, "Got unexpected hr %#lx.\n", hr);
12895 hr = ID2D1TransformGraph_AddNode(graph, (ID2D1TransformNode *)blend_transform);
12896 ok(hr == E_INVALIDARG, "Got unexpected hr %#lx.\n", hr);
12897 ID2D1TransformGraph_Clear(graph);
12898
12899 hr = ID2D1TransformGraph_AddNode(graph, (ID2D1TransformNode *)offset_transform);
12900 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
12901 hr = ID2D1TransformGraph_AddNode(graph, (ID2D1TransformNode *)offset_transform);
12902 ok(hr == E_INVALIDARG, "Got unexpected hr %#lx.\n", hr);
12903 hr = ID2D1TransformGraph_AddNode(graph, (ID2D1TransformNode *)blend_transform);
12904 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
12905
12906 /* Invalid effect input index. */
12907 hr = ID2D1TransformGraph_ConnectToEffectInput(graph, 1, (ID2D1TransformNode *)offset_transform, 0);
12908 ok(hr == E_INVALIDARG, "Got unexpected hr %#lx.\n", hr);
12909 /* Invalid object input index. */
12910 hr = ID2D1TransformGraph_ConnectToEffectInput(graph, 0, (ID2D1TransformNode *)offset_transform, 1);
12911 ok(hr == E_INVALIDARG, "Got unexpected hr %#lx.\n", hr);
12912 hr = ID2D1TransformGraph_ConnectToEffectInput(graph, 0, (ID2D1TransformNode *)offset_transform, 0);
12913 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
12914 hr = ID2D1TransformGraph_SetOutputNode(graph, (ID2D1TransformNode *)offset_transform);
12915 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
12916
12917 /* Remove nodes */
12918 hr = ID2D1TransformGraph_RemoveNode(graph, (ID2D1TransformNode *)offset_transform);
12919 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
12920 hr = ID2D1TransformGraph_RemoveNode(graph, (ID2D1TransformNode *)offset_transform);
12921 ok(hr == HRESULT_FROM_WIN32(ERROR_NOT_FOUND), "Got unexpected hr %#lx.\n", hr);
12922 hr = ID2D1TransformGraph_RemoveNode(graph, (ID2D1TransformNode *)blend_transform);
12923 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
12924
12925 /* Connect nodes which are both un-added */
12926 ID2D1TransformGraph_Clear(graph);
12927 hr = ID2D1TransformGraph_ConnectNode(graph,
12928 (ID2D1TransformNode *)offset_transform, (ID2D1TransformNode *)blend_transform, 0);
12929 ok(hr == HRESULT_FROM_WIN32(ERROR_NOT_FOUND), "Got unexpected hr %#lx.\n", hr);
12930
12931 /* Connect added node to un-added node */
12932 hr = ID2D1TransformGraph_AddNode(graph, (ID2D1TransformNode *)offset_transform);
12933 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
12934 hr = ID2D1TransformGraph_ConnectNode(graph,
12935 (ID2D1TransformNode *)offset_transform, (ID2D1TransformNode *)blend_transform, 0);
12936 ok(hr == HRESULT_FROM_WIN32(ERROR_NOT_FOUND), "Got unexpected hr %#lx.\n", hr);
12937
12938 /* Connect un-added node to added node */
12939 ID2D1TransformGraph_Clear(graph);
12940 hr = ID2D1TransformGraph_AddNode(graph, (ID2D1TransformNode *)blend_transform);
12941 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
12942 hr = ID2D1TransformGraph_ConnectNode(graph,
12943 (ID2D1TransformNode *)offset_transform, (ID2D1TransformNode *)blend_transform, 0);
12944 ok(hr == HRESULT_FROM_WIN32(ERROR_NOT_FOUND), "Got unexpected hr %#lx.\n", hr);
12945
12946 /* Connect nodes */
12947 ID2D1TransformGraph_Clear(graph);
12948 hr = ID2D1TransformGraph_AddNode(graph, (ID2D1TransformNode *)offset_transform);
12949 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
12950 hr = ID2D1TransformGraph_AddNode(graph, (ID2D1TransformNode *)blend_transform);
12951 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
12952 count = ID2D1BlendTransform_GetInputCount(blend_transform);
12953 for (i = 0; i < count; ++i)
12954 {
12955 hr = ID2D1TransformGraph_ConnectNode(graph,
12956 (ID2D1TransformNode *)offset_transform, (ID2D1TransformNode *)blend_transform, i);
12957 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
12958 }
12959
12960 /* Connect node to out-of-bounds index */
12961 hr = ID2D1TransformGraph_ConnectNode(graph,
12962 (ID2D1TransformNode *)offset_transform, (ID2D1TransformNode *)blend_transform, count);
12963 ok(hr == E_INVALIDARG, "Got unexpected hr %#lx.\n", hr);
12964
12965 /* Passthrough graph. */
12966 hr = ID2D1TransformGraph_SetPassthroughGraph(graph, 100);
12967 ok(hr == E_INVALIDARG, "Got unexpected hr %#lx.\n", hr);
12968
12969 hr = ID2D1TransformGraph_SetPassthroughGraph(graph, 0);
12970 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
12971
12972 ID2D1BlendTransform_Release(blend_transform);
12973 ID2D1OffsetTransform_Release(offset_transform);
12974 ID2D1Effect_Release(effect);
12975 hr = ID2D1Factory1_UnregisterEffect(factory, &CLSID_TestEffect);
12976 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
12978}

Referenced by START_TEST().

◆ test_unit_mode()

static void test_unit_mode ( BOOL  d3d11)
static

Definition at line 10460 of file d2d1.c.

10461{
10462 struct d2d1_test_context ctx;
10464 D2D1_UNIT_MODE unit_mode;
10465
10466 if (!init_test_context(&ctx, d3d11))
10467 return;
10468
10469 context = ctx.context;
10470
10471 unit_mode = ID2D1DeviceContext_GetUnitMode(context);
10472 ok(unit_mode == D2D1_UNIT_MODE_DIPS, "Got unexpected unit mode %#x.\n", unit_mode);
10473
10474 ID2D1DeviceContext_SetUnitMode(context, 0xdeadbeef);
10475 unit_mode = ID2D1DeviceContext_GetUnitMode(context);
10476 ok(unit_mode == D2D1_UNIT_MODE_DIPS, "Got unexpected unit mode %#x.\n", unit_mode);
10477
10478 ID2D1DeviceContext_SetUnitMode(context, D2D1_UNIT_MODE_PIXELS);
10479 unit_mode = ID2D1DeviceContext_GetUnitMode(context);
10480 ok(unit_mode == D2D1_UNIT_MODE_PIXELS, "Got unexpected unit mode %#x.\n", unit_mode);
10481
10482 ID2D1DeviceContext_SetUnitMode(context, 0xdeadbeef);
10483 unit_mode = ID2D1DeviceContext_GetUnitMode(context);
10484 ok(unit_mode == D2D1_UNIT_MODE_PIXELS, "Got unexpected unit mode %#x.\n", unit_mode);
10485
10487}

Referenced by START_TEST().

◆ test_wic_bitmap_format()

static void test_wic_bitmap_format ( BOOL  d3d11)
static

Definition at line 10489 of file d2d1.c.

10490{
10491 IWICImagingFactory *wic_factory;
10492 struct d2d1_test_context ctx;
10494 IWICBitmap *wic_bitmap;
10497 unsigned int i;
10498 HRESULT hr;
10499
10500 static const struct
10501 {
10502 const WICPixelFormatGUID *wic;
10504 }
10505 tests[] =
10506 {
10507 {&GUID_WICPixelFormat32bppPBGRA, {DXGI_FORMAT_B8G8R8A8_UNORM, D2D1_ALPHA_MODE_PREMULTIPLIED}},
10508 {&GUID_WICPixelFormat32bppPRGBA, {DXGI_FORMAT_R8G8B8A8_UNORM, D2D1_ALPHA_MODE_PREMULTIPLIED}},
10509 {&GUID_WICPixelFormat32bppBGR, {DXGI_FORMAT_B8G8R8A8_UNORM, D2D1_ALPHA_MODE_IGNORE}},
10510 {&GUID_WICPixelFormat32bppRGB, {DXGI_FORMAT_R8G8B8A8_UNORM, D2D1_ALPHA_MODE_IGNORE}},
10511 };
10512
10513 if (!init_test_context(&ctx, d3d11))
10514 return;
10515
10516 rt = ctx.rt;
10518
10519 hr = CoCreateInstance(&CLSID_WICImagingFactory, NULL, CLSCTX_INPROC_SERVER,
10520 &IID_IWICImagingFactory, (void **)&wic_factory);
10521 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
10522
10523 for (i = 0; i < ARRAY_SIZE(tests); ++i)
10524 {
10525 hr = IWICImagingFactory_CreateBitmap(wic_factory, 16, 16,
10526 tests[i].wic, WICBitmapCacheOnDemand, &wic_bitmap);
10527 ok(hr == S_OK, "%s: Got unexpected hr %#lx.\n", debugstr_guid(tests[i].wic), hr);
10528
10529 hr = ID2D1RenderTarget_CreateBitmapFromWicBitmap(rt, (IWICBitmapSource *)wic_bitmap, NULL, &bitmap);
10530 ok(hr == S_OK, "%s: Got unexpected hr %#lx.\n", debugstr_guid(tests[i].wic), hr);
10531
10532 format = ID2D1Bitmap_GetPixelFormat(bitmap);
10533 ok(format.format == tests[i].d2d.format, "%s: Got unexpected DXGI format %#x.\n",
10534 debugstr_guid(tests[i].wic), format.format);
10535 ok(format.alphaMode == tests[i].d2d.alphaMode, "%s: Got unexpected alpha mode %#x.\n",
10536 debugstr_guid(tests[i].wic), format.alphaMode);
10537
10538 ID2D1Bitmap_Release(bitmap);
10539 IWICBitmap_Release(wic_bitmap);
10540 }
10541
10542 IWICImagingFactory_Release(wic_factory);
10545}
static struct test_info tests[]

Referenced by START_TEST().

◆ test_wic_gdi_interop()

static void test_wic_gdi_interop ( BOOL  d3d11)
static

Definition at line 8815 of file d2d1.c.

8816{
8819 IWICImagingFactory *wic_factory;
8820 struct d2d1_test_context ctx;
8821 IWICBitmapLock *wic_lock;
8822 IWICBitmap *wic_bitmap;
8825 HRESULT hr;
8826 BOOL match;
8827 RECT rect;
8828 HDC dc;
8829
8830 if (!init_test_context(&ctx, d3d11))
8831 return;
8832
8834 hr = CoCreateInstance(&CLSID_WICImagingFactory, NULL, CLSCTX_INPROC_SERVER,
8835 &IID_IWICImagingFactory, (void **)&wic_factory);
8836 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
8837 hr = IWICImagingFactory_CreateBitmap(wic_factory, 16, 16,
8838 &GUID_WICPixelFormat32bppPBGRA, WICBitmapCacheOnDemand, &wic_bitmap);
8839 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
8840 IWICImagingFactory_Release(wic_factory);
8841
8842 /* WIC target, default usage */
8844 desc.pixelFormat.format = DXGI_FORMAT_UNKNOWN;
8845 desc.pixelFormat.alphaMode = D2D1_ALPHA_MODE_PREMULTIPLIED;
8846 desc.dpiX = 0.0f;
8847 desc.dpiY = 0.0f;
8850
8851 hr = ID2D1Factory_CreateWicBitmapRenderTarget(ctx.factory, wic_bitmap, &desc, &rt);
8852 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
8853
8854 hr = ID2D1RenderTarget_QueryInterface(rt, &IID_ID2D1GdiInteropRenderTarget, (void **)&interop);
8855 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
8856
8857 ID2D1RenderTarget_BeginDraw(rt);
8858 dc = (void *)0xdeadbeef;
8859 hr = ID2D1GdiInteropRenderTarget_GetDC(interop, D2D1_DC_INITIALIZE_MODE_COPY, &dc);
8860 ok(hr == D2DERR_TARGET_NOT_GDI_COMPATIBLE, "Got unexpected hr %#lx.\n", hr);
8861 ok(!dc, "Got unexpected DC %p.\n", dc);
8862 ID2D1GdiInteropRenderTarget_Release(interop);
8863 hr = ID2D1RenderTarget_EndDraw(rt, NULL, NULL);
8864 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
8865
8866 ID2D1RenderTarget_Release(rt);
8867
8868 /* WIC target, gdi compatible */
8870
8871 hr = ID2D1Factory_CreateWicBitmapRenderTarget(ctx.factory, wic_bitmap, &desc, &rt);
8872 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
8873
8874 hr = ID2D1RenderTarget_QueryInterface(rt, &IID_ID2D1GdiInteropRenderTarget, (void **)&interop);
8875 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
8876
8877 ID2D1RenderTarget_BeginDraw(rt);
8878 dc = NULL;
8879 hr = ID2D1GdiInteropRenderTarget_GetDC(interop, D2D1_DC_INITIALIZE_MODE_COPY, &dc);
8880 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
8881 ok(dc != NULL, "Expected NULL dc, got %p.\n", dc);
8882 hr = ID2D1GdiInteropRenderTarget_ReleaseDC(interop, NULL);
8883 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
8884 hr = ID2D1RenderTarget_EndDraw(rt, NULL, NULL);
8885 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
8886
8887 ID2D1RenderTarget_BeginDraw(rt);
8888 set_color(&color, 1.0f, 0.0f, 0.0f, 1.0f);
8889 ID2D1RenderTarget_Clear(rt, &color);
8890 hr = ID2D1RenderTarget_EndDraw(rt, NULL, NULL);
8891 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
8892
8893 match = compare_wic_bitmap(wic_bitmap, "54034063dbc1c1bb61cb60ec57e4498678dc2b13");
8894 ok(match, "Bitmap does not match.\n");
8895
8896 /* Do solid fill using GDI */
8897 ID2D1RenderTarget_BeginDraw(rt);
8898
8899 hr = ID2D1GdiInteropRenderTarget_GetDC(interop, D2D1_DC_INITIALIZE_MODE_COPY, &dc);
8900 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
8901
8902 SetRect(&rect, 0, 0, 16, 16);
8904 hr = ID2D1GdiInteropRenderTarget_ReleaseDC(interop, NULL);
8905 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
8906
8907 hr = ID2D1RenderTarget_EndDraw(rt, NULL, NULL);
8908 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
8909
8910 match = compare_wic_bitmap(wic_bitmap, "60cacbf3d72e1e7834203da608037b1bf83b40e8");
8911 ok(match, "Bitmap does not match.\n");
8912
8913 /* Bitmap is locked at BeginDraw(). */
8914 hr = IWICBitmap_Lock(wic_bitmap, NULL, WICBitmapLockRead, &wic_lock);
8915 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
8916 IWICBitmapLock_Release(wic_lock);
8917
8918 ID2D1RenderTarget_BeginDraw(rt);
8919 hr = IWICBitmap_Lock(wic_bitmap, NULL, WICBitmapLockRead, &wic_lock);
8920 todo_wine ok(hr == WINCODEC_ERR_ALREADYLOCKED, "Got unexpected hr %#lx.\n", hr);
8921 if (SUCCEEDED(hr))
8922 IWICBitmapLock_Release(wic_lock);
8923 hr = ID2D1RenderTarget_EndDraw(rt, NULL, NULL);
8924 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
8925
8926 /* Lock before BeginDraw(). */
8927 hr = IWICBitmap_Lock(wic_bitmap, NULL, WICBitmapLockRead, &wic_lock);
8928 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
8929 ID2D1RenderTarget_BeginDraw(rt);
8930 hr = ID2D1RenderTarget_EndDraw(rt, NULL, NULL);
8931 todo_wine ok(hr == WINCODEC_ERR_ALREADYLOCKED, "Got unexpected hr %#lx.\n", hr);
8932 IWICBitmapLock_Release(wic_lock);
8933
8934 ID2D1GdiInteropRenderTarget_Release(interop);
8935 ID2D1RenderTarget_Release(rt);
8936
8937 IWICBitmap_Release(wic_bitmap);
8939
8941}
static BOOL compare_wic_bitmap(IWICBitmap *bitmap, const char *ref_sha1)
Definition: d2d1.c:892
#define WINCODEC_ERR_ALREADYLOCKED
Definition: winerror.h:7297
HGDIOBJ WINAPI GetStockObject(_In_ int)
#define BLACK_BRUSH
Definition: wingdi.h:896
int WINAPI FillRect(HDC, LPCRECT, HBRUSH)

Referenced by START_TEST().

◆ test_wic_target_format()

static void test_wic_target_format ( BOOL  d3d11)
static

Definition at line 15250 of file d2d1.c.

15251{
15252 static const struct
15253 {
15255 const GUID *wic_format;
15256 HRESULT hr;
15257 }
15258 wic_target_formats[] =
15259 {
15260 { { DXGI_FORMAT_UNKNOWN, D2D1_ALPHA_MODE_PREMULTIPLIED },
15261 &GUID_WICPixelFormat32bppPBGRA },
15262 { { DXGI_FORMAT_UNKNOWN, D2D1_ALPHA_MODE_IGNORE },
15263 &GUID_WICPixelFormat32bppBGR },
15264 { { DXGI_FORMAT_UNKNOWN, D2D1_ALPHA_MODE_UNKNOWN },
15265 &GUID_WICPixelFormat32bppPBGRA },
15266 { { DXGI_FORMAT_UNKNOWN, D2D1_ALPHA_MODE_UNKNOWN },
15267 &GUID_WICPixelFormat32bppBGR },
15268
15269 { { DXGI_FORMAT_B8G8R8A8_UNORM, D2D1_ALPHA_MODE_PREMULTIPLIED },
15270 &GUID_WICPixelFormat32bppPBGRA },
15271 { { DXGI_FORMAT_B8G8R8A8_UNORM, D2D1_ALPHA_MODE_IGNORE },
15272 &GUID_WICPixelFormat32bppBGR },
15273 { { DXGI_FORMAT_B8G8R8A8_UNORM, D2D1_ALPHA_MODE_UNKNOWN },
15274 &GUID_WICPixelFormat32bppPBGRA },
15275 { { DXGI_FORMAT_B8G8R8A8_UNORM, D2D1_ALPHA_MODE_UNKNOWN },
15276 &GUID_WICPixelFormat32bppBGR },
15277
15278 { { DXGI_FORMAT_UNKNOWN, D2D1_ALPHA_MODE_PREMULTIPLIED },
15279 &GUID_WICPixelFormat32bppPRGBA },
15280 { { DXGI_FORMAT_UNKNOWN, D2D1_ALPHA_MODE_IGNORE },
15281 &GUID_WICPixelFormat32bppRGB },
15282 { { DXGI_FORMAT_UNKNOWN, D2D1_ALPHA_MODE_UNKNOWN },
15283 &GUID_WICPixelFormat32bppPRGBA },
15284 { { DXGI_FORMAT_UNKNOWN, D2D1_ALPHA_MODE_UNKNOWN },
15285 &GUID_WICPixelFormat32bppRGB },
15286
15287 { { DXGI_FORMAT_R8G8B8A8_UNORM, D2D1_ALPHA_MODE_PREMULTIPLIED },
15288 &GUID_WICPixelFormat32bppPRGBA },
15289 { { DXGI_FORMAT_R8G8B8A8_UNORM, D2D1_ALPHA_MODE_IGNORE },
15290 &GUID_WICPixelFormat32bppRGB },
15291 { { DXGI_FORMAT_R8G8B8A8_UNORM, D2D1_ALPHA_MODE_UNKNOWN },
15292 &GUID_WICPixelFormat32bppPRGBA },
15293 { { DXGI_FORMAT_R8G8B8A8_UNORM, D2D1_ALPHA_MODE_UNKNOWN },
15294 &GUID_WICPixelFormat32bppRGB },
15295
15296 { { DXGI_FORMAT_R8G8B8A8_UNORM, D2D1_ALPHA_MODE_PREMULTIPLIED },
15297 &GUID_WICPixelFormat32bppPBGRA, E_INVALIDARG },
15298 { { DXGI_FORMAT_R8G8B8A8_UNORM, D2D1_ALPHA_MODE_IGNORE },
15299 &GUID_WICPixelFormat32bppBGR, E_INVALIDARG },
15300 { { DXGI_FORMAT_R8G8B8A8_UNORM, D2D1_ALPHA_MODE_UNKNOWN },
15301 &GUID_WICPixelFormat32bppPBGRA, E_INVALIDARG },
15302 { { DXGI_FORMAT_R8G8B8A8_UNORM, D2D1_ALPHA_MODE_UNKNOWN },
15303 &GUID_WICPixelFormat32bppBGR, E_INVALIDARG },
15304
15305 { { DXGI_FORMAT_B8G8R8A8_UNORM, D2D1_ALPHA_MODE_PREMULTIPLIED },
15306 &GUID_WICPixelFormat32bppBGR, E_INVALIDARG },
15307 { { DXGI_FORMAT_B8G8R8A8_UNORM, D2D1_ALPHA_MODE_IGNORE },
15308 &GUID_WICPixelFormat32bppPBGRA, E_INVALIDARG },
15309 };
15311 IWICImagingFactory *wic_factory;
15312 struct d2d1_test_context ctx;
15313 IWICBitmap *wic_bitmap;
15315 unsigned int i;
15316 HRESULT hr;
15317
15318 if (!init_test_context(&ctx, d3d11))
15319 return;
15320
15322 hr = CoCreateInstance(&CLSID_WICImagingFactory, NULL, CLSCTX_INPROC_SERVER,
15323 &IID_IWICImagingFactory, (void **)&wic_factory);
15324 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
15325
15326 for (i = 0; i < ARRAY_SIZE(wic_target_formats); ++i)
15327 {
15328 winetest_push_context("Test %u", i);
15329
15330 hr = IWICImagingFactory_CreateBitmap(wic_factory, 16, 16,
15331 wic_target_formats[i].wic_format, WICBitmapCacheOnDemand, &wic_bitmap);
15332 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
15333
15335 rt_desc.pixelFormat = wic_target_formats[i].pixel_format;
15336 rt_desc.dpiX = 96.0f;
15337 rt_desc.dpiY = 96.0f;
15340 hr = ID2D1Factory_CreateWicBitmapRenderTarget(ctx.factory, wic_bitmap, &rt_desc, &rt);
15341 todo_wine_if(FAILED(wic_target_formats[i].hr))
15342 ok(hr == wic_target_formats[i].hr, "Got unexpected hr %#lx.\n", hr);
15343
15344 IWICBitmap_Release(wic_bitmap);
15345
15346 if (SUCCEEDED(hr))
15347 ID2D1RenderTarget_Release(rt);
15348
15350 }
15351 IWICImagingFactory_Release(wic_factory);
15352
15355}
const WICPixelFormatGUID * wic_format
Definition: image.c:47

Referenced by START_TEST().

◆ thread_func()

static DWORD WINAPI thread_func ( void *  ctx)
static

Definition at line 434 of file d2d1.c.

435{
436 LONG *i = ctx, j;
437
438 while (*i < mt_test_count)
439 {
440 j = *i;
441 if (InterlockedCompareExchange(i, j + 1, j) == j)
442 mt_tests[j].test(mt_tests[j].d3d11);
443 }
444
445 return 0;
446}
#define InterlockedCompareExchange
Definition: interlocked.h:119

Referenced by run_queued_tests().

◆ translate_matrix()

◆ void()

static void ( WINAPI *  pD2D1SinCos)
static

Variable Documentation

◆ c

Definition at line 300 of file d2d1.c.

Referenced by test_math().

◆ colour

◆ custom_effect_impl_vtbl

const ID2D1EffectImplVtbl custom_effect_impl_vtbl
static
Initial value:
=
{
}
static HRESULT STDMETHODCALLTYPE ps_effect_impl_Initialize(ID2D1EffectImpl *iface, ID2D1EffectContext *context, ID2D1TransformGraph *graph)
Definition: d2d1.c:14576
static ULONG STDMETHODCALLTYPE effect_impl_AddRef(ID2D1EffectImpl *iface)
Definition: d2d1.c:11214
static HRESULT STDMETHODCALLTYPE effect_impl_QueryInterface(ID2D1EffectImpl *iface, REFIID iid, void **out)
Definition: d2d1.c:11190
static HRESULT STDMETHODCALLTYPE effect_impl_PrepareForRender(ID2D1EffectImpl *iface, D2D1_CHANGE_TYPE type)
Definition: d2d1.c:11248
static HRESULT STDMETHODCALLTYPE effect_impl_SetGraph(ID2D1EffectImpl *iface, ID2D1TransformGraph *graph)
Definition: d2d1.c:11253
static ULONG STDMETHODCALLTYPE effect_impl_Release(ID2D1EffectImpl *iface)
Definition: d2d1.c:11221

Definition at line 14588 of file d2d1.c.

Referenced by create_custom_shader_effect().

◆ custom_shader_effect_draw_transform_vtbl

const ID2D1DrawTransformVtbl custom_shader_effect_draw_transform_vtbl
static
Initial value:
=
{
}
static ULONG STDMETHODCALLTYPE effect_impl_draw_transform_AddRef(ID2D1DrawTransform *iface)
Definition: d2d1.c:14605
static HRESULT STDMETHODCALLTYPE effect_impl_draw_transform_MapOutputRectToInputRects(ID2D1DrawTransform *iface, const D2D1_RECT_L *output_rect, D2D1_RECT_L *input_rects, UINT32 input_rect_count)
Definition: d2d1.c:14622
static HRESULT STDMETHODCALLTYPE effect_impl_draw_transform_QueryInterface(ID2D1DrawTransform *iface, REFIID iid, void **out)
Definition: d2d1.c:14598
static HRESULT STDMETHODCALLTYPE effect_impl_draw_transform_MapInputRectsToOutputRect(ID2D1DrawTransform *iface, const D2D1_RECT_L *input_rects, const D2D1_RECT_L *input_opaque_rects, UINT32 input_rect_count, D2D1_RECT_L *output_rect, D2D1_RECT_L *output_opaque_rect)
Definition: d2d1.c:14633
static UINT32 STDMETHODCALLTYPE effect_impl_draw_transform_GetInputCount(ID2D1DrawTransform *iface)
Definition: d2d1.c:14617
static HRESULT STDMETHODCALLTYPE effect_impl_draw_transform_MapInvalidRect(ID2D1DrawTransform *iface, UINT32 index, D2D1_RECT_L input_rect, D2D1_RECT_L *output_rect)
Definition: d2d1.c:14646
static ULONG STDMETHODCALLTYPE effect_impl_draw_transform_Release(ID2D1DrawTransform *iface)
Definition: d2d1.c:14611
static HRESULT STDMETHODCALLTYPE effect_impl_draw_transform_SetDrawInfo(ID2D1DrawTransform *iface, ID2D1DrawInfo *info)
Definition: d2d1.c:14653

Definition at line 14689 of file d2d1.c.

Referenced by create_custom_shader_effect().

◆ device

◆ dst_colour_space

D2D1_COLOR_SPACE dst_colour_space

Definition at line 304 of file d2d1.c.

Referenced by D2D1ConvertColorSpace().

◆ effect_impl_vtbl

const ID2D1EffectImplVtbl effect_impl_vtbl
static
Initial value:
=
{
}
static HRESULT STDMETHODCALLTYPE effect_impl_Initialize(ID2D1EffectImpl *iface, ID2D1EffectContext *context, ID2D1TransformGraph *graph)
Definition: d2d1.c:11239

Definition at line 11263 of file d2d1.c.

Referenced by effect_impl_create().

◆ effect_variable_input_count

const WCHAR* effect_variable_input_count
static
Initial value:
=
L"<?xml version='1.0'?> \
<Effect> \
<Property name='DisplayName' type='string' value='VariableInputs'/> \
<Property name='Author' type='string' value='The Wine Project'/> \
<Property name='Category' type='string' value='Test'/> \
<Property name='Description' type='string' value='Test effect.'/> \
<Inputs minimum='2' maximum='5' > \
<Input name='Source1'/> \
<Input name='Source2'/> \
<Input name='Source3'/> \
</Inputs> \
<Property name='Graph' type='iunknown'> \
<Property name='DisplayName' type='string' value='Graph'/> \
</Property> \
</Effect> \
"

Definition at line 268 of file d2d1.c.

Referenced by test_effect_register().

◆ effect_xml_a

const WCHAR* effect_xml_a
static

◆ effect_xml_b

const WCHAR* effect_xml_b
static
Initial value:
=
L"<?xml version='1.0'?> \
<Effect> \
<Property name='DisplayName' type='string' value='TestEffectB'/> \
<Property name='Author' type='string' value='The Wine Project'/> \
<Property name='Category' type='string' value='Test'/> \
<Property name='Description' type='string' value='Test effect.'/> \
<Inputs> \
<Input name='Source'/> \
</Inputs> \
<Property name='Context' type='iunknown'> \
<Property name='DisplayName' type='string' value='Context'/> \
</Property> \
</Effect> \
"

Definition at line 148 of file d2d1.c.

Referenced by preload_shader(), test_blend_transform(), test_border_transform(), test_bounds_adjustment_transform(), test_effect_context(), test_effect_properties(), test_effect_register(), test_effect_vertex_buffer(), and test_offset_transform().

◆ effect_xml_c

const WCHAR* effect_xml_c
static
Initial value:
=
L"<?xml version='1.0'?> \
<Effect> \
<Property name='DisplayName' type='string' value='TestEffectC'/> \
<Property name='Author' type='string' value='The Wine Project'/> \
<Property name='Category' type='string' value='Test'/> \
<Property name='Description' type='string' value='Test effect.'/> \
<Inputs> \
<Input name='Source'/> \
</Inputs> \
<Property name='Context' type='iunknown'> \
<Property name='DisplayName' type='string' value='Context'/> \
</Property> \
<Property name='Integer' type='uint32'> \
<Property name='DisplayName' type='string' value='Integer'/> \
</Property> \
<Property name='Graph' type='iunknown'> \
<Property name='DisplayName' type='string' value='Graph'/> \
</Property> \
</Effect> \
"

Definition at line 164 of file d2d1.c.

Referenced by test_effect_properties(), test_effect_register(), and test_transform_graph().

◆ effect_xml_minimum

const WCHAR* effect_xml_minimum
static
Initial value:
=
L"<?xml version='1.0'?> \
<Effect> \
<Property name='DisplayName' type='string'/> \
<Property name='Author' type='string'/> \
<Property name='Category' type='string'/> \
<Property name='Description' type='string'/> \
<Inputs/> \
</Effect> \
"

Definition at line 186 of file d2d1.c.

Referenced by test_effect_properties(), and test_effect_register().

◆ effect_xml_without_author

const WCHAR* effect_xml_without_author
static
Initial value:
=
L"<?xml version='1.0'?> \
<Effect> \
<Property name='DisplayName' type='string'/> \
<Property name='Category' type='string'/> \
<Property name='Description' type='string'/> \
<Inputs/> \
</Effect> \
"

Definition at line 227 of file d2d1.c.

Referenced by test_effect_register().

◆ effect_xml_without_category

const WCHAR* effect_xml_without_category
static
Initial value:
=
L"<?xml version='1.0'?> \
<Effect> \
<Property name='DisplayName' type='string'/> \
<Property name='Author' type='string'/> \
<Property name='Description' type='string'/> \
<Inputs/> \
</Effect> \
"

Definition at line 237 of file d2d1.c.

Referenced by test_effect_register().

◆ effect_xml_without_description

const WCHAR* effect_xml_without_description
static
Initial value:
=
L"<?xml version='1.0'?> \
<Effect> \
<Property name='DisplayName' type='string'/> \
<Property name='Author' type='string'/> \
<Property name='Category' type='string'/> \
<Inputs/> \
</Effect> \
"

Definition at line 247 of file d2d1.c.

Referenced by test_effect_register().

◆ effect_xml_without_inputs

const WCHAR* effect_xml_without_inputs
static
Initial value:
=
L"<?xml version='1.0'?> \
<Effect> \
<Property name='DisplayName' type='string'/> \
<Property name='Author' type='string'/> \
<Property name='Category' type='string'/> \
<Property name='Description' type='string'/> \
</Effect> \
"

Definition at line 207 of file d2d1.c.

Referenced by test_effect_register().

◆ effect_xml_without_name

const WCHAR* effect_xml_without_name
static
Initial value:
=
L"<?xml version='1.0'?> \
<Effect> \
<Property name='Author' type='string'/> \
<Property name='Category' type='string'/> \
<Property name='Description' type='string'/> \
<Inputs/> \
</Effect> \
"

Definition at line 217 of file d2d1.c.

Referenced by test_effect_register().

◆ effect_xml_without_type

const WCHAR* effect_xml_without_type
static
Initial value:
=
L"<?xml version='1.0'?> \
<Effect> \
<Property name='DisplayName' type='string'/> \
<Property name='Author' type='string'/> \
<Property name='Category' type='string'/> \
<Property name='Description'/> \
<Inputs/> \
</Effect> \
"

Definition at line 257 of file d2d1.c.

Referenced by test_effect_register().

◆ effect_xml_without_version

const WCHAR* effect_xml_without_version
static
Initial value:
=
L"<Effect> \
<Property name='DisplayName' type='string'/> \
<Property name='Author' type='string'/> \
<Property name='Category' type='string'/> \
<Property name='Description' type='string'/> \
<Inputs/> \
</Effect> \
"

Definition at line 197 of file d2d1.c.

Referenced by test_effect_register().

◆ geometry_sink_vtbl

const struct ID2D1SimplifiedGeometrySinkVtbl geometry_sink_vtbl
static
Initial value:
=
{
}
static ULONG STDMETHODCALLTYPE geometry_sink_Release(ID2D1SimplifiedGeometrySink *iface)
Definition: d2d1.c:1446
static void STDMETHODCALLTYPE geometry_sink_AddBeziers(ID2D1SimplifiedGeometrySink *iface, const D2D1_BEZIER_SEGMENT *beziers, UINT32 count)
Definition: d2d1.c:1515
static HRESULT STDMETHODCALLTYPE geometry_sink_Close(ID2D1SimplifiedGeometrySink *iface)
Definition: d2d1.c:1541
static void STDMETHODCALLTYPE geometry_sink_BeginFigure(ID2D1SimplifiedGeometrySink *iface, D2D1_POINT_2F start_point, D2D1_FIGURE_BEGIN figure_begin)
Definition: d2d1.c:1466
static ULONG STDMETHODCALLTYPE geometry_sink_AddRef(ID2D1SimplifiedGeometrySink *iface)
Definition: d2d1.c:1441
static HRESULT STDMETHODCALLTYPE geometry_sink_QueryInterface(ID2D1SimplifiedGeometrySink *iface, REFIID iid, void **out)
Definition: d2d1.c:1427
static void STDMETHODCALLTYPE geometry_sink_SetSegmentFlags(ID2D1SimplifiedGeometrySink *iface, D2D1_PATH_SEGMENT flags)
Definition: d2d1.c:1458
static void STDMETHODCALLTYPE geometry_sink_EndFigure(ID2D1SimplifiedGeometrySink *iface, D2D1_FIGURE_END figure_end)
Definition: d2d1.c:1532
static void STDMETHODCALLTYPE geometry_sink_AddLines(ID2D1SimplifiedGeometrySink *iface, const D2D1_POINT_2F *points, UINT32 count)
Definition: d2d1.c:1498
static void STDMETHODCALLTYPE geometry_sink_SetFillMode(ID2D1SimplifiedGeometrySink *iface, D2D1_FILL_MODE mode)
Definition: d2d1.c:1451

Definition at line 1550 of file d2d1.c.

Referenced by geometry_sink_init().

◆ mt_test_count

size_t mt_test_count

Definition at line 313 of file d2d1.c.

Referenced by queue_d3d1x_test(), run_queued_tests(), and thread_func().

◆ mt_tests

struct test_entry * mt_tests
static

◆ mt_tests_size

size_t mt_tests_size

Definition at line 313 of file d2d1.c.

Referenced by queue_d3d1x_test().

◆ properties

Definition at line 299 of file d2d1.c.

Referenced by adapter_vk_init_driver_info(), CertContext_SetKeyContextProperty(), CertContext_SetKeyProvInfoProperty(), check_vk_instance_extension(), copy_properties(), create_properties(), D2D1CreateDevice(), d2d_command_list_create_brush(), d2d_effect_init_properties(), d2d_effect_properties_AddRef(), d2d_effect_properties_get_property_by_index(), d2d_effect_properties_get_property_by_name(), d2d_effect_properties_get_value_size(), d2d_effect_properties_GetPropertyCount(), d2d_effect_properties_GetPropertyIndex(), d2d_effect_properties_GetPropertyName(), d2d_effect_properties_GetPropertyNameLength(), d2d_effect_properties_GetSubProperties(), d2d_effect_properties_GetType(), d2d_effect_properties_GetValue(), d2d_effect_properties_GetValueByName(), d2d_effect_properties_GetValueSize(), d2d_effect_properties_Release(), d2d_effect_properties_SetValue(), d2d_effect_properties_SetValueByName(), d2d_effect_property_get_uint32_value(), d2d_effect_property_get_value(), d2d_effect_property_set_value(), d3d12_device_CheckFeatureSupport(), d3d12_device_supports_typed_uav_load_additional_formats(), d3d12_get_vk_physical_device(), FT_Face_Properties(), id(), init_vulkan_format_info(), is_cpu_accessible_heap(), is_preserving_whitespace(), pcf_find_property(), pcf_get_properties(), PiCallDriverAddDevice(), properties_add_ref(), properties_release(), test_audiostream_receive(), test_create_device(), test_ddrawstream_receive(), test_get_effect_properties(), test_start_trace(), vkd3d_device_vk_heaps_descriptor_limits_init(), vkd3d_get_required_texel_buffer_alignment(), vkd3d_init_depth_stencil_formats(), vkd3d_is_linear_tiling_supported(), vkd3d_queue_create(), and vkd3d_trace_physical_device_properties().

◆ s

float* s

Definition at line 300 of file d2d1.c.

Referenced by test_math().

◆ test_ps_code

const char test_ps_code[]
static
Initial value:
=
"float4 main() : SV_Target\n"
"{\n"
" return float4(0.1, 0.2, 0.3, 0.4);\n"
"}"

Definition at line 292 of file d2d1.c.

Referenced by test_effect_context().

◆ test_vs_code

const char test_vs_code[]
static
Initial value:
=
"void main(float4 pos : Position, out float4 output : SV_Position)\n"
"{\n"
" output = pos;\n"
"}"

Definition at line 286 of file d2d1.c.

Referenced by test_effect_context().

◆ use_mt

BOOL use_mt = TRUE
static

Definition at line 306 of file d2d1.c.

Referenced by run_queued_tests(), and START_TEST().

◆ y

◆ z

Definition at line 302 of file d2d1.c.

Referenced by set_vec4(), and test_math().