From 361240657c2d668a719cdf4e999867025c8caeb1 Mon Sep 17 00:00:00 2001 From: Luca Bacci Date: Thu, 16 Jan 2025 14:19:55 +0100 Subject: [PATCH] Win32: Do not load msimg32.dll at runtime This commit drops support for Windows 98 --- src/win32/cairo-win32-device.c | 15 --------------- src/win32/cairo-win32-gdi-compositor.c | 13 ++++--------- src/win32/cairo-win32-private.h | 16 ---------------- 3 files changed, 4 insertions(+), 40 deletions(-) diff --git a/src/win32/cairo-win32-device.c b/src/win32/cairo-win32-device.c index 42f013392..575239352 100644 --- a/src/win32/cairo-win32-device.c +++ b/src/win32/cairo-win32-device.c @@ -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); diff --git a/src/win32/cairo-win32-gdi-compositor.c b/src/win32/cairo-win32-gdi-compositor.c index bc1f69e70..08e5abfb3 100644 --- a/src/win32/cairo-win32-gdi-compositor.c +++ b/src/win32/cairo-win32-gdi-compositor.c @@ -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 diff --git a/src/win32/cairo-win32-private.h b/src/win32/cairo-win32-private.h index 6af09c0e1..594e2b085 100644 --- a/src/win32/cairo-win32-private.h +++ b/src/win32/cairo-win32-private.h @@ -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)