mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 670096 - cairo fails to compile on mingw with D2D and DWrite enabled r=cjones
This commit is contained in:
parent
cf52499e3b
commit
0d85d047f6
@ -52,7 +52,7 @@
|
||||
#include "cairo-list-private.h"
|
||||
|
||||
/* describes the type of the currently applied clip so that we can pop it */
|
||||
struct d2d_clip;
|
||||
struct d2d_clip_t;
|
||||
|
||||
#define MAX_OPERATORS CAIRO_OPERATOR_HSL_LUMINOSITY + 1
|
||||
|
||||
@ -114,7 +114,7 @@ struct _cairo_d2d_surface {
|
||||
cairo_format_t format;
|
||||
|
||||
cairo_clip_t clip;
|
||||
d2d_clip *d2d_clip;
|
||||
d2d_clip_t *d2d_clip;
|
||||
|
||||
|
||||
/** Mask layer used by surface_mask to push opacity masks */
|
||||
@ -162,10 +162,10 @@ struct _cairo_d2d_surface_entry
|
||||
};
|
||||
|
||||
typedef HRESULT (WINAPI*D2D1CreateFactoryFunc)(
|
||||
__in D2D1_FACTORY_TYPE factoryType,
|
||||
__in REFIID iid,
|
||||
__in_opt CONST D2D1_FACTORY_OPTIONS *pFactoryOptions,
|
||||
__out void **factory
|
||||
D2D1_FACTORY_TYPE factoryType,
|
||||
REFIID iid,
|
||||
CONST D2D1_FACTORY_OPTIONS *pFactoryOptions,
|
||||
void **factory
|
||||
);
|
||||
|
||||
typedef HRESULT (WINAPI*D3D10CreateDevice1Func)(
|
||||
|
@ -844,12 +844,12 @@ void cairo_d2d_present_backbuffer(cairo_surface_t *surface)
|
||||
}
|
||||
}
|
||||
|
||||
struct d2d_clip
|
||||
struct d2d_clip_t
|
||||
{
|
||||
enum clip_type {LAYER, AXIS_ALIGNED_CLIP};
|
||||
d2d_clip * const prev;
|
||||
d2d_clip_t * const prev;
|
||||
const enum clip_type type;
|
||||
d2d_clip(d2d_clip *prev, clip_type type) : prev(prev), type(type) { }
|
||||
d2d_clip_t(d2d_clip_t *prev, clip_type type) : prev(prev), type(type) { }
|
||||
};
|
||||
|
||||
static RefPtr<ID2D1PathGeometry>
|
||||
@ -889,7 +889,7 @@ push_clip (cairo_d2d_surface_t *d2dsurf, cairo_clip_path_t *clip_path)
|
||||
_cairo_fixed_to_float(box.p2.y)),
|
||||
mode);
|
||||
|
||||
d2dsurf->d2d_clip = new d2d_clip (d2dsurf->d2d_clip, d2d_clip::AXIS_ALIGNED_CLIP);
|
||||
d2dsurf->d2d_clip = new d2d_clip_t (d2dsurf->d2d_clip, d2d_clip_t::AXIS_ALIGNED_CLIP);
|
||||
} else {
|
||||
HRESULT hr;
|
||||
RefPtr<ID2D1PathGeometry> geom = _cairo_d2d_create_path_geometry_for_path (&clip_path->path,
|
||||
@ -914,7 +914,7 @@ push_clip (cairo_d2d_surface_t *d2dsurf, cairo_clip_path_t *clip_path)
|
||||
options),
|
||||
layer);
|
||||
|
||||
d2dsurf->d2d_clip = new d2d_clip(d2dsurf->d2d_clip, d2d_clip::LAYER);
|
||||
d2dsurf->d2d_clip = new d2d_clip_t(d2dsurf->d2d_clip, d2d_clip_t::LAYER);
|
||||
}
|
||||
if (!d2dsurf->d2d_clip)
|
||||
return _cairo_error(CAIRO_STATUS_NO_MEMORY);
|
||||
@ -924,12 +924,12 @@ push_clip (cairo_d2d_surface_t *d2dsurf, cairo_clip_path_t *clip_path)
|
||||
static void
|
||||
pop_clip (cairo_d2d_surface_t *d2dsurf)
|
||||
{
|
||||
d2d_clip *current_clip = d2dsurf->d2d_clip;
|
||||
d2d_clip_t *current_clip = d2dsurf->d2d_clip;
|
||||
|
||||
/* pop the clip from the render target */
|
||||
if (current_clip->type == d2d_clip::LAYER) {
|
||||
if (current_clip->type == d2d_clip_t::LAYER) {
|
||||
d2dsurf->rt->PopLayer();
|
||||
} else if (current_clip->type == d2d_clip::AXIS_ALIGNED_CLIP) {
|
||||
} else if (current_clip->type == d2d_clip_t::AXIS_ALIGNED_CLIP) {
|
||||
d2dsurf->rt->PopAxisAlignedClip();
|
||||
}
|
||||
|
||||
@ -2432,6 +2432,10 @@ _cairo_d2d_create_similar(void *surface,
|
||||
RefPtr<ID3D10Texture2D> texture;
|
||||
RefPtr<IDXGISurface> dxgiSurface;
|
||||
|
||||
D2D1_RENDER_TARGET_USAGE usage = (desc.MiscFlags & D3D10_RESOURCE_MISC_GDI_COMPATIBLE) ?
|
||||
D2D1_RENDER_TARGET_USAGE_GDI_COMPATIBLE
|
||||
: D2D1_RENDER_TARGET_USAGE_NONE;
|
||||
|
||||
hr = d2dsurf->device->mD3D10Device->CreateTexture2D(&desc, NULL, &texture);
|
||||
if (FAILED(hr)) {
|
||||
goto FAIL_CREATESIMILAR;
|
||||
@ -2445,10 +2449,6 @@ _cairo_d2d_create_similar(void *surface,
|
||||
goto FAIL_CREATESIMILAR;
|
||||
}
|
||||
|
||||
D2D1_RENDER_TARGET_USAGE usage = (desc.MiscFlags & D3D10_RESOURCE_MISC_GDI_COMPATIBLE) ?
|
||||
D2D1_RENDER_TARGET_USAGE_GDI_COMPATIBLE
|
||||
: D2D1_RENDER_TARGET_USAGE_NONE;
|
||||
|
||||
hr = sD2DFactory->CreateDxgiSurfaceRenderTarget(dxgiSurface,
|
||||
D2D1::RenderTargetProperties(D2D1_RENDER_TARGET_TYPE_DEFAULT,
|
||||
D2D1::PixelFormat(DXGI_FORMAT_UNKNOWN,
|
||||
@ -4480,6 +4480,7 @@ cairo_d2d_surface_create_for_handle(cairo_device_t *device, HANDLE handle, cairo
|
||||
D2D1_RENDER_TARGET_PROPERTIES props;
|
||||
DXGI_FORMAT format;
|
||||
DXGI_SURFACE_DESC desc;
|
||||
D2D1_ALPHA_MODE alpha = D2D1_ALPHA_MODE_PREMULTIPLIED;
|
||||
|
||||
hr = d2d_device->mD3D10Device->OpenSharedResource(handle,
|
||||
__uuidof(ID3D10Resource),
|
||||
@ -4498,7 +4499,6 @@ cairo_d2d_surface_create_for_handle(cairo_device_t *device, HANDLE handle, cairo
|
||||
dxgiSurface->GetDesc(&desc);
|
||||
format = desc.Format;
|
||||
|
||||
D2D1_ALPHA_MODE alpha = D2D1_ALPHA_MODE_PREMULTIPLIED;
|
||||
if (format == DXGI_FORMAT_B8G8R8A8_UNORM) {
|
||||
if (content == CAIRO_CONTENT_ALPHA) {
|
||||
status = CAIRO_STATUS_INVALID_CONTENT;
|
||||
|
@ -45,10 +45,10 @@
|
||||
#include <float.h>
|
||||
|
||||
typedef HRESULT (WINAPI*D2D1CreateFactoryFunc)(
|
||||
__in D2D1_FACTORY_TYPE factoryType,
|
||||
__in REFIID iid,
|
||||
__in_opt CONST D2D1_FACTORY_OPTIONS *pFactoryOptions,
|
||||
__out void **factory
|
||||
D2D1_FACTORY_TYPE factoryType,
|
||||
REFIID iid,
|
||||
CONST D2D1_FACTORY_OPTIONS *pFactoryOptions,
|
||||
void **factory
|
||||
);
|
||||
|
||||
#define CAIRO_INT_STATUS_SUCCESS (cairo_int_status_t)CAIRO_STATUS_SUCCESS
|
||||
@ -156,7 +156,7 @@ const cairo_font_face_backend_t _cairo_dwrite_font_face_backend = {
|
||||
|
||||
void _cairo_dwrite_scaled_font_fini(void *scaled_font);
|
||||
|
||||
cairo_warn cairo_int_status_t
|
||||
static cairo_warn cairo_int_status_t
|
||||
_cairo_dwrite_scaled_glyph_init(void *scaled_font,
|
||||
cairo_scaled_glyph_t *scaled_glyph,
|
||||
cairo_scaled_glyph_info_t info);
|
||||
@ -962,6 +962,15 @@ _cairo_dwrite_scaled_font_init_glyph_surface(cairo_dwrite_scaled_font_t *scaled_
|
||||
glyph.x = -x1;
|
||||
glyph.y = -y1;
|
||||
|
||||
DWRITE_GLYPH_RUN run;
|
||||
FLOAT advance = 0;
|
||||
UINT16 index = (UINT16)glyph.index;
|
||||
DWRITE_GLYPH_OFFSET offset;
|
||||
double x = glyph.x;
|
||||
double y = glyph.y;
|
||||
RECT area;
|
||||
DWRITE_MATRIX matrix;
|
||||
|
||||
surface = (cairo_win32_surface_t *)
|
||||
cairo_win32_surface_create_with_dib (CAIRO_FORMAT_RGB24, width, height);
|
||||
|
||||
@ -973,12 +982,6 @@ _cairo_dwrite_scaled_font_init_glyph_surface(cairo_dwrite_scaled_font_t *scaled_
|
||||
if (status)
|
||||
goto FAIL;
|
||||
|
||||
DWRITE_GLYPH_RUN run;
|
||||
FLOAT advance = 0;
|
||||
UINT16 index = (UINT16)glyph.index;
|
||||
DWRITE_GLYPH_OFFSET offset;
|
||||
double x = glyph.x;
|
||||
double y = glyph.y;
|
||||
/**
|
||||
* We transform by the inverse transformation here. This will put our glyph
|
||||
* locations in the space in which we draw. Which is later transformed by
|
||||
@ -991,7 +994,6 @@ _cairo_dwrite_scaled_font_init_glyph_surface(cairo_dwrite_scaled_font_t *scaled_
|
||||
/** Y-axis is inverted */
|
||||
offset.ascenderOffset = -(FLOAT)y;
|
||||
|
||||
RECT area;
|
||||
area.top = 0;
|
||||
area.bottom = height;
|
||||
area.left = 0;
|
||||
@ -1006,7 +1008,7 @@ _cairo_dwrite_scaled_font_init_glyph_surface(cairo_dwrite_scaled_font_t *scaled_
|
||||
run.isSideways = FALSE;
|
||||
run.glyphOffsets = &offset;
|
||||
|
||||
DWRITE_MATRIX matrix = _cairo_dwrite_matrix_from_matrix(&scaled_font->mat);
|
||||
matrix = _cairo_dwrite_matrix_from_matrix(&scaled_font->mat);
|
||||
|
||||
status = _dwrite_draw_glyphs_to_gdi_surface_gdi (surface, &matrix, &run,
|
||||
RGB(0,0,0), scaled_font, area);
|
||||
|
@ -34,13 +34,13 @@
|
||||
* Bas Schouten <bschouten@mozilla.com>
|
||||
*/
|
||||
#include <dwrite.h>
|
||||
#include <D2d1.h>
|
||||
#include <d2d1.h>
|
||||
|
||||
// DirectWrite is not available on all platforms.
|
||||
typedef HRESULT (WINAPI*DWriteCreateFactoryFunc)(
|
||||
__in DWRITE_FACTORY_TYPE factoryType,
|
||||
__in REFIID iid,
|
||||
__out IUnknown **factory
|
||||
DWRITE_FACTORY_TYPE factoryType,
|
||||
REFIID iid,
|
||||
IUnknown **factory
|
||||
);
|
||||
|
||||
/* cairo_scaled_font_t implementation */
|
||||
|
@ -74,9 +74,10 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
RefPtr<T> &operator =(const RefPtr<T> aPtr)
|
||||
template<typename U>
|
||||
RefPtr<T> &operator =(const RefPtr<U> aPtr)
|
||||
{
|
||||
assignPtr(aPtr.mPtr);
|
||||
assignPtr(aPtr);
|
||||
return *this;
|
||||
}
|
||||
|
||||
@ -117,7 +118,7 @@ public:
|
||||
return (mPtr ? true : false);
|
||||
}
|
||||
|
||||
operator T*()
|
||||
operator T*() const
|
||||
{
|
||||
return mPtr;
|
||||
}
|
||||
|
@ -149,7 +149,6 @@ struct _cairo_device
|
||||
int type;
|
||||
int refcount;
|
||||
};
|
||||
typedef struct _cairo_device cairo_device_t;
|
||||
|
||||
/**
|
||||
* Create a D2D device
|
||||
|
Loading…
Reference in New Issue
Block a user