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 | CAIRO_FORMAT_A8 not allowed for cairo-qt image backend |
michael@0 | 2 | diff --git a/gfx/cairo/cairo/src/cairo-qt-surface.cpp b/gfx/cairo/cairo/src/cairo-qt-surface.cpp |
michael@0 | 3 | --- a/gfx/cairo/cairo/src/cairo-qt-surface.cpp |
michael@0 | 4 | +++ b/gfx/cairo/cairo/src/cairo-qt-surface.cpp |
michael@0 | 5 | @@ -459,17 +459,17 @@ _cairo_qt_surface_finish (void *abstract |
michael@0 | 6 | { |
michael@0 | 7 | cairo_qt_surface_t *qs = (cairo_qt_surface_t *) abstract_surface; |
michael@0 | 8 | |
michael@0 | 9 | D(fprintf(stderr, "q[%p] finish\n", abstract_surface)); |
michael@0 | 10 | |
michael@0 | 11 | /* Only delete p if we created it */ |
michael@0 | 12 | if (qs->image || qs->pixmap) |
michael@0 | 13 | delete qs->p; |
michael@0 | 14 | - else |
michael@0 | 15 | + else if (qs->p) |
michael@0 | 16 | qs->p->restore (); |
michael@0 | 17 | |
michael@0 | 18 | if (qs->image_equiv) |
michael@0 | 19 | cairo_surface_destroy (qs->image_equiv); |
michael@0 | 20 | |
michael@0 | 21 | _cairo_surface_clipper_reset (&qs->clipper); |
michael@0 | 22 | |
michael@0 | 23 | if (qs->image) |
michael@0 | 24 | @@ -736,17 +736,17 @@ _cairo_qt_surface_set_clip_region (cairo |
michael@0 | 25 | } |
michael@0 | 26 | |
michael@0 | 27 | static cairo_int_status_t |
michael@0 | 28 | _cairo_qt_surface_set_clip (cairo_qt_surface_t *qs, |
michael@0 | 29 | cairo_clip_t *clip) |
michael@0 | 30 | { |
michael@0 | 31 | cairo_int_status_t status; |
michael@0 | 32 | |
michael@0 | 33 | - D(fprintf(stderr, "q[%p] intersect_clip_path %s\n", abstract_surface, path ? "(path)" : "(clear)")); |
michael@0 | 34 | + D(fprintf(stderr, "q[%p] intersect_clip_path %s\n", qs, clip ? "(path)" : "(clear)")); |
michael@0 | 35 | |
michael@0 | 36 | if (clip == NULL) { |
michael@0 | 37 | _cairo_surface_clipper_reset (&qs->clipper); |
michael@0 | 38 | // How the clip path is reset depends on whether we own p or not |
michael@0 | 39 | if (qs->pixmap || qs->image) { |
michael@0 | 40 | // we own p |
michael@0 | 41 | qs->p->setClipping (false); |
michael@0 | 42 | } else { |
michael@0 | 43 | @@ -1605,16 +1605,25 @@ cairo_qt_surface_create_with_qimage (cai |
michael@0 | 44 | |
michael@0 | 45 | _cairo_surface_init (&qs->base, |
michael@0 | 46 | &cairo_qt_surface_backend, |
michael@0 | 47 | _cairo_content_from_format (format)); |
michael@0 | 48 | |
michael@0 | 49 | _cairo_surface_clipper_init (&qs->clipper, |
michael@0 | 50 | _cairo_qt_surface_clipper_intersect_clip_path); |
michael@0 | 51 | |
michael@0 | 52 | + if (CAIRO_FORMAT_A8 == format) { |
michael@0 | 53 | + qs->image = NULL; |
michael@0 | 54 | + qs->image_equiv = cairo_image_surface_create(format, |
michael@0 | 55 | + width, height); |
michael@0 | 56 | + qs->p = NULL; |
michael@0 | 57 | + qs->supports_porter_duff = false; |
michael@0 | 58 | + qs->window = QRect(0, 0, width, height); |
michael@0 | 59 | + return &qs->base; |
michael@0 | 60 | + } |
michael@0 | 61 | |
michael@0 | 62 | QImage *image = new QImage (width, height, |
michael@0 | 63 | _qimage_format_from_cairo_format (format)); |
michael@0 | 64 | |
michael@0 | 65 | qs->image = image; |
michael@0 | 66 | |
michael@0 | 67 | if (!image->isNull()) { |
michael@0 | 68 | qs->p = new QPainter(image); |