ReactOS 0.4.17-dev-934-g091855f
factory.c File Reference
#include "d2d1_private.h"
#include "xmllite.h"
#include "wine/list.h"
Include dependency graph for factory.c:

Go to the source code of this file.

Macros

#define D2D1_INIT_GUID
 

Functions

 WINE_DECLARE_DEBUG_CHANNEL (winediag)
 
 WINE_DEFAULT_DEBUG_CHANNEL (d2d)
 
static void d2d_effect_registration_cleanup (struct d2d_effect_registration *reg)
 
static struct d2d_factory * impl_from_ID2D1Factory7 (ID2D1Factory7 *iface)
 
static struct d2d_factory * impl_from_ID2D1Multithread (ID2D1Multithread *iface)
 
static BOOL WINAPI d2d_factory_builtins_initonce (INIT_ONCE *once, void *param, void **context)
 
static void d2d_factory_init_builtin_effects (struct d2d_factory *factory)
 
void d2d_factory_register_effect (struct d2d_factory *factory, struct d2d_effect_registration *effect)
 
struct d2d_effect_registration * d2d_factory_get_registered_effect (ID2D1Factory *iface, const GUID *id)
 
static HRESULT d2d_factory_reload_sysmetrics (struct d2d_factory *factory)
 
static HRESULT STDMETHODCALLTYPE d2d_factory_QueryInterface (ID2D1Factory7 *iface, REFIID iid, void **out)
 
static ULONG STDMETHODCALLTYPE d2d_factory_AddRef (ID2D1Factory7 *iface)
 
static ULONG STDMETHODCALLTYPE d2d_factory_Release (ID2D1Factory7 *iface)
 
static HRESULT STDMETHODCALLTYPE d2d_factory_ReloadSystemMetrics (ID2D1Factory7 *iface)
 
static void STDMETHODCALLTYPE d2d_factory_GetDesktopDpi (ID2D1Factory7 *iface, float *dpi_x, float *dpi_y)
 
static HRESULT STDMETHODCALLTYPE d2d_factory_CreateRectangleGeometry (ID2D1Factory7 *iface, const D2D1_RECT_F *rect, ID2D1RectangleGeometry **geometry)
 
static HRESULT STDMETHODCALLTYPE d2d_factory_CreateRoundedRectangleGeometry (ID2D1Factory7 *iface, const D2D1_ROUNDED_RECT *rounded_rect, ID2D1RoundedRectangleGeometry **geometry)
 
static HRESULT STDMETHODCALLTYPE d2d_factory_CreateEllipseGeometry (ID2D1Factory7 *iface, const D2D1_ELLIPSE *ellipse, ID2D1EllipseGeometry **geometry)
 
static HRESULT STDMETHODCALLTYPE d2d_factory_CreateGeometryGroup (ID2D1Factory7 *iface, D2D1_FILL_MODE fill_mode, ID2D1Geometry **geometries, UINT32 geometry_count, ID2D1GeometryGroup **group)
 
static HRESULT STDMETHODCALLTYPE d2d_factory_CreateTransformedGeometry (ID2D1Factory7 *iface, ID2D1Geometry *src_geometry, const D2D1_MATRIX_3X2_F *transform, ID2D1TransformedGeometry **transformed_geometry)
 
static HRESULT STDMETHODCALLTYPE d2d_factory_CreatePathGeometry (ID2D1Factory7 *iface, ID2D1PathGeometry **geometry)
 
static HRESULT STDMETHODCALLTYPE d2d_factory_CreateStrokeStyle (ID2D1Factory7 *iface, const D2D1_STROKE_STYLE_PROPERTIES *desc, const float *dashes, UINT32 dash_count, ID2D1StrokeStyle **stroke_style)
 
static HRESULT STDMETHODCALLTYPE d2d_factory_CreateDrawingStateBlock (ID2D1Factory7 *iface, const D2D1_DRAWING_STATE_DESCRIPTION *desc, IDWriteRenderingParams *text_rendering_params, ID2D1DrawingStateBlock **state_block)
 
static HRESULT d2d_factory_get_device (struct d2d_factory *factory, ID3D10Device1 **device)
 
static HRESULT STDMETHODCALLTYPE d2d_factory_CreateWicBitmapRenderTarget (ID2D1Factory7 *iface, IWICBitmap *target, const D2D1_RENDER_TARGET_PROPERTIES *desc, ID2D1RenderTarget **render_target)
 
static HRESULT STDMETHODCALLTYPE d2d_factory_CreateHwndRenderTarget (ID2D1Factory7 *iface, const D2D1_RENDER_TARGET_PROPERTIES *desc, const D2D1_HWND_RENDER_TARGET_PROPERTIES *hwnd_rt_desc, ID2D1HwndRenderTarget **render_target)
 
static HRESULT STDMETHODCALLTYPE d2d_factory_CreateDxgiSurfaceRenderTarget (ID2D1Factory7 *iface, IDXGISurface *surface, const D2D1_RENDER_TARGET_PROPERTIES *desc, ID2D1RenderTarget **render_target)
 
static HRESULT STDMETHODCALLTYPE d2d_factory_CreateDCRenderTarget (ID2D1Factory7 *iface, const D2D1_RENDER_TARGET_PROPERTIES *desc, ID2D1DCRenderTarget **render_target)
 
HRESULT d2d_factory_create_device (ID2D1Factory1 *factory, IDXGIDevice *dxgi_device, bool allow_get_dxgi_device, REFIID iid, void **device)
 
static HRESULT STDMETHODCALLTYPE d2d_factory_CreateDevice (ID2D1Factory7 *iface, IDXGIDevice *dxgi_device, ID2D1Device **device)
 
static HRESULT STDMETHODCALLTYPE d2d_factory_CreateStrokeStyle1 (ID2D1Factory7 *iface, const D2D1_STROKE_STYLE_PROPERTIES1 *desc, const float *dashes, UINT32 dash_count, ID2D1StrokeStyle1 **stroke_style)
 
static HRESULT STDMETHODCALLTYPE d2d_factory_CreatePathGeometry1 (ID2D1Factory7 *iface, ID2D1PathGeometry1 **geometry)
 
static HRESULT STDMETHODCALLTYPE d2d_factory_CreateDrawingStateBlock1 (ID2D1Factory7 *iface, const D2D1_DRAWING_STATE_DESCRIPTION1 *desc, IDWriteRenderingParams *text_rendering_params, ID2D1DrawingStateBlock1 **state_block)
 
static HRESULT STDMETHODCALLTYPE d2d_factory_CreateGdiMetafile (ID2D1Factory7 *iface, IStream *stream, ID2D1GdiMetafile **metafile)
 
static HRESULT parse_effect_get_next_xml_node (IXmlReader *reader, XmlNodeType expected_type, const WCHAR *expected_name, unsigned int *depth)
 
static HRESULT parse_effect_skip_element (IXmlReader *reader, unsigned int element_depth)
 
static HRESULT parse_effect_get_attribute (IXmlReader *reader, const WCHAR *name, WCHAR **ret)
 
static HRESULT parse_effect_get_property_type (IXmlReader *reader, D2D1_PROPERTY_TYPE *type)
 
static struct d2d_effect_property * parse_effect_get_property (const struct d2d_effect_registration *effect, const WCHAR *name)
 
static UINT32 parse_effect_get_property_index (struct d2d_effect_properties *props, const WCHAR *name)
 
static HRESULT parse_effect_property (IXmlReader *reader, struct d2d_effect_registration *effect)
 
static HRESULT parse_effect_inputs (IXmlReader *reader, struct d2d_effect_registration *effect)
 
static HRESULT parse_effect_xml (IXmlReader *reader, struct d2d_effect_registration *effect)
 
static HRESULT d2d_factory_register_effect_from_stream (struct d2d_factory *factory, REFCLSID effect_id, IStream *property_xml, const D2D1_PROPERTY_BINDING *bindings, UINT32 binding_count, PD2D1_EFFECT_FACTORY effect_factory, BOOL builtin)
 
static HRESULT STDMETHODCALLTYPE d2d_factory_RegisterEffectFromStream (ID2D1Factory7 *iface, REFCLSID effect_id, IStream *property_xml, const D2D1_PROPERTY_BINDING *bindings, UINT32 binding_count, PD2D1_EFFECT_FACTORY effect_factory)
 
static HRESULT d2d_factory_register_effect_from_string (struct d2d_factory *factory, REFCLSID effect_id, const WCHAR *property_xml, const D2D1_PROPERTY_BINDING *bindings, UINT32 binding_count, PD2D1_EFFECT_FACTORY effect_factory, BOOL builtin)
 
HRESULT d2d_factory_register_builtin_effect (struct d2d_factory *factory, REFCLSID effect_id, const WCHAR *property_xml, const D2D1_PROPERTY_BINDING *bindings, UINT32 binding_count, PD2D1_EFFECT_FACTORY effect_factory)
 
static HRESULT STDMETHODCALLTYPE d2d_factory_RegisterEffectFromString (ID2D1Factory7 *iface, REFCLSID effect_id, const WCHAR *property_xml, const D2D1_PROPERTY_BINDING *bindings, UINT32 binding_count, PD2D1_EFFECT_FACTORY effect_factory)
 
static HRESULT STDMETHODCALLTYPE d2d_factory_UnregisterEffect (ID2D1Factory7 *iface, REFCLSID effect_id)
 
static HRESULT STDMETHODCALLTYPE d2d_factory_GetRegisteredEffects (ID2D1Factory7 *iface, CLSID *effects, UINT32 effect_count, UINT32 *returned, UINT32 *registered)
 
static HRESULT STDMETHODCALLTYPE d2d_factory_GetEffectProperties (ID2D1Factory7 *iface, REFCLSID effect_id, ID2D1Properties **props)
 
static HRESULT STDMETHODCALLTYPE d2d_factory_ID2D1Factory2_CreateDevice (ID2D1Factory7 *iface, IDXGIDevice *dxgi_device, ID2D1Device1 **device)
 
static HRESULT STDMETHODCALLTYPE d2d_factory_ID2D1Factory3_CreateDevice (ID2D1Factory7 *iface, IDXGIDevice *dxgi_device, ID2D1Device2 **device)
 
static HRESULT STDMETHODCALLTYPE d2d_factory_ID2D1Factory4_CreateDevice (ID2D1Factory7 *iface, IDXGIDevice *dxgi_device, ID2D1Device3 **device)
 
static HRESULT STDMETHODCALLTYPE d2d_factory_ID2D1Factory5_CreateDevice (ID2D1Factory7 *iface, IDXGIDevice *dxgi_device, ID2D1Device4 **device)
 
static HRESULT STDMETHODCALLTYPE d2d_factory_ID2D1Factory6_CreateDevice (ID2D1Factory7 *iface, IDXGIDevice *dxgi_device, ID2D1Device5 **device)
 
static HRESULT STDMETHODCALLTYPE d2d_factory_ID2D1Factory7_CreateDevice (ID2D1Factory7 *iface, IDXGIDevice *dxgi_device, ID2D1Device6 **device)
 
static HRESULT STDMETHODCALLTYPE d2d_factory_mt_QueryInterface (ID2D1Multithread *iface, REFIID iid, void **out)
 
static ULONG STDMETHODCALLTYPE d2d_factory_mt_AddRef (ID2D1Multithread *iface)
 
static ULONG STDMETHODCALLTYPE d2d_factory_mt_Release (ID2D1Multithread *iface)
 
static BOOL STDMETHODCALLTYPE d2d_factory_mt_GetMultithreadProtected (ID2D1Multithread *iface)
 
static void STDMETHODCALLTYPE d2d_factory_mt_Enter (ID2D1Multithread *iface)
 
static void STDMETHODCALLTYPE d2d_factory_mt_Leave (ID2D1Multithread *iface)
 
static BOOL STDMETHODCALLTYPE d2d_factory_st_GetMultithreadProtected (ID2D1Multithread *iface)
 
static void STDMETHODCALLTYPE d2d_factory_st_Enter (ID2D1Multithread *iface)
 
static void STDMETHODCALLTYPE d2d_factory_st_Leave (ID2D1Multithread *iface)
 
static void d2d_factory_init (struct d2d_factory *factory, D2D1_FACTORY_TYPE factory_type, const D2D1_FACTORY_OPTIONS *factory_options)
 
HRESULT WINAPI D2D1CreateFactory (D2D1_FACTORY_TYPE factory_type, REFIID iid, const D2D1_FACTORY_OPTIONS *factory_options, void **factory)
 
void WINAPI D2D1MakeRotateMatrix (float angle, D2D1_POINT_2F center, D2D1_MATRIX_3X2_F *matrix)
 
void WINAPI D2D1MakeSkewMatrix (float angle_x, float angle_y, D2D1_POINT_2F center, D2D1_MATRIX_3X2_F *matrix)
 
BOOL WINAPI D2D1IsMatrixInvertible (const D2D1_MATRIX_3X2_F *matrix)
 
BOOL WINAPI D2D1InvertMatrix (D2D1_MATRIX_3X2_F *matrix)
 
HRESULT WINAPI D2D1CreateDevice (IDXGIDevice *dxgi_device, const D2D1_CREATION_PROPERTIES *properties, ID2D1Device **device)
 
void WINAPI D2D1SinCos (float angle, float *s, float *c)
 
float WINAPI D2D1Tan (float angle)
 
float WINAPI D2D1Vec3Length (float x, float y, float z)
 
static float srgb_transfer_function (float x)
 
static float srgb_inverse_transfer_function (float x)
 
D2D1_COLOR_F WINAPI D2D1ConvertColorSpace (D2D1_COLOR_SPACE src_colour_space, D2D1_COLOR_SPACE dst_colour_space, const D2D1_COLOR_F *colour)
 
static bool get_config_key_u32 (HKEY default_key, HKEY application_key, const char *name, uint32_t *value)
 
static void d2d_settings_init (void)
 
BOOL WINAPI DllMain (HINSTANCE inst, DWORD reason, void *reserved)
 

Variables

struct d2d_settings d2d_settings
 
static const struct ID2D1Factory7Vtbl d2d_factory_vtbl
 
static const struct ID2D1MultithreadVtbl d2d_factory_multithread_vtbl
 
static const struct ID2D1MultithreadVtbl d2d_factory_multithread_noop_vtbl
 

Macro Definition Documentation

◆ D2D1_INIT_GUID

#define D2D1_INIT_GUID

Definition at line 19 of file factory.c.

Function Documentation

◆ D2D1ConvertColorSpace()

D2D1_COLOR_F WINAPI D2D1ConvertColorSpace ( D2D1_COLOR_SPACE  src_colour_space,
D2D1_COLOR_SPACE  dst_colour_space,
const D2D1_COLOR_F *  colour 
)

Definition at line 1536 of file factory.c.

1538{
1540
1541 TRACE("src_colour_space %#x, dst_colour_space %#x, colour %s.\n",
1542 src_colour_space, dst_colour_space, debug_d2d_color_f(colour));
1543
1544 if (src_colour_space == D2D1_COLOR_SPACE_CUSTOM || dst_colour_space == D2D1_COLOR_SPACE_CUSTOM)
1545 {
1546 ret.r = 0.0f;
1547 ret.g = 0.0f;
1548 ret.b = 0.0f;
1549 ret.a = 0.0f;
1550
1551 return ret;
1552 }
1553
1554 if (src_colour_space == dst_colour_space)
1555 return *colour;
1556
1557 if (src_colour_space == D2D1_COLOR_SPACE_SRGB && dst_colour_space == D2D1_COLOR_SPACE_SCRGB)
1558 {
1562 ret.a = colour->a;
1563
1564 return ret;
1565 }
1566
1567 if (src_colour_space == D2D1_COLOR_SPACE_SCRGB && dst_colour_space == D2D1_COLOR_SPACE_SRGB)
1568 {
1569 ret.r = srgb_transfer_function(colour->r);
1570 ret.g = srgb_transfer_function(colour->g);
1571 ret.b = srgb_transfer_function(colour->b);
1572 ret.a = colour->a;
1573
1574 return ret;
1575 }
1576
1577 FIXME("Unhandled conversion from source colour space %#x to destination colour space %#x.\n",
1578 src_colour_space, dst_colour_space);
1579 ret.r = 0.0f;
1580 ret.g = 0.0f;
1581 ret.b = 0.0f;
1582 ret.a = 0.0f;
1583
1584 return ret;
1585}
#define FIXME(fmt,...)
Definition: precomp.h:53
@ 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
static const char * debug_d2d_color_f(const D2D1_COLOR_F *colour)
Definition: d2d1_private.h:986
static float srgb_transfer_function(float x)
Definition: factory.c:1512
static float srgb_inverse_transfer_function(float x)
Definition: factory.c:1524
return ret
Definition: mutex.c:147
#define TRACE(s)
Definition: solgame.cpp:4

◆ D2D1CreateDevice()

HRESULT WINAPI D2D1CreateDevice ( IDXGIDevice *  dxgi_device,
const D2D1_CREATION_PROPERTIES *  properties,
ID2D1Device **  device 
)

Definition at line 1444 of file factory.c.

1446{
1447 D2D1_CREATION_PROPERTIES default_properties = {0};
1448 D2D1_FACTORY_OPTIONS factory_options;
1450 ID3D11Device *d3d_device;
1452 HRESULT hr;
1453
1454 TRACE("dxgi_device %p, properties %p, device %p.\n", dxgi_device, properties, device);
1455
1456 if (!properties)
1457 {
1458 if (SUCCEEDED(IDXGIDevice_QueryInterface(dxgi_device, &IID_ID3D11Device, (void **)&d3d_device)))
1459 {
1460 if (!(ID3D11Device_GetCreationFlags(d3d_device) & D3D11_CREATE_DEVICE_SINGLETHREADED))
1462 ID3D11Device_Release(d3d_device);
1463 }
1464 properties = &default_properties;
1465 }
1466
1467 switch (properties->threadingMode)
1468 {
1471 break;
1474 break;
1475 default:
1476 return E_INVALIDARG;
1477 }
1478
1479 factory_options.debugLevel = properties->debugLevel;
1480 if (FAILED(hr = D2D1CreateFactory(factory_type, &IID_ID2D1Factory1, &factory_options, (void **)&factory)))
1481 return hr;
1482
1483 hr = ID2D1Factory1_CreateDevice(factory, dxgi_device, device);
1484 ID2D1Factory1_Release(factory);
1485 return hr;
1486}
D2D1_FACTORY_TYPE
Definition: d2d1.idl:77
@ D2D1_FACTORY_TYPE_SINGLE_THREADED
Definition: d2d1.idl:78
@ D2D1_FACTORY_TYPE_MULTI_THREADED
Definition: d2d1.idl:79
@ D2D1_THREADING_MODE_SINGLE_THREADED
Definition: d2d1_1.idl:216
@ D2D1_THREADING_MODE_MULTI_THREADED
Definition: d2d1_1.idl:217
#define E_INVALIDARG
Definition: ddrawi.h:101
HRESULT hr
Definition: delayimp.cpp:582
HRESULT WINAPI D2D1CreateFactory(D2D1_FACTORY_TYPE factory_type, REFIID iid, const D2D1_FACTORY_OPTIONS *factory_options, void **factory)
Definition: factory.c:1363
factory_type
Definition: factory.h:22
#define SUCCEEDED(hr)
Definition: intsafe.h:50
#define FAILED(hr)
Definition: intsafe.h:51
D2D1_DEBUG_LEVEL debugLevel
Definition: d2d1_1.idl:224
D2D1_THREADING_MODE threadingMode
Definition: d2d1_1.idl:223
D2D1_DEBUG_LEVEL debugLevel
Definition: d2d1.idl:306
Definition: devices.h:37
Definition: main.c:439

◆ D2D1CreateFactory()

HRESULT WINAPI D2D1CreateFactory ( D2D1_FACTORY_TYPE  factory_type,
REFIID  iid,
const D2D1_FACTORY_OPTIONS *  factory_options,
void **  factory 
)

Definition at line 1363 of file factory.c.

1365{
1366 struct d2d_factory *object;
1367 HRESULT hr;
1368
1369 TRACE("factory_type %#x, iid %s, factory_options %p, factory %p.\n",
1370 factory_type, debugstr_guid(iid), factory_options, factory);
1371
1374 {
1375 return E_INVALIDARG;
1376 }
1377
1378 if (!(object = calloc(1, sizeof(*object))))
1379 return E_OUTOFMEMORY;
1380
1381 d2d_factory_init(object, factory_type, factory_options);
1382
1383 TRACE("Created factory %p.\n", object);
1384
1385 hr = ID2D1Factory7_QueryInterface(&object->ID2D1Factory7_iface, iid, factory);
1386 ID2D1Factory7_Release(&object->ID2D1Factory7_iface);
1387
1388 return hr;
1389}
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
static void d2d_factory_init(struct d2d_factory *factory, D2D1_FACTORY_TYPE factory_type, const D2D1_FACTORY_OPTIONS *factory_options)
Definition: factory.c:1346
#define debugstr_guid
Definition: kernel32.h:35
#define calloc
Definition: rosglue.h:14

Referenced by D2D1CreateDevice().

◆ D2D1InvertMatrix()

BOOL WINAPI D2D1InvertMatrix ( D2D1_MATRIX_3X2_F *  matrix)

Definition at line 1435 of file factory.c.

1436{
1438
1439 TRACE("matrix %p.\n", matrix);
1440
1441 return d2d_matrix_invert(matrix, &m);
1442}
static BOOL d2d_matrix_invert(D2D_MATRIX_3X2_F *dst, const D2D_MATRIX_3X2_F *src)
Definition: d2d1_private.h:936
GLuint GLenum matrix
Definition: glext.h:9407
const GLfloat * m
Definition: glext.h:10848

◆ D2D1IsMatrixInvertible()

BOOL WINAPI D2D1IsMatrixInvertible ( const D2D1_MATRIX_3X2_F *  matrix)

Definition at line 1428 of file factory.c.

1429{
1430 TRACE("matrix %p.\n", matrix);
1431
1432 return (matrix->_11 * matrix->_22 - matrix->_21 * matrix->_12) != 0.0f;
1433}

◆ D2D1MakeRotateMatrix()

void WINAPI D2D1MakeRotateMatrix ( float  angle,
D2D1_POINT_2F  center,
D2D1_MATRIX_3X2_F *  matrix 
)

Definition at line 1391 of file factory.c.

1392{
1393 float theta, sin_theta, cos_theta;
1394
1395 TRACE("angle %.8e, center %s, matrix %p.\n", angle, debug_d2d_point_2f(&center), matrix);
1396
1397 theta = angle * (M_PI / 180.0f);
1398 sin_theta = sinf(theta);
1399 cos_theta = cosf(theta);
1400
1401 /* translate(center) * rotate(theta) * translate(-center) */
1402 matrix->_11 = cos_theta;
1403 matrix->_12 = sin_theta;
1404 matrix->_21 = -sin_theta;
1405 matrix->_22 = cos_theta;
1406 matrix->_31 = center.x - center.x * cos_theta + center.y * sin_theta;
1407 matrix->_32 = center.y - center.x * sin_theta - center.y * cos_theta;
1408}
static const char * debug_d2d_point_2f(const D2D1_POINT_2F *point)
Definition: d2d1_private.h:993
_ACRTIMP float __cdecl cosf(float)
Definition: cosf.c:13
_ACRTIMP float __cdecl sinf(float)
Definition: sinf.c:13
GLfloat angle
Definition: glext.h:10853
#define M_PI
Definition: macros.h:263

◆ D2D1MakeSkewMatrix()

void WINAPI D2D1MakeSkewMatrix ( float  angle_x,
float  angle_y,
D2D1_POINT_2F  center,
D2D1_MATRIX_3X2_F *  matrix 
)

Definition at line 1410 of file factory.c.

1411{
1412 float tan_x, tan_y;
1413
1414 TRACE("angle_x %.8e, angle_y %.8e, center %s, matrix %p.\n", angle_x, angle_y, debug_d2d_point_2f(&center), matrix);
1415
1416 tan_x = tan(angle_x * (M_PI / 180.0f));
1417 tan_y = tan(angle_y * (M_PI / 180.0f));
1418
1419 /* translate(-center) * skew() * translate(center) */
1420 matrix->_11 = 1.0f;
1421 matrix->_12 = tan_y;
1422 matrix->_21 = tan_x;
1423 matrix->_22 = 1.0f;
1424 matrix->_31 = -tan_x * center.y;
1425 matrix->_32 = -tan_y * center.x;
1426}
_ACRTIMP double __cdecl tan(double)
Definition: tan.c:122

◆ D2D1SinCos()

void WINAPI D2D1SinCos ( float  angle,
float *  s,
float *  c 
)

Definition at line 1488 of file factory.c.

1489{
1490 TRACE("angle %.8e, s %p, c %p.\n", angle, s, c);
1491
1492 *s = sinf(angle);
1493 *c = cosf(angle);
1494}
GLdouble s
Definition: gl.h:2039
const GLubyte * c
Definition: glext.h:8905

◆ D2D1Tan()

float WINAPI D2D1Tan ( float  angle)

Definition at line 1496 of file factory.c.

1497{
1498 TRACE("angle %.8e.\n", angle);
1499
1500 return tanf(angle);
1501}
_ACRTIMP float __cdecl tanf(float)
Definition: tanf.c:72

◆ D2D1Vec3Length()

float WINAPI D2D1Vec3Length ( float  x,
float  y,
float  z 
)

Definition at line 1503 of file factory.c.

1504{
1505 TRACE("x %.8e, y %.8e, z %.8e.\n", x, y, z);
1506
1507 return sqrtf(x * x + y * y + z * z);
1508}
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
GLdouble GLdouble z
Definition: glext.h:5874
#define sqrtf(x)
Definition: mymath.h:59

◆ d2d_effect_registration_cleanup()

static void d2d_effect_registration_cleanup ( struct d2d_effect_registration *  reg)
static

Definition at line 33 of file factory.c.

34{
35 ID2D1Properties_Release(&reg->properties->ID2D1Properties_iface);
36 free(reg);
37}
#define free
Definition: debug_ros.c:5
static int reg
Definition: i386-dis.c:1290

Referenced by d2d_factory_register_effect_from_stream(), d2d_factory_Release(), and d2d_factory_UnregisterEffect().

◆ d2d_factory_AddRef()

static ULONG STDMETHODCALLTYPE d2d_factory_AddRef ( ID2D1Factory7 *  iface)
static

Definition at line 133 of file factory.c.

134{
137
138 TRACE("%p increasing refcount to %lu.\n", iface, refcount);
139
140 return refcount;
141}
#define InterlockedIncrement
Definition: armddk.h:53
static struct d2d_factory * impl_from_ID2D1Factory7(ID2D1Factory7 *iface)
Definition: factory.c:39
uint32_t ULONG
Definition: typedefs.h:59

Referenced by d2d_factory_mt_AddRef().

◆ d2d_factory_builtins_initonce()

static BOOL WINAPI d2d_factory_builtins_initonce ( INIT_ONCE *  once,
void *  param,
void **  context 
)
static

Definition at line 49 of file factory.c.

50{
52
53 return TRUE;
54}
void d2d_effects_init_builtins(struct d2d_factory *factory)
Definition: effect.c:1074
#define TRUE
Definition: types.h:120
GLfloat param
Definition: glext.h:5796

Referenced by d2d_factory_init_builtin_effects().

◆ d2d_factory_create_device()

HRESULT d2d_factory_create_device ( ID2D1Factory1 *  factory,
IDXGIDevice *  dxgi_device,
bool  allow_get_dxgi_device,
REFIID  iid,
void **  device 
)

Definition at line 516 of file factory.c.

518{
519 struct d2d_device *object;
520 HRESULT hr;
521
522 if (!(object = calloc(1, sizeof(*object))))
523 return E_OUTOFMEMORY;
524
526
527 TRACE("Create device %p.\n", object);
528
529 hr = ID2D1Device6_QueryInterface(&object->ID2D1Device6_iface, iid, device);
530 ID2D1Device6_Release(&object->ID2D1Device6_iface);
531
532 return hr;
533}
void d2d_device_init(struct d2d_device *device, ID2D1Factory1 *factory, IDXGIDevice *dxgi_device, bool allow_get_dxgi_device)
Definition: device.c:4530
bool allow_get_dxgi_device
Definition: d2d1_private.h:616

Referenced by d2d_dc_render_target_init(), d2d_factory_CreateDevice(), d2d_factory_ID2D1Factory2_CreateDevice(), d2d_factory_ID2D1Factory3_CreateDevice(), d2d_factory_ID2D1Factory4_CreateDevice(), d2d_factory_ID2D1Factory5_CreateDevice(), d2d_factory_ID2D1Factory6_CreateDevice(), d2d_factory_ID2D1Factory7_CreateDevice(), d2d_hwnd_render_target_init(), and d2d_wic_render_target_init().

◆ d2d_factory_CreateDCRenderTarget()

static HRESULT STDMETHODCALLTYPE d2d_factory_CreateDCRenderTarget ( ID2D1Factory7 *  iface,
const D2D1_RENDER_TARGET_PROPERTIES *  desc,
ID2D1DCRenderTarget **  render_target 
)
static

Definition at line 487 of file factory.c.

489{
493 HRESULT hr;
494
495 TRACE("iface %p, desc %p, render_target %p.\n", iface, desc, render_target);
496
498 return hr;
499
500 if (!(object = calloc(1, sizeof(*object))))
501 return E_OUTOFMEMORY;
502
503 if (FAILED(hr = d2d_dc_render_target_init(object, (ID2D1Factory1 *)iface, device, desc)))
504 {
505 WARN("Failed to initialise render target, hr %#lx.\n", hr);
506 free(object);
507 return hr;
508 }
509
510 TRACE("Created render target %p.\n", object);
511 *render_target = &object->ID2D1DCRenderTarget_iface;
512
513 return S_OK;
514}
#define WARN(fmt,...)
Definition: precomp.h:61
HRESULT d2d_dc_render_target_init(struct d2d_dc_render_target *render_target, ID2D1Factory1 *factory, ID3D10Device1 *d3d_device, const D2D1_RENDER_TARGET_PROPERTIES *desc)
static HRESULT d2d_factory_get_device(struct d2d_factory *factory, ID3D10Device1 **device)
Definition: factory.c:384
#define S_OK
Definition: intsafe.h:52
D3D11_SHADER_VARIABLE_DESC desc
Definition: reflection.c:1683

◆ d2d_factory_CreateDevice()

static HRESULT STDMETHODCALLTYPE d2d_factory_CreateDevice ( ID2D1Factory7 *  iface,
IDXGIDevice *  dxgi_device,
ID2D1Device **  device 
)
static

Definition at line 535 of file factory.c.

537{
538 TRACE("iface %p, dxgi_device %p, device %p.\n", iface, dxgi_device, device);
539
540 return d2d_factory_create_device((ID2D1Factory1 *)iface, dxgi_device, true, &IID_ID2D1Device, (void **)device);
541}
HRESULT d2d_factory_create_device(ID2D1Factory1 *factory, IDXGIDevice *dxgi_device, bool allow_get_dxgi_device, REFIID iid, void **device)
Definition: factory.c:516

◆ d2d_factory_CreateDrawingStateBlock()

static HRESULT STDMETHODCALLTYPE d2d_factory_CreateDrawingStateBlock ( ID2D1Factory7 *  iface,
const D2D1_DRAWING_STATE_DESCRIPTION *  desc,
IDWriteRenderingParams *  text_rendering_params,
ID2D1DrawingStateBlock **  state_block 
)
static

Definition at line 356 of file factory.c.

359{
361 struct d2d_state_block *object;
362
363 TRACE("iface %p, desc %p, text_rendering_params %p, state_block %p.\n",
364 iface, desc, text_rendering_params, state_block);
365
366 if (!(object = calloc(1, sizeof(*object))))
367 return E_OUTOFMEMORY;
368
369 if (desc)
370 {
371 memcpy(&state_desc, desc, sizeof(*desc));
373 state_desc.unitMode = D2D1_UNIT_MODE_DIPS;
374 }
375
376 d2d_state_block_init(object, (ID2D1Factory *)iface, desc ? &state_desc : NULL, text_rendering_params);
377
378 TRACE("Created state block %p.\n", object);
379 *state_block = (ID2D1DrawingStateBlock *)&object->ID2D1DrawingStateBlock1_iface;
380
381 return S_OK;
382}
@ D2D1_UNIT_MODE_DIPS
Definition: d2d1_1.idl:65
@ D2D1_PRIMITIVE_BLEND_SOURCE_OVER
Definition: d2d1_1.idl:55
void d2d_state_block_init(struct d2d_state_block *state_block, ID2D1Factory *factory, const D2D1_DRAWING_STATE_DESCRIPTION1 *desc, IDWriteRenderingParams *text_rendering_params)
Definition: state_block.c:164
#define NULL
Definition: types.h:112
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
D2D1_PRIMITIVE_BLEND primitiveBlend
Definition: d2d1_1.idl:247
IDWriteRenderingParams * text_rendering_params
Definition: d2d1_private.h:457

◆ d2d_factory_CreateDrawingStateBlock1()

static HRESULT STDMETHODCALLTYPE d2d_factory_CreateDrawingStateBlock1 ( ID2D1Factory7 *  iface,
const D2D1_DRAWING_STATE_DESCRIPTION1 *  desc,
IDWriteRenderingParams *  text_rendering_params,
ID2D1DrawingStateBlock1 **  state_block 
)
static

Definition at line 588 of file factory.c.

591{
592 struct d2d_state_block *object;
593
594 TRACE("iface %p, desc %p, text_rendering_params %p, state_block %p.\n",
595 iface, desc, text_rendering_params, state_block);
596
597 if (!(object = calloc(1, sizeof(*object))))
598 return E_OUTOFMEMORY;
599
601
602 TRACE("Created state block %p.\n", object);
603 *state_block = &object->ID2D1DrawingStateBlock1_iface;
604
605 return S_OK;
606}

◆ d2d_factory_CreateDxgiSurfaceRenderTarget()

static HRESULT STDMETHODCALLTYPE d2d_factory_CreateDxgiSurfaceRenderTarget ( ID2D1Factory7 *  iface,
IDXGISurface *  surface,
const D2D1_RENDER_TARGET_PROPERTIES *  desc,
ID2D1RenderTarget **  render_target 
)
static

Definition at line 458 of file factory.c.

460{
461 IDXGIDevice *dxgi_device;
463 HRESULT hr;
464
465 TRACE("iface %p, surface %p, desc %p, render_target %p.\n", iface, surface, desc, render_target);
466
467 if (FAILED(hr = IDXGISurface_GetDevice(surface, &IID_IDXGIDevice, (void **)&dxgi_device)))
468 {
469 WARN("Failed to get DXGI device, hr %#lx.\n", hr);
470 return hr;
471 }
472
473 hr = ID2D1Factory1_CreateDevice((ID2D1Factory1 *)iface, dxgi_device, &device);
474 IDXGIDevice_Release(dxgi_device);
475 if (FAILED(hr))
476 {
477 WARN("Failed to create D2D device, hr %#lx.\n", hr);
478 return hr;
479 }
480
482 NULL, NULL, desc, (void **)render_target);
483 ID2D1Device_Release(device);
484 return hr;
485}
struct d2d_device * unsafe_impl_from_ID2D1Device(ID2D1Device1 *iface)
Definition: device.c:4522
HRESULT d2d_d3d_create_render_target(struct d2d_device *device, IDXGISurface *surface, IUnknown *outer_unknown, const struct d2d_device_context_ops *ops, const D2D1_RENDER_TARGET_PROPERTIES *desc, void **render_target)
Definition: device.c:4183

◆ d2d_factory_CreateEllipseGeometry()

static HRESULT STDMETHODCALLTYPE d2d_factory_CreateEllipseGeometry ( ID2D1Factory7 *  iface,
const D2D1_ELLIPSE *  ellipse,
ID2D1EllipseGeometry **  geometry 
)
static

Definition at line 233 of file factory.c.

235{
236 struct d2d_geometry *object;
237 HRESULT hr;
238
239 TRACE("iface %p, ellipse %s, geometry %p.\n", iface, debug_d2d_ellipse(ellipse), geometry);
240
241 if (!(object = calloc(1, sizeof(*object))))
242 return E_OUTOFMEMORY;
243
244 if (FAILED(hr = d2d_ellipse_geometry_init(object, (ID2D1Factory *)iface, ellipse)))
245 {
246 WARN("Failed to initialise ellipse geometry, hr %#lx.\n", hr);
247 free(object);
248 return hr;
249 }
250
251 TRACE("Created ellipse geometry %p.\n", object);
252 *geometry = (ID2D1EllipseGeometry *)&object->ID2D1Geometry_iface;
253
254 return S_OK;
255}
static const char * debug_d2d_ellipse(const D2D1_ELLIPSE *ellipse)
HRESULT d2d_ellipse_geometry_init(struct d2d_geometry *geometry, ID2D1Factory *factory, const D2D1_ELLIPSE *ellipse)
Definition: geometry.c:4185
D2D1_ELLIPSE ellipse
Definition: d2d1_private.h:559

◆ d2d_factory_CreateGdiMetafile()

static HRESULT STDMETHODCALLTYPE d2d_factory_CreateGdiMetafile ( ID2D1Factory7 *  iface,
IStream *  stream,
ID2D1GdiMetafile **  metafile 
)
static

Definition at line 608 of file factory.c.

610{
611 FIXME("iface %p, stream %p, metafile %p stub!\n", iface, stream, metafile);
612
613 return E_NOTIMPL;
614}
#define E_NOTIMPL
Definition: ddrawi.h:99
static const unsigned char metafile[]
Definition: olepicture.c:126
Definition: parse.h:23

◆ d2d_factory_CreateGeometryGroup()

static HRESULT STDMETHODCALLTYPE d2d_factory_CreateGeometryGroup ( ID2D1Factory7 *  iface,
D2D1_FILL_MODE  fill_mode,
ID2D1Geometry **  geometries,
UINT32  geometry_count,
ID2D1GeometryGroup **  group 
)
static

Definition at line 257 of file factory.c.

259{
260 struct d2d_geometry *object;
261 HRESULT hr;
262
263 TRACE("iface %p, fill_mode %#x, geometries %p, geometry_count %u, group %p.\n",
264 iface, fill_mode, geometries, geometry_count, group);
265
266 if (!(object = calloc(1, sizeof(*object))))
267 return E_OUTOFMEMORY;
268
269 if (FAILED(hr = d2d_geometry_group_init(object, (ID2D1Factory *)iface, fill_mode, geometries, geometry_count)))
270 {
271 WARN("Failed to initialise geometry group, hr %#lx.\n", hr);
272 free(object);
273 return hr;
274 }
275
276 TRACE("Created geometry group %p.\n", object);
277 *group = (ID2D1GeometryGroup *)&object->ID2D1Geometry_iface;
278
279 return S_OK;
280}
HRESULT d2d_geometry_group_init(struct d2d_geometry *geometry, ID2D1Factory *factory, D2D1_FILL_MODE fill_mode, ID2D1Geometry **src_geometries, unsigned int geometry_count)
Definition: geometry.c:5497
GLboolean GLuint group
Definition: glext.h:11120
D2D1_FILL_MODE fill_mode
Definition: d2d1_private.h:570
UINT32 geometry_count
Definition: d2d1_private.h:591

◆ d2d_factory_CreateHwndRenderTarget()

static HRESULT STDMETHODCALLTYPE d2d_factory_CreateHwndRenderTarget ( ID2D1Factory7 *  iface,
const D2D1_RENDER_TARGET_PROPERTIES *  desc,
const D2D1_HWND_RENDER_TARGET_PROPERTIES *  hwnd_rt_desc,
ID2D1HwndRenderTarget **  render_target 
)
static

Definition at line 428 of file factory.c.

431{
435 HRESULT hr;
436
437 TRACE("iface %p, desc %p, hwnd_rt_desc %p, render_target %p.\n", iface, desc, hwnd_rt_desc, render_target);
438
440 return hr;
441
442 if (!(object = calloc(1, sizeof(*object))))
443 return E_OUTOFMEMORY;
444
445 if (FAILED(hr = d2d_hwnd_render_target_init(object, (ID2D1Factory1 *)iface, device, desc, hwnd_rt_desc)))
446 {
447 WARN("Failed to initialise render target, hr %#lx.\n", hr);
448 free(object);
449 return hr;
450 }
451
452 TRACE("Created render target %p.\n", object);
453 *render_target = &object->ID2D1HwndRenderTarget_iface;
454
455 return S_OK;
456}
HRESULT d2d_hwnd_render_target_init(struct d2d_hwnd_render_target *render_target, ID2D1Factory1 *factory, ID3D10Device1 *d3d_device, const D2D1_RENDER_TARGET_PROPERTIES *desc, const D2D1_HWND_RENDER_TARGET_PROPERTIES *hwnd_desc)

◆ d2d_factory_CreatePathGeometry()

static HRESULT STDMETHODCALLTYPE d2d_factory_CreatePathGeometry ( ID2D1Factory7 *  iface,
ID2D1PathGeometry **  geometry 
)
static

Definition at line 302 of file factory.c.

304{
305 struct d2d_geometry *object;
306
307 TRACE("iface %p, geometry %p.\n", iface, geometry);
308
309 if (!(object = calloc(1, sizeof(*object))))
310 return E_OUTOFMEMORY;
311
312 d2d_path_geometry_init(object, (ID2D1Factory *)iface);
313
314 TRACE("Created path geometry %p.\n", object);
315 *geometry = (ID2D1PathGeometry *)&object->ID2D1Geometry_iface;
316
317 return S_OK;
318}
void d2d_path_geometry_init(struct d2d_geometry *geometry, ID2D1Factory *factory)
Definition: geometry.c:3965

◆ d2d_factory_CreatePathGeometry1()

static HRESULT STDMETHODCALLTYPE d2d_factory_CreatePathGeometry1 ( ID2D1Factory7 *  iface,
ID2D1PathGeometry1 **  geometry 
)
static

Definition at line 570 of file factory.c.

572{
573 struct d2d_geometry *object;
574
575 TRACE("iface %p, geometry %p.\n", iface, geometry);
576
577 if (!(object = calloc(1, sizeof(*object))))
578 return E_OUTOFMEMORY;
579
580 d2d_path_geometry_init(object, (ID2D1Factory *)iface);
581
582 TRACE("Created path geometry %p.\n", object);
583 *geometry = (ID2D1PathGeometry1 *)&object->ID2D1Geometry_iface;
584
585 return S_OK;
586}

◆ d2d_factory_CreateRectangleGeometry()

static HRESULT STDMETHODCALLTYPE d2d_factory_CreateRectangleGeometry ( ID2D1Factory7 *  iface,
const D2D1_RECT_F *  rect,
ID2D1RectangleGeometry **  geometry 
)
static

Definition at line 185 of file factory.c.

187{
188 struct d2d_geometry *object;
189 HRESULT hr;
190
191 TRACE("iface %p, rect %s, geometry %p.\n", iface, debug_d2d_rect_f(rect), geometry);
192
193 if (!(object = calloc(1, sizeof(*object))))
194 return E_OUTOFMEMORY;
195
196 if (FAILED(hr = d2d_rectangle_geometry_init(object, (ID2D1Factory *)iface, rect)))
197 {
198 WARN("Failed to initialise rectangle geometry, hr %#lx.\n", hr);
199 free(object);
200 return hr;
201 }
202
203 TRACE("Created rectangle geometry %p.\n", object);
204 *geometry = (ID2D1RectangleGeometry *)&object->ID2D1Geometry_iface;
205
206 return S_OK;
207}
RECT rect
Definition: combotst.c:67
static const char * debug_d2d_rect_f(const D2D1_RECT_F *rect)
HRESULT d2d_rectangle_geometry_init(struct d2d_geometry *geometry, ID2D1Factory *factory, const D2D1_RECT_F *rect)
Definition: geometry.c:4591

◆ d2d_factory_CreateRoundedRectangleGeometry()

static HRESULT STDMETHODCALLTYPE d2d_factory_CreateRoundedRectangleGeometry ( ID2D1Factory7 *  iface,
const D2D1_ROUNDED_RECT *  rounded_rect,
ID2D1RoundedRectangleGeometry **  geometry 
)
static

Definition at line 209 of file factory.c.

211{
212 struct d2d_geometry *object;
213 HRESULT hr;
214
215 TRACE("iface %p, rounded_rect %s, geometry %p.\n", iface, debug_d2d_rounded_rect(rounded_rect), geometry);
216
217 if (!(object = calloc(1, sizeof(*object))))
218 return E_OUTOFMEMORY;
219
221 {
222 WARN("Failed to initialise rounded rectangle geometry, hr %#lx.\n", hr);
223 free(object);
224 return hr;
225 }
226
227 TRACE("Created rounded rectangle geometry %p.\n", object);
228 *geometry = (ID2D1RoundedRectangleGeometry *)&object->ID2D1Geometry_iface;
229
230 return S_OK;
231}
HRESULT d2d_rounded_rectangle_geometry_init(struct d2d_geometry *geometry, ID2D1Factory *factory, const D2D1_ROUNDED_RECT *rounded_rect)
Definition: geometry.c:4876
static const char * debug_d2d_rounded_rect(const D2D1_ROUNDED_RECT *rounded_rect)
D2D1_ROUNDED_RECT rounded_rect
Definition: d2d1_private.h:581

◆ d2d_factory_CreateStrokeStyle()

static HRESULT STDMETHODCALLTYPE d2d_factory_CreateStrokeStyle ( ID2D1Factory7 *  iface,
const D2D1_STROKE_STYLE_PROPERTIES *  desc,
const float *  dashes,
UINT32  dash_count,
ID2D1StrokeStyle **  stroke_style 
)
static

Definition at line 320 of file factory.c.

323{
324 struct d2d_stroke_style *object;
326 HRESULT hr;
327
328 TRACE("iface %p, desc %p, dashes %p, dash_count %u, stroke_style %p.\n",
329 iface, desc, dashes, dash_count, stroke_style);
330
331 if (!(object = calloc(1, sizeof(*object))))
332 return E_OUTOFMEMORY;
333
334 desc1.startCap = desc->startCap;
335 desc1.endCap = desc->endCap;
336 desc1.dashCap = desc->dashCap;
337 desc1.lineJoin = desc->lineJoin;
338 desc1.miterLimit = desc->miterLimit;
339 desc1.dashStyle = desc->dashStyle;
340 desc1.dashOffset = desc->dashOffset;
342
343 if (FAILED(hr = d2d_stroke_style_init(object, (ID2D1Factory *)iface, &desc1, dashes, dash_count)))
344 {
345 WARN("Failed to initialise stroke style, hr %#lx.\n", hr);
346 free(object);
347 return hr;
348 }
349
350 TRACE("Created stroke style %p.\n", object);
351 *stroke_style = (ID2D1StrokeStyle *)&object->ID2D1StrokeStyle1_iface;
352
353 return S_OK;
354}
@ D2D1_STROKE_TRANSFORM_TYPE_NORMAL
Definition: d2d1_1.idl:47
HRESULT d2d_stroke_style_init(struct d2d_stroke_style *style, ID2D1Factory *factory, const D2D1_STROKE_STYLE_PROPERTIES1 *desc, const float *dashes, UINT32 dash_count)
Definition: stroke.c:202
D2D1_STROKE_TRANSFORM_TYPE transformType
Definition: d2d1_1.idl:237
D2D1_DASH_STYLE dashStyle
Definition: d2d1_1.idl:235

◆ d2d_factory_CreateStrokeStyle1()

static HRESULT STDMETHODCALLTYPE d2d_factory_CreateStrokeStyle1 ( ID2D1Factory7 *  iface,
const D2D1_STROKE_STYLE_PROPERTIES1 *  desc,
const float *  dashes,
UINT32  dash_count,
ID2D1StrokeStyle1 **  stroke_style 
)
static

Definition at line 543 of file factory.c.

546{
547 struct d2d_stroke_style *object;
548 HRESULT hr;
549
550 TRACE("iface %p, desc %p, dashes %p, dash_count %u, stroke_style %p.\n",
551 iface, desc, dashes, dash_count, stroke_style);
552
553 if (!(object = calloc(1, sizeof(*object))))
554 return E_OUTOFMEMORY;
555
556 if (FAILED(hr = d2d_stroke_style_init(object, (ID2D1Factory *)iface,
558 {
559 WARN("Failed to initialise stroke style, hr %#lx.\n", hr);
560 free(object);
561 return hr;
562 }
563
564 TRACE("Created stroke style %p.\n", object);
565 *stroke_style = &object->ID2D1StrokeStyle1_iface;
566
567 return S_OK;
568}

◆ d2d_factory_CreateTransformedGeometry()

static HRESULT STDMETHODCALLTYPE d2d_factory_CreateTransformedGeometry ( ID2D1Factory7 *  iface,
ID2D1Geometry *  src_geometry,
const D2D1_MATRIX_3X2_F *  transform,
ID2D1TransformedGeometry **  transformed_geometry 
)
static

Definition at line 282 of file factory.c.

285{
286 struct d2d_geometry *object;
287
288 TRACE("iface %p, src_geometry %p, transform %p, transformed_geometry %p.\n",
289 iface, src_geometry, transform, transformed_geometry);
290
291 if (!(object = calloc(1, sizeof(*object))))
292 return E_OUTOFMEMORY;
293
295
296 TRACE("Created transformed geometry %p.\n", object);
297 *transformed_geometry = (ID2D1TransformedGeometry *)&object->ID2D1Geometry_iface;
298
299 return S_OK;
300}
void d2d_transformed_geometry_init(struct d2d_geometry *geometry, ID2D1Factory *factory, ID2D1Geometry *src_geometry, const D2D_MATRIX_3X2_F *transform)
Definition: geometry.c:5226
GLuint GLenum GLenum transform
Definition: glext.h:9407
ID2D1Geometry * src_geometry
Definition: d2d1_private.h:585

◆ d2d_factory_CreateWicBitmapRenderTarget()

static HRESULT STDMETHODCALLTYPE d2d_factory_CreateWicBitmapRenderTarget ( ID2D1Factory7 *  iface,
IWICBitmap *  target,
const D2D1_RENDER_TARGET_PROPERTIES *  desc,
ID2D1RenderTarget **  render_target 
)
static

Definition at line 396 of file factory.c.

398{
402 HRESULT hr;
403
404 TRACE("iface %p, target %p, desc %p, render_target %p.\n", iface, target, desc, render_target);
405
406 if (!(object = calloc(1, sizeof(*object))))
407 return E_OUTOFMEMORY;
408
410 {
411 free(object);
412 return hr;
413 }
414
416 {
417 WARN("Failed to initialise render target, hr %#lx.\n", hr);
418 free(object);
419 return hr;
420 }
421
422 TRACE("Created render target %p.\n", object);
423 *render_target = object->dxgi_target;
424
425 return S_OK;
426}
HRESULT d2d_wic_render_target_init(struct d2d_wic_render_target *render_target, ID2D1Factory1 *factory, ID3D10Device1 *d3d_device, IWICBitmap *bitmap, const D2D1_RENDER_TARGET_PROPERTIES *desc)
Definition: tools.h:99

◆ d2d_factory_get_device()

static HRESULT d2d_factory_get_device ( struct d2d_factory *  factory,
ID3D10Device1 **  device 
)
static

Definition at line 384 of file factory.c.

385{
386 HRESULT hr = S_OK;
387
390 WARN("Failed to create device, hr %#lx.\n", hr);
391
392 *device = factory->device;
393 return hr;
394}
@ 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_HARDWARE
Definition: d3d10misc.h:29

Referenced by d2d_factory_CreateDCRenderTarget(), d2d_factory_CreateHwndRenderTarget(), and d2d_factory_CreateWicBitmapRenderTarget().

◆ d2d_factory_get_registered_effect()

struct d2d_effect_registration * d2d_factory_get_registered_effect ( ID2D1Factory *  iface,
const GUID *  id 
)

Definition at line 66 of file factory.c.

68{
71
73
75 {
76 if (IsEqualGUID(id, &reg->id)) return reg;
77 }
78
79 return NULL;
80}
static struct d2d_factory * unsafe_impl_from_ID2D1Factory(ID2D1Factory *iface)
Definition: d2d1_private.h:704
static void d2d_factory_init_builtin_effects(struct d2d_factory *factory)
Definition: factory.c:56
uint32_t entry
Definition: isohybrid.c:63
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
#define LIST_FOR_EACH_ENTRY(elem, list, type, field)
Definition: list.h:236

Referenced by d2d_effect_create(), and d2d_factory_GetEffectProperties().

◆ d2d_factory_GetDesktopDpi()

static void STDMETHODCALLTYPE d2d_factory_GetDesktopDpi ( ID2D1Factory7 *  iface,
float *  dpi_x,
float *  dpi_y 
)
static

Definition at line 175 of file factory.c.

176{
178
179 TRACE("iface %p, dpi_x %p, dpi_y %p.\n", iface, dpi_x, dpi_y);
180
181 *dpi_x = factory->dpi_x;
182 *dpi_y = factory->dpi_y;
183}

◆ d2d_factory_GetEffectProperties()

static HRESULT STDMETHODCALLTYPE d2d_factory_GetEffectProperties ( ID2D1Factory7 *  iface,
REFCLSID  effect_id,
ID2D1Properties **  props 
)
static

Definition at line 1165 of file factory.c.

1167{
1169 const struct d2d_effect_registration *reg;
1170
1171 TRACE("iface %p, effect_id %s, props %p.\n", iface, debugstr_guid(effect_id), props);
1172
1174
1176 {
1177 WARN("Effect id %s not found.\n", wine_dbgstr_guid(effect_id));
1179 }
1180
1181 *props = &reg->properties->ID2D1Properties_iface;
1182 ID2D1Properties_AddRef(*props);
1183
1184 return S_OK;
1185}
struct d2d_effect_registration * d2d_factory_get_registered_effect(ID2D1Factory *iface, const GUID *id)
Definition: factory.c:66
static __inline const char * wine_dbgstr_guid(const GUID *id)
Definition: debug.h:181
static const WCHAR props[]
Definition: wbemdisp.c:288
static HRESULT HRESULT_FROM_WIN32(unsigned int x)
Definition: winerror.h:210
#define ERROR_NOT_FOUND
Definition: winerror.h:1014

◆ d2d_factory_GetRegisteredEffects()

static HRESULT STDMETHODCALLTYPE d2d_factory_GetRegisteredEffects ( ID2D1Factory7 *  iface,
CLSID *  effects,
UINT32  effect_count,
UINT32 *  returned,
UINT32 *  registered 
)
static

Definition at line 1130 of file factory.c.

1132{
1134 struct d2d_effect_registration *effect;
1135 UINT32 ret, reg;
1136
1137 TRACE("iface %p, effects %p, effect_count %u, returned %p, registered %p.\n",
1138 iface, effects, effect_count, returned, registered);
1139
1140 if (!returned) returned = &ret;
1141 if (!registered) registered = ®
1142
1143 *registered = 0;
1144 *returned = 0;
1145
1147
1148 LIST_FOR_EACH_ENTRY(effect, &factory->effects, struct d2d_effect_registration, entry)
1149 {
1150 if (effects && effect_count)
1151 {
1152 *effects = effect->id;
1153 effects++;
1154 effect_count--;
1155 *returned += 1;
1156 }
1157
1158 *registered += 1;
1159 }
1160
1161 if (!effects) return S_OK;
1162 return *returned == *registered ? S_OK : D2DERR_INSUFFICIENT_BUFFER;
1163}
#define D2DERR_INSUFFICIENT_BUFFER
Definition: d2derr.h:23
uint32_t UINT32
Definition: typedefs.h:59

◆ d2d_factory_ID2D1Factory2_CreateDevice()

static HRESULT STDMETHODCALLTYPE d2d_factory_ID2D1Factory2_CreateDevice ( ID2D1Factory7 *  iface,
IDXGIDevice *  dxgi_device,
ID2D1Device1 **  device 
)
static

Definition at line 1187 of file factory.c.

1189{
1190 TRACE("iface %p, dxgi_device %p, device %p.\n", iface, dxgi_device, device);
1191
1192 return d2d_factory_create_device((ID2D1Factory1 *)iface, dxgi_device, true, &IID_ID2D1Device1, (void **)device);
1193}

◆ d2d_factory_ID2D1Factory3_CreateDevice()

static HRESULT STDMETHODCALLTYPE d2d_factory_ID2D1Factory3_CreateDevice ( ID2D1Factory7 *  iface,
IDXGIDevice *  dxgi_device,
ID2D1Device2 **  device 
)
static

Definition at line 1195 of file factory.c.

1197{
1198 TRACE("iface %p, dxgi_device %p, device %p.\n", iface, dxgi_device, device);
1199
1200 return d2d_factory_create_device((ID2D1Factory1 *)iface, dxgi_device, true, &IID_ID2D1Device2, (void **)device);
1201}

◆ d2d_factory_ID2D1Factory4_CreateDevice()

static HRESULT STDMETHODCALLTYPE d2d_factory_ID2D1Factory4_CreateDevice ( ID2D1Factory7 *  iface,
IDXGIDevice *  dxgi_device,
ID2D1Device3 **  device 
)
static

Definition at line 1203 of file factory.c.

1205{
1206 TRACE("iface %p, dxgi_device %p, device %p.\n", iface, dxgi_device, device);
1207
1208 return d2d_factory_create_device((ID2D1Factory1 *)iface, dxgi_device, true, &IID_ID2D1Device3, (void **)device);
1209}

◆ d2d_factory_ID2D1Factory5_CreateDevice()

static HRESULT STDMETHODCALLTYPE d2d_factory_ID2D1Factory5_CreateDevice ( ID2D1Factory7 *  iface,
IDXGIDevice *  dxgi_device,
ID2D1Device4 **  device 
)
static

Definition at line 1211 of file factory.c.

1213{
1214 TRACE("iface %p, dxgi_device %p, device %p.\n", iface, dxgi_device, device);
1215
1216 return d2d_factory_create_device((ID2D1Factory1 *)iface, dxgi_device, true, &IID_ID2D1Device4, (void **)device);
1217}

◆ d2d_factory_ID2D1Factory6_CreateDevice()

static HRESULT STDMETHODCALLTYPE d2d_factory_ID2D1Factory6_CreateDevice ( ID2D1Factory7 *  iface,
IDXGIDevice *  dxgi_device,
ID2D1Device5 **  device 
)
static

Definition at line 1219 of file factory.c.

1221{
1222 TRACE("iface %p, dxgi_device %p, device %p.\n", iface, dxgi_device, device);
1223
1224 return d2d_factory_create_device((ID2D1Factory1 *)iface, dxgi_device, true, &IID_ID2D1Device5, (void **)device);
1225}

◆ d2d_factory_ID2D1Factory7_CreateDevice()

static HRESULT STDMETHODCALLTYPE d2d_factory_ID2D1Factory7_CreateDevice ( ID2D1Factory7 *  iface,
IDXGIDevice *  dxgi_device,
ID2D1Device6 **  device 
)
static

Definition at line 1227 of file factory.c.

1229{
1230 TRACE("iface %p, dxgi_device %p, device %p.\n", iface, dxgi_device, device);
1231
1232 return d2d_factory_create_device((ID2D1Factory1 *)iface, dxgi_device, true, &IID_ID2D1Device6, (void **)device);
1233}

◆ d2d_factory_init()

static void d2d_factory_init ( struct d2d_factory *  factory,
D2D1_FACTORY_TYPE  factory_type,
const D2D1_FACTORY_OPTIONS *  factory_options 
)
static

Definition at line 1346 of file factory.c.

1348{
1349 if (factory_options && factory_options->debugLevel != D2D1_DEBUG_LEVEL_NONE)
1350 WARN("Ignoring debug level %#x.\n", factory_options->debugLevel);
1351
1352 factory->ID2D1Factory7_iface.lpVtbl = &d2d_factory_vtbl;
1353 factory->ID2D1Multithread_iface.lpVtbl = factory_type == D2D1_FACTORY_TYPE_SINGLE_THREADED ?
1355 factory->factory_type = factory_type;
1356 factory->refcount = 1;
1358 list_init(&factory->effects);
1360 InitOnceInitialize(&factory->init_builtins);
1361}
static void list_init(struct list_entry *head)
Definition: list.h:51
@ D2D1_DEBUG_LEVEL_NONE
Definition: d2d1.idl:69
static const struct ID2D1Factory7Vtbl d2d_factory_vtbl
Definition: factory.c:1235
static const struct ID2D1MultithreadVtbl d2d_factory_multithread_noop_vtbl
Definition: factory.c:1336
static HRESULT d2d_factory_reload_sysmetrics(struct d2d_factory *factory)
Definition: factory.c:82
static const struct ID2D1MultithreadVtbl d2d_factory_multithread_vtbl
Definition: factory.c:1326
VOID WINAPI InitializeCriticalSection(OUT LPCRITICAL_SECTION lpCriticalSection)
Definition: synch.c:687
WINBASEAPI VOID WINAPI InitOnceInitialize(_Out_ PINIT_ONCE InitOnce)

Referenced by D2D1CreateFactory().

◆ d2d_factory_init_builtin_effects()

static void d2d_factory_init_builtin_effects ( struct d2d_factory *  factory)
static

Definition at line 56 of file factory.c.

57{
59}
static BOOL WINAPI d2d_factory_builtins_initonce(INIT_ONCE *once, void *param, void **context)
Definition: factory.c:49
BOOL WINAPI InitOnceExecuteOnce(_Inout_ PINIT_ONCE InitOnce, _In_ __callback PINIT_ONCE_FN InitFn, _Inout_opt_ PVOID Parameter, _Outptr_opt_result_maybenull_ LPVOID *Context)
Definition: InitOnce.c:12

Referenced by d2d_factory_get_registered_effect(), d2d_factory_GetEffectProperties(), d2d_factory_GetRegisteredEffects(), d2d_factory_RegisterEffectFromStream(), d2d_factory_RegisterEffectFromString(), and d2d_factory_UnregisterEffect().

◆ d2d_factory_mt_AddRef()

static ULONG STDMETHODCALLTYPE d2d_factory_mt_AddRef ( ID2D1Multithread *  iface)
static

Definition at line 1278 of file factory.c.

1279{
1281 return d2d_factory_AddRef(&factory->ID2D1Factory7_iface);
1282}
static struct d2d_factory * impl_from_ID2D1Multithread(ID2D1Multithread *iface)
Definition: factory.c:44
static ULONG STDMETHODCALLTYPE d2d_factory_AddRef(ID2D1Factory7 *iface)
Definition: factory.c:133

◆ d2d_factory_mt_Enter()

static void STDMETHODCALLTYPE d2d_factory_mt_Enter ( ID2D1Multithread *  iface)
static

Definition at line 1295 of file factory.c.

1296{
1298
1299 TRACE("%p.\n", iface);
1300
1302}
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)

◆ d2d_factory_mt_GetMultithreadProtected()

static BOOL STDMETHODCALLTYPE d2d_factory_mt_GetMultithreadProtected ( ID2D1Multithread *  iface)
static

Definition at line 1290 of file factory.c.

1291{
1292 return TRUE;
1293}

◆ d2d_factory_mt_Leave()

static void STDMETHODCALLTYPE d2d_factory_mt_Leave ( ID2D1Multithread *  iface)
static

Definition at line 1304 of file factory.c.

1305{
1307
1308 TRACE("%p.\n", iface);
1309
1311}
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)

◆ d2d_factory_mt_QueryInterface()

static HRESULT STDMETHODCALLTYPE d2d_factory_mt_QueryInterface ( ID2D1Multithread *  iface,
REFIID  iid,
void **  out 
)
static

Definition at line 1272 of file factory.c.

1273{
1275 return d2d_factory_QueryInterface(&factory->ID2D1Factory7_iface, iid, out);
1276}
static HRESULT STDMETHODCALLTYPE d2d_factory_QueryInterface(ID2D1Factory7 *iface, REFIID iid, void **out)
Definition: factory.c:100
wchar_t tm const _CrtWcstime_Writes_and_advances_ptr_ count wchar_t ** out
Definition: wcsftime.cpp:383

◆ d2d_factory_mt_Release()

static ULONG STDMETHODCALLTYPE d2d_factory_mt_Release ( ID2D1Multithread *  iface)
static

Definition at line 1284 of file factory.c.

1285{
1287 return d2d_factory_Release(&factory->ID2D1Factory7_iface);
1288}
static ULONG STDMETHODCALLTYPE d2d_factory_Release(ID2D1Factory7 *iface)
Definition: factory.c:143

◆ d2d_factory_QueryInterface()

static HRESULT STDMETHODCALLTYPE d2d_factory_QueryInterface ( ID2D1Factory7 *  iface,
REFIID  iid,
void **  out 
)
static

Definition at line 100 of file factory.c.

101{
103
104 TRACE("iface %p, iid %s, out %p.\n", iface, debugstr_guid(iid), out);
105
106 if ((IsEqualGUID(iid, &IID_ID2D1Factory7) && d2d_settings.max_version_factory >= 7)
107 || (IsEqualGUID(iid, &IID_ID2D1Factory6) && d2d_settings.max_version_factory >= 6)
108 || (IsEqualGUID(iid, &IID_ID2D1Factory5) && d2d_settings.max_version_factory >= 5)
109 || (IsEqualGUID(iid, &IID_ID2D1Factory4) && d2d_settings.max_version_factory >= 4)
110 || (IsEqualGUID(iid, &IID_ID2D1Factory3) && d2d_settings.max_version_factory >= 3)
111 || (IsEqualGUID(iid, &IID_ID2D1Factory2) && d2d_settings.max_version_factory >= 2)
112 || (IsEqualGUID(iid, &IID_ID2D1Factory1) && d2d_settings.max_version_factory >= 1)
113 || IsEqualGUID(iid, &IID_ID2D1Factory)
114 || IsEqualGUID(iid, &IID_IUnknown))
115 {
116 ID2D1Factory7_AddRef(iface);
117 *out = iface;
118 return S_OK;
119 }
120 else if (IsEqualGUID(iid, &IID_ID2D1Multithread))
121 {
122 ID2D1Factory7_AddRef(iface);
123 *out = &factory->ID2D1Multithread_iface;
124 return S_OK;
125 }
126
127 WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(iid));
128
129 *out = NULL;
130 return E_NOINTERFACE;
131}
const GUID IID_IUnknown
unsigned int max_version_factory
Definition: d2d1_private.h:61
#define E_NOINTERFACE
Definition: winerror.h:3479

Referenced by d2d_factory_mt_QueryInterface().

◆ d2d_factory_register_builtin_effect()

HRESULT d2d_factory_register_builtin_effect ( struct d2d_factory *  factory,
REFCLSID  effect_id,
const WCHAR *  property_xml,
const D2D1_PROPERTY_BINDING *  bindings,
UINT32  binding_count,
PD2D1_EFFECT_FACTORY  effect_factory 
)

Definition at line 1081 of file factory.c.

1084{
1085 return d2d_factory_register_effect_from_string(factory, effect_id, property_xml, bindings,
1086 binding_count, effect_factory, TRUE);
1087}
static HRESULT d2d_factory_register_effect_from_string(struct d2d_factory *factory, REFCLSID effect_id, const WCHAR *property_xml, const D2D1_PROPERTY_BINDING *bindings, UINT32 binding_count, PD2D1_EFFECT_FACTORY effect_factory, BOOL builtin)
Definition: factory.c:1057

Referenced by d2d_effects_init_builtins().

◆ d2d_factory_register_effect()

void d2d_factory_register_effect ( struct d2d_factory *  factory,
struct d2d_effect_registration *  effect 
)

Definition at line 61 of file factory.c.

62{
63 list_add_tail(&factory->effects, &effect->entry);
64}
static void list_add_tail(struct list_entry *head, struct list_entry *entry)
Definition: list.h:83

Referenced by d2d_factory_register_effect_from_stream().

◆ d2d_factory_register_effect_from_stream()

static HRESULT d2d_factory_register_effect_from_stream ( struct d2d_factory *  factory,
REFCLSID  effect_id,
IStream *  property_xml,
const D2D1_PROPERTY_BINDING *  bindings,
UINT32  binding_count,
PD2D1_EFFECT_FACTORY  effect_factory,
BOOL  builtin 
)
static

Definition at line 954 of file factory.c.

957{
958 struct d2d_effect_registration *effect;
960 unsigned int i;
961 HRESULT hr;
962
964 {
965 if (IsEqualGUID(effect_id, &effect->id))
966 {
967 if (effect->builtin) return E_INVALIDARG;
968 ++effect->registration_count;
969 return S_OK;
970 }
971 }
972
973 if (FAILED(hr = CreateXmlReader(&IID_IXmlReader, (void **)&reader, NULL)))
974 return hr;
975
976 if (FAILED(hr = IXmlReader_SetInput(reader, (IUnknown *)property_xml)))
977 {
978 IXmlReader_Release(reader);
979 return hr;
980 }
981
982 if (!(effect = calloc(1, sizeof(*effect))))
983 {
984 IXmlReader_Release(reader);
985 return E_OUTOFMEMORY;
986 }
987 if (!(effect->properties = calloc(1, sizeof(*effect->properties))))
988 {
989 IXmlReader_Release(reader);
990 free(effect);
991 return E_OUTOFMEMORY;
992 }
994 effect->builtin = builtin;
995
996 hr = parse_effect_xml(reader, effect);
997 IXmlReader_Release(reader);
998 if (FAILED(hr))
999 {
1000 WARN("Failed to parse effect xml, hr %#lx.\n", hr);
1002 return hr;
1003 }
1004
1005 /* Check required properties. */
1006 if (!parse_effect_get_property(effect, L"DisplayName")
1007 || !parse_effect_get_property(effect, L"Author")
1008 || !parse_effect_get_property(effect, L"Category")
1009 || !parse_effect_get_property(effect, L"Description")
1010 || !parse_effect_get_property(effect, L"Inputs"))
1011 {
1012 WARN("Missing required properties.\n");
1014 return E_INVALIDARG;
1015 }
1016
1017 /* Bind getter and setter. */
1018 for (i = 0; i < binding_count; ++i)
1019 {
1021
1022 if (!(property = parse_effect_get_property(effect, bindings[i].propertyName)))
1023 {
1024 WARN("Failed to bind to missing property.\n");
1027 }
1028
1029 property->get_function = bindings[i].getFunction;
1030 property->set_function = bindings[i].setFunction;
1031 }
1032
1033 effect->registration_count = 1;
1034 effect->id = *effect_id;
1035 effect->factory = effect_factory;
1036
1038
1039 return S_OK;
1040}
void d2d_effect_init_properties(struct d2d_effect *effect, struct d2d_effect_properties *properties)
Definition: effect.c:2440
void d2d_factory_register_effect(struct d2d_factory *factory, struct d2d_effect_registration *effect)
Definition: factory.c:61
static void d2d_effect_registration_cleanup(struct d2d_effect_registration *reg)
Definition: factory.c:33
static struct d2d_effect_property * parse_effect_get_property(const struct d2d_effect_registration *effect, const WCHAR *name)
Definition: factory.c:732
static HRESULT parse_effect_xml(IXmlReader *reader, struct d2d_effect_registration *effect)
Definition: factory.c:914
HRESULT WINAPI CreateXmlReader(REFIID riid, void **obj, IMalloc *imalloc)
Definition: reader.c:3616
#define L(x)
Definition: resources.c:13
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 LIST_FOR_EACH_ENTRY_REV(elem, list, type, field)
Definition: list.h:260
struct vkd3d_spirv_builtin builtin
Definition: spirv.c:4840
PD2D1_PROPERTY_SET_FUNCTION setFunction
PD2D1_PROPERTY_GET_FUNCTION getFunction
struct d2d_effect_properties * properties
Definition: d2d1_private.h:683
PD2D1_EFFECT_FACTORY factory
Definition: d2d1_private.h:678
Definition: reader.h:84
#define D2DERR_INVALID_PROPERTY
Definition: winerror.h:7392

Referenced by d2d_factory_register_effect_from_string(), and d2d_factory_RegisterEffectFromStream().

◆ d2d_factory_register_effect_from_string()

static HRESULT d2d_factory_register_effect_from_string ( struct d2d_factory *  factory,
REFCLSID  effect_id,
const WCHAR *  property_xml,
const D2D1_PROPERTY_BINDING *  bindings,
UINT32  binding_count,
PD2D1_EFFECT_FACTORY  effect_factory,
BOOL  builtin 
)
static

Definition at line 1057 of file factory.c.

1060{
1061 static const LARGE_INTEGER zero;
1062 IStream *stream;
1063 ULONG size;
1064 HRESULT hr;
1065
1067 return hr;
1068
1069 size = sizeof(*property_xml) * (wcslen(property_xml) + 1);
1070 if (SUCCEEDED(hr = IStream_Write(stream, property_xml, size, NULL)))
1071 hr = IStream_Seek(stream, zero, STREAM_SEEK_SET, NULL);
1072
1073 if (SUCCEEDED(hr))
1075 binding_count, effect_factory, builtin);
1076
1077 IStream_Release(stream);
1078 return hr;
1079}
static HRESULT d2d_factory_register_effect_from_stream(struct d2d_factory *factory, REFCLSID effect_id, IStream *property_xml, const D2D1_PROPERTY_BINDING *bindings, UINT32 binding_count, PD2D1_EFFECT_FACTORY effect_factory, BOOL builtin)
Definition: factory.c:954
HRESULT WINAPI CreateStreamOnHGlobal(HGLOBAL hGlobal, BOOL delete_on_release, IStream **stream)
_ACRTIMP size_t __cdecl wcslen(const wchar_t *)
Definition: wcs.c:2988
GLsizeiptr size
Definition: glext.h:5919
int zero
Definition: sehframes.cpp:29

Referenced by d2d_factory_register_builtin_effect(), and d2d_factory_RegisterEffectFromString().

◆ d2d_factory_RegisterEffectFromStream()

static HRESULT STDMETHODCALLTYPE d2d_factory_RegisterEffectFromStream ( ID2D1Factory7 *  iface,
REFCLSID  effect_id,
IStream *  property_xml,
const D2D1_PROPERTY_BINDING *  bindings,
UINT32  binding_count,
PD2D1_EFFECT_FACTORY  effect_factory 
)
static

Definition at line 1042 of file factory.c.

1045{
1047
1048 TRACE("iface %p, effect_id %s, property_xml %p, bindings %p, binding_count %u, effect_factory %p.\n",
1049 iface, debugstr_guid(effect_id), property_xml, bindings, binding_count, effect_factory);
1050
1052
1053 return d2d_factory_register_effect_from_stream(factory, effect_id, property_xml, bindings,
1054 binding_count, effect_factory, FALSE);
1055}
#define FALSE
Definition: types.h:117

◆ d2d_factory_RegisterEffectFromString()

static HRESULT STDMETHODCALLTYPE d2d_factory_RegisterEffectFromString ( ID2D1Factory7 *  iface,
REFCLSID  effect_id,
const WCHAR *  property_xml,
const D2D1_PROPERTY_BINDING *  bindings,
UINT32  binding_count,
PD2D1_EFFECT_FACTORY  effect_factory 
)
static

Definition at line 1089 of file factory.c.

1092{
1094
1095 TRACE("iface %p, effect_id %s, property_xml %s, bindings %p, binding_count %u, effect_factory %p.\n",
1096 iface, debugstr_guid(effect_id), debugstr_w(property_xml), bindings, binding_count, effect_factory);
1097
1099
1100 return d2d_factory_register_effect_from_string(factory, effect_id, property_xml, bindings,
1101 binding_count, effect_factory, FALSE);
1102}
#define debugstr_w
Definition: kernel32.h:32

◆ d2d_factory_Release()

static ULONG STDMETHODCALLTYPE d2d_factory_Release ( ID2D1Factory7 *  iface)
static

Definition at line 143 of file factory.c.

144{
147 struct d2d_effect_registration *reg, *reg2;
148
149 TRACE("%p decreasing refcount to %lu.\n", iface, refcount);
150
151 if (!refcount)
152 {
153 if (factory->device)
154 ID3D10Device1_Release(factory->device);
156 {
158 }
160 free(factory);
161 }
162
163 return refcount;
164}
#define InterlockedDecrement
Definition: armddk.h:52
#define LIST_FOR_EACH_ENTRY_SAFE(cursor, cursor2, list, type, field)
Definition: list.h:242
void WINAPI DeleteCriticalSection(PCRITICAL_SECTION)

Referenced by d2d_factory_mt_Release().

◆ d2d_factory_reload_sysmetrics()

static HRESULT d2d_factory_reload_sysmetrics ( struct d2d_factory *  factory)
static

Definition at line 82 of file factory.c.

83{
84 HDC hdc;
85
86 if (!(hdc = GetDC(NULL)))
87 {
88 factory->dpi_x = factory->dpi_y = 96.0f;
89 return E_FAIL;
90 }
91
94
96
97 return S_OK;
98}
#define E_FAIL
Definition: ddrawi.h:102
HDC hdc
Definition: main.c:9
static HDC
Definition: imagelist.c:88
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
HDC WINAPI GetDC(_In_opt_ HWND)
int WINAPI GetDeviceCaps(_In_opt_ HDC, _In_ int)
#define LOGPIXELSY
Definition: wingdi.h:719
#define LOGPIXELSX
Definition: wingdi.h:718

Referenced by d2d_factory_init(), and d2d_factory_ReloadSystemMetrics().

◆ d2d_factory_ReloadSystemMetrics()

static HRESULT STDMETHODCALLTYPE d2d_factory_ReloadSystemMetrics ( ID2D1Factory7 *  iface)
static

Definition at line 166 of file factory.c.

167{
169
170 TRACE("iface %p.\n", iface);
171
173}

◆ d2d_factory_st_Enter()

static void STDMETHODCALLTYPE d2d_factory_st_Enter ( ID2D1Multithread *  iface)
static

Definition at line 1318 of file factory.c.

1319{
1320}

◆ d2d_factory_st_GetMultithreadProtected()

static BOOL STDMETHODCALLTYPE d2d_factory_st_GetMultithreadProtected ( ID2D1Multithread *  iface)
static

Definition at line 1313 of file factory.c.

1314{
1315 return FALSE;
1316}

◆ d2d_factory_st_Leave()

static void STDMETHODCALLTYPE d2d_factory_st_Leave ( ID2D1Multithread *  iface)
static

Definition at line 1322 of file factory.c.

1323{
1324}

◆ d2d_factory_UnregisterEffect()

static HRESULT STDMETHODCALLTYPE d2d_factory_UnregisterEffect ( ID2D1Factory7 *  iface,
REFCLSID  effect_id 
)
static

Definition at line 1104 of file factory.c.

1105{
1107 struct d2d_effect_registration *effect;
1108
1109 TRACE("iface %p, effect_id %s.\n", iface, debugstr_guid(effect_id));
1110
1112
1114 {
1115 if (IsEqualGUID(effect_id, &effect->id))
1116 {
1117 if (effect->builtin) break;
1118 if (!--effect->registration_count)
1119 {
1120 list_remove(&effect->entry);
1122 }
1123 return S_OK;
1124 }
1125 }
1126
1128}
static void list_remove(struct list_entry *entry)
Definition: list.h:90
#define D2DERR_EFFECT_IS_NOT_REGISTERED
Definition: winerror.h:7391

◆ d2d_settings_init()

static void d2d_settings_init ( void  )
static

Definition at line 1609 of file factory.c.

1610{
1611 HKEY default_key, tmp_key, application_key = NULL;
1612 char buffer[MAX_PATH + 10];
1613 DWORD len;
1614
1615 if (RegOpenKeyA(HKEY_CURRENT_USER, "Software\\Wine\\Direct2D", &default_key))
1616 default_key = NULL;
1617
1619 if (len && len < MAX_PATH)
1620 {
1621 char *p, *appname = buffer;
1622
1623 if ((p = strrchr(appname, '/')))
1624 appname = p + 1;
1625 if ((p = strrchr(appname, '\\')))
1626 appname = p + 1;
1627 strcat(appname, "\\Direct2D");
1628
1629 if (!RegOpenKeyA(HKEY_CURRENT_USER, "Software\\Wine\\AppDefaults", &tmp_key))
1630 {
1631 if (RegOpenKeyA(tmp_key, appname, &application_key))
1632 application_key = NULL;
1633 RegCloseKey(tmp_key);
1634 }
1635 }
1636
1637 if (!default_key && !application_key)
1638 return;
1639
1640 if (get_config_key_u32(default_key, application_key, "max_version_factory", &d2d_settings.max_version_factory))
1641 ERR_(winediag)("Limiting maximum Direct2D factory version to %#x.\n", d2d_settings.max_version_factory);
1642
1643 if (application_key)
1644 RegCloseKey(application_key);
1645 if (default_key)
1646 RegCloseKey(default_key);
1647}
#define RegCloseKey(hKey)
Definition: registry.h:49
static bool get_config_key_u32(HKEY default_key, HKEY application_key, const char *name, uint32_t *value)
Definition: factory.c:1587
LONG WINAPI RegOpenKeyA(HKEY hKey, LPCSTR lpSubKey, PHKEY phkResult)
Definition: reg.c:3234
#define MAX_PATH
Definition: compat.h:34
DWORD WINAPI GetModuleFileNameA(HINSTANCE hModule, LPSTR lpFilename, DWORD nSize)
Definition: loader.c:539
_ACRTIMP char *__cdecl strrchr(const char *, int)
Definition: string.c:3303
unsigned long DWORD
Definition: ntddk_ex.h:95
GLuint buffer
Definition: glext.h:5915
GLfloat GLfloat p
Definition: glext.h:8902
GLenum GLsizei len
Definition: glext.h:6722
#define ERR_(ch,...)
Definition: debug.h:156
strcat
Definition: string.h:92
#define HKEY_CURRENT_USER
Definition: winreg.h:11

Referenced by DllMain().

◆ DllMain()

BOOL WINAPI DllMain ( HINSTANCE  inst,
DWORD  reason,
void *  reserved 
)

Definition at line 1649 of file factory.c.

1650{
1653 return TRUE;
1654}
static void d2d_settings_init(void)
Definition: factory.c:1609
static WCHAR reason[MAX_STRING_RESOURCE_LEN]
Definition: object.c:1971
#define DLL_PROCESS_ATTACH
Definition: compat.h:131

◆ get_config_key_u32()

static bool get_config_key_u32 ( HKEY  default_key,
HKEY  application_key,
const char *  name,
uint32_t *  value 
)
static

Definition at line 1587 of file factory.c.

1588{
1589 DWORD type, size;
1590 uint32_t data;
1591
1592 size = sizeof(data);
1593 if (application_key && !RegQueryValueExA(application_key,
1594 name, 0, &type, (BYTE *)&data, &size) && type == REG_DWORD)
1595 goto success;
1596
1597 size = sizeof(data);
1598 if (default_key && !RegQueryValueExA(default_key,
1599 name, 0, &type, (BYTE *)&data, &size) && type == REG_DWORD)
1600 goto success;
1601
1602 return false;
1603
1604success:
1605 *value = data;
1606 return true;
1607}
UINT32 uint32_t
Definition: types.h:75
LONG WINAPI RegQueryValueExA(_In_ HKEY hkeyorg, _In_ LPCSTR name, _In_ LPDWORD reserved, _Out_opt_ LPDWORD type, _Out_opt_ LPBYTE data, _Inout_opt_ LPDWORD count)
Definition: reg.c:4009
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
#define REG_DWORD
Definition: sdbapi.c:615
Definition: name.c:39
Definition: pdh_main.c:64
#define success(from, fromstr, to, tostr)
unsigned char BYTE
Definition: xxhash.c:193

Referenced by d2d_settings_init().

◆ impl_from_ID2D1Factory7()

◆ impl_from_ID2D1Multithread()

static struct d2d_factory * impl_from_ID2D1Multithread ( ID2D1Multithread *  iface)
inlinestatic

Definition at line 44 of file factory.c.

45{
46 return CONTAINING_RECORD(iface, struct d2d_factory, ID2D1Multithread_iface);
47}

Referenced by d2d_factory_mt_AddRef(), d2d_factory_mt_Enter(), d2d_factory_mt_Leave(), d2d_factory_mt_QueryInterface(), and d2d_factory_mt_Release().

◆ parse_effect_get_attribute()

static HRESULT parse_effect_get_attribute ( IXmlReader *  reader,
const WCHAR *  name,
WCHAR **  ret 
)
static

Definition at line 670 of file factory.c.

671{
672 const WCHAR *value;
673
674 *ret = NULL;
675
676 if (IXmlReader_MoveToAttributeByName(reader, name, NULL) != S_OK)
677 return E_INVALIDARG;
678 if (IXmlReader_GetValue(reader, &value, NULL) != S_OK)
679 return E_INVALIDARG;
680 if (!(*ret = wcsdup(value)))
681 return E_OUTOFMEMORY;
682
683 return S_OK;
684}
static wchar_t * wcsdup(const wchar_t *str)
Definition: string.h:94
short WCHAR
Definition: pedump.c:58

Referenced by parse_effect_get_property_type(), parse_effect_inputs(), and parse_effect_property().

◆ parse_effect_get_next_xml_node()

static HRESULT parse_effect_get_next_xml_node ( IXmlReader *  reader,
XmlNodeType  expected_type,
const WCHAR *  expected_name,
unsigned int *  depth 
)
static

Definition at line 616 of file factory.c.

618{
619 const WCHAR *node_name;
620 XmlNodeType node_type;
621 HRESULT hr;
622
623 assert(expected_type != XmlNodeType_Whitespace);
624
625 while ((hr = IXmlReader_Read(reader, &node_type)) == S_OK)
626 {
627 if (node_type == XmlNodeType_Whitespace)
628 continue;
629
630 if (expected_type != XmlNodeType_None && node_type != expected_type)
632
633 if (expected_name)
634 {
635 if (FAILED(hr = IXmlReader_GetLocalName(reader, &node_name, NULL)))
636 return hr;
637
638 if (wcscmp(node_name, expected_name))
640 }
641
642 if (depth)
643 IXmlReader_GetDepth(reader, depth);
644 return S_OK;
645 }
646
647 return hr;
648}
#define assert(_expr)
Definition: assert.h:32
_ACRTIMP int __cdecl wcscmp(const wchar_t *, const wchar_t *)
Definition: wcs.c:1977
GLint GLint GLsizei GLsizei GLsizei depth
Definition: gl.h:1546
XmlNodeType
Definition: xmllite.idl:23
@ XmlNodeType_Whitespace
Definition: xmllite.idl:32
@ XmlNodeType_None
Definition: xmllite.idl:24

Referenced by parse_effect_inputs(), and parse_effect_xml().

◆ parse_effect_get_property()

static struct d2d_effect_property * parse_effect_get_property ( const struct d2d_effect_registration *  effect,
const WCHAR *  name 
)
static

Definition at line 732 of file factory.c.

734{
735 unsigned int i;
736
737 for (i = 0; i < effect->properties->count; ++i)
738 {
739 if (!wcscmp(name, effect->properties->properties[i].name))
740 return &effect->properties->properties[i];
741 }
742
743 return NULL;
744}

Referenced by d2d_factory_register_effect_from_stream(), and parse_effect_property().

◆ parse_effect_get_property_index()

static UINT32 parse_effect_get_property_index ( struct d2d_effect_properties *  props,
const WCHAR *  name 
)
static

Definition at line 746 of file factory.c.

748{
749 if (!wcscmp(name, L"DisplayName")) return D2D1_PROPERTY_DISPLAYNAME;
750 if (!wcscmp(name, L"Author")) return D2D1_PROPERTY_AUTHOR;
751 if (!wcscmp(name, L"Category")) return D2D1_PROPERTY_CATEGORY;
752 if (!wcscmp(name, L"Description")) return D2D1_PROPERTY_DESCRIPTION;
753 return props->custom_count;
754}
@ 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_AUTHOR
Definition: d2d1_1.idl:191

Referenced by parse_effect_property().

◆ parse_effect_get_property_type()

static HRESULT parse_effect_get_property_type ( IXmlReader *  reader,
D2D1_PROPERTY_TYPE *  type 
)
static

Definition at line 686 of file factory.c.

687{
688 static const WCHAR *types[] =
689 {
691 [D2D1_PROPERTY_TYPE_STRING] = L"string",
692 [D2D1_PROPERTY_TYPE_BOOL] = L"bool",
693 [D2D1_PROPERTY_TYPE_UINT32] = L"uint32",
694 [D2D1_PROPERTY_TYPE_INT32] = L"int32",
695 [D2D1_PROPERTY_TYPE_FLOAT] = L"float",
696 [D2D1_PROPERTY_TYPE_VECTOR2] = L"vector2",
697 [D2D1_PROPERTY_TYPE_VECTOR3] = L"vector3",
698 [D2D1_PROPERTY_TYPE_VECTOR4] = L"vector4",
699 [D2D1_PROPERTY_TYPE_BLOB] = L"blob",
700 [D2D1_PROPERTY_TYPE_IUNKNOWN] = L"iunknown",
701 [D2D1_PROPERTY_TYPE_ENUM] = L"enum",
702 [D2D1_PROPERTY_TYPE_ARRAY] = L"array",
703 [D2D1_PROPERTY_TYPE_CLSID] = L"clsid",
704 [D2D1_PROPERTY_TYPE_MATRIX_3X2] = L"matrix3x2",
705 [D2D1_PROPERTY_TYPE_MATRIX_4X3] = L"matrix4x3",
706 [D2D1_PROPERTY_TYPE_MATRIX_4X4] = L"matrix4x4",
707 [D2D1_PROPERTY_TYPE_MATRIX_5X4] = L"matrix5x4",
708 [D2D1_PROPERTY_TYPE_COLOR_CONTEXT] = L"colorcontext",
709 };
710 unsigned int i;
711 WCHAR *value;
712 HRESULT hr;
713
714 if (FAILED(hr = parse_effect_get_attribute(reader, L"type", &value))) return hr;
715
717
718 for (i = 0; i < ARRAY_SIZE(types); ++i)
719 {
720 if (!wcscmp(value, types[i]))
721 {
722 *type = i;
723 break;
724 }
725 }
726
727 free(value);
728
730}
#define ARRAY_SIZE(A)
Definition: main.h:20
@ D2D1_PROPERTY_TYPE_BLOB
Definition: d2d1_1.idl:174
@ D2D1_PROPERTY_TYPE_CLSID
Definition: d2d1_1.idl:178
@ D2D1_PROPERTY_TYPE_MATRIX_5X4
Definition: d2d1_1.idl:182
@ D2D1_PROPERTY_TYPE_ENUM
Definition: d2d1_1.idl:176
@ D2D1_PROPERTY_TYPE_BOOL
Definition: d2d1_1.idl:167
@ D2D1_PROPERTY_TYPE_MATRIX_3X2
Definition: d2d1_1.idl:179
@ D2D1_PROPERTY_TYPE_MATRIX_4X4
Definition: d2d1_1.idl:181
@ D2D1_PROPERTY_TYPE_UINT32
Definition: d2d1_1.idl:168
@ D2D1_PROPERTY_TYPE_UNKNOWN
Definition: d2d1_1.idl:165
@ D2D1_PROPERTY_TYPE_MATRIX_4X3
Definition: d2d1_1.idl:180
@ D2D1_PROPERTY_TYPE_STRING
Definition: d2d1_1.idl:166
@ D2D1_PROPERTY_TYPE_VECTOR2
Definition: d2d1_1.idl:171
@ D2D1_PROPERTY_TYPE_FLOAT
Definition: d2d1_1.idl:170
@ D2D1_PROPERTY_TYPE_VECTOR3
Definition: d2d1_1.idl:172
@ D2D1_PROPERTY_TYPE_IUNKNOWN
Definition: d2d1_1.idl:175
@ D2D1_PROPERTY_TYPE_ARRAY
Definition: d2d1_1.idl:177
@ D2D1_PROPERTY_TYPE_INT32
Definition: d2d1_1.idl:169
@ D2D1_PROPERTY_TYPE_VECTOR4
Definition: d2d1_1.idl:173
@ D2D1_PROPERTY_TYPE_COLOR_CONTEXT
Definition: d2d1_1.idl:183
static HRESULT parse_effect_get_attribute(IXmlReader *reader, const WCHAR *name, WCHAR **ret)
Definition: factory.c:670
Definition: cmds.c:130

Referenced by parse_effect_property().

◆ parse_effect_inputs()

static HRESULT parse_effect_inputs ( IXmlReader *  reader,
struct d2d_effect_registration *  effect 
)
static

Definition at line 799 of file factory.c.

800{
801 struct d2d_effect_property *inputs, *min_inputs, *max_inputs;
802 struct d2d_effect_properties *subproperties;
803 UINT32 min_inputs_value, max_inputs_value;
804 unsigned int depth, input_count = 0;
805 XmlNodeType node_type;
806 WCHAR *name, *value;
807 WCHAR buffW[16];
808 HRESULT hr;
809
810 if (FAILED(hr = d2d_effect_properties_add(effect->properties, L"Inputs",
812 return hr;
813
814 if (!(inputs = d2d_effect_properties_get_property_by_name(effect->properties, L"Inputs")))
815 return E_FAIL;
816 if (!(inputs->subproperties = calloc(1, sizeof(*inputs->subproperties))))
817 return E_OUTOFMEMORY;
819 subproperties = inputs->subproperties;
820
825
827 {
830 free(value);
831 if (FAILED(hr)) return hr;
832 }
834 {
837 free(value);
838 if (FAILED(hr)) return hr;
839 }
840
841 min_inputs = d2d_effect_properties_get_property_by_name(effect->properties, L"MinInputs");
842 max_inputs = d2d_effect_properties_get_property_by_name(effect->properties, L"MaxInputs");
843
844 if (!IXmlReader_IsEmptyElement(reader))
845 {
847 {
848 if (FAILED(hr = IXmlReader_GetNodeType(reader, &node_type))) return hr;
849 if (node_type == XmlNodeType_EndElement) continue;
851
852 if (FAILED(hr = parse_effect_get_attribute(reader, L"name", &name))) return hr;
853
854 swprintf(buffW, ARRAY_SIZE(buffW), L"%lu", input_count);
855 d2d_effect_subproperties_add(subproperties, buffW, input_count, D2D1_PROPERTY_TYPE_STRING, name);
856 input_count++;
857
858 free(name);
859 }
860 *(UINT32 *)(effect->properties->data.ptr + inputs->data.offset) = input_count;
861
862 if (FAILED(hr = IXmlReader_GetNodeType(reader, &node_type))) return hr;
864 }
865
866 if (min_inputs)
867 d2d_effect_property_get_uint32_value(effect->properties, min_inputs, &min_inputs_value);
868 if (max_inputs)
869 d2d_effect_property_get_uint32_value(effect->properties, max_inputs, &max_inputs_value);
870
871 /* Validate the range */
872 if (min_inputs && max_inputs)
873 {
874 if (min_inputs_value > max_inputs_value)
875 {
876 WARN("Invalid input count range %u - %u.\n", min_inputs_value, max_inputs_value);
877 return E_INVALIDARG;
878 }
879 }
880
881 /* Validate actual input count with specified range. */
882 if (min_inputs && min_inputs_value > input_count)
883 {
884 WARN("Too few inputs were declared, expected at least %u.\n", min_inputs_value);
885 return E_INVALIDARG;
886 }
887
888 if (max_inputs && max_inputs_value < input_count)
889 {
890 WARN("Too many inputs were declared, expected at most %u.\n", max_inputs_value);
891 return E_INVALIDARG;
892 }
893
894 /* Apply default value to a missing property. If both properties are missing, add them. */
895 if (min_inputs != max_inputs)
896 {
897 swprintf(buffW, ARRAY_SIZE(buffW), L"%lu", min_inputs ? min_inputs_value : max_inputs_value);
898 if (min_inputs)
900 else
902 }
903 else if (!min_inputs)
904 {
905 swprintf(buffW, ARRAY_SIZE(buffW), L"%lu", input_count);
907 if (SUCCEEDED(hr))
909 }
910
911 return hr;
912}
@ D2D1_PROPERTY_MAX_INPUTS
Definition: d2d1_1.idl:198
@ D2D1_PROPERTY_MIN_INPUTS
Definition: d2d1_1.idl:197
@ D2D1_PROPERTY_INPUTS
Definition: d2d1_1.idl:194
@ D2D1_SUBPROPERTY_ISREADONLY
Definition: d2d1_1.idl:205
@ D2D1_SUBPROPERTY_DISPLAYNAME
Definition: d2d1_1.idl:204
HRESULT d2d_effect_subproperties_add(struct d2d_effect_properties *props, const WCHAR *name, UINT32 index, D2D1_PROPERTY_TYPE type, const WCHAR *value)
Definition: effect.c:1287
struct d2d_effect_property * d2d_effect_properties_get_property_by_name(const struct d2d_effect_properties *properties, const WCHAR *name)
Definition: effect.c:1345
HRESULT d2d_effect_properties_add(struct d2d_effect_properties *props, const WCHAR *name, UINT32 index, D2D1_PROPERTY_TYPE type, const WCHAR *value)
Definition: effect.c:1281
HRESULT d2d_effect_property_get_uint32_value(const struct d2d_effect_properties *properties, const struct d2d_effect_property *prop, UINT32 *value)
Definition: effect.c:1422
static HRESULT parse_effect_get_next_xml_node(IXmlReader *reader, XmlNodeType expected_type, const WCHAR *expected_name, unsigned int *depth)
Definition: factory.c:616
#define swprintf
Definition: precomp.h:40
struct d2d_effect * effect
Definition: d2d1_private.h:660
union d2d_effect_property::@250 data
struct d2d_effect_properties * subproperties
Definition: d2d1_private.h:653
@ XmlNodeType_EndElement
Definition: xmllite.idl:33
@ XmlNodeType_Element
Definition: xmllite.idl:25

Referenced by parse_effect_xml().

◆ parse_effect_property()

static HRESULT parse_effect_property ( IXmlReader *  reader,
struct d2d_effect_registration *  effect 
)
static

Definition at line 756 of file factory.c.

757{
758 WCHAR *name = NULL, *value = NULL;
760 unsigned int depth;
762 HRESULT hr;
763
765 return hr;
766
768 {
769 free(name);
770 return hr;
771 }
772
773 /* Check for duplicates. */
774 if (parse_effect_get_property(effect, name))
776
778
779 if (SUCCEEDED(hr))
780 {
781 /* FIXME: sub properties are ignored */
782 IXmlReader_MoveToElement(reader);
783 IXmlReader_GetDepth(reader, &depth);
785 }
786
787 if (SUCCEEDED(hr))
788 {
791 }
792
793 free(value);
794 free(name);
795
796 return hr;
797}
#define index(s, c)
Definition: various.h:29
D2D1_PROPERTY_TYPE
Definition: d2d1_1.idl:164
static UINT32 parse_effect_get_property_index(struct d2d_effect_properties *props, const WCHAR *name)
Definition: factory.c:746
static HRESULT parse_effect_get_property_type(IXmlReader *reader, D2D1_PROPERTY_TYPE *type)
Definition: factory.c:686
static HRESULT parse_effect_skip_element(IXmlReader *reader, unsigned int element_depth)
Definition: factory.c:650
GLuint index
Definition: glext.h:6031

Referenced by parse_effect_xml().

◆ parse_effect_skip_element()

static HRESULT parse_effect_skip_element ( IXmlReader *  reader,
unsigned int  element_depth 
)
static

Definition at line 650 of file factory.c.

651{
652 XmlNodeType node_type;
653 unsigned int depth;
654 HRESULT hr;
655
656 if (IXmlReader_IsEmptyElement(reader)) return S_OK;
657
658 while ((hr = IXmlReader_Read(reader, &node_type)) == S_OK)
659 {
660 IXmlReader_GetDepth(reader, &depth);
661 if (node_type == XmlNodeType_EndElement && depth == element_depth + 1)
662 {
663 return S_OK;
664 }
665 }
666
667 return hr;
668}

Referenced by parse_effect_property(), and parse_effect_xml().

◆ parse_effect_xml()

static HRESULT parse_effect_xml ( IXmlReader *  reader,
struct d2d_effect_registration *  effect 
)
static

Definition at line 914 of file factory.c.

915{
916 const WCHAR *node_name;
917 XmlNodeType node_type;
918 unsigned int depth;
919 HRESULT hr;
920
921 /* Xml declaration node is mandatory. */
923 return hr;
924
925 /* Top level "Effect" element. */
927 return hr;
928
929 /* Loop inside effect node */
931 {
932 if (FAILED(hr = IXmlReader_GetNodeType(reader, &node_type))) return hr;
933 if (node_type != XmlNodeType_Element && node_type != XmlNodeType_EndElement) continue;
934 if (FAILED(hr = IXmlReader_GetLocalName(reader, &node_name, NULL))) return hr;
935 if (node_type == XmlNodeType_EndElement) break;
936
937 if (!wcscmp(node_name, L"Property"))
939 else if (!wcscmp(node_name, L"Inputs"))
940 hr = parse_effect_inputs(reader, effect);
941 else
942 {
943 WARN("Unexpected element %s.\n", debugstr_w(node_name));
945 }
946
947 if (FAILED(hr))
948 return hr;
949 }
950
951 return hr;
952}
static HRESULT parse_effect_property(IXmlReader *reader, struct d2d_effect_registration *effect)
Definition: factory.c:756
static HRESULT parse_effect_inputs(IXmlReader *reader, struct d2d_effect_registration *effect)
Definition: factory.c:799
@ XmlNodeType_XmlDeclaration
Definition: xmllite.idl:34

Referenced by d2d_factory_register_effect_from_stream().

◆ srgb_inverse_transfer_function()

static float srgb_inverse_transfer_function ( float  x)
static

Definition at line 1524 of file factory.c.

1525{
1526 if (x <= 0.0f)
1527 return 0.0f;
1528 else if (x >= 1.0f)
1529 return 1.0f;
1530 else if (x <= 0.04045f)
1531 return x / 12.92f;
1532 else
1533 return powf((x + 0.055f) / 1.055f, 2.4f);
1534}
_ACRTIMP float __cdecl powf(float, float)
Definition: powf.c:14

Referenced by D2D1ConvertColorSpace().

◆ srgb_transfer_function()

static float srgb_transfer_function ( float  x)
static

Definition at line 1512 of file factory.c.

1513{
1514 if (x <= 0.0f)
1515 return 0.0f;
1516 else if (x >= 1.0f)
1517 return 1.0f;
1518 else if (x <= 0.0031308f)
1519 return 12.92f * x;
1520 else
1521 return 1.055f * powf(x, 1.0f / 2.4f) - 0.055f;
1522}

Referenced by D2D1ConvertColorSpace().

◆ WINE_DECLARE_DEBUG_CHANNEL()

WINE_DECLARE_DEBUG_CHANNEL ( winediag  )

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( d2d  )

Variable Documentation

◆ d2d_factory_multithread_noop_vtbl

const struct ID2D1MultithreadVtbl d2d_factory_multithread_noop_vtbl
static
Initial value:
=
{
}
static BOOL STDMETHODCALLTYPE d2d_factory_st_GetMultithreadProtected(ID2D1Multithread *iface)
Definition: factory.c:1313
static void STDMETHODCALLTYPE d2d_factory_st_Leave(ID2D1Multithread *iface)
Definition: factory.c:1322
static ULONG STDMETHODCALLTYPE d2d_factory_mt_Release(ID2D1Multithread *iface)
Definition: factory.c:1284
static ULONG STDMETHODCALLTYPE d2d_factory_mt_AddRef(ID2D1Multithread *iface)
Definition: factory.c:1278
static HRESULT STDMETHODCALLTYPE d2d_factory_mt_QueryInterface(ID2D1Multithread *iface, REFIID iid, void **out)
Definition: factory.c:1272
static void STDMETHODCALLTYPE d2d_factory_st_Enter(ID2D1Multithread *iface)
Definition: factory.c:1318

Definition at line 1336 of file factory.c.

Referenced by d2d_factory_init().

◆ d2d_factory_multithread_vtbl

const struct ID2D1MultithreadVtbl d2d_factory_multithread_vtbl
static
Initial value:
=
{
}
static void STDMETHODCALLTYPE d2d_factory_mt_Leave(ID2D1Multithread *iface)
Definition: factory.c:1304
static BOOL STDMETHODCALLTYPE d2d_factory_mt_GetMultithreadProtected(ID2D1Multithread *iface)
Definition: factory.c:1290
static void STDMETHODCALLTYPE d2d_factory_mt_Enter(ID2D1Multithread *iface)
Definition: factory.c:1295

Definition at line 1326 of file factory.c.

Referenced by d2d_factory_init().

◆ d2d_factory_vtbl

const struct ID2D1Factory7Vtbl d2d_factory_vtbl
static

Definition at line 1235 of file factory.c.

Referenced by d2d_factory_init().

◆ d2d_settings

Initial value:
=
{
~0u,
}
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

Definition at line 28 of file factory.c.