2 * Copyright 2014 Henri Verbeet for CodeWeavers
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 #ifndef __WINE_D2D1_PRIVATE_H
20 #define __WINE_D2D1_PRIVATE_H
22 #include "wine/debug.h"
23 #include "wine/list.h"
32 #include "d2d1effectauthor.h"
42 D2D_BRUSH_TYPE_LINEAR
,
43 D2D_BRUSH_TYPE_RADIAL
,
44 D2D_BRUSH_TYPE_BITMAP
,
51 D2D_SHAPE_TYPE_OUTLINE
,
52 D2D_SHAPE_TYPE_BEZIER_OUTLINE
,
53 D2D_SHAPE_TYPE_ARC_OUTLINE
,
54 D2D_SHAPE_TYPE_TRIANGLE
,
61 unsigned int max_version_factory
;
63 extern struct d2d_settings d2d_settings DECLSPEC_HIDDEN
;
72 struct d2d_error_state
78 struct d2d_shape_resources
80 ID3D11InputLayout
*il
;
81 ID3D11VertexShader
*vs
;
86 enum d2d_brush_type type
;
99 unsigned int stop_count
;
103 D2D1_POINT_2F centre
;
104 D2D1_POINT_2F offset
;
107 unsigned int stop_count
;
112 float _11
, _21
, _31
, pad
;
124 struct d2d_brush_cb colour_brush
;
125 struct d2d_brush_cb opacity_brush
;
137 float _11
, _21
, _31
, pad0
;
138 float _12
, _22
, _32
, stroke_width
;
139 } transform_geometry
;
140 struct d2d_vec4 transform_rtx
;
141 struct d2d_vec4 transform_rty
;
144 struct d2d_device_context_ops
146 HRESULT (*device_context_present
)(IUnknown
*outer_unknown
);
149 enum d2d_device_context_sampler_limits
151 D2D_SAMPLER_INTERPOLATION_MODE_COUNT
= 2,
152 D2D_SAMPLER_EXTEND_MODE_COUNT
= 3,
155 enum d2d_device_context_target_type
157 D2D_TARGET_UNKNOWN
= 0,
159 D2D_TARGET_COMMAND_LIST
,
162 struct d2d_device_context
164 ID2D1DeviceContext1 ID2D1DeviceContext1_iface
;
165 ID2D1GdiInteropRenderTarget ID2D1GdiInteropRenderTarget_iface
;
166 IDWriteTextRenderer IDWriteTextRenderer_iface
;
167 IUnknown IUnknown_iface
;
170 IUnknown
*outer_unknown
;
171 const struct d2d_device_context_ops
*ops
;
173 ID2D1Factory
*factory
;
175 ID3D11Device1
*d3d_device
;
176 ID3DDeviceContextState
*d3d_state
;
180 enum d2d_device_context_target_type type
;
183 struct d2d_bitmap
*bitmap
;
184 struct d2d_command_list
*command_list
;
187 struct d2d_shape_resources shape_resources
[D2D_SHAPE_TYPE_COUNT
];
189 ID3D11PixelShader
*ps
;
192 unsigned int vb_stride
;
194 ID3D11RasterizerState
*rs
;
195 ID3D11BlendState
*bs
;
196 ID3D11SamplerState
*sampler_states
197 [D2D_SAMPLER_INTERPOLATION_MODE_COUNT
]
198 [D2D_SAMPLER_EXTEND_MODE_COUNT
]
199 [D2D_SAMPLER_EXTEND_MODE_COUNT
];
201 struct d2d_error_state error
;
202 D2D1_DRAWING_STATE_DESCRIPTION1 drawing_state
;
203 IDWriteRenderingParams
*text_rendering_params
;
204 IDWriteRenderingParams
*default_text_rendering_params
;
206 D2D1_RENDER_TARGET_PROPERTIES desc
;
207 D2D1_SIZE_U pixel_size
;
208 struct d2d_clip_stack clip_stack
;
211 HRESULT
d2d_d3d_create_render_target(ID2D1Device
*device
, IDXGISurface
*surface
, IUnknown
*outer_unknown
,
212 const struct d2d_device_context_ops
*ops
, const D2D1_RENDER_TARGET_PROPERTIES
*desc
,
213 void **render_target
) DECLSPEC_HIDDEN
;
215 static inline BOOL
d2d_device_context_is_dxgi_target(const struct d2d_device_context
*context
)
217 return !context
->ops
;
220 struct d2d_wic_render_target
222 IUnknown IUnknown_iface
;
225 IDXGISurface
*dxgi_surface
;
226 ID2D1RenderTarget
*dxgi_target
;
227 IUnknown
*dxgi_inner
;
228 ID3D10Texture2D
*readback_texture
;
236 HRESULT
d2d_wic_render_target_init(struct d2d_wic_render_target
*render_target
, ID2D1Factory1
*factory
,
237 ID3D10Device1
*d3d_device
, IWICBitmap
*bitmap
, const D2D1_RENDER_TARGET_PROPERTIES
*desc
) DECLSPEC_HIDDEN
;
239 struct d2d_dc_render_target
241 ID2D1DCRenderTarget ID2D1DCRenderTarget_iface
;
244 IDXGISurface1
*dxgi_surface
;
245 D2D1_PIXEL_FORMAT pixel_format
;
246 ID3D10Device1
*d3d_device
;
247 ID2D1RenderTarget
*dxgi_target
;
248 IUnknown
*dxgi_inner
;
254 HRESULT
d2d_dc_render_target_init(struct d2d_dc_render_target
*render_target
, ID2D1Factory1
*factory
,
255 ID3D10Device1
*d3d_device
, const D2D1_RENDER_TARGET_PROPERTIES
*desc
) DECLSPEC_HIDDEN
;
257 struct d2d_hwnd_render_target
259 ID2D1HwndRenderTarget ID2D1HwndRenderTarget_iface
;
262 ID2D1RenderTarget
*dxgi_target
;
263 IUnknown
*dxgi_inner
;
264 IDXGISwapChain
*swapchain
;
269 HRESULT
d2d_hwnd_render_target_init(struct d2d_hwnd_render_target
*render_target
, ID2D1Factory1
*factory
,
270 ID3D10Device1
*d3d_device
, const D2D1_RENDER_TARGET_PROPERTIES
*desc
,
271 const D2D1_HWND_RENDER_TARGET_PROPERTIES
*hwnd_desc
) DECLSPEC_HIDDEN
;
273 struct d2d_bitmap_render_target
275 ID2D1BitmapRenderTarget ID2D1BitmapRenderTarget_iface
;
278 ID2D1RenderTarget
*dxgi_target
;
279 IUnknown
*dxgi_inner
;
283 HRESULT
d2d_bitmap_render_target_init(struct d2d_bitmap_render_target
*render_target
,
284 const struct d2d_device_context
*parent_target
, const D2D1_SIZE_F
*size
,
285 const D2D1_SIZE_U
*pixel_size
, const D2D1_PIXEL_FORMAT
*format
,
286 D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS options
) DECLSPEC_HIDDEN
;
290 ID2D1GradientStopCollection ID2D1GradientStopCollection_iface
;
293 ID2D1Factory
*factory
;
294 ID3D11ShaderResourceView
*view
;
295 D2D1_GRADIENT_STOP
*stops
;
299 HRESULT
d2d_gradient_create(ID2D1Factory
*factory
, ID3D11Device1
*device
, const D2D1_GRADIENT_STOP
*stops
,
300 UINT32 stop_count
, D2D1_GAMMA gamma
, D2D1_EXTEND_MODE extend_mode
,
301 struct d2d_gradient
**gradient
) DECLSPEC_HIDDEN
;
305 ID2D1Brush ID2D1Brush_iface
;
308 ID2D1Factory
*factory
;
310 D2D1_MATRIX_3X2_F transform
;
312 enum d2d_brush_type type
;
321 struct d2d_gradient
*gradient
;
327 struct d2d_gradient
*gradient
;
328 D2D1_POINT_2F centre
;
329 D2D1_POINT_2F offset
;
330 D2D1_POINT_2F radius
;
334 struct d2d_bitmap
*bitmap
;
335 D2D1_EXTEND_MODE extend_mode_x
;
336 D2D1_EXTEND_MODE extend_mode_y
;
337 D2D1_INTERPOLATION_MODE interpolation_mode
;
342 D2D1_EXTEND_MODE extend_mode_x
;
343 D2D1_EXTEND_MODE extend_mode_y
;
344 D2D1_INTERPOLATION_MODE interpolation_mode
;
345 D2D1_RECT_F source_rect
;
350 HRESULT
d2d_solid_color_brush_create(ID2D1Factory
*factory
, const D2D1_COLOR_F
*color
,
351 const D2D1_BRUSH_PROPERTIES
*desc
, struct d2d_brush
**brush
) DECLSPEC_HIDDEN
;
352 HRESULT
d2d_linear_gradient_brush_create(ID2D1Factory
*factory
,
353 const D2D1_LINEAR_GRADIENT_BRUSH_PROPERTIES
*gradient_desc
, const D2D1_BRUSH_PROPERTIES
*brush_desc
,
354 ID2D1GradientStopCollection
*gradient
, struct d2d_brush
**brush
) DECLSPEC_HIDDEN
;
355 HRESULT
d2d_radial_gradient_brush_create(ID2D1Factory
*factory
,
356 const D2D1_RADIAL_GRADIENT_BRUSH_PROPERTIES
*gradient_desc
, const D2D1_BRUSH_PROPERTIES
*brush_desc
,
357 ID2D1GradientStopCollection
*gradient
, struct d2d_brush
**brush
) DECLSPEC_HIDDEN
;
358 HRESULT
d2d_bitmap_brush_create(ID2D1Factory
*factory
, ID2D1Bitmap
*bitmap
,
359 const D2D1_BITMAP_BRUSH_PROPERTIES1
*bitmap_brush_desc
, const D2D1_BRUSH_PROPERTIES
*brush_desc
,
360 struct d2d_brush
**brush
) DECLSPEC_HIDDEN
;
361 HRESULT
d2d_image_brush_create(ID2D1Factory
*factory
, ID2D1Image
*image
,
362 const D2D1_IMAGE_BRUSH_PROPERTIES
*image_brush_desc
, const D2D1_BRUSH_PROPERTIES
*brush_desc
,
363 struct d2d_brush
**brush
) DECLSPEC_HIDDEN
;
364 void d2d_brush_bind_resources(struct d2d_brush
*brush
, struct d2d_device_context
*context
,
365 unsigned int brush_idx
) DECLSPEC_HIDDEN
;
366 BOOL
d2d_brush_fill_cb(const struct d2d_brush
*brush
, struct d2d_brush_cb
*cb
) DECLSPEC_HIDDEN
;
367 struct d2d_brush
*unsafe_impl_from_ID2D1Brush(ID2D1Brush
*iface
) DECLSPEC_HIDDEN
;
369 struct d2d_stroke_style
371 ID2D1StrokeStyle1 ID2D1StrokeStyle1_iface
;
374 ID2D1Factory
*factory
;
375 D2D1_STROKE_STYLE_PROPERTIES1 desc
;
380 HRESULT
d2d_stroke_style_init(struct d2d_stroke_style
*style
, ID2D1Factory
*factory
,
381 const D2D1_STROKE_STYLE_PROPERTIES1
*desc
, const float *dashes
, UINT32 dash_count
) DECLSPEC_HIDDEN
;
385 ID2D1Layer ID2D1Layer_iface
;
388 ID2D1Factory
*factory
;
392 HRESULT
d2d_layer_create(ID2D1Factory
*factory
, const D2D1_SIZE_F
*size
, struct d2d_layer
**layer
) DECLSPEC_HIDDEN
;
396 ID2D1Mesh ID2D1Mesh_iface
;
399 ID2D1Factory
*factory
;
402 HRESULT
d2d_mesh_create(ID2D1Factory
*factory
, struct d2d_mesh
**mesh
) DECLSPEC_HIDDEN
;
406 ID2D1Bitmap1 ID2D1Bitmap1_iface
;
409 ID2D1Factory
*factory
;
410 ID3D11ShaderResourceView
*srv
;
411 ID3D11RenderTargetView
*rtv
;
412 IDXGISurface
*surface
;
413 ID3D11Resource
*resource
;
414 D3D11_MAPPED_SUBRESOURCE mapped_resource
;
415 D2D1_SIZE_U pixel_size
;
416 D2D1_PIXEL_FORMAT format
;
419 D2D1_BITMAP_OPTIONS options
;
422 HRESULT
d2d_bitmap_create(struct d2d_device_context
*context
, D2D1_SIZE_U size
, const void *src_data
,
423 UINT32 pitch
, const D2D1_BITMAP_PROPERTIES1
*desc
, struct d2d_bitmap
**bitmap
) DECLSPEC_HIDDEN
;
424 HRESULT
d2d_bitmap_create_shared(struct d2d_device_context
*context
, REFIID iid
, void *data
,
425 const D2D1_BITMAP_PROPERTIES1
*desc
, struct d2d_bitmap
**bitmap
) DECLSPEC_HIDDEN
;
426 HRESULT
d2d_bitmap_create_from_wic_bitmap(struct d2d_device_context
*context
, IWICBitmapSource
*bitmap_source
,
427 const D2D1_BITMAP_PROPERTIES1
*desc
, struct d2d_bitmap
**bitmap
) DECLSPEC_HIDDEN
;
428 unsigned int d2d_get_bitmap_options_for_surface(IDXGISurface
*surface
) DECLSPEC_HIDDEN
;
429 struct d2d_bitmap
*unsafe_impl_from_ID2D1Bitmap(ID2D1Bitmap
*iface
) DECLSPEC_HIDDEN
;
431 struct d2d_state_block
433 ID2D1DrawingStateBlock1 ID2D1DrawingStateBlock1_iface
;
436 ID2D1Factory
*factory
;
437 D2D1_DRAWING_STATE_DESCRIPTION1 drawing_state
;
438 IDWriteRenderingParams
*text_rendering_params
;
441 void d2d_state_block_init(struct d2d_state_block
*state_block
, ID2D1Factory
*factory
,
442 const D2D1_DRAWING_STATE_DESCRIPTION1
*desc
, IDWriteRenderingParams
*text_rendering_params
) DECLSPEC_HIDDEN
;
443 struct d2d_state_block
*unsafe_impl_from_ID2D1DrawingStateBlock(ID2D1DrawingStateBlock
*iface
) DECLSPEC_HIDDEN
;
445 enum d2d_geometry_state
447 D2D_GEOMETRY_STATE_INITIAL
= 0,
448 D2D_GEOMETRY_STATE_ERROR
,
449 D2D_GEOMETRY_STATE_OPEN
,
450 D2D_GEOMETRY_STATE_CLOSED
,
451 D2D_GEOMETRY_STATE_FIGURE
,
454 struct d2d_curve_vertex
456 D2D1_POINT_2F position
;
468 struct d2d_outline_vertex
470 D2D1_POINT_2F position
;
475 struct d2d_curve_outline_vertex
477 D2D1_POINT_2F position
;
478 D2D1_POINT_2F p0
, p1
, p2
;
479 D2D1_POINT_2F prev
, next
;
484 ID2D1Geometry ID2D1Geometry_iface
;
487 ID2D1Factory
*factory
;
489 D2D_MATRIX_3X2_F transform
;
493 D2D1_POINT_2F
*vertices
;
496 struct d2d_face
*faces
;
500 struct d2d_curve_vertex
*bezier_vertices
;
501 size_t bezier_vertices_size
;
502 size_t bezier_vertex_count
;
504 struct d2d_curve_vertex
*arc_vertices
;
505 size_t arc_vertices_size
;
506 size_t arc_vertex_count
;
511 struct d2d_outline_vertex
*vertices
;
512 size_t vertices_size
;
515 struct d2d_face
*faces
;
519 struct d2d_curve_outline_vertex
*beziers
;
523 struct d2d_face
*bezier_faces
;
524 size_t bezier_faces_size
;
525 size_t bezier_face_count
;
527 struct d2d_curve_outline_vertex
*arcs
;
531 struct d2d_face
*arc_faces
;
532 size_t arc_faces_size
;
533 size_t arc_face_count
;
540 D2D1_ELLIPSE ellipse
;
544 ID2D1GeometrySink ID2D1GeometrySink_iface
;
546 struct d2d_figure
*figures
;
550 enum d2d_geometry_state state
;
551 D2D1_FILL_MODE fill_mode
;
552 UINT32 segment_count
;
562 D2D1_ROUNDED_RECT rounded_rect
;
566 ID2D1Geometry
*src_geometry
;
567 D2D_MATRIX_3X2_F transform
;
571 ID2D1Geometry
**src_geometries
;
572 UINT32 geometry_count
;
573 D2D1_FILL_MODE fill_mode
;
578 HRESULT
d2d_ellipse_geometry_init(struct d2d_geometry
*geometry
,
579 ID2D1Factory
*factory
, const D2D1_ELLIPSE
*ellipse
) DECLSPEC_HIDDEN
;
580 void d2d_path_geometry_init(struct d2d_geometry
*geometry
, ID2D1Factory
*factory
) DECLSPEC_HIDDEN
;
581 HRESULT
d2d_rectangle_geometry_init(struct d2d_geometry
*geometry
,
582 ID2D1Factory
*factory
, const D2D1_RECT_F
*rect
) DECLSPEC_HIDDEN
;
583 HRESULT
d2d_rounded_rectangle_geometry_init(struct d2d_geometry
*geometry
,
584 ID2D1Factory
*factory
, const D2D1_ROUNDED_RECT
*rounded_rect
) DECLSPEC_HIDDEN
;
585 void d2d_transformed_geometry_init(struct d2d_geometry
*geometry
, ID2D1Factory
*factory
,
586 ID2D1Geometry
*src_geometry
, const D2D_MATRIX_3X2_F
*transform
) DECLSPEC_HIDDEN
;
587 HRESULT
d2d_geometry_group_init(struct d2d_geometry
*geometry
, ID2D1Factory
*factory
,
588 D2D1_FILL_MODE fill_mode
, ID2D1Geometry
**src_geometries
, unsigned int geometry_count
) DECLSPEC_HIDDEN
;
589 struct d2d_geometry
*unsafe_impl_from_ID2D1Geometry(ID2D1Geometry
*iface
) DECLSPEC_HIDDEN
;
593 ID2D1Device ID2D1Device_iface
;
595 ID2D1Factory1
*factory
;
596 IDXGIDevice
*dxgi_device
;
599 void d2d_device_init(struct d2d_device
*device
, ID2D1Factory1
*factory
, IDXGIDevice
*dxgi_device
) DECLSPEC_HIDDEN
;
607 struct d2d_effect_context
609 ID2D1EffectContext ID2D1EffectContext_iface
;
612 struct d2d_device_context
*device_context
;
614 struct d2d_shader
*shaders
;
619 void d2d_effect_context_init(struct d2d_effect_context
*effect_context
,
620 struct d2d_device_context
*device_context
) DECLSPEC_HIDDEN
;
622 struct d2d_effect_property
625 D2D1_PROPERTY_TYPE type
;
634 PD2D1_PROPERTY_SET_FUNCTION set_function
;
635 PD2D1_PROPERTY_GET_FUNCTION get_function
;
636 struct d2d_effect_properties
*subproperties
;
639 struct d2d_effect_properties
641 ID2D1Properties ID2D1Properties_iface
;
642 struct d2d_effect
*effect
;
644 struct d2d_effect_property
*properties
;
657 struct d2d_effect_registration
660 PD2D1_EFFECT_FACTORY factory
;
661 UINT32 registration_count
;
666 UINT32 default_input_count
;
667 struct d2d_effect_properties properties
;
671 void d2d_effects_init_builtins(struct d2d_factory
*factory
) DECLSPEC_HIDDEN
;
672 struct d2d_effect_registration
* d2d_factory_get_registered_effect(ID2D1Factory
*factory
,
673 const GUID
*effect_id
) DECLSPEC_HIDDEN
;
674 void d2d_factory_register_effect(struct d2d_factory
*factory
,
675 struct d2d_effect_registration
*effect
) DECLSPEC_HIDDEN
;
677 struct d2d_transform_graph
679 ID2D1TransformGraph ID2D1TransformGraph_iface
;
685 ID2D1Effect ID2D1Effect_iface
;
686 ID2D1Image ID2D1Image_iface
;
689 ID2D1EffectImpl
*impl
;
690 struct d2d_effect_properties properties
;
691 struct d2d_effect_context
*effect_context
;
692 struct d2d_transform_graph
*graph
;
698 HRESULT
d2d_effect_create(struct d2d_device_context
*context
, const CLSID
*effect_id
,
699 ID2D1Effect
**effect
) DECLSPEC_HIDDEN
;
700 HRESULT
d2d_effect_properties_add(struct d2d_effect_properties
*props
, const WCHAR
*name
,
701 UINT32 index
, D2D1_PROPERTY_TYPE type
, const WCHAR
*value
) DECLSPEC_HIDDEN
;
702 HRESULT
d2d_effect_subproperties_add(struct d2d_effect_properties
*props
, const WCHAR
*name
,
703 UINT32 index
, D2D1_PROPERTY_TYPE type
, const WCHAR
*value
) DECLSPEC_HIDDEN
;
704 struct d2d_effect_property
* d2d_effect_properties_get_property_by_name(
705 const struct d2d_effect_properties
*properties
, const WCHAR
*name
) DECLSPEC_HIDDEN
;
706 void d2d_effect_properties_cleanup(struct d2d_effect_properties
*props
) DECLSPEC_HIDDEN
;
708 struct d2d_command_list
710 ID2D1CommandList ID2D1CommandList_iface
;
713 ID2D1Factory
*factory
;
716 HRESULT
d2d_command_list_create(ID2D1Factory
*factory
, struct d2d_command_list
**command_list
) DECLSPEC_HIDDEN
;
717 struct d2d_command_list
*unsafe_impl_from_ID2D1CommandList(ID2D1CommandList
*iface
) DECLSPEC_HIDDEN
;
719 static inline BOOL
d2d_array_reserve(void **elements
, size_t *capacity
, size_t count
, size_t size
)
721 size_t new_capacity
, max_capacity
;
724 if (count
<= *capacity
)
727 max_capacity
= ~(SIZE_T
)0 / size
;
728 if (count
> max_capacity
)
731 new_capacity
= max(4, *capacity
);
732 while (new_capacity
< count
&& new_capacity
<= max_capacity
/ 2)
734 if (new_capacity
< count
)
735 new_capacity
= max_capacity
;
737 if (!(new_elements
= realloc(*elements
, new_capacity
* size
)))
740 *elements
= new_elements
;
741 *capacity
= new_capacity
;
745 static inline void d2d_matrix_multiply(D2D_MATRIX_3X2_F
*a
, const D2D_MATRIX_3X2_F
*b
)
747 D2D_MATRIX_3X2_F tmp
= *a
;
749 a
->_11
= tmp
._11
* b
->_11
+ tmp
._12
* b
->_21
;
750 a
->_12
= tmp
._11
* b
->_12
+ tmp
._12
* b
->_22
;
751 a
->_21
= tmp
._21
* b
->_11
+ tmp
._22
* b
->_21
;
752 a
->_22
= tmp
._21
* b
->_12
+ tmp
._22
* b
->_22
;
753 a
->_31
= tmp
._31
* b
->_11
+ tmp
._32
* b
->_21
+ b
->_31
;
754 a
->_32
= tmp
._31
* b
->_12
+ tmp
._32
* b
->_22
+ b
->_32
;
757 /* Dst must be different from src. */
758 static inline BOOL
d2d_matrix_invert(D2D_MATRIX_3X2_F
*dst
, const D2D_MATRIX_3X2_F
*src
)
760 float d
= src
->_11
* src
->_22
- src
->_21
* src
->_12
;
764 dst
->_11
= src
->_22
/ d
;
765 dst
->_21
= -src
->_21
/ d
;
766 dst
->_31
= (src
->_21
* src
->_32
- src
->_31
* src
->_22
) / d
;
767 dst
->_12
= -src
->_12
/ d
;
768 dst
->_22
= src
->_11
/ d
;
769 dst
->_32
= -(src
->_11
* src
->_32
- src
->_31
* src
->_12
) / d
;
774 static inline void d2d_point_set(D2D1_POINT_2F
*dst
, float x
, float y
)
780 static inline float d2d_point_dot(const D2D1_POINT_2F
*p0
, const D2D1_POINT_2F
*p1
)
782 return p0
->x
* p1
->x
+ p0
->y
* p1
->y
;
785 static inline void d2d_point_transform(D2D1_POINT_2F
*dst
, const D2D1_MATRIX_3X2_F
*matrix
, float x
, float y
)
787 dst
->x
= x
* matrix
->_11
+ y
* matrix
->_21
+ matrix
->_31
;
788 dst
->y
= x
* matrix
->_12
+ y
* matrix
->_22
+ matrix
->_32
;
791 static inline void d2d_rect_expand(D2D1_RECT_F
*dst
, const D2D1_POINT_2F
*point
)
793 if (point
->x
< dst
->left
)
794 dst
->left
= point
->x
;
795 if (point
->x
> dst
->right
)
796 dst
->right
= point
->x
;
797 if (point
->y
< dst
->top
)
799 if (point
->y
> dst
->bottom
)
800 dst
->bottom
= point
->y
;
803 static inline D2D1_INTERPOLATION_MODE
d2d1_1_interp_mode_from_d2d1(D2D1_BITMAP_INTERPOLATION_MODE mode
)
805 return (D2D1_INTERPOLATION_MODE
)mode
;
808 static inline const char *debug_d2d_color_f(const D2D1_COLOR_F
*colour
)
812 return wine_dbg_sprintf("{%.8e, %.8e, %.8e, %.8e}", colour
->r
, colour
->g
, colour
->b
, colour
->a
);
815 static inline const char *debug_d2d_point_2f(const D2D1_POINT_2F
*point
)
819 return wine_dbg_sprintf("{%.8e, %.8e}", point
->x
, point
->y
);
822 static inline const char *debug_d2d_point_2l(const D2D1_POINT_2L
*point
)
826 return wine_dbg_sprintf("{%ld, %ld}", point
->x
, point
->y
);
829 static inline const char *debug_d2d_rect_f(const D2D1_RECT_F
*rect
)
833 return wine_dbg_sprintf("(%.8e, %.8e)-(%.8e, %.8e)", rect
->left
, rect
->top
, rect
->right
, rect
->bottom
);
836 static inline const char *debug_d2d_rect_l(const D2D1_RECT_L
*rect
)
840 return wine_dbg_sprintf("(%ld, %ld)-(%ld, %ld)", rect
->left
, rect
->top
, rect
->right
, rect
->bottom
);
843 static inline const char *debug_d2d_rounded_rect(const D2D1_ROUNDED_RECT
*rounded_rect
)
847 return wine_dbg_sprintf("(%.8e, %.8e)-(%.8e, %.8e)[%.8e, %.8e]", rounded_rect
->rect
.left
, rounded_rect
->rect
.top
,
848 rounded_rect
->rect
.right
, rounded_rect
->rect
.bottom
, rounded_rect
->radiusX
, rounded_rect
->radiusY
);
851 static inline const char *debug_d2d_ellipse(const D2D1_ELLIPSE
*ellipse
)
855 return wine_dbg_sprintf("(%.8e, %.8e)[%.8e, %.8e]",
856 ellipse
->point
.x
, ellipse
->point
.y
, ellipse
->radiusX
, ellipse
->radiusY
);
859 #endif /* __WINE_D2D1_PRIVATE_H */