ReactOS 0.4.17-dev-934-g091855f
state_block.c File Reference
#include "d2d1_private.h"
Include dependency graph for state_block.c:

Go to the source code of this file.

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (d2d)
 
static struct d2d_state_block * impl_from_ID2D1DrawingStateBlock1 (ID2D1DrawingStateBlock1 *iface)
 
static HRESULT STDMETHODCALLTYPE d2d_state_block_QueryInterface (ID2D1DrawingStateBlock1 *iface, REFIID iid, void **out)
 
static ULONG STDMETHODCALLTYPE d2d_state_block_AddRef (ID2D1DrawingStateBlock1 *iface)
 
static ULONG STDMETHODCALLTYPE d2d_state_block_Release (ID2D1DrawingStateBlock1 *iface)
 
static void STDMETHODCALLTYPE d2d_state_block_GetFactory (ID2D1DrawingStateBlock1 *iface, ID2D1Factory **factory)
 
static void STDMETHODCALLTYPE d2d_state_block_GetDescription (ID2D1DrawingStateBlock1 *iface, D2D1_DRAWING_STATE_DESCRIPTION *desc)
 
static void STDMETHODCALLTYPE d2d_state_block_SetDescription (ID2D1DrawingStateBlock1 *iface, const D2D1_DRAWING_STATE_DESCRIPTION *desc)
 
static void STDMETHODCALLTYPE d2d_state_block_SetTextRenderingParams (ID2D1DrawingStateBlock1 *iface, IDWriteRenderingParams *text_rendering_params)
 
static void STDMETHODCALLTYPE d2d_state_block_GetTextRenderingParams (ID2D1DrawingStateBlock1 *iface, IDWriteRenderingParams **text_rendering_params)
 
static void STDMETHODCALLTYPE d2d_state_block_GetDescription1 (ID2D1DrawingStateBlock1 *iface, D2D1_DRAWING_STATE_DESCRIPTION1 *desc)
 
static void STDMETHODCALLTYPE d2d_state_block_SetDescription1 (ID2D1DrawingStateBlock1 *iface, const D2D1_DRAWING_STATE_DESCRIPTION1 *desc)
 
void d2d_state_block_init (struct d2d_state_block *state_block, ID2D1Factory *factory, const D2D1_DRAWING_STATE_DESCRIPTION1 *desc, IDWriteRenderingParams *text_rendering_params)
 
struct d2d_state_block * unsafe_impl_from_ID2D1DrawingStateBlock (ID2D1DrawingStateBlock *iface)
 

Variables

static const struct ID2D1DrawingStateBlock1Vtbl d2d_state_block_vtbl
 

Function Documentation

◆ d2d_state_block_AddRef()

static ULONG STDMETHODCALLTYPE d2d_state_block_AddRef ( ID2D1DrawingStateBlock1 *  iface)
static

Definition at line 48 of file state_block.c.

49{
50 struct d2d_state_block *state_block = impl_from_ID2D1DrawingStateBlock1(iface);
52
53 TRACE("%p increasing refcount to %lu.\n", iface, refcount);
54
55 return refcount;
56}
#define InterlockedIncrement
Definition: armddk.h:53
#define TRACE(s)
Definition: solgame.cpp:4
static struct d2d_state_block * impl_from_ID2D1DrawingStateBlock1(ID2D1DrawingStateBlock1 *iface)
Definition: state_block.c:23
uint32_t ULONG
Definition: typedefs.h:59

◆ d2d_state_block_GetDescription()

static void STDMETHODCALLTYPE d2d_state_block_GetDescription ( ID2D1DrawingStateBlock1 *  iface,
D2D1_DRAWING_STATE_DESCRIPTION *  desc 
)
static

Definition at line 85 of file state_block.c.

87{
88 struct d2d_state_block *state_block = impl_from_ID2D1DrawingStateBlock1(iface);
89
90 TRACE("iface %p, desc %p.\n", iface, desc);
91
92 memcpy(desc, &state_block->drawing_state, sizeof(*desc));
93}
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
D3D11_SHADER_VARIABLE_DESC desc
Definition: reflection.c:1683
D2D1_DRAWING_STATE_DESCRIPTION1 drawing_state
Definition: d2d1_private.h:456

◆ d2d_state_block_GetDescription1()

static void STDMETHODCALLTYPE d2d_state_block_GetDescription1 ( ID2D1DrawingStateBlock1 *  iface,
D2D1_DRAWING_STATE_DESCRIPTION1 *  desc 
)
static

Definition at line 130 of file state_block.c.

132{
133 struct d2d_state_block *state_block = impl_from_ID2D1DrawingStateBlock1(iface);
134
135 TRACE("iface %p, desc %p.\n", iface, desc);
136
137 *desc = state_block->drawing_state;
138}

◆ d2d_state_block_GetFactory()

static void STDMETHODCALLTYPE d2d_state_block_GetFactory ( ID2D1DrawingStateBlock1 *  iface,
ID2D1Factory **  factory 
)
static

Definition at line 76 of file state_block.c.

77{
78 struct d2d_state_block *state_block = impl_from_ID2D1DrawingStateBlock1(iface);
79
80 TRACE("iface %p, factory %p.\n", iface, factory);
81
82 ID2D1Factory_AddRef(*factory = state_block->factory);
83}
ID2D1Factory * factory
Definition: d2d1_private.h:455
Definition: main.c:439

◆ d2d_state_block_GetTextRenderingParams()

static void STDMETHODCALLTYPE d2d_state_block_GetTextRenderingParams ( ID2D1DrawingStateBlock1 *  iface,
IDWriteRenderingParams **  text_rendering_params 
)
static

Definition at line 119 of file state_block.c.

121{
122 struct d2d_state_block *state_block = impl_from_ID2D1DrawingStateBlock1(iface);
123
124 TRACE("iface %p, text_rendering_params %p.\n", iface, text_rendering_params);
125
126 if ((*text_rendering_params = state_block->text_rendering_params))
127 IDWriteRenderingParams_AddRef(*text_rendering_params);
128}
IDWriteRenderingParams * text_rendering_params
Definition: d2d1_private.h:457

◆ d2d_state_block_init()

void d2d_state_block_init ( struct d2d_state_block *  state_block,
ID2D1Factory *  factory,
const D2D1_DRAWING_STATE_DESCRIPTION1 *  desc,
IDWriteRenderingParams *  text_rendering_params 
)

Definition at line 164 of file state_block.c.

166{
167 static const D2D1_MATRIX_3X2_F identity =
168 {{{
169 1.0f, 0.0f,
170 0.0f, 1.0f,
171 0.0f, 0.0f,
172 }}};
173
175 state_block->refcount = 1;
176 ID2D1Factory_AddRef(state_block->factory = factory);
177 if (desc)
178 state_block->drawing_state = *desc;
179 else
180 state_block->drawing_state.transform = identity;
181 if ((state_block->text_rendering_params = text_rendering_params))
182 IDWriteRenderingParams_AddRef(state_block->text_rendering_params);
183}
static const struct ID2D1DrawingStateBlock1Vtbl d2d_state_block_vtbl
Definition: state_block.c:150
D2D1_MATRIX_3X2_F transform
Definition: d2d1_1.idl:246
ID2D1DrawingStateBlock1 ID2D1DrawingStateBlock1_iface
Definition: d2d1_private.h:452

Referenced by d2d_factory_CreateDrawingStateBlock(), and d2d_factory_CreateDrawingStateBlock1().

◆ d2d_state_block_QueryInterface()

static HRESULT STDMETHODCALLTYPE d2d_state_block_QueryInterface ( ID2D1DrawingStateBlock1 *  iface,
REFIID  iid,
void **  out 
)
static

Definition at line 28 of file state_block.c.

29{
30 TRACE("iface %p, iid %s, out %p.\n", iface, debugstr_guid(iid), out);
31
32 if (IsEqualGUID(iid, &IID_ID2D1DrawingStateBlock1)
33 || IsEqualGUID(iid, &IID_ID2D1DrawingStateBlock)
34 || IsEqualGUID(iid, &IID_ID2D1Resource)
35 || IsEqualGUID(iid, &IID_IUnknown))
36 {
37 ID2D1DrawingStateBlock1_AddRef(iface);
38 *out = iface;
39 return S_OK;
40 }
41
42 WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(iid));
43
44 *out = NULL;
45 return E_NOINTERFACE;
46}
#define WARN(fmt,...)
Definition: precomp.h:61
const GUID IID_IUnknown
#define NULL
Definition: types.h:112
#define S_OK
Definition: intsafe.h:52
#define debugstr_guid
Definition: kernel32.h:35
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
wchar_t tm const _CrtWcstime_Writes_and_advances_ptr_ count wchar_t ** out
Definition: wcsftime.cpp:383
#define E_NOINTERFACE
Definition: winerror.h:3479

◆ d2d_state_block_Release()

static ULONG STDMETHODCALLTYPE d2d_state_block_Release ( ID2D1DrawingStateBlock1 *  iface)
static

Definition at line 58 of file state_block.c.

59{
60 struct d2d_state_block *state_block = impl_from_ID2D1DrawingStateBlock1(iface);
62
63 TRACE("%p decreasing refcount to %lu.\n", iface, refcount);
64
65 if (!refcount)
66 {
67 if (state_block->text_rendering_params)
68 IDWriteRenderingParams_Release(state_block->text_rendering_params);
69 ID2D1Factory_Release(state_block->factory);
70 free(state_block);
71 }
72
73 return refcount;
74}
#define InterlockedDecrement
Definition: armddk.h:52
#define free
Definition: debug_ros.c:5

◆ d2d_state_block_SetDescription()

static void STDMETHODCALLTYPE d2d_state_block_SetDescription ( ID2D1DrawingStateBlock1 *  iface,
const D2D1_DRAWING_STATE_DESCRIPTION *  desc 
)
static

Definition at line 95 of file state_block.c.

97{
98 struct d2d_state_block *state_block = impl_from_ID2D1DrawingStateBlock1(iface);
99
100 TRACE("iface %p, desc %p.\n", iface, desc);
101
102 memcpy(&state_block->drawing_state, desc, sizeof(*desc));
103}

◆ d2d_state_block_SetDescription1()

static void STDMETHODCALLTYPE d2d_state_block_SetDescription1 ( ID2D1DrawingStateBlock1 *  iface,
const D2D1_DRAWING_STATE_DESCRIPTION1 *  desc 
)
static

Definition at line 140 of file state_block.c.

142{
143 struct d2d_state_block *state_block = impl_from_ID2D1DrawingStateBlock1(iface);
144
145 TRACE("iface %p, desc %p.\n", iface, desc);
146
147 state_block->drawing_state = *desc;
148}

◆ d2d_state_block_SetTextRenderingParams()

static void STDMETHODCALLTYPE d2d_state_block_SetTextRenderingParams ( ID2D1DrawingStateBlock1 *  iface,
IDWriteRenderingParams *  text_rendering_params 
)
static

Definition at line 105 of file state_block.c.

107{
108 struct d2d_state_block *state_block = impl_from_ID2D1DrawingStateBlock1(iface);
109
110 TRACE("iface %p, text_rendering_params %p.\n", iface, text_rendering_params);
111
113 IDWriteRenderingParams_AddRef(text_rendering_params);
114 if (state_block->text_rendering_params)
115 IDWriteRenderingParams_Release(state_block->text_rendering_params);
117}

◆ impl_from_ID2D1DrawingStateBlock1()

◆ unsafe_impl_from_ID2D1DrawingStateBlock()

struct d2d_state_block * unsafe_impl_from_ID2D1DrawingStateBlock ( ID2D1DrawingStateBlock *  iface)

Definition at line 185 of file state_block.c.

186{
187 if (!iface)
188 return NULL;
189 if (iface->lpVtbl != (ID2D1DrawingStateBlockVtbl *)&d2d_state_block_vtbl)
190 {
191 WARN("Unexpected state block vtbl %p.\n", iface->lpVtbl);
192 return NULL;
193 }
194 return CONTAINING_RECORD(iface, struct d2d_state_block, ID2D1DrawingStateBlock1_iface);
195}

Referenced by d2d_device_context_RestoreDrawingState(), and d2d_device_context_SaveDrawingState().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( d2d  )

Variable Documentation

◆ d2d_state_block_vtbl

const struct ID2D1DrawingStateBlock1Vtbl d2d_state_block_vtbl
static
Initial value:
=
{
}
static ULONG STDMETHODCALLTYPE d2d_state_block_AddRef(ID2D1DrawingStateBlock1 *iface)
Definition: state_block.c:48
static void STDMETHODCALLTYPE d2d_state_block_SetDescription(ID2D1DrawingStateBlock1 *iface, const D2D1_DRAWING_STATE_DESCRIPTION *desc)
Definition: state_block.c:95
static void STDMETHODCALLTYPE d2d_state_block_GetTextRenderingParams(ID2D1DrawingStateBlock1 *iface, IDWriteRenderingParams **text_rendering_params)
Definition: state_block.c:119
static void STDMETHODCALLTYPE d2d_state_block_GetDescription(ID2D1DrawingStateBlock1 *iface, D2D1_DRAWING_STATE_DESCRIPTION *desc)
Definition: state_block.c:85
static void STDMETHODCALLTYPE d2d_state_block_SetDescription1(ID2D1DrawingStateBlock1 *iface, const D2D1_DRAWING_STATE_DESCRIPTION1 *desc)
Definition: state_block.c:140
static void STDMETHODCALLTYPE d2d_state_block_SetTextRenderingParams(ID2D1DrawingStateBlock1 *iface, IDWriteRenderingParams *text_rendering_params)
Definition: state_block.c:105
static void STDMETHODCALLTYPE d2d_state_block_GetFactory(ID2D1DrawingStateBlock1 *iface, ID2D1Factory **factory)
Definition: state_block.c:76
static HRESULT STDMETHODCALLTYPE d2d_state_block_QueryInterface(ID2D1DrawingStateBlock1 *iface, REFIID iid, void **out)
Definition: state_block.c:28
static void STDMETHODCALLTYPE d2d_state_block_GetDescription1(ID2D1DrawingStateBlock1 *iface, D2D1_DRAWING_STATE_DESCRIPTION1 *desc)
Definition: state_block.c:130
static ULONG STDMETHODCALLTYPE d2d_state_block_Release(ID2D1DrawingStateBlock1 *iface)
Definition: state_block.c:58

Definition at line 150 of file state_block.c.

Referenced by d2d_state_block_init(), and unsafe_impl_from_ID2D1DrawingStateBlock().