gfx/cairo/win32-transparent-surface.patch

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/gfx/cairo/win32-transparent-surface.patch	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,129 @@
     1.4 +diff --git a/gfx/cairo/cairo/src/cairo-win32-surface.c b/gfx/cairo/cairo/src/cairo-win32-surface.c
     1.5 +--- a/gfx/cairo/cairo/src/cairo-win32-surface.c
     1.6 ++++ b/gfx/cairo/cairo/src/cairo-win32-surface.c
     1.7 +@@ -1709,40 +1709,23 @@ _cairo_win32_surface_show_glyphs (void		
     1.8 +     }
     1.9 + #else
    1.10 +     return CAIRO_INT_STATUS_UNSUPPORTED;
    1.11 + #endif
    1.12 + }
    1.13 + 
    1.14 + #undef STACK_GLYPH_SIZE
    1.15 + 
    1.16 +-/**
    1.17 +- * cairo_win32_surface_create:
    1.18 +- * @hdc: the DC to create a surface for
    1.19 +- *
    1.20 +- * Creates a cairo surface that targets the given DC.  The DC will be
    1.21 +- * queried for its initial clip extents, and this will be used as the
    1.22 +- * size of the cairo surface.  The resulting surface will always be of
    1.23 +- * format %CAIRO_FORMAT_RGB24; should you need another surface format,
    1.24 +- * you will need to create one through
    1.25 +- * cairo_win32_surface_create_with_dib().
    1.26 +- *
    1.27 +- * Return value: the newly created surface
    1.28 +- **/
    1.29 +-cairo_surface_t *
    1.30 +-cairo_win32_surface_create (HDC hdc)
    1.31 ++static cairo_surface_t *
    1.32 ++cairo_win32_surface_create_internal (HDC hdc, cairo_format_t format)
    1.33 + {
    1.34 +     cairo_win32_surface_t *surface;
    1.35 + 
    1.36 +-    cairo_format_t format;
    1.37 +     RECT rect;
    1.38 + 
    1.39 +-    /* Assume that everything coming in as a HDC is RGB24 */
    1.40 +-    format = CAIRO_FORMAT_RGB24;
    1.41 +-
    1.42 +     surface = malloc (sizeof (cairo_win32_surface_t));
    1.43 +     if (surface == NULL)
    1.44 + 	return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_NO_MEMORY));
    1.45 + 
    1.46 +     if (_cairo_win32_save_initial_clip (hdc, surface) != CAIRO_STATUS_SUCCESS) {
    1.47 + 	free (surface);
    1.48 + 	return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_NO_MEMORY));
    1.49 +     }
    1.50 +@@ -1765,17 +1748,58 @@ cairo_win32_surface_create (HDC hdc)
    1.51 +     surface->extents.width = rect.right - rect.left;
    1.52 +     surface->extents.height = rect.bottom - rect.top;
    1.53 + 
    1.54 +     surface->flags = _cairo_win32_flags_for_dc (surface->dc);
    1.55 + 
    1.56 +     _cairo_surface_init (&surface->base, &cairo_win32_surface_backend,
    1.57 + 			 _cairo_content_from_format (format));
    1.58 + 
    1.59 +-    return (cairo_surface_t *)surface;
    1.60 ++    return &surface->base;
    1.61 ++}
    1.62 ++
    1.63 ++/**
    1.64 ++ * cairo_win32_surface_create:
    1.65 ++ * @hdc: the DC to create a surface for
    1.66 ++ *
    1.67 ++ * Creates a cairo surface that targets the given DC.  The DC will be
    1.68 ++ * queried for its initial clip extents, and this will be used as the
    1.69 ++ * size of the cairo surface.  The resulting surface will always be of
    1.70 ++ * format %CAIRO_FORMAT_RGB24; should you need another surface format,
    1.71 ++ * you will need to create one through
    1.72 ++ * cairo_win32_surface_create_with_dib() or call
    1.73 ++ * cairo_win32_surface_create_with_alpha.
    1.74 ++ *
    1.75 ++ * Return value: the newly created surface
    1.76 ++ **/
    1.77 ++cairo_surface_t *
    1.78 ++cairo_win32_surface_create (HDC hdc)
    1.79 ++{
    1.80 ++    /* Assume everything comes in as RGB24 */
    1.81 ++    return cairo_win32_surface_create_internal(hdc, CAIRO_FORMAT_RGB24);
    1.82 ++}
    1.83 ++
    1.84 ++/**
    1.85 ++ * cairo_win32_surface_create_with_alpha:
    1.86 ++ * @hdc: the DC to create a surface for
    1.87 ++ *
    1.88 ++ * Creates a cairo surface that targets the given DC.  The DC will be
    1.89 ++ * queried for its initial clip extents, and this will be used as the
    1.90 ++ * size of the cairo surface.  The resulting surface will always be of
    1.91 ++ * format %CAIRO_FORMAT_ARGB32; this format is used when drawing into
    1.92 ++ * transparent windows.
    1.93 ++ *
    1.94 ++ * Return value: the newly created surface
    1.95 ++ *
    1.96 ++ * Since: 1.10
    1.97 ++ **/
    1.98 ++cairo_surface_t *
    1.99 ++cairo_win32_surface_create_with_alpha (HDC hdc)
   1.100 ++{
   1.101 ++    return cairo_win32_surface_create_internal(hdc, CAIRO_FORMAT_ARGB32);
   1.102 + }
   1.103 + 
   1.104 + /**
   1.105 +  * cairo_win32_surface_create_with_dib:
   1.106 +  * @format: format of pixels in the surface to create
   1.107 +  * @width: width of the surface, in pixels
   1.108 +  * @height: height of the surface, in pixels
   1.109 +  *
   1.110 +diff --git a/gfx/cairo/cairo/src/cairo-win32.h b/gfx/cairo/cairo/src/cairo-win32.h
   1.111 +--- a/gfx/cairo/cairo/src/cairo-win32.h
   1.112 ++++ b/gfx/cairo/cairo/src/cairo-win32.h
   1.113 +@@ -44,16 +44,19 @@
   1.114 + #include <windows.h>
   1.115 + 
   1.116 + CAIRO_BEGIN_DECLS
   1.117 + 
   1.118 + cairo_public cairo_surface_t *
   1.119 + cairo_win32_surface_create (HDC hdc);
   1.120 + 
   1.121 + cairo_public cairo_surface_t *
   1.122 ++cairo_win32_surface_create_with_alpha (HDC hdc);
   1.123 ++
   1.124 ++cairo_public cairo_surface_t *
   1.125 + cairo_win32_printing_surface_create (HDC hdc);
   1.126 + 
   1.127 + cairo_public cairo_surface_t *
   1.128 + cairo_win32_surface_create_with_ddb (HDC hdc,
   1.129 +                                      cairo_format_t format,
   1.130 +                                      int width,
   1.131 +                                      int height);
   1.132 + 

mercurial