d2d1: Implement d2d_factory_CreateTransformedGeometry().
This commit is contained in:
parent
69906b59d8
commit
acbb0bdfac
|
@ -249,6 +249,8 @@ struct d2d_geometry
|
|||
|
||||
ID2D1Factory *factory;
|
||||
|
||||
D2D_MATRIX_3X2_F transform;
|
||||
|
||||
D2D1_POINT_2F *vertices;
|
||||
size_t vertex_count;
|
||||
|
||||
|
@ -277,12 +279,18 @@ struct d2d_geometry
|
|||
{
|
||||
D2D1_RECT_F rect;
|
||||
} rectangle;
|
||||
struct
|
||||
{
|
||||
ID2D1Geometry *src_geometry;
|
||||
} transformed;
|
||||
} u;
|
||||
};
|
||||
|
||||
void d2d_path_geometry_init(struct d2d_geometry *geometry, ID2D1Factory *factory) DECLSPEC_HIDDEN;
|
||||
HRESULT d2d_rectangle_geometry_init(struct d2d_geometry *geometry,
|
||||
ID2D1Factory *factory, const D2D1_RECT_F *rect) DECLSPEC_HIDDEN;
|
||||
void d2d_transformed_geometry_init(struct d2d_geometry *geometry, ID2D1Factory *factory,
|
||||
ID2D1Geometry *src_geometry, const D2D_MATRIX_3X2_F *transform) DECLSPEC_HIDDEN;
|
||||
struct d2d_geometry *unsafe_impl_from_ID2D1Geometry(ID2D1Geometry *iface) DECLSPEC_HIDDEN;
|
||||
|
||||
static inline void d2d_matrix_multiply(D2D_MATRIX_3X2_F *a, const D2D_MATRIX_3X2_F *b)
|
||||
|
|
|
@ -150,10 +150,20 @@ static HRESULT STDMETHODCALLTYPE d2d_factory_CreateTransformedGeometry(ID2D1Fact
|
|||
ID2D1Geometry *src_geometry, const D2D1_MATRIX_3X2_F *transform,
|
||||
ID2D1TransformedGeometry **transformed_geometry)
|
||||
{
|
||||
FIXME("iface %p, src_geometry %p, transform %p, transformed_geometry %p stub!\n",
|
||||
struct d2d_geometry *object;
|
||||
|
||||
TRACE("iface %p, src_geometry %p, transform %p, transformed_geometry %p.\n",
|
||||
iface, src_geometry, transform, transformed_geometry);
|
||||
|
||||
return E_NOTIMPL;
|
||||
if (!(object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object))))
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
d2d_transformed_geometry_init(object, iface, src_geometry, transform);
|
||||
|
||||
TRACE("Created transformed geometry %p.\n", object);
|
||||
*transformed_geometry = (ID2D1TransformedGeometry *)&object->ID2D1Geometry_iface;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT STDMETHODCALLTYPE d2d_factory_CreatePathGeometry(ID2D1Factory *iface, ID2D1PathGeometry **geometry)
|
||||
|
|
|
@ -26,6 +26,13 @@ WINE_DEFAULT_DEBUG_CHANNEL(d2d);
|
|||
#define D2D_CDT_EDGE_FLAG_FREED 0x80000000u
|
||||
#define D2D_CDT_EDGE_FLAG_VISITED(r) (1u << (r))
|
||||
|
||||
static const D2D1_MATRIX_3X2_F identity =
|
||||
{
|
||||
1.0f, 0.0f,
|
||||
0.0f, 1.0f,
|
||||
0.0f, 0.0f,
|
||||
};
|
||||
|
||||
enum d2d_cdt_edge_next
|
||||
{
|
||||
D2D_EDGE_NEXT_ORIGIN = 0,
|
||||
|
@ -986,11 +993,12 @@ static void d2d_geometry_cleanup(struct d2d_geometry *geometry)
|
|||
}
|
||||
|
||||
static void d2d_geometry_init(struct d2d_geometry *geometry, ID2D1Factory *factory,
|
||||
const struct ID2D1GeometryVtbl *vtbl)
|
||||
const D2D1_MATRIX_3X2_F *transform, const struct ID2D1GeometryVtbl *vtbl)
|
||||
{
|
||||
geometry->ID2D1Geometry_iface.lpVtbl = vtbl;
|
||||
geometry->refcount = 1;
|
||||
ID2D1Factory_AddRef(geometry->factory = factory);
|
||||
geometry->transform = *transform;
|
||||
}
|
||||
|
||||
static inline struct d2d_geometry *impl_from_ID2D1GeometrySink(ID2D1GeometrySink *iface)
|
||||
|
@ -1574,7 +1582,7 @@ static const struct ID2D1PathGeometryVtbl d2d_path_geometry_vtbl =
|
|||
|
||||
void d2d_path_geometry_init(struct d2d_geometry *geometry, ID2D1Factory *factory)
|
||||
{
|
||||
d2d_geometry_init(geometry, factory, (ID2D1GeometryVtbl *)&d2d_path_geometry_vtbl);
|
||||
d2d_geometry_init(geometry, factory, &identity, (ID2D1GeometryVtbl *)&d2d_path_geometry_vtbl);
|
||||
geometry->u.path.ID2D1GeometrySink_iface.lpVtbl = &d2d_geometry_sink_vtbl;
|
||||
}
|
||||
|
||||
|
@ -1791,7 +1799,7 @@ static const struct ID2D1RectangleGeometryVtbl d2d_rectangle_geometry_vtbl =
|
|||
|
||||
HRESULT d2d_rectangle_geometry_init(struct d2d_geometry *geometry, ID2D1Factory *factory, const D2D1_RECT_F *rect)
|
||||
{
|
||||
d2d_geometry_init(geometry, factory, (ID2D1GeometryVtbl *)&d2d_rectangle_geometry_vtbl);
|
||||
d2d_geometry_init(geometry, factory, &identity, (ID2D1GeometryVtbl *)&d2d_rectangle_geometry_vtbl);
|
||||
geometry->u.rectangle.rect = *rect;
|
||||
|
||||
if (!(geometry->vertices = HeapAlloc(GetProcessHeap(), 0, 4 * sizeof(*geometry->vertices))))
|
||||
|
@ -1826,11 +1834,256 @@ HRESULT d2d_rectangle_geometry_init(struct d2d_geometry *geometry, ID2D1Factory
|
|||
return S_OK;
|
||||
}
|
||||
|
||||
static inline struct d2d_geometry *impl_from_ID2D1TransformedGeometry(ID2D1TransformedGeometry *iface)
|
||||
{
|
||||
return CONTAINING_RECORD(iface, struct d2d_geometry, ID2D1Geometry_iface);
|
||||
}
|
||||
|
||||
static HRESULT STDMETHODCALLTYPE d2d_transformed_geometry_QueryInterface(ID2D1TransformedGeometry *iface,
|
||||
REFIID iid, void **out)
|
||||
{
|
||||
TRACE("iface %p, iid %s, out %p.\n", iface, debugstr_guid(iid), out);
|
||||
|
||||
if (IsEqualGUID(iid, &IID_ID2D1TransformedGeometry)
|
||||
|| IsEqualGUID(iid, &IID_ID2D1Geometry)
|
||||
|| IsEqualGUID(iid, &IID_ID2D1Resource)
|
||||
|| IsEqualGUID(iid, &IID_IUnknown))
|
||||
{
|
||||
ID2D1TransformedGeometry_AddRef(iface);
|
||||
*out = iface;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(iid));
|
||||
|
||||
*out = NULL;
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
|
||||
static ULONG STDMETHODCALLTYPE d2d_transformed_geometry_AddRef(ID2D1TransformedGeometry *iface)
|
||||
{
|
||||
struct d2d_geometry *geometry = impl_from_ID2D1TransformedGeometry(iface);
|
||||
ULONG refcount = InterlockedIncrement(&geometry->refcount);
|
||||
|
||||
TRACE("%p increasing refcount to %u.\n", iface, refcount);
|
||||
|
||||
return refcount;
|
||||
}
|
||||
|
||||
static ULONG STDMETHODCALLTYPE d2d_transformed_geometry_Release(ID2D1TransformedGeometry *iface)
|
||||
{
|
||||
struct d2d_geometry *geometry = impl_from_ID2D1TransformedGeometry(iface);
|
||||
ULONG refcount = InterlockedDecrement(&geometry->refcount);
|
||||
|
||||
TRACE("%p decreasing refcount to %u.\n", iface, refcount);
|
||||
|
||||
if (!refcount)
|
||||
{
|
||||
geometry->beziers = NULL;
|
||||
geometry->faces = NULL;
|
||||
geometry->vertices = NULL;
|
||||
ID2D1Geometry_Release(geometry->u.transformed.src_geometry);
|
||||
d2d_geometry_cleanup(geometry);
|
||||
HeapFree(GetProcessHeap(), 0, geometry);
|
||||
}
|
||||
|
||||
return refcount;
|
||||
}
|
||||
|
||||
static void STDMETHODCALLTYPE d2d_transformed_geometry_GetFactory(ID2D1TransformedGeometry *iface,
|
||||
ID2D1Factory **factory)
|
||||
{
|
||||
struct d2d_geometry *geometry = impl_from_ID2D1TransformedGeometry(iface);
|
||||
|
||||
TRACE("iface %p, factory %p.\n", iface, factory);
|
||||
|
||||
ID2D1Factory_AddRef(*factory = geometry->factory);
|
||||
}
|
||||
|
||||
static HRESULT STDMETHODCALLTYPE d2d_transformed_geometry_GetBounds(ID2D1TransformedGeometry *iface,
|
||||
const D2D1_MATRIX_3X2_F *transform, D2D1_RECT_F *bounds)
|
||||
{
|
||||
FIXME("iface %p, transform %p, bounds %p stub!\n", iface, transform, bounds);
|
||||
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT STDMETHODCALLTYPE d2d_transformed_geometry_GetWidenedBounds(ID2D1TransformedGeometry *iface,
|
||||
float stroke_width, ID2D1StrokeStyle *stroke_style, const D2D1_MATRIX_3X2_F *transform,
|
||||
float tolerance, D2D1_RECT_F *bounds)
|
||||
{
|
||||
FIXME("iface %p, stroke_width %.8e, stroke_style %p, transform %p, tolerance %.8e, bounds %p stub!\n",
|
||||
iface, stroke_width, stroke_style, transform, tolerance, bounds);
|
||||
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT STDMETHODCALLTYPE d2d_transformed_geometry_StrokeContainsPoint(ID2D1TransformedGeometry *iface,
|
||||
D2D1_POINT_2F point, float stroke_width, ID2D1StrokeStyle *stroke_style, const D2D1_MATRIX_3X2_F *transform,
|
||||
float tolerance, BOOL *contains)
|
||||
{
|
||||
FIXME("iface %p, point {%.8e, %.8e}, stroke_width %.8e, stroke_style %p, "
|
||||
"transform %p, tolerance %.8e, contains %p stub!\n",
|
||||
iface, point.x, point.y, stroke_width, stroke_style, transform, tolerance, contains);
|
||||
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT STDMETHODCALLTYPE d2d_transformed_geometry_FillContainsPoint(ID2D1TransformedGeometry *iface,
|
||||
D2D1_POINT_2F point, const D2D1_MATRIX_3X2_F *transform, float tolerance, BOOL *contains)
|
||||
{
|
||||
FIXME("iface %p, point {%.8e, %.8e}, transform %p, tolerance %.8e, contains %p stub!\n",
|
||||
iface, point.x, point.y, transform, tolerance, contains);
|
||||
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT STDMETHODCALLTYPE d2d_transformed_geometry_CompareWithGeometry(ID2D1TransformedGeometry *iface,
|
||||
ID2D1Geometry *geometry, const D2D1_MATRIX_3X2_F *transform, float tolerance, D2D1_GEOMETRY_RELATION *relation)
|
||||
{
|
||||
FIXME("iface %p, geometry %p, transform %p, tolerance %.8e, relation %p stub!\n",
|
||||
iface, geometry, transform, tolerance, relation);
|
||||
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT STDMETHODCALLTYPE d2d_transformed_geometry_Simplify(ID2D1TransformedGeometry *iface,
|
||||
D2D1_GEOMETRY_SIMPLIFICATION_OPTION option, const D2D1_MATRIX_3X2_F *transform, float tolerance,
|
||||
ID2D1SimplifiedGeometrySink *sink)
|
||||
{
|
||||
FIXME("iface %p, option %#x, transform %p, tolerance %.8e, sink %p stub!\n",
|
||||
iface, option, transform, tolerance, sink);
|
||||
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT STDMETHODCALLTYPE d2d_transformed_geometry_Tessellate(ID2D1TransformedGeometry *iface,
|
||||
const D2D1_MATRIX_3X2_F *transform, float tolerance, ID2D1TessellationSink *sink)
|
||||
{
|
||||
FIXME("iface %p, transform %p, tolerance %.8e, sink %p stub!\n", iface, transform, tolerance, sink);
|
||||
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT STDMETHODCALLTYPE d2d_transformed_geometry_CombineWithGeometry(ID2D1TransformedGeometry *iface,
|
||||
ID2D1Geometry *geometry, D2D1_COMBINE_MODE combine_mode, const D2D1_MATRIX_3X2_F *transform,
|
||||
float tolerance, ID2D1SimplifiedGeometrySink *sink)
|
||||
{
|
||||
FIXME("iface %p, geometry %p, combine_mode %#x, transform %p, tolerance %.8e, sink %p stub!\n",
|
||||
iface, geometry, combine_mode, transform, tolerance, sink);
|
||||
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT STDMETHODCALLTYPE d2d_transformed_geometry_Outline(ID2D1TransformedGeometry *iface,
|
||||
const D2D1_MATRIX_3X2_F *transform, float tolerance, ID2D1SimplifiedGeometrySink *sink)
|
||||
{
|
||||
FIXME("iface %p, transform %p, tolerance %.8e, sink %p stub!\n", iface, transform, tolerance, sink);
|
||||
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT STDMETHODCALLTYPE d2d_transformed_geometry_ComputeArea(ID2D1TransformedGeometry *iface,
|
||||
const D2D1_MATRIX_3X2_F *transform, float tolerance, float *area)
|
||||
{
|
||||
FIXME("iface %p, transform %p, tolerance %.8e, area %p stub!\n", iface, transform, tolerance, area);
|
||||
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT STDMETHODCALLTYPE d2d_transformed_geometry_ComputeLength(ID2D1TransformedGeometry *iface,
|
||||
const D2D1_MATRIX_3X2_F *transform, float tolerance, float *length)
|
||||
{
|
||||
FIXME("iface %p, transform %p, tolerance %.8e, length %p stub!\n", iface, transform, tolerance, length);
|
||||
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT STDMETHODCALLTYPE d2d_transformed_geometry_ComputePointAtLength(ID2D1TransformedGeometry *iface,
|
||||
float length, const D2D1_MATRIX_3X2_F *transform, float tolerance, D2D1_POINT_2F *point,
|
||||
D2D1_POINT_2F *tangent)
|
||||
{
|
||||
FIXME("iface %p, length %.8e, transform %p, tolerance %.8e, point %p, tangent %p stub!\n",
|
||||
iface, length, transform, tolerance, point, tangent);
|
||||
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT STDMETHODCALLTYPE d2d_transformed_geometry_Widen(ID2D1TransformedGeometry *iface, float stroke_width,
|
||||
ID2D1StrokeStyle *stroke_style, const D2D1_MATRIX_3X2_F *transform, float tolerance,
|
||||
ID2D1SimplifiedGeometrySink *sink)
|
||||
{
|
||||
FIXME("iface %p, stroke_width %.8e, stroke_style %p, transform %p, tolerance %.8e, sink %p stub!\n",
|
||||
iface, stroke_width, stroke_style, transform, tolerance, sink);
|
||||
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static void STDMETHODCALLTYPE d2d_transformed_geometry_GetSourceGeometry(ID2D1TransformedGeometry *iface,
|
||||
ID2D1Geometry **src_geometry)
|
||||
{
|
||||
struct d2d_geometry *geometry = impl_from_ID2D1TransformedGeometry(iface);
|
||||
|
||||
TRACE("iface %p, src_geometry %p.\n", iface, src_geometry);
|
||||
|
||||
ID2D1Geometry_AddRef(*src_geometry = geometry->u.transformed.src_geometry);
|
||||
}
|
||||
|
||||
static void STDMETHODCALLTYPE d2d_transformed_geometry_GetTransform(ID2D1TransformedGeometry *iface,
|
||||
D2D1_MATRIX_3X2_F *transform)
|
||||
{
|
||||
struct d2d_geometry *geometry = impl_from_ID2D1TransformedGeometry(iface);
|
||||
|
||||
TRACE("iface %p, transform %p.\n", iface, transform);
|
||||
|
||||
*transform = geometry->transform;
|
||||
}
|
||||
|
||||
static const struct ID2D1TransformedGeometryVtbl d2d_transformed_geometry_vtbl =
|
||||
{
|
||||
d2d_transformed_geometry_QueryInterface,
|
||||
d2d_transformed_geometry_AddRef,
|
||||
d2d_transformed_geometry_Release,
|
||||
d2d_transformed_geometry_GetFactory,
|
||||
d2d_transformed_geometry_GetBounds,
|
||||
d2d_transformed_geometry_GetWidenedBounds,
|
||||
d2d_transformed_geometry_StrokeContainsPoint,
|
||||
d2d_transformed_geometry_FillContainsPoint,
|
||||
d2d_transformed_geometry_CompareWithGeometry,
|
||||
d2d_transformed_geometry_Simplify,
|
||||
d2d_transformed_geometry_Tessellate,
|
||||
d2d_transformed_geometry_CombineWithGeometry,
|
||||
d2d_transformed_geometry_Outline,
|
||||
d2d_transformed_geometry_ComputeArea,
|
||||
d2d_transformed_geometry_ComputeLength,
|
||||
d2d_transformed_geometry_ComputePointAtLength,
|
||||
d2d_transformed_geometry_Widen,
|
||||
d2d_transformed_geometry_GetSourceGeometry,
|
||||
d2d_transformed_geometry_GetTransform,
|
||||
};
|
||||
|
||||
void d2d_transformed_geometry_init(struct d2d_geometry *geometry, ID2D1Factory *factory,
|
||||
ID2D1Geometry *src_geometry, const D2D_MATRIX_3X2_F *transform)
|
||||
{
|
||||
struct d2d_geometry *src_impl;
|
||||
|
||||
d2d_geometry_init(geometry, factory, transform, (ID2D1GeometryVtbl *)&d2d_transformed_geometry_vtbl);
|
||||
ID2D1Geometry_AddRef(geometry->u.transformed.src_geometry = src_geometry);
|
||||
src_impl = unsafe_impl_from_ID2D1Geometry(src_geometry);
|
||||
geometry->vertices = src_impl->vertices;
|
||||
geometry->vertex_count = src_impl->vertex_count;
|
||||
geometry->faces = src_impl->faces;
|
||||
geometry->face_count = src_impl->face_count;
|
||||
geometry->beziers = src_impl->beziers;
|
||||
geometry->bezier_count = src_impl->bezier_count;
|
||||
}
|
||||
|
||||
struct d2d_geometry *unsafe_impl_from_ID2D1Geometry(ID2D1Geometry *iface)
|
||||
{
|
||||
if (!iface)
|
||||
return NULL;
|
||||
assert(iface->lpVtbl == (const ID2D1GeometryVtbl *)&d2d_path_geometry_vtbl
|
||||
|| iface->lpVtbl == (const ID2D1GeometryVtbl *)&d2d_rectangle_geometry_vtbl);
|
||||
|| iface->lpVtbl == (const ID2D1GeometryVtbl *)&d2d_rectangle_geometry_vtbl
|
||||
|| iface->lpVtbl == (const ID2D1GeometryVtbl *)&d2d_transformed_geometry_vtbl);
|
||||
return CONTAINING_RECORD(iface, struct d2d_geometry, ID2D1Geometry_iface);
|
||||
}
|
||||
|
|
|
@ -133,6 +133,7 @@ static void d2d_draw(struct d2d_d3d_render_target *render_target, enum d2d_shape
|
|||
{
|
||||
struct d2d_shape_resources *shape_resources = &render_target->shape_resources[shape_type];
|
||||
ID3D10Device *device = render_target->device;
|
||||
D3D10_RECT scissor_rect;
|
||||
unsigned int offset;
|
||||
D3D10_VIEWPORT vp;
|
||||
HRESULT hr;
|
||||
|
@ -164,16 +165,22 @@ static void d2d_draw(struct d2d_d3d_render_target *render_target, enum d2d_shape
|
|||
if (render_target->clip_stack.count)
|
||||
{
|
||||
const D2D1_RECT_F *clip_rect;
|
||||
D3D10_RECT scissor_rect;
|
||||
|
||||
clip_rect = &render_target->clip_stack.stack[render_target->clip_stack.count - 1];
|
||||
scissor_rect.left = clip_rect->left + 0.5f;
|
||||
scissor_rect.top = clip_rect->top + 0.5f;
|
||||
scissor_rect.right = clip_rect->right + 0.5f;
|
||||
scissor_rect.bottom = clip_rect->bottom + 0.5f;
|
||||
ID3D10Device_RSSetScissorRects(device, 1, &scissor_rect);
|
||||
ID3D10Device_RSSetState(device, render_target->rs);
|
||||
}
|
||||
else
|
||||
{
|
||||
scissor_rect.left = 0.0f;
|
||||
scissor_rect.top = 0.0f;
|
||||
scissor_rect.right = render_target->pixel_size.width;
|
||||
scissor_rect.bottom = render_target->pixel_size.height;
|
||||
}
|
||||
ID3D10Device_RSSetScissorRects(device, 1, &scissor_rect);
|
||||
ID3D10Device_RSSetState(device, render_target->rs);
|
||||
ID3D10Device_OMSetRenderTargets(device, 1, &render_target->view, NULL);
|
||||
if (brush)
|
||||
d2d_brush_bind_resources(brush, render_target, shape_type);
|
||||
|
@ -664,6 +671,7 @@ static void STDMETHODCALLTYPE d2d_d3d_render_target_FillGeometry(ID2D1RenderTarg
|
|||
ID3D10Buffer *ib, *vb, *vs_cb, *ps_cb;
|
||||
D3D10_SUBRESOURCE_DATA buffer_data;
|
||||
D3D10_BUFFER_DESC buffer_desc;
|
||||
D2D1_MATRIX_3X2_F w, g;
|
||||
float tmp_x, tmp_y;
|
||||
HRESULT hr;
|
||||
struct
|
||||
|
@ -681,13 +689,24 @@ static void STDMETHODCALLTYPE d2d_d3d_render_target_FillGeometry(ID2D1RenderTarg
|
|||
|
||||
tmp_x = (2.0f * render_target->dpi_x) / (96.0f * render_target->pixel_size.width);
|
||||
tmp_y = -(2.0f * render_target->dpi_y) / (96.0f * render_target->pixel_size.height);
|
||||
transform._11 = render_target->drawing_state.transform._11 * tmp_x;
|
||||
transform._21 = render_target->drawing_state.transform._21 * tmp_x;
|
||||
transform._31 = render_target->drawing_state.transform._31 * tmp_x - 1.0f;
|
||||
w = render_target->drawing_state.transform;
|
||||
w._11 *= tmp_x;
|
||||
w._21 *= tmp_x;
|
||||
w._31 = w._31 * tmp_x - 1.0f;
|
||||
w._12 *= tmp_y;
|
||||
w._22 *= tmp_y;
|
||||
w._32 = w._32 * tmp_y + 1.0f;
|
||||
|
||||
g = geometry_impl->transform;
|
||||
d2d_matrix_multiply(&g, &w);
|
||||
|
||||
transform._11 = g._11;
|
||||
transform._21 = g._21;
|
||||
transform._31 = g._31;
|
||||
transform.pad0 = 0.0f;
|
||||
transform._12 = render_target->drawing_state.transform._12 * tmp_y;
|
||||
transform._22 = render_target->drawing_state.transform._22 * tmp_y;
|
||||
transform._32 = render_target->drawing_state.transform._32 * tmp_y + 1.0f;
|
||||
transform._12 = g._12;
|
||||
transform._22 = g._22;
|
||||
transform._32 = g._32;
|
||||
transform.pad1 = 0.0f;
|
||||
|
||||
buffer_desc.ByteWidth = sizeof(transform);
|
||||
|
@ -1801,7 +1820,7 @@ HRESULT d2d_d3d_render_target_init(struct d2d_d3d_render_target *render_target,
|
|||
}
|
||||
|
||||
rs_desc.FillMode = D3D10_FILL_SOLID;
|
||||
rs_desc.CullMode = D3D10_CULL_BACK;
|
||||
rs_desc.CullMode = D3D10_CULL_NONE;
|
||||
rs_desc.FrontCounterClockwise = FALSE;
|
||||
rs_desc.DepthBias = 0;
|
||||
rs_desc.DepthBiasClamp = 0.0f;
|
||||
|
|
|
@ -251,6 +251,18 @@ static void serialize_figure(struct figure *figure)
|
|||
trace("%.*s\n", k * 4, output);
|
||||
}
|
||||
|
||||
static void figure_add_span(struct figure *figure, unsigned int span)
|
||||
{
|
||||
if (figure->span_count == figure->spans_size)
|
||||
{
|
||||
figure->spans_size *= 2;
|
||||
figure->spans = HeapReAlloc(GetProcessHeap(), 0, figure->spans,
|
||||
figure->spans_size * sizeof(*figure->spans));
|
||||
}
|
||||
|
||||
figure->spans[figure->span_count++] = span;
|
||||
}
|
||||
|
||||
static void deserialize_span(struct figure *figure, unsigned int *current, unsigned int *shift, unsigned int c)
|
||||
{
|
||||
*current |= (c & 0x7f) << *shift;
|
||||
|
@ -260,14 +272,8 @@ static void deserialize_span(struct figure *figure, unsigned int *current, unsig
|
|||
return;
|
||||
}
|
||||
|
||||
if (figure->span_count == figure->spans_size)
|
||||
{
|
||||
figure->spans_size *= 2;
|
||||
figure->spans = HeapReAlloc(GetProcessHeap(), 0, figure->spans,
|
||||
figure->spans_size * sizeof(*figure->spans));
|
||||
}
|
||||
|
||||
figure->spans[figure->span_count++] = *current;
|
||||
if (*current)
|
||||
figure_add_span(figure, *current);
|
||||
*current = 0;
|
||||
*shift = 0;
|
||||
}
|
||||
|
@ -353,28 +359,48 @@ static BOOL compare_figure(IDXGISurface *surface, unsigned int x, unsigned int y
|
|||
{
|
||||
if ((i || j) && prev != row[j])
|
||||
{
|
||||
if (figure.span_count == figure.spans_size)
|
||||
{
|
||||
figure.spans_size *= 2;
|
||||
figure.spans = HeapReAlloc(GetProcessHeap(), 0, figure.spans,
|
||||
figure.spans_size * sizeof(*figure.spans));
|
||||
}
|
||||
figure.spans[figure.span_count++] = span;
|
||||
figure_add_span(&figure, span);
|
||||
prev = row[j];
|
||||
span = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (span)
|
||||
figure_add_span(&figure, span);
|
||||
|
||||
deserialize_figure(&ref_figure, (BYTE *)ref);
|
||||
span = w * h;
|
||||
for (i = 0; i < ref_figure.span_count; ++i)
|
||||
{
|
||||
span -= ref_figure.spans[i];
|
||||
}
|
||||
if (span)
|
||||
figure_add_span(&ref_figure, span);
|
||||
|
||||
j = min(figure.span_count, ref_figure.span_count);
|
||||
for (i = 0, diff = 0; i < j; ++i)
|
||||
diff += abs(figure.spans[i] - ref_figure.spans[i]);
|
||||
for (i = j; j < figure.span_count; ++j)
|
||||
diff += figure.spans[i];
|
||||
for (i = j; j < ref_figure.span_count; ++j)
|
||||
diff += ref_figure.spans[i];
|
||||
for (i = 0, j = 0, diff = 0; i < figure.span_count && j < ref_figure.span_count;)
|
||||
{
|
||||
if (figure.spans[i] == ref_figure.spans[j])
|
||||
{
|
||||
if ((i ^ j) & 1)
|
||||
diff += ref_figure.spans[j];
|
||||
++i;
|
||||
++j;
|
||||
}
|
||||
else if (figure.spans[i] > ref_figure.spans[j])
|
||||
{
|
||||
if ((i ^ j) & 1)
|
||||
diff += ref_figure.spans[j];
|
||||
figure.spans[i] -= ref_figure.spans[j];
|
||||
++j;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((i ^ j) & 1)
|
||||
diff += figure.spans[i];
|
||||
ref_figure.spans[j] -= figure.spans[i];
|
||||
++i;
|
||||
}
|
||||
}
|
||||
if (diff > max_diff)
|
||||
serialize_figure(&figure);
|
||||
|
||||
|
@ -1229,10 +1255,13 @@ static void fill_geometry_sink_bezier(ID2D1GeometrySink *sink)
|
|||
|
||||
static void test_path_geometry(void)
|
||||
{
|
||||
ID2D1TransformedGeometry *transformed_geometry;
|
||||
D2D1_MATRIX_3X2_F matrix, tmp_matrix;
|
||||
ID2D1GeometrySink *sink, *tmp_sink;
|
||||
D2D1_POINT_2F point = {0.0f, 0.0f};
|
||||
ID2D1SolidColorBrush *brush;
|
||||
ID2D1PathGeometry *geometry;
|
||||
ID2D1Geometry *tmp_geometry;
|
||||
IDXGISwapChain *swapchain;
|
||||
ID2D1RenderTarget *rt;
|
||||
ID3D10Device1 *device;
|
||||
|
@ -1437,14 +1466,32 @@ static void test_path_geometry(void)
|
|||
ID2D1GeometrySink_SetFillMode(sink, D2D1_FILL_MODE_WINDING);
|
||||
ID2D1GeometrySink_Release(sink);
|
||||
|
||||
set_matrix_identity(&matrix);
|
||||
translate_matrix(&matrix, 80.0f, 640.0f);
|
||||
scale_matrix(&matrix, 1.0f, -1.0f);
|
||||
hr = ID2D1Factory_CreateTransformedGeometry(factory, (ID2D1Geometry *)geometry, &matrix, &transformed_geometry);
|
||||
ok(SUCCEEDED(hr), "Failed to create transformed geometry, hr %#x.\n", hr);
|
||||
|
||||
ID2D1TransformedGeometry_GetSourceGeometry(transformed_geometry, &tmp_geometry);
|
||||
ok(tmp_geometry == (ID2D1Geometry *)geometry,
|
||||
"Got unexpected source geometry %p, expected %p.\n", tmp_geometry, geometry);
|
||||
ID2D1Geometry_Release(tmp_geometry);
|
||||
ID2D1TransformedGeometry_GetTransform(transformed_geometry, &tmp_matrix);
|
||||
ok(!memcmp(&tmp_matrix, &matrix, sizeof(matrix)),
|
||||
"Got unexpected matrix {%.8e, %.8e, %.8e, %.8e, %.8e, %.8e}.\n",
|
||||
tmp_matrix._11, tmp_matrix._12, tmp_matrix._21,
|
||||
tmp_matrix._22, tmp_matrix._31, tmp_matrix._32);
|
||||
|
||||
ID2D1RenderTarget_BeginDraw(rt);
|
||||
set_color(&color, 0.396f, 0.180f, 0.537f, 1.0f);
|
||||
ID2D1RenderTarget_Clear(rt, &color);
|
||||
ID2D1RenderTarget_FillGeometry(rt, (ID2D1Geometry *)geometry, (ID2D1Brush *)brush, NULL);
|
||||
ID2D1RenderTarget_FillGeometry(rt, (ID2D1Geometry *)transformed_geometry, (ID2D1Brush *)brush, NULL);
|
||||
hr = ID2D1RenderTarget_EndDraw(rt, NULL, NULL);
|
||||
ok(SUCCEEDED(hr), "Failed to end draw, hr %#x.\n", hr);
|
||||
match = compare_surface(surface, "736d9bf019bcf0be264571c1bd954f07752330ab");
|
||||
match = compare_surface(surface, "3aace1b22aae111cb577614fed16e4eb1650dba5");
|
||||
ok(match, "Surface does not match.\n");
|
||||
ID2D1TransformedGeometry_Release(transformed_geometry);
|
||||
ID2D1PathGeometry_Release(geometry);
|
||||
|
||||
hr = ID2D1Factory_CreatePathGeometry(factory, &geometry);
|
||||
|
@ -1463,13 +1510,21 @@ static void test_path_geometry(void)
|
|||
ok(count == 44, "Got unexpected segment count %u.\n", count);
|
||||
ID2D1GeometrySink_Release(sink);
|
||||
|
||||
set_matrix_identity(&matrix);
|
||||
translate_matrix(&matrix, 320.0f, 320.0f);
|
||||
scale_matrix(&matrix, -1.0f, 1.0f);
|
||||
hr = ID2D1Factory_CreateTransformedGeometry(factory, (ID2D1Geometry *)geometry, &matrix, &transformed_geometry);
|
||||
ok(SUCCEEDED(hr), "Failed to create transformed geometry, hr %#x.\n", hr);
|
||||
|
||||
ID2D1RenderTarget_BeginDraw(rt);
|
||||
ID2D1RenderTarget_Clear(rt, &color);
|
||||
ID2D1RenderTarget_FillGeometry(rt, (ID2D1Geometry *)geometry, (ID2D1Brush *)brush, NULL);
|
||||
ID2D1RenderTarget_FillGeometry(rt, (ID2D1Geometry *)transformed_geometry, (ID2D1Brush *)brush, NULL);
|
||||
hr = ID2D1RenderTarget_EndDraw(rt, NULL, NULL);
|
||||
ok(SUCCEEDED(hr), "Failed to end draw, hr %#x.\n", hr);
|
||||
match = compare_surface(surface, "dd80ed3c218698687156ff4598db3a53917f8476");
|
||||
match = compare_surface(surface, "bfb40a1f007694fa07dbd3b854f3f5d9c3e1d76b");
|
||||
ok(match, "Surface does not match.\n");
|
||||
ID2D1TransformedGeometry_Release(transformed_geometry);
|
||||
ID2D1PathGeometry_Release(geometry);
|
||||
|
||||
hr = ID2D1Factory_CreatePathGeometry(factory, &geometry);
|
||||
|
@ -1487,9 +1542,18 @@ static void test_path_geometry(void)
|
|||
ok(count == 10, "Got unexpected segment count %u.\n", count);
|
||||
ID2D1GeometrySink_Release(sink);
|
||||
|
||||
set_matrix_identity(&matrix);
|
||||
scale_matrix(&matrix, 0.5f, 2.0f);
|
||||
translate_matrix(&matrix, 240.0f, -33.0f);
|
||||
rotate_matrix(&matrix, M_PI / 4.0f);
|
||||
scale_matrix(&matrix, 2.0f, 0.5f);
|
||||
hr = ID2D1Factory_CreateTransformedGeometry(factory, (ID2D1Geometry *)geometry, &matrix, &transformed_geometry);
|
||||
ok(SUCCEEDED(hr), "Failed to create transformed geometry, hr %#x.\n", hr);
|
||||
|
||||
ID2D1RenderTarget_BeginDraw(rt);
|
||||
ID2D1RenderTarget_Clear(rt, &color);
|
||||
ID2D1RenderTarget_FillGeometry(rt, (ID2D1Geometry *)geometry, (ID2D1Brush *)brush, NULL);
|
||||
ID2D1RenderTarget_FillGeometry(rt, (ID2D1Geometry *)transformed_geometry, (ID2D1Brush *)brush, NULL);
|
||||
hr = ID2D1RenderTarget_EndDraw(rt, NULL, NULL);
|
||||
ok(SUCCEEDED(hr), "Failed to end draw, hr %#x.\n", hr);
|
||||
match = compare_figure(surface, 0, 0, 160, 160, 0xff652e89, 64,
|
||||
|
@ -1502,6 +1566,19 @@ static void test_path_geometry(void)
|
|||
"EBVnFBAUaRQOFGsTDhJvEgwSchAMEHYPCg96DQoMggEICgiLAQQIBJQBCJgBCJkBBpoBBpoBBpoB"
|
||||
"BpsBBJwBBJwBBJwBBJwBBJ0BAp4BAp4BAp4BAp4BAp4BAp4BAp4BAgAA");
|
||||
todo_wine ok(match, "Figure does not match.\n");
|
||||
match = compare_figure(surface, 160, 0, 320, 160, 0xff652e89, 64,
|
||||
"4VIBwAIBWgHlAQFYAecBAVYB6QEBVAHrAQEjDCMB7AECHhQeAu0BAxoYGgPvAQMWHhYD8QEDFCAU"
|
||||
"A/MBBBAkEAT0AQUOJw0F9QEGCioKBvcBBggsCAb4AQgFLgUI+QEJATIBCfsBCAIwAgj8AQcFLAUH"
|
||||
"/QEFCCgIBf4BBAwiDAT/AQIQHBAClwISlwIBPgGAAgI8Av8BAzwD/QEEPAT7AQY6BvkBBzoH+AEI"
|
||||
"OAj3AQk4CfYBCTgK9AELNgvzAQw2DPIBDDYM8QEONA7wAQ40DvABDjQO7wEPNA/uAQ80D+4BEDIQ"
|
||||
"7QERMhHsAREyEewBETIR7AERMhHsAREyEewBETIR7AERMhHsAREyEewBETIR7AERMhHsAREyEewB"
|
||||
"ETIR7AERMhHsAREyEe0BEDIQ7gEQMw/uAQ80D+4BDzQP7wEONA7wAQ40DvEBDDYM8gEMNgzzAQs2"
|
||||
"C/QBCzcK9QEJOAn3AQg4CfcBBzoH+QEGOgb7AQU6BfwBBDwE/QEDPAP/AQE+AZkCDpkCAhIYEgKA"
|
||||
"AgMNIA0D/wEFCSYJBf4BBgYqBgf8AQgDLgMI+wFG+gEIAzADCPkBBwYuBgf3AQYKKgoG9gEFDCgM"
|
||||
"BfUBBBAlDwTzAQQSIhIE8QEDFh4WA/ABAhkaGQLvAQIcFhwC7QECIBAgAusBASgEKAHpAQFWAecB"
|
||||
"AVgB5QEBWgHAAgEA");
|
||||
todo_wine ok(match, "Figure does not match.\n");
|
||||
ID2D1TransformedGeometry_Release(transformed_geometry);
|
||||
ID2D1PathGeometry_Release(geometry);
|
||||
|
||||
hr = ID2D1Factory_CreatePathGeometry(factory, &geometry);
|
||||
|
@ -1520,9 +1597,18 @@ static void test_path_geometry(void)
|
|||
ok(count == 10, "Got unexpected segment count %u.\n", count);
|
||||
ID2D1GeometrySink_Release(sink);
|
||||
|
||||
set_matrix_identity(&matrix);
|
||||
scale_matrix(&matrix, 0.5f, 2.0f);
|
||||
translate_matrix(&matrix, 127.0f, 80.0f);
|
||||
rotate_matrix(&matrix, M_PI / -4.0f);
|
||||
scale_matrix(&matrix, 2.0f, 0.5f);
|
||||
hr = ID2D1Factory_CreateTransformedGeometry(factory, (ID2D1Geometry *)geometry, &matrix, &transformed_geometry);
|
||||
ok(SUCCEEDED(hr), "Failed to create transformed geometry, hr %#x.\n", hr);
|
||||
|
||||
ID2D1RenderTarget_BeginDraw(rt);
|
||||
ID2D1RenderTarget_Clear(rt, &color);
|
||||
ID2D1RenderTarget_FillGeometry(rt, (ID2D1Geometry *)geometry, (ID2D1Brush *)brush, NULL);
|
||||
ID2D1RenderTarget_FillGeometry(rt, (ID2D1Geometry *)transformed_geometry, (ID2D1Brush *)brush, NULL);
|
||||
hr = ID2D1RenderTarget_EndDraw(rt, NULL, NULL);
|
||||
ok(SUCCEEDED(hr), "Failed to end draw, hr %#x.\n", hr);
|
||||
match = compare_figure(surface, 0, 0, 160, 160, 0xff652e89, 64,
|
||||
|
@ -1532,6 +1618,16 @@ static void test_path_geometry(void)
|
|||
"TFRMVEtWSlZKV0hYSFlGWkZbRFxDXkJfQGE+YzxlOmc4aTZrM28wcix2KHojggEaiwEQlAEImAEI"
|
||||
"mQEGmgEGmgEGmgEGmwEEnAEEnAEEnAEEnAEEnQECngECngECngECngECngECngECngEC");
|
||||
ok(match, "Figure does not match.\n");
|
||||
match = compare_figure(surface, 160, 0, 320, 160, 0xff652e89, 64,
|
||||
"4VIBwAIBWgHlAQFYAecBAVYB6QEBVAHrAQIhDiIB7QECHRUdAu4BAhkaGQPvAQMWHhYD8QEEEyET"
|
||||
"A/MBBBAkEAT1AQUMKA0F9QEGCioKBvcBBwctBwb5AQgELwQI+QEJATIBCfsBRP0BQ/0BQv8BQf8B"
|
||||
"QIECP4ACQIACQf4BQ/wBRPsBRvoBR/gBSPcBSvYBS/QBTPMBTvIBTvIBT/ABUPABUe4BUu4BUu4B"
|
||||
"U+0BU+wBVOwBVOwBVOwBVOwBVesBVesBVesBVesBVOwBVOwBVOwBVO0BU+0BU+0BUu4BUu8BUe8B"
|
||||
"UPEBT/EBTvIBTvMBTPUBS/UBSvcBSfcBSPkBRvsBRP0BQ/4BQf8BQIECP4ACQIACQf4BQv4BQ/wB"
|
||||
"RPsBCQEyAQn6AQgELwQI+AEHBy0GB/cBBgoqCgb2AQUMKA0F9AEEECUPBPMBBBIiEwPxAQMWHhYD"
|
||||
"8AECGRoZA+4BAh0VHQLsAQIhDiIB6wEBVAHpAQFWAecBAVgB5QEBWgHAAgEA");
|
||||
ok(match, "Figure does not match.\n");
|
||||
ID2D1TransformedGeometry_Release(transformed_geometry);
|
||||
ID2D1PathGeometry_Release(geometry);
|
||||
|
||||
ID2D1SolidColorBrush_Release(brush);
|
||||
|
|
Loading…
Reference in New Issue