gecko-dev/gfx/cairo/wince-fixes.patch

65 lines
2.2 KiB
Diff

diff --git a/gfx/cairo/cairo/src/cairo-win32-private.h b/gfx/cairo/cairo/src/cairo-win32-private.h
--- a/gfx/cairo/cairo/src/cairo-win32-private.h
+++ b/gfx/cairo/cairo/src/cairo-win32-private.h
@@ -194,4 +194,22 @@
cairo_bool_t
_cairo_win32_scaled_font_is_bitmap (cairo_scaled_font_t *scaled_font);
+#ifdef WINCE
+
+// These are the required stubs for windows mobile
+#define ETO_GLYPH_INDEX 0
+#define ETO_PDY 0
+#define HALFTONE COLORONCOLOR
+#define GM_ADVANCED 2
+#define MWT_IDENTITY 1
+
+inline int SetGraphicsMode(HDC hdc, int iMode) {return 1;}
+inline int GetGraphicsMode(HDC hdc) {return 1;} /*GM_COMPATIBLE*/
+inline void GdiFlush() {}
+inline BOOL SetWorldTransform(HDC hdc, CONST XFORM *lpXform) { return FALSE; }
+inline BOOL GetWorldTransform(HDC hdc, LPXFORM lpXform ) { return FALSE; }
+inline BOOL ModifyWorldTransform(HDC hdc, CONST XFORM * lpxf, DWORD mode) { return 1; }
+
+#endif
+
#endif /* CAIRO_WIN32_PRIVATE_H */
diff --git a/gfx/cairo/cairo/src/cairo-win32-surface.c b/gfx/cairo/cairo/src/cairo-win32-surface.c
--- a/gfx/cairo/cairo/src/cairo-win32-surface.c
+++ b/gfx/cairo/cairo/src/cairo-win32-surface.c
@@ -1591,8 +1591,25 @@
return _cairo_error (CAIRO_STATUS_NO_MEMORY);
/* AND the new region into our DC */
+
+#ifndef WINCE
if (ExtSelectClipRgn (surface->dc, gdi_region, RGN_AND) == ERROR)
status = _cairo_win32_print_gdi_error ("_cairo_win32_surface_set_clip_region");
+#else
+ // The ExtSelectClipRgn function combines the specified
+ // region with the current clipping region using the
+ // specified mode. Here we do similar using basic
+ // functions available on WINCE.
+ {
+ HRGN currentClip, newClip;
+ GetClipRgn(surface->dc, &currentClip);
+
+ if (CombineRgn(newClip, currentClip, gdi_region, RGN_AND) != ERROR) {
+ SelectClipRgn(surface->dc, newClip);
+ DeleteObject(newClip);
+ }
+ }
+#endif
DeleteObject (gdi_region);
}
@@ -1629,7 +1646,7 @@
cairo_scaled_font_t *scaled_font,
int *remaining_glyphs)
{
-#if CAIRO_HAS_WIN32_FONT
+#if defined(CAIRO_HAS_WIN32_FONT) && !defined(WINCE)
cairo_win32_surface_t *dst = surface;
WORD glyph_buf_stack[STACK_GLYPH_SIZE];