Tue, 06 Jan 2015 21:39:09 +0100
Conditionally force memory storage according to privacy.thirdparty.isolate;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.
michael@0 | 1 | diff --git a/gfx/cairo/cairo/src/cairo-rename.h b/gfx/cairo/cairo/src/cairo-rename.h |
michael@0 | 2 | --- a/gfx/cairo/cairo/src/cairo-rename.h |
michael@0 | 3 | +++ b/gfx/cairo/cairo/src/cairo-rename.h |
michael@0 | 4 | @@ -335,16 +335,17 @@ |
michael@0 | 5 | #define cairo_win32_font_face_create_for_logfontw_hfont _moz_cairo_win32_font_face_create_for_logfontw_hfont |
michael@0 | 6 | #define cairo_win32_printing_surface_create _moz_cairo_win32_printing_surface_create |
michael@0 | 7 | #define cairo_win32_scaled_font_done_font _moz_cairo_win32_scaled_font_done_font |
michael@0 | 8 | #define cairo_win32_scaled_font_get_device_to_logical _moz_cairo_win32_scaled_font_get_device_to_logical |
michael@0 | 9 | #define cairo_win32_scaled_font_get_logical_to_device _moz_cairo_win32_scaled_font_get_logical_to_device |
michael@0 | 10 | #define cairo_win32_scaled_font_get_metrics_factor _moz_cairo_win32_scaled_font_get_metrics_factor |
michael@0 | 11 | #define cairo_win32_scaled_font_select_font _moz_cairo_win32_scaled_font_select_font |
michael@0 | 12 | #define cairo_win32_surface_create _moz_cairo_win32_surface_create |
michael@0 | 13 | +#define cairo_win32_surface_create_with_d3dsurface9 _moz_cairo_win32_surface_create_with_d3dsurface9 |
michael@0 | 14 | #define cairo_win32_surface_create_with_ddb _moz_cairo_win32_surface_create_with_ddb |
michael@0 | 15 | #define cairo_win32_surface_create_with_dib _moz_cairo_win32_surface_create_with_dib |
michael@0 | 16 | #define cairo_win32_surface_get_dc _moz_cairo_win32_surface_get_dc |
michael@0 | 17 | #define cairo_win32_surface_get_image _moz_cairo_win32_surface_get_image |
michael@0 | 18 | #define cairo_xcb_surface_create _moz_cairo_xcb_surface_create |
michael@0 | 19 | #define cairo_xcb_surface_create_for_bitmap _moz_cairo_xcb_surface_create_for_bitmap |
michael@0 | 20 | #define cairo_xcb_surface_create_with_xrender_format _moz_cairo_xcb_surface_create_with_xrender_format |
michael@0 | 21 | #define cairo_xcb_surface_set_size _moz_cairo_xcb_surface_set_size |
michael@0 | 22 | diff --git a/gfx/cairo/cairo/src/cairo-win32-printing-surface.c b/gfx/cairo/cairo/src/cairo-win32-printing-surface.c |
michael@0 | 23 | --- a/gfx/cairo/cairo/src/cairo-win32-printing-surface.c |
michael@0 | 24 | +++ b/gfx/cairo/cairo/src/cairo-win32-printing-surface.c |
michael@0 | 25 | @@ -1852,16 +1852,17 @@ cairo_win32_printing_surface_create (HDC |
michael@0 | 26 | } |
michael@0 | 27 | |
michael@0 | 28 | _cairo_surface_clipper_init (&surface->clipper, |
michael@0 | 29 | _cairo_win32_printing_surface_clipper_intersect_clip_path); |
michael@0 | 30 | |
michael@0 | 31 | surface->image = NULL; |
michael@0 | 32 | surface->format = CAIRO_FORMAT_RGB24; |
michael@0 | 33 | surface->content = CAIRO_CONTENT_COLOR_ALPHA; |
michael@0 | 34 | + surface->d3d9surface = NULL; |
michael@0 | 35 | |
michael@0 | 36 | surface->dc = hdc; |
michael@0 | 37 | surface->bitmap = NULL; |
michael@0 | 38 | surface->is_dib = FALSE; |
michael@0 | 39 | surface->saved_dc_bitmap = NULL; |
michael@0 | 40 | surface->brush = NULL; |
michael@0 | 41 | surface->old_brush = NULL; |
michael@0 | 42 | surface->font_subsets = _cairo_scaled_font_subsets_create_scaled (); |
michael@0 | 43 | diff --git a/gfx/cairo/cairo/src/cairo-win32-private.h b/gfx/cairo/cairo/src/cairo-win32-private.h |
michael@0 | 44 | --- a/gfx/cairo/cairo/src/cairo-win32-private.h |
michael@0 | 45 | +++ b/gfx/cairo/cairo/src/cairo-win32-private.h |
michael@0 | 46 | @@ -54,16 +54,18 @@ CAIRO_BEGIN_DECLS |
michael@0 | 47 | |
michael@0 | 48 | typedef struct _cairo_win32_surface { |
michael@0 | 49 | cairo_surface_t base; |
michael@0 | 50 | |
michael@0 | 51 | cairo_format_t format; |
michael@0 | 52 | |
michael@0 | 53 | HDC dc; |
michael@0 | 54 | |
michael@0 | 55 | + struct IDirect3DSurface9 *d3d9surface; |
michael@0 | 56 | + |
michael@0 | 57 | /* We create off-screen surfaces as DIBs or DDBs, based on what we created |
michael@0 | 58 | * originally*/ |
michael@0 | 59 | HBITMAP bitmap; |
michael@0 | 60 | cairo_bool_t is_dib; |
michael@0 | 61 | |
michael@0 | 62 | /* Used to save the initial 1x1 monochrome bitmap for the DC to |
michael@0 | 63 | * select back into the DC before deleting the DC and our |
michael@0 | 64 | * bitmap. For Windows XP, this doesn't seem to be necessary |
michael@0 | 65 | diff --git a/gfx/cairo/cairo/src/cairo-win32-surface.c b/gfx/cairo/cairo/src/cairo-win32-surface.c |
michael@0 | 66 | --- a/gfx/cairo/cairo/src/cairo-win32-surface.c |
michael@0 | 67 | +++ b/gfx/cairo/cairo/src/cairo-win32-surface.c |
michael@0 | 68 | @@ -54,16 +54,17 @@ |
michael@0 | 69 | #include "cairo-win32-private.h" |
michael@0 | 70 | #include "cairo-scaled-font-subsets-private.h" |
michael@0 | 71 | #include "cairo-surface-fallback-private.h" |
michael@0 | 72 | #include "cairo-surface-clipper-private.h" |
michael@0 | 73 | #include "cairo-gstate-private.h" |
michael@0 | 74 | #include "cairo-private.h" |
michael@0 | 75 | #include <wchar.h> |
michael@0 | 76 | #include <windows.h> |
michael@0 | 77 | +#include <d3d9.h> |
michael@0 | 78 | |
michael@0 | 79 | #if defined(__MINGW32__) && !defined(ETO_PDY) |
michael@0 | 80 | # define ETO_PDY 0x2000 |
michael@0 | 81 | #endif |
michael@0 | 82 | |
michael@0 | 83 | #undef DEBUG_COMPOSITE |
michael@0 | 84 | |
michael@0 | 85 | /* for older SDKs */ |
michael@0 | 86 | @@ -384,16 +385,17 @@ static cairo_surface_t * |
michael@0 | 87 | |
michael@0 | 88 | surface->image = cairo_image_surface_create_for_data (bits, format, |
michael@0 | 89 | width, height, rowstride); |
michael@0 | 90 | status = surface->image->status; |
michael@0 | 91 | if (status) |
michael@0 | 92 | goto FAIL; |
michael@0 | 93 | |
michael@0 | 94 | surface->format = format; |
michael@0 | 95 | + surface->d3d9surface = NULL; |
michael@0 | 96 | |
michael@0 | 97 | surface->clip_rect.x = 0; |
michael@0 | 98 | surface->clip_rect.y = 0; |
michael@0 | 99 | surface->clip_rect.width = width; |
michael@0 | 100 | surface->clip_rect.height = height; |
michael@0 | 101 | |
michael@0 | 102 | surface->initial_clip_rgn = NULL; |
michael@0 | 103 | surface->had_simple_clip = FALSE; |
michael@0 | 104 | @@ -481,26 +483,73 @@ cairo_status_t |
michael@0 | 105 | if (surface->bitmap) { |
michael@0 | 106 | SelectObject (surface->dc, surface->saved_dc_bitmap); |
michael@0 | 107 | DeleteObject (surface->bitmap); |
michael@0 | 108 | DeleteDC (surface->dc); |
michael@0 | 109 | } else { |
michael@0 | 110 | _cairo_win32_restore_initial_clip (surface); |
michael@0 | 111 | } |
michael@0 | 112 | |
michael@0 | 113 | + if (surface->d3d9surface) { |
michael@0 | 114 | + IDirect3DSurface9_ReleaseDC (surface->d3d9surface, surface->dc); |
michael@0 | 115 | + IDirect3DSurface9_Release (surface->d3d9surface); |
michael@0 | 116 | + } |
michael@0 | 117 | + |
michael@0 | 118 | if (surface->initial_clip_rgn) |
michael@0 | 119 | DeleteObject (surface->initial_clip_rgn); |
michael@0 | 120 | |
michael@0 | 121 | if (surface->font_subsets != NULL) |
michael@0 | 122 | _cairo_scaled_font_subsets_destroy (surface->font_subsets); |
michael@0 | 123 | |
michael@0 | 124 | return CAIRO_STATUS_SUCCESS; |
michael@0 | 125 | } |
michael@0 | 126 | |
michael@0 | 127 | static cairo_status_t |
michael@0 | 128 | +_cairo_win32_surface_d3d9_lock_rect (cairo_win32_surface_t *surface, |
michael@0 | 129 | + int x, |
michael@0 | 130 | + int y, |
michael@0 | 131 | + int width, |
michael@0 | 132 | + int height, |
michael@0 | 133 | + cairo_image_surface_t **local_out) |
michael@0 | 134 | +{ |
michael@0 | 135 | + cairo_image_surface_t *local; |
michael@0 | 136 | + cairo_int_status_t status; |
michael@0 | 137 | + |
michael@0 | 138 | + RECT rectin = { x, y, x+width, y+height }; |
michael@0 | 139 | + D3DLOCKED_RECT rectout; |
michael@0 | 140 | + HRESULT hr; |
michael@0 | 141 | + hr = IDirect3DSurface9_ReleaseDC (surface->d3d9surface, surface->dc); |
michael@0 | 142 | + hr = IDirect3DSurface9_LockRect (surface->d3d9surface, |
michael@0 | 143 | + &rectout, &rectin, 0); |
michael@0 | 144 | + surface->dc = 0; // Don't use the DC when this is locked! |
michael@0 | 145 | + if (hr) { |
michael@0 | 146 | + IDirect3DSurface9_GetDC (surface->d3d9surface, &surface->dc); |
michael@0 | 147 | + return CAIRO_INT_STATUS_UNSUPPORTED; |
michael@0 | 148 | + } |
michael@0 | 149 | + local = cairo_image_surface_create_for_data (rectout.pBits, |
michael@0 | 150 | + surface->format, |
michael@0 | 151 | + width, height, |
michael@0 | 152 | + rectout.Pitch); |
michael@0 | 153 | + if (local == NULL) { |
michael@0 | 154 | + IDirect3DSurface9_UnlockRect (surface->d3d9surface); |
michael@0 | 155 | + IDirect3DSurface9_GetDC (surface->d3d9surface, &surface->dc); |
michael@0 | 156 | + return CAIRO_INT_STATUS_UNSUPPORTED; |
michael@0 | 157 | + } |
michael@0 | 158 | + if (local->base.status) { |
michael@0 | 159 | + IDirect3DSurface9_UnlockRect (surface->d3d9surface); |
michael@0 | 160 | + IDirect3DSurface9_GetDC (surface->d3d9surface, &surface->dc); |
michael@0 | 161 | + return local->base.status; |
michael@0 | 162 | + } |
michael@0 | 163 | + |
michael@0 | 164 | + *local_out = local; |
michael@0 | 165 | + |
michael@0 | 166 | + return CAIRO_STATUS_SUCCESS; |
michael@0 | 167 | +} |
michael@0 | 168 | + |
michael@0 | 169 | +static cairo_status_t |
michael@0 | 170 | _cairo_win32_surface_get_subimage (cairo_win32_surface_t *surface, |
michael@0 | 171 | int x, |
michael@0 | 172 | int y, |
michael@0 | 173 | int width, |
michael@0 | 174 | int height, |
michael@0 | 175 | cairo_win32_surface_t **local_out) |
michael@0 | 176 | { |
michael@0 | 177 | cairo_win32_surface_t *local; |
michael@0 | 178 | @@ -599,17 +648,16 @@ static void |
michael@0 | 179 | } |
michael@0 | 180 | |
michael@0 | 181 | static cairo_status_t |
michael@0 | 182 | _cairo_win32_surface_acquire_source_image (void *abstract_surface, |
michael@0 | 183 | cairo_image_surface_t **image_out, |
michael@0 | 184 | void **image_extra) |
michael@0 | 185 | { |
michael@0 | 186 | cairo_win32_surface_t *surface = abstract_surface; |
michael@0 | 187 | - cairo_win32_surface_t *local; |
michael@0 | 188 | cairo_status_t status; |
michael@0 | 189 | |
michael@0 | 190 | if (!surface->image && !surface->is_dib && surface->bitmap && |
michael@0 | 191 | (surface->flags & CAIRO_WIN32_SURFACE_CAN_CONVERT_TO_DIB) != 0) |
michael@0 | 192 | { |
michael@0 | 193 | /* This is a DDB, and we're being asked to use it as a source for |
michael@0 | 194 | * something that we couldn't support natively. So turn it into |
michael@0 | 195 | * a DIB, so that we have an equivalent image surface, as long |
michael@0 | 196 | @@ -619,69 +667,109 @@ static cairo_status_t |
michael@0 | 197 | } |
michael@0 | 198 | |
michael@0 | 199 | if (surface->image) { |
michael@0 | 200 | *image_out = (cairo_image_surface_t *)surface->image; |
michael@0 | 201 | *image_extra = NULL; |
michael@0 | 202 | return CAIRO_STATUS_SUCCESS; |
michael@0 | 203 | } |
michael@0 | 204 | |
michael@0 | 205 | - status = _cairo_win32_surface_get_subimage (abstract_surface, 0, 0, |
michael@0 | 206 | - surface->extents.width, |
michael@0 | 207 | - surface->extents.height, &local); |
michael@0 | 208 | - if (status) |
michael@0 | 209 | - return status; |
michael@0 | 210 | - |
michael@0 | 211 | - *image_out = (cairo_image_surface_t *)local->image; |
michael@0 | 212 | - *image_extra = local; |
michael@0 | 213 | + if (surface->d3d9surface) { |
michael@0 | 214 | + cairo_image_surface_t *local; |
michael@0 | 215 | + status = _cairo_win32_surface_d3d9_lock_rect (abstract_surface, 0, 0, |
michael@0 | 216 | + surface->extents.width, |
michael@0 | 217 | + surface->extents.height, &local); |
michael@0 | 218 | + if (status) |
michael@0 | 219 | + return status; |
michael@0 | 220 | + |
michael@0 | 221 | + *image_out = local; |
michael@0 | 222 | + *image_extra = surface; |
michael@0 | 223 | + } else { |
michael@0 | 224 | + cairo_win32_surface_t *local; |
michael@0 | 225 | + status = _cairo_win32_surface_get_subimage (abstract_surface, 0, 0, |
michael@0 | 226 | + surface->extents.width, |
michael@0 | 227 | + surface->extents.height, &local); |
michael@0 | 228 | + if (status) |
michael@0 | 229 | + return status; |
michael@0 | 230 | + |
michael@0 | 231 | + *image_out = (cairo_image_surface_t *)local->image; |
michael@0 | 232 | + *image_extra = local; |
michael@0 | 233 | + } |
michael@0 | 234 | + // image_extra is always of type cairo_win32_surface_t. For d3d9surface it points |
michael@0 | 235 | + // to the original surface to get back the d3d9surface and properly unlock. |
michael@0 | 236 | + |
michael@0 | 237 | return CAIRO_STATUS_SUCCESS; |
michael@0 | 238 | } |
michael@0 | 239 | |
michael@0 | 240 | static void |
michael@0 | 241 | _cairo_win32_surface_release_source_image (void *abstract_surface, |
michael@0 | 242 | cairo_image_surface_t *image, |
michael@0 | 243 | void *image_extra) |
michael@0 | 244 | { |
michael@0 | 245 | + cairo_win32_surface_t *surface = abstract_surface; |
michael@0 | 246 | cairo_win32_surface_t *local = image_extra; |
michael@0 | 247 | |
michael@0 | 248 | - if (local) |
michael@0 | 249 | + if (local && local->d3d9surface) { |
michael@0 | 250 | + IDirect3DSurface9_UnlockRect (local->d3d9surface); |
michael@0 | 251 | + IDirect3DSurface9_GetDC (local->d3d9surface, &local->dc); |
michael@0 | 252 | + cairo_surface_destroy ((cairo_surface_t *)image); |
michael@0 | 253 | + } else { |
michael@0 | 254 | cairo_surface_destroy ((cairo_surface_t *)local); |
michael@0 | 255 | + } |
michael@0 | 256 | } |
michael@0 | 257 | |
michael@0 | 258 | static cairo_status_t |
michael@0 | 259 | _cairo_win32_surface_acquire_dest_image (void *abstract_surface, |
michael@0 | 260 | cairo_rectangle_int_t *interest_rect, |
michael@0 | 261 | cairo_image_surface_t **image_out, |
michael@0 | 262 | cairo_rectangle_int_t *image_rect, |
michael@0 | 263 | void **image_extra) |
michael@0 | 264 | { |
michael@0 | 265 | cairo_win32_surface_t *surface = abstract_surface; |
michael@0 | 266 | - cairo_win32_surface_t *local = NULL; |
michael@0 | 267 | cairo_status_t status; |
michael@0 | 268 | |
michael@0 | 269 | if (surface->image) { |
michael@0 | 270 | GdiFlush(); |
michael@0 | 271 | |
michael@0 | 272 | *image_out = (cairo_image_surface_t *) surface->image; |
michael@0 | 273 | *image_extra = NULL; |
michael@0 | 274 | *image_rect = surface->extents; |
michael@0 | 275 | return CAIRO_STATUS_SUCCESS; |
michael@0 | 276 | } |
michael@0 | 277 | |
michael@0 | 278 | - status = _cairo_win32_surface_get_subimage (abstract_surface, |
michael@0 | 279 | + if (surface->d3d9surface) { |
michael@0 | 280 | + cairo_image_surface_t *local = NULL; |
michael@0 | 281 | + status = _cairo_win32_surface_d3d9_lock_rect (abstract_surface, |
michael@0 | 282 | interest_rect->x, |
michael@0 | 283 | interest_rect->y, |
michael@0 | 284 | interest_rect->width, |
michael@0 | 285 | - interest_rect->height, |
michael@0 | 286 | - &local); |
michael@0 | 287 | - if (status) |
michael@0 | 288 | - return status; |
michael@0 | 289 | - |
michael@0 | 290 | - *image_out = (cairo_image_surface_t *) local->image; |
michael@0 | 291 | - *image_extra = local; |
michael@0 | 292 | + interest_rect->height, &local); |
michael@0 | 293 | + |
michael@0 | 294 | + if (status) |
michael@0 | 295 | + return status; |
michael@0 | 296 | + |
michael@0 | 297 | + *image_out = local; |
michael@0 | 298 | + *image_extra = surface; |
michael@0 | 299 | + } else { |
michael@0 | 300 | + cairo_win32_surface_t *local = NULL; |
michael@0 | 301 | + status = _cairo_win32_surface_get_subimage (abstract_surface, |
michael@0 | 302 | + interest_rect->x, |
michael@0 | 303 | + interest_rect->y, |
michael@0 | 304 | + interest_rect->width, |
michael@0 | 305 | + interest_rect->height, &local); |
michael@0 | 306 | + |
michael@0 | 307 | + if (status) |
michael@0 | 308 | + return status; |
michael@0 | 309 | + |
michael@0 | 310 | + *image_out = (cairo_image_surface_t *) local->image; |
michael@0 | 311 | + *image_extra = local; |
michael@0 | 312 | + } |
michael@0 | 313 | + // image_extra is always of type cairo_win32_surface_t. For d3d9surface it points |
michael@0 | 314 | + // to the original surface to get back the d3d9surface and properly unlock. |
michael@0 | 315 | + |
michael@0 | 316 | *image_rect = *interest_rect; |
michael@0 | 317 | return CAIRO_STATUS_SUCCESS; |
michael@0 | 318 | } |
michael@0 | 319 | |
michael@0 | 320 | static void |
michael@0 | 321 | _cairo_win32_surface_release_dest_image (void *abstract_surface, |
michael@0 | 322 | cairo_rectangle_int_t *interest_rect, |
michael@0 | 323 | cairo_image_surface_t *image, |
michael@0 | 324 | @@ -689,29 +777,37 @@ static void |
michael@0 | 325 | void *image_extra) |
michael@0 | 326 | { |
michael@0 | 327 | cairo_win32_surface_t *surface = abstract_surface; |
michael@0 | 328 | cairo_win32_surface_t *local = image_extra; |
michael@0 | 329 | |
michael@0 | 330 | if (!local) |
michael@0 | 331 | return; |
michael@0 | 332 | |
michael@0 | 333 | - /* clear any clip that's currently set on the surface |
michael@0 | 334 | - so that we can blit uninhibited. */ |
michael@0 | 335 | - _cairo_win32_surface_set_clip_region (surface, NULL); |
michael@0 | 336 | - |
michael@0 | 337 | - if (!BitBlt (surface->dc, |
michael@0 | 338 | - image_rect->x, image_rect->y, |
michael@0 | 339 | - image_rect->width, image_rect->height, |
michael@0 | 340 | - local->dc, |
michael@0 | 341 | - 0, 0, |
michael@0 | 342 | - SRCCOPY)) |
michael@0 | 343 | - _cairo_win32_print_gdi_error ("_cairo_win32_surface_release_dest_image"); |
michael@0 | 344 | - |
michael@0 | 345 | - cairo_surface_destroy ((cairo_surface_t *)local); |
michael@0 | 346 | + if (local->d3d9surface) { |
michael@0 | 347 | + IDirect3DSurface9_UnlockRect (local->d3d9surface); |
michael@0 | 348 | + IDirect3DSurface9_GetDC (local->d3d9surface, &local->dc); |
michael@0 | 349 | + cairo_surface_destroy ((cairo_surface_t *)image); |
michael@0 | 350 | + } else { |
michael@0 | 351 | + |
michael@0 | 352 | + /* clear any clip that's currently set on the surface |
michael@0 | 353 | + so that we can blit uninhibited. */ |
michael@0 | 354 | + _cairo_win32_surface_set_clip_region (surface, NULL); |
michael@0 | 355 | + |
michael@0 | 356 | + if (!BitBlt (surface->dc, |
michael@0 | 357 | + image_rect->x, image_rect->y, |
michael@0 | 358 | + image_rect->width, image_rect->height, |
michael@0 | 359 | + local->dc, |
michael@0 | 360 | + 0, 0, |
michael@0 | 361 | + SRCCOPY)) |
michael@0 | 362 | + _cairo_win32_print_gdi_error ("_cairo_win32_surface_release_dest_image"); |
michael@0 | 363 | + |
michael@0 | 364 | + cairo_surface_destroy ((cairo_surface_t *)local); |
michael@0 | 365 | + } |
michael@0 | 366 | + |
michael@0 | 367 | } |
michael@0 | 368 | |
michael@0 | 369 | cairo_status_t |
michael@0 | 370 | _cairo_win32_surface_set_clip_region (void *abstract_surface, |
michael@0 | 371 | cairo_region_t *region) |
michael@0 | 372 | { |
michael@0 | 373 | cairo_win32_surface_t *surface = abstract_surface; |
michael@0 | 374 | cairo_status_t status = CAIRO_STATUS_SUCCESS; |
michael@0 | 375 | @@ -1849,16 +1945,17 @@ cairo_win32_surface_create_internal (HDC |
michael@0 | 376 | free (surface); |
michael@0 | 377 | return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_NO_MEMORY)); |
michael@0 | 378 | } |
michael@0 | 379 | |
michael@0 | 380 | surface->clip_region = NULL; |
michael@0 | 381 | surface->image = NULL; |
michael@0 | 382 | surface->format = format; |
michael@0 | 383 | |
michael@0 | 384 | + surface->d3d9surface = NULL; |
michael@0 | 385 | surface->dc = hdc; |
michael@0 | 386 | surface->bitmap = NULL; |
michael@0 | 387 | surface->is_dib = FALSE; |
michael@0 | 388 | surface->saved_dc_bitmap = NULL; |
michael@0 | 389 | surface->brush = NULL; |
michael@0 | 390 | surface->old_brush = NULL; |
michael@0 | 391 | surface->font_subsets = NULL; |
michael@0 | 392 | |
michael@0 | 393 | @@ -2009,16 +2106,29 @@ cairo_win32_surface_create_with_ddb (HDC |
michael@0 | 394 | |
michael@0 | 395 | FINISH: |
michael@0 | 396 | if (screen_dc) |
michael@0 | 397 | ReleaseDC (NULL, screen_dc); |
michael@0 | 398 | |
michael@0 | 399 | return (cairo_surface_t*) new_surf; |
michael@0 | 400 | } |
michael@0 | 401 | |
michael@0 | 402 | +cairo_public cairo_surface_t * |
michael@0 | 403 | +cairo_win32_surface_create_with_d3dsurface9 (IDirect3DSurface9 *surface) |
michael@0 | 404 | +{ |
michael@0 | 405 | + HDC dc; |
michael@0 | 406 | + cairo_win32_surface_t *win_surface; |
michael@0 | 407 | + |
michael@0 | 408 | + IDirect3DSurface9_AddRef (surface); |
michael@0 | 409 | + IDirect3DSurface9_GetDC (surface, &dc); |
michael@0 | 410 | + win_surface = cairo_win32_surface_create_internal(dc, CAIRO_FORMAT_RGB24); |
michael@0 | 411 | + win_surface->d3d9surface = surface; |
michael@0 | 412 | + return (cairo_surface_t*) win_surface; |
michael@0 | 413 | + |
michael@0 | 414 | +} |
michael@0 | 415 | /** |
michael@0 | 416 | * _cairo_surface_is_win32: |
michael@0 | 417 | * @surface: a #cairo_surface_t |
michael@0 | 418 | * |
michael@0 | 419 | * Checks if a surface is a win32 surface. This will |
michael@0 | 420 | * return False if this is a win32 printing surface; use |
michael@0 | 421 | * _cairo_surface_is_win32_printing() to check for that. |
michael@0 | 422 | * |
michael@0 | 423 | diff --git a/gfx/cairo/cairo/src/cairo-win32.h b/gfx/cairo/cairo/src/cairo-win32.h |
michael@0 | 424 | --- a/gfx/cairo/cairo/src/cairo-win32.h |
michael@0 | 425 | +++ b/gfx/cairo/cairo/src/cairo-win32.h |
michael@0 | 426 | @@ -59,17 +59,16 @@ cairo_win32_surface_create_with_ddb (HDC hdc, |
michael@0 | 427 | cairo_format_t format, |
michael@0 | 428 | int width, |
michael@0 | 429 | int height); |
michael@0 | 430 | |
michael@0 | 431 | cairo_public cairo_surface_t * |
michael@0 | 432 | cairo_win32_surface_create_with_dib (cairo_format_t format, |
michael@0 | 433 | int width, |
michael@0 | 434 | int height); |
michael@0 | 435 | - |
michael@0 | 436 | cairo_public HDC |
michael@0 | 437 | cairo_win32_surface_get_dc (cairo_surface_t *surface); |
michael@0 | 438 | |
michael@0 | 439 | cairo_public HDC |
michael@0 | 440 | cairo_win32_get_dc_with_clip (cairo_t *cr); |
michael@0 | 441 | |
michael@0 | 442 | cairo_public cairo_surface_t * |
michael@0 | 443 | cairo_win32_surface_get_image (cairo_surface_t *surface); |
michael@0 | 444 | @@ -143,16 +142,21 @@ cairo_dwrite_scaled_font_get_force_GDI_classic(cairo_scaled_font_t *dwrite_scale |
michael@0 | 445 | void |
michael@0 | 446 | cairo_dwrite_set_cleartype_params(FLOAT gamma, FLOAT contrast, FLOAT level, int geometry, int mode); |
michael@0 | 447 | |
michael@0 | 448 | int |
michael@0 | 449 | cairo_dwrite_get_cleartype_rendering_mode(); |
michael@0 | 450 | |
michael@0 | 451 | #endif /* CAIRO_HAS_DWRITE_FONT */ |
michael@0 | 452 | |
michael@0 | 453 | +struct IDirect3DSurface9; |
michael@0 | 454 | +cairo_public cairo_surface_t * |
michael@0 | 455 | +cairo_win32_surface_create_with_d3dsurface9 (struct IDirect3DSurface9 *surface); |
michael@0 | 456 | + |
michael@0 | 457 | + |
michael@0 | 458 | #if CAIRO_HAS_D2D_SURFACE |
michael@0 | 459 | |
michael@0 | 460 | struct _cairo_device |
michael@0 | 461 | { |
michael@0 | 462 | int type; |
michael@0 | 463 | int refcount; |
michael@0 | 464 | }; |
michael@0 | 465 |