gecko-dev/gfx/cairo/cairo-win32-expose-dc-and-dib.patch
2006-02-10 23:55:27 +00:00

98 lines
3.1 KiB
Diff

Index: cairo/src/cairo-win32-surface.c
===================================================================
--- cairo.orig/src/cairo-win32-surface.c 2006-02-07 17:14:24.921875000 -0800
+++ cairo/src/cairo-win32-surface.c 2006-02-10 11:23:50.406250000 -0800
@@ -330,9 +330,9 @@
* be created (probably because of lack of memory)
**/
cairo_surface_t *
-_cairo_win32_surface_create_dib (cairo_format_t format,
- int width,
- int height)
+cairo_win32_surface_create_dib (cairo_format_t format,
+ int width,
+ int height)
{
return _cairo_win32_surface_create_for_dc (NULL, format, width, height);
}
@@ -1007,6 +1007,31 @@
return surface->backend == &cairo_win32_surface_backend;
}
+/**
+ * cairo_win32_surface_get_dc
+ * @surface: a #cairo_surface_t
+ *
+ * Returns the HDC associated with this surface, or NULL if none.
+ * Also returns NULL if the surface is not a win32 surface.
+ *
+ * Return value: HDC or NULL if no HDC available.
+ **/
+HDC
+cairo_win32_surface_get_dc (cairo_surface_t *surface)
+{
+ cairo_win32_surface_t *winsurf;
+
+ if (surface == NULL)
+ return NULL;
+
+ if (!_cairo_surface_is_win32(surface))
+ return NULL;
+
+ winsurf = (cairo_win32_surface_t *) surface;
+
+ return winsurf->dc;
+}
+
static const cairo_surface_backend_t cairo_win32_surface_backend = {
_cairo_win32_surface_create_similar,
_cairo_win32_surface_finish,
Index: cairo/src/cairo-win32.h
===================================================================
--- cairo.orig/src/cairo-win32.h 2006-02-07 17:14:24.922875000 -0800
+++ cairo/src/cairo-win32.h 2006-02-10 11:23:24.171875000 -0800
@@ -47,6 +47,14 @@
cairo_public cairo_surface_t *
cairo_win32_surface_create (HDC hdc);
+cairo_public cairo_surface_t *
+cairo_win32_surface_create_dib (cairo_format_t format,
+ int width,
+ int height);
+
+cairo_public HDC
+cairo_win32_surface_get_dc (cairo_surface_t *surface);
+
cairo_public cairo_font_face_t *
cairo_win32_font_face_create_for_logfontw (LOGFONTW *logfont);
Index: cairo/src/cairo-win32-font.c
===================================================================
--- cairo.orig/src/cairo-win32-font.c 2006-02-10 11:15:07.968750000 -0800
+++ cairo/src/cairo-win32-font.c 2006-02-10 11:22:36.296875000 -0800
@@ -1159,7 +1159,7 @@
cairo_surface_pattern_t mask;
RECT r;
- tmp_surface = (cairo_win32_surface_t *)_cairo_win32_surface_create_dib (CAIRO_FORMAT_ARGB32, width, height);
+ tmp_surface = (cairo_win32_surface_t *)cairo_win32_surface_create_dib (CAIRO_FORMAT_ARGB32, width, height);
if (tmp_surface->base.status)
return CAIRO_STATUS_NO_MEMORY;
Index: cairo/src/cairo-win32-private.h
===================================================================
--- cairo.orig/src/cairo-win32-private.h 2006-02-07 17:06:46.734375000 -0800
+++ cairo/src/cairo-win32-private.h 2006-02-10 11:19:42.890625000 -0800
@@ -70,11 +70,6 @@
cairo_status_t
_cairo_win32_print_gdi_error (const char *context);
-cairo_surface_t *
-_cairo_win32_surface_create_dib (cairo_format_t format,
- int width,
- int height);
-
cairo_bool_t
_cairo_surface_is_win32 (cairo_surface_t *surface);