Bug 461860 - windows mobile fixes in gfx r+sr=vlad

This commit is contained in:
Doug Turner 2008-12-03 08:42:03 -05:00
parent 6697fd8c44
commit 3bd692715b
8 changed files with 133 additions and 3 deletions

View File

@ -34,6 +34,8 @@ win32-ddb-dib.patch: fix for bug 455513; not upstream yet pending feebdack
qpainter-type.patch: add SURFACE_TYPE_QPAINTER to cairo.h
wince-fixes.patch: stubs out win32 functions we use but are not supported on win32. Also implements ExtSelectClipRgn in terms of other functions available on wince.
==== pixman patches ====
endian.patch: include cairo-platform.h for endian macros

View File

@ -194,4 +194,22 @@ _cairo_win32_scaled_font_is_type1 (cairo_scaled_font_t *scaled_font);
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 */

View File

@ -1591,8 +1591,25 @@ _cairo_win32_surface_set_clip_region (void *abstract_surface,
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_win32_surface_show_glyphs (void *surface,
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];

View File

@ -0,0 +1,64 @@
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];

View File

@ -78,7 +78,9 @@ static nsSystemFontsGTK2 *gSystemFonts = nsnull;
#include "gfxWindowsSurface.h"
#include "gfxPDFSurface.h"
static nsSystemFontsWin *gSystemFonts = nsnull;
#ifndef WINCE
#include <usp10.h>
#endif
#elif defined(XP_OS2)
#include "nsSystemFontsOS2.h"
#include "gfxPDFSurface.h"
@ -129,7 +131,7 @@ nsThebesDeviceContext::nsThebesDeviceContext()
mWidgetSurfaceCache.Init();
#ifdef XP_WIN
#if defined(XP_WIN) && !defined(WINCE)
SCRIPT_DIGITSUBSTITUTE sds;
ScriptRecordDigitSubstitution(LOCALE_USER_DEFAULT, &sds);
#endif

View File

@ -693,7 +693,12 @@ nsThebesImage::Draw(gfxContext* aContext,
PRBool
nsThebesImage::ShouldUseImageSurfaces()
{
#ifdef XP_WIN
#if defined(WINCE)
// There is no test on windows mobile to check for Gui resources.
// Allocate, until we run out of memory.
return PR_TRUE;
#elif defined(XP_WIN)
static const DWORD kGDIObjectsHighWaterMark = 7000;
// at 7000 GDI objects, stop allocating normal images to make sure

View File

@ -90,4 +90,22 @@ private:
HWND mWnd;
};
#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 /* GFX_WINDOWSSURFACE_H */

View File

@ -886,6 +886,7 @@ gfxWindowsPlatform::FindFontEntry(const nsAString& aName, const gfxFontStyle& aF
cmsHPROFILE
gfxWindowsPlatform::GetPlatformCMSOutputProfile()
{
#ifndef WINCE
WCHAR str[1024+1];
DWORD size = 1024;
@ -902,6 +903,9 @@ gfxWindowsPlatform::GetPlatformCMSOutputProfile()
NS_ConvertUTF16toUTF8(str).get());
#endif
return profile;
#else
return nsnull;
#endif
}
PRBool