2005-06-04 07:03:29 +00:00
|
|
|
--- ../../../../../cairo-cvs/dist/cairo-0.5.0/src/cairo-win32-surface.c 2005-05-11 19:59:13.000000000 -0700
|
|
|
|
+++ cairo/src/cairo-win32-surface.c 2005-06-01 22:25:37.000000000 -0700
|
|
|
|
@@ -512,6 +512,38 @@
|
|
|
|
cairo_surface_destroy ((cairo_surface_t *)local);
|
2005-04-25 23:55:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
+// AlphaBlend is not available or useable on older versions of Win32
|
|
|
|
+
|
|
|
|
+/* for compatibility with VC++ 5 */
|
|
|
|
+#if !defined(AC_SRC_OVER)
|
|
|
|
+#define AC_SRC_OVER 0x00
|
|
|
|
+#define AC_SRC_ALPHA 0x01
|
|
|
|
+#pragma pack(1)
|
|
|
|
+typedef struct {
|
|
|
|
+ BYTE BlendOp;
|
|
|
|
+ BYTE BlendFlags;
|
|
|
|
+ BYTE SourceConstantAlpha;
|
|
|
|
+ BYTE AlphaFormat;
|
|
|
|
+}BLENDFUNCTION;
|
|
|
|
+#pragma pack()
|
|
|
|
+#endif
|
|
|
|
+
|
|
|
|
+typedef BOOL (WINAPI *ALPHABLENDPROC)(
|
|
|
|
+ HDC hdcDest,
|
|
|
|
+ int nXOriginDest,
|
|
|
|
+ int nYOriginDest,
|
|
|
|
+ int nWidthDest,
|
|
|
|
+ int hHeightDest,
|
|
|
|
+ HDC hdcSrc,
|
|
|
|
+ int nXOriginSrc,
|
|
|
|
+ int nYOriginSrc,
|
|
|
|
+ int nWidthSrc,
|
|
|
|
+ int nHeightSrc,
|
|
|
|
+ BLENDFUNCTION blendFunction);
|
|
|
|
+
|
|
|
|
+static unsigned gAlphaBlendChecked = FALSE;
|
|
|
|
+static ALPHABLENDPROC gAlphaBlend;
|
|
|
|
+
|
|
|
|
static cairo_int_status_t
|
|
|
|
_cairo_win32_surface_composite (cairo_operator_t operator,
|
|
|
|
cairo_pattern_t *pattern,
|
2005-06-04 07:03:29 +00:00
|
|
|
@@ -533,6 +565,21 @@
|
2005-04-25 23:55:56 +00:00
|
|
|
int integer_transform;
|
|
|
|
int itx, ity;
|
|
|
|
|
|
|
|
+ if (!gAlphaBlendChecked) {
|
2005-06-04 07:03:29 +00:00
|
|
|
+ OSVERSIONINFO os;
|
2005-04-25 23:55:56 +00:00
|
|
|
+
|
2005-06-04 07:03:29 +00:00
|
|
|
+ os.dwOSVersionInfoSize = sizeof(os);
|
|
|
|
+ GetVersionEx(&os);
|
|
|
|
+ // If running on Win98, disable using AlphaBlend()
|
|
|
|
+ // to avoid Win98 AlphaBlend() bug
|
|
|
|
+ if (VER_PLATFORM_WIN32_WINDOWS != os.dwPlatformId ||
|
|
|
|
+ os.dwMajorVersion != 4 || os.dwMinorVersion != 10) {
|
|
|
|
+ gAlphaBlend = (ALPHABLENDPROC)GetProcAddress(LoadLibrary("msimg32"),
|
|
|
|
+ "AlphaBlend");
|
|
|
|
+ }
|
|
|
|
+ gAlphaBlendChecked = PR_TRUE;
|
2005-04-25 23:55:56 +00:00
|
|
|
+ }
|
|
|
|
+
|
|
|
|
if (pattern->type != CAIRO_PATTERN_SURFACE ||
|
|
|
|
pattern->extend != CAIRO_EXTEND_NONE)
|
|
|
|
return CAIRO_INT_STATUS_UNSUPPORTED;
|
2005-06-04 07:03:29 +00:00
|
|
|
@@ -587,7 +634,10 @@
|
2005-04-25 23:55:56 +00:00
|
|
|
blend_function.SourceConstantAlpha = alpha;
|
|
|
|
blend_function.AlphaFormat = src->format == CAIRO_FORMAT_ARGB32 ? AC_SRC_ALPHA : 0;
|
|
|
|
|
|
|
|
- if (!AlphaBlend (dst->dc,
|
|
|
|
+ if (!gAlphaBlend)
|
|
|
|
+ return CAIRO_INT_STATUS_UNSUPPORTED;
|
|
|
|
+
|
|
|
|
+ if (!gAlphaBlend(dst->dc,
|
|
|
|
dst_x, dst_y,
|
|
|
|
width, height,
|
|
|
|
src->dc,
|