michael@0: diff --git a/gfx/cairo/cairo/src/cairo-win32-surface.c b/gfx/cairo/cairo/src/cairo-win32-surface.c michael@0: --- a/gfx/cairo/cairo/src/cairo-win32-surface.c michael@0: +++ b/gfx/cairo/cairo/src/cairo-win32-surface.c michael@0: @@ -1709,40 +1709,23 @@ _cairo_win32_surface_show_glyphs (void michael@0: } michael@0: #else michael@0: return CAIRO_INT_STATUS_UNSUPPORTED; michael@0: #endif michael@0: } michael@0: michael@0: #undef STACK_GLYPH_SIZE michael@0: michael@0: -/** michael@0: - * cairo_win32_surface_create: michael@0: - * @hdc: the DC to create a surface for michael@0: - * michael@0: - * Creates a cairo surface that targets the given DC. The DC will be michael@0: - * queried for its initial clip extents, and this will be used as the michael@0: - * size of the cairo surface. The resulting surface will always be of michael@0: - * format %CAIRO_FORMAT_RGB24; should you need another surface format, michael@0: - * you will need to create one through michael@0: - * cairo_win32_surface_create_with_dib(). michael@0: - * michael@0: - * Return value: the newly created surface michael@0: - **/ michael@0: -cairo_surface_t * michael@0: -cairo_win32_surface_create (HDC hdc) michael@0: +static cairo_surface_t * michael@0: +cairo_win32_surface_create_internal (HDC hdc, cairo_format_t format) michael@0: { michael@0: cairo_win32_surface_t *surface; michael@0: michael@0: - cairo_format_t format; michael@0: RECT rect; michael@0: michael@0: - /* Assume that everything coming in as a HDC is RGB24 */ michael@0: - format = CAIRO_FORMAT_RGB24; michael@0: - michael@0: surface = malloc (sizeof (cairo_win32_surface_t)); michael@0: if (surface == NULL) michael@0: return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_NO_MEMORY)); michael@0: michael@0: if (_cairo_win32_save_initial_clip (hdc, surface) != CAIRO_STATUS_SUCCESS) { michael@0: free (surface); michael@0: return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_NO_MEMORY)); michael@0: } michael@0: @@ -1765,17 +1748,58 @@ cairo_win32_surface_create (HDC hdc) michael@0: surface->extents.width = rect.right - rect.left; michael@0: surface->extents.height = rect.bottom - rect.top; michael@0: michael@0: surface->flags = _cairo_win32_flags_for_dc (surface->dc); michael@0: michael@0: _cairo_surface_init (&surface->base, &cairo_win32_surface_backend, michael@0: _cairo_content_from_format (format)); michael@0: michael@0: - return (cairo_surface_t *)surface; michael@0: + return &surface->base; michael@0: +} michael@0: + michael@0: +/** michael@0: + * cairo_win32_surface_create: michael@0: + * @hdc: the DC to create a surface for michael@0: + * michael@0: + * Creates a cairo surface that targets the given DC. The DC will be michael@0: + * queried for its initial clip extents, and this will be used as the michael@0: + * size of the cairo surface. The resulting surface will always be of michael@0: + * format %CAIRO_FORMAT_RGB24; should you need another surface format, michael@0: + * you will need to create one through michael@0: + * cairo_win32_surface_create_with_dib() or call michael@0: + * cairo_win32_surface_create_with_alpha. michael@0: + * michael@0: + * Return value: the newly created surface michael@0: + **/ michael@0: +cairo_surface_t * michael@0: +cairo_win32_surface_create (HDC hdc) michael@0: +{ michael@0: + /* Assume everything comes in as RGB24 */ michael@0: + return cairo_win32_surface_create_internal(hdc, CAIRO_FORMAT_RGB24); michael@0: +} michael@0: + michael@0: +/** michael@0: + * cairo_win32_surface_create_with_alpha: michael@0: + * @hdc: the DC to create a surface for michael@0: + * michael@0: + * Creates a cairo surface that targets the given DC. The DC will be michael@0: + * queried for its initial clip extents, and this will be used as the michael@0: + * size of the cairo surface. The resulting surface will always be of michael@0: + * format %CAIRO_FORMAT_ARGB32; this format is used when drawing into michael@0: + * transparent windows. michael@0: + * michael@0: + * Return value: the newly created surface michael@0: + * michael@0: + * Since: 1.10 michael@0: + **/ michael@0: +cairo_surface_t * michael@0: +cairo_win32_surface_create_with_alpha (HDC hdc) michael@0: +{ michael@0: + return cairo_win32_surface_create_internal(hdc, CAIRO_FORMAT_ARGB32); michael@0: } michael@0: michael@0: /** michael@0: * cairo_win32_surface_create_with_dib: michael@0: * @format: format of pixels in the surface to create michael@0: * @width: width of the surface, in pixels michael@0: * @height: height of the surface, in pixels michael@0: * michael@0: diff --git a/gfx/cairo/cairo/src/cairo-win32.h b/gfx/cairo/cairo/src/cairo-win32.h michael@0: --- a/gfx/cairo/cairo/src/cairo-win32.h michael@0: +++ b/gfx/cairo/cairo/src/cairo-win32.h michael@0: @@ -44,16 +44,19 @@ michael@0: #include michael@0: michael@0: CAIRO_BEGIN_DECLS michael@0: michael@0: cairo_public cairo_surface_t * michael@0: cairo_win32_surface_create (HDC hdc); michael@0: michael@0: cairo_public cairo_surface_t * michael@0: +cairo_win32_surface_create_with_alpha (HDC hdc); michael@0: + michael@0: +cairo_public cairo_surface_t * michael@0: cairo_win32_printing_surface_create (HDC hdc); michael@0: michael@0: cairo_public cairo_surface_t * michael@0: cairo_win32_surface_create_with_ddb (HDC hdc, michael@0: cairo_format_t format, michael@0: int width, michael@0: int height); michael@0: