[cairo-commit] src/cairo-qt-surface.cpp
Chris Wilson
ickle at kemper.freedesktop.org
Fri Jan 15 06:29:56 PST 2010
src/cairo-qt-surface.cpp | 33 ++++++++++++++++++++++++++-------
1 file changed, 26 insertions(+), 7 deletions(-)
New commits:
commit 6950b233e41a0c926465728c37f9bc5512f2844b
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Fri Jan 15 14:25:16 2010 +0000
qt: Make flush() robust.
Hanno Meyer-Thurow reported in
http://bugs.freedesktop.org/show_bug.cgi?id=26063
[PATCH] various fixes to cairo-qt
a few issues related to _cairo_qt_surface_flush() where firefox was
crashing after being built to use cairo-qt.
This is an amalgam of those patches that hopefully address the issue.
diff --git a/src/cairo-qt-surface.cpp b/src/cairo-qt-surface.cpp
index 902251d..29ca0be 100644
--- a/src/cairo-qt-surface.cpp
+++ b/src/cairo-qt-surface.cpp
@@ -485,7 +485,7 @@ _cairo_qt_surface_finish (void *abstract_surface)
if (qs->image || qs->pixmap)
delete qs->p;
else
- qs->p->restore();
+ qs->p->restore ();
if (qs->image_equiv)
cairo_surface_destroy (qs->image_equiv);
@@ -1553,11 +1553,30 @@ static cairo_status_t
_cairo_qt_surface_flush (void *abstract_surface)
{
cairo_qt_surface_t *qs = (cairo_qt_surface_t *) abstract_surface;
-
- QPaintDevice * dev = qs->p->device();
- qs->p->end();
- qs->p->begin(dev);
-
+
+ if (qs->p == NULL)
+ return CAIRO_STATUS_SUCCESS;
+
+ if (qs->image || qs->pixmap) {
+ qs->p->end ();
+ qs->p->begin (qs->p->device ());
+ } else {
+ qs->p->restore ();
+ }
+
+ return CAIRO_STATUS_SUCCESS;
+}
+
+static cairo_status_t
+_cairo_qt_surface_mark_dirty (void *abstract_surface,
+ int x, int y,
+ int width, int height)
+{
+ cairo_qt_surface_t *qs = (cairo_qt_surface_t *) abstract_surface;
+
+ if (qs->p && !(qs->image || qs->pixmap))
+ qs->p->save ();
+
return CAIRO_STATUS_SUCCESS;
}
@@ -1586,7 +1605,7 @@ static const cairo_surface_backend_t cairo_qt_surface_backend = {
NULL, /* old_show_glyphs */
NULL, /* get_font_options */
_cairo_qt_surface_flush,
- NULL, /* mark_dirty_rectangle */
+ _cairo_qt_surface_mark_dirty,
NULL, /* scaled_font_fini */
NULL, /* scaled_glyph_fini */
More information about the cairo-commit
mailing list