Win32: Do not load msimg32.dll at runtime

This commit drops support for Windows 98
This commit is contained in:
Luca Bacci 2025-01-16 14:19:55 +01:00
parent 613df92660
commit 361240657c
3 changed files with 4 additions and 40 deletions

View file

@ -90,18 +90,6 @@ D2D1_RENDER_TARGET_PROPERTIES props = D2D1::RenderTargetProperties(D2D1_RENDER_T
hr = m_pD2DFactory->CreateDCRenderTarget(&props, &device->d2d);
#endif
static void *
_cairo_win32_device_get_alpha_blend (cairo_win32_device_t *device)
{
void *func = NULL;
device->msimg32_dll = LoadLibraryW (L"msimg32");
if (device->msimg32_dll)
func = GetProcAddress (device->msimg32_dll, "AlphaBlend");
return func;
}
cairo_device_t *
_cairo_win32_device_get (void)
{
@ -118,9 +106,6 @@ _cairo_win32_device_get (void)
device->compositor = _cairo_win32_gdi_compositor_get ();
device->msimg32_dll = NULL;
device->alpha_blend = _cairo_win32_device_get_alpha_blend (device);
if (_cairo_atomic_ptr_cmpxchg ((cairo_atomic_intptr_t *)&__cairo_win32_device, NULL, device))
return cairo_device_reference(&device->base);

View file

@ -105,7 +105,6 @@ struct copy_box {
int tx, ty;
HDC dst, src;
BLENDFUNCTION bf;
cairo_win32_alpha_blend_func_t alpha_blend;
};
static cairo_bool_t copy_box (cairo_box_t *box, void *closure)
@ -131,9 +130,9 @@ static cairo_bool_t alpha_box (cairo_box_t *box, void *closure)
int height = _cairo_fixed_integer_part (box->p2.y - box->p1.y);
TRACE ((stderr, "%s\n", __FUNCTION__));
return cb->alpha_blend (cb->dst, x, y, width, height,
cb->src, x + cb->tx, y + cb->ty, width, height,
cb->bf);
return AlphaBlend (cb->dst, x, y, width, height,
cb->src, x + cb->tx, y + cb->ty, width, height,
cb->bf);
}
struct upload_box {
@ -382,7 +381,6 @@ alpha_blend_boxes (cairo_win32_display_surface_t *dst,
cb.bf.BlendFlags = 0;
cb.bf.SourceConstantAlpha = alpha;
cb.bf.AlphaFormat = (src->win32.format == CAIRO_FORMAT_ARGB32) ? AC_SRC_ALPHA : 0;
cb.alpha_blend = to_win32_device(dst->win32.base.device)->alpha_blend;
cb.tx += cb.limit.x;
cb.ty += cb.limit.y;
@ -397,10 +395,7 @@ alpha_blend_boxes (cairo_win32_display_surface_t *dst,
static cairo_bool_t
can_alpha_blend (cairo_win32_display_surface_t *dst)
{
if ((dst->win32.flags & CAIRO_WIN32_SURFACE_CAN_ALPHABLEND) == 0)
return FALSE;
return to_win32_device(dst->win32.base.device)->alpha_blend != NULL;
return (dst->win32.flags & CAIRO_WIN32_SURFACE_CAN_ALPHABLEND) != 0;
}
static cairo_status_t

View file

@ -168,26 +168,10 @@ typedef struct _cairo_win32_printing_surface {
} cairo_win32_printing_surface_t;
#define to_win32_printing_surface(S) ((cairo_win32_printing_surface_t *)(S))
typedef BOOL (WINAPI *cairo_win32_alpha_blend_func_t) (HDC hdcDest,
int nXOriginDest,
int nYOriginDest,
int nWidthDest,
int hHeightDest,
HDC hdcSrc,
int nXOriginSrc,
int nYOriginSrc,
int nWidthSrc,
int nHeightSrc,
BLENDFUNCTION blendFunction);
typedef struct _cairo_win32_device {
cairo_device_t base;
HMODULE msimg32_dll;
const cairo_compositor_t *compositor;
cairo_win32_alpha_blend_func_t alpha_blend;
} cairo_win32_device_t;
#define to_win32_device(D) ((cairo_win32_device_t *)(D))
#define to_win32_device_from_surface(S) to_win32_device(((cairo_surface_t *)(S))->device)