|
1 diff --git a/gfx/cairo/cairo/src/cairo-win32-surface.c b/gfx/cairo/cairo/src/cairo-win32-surface.c |
|
2 --- a/gfx/cairo/cairo/src/cairo-win32-surface.c |
|
3 +++ b/gfx/cairo/cairo/src/cairo-win32-surface.c |
|
4 @@ -1709,40 +1709,23 @@ _cairo_win32_surface_show_glyphs (void |
|
5 } |
|
6 #else |
|
7 return CAIRO_INT_STATUS_UNSUPPORTED; |
|
8 #endif |
|
9 } |
|
10 |
|
11 #undef STACK_GLYPH_SIZE |
|
12 |
|
13 -/** |
|
14 - * cairo_win32_surface_create: |
|
15 - * @hdc: the DC to create a surface for |
|
16 - * |
|
17 - * Creates a cairo surface that targets the given DC. The DC will be |
|
18 - * queried for its initial clip extents, and this will be used as the |
|
19 - * size of the cairo surface. The resulting surface will always be of |
|
20 - * format %CAIRO_FORMAT_RGB24; should you need another surface format, |
|
21 - * you will need to create one through |
|
22 - * cairo_win32_surface_create_with_dib(). |
|
23 - * |
|
24 - * Return value: the newly created surface |
|
25 - **/ |
|
26 -cairo_surface_t * |
|
27 -cairo_win32_surface_create (HDC hdc) |
|
28 +static cairo_surface_t * |
|
29 +cairo_win32_surface_create_internal (HDC hdc, cairo_format_t format) |
|
30 { |
|
31 cairo_win32_surface_t *surface; |
|
32 |
|
33 - cairo_format_t format; |
|
34 RECT rect; |
|
35 |
|
36 - /* Assume that everything coming in as a HDC is RGB24 */ |
|
37 - format = CAIRO_FORMAT_RGB24; |
|
38 - |
|
39 surface = malloc (sizeof (cairo_win32_surface_t)); |
|
40 if (surface == NULL) |
|
41 return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_NO_MEMORY)); |
|
42 |
|
43 if (_cairo_win32_save_initial_clip (hdc, surface) != CAIRO_STATUS_SUCCESS) { |
|
44 free (surface); |
|
45 return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_NO_MEMORY)); |
|
46 } |
|
47 @@ -1765,17 +1748,58 @@ cairo_win32_surface_create (HDC hdc) |
|
48 surface->extents.width = rect.right - rect.left; |
|
49 surface->extents.height = rect.bottom - rect.top; |
|
50 |
|
51 surface->flags = _cairo_win32_flags_for_dc (surface->dc); |
|
52 |
|
53 _cairo_surface_init (&surface->base, &cairo_win32_surface_backend, |
|
54 _cairo_content_from_format (format)); |
|
55 |
|
56 - return (cairo_surface_t *)surface; |
|
57 + return &surface->base; |
|
58 +} |
|
59 + |
|
60 +/** |
|
61 + * cairo_win32_surface_create: |
|
62 + * @hdc: the DC to create a surface for |
|
63 + * |
|
64 + * Creates a cairo surface that targets the given DC. The DC will be |
|
65 + * queried for its initial clip extents, and this will be used as the |
|
66 + * size of the cairo surface. The resulting surface will always be of |
|
67 + * format %CAIRO_FORMAT_RGB24; should you need another surface format, |
|
68 + * you will need to create one through |
|
69 + * cairo_win32_surface_create_with_dib() or call |
|
70 + * cairo_win32_surface_create_with_alpha. |
|
71 + * |
|
72 + * Return value: the newly created surface |
|
73 + **/ |
|
74 +cairo_surface_t * |
|
75 +cairo_win32_surface_create (HDC hdc) |
|
76 +{ |
|
77 + /* Assume everything comes in as RGB24 */ |
|
78 + return cairo_win32_surface_create_internal(hdc, CAIRO_FORMAT_RGB24); |
|
79 +} |
|
80 + |
|
81 +/** |
|
82 + * cairo_win32_surface_create_with_alpha: |
|
83 + * @hdc: the DC to create a surface for |
|
84 + * |
|
85 + * Creates a cairo surface that targets the given DC. The DC will be |
|
86 + * queried for its initial clip extents, and this will be used as the |
|
87 + * size of the cairo surface. The resulting surface will always be of |
|
88 + * format %CAIRO_FORMAT_ARGB32; this format is used when drawing into |
|
89 + * transparent windows. |
|
90 + * |
|
91 + * Return value: the newly created surface |
|
92 + * |
|
93 + * Since: 1.10 |
|
94 + **/ |
|
95 +cairo_surface_t * |
|
96 +cairo_win32_surface_create_with_alpha (HDC hdc) |
|
97 +{ |
|
98 + return cairo_win32_surface_create_internal(hdc, CAIRO_FORMAT_ARGB32); |
|
99 } |
|
100 |
|
101 /** |
|
102 * cairo_win32_surface_create_with_dib: |
|
103 * @format: format of pixels in the surface to create |
|
104 * @width: width of the surface, in pixels |
|
105 * @height: height of the surface, in pixels |
|
106 * |
|
107 diff --git a/gfx/cairo/cairo/src/cairo-win32.h b/gfx/cairo/cairo/src/cairo-win32.h |
|
108 --- a/gfx/cairo/cairo/src/cairo-win32.h |
|
109 +++ b/gfx/cairo/cairo/src/cairo-win32.h |
|
110 @@ -44,16 +44,19 @@ |
|
111 #include <windows.h> |
|
112 |
|
113 CAIRO_BEGIN_DECLS |
|
114 |
|
115 cairo_public cairo_surface_t * |
|
116 cairo_win32_surface_create (HDC hdc); |
|
117 |
|
118 cairo_public cairo_surface_t * |
|
119 +cairo_win32_surface_create_with_alpha (HDC hdc); |
|
120 + |
|
121 +cairo_public cairo_surface_t * |
|
122 cairo_win32_printing_surface_create (HDC hdc); |
|
123 |
|
124 cairo_public cairo_surface_t * |
|
125 cairo_win32_surface_create_with_ddb (HDC hdc, |
|
126 cairo_format_t format, |
|
127 int width, |
|
128 int height); |
|
129 |