[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - vcl/unx

Caolán McNamara caolanm at redhat.com
Mon May 14 13:44:24 UTC 2018


 vcl/unx/generic/gdi/cairotextrender.cxx    |   22 +++++++++++++++++++++-
 vcl/unx/generic/gdi/x11cairotextrender.cxx |   16 +---------------
 2 files changed, 22 insertions(+), 16 deletions(-)

New commits:
commit 17e7bd5e17e3393c44c76b7c69d47ad112e5efa6
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri May 4 17:15:37 2018 +0100

    Resolves: tdf#117413 char doubling appearing under X with gtk3
    
    like happened on gtk2, so make the rhbz#1283420 bodge happen for XLIB surfaces,
    regardless of the backend
    
    Change-Id: Ic51679a71523e8cc76832858411b102d915638cf
    Reviewed-on: https://gerrit.libreoffice.org/53897
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Jean-Baptiste Faure <jbfaure at libreoffice.org>
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>

diff --git a/vcl/unx/generic/gdi/cairotextrender.cxx b/vcl/unx/generic/gdi/cairotextrender.cxx
index e4314ea41243..38d9e775b89d 100644
--- a/vcl/unx/generic/gdi/cairotextrender.cxx
+++ b/vcl/unx/generic/gdi/cairotextrender.cxx
@@ -156,6 +156,26 @@ namespace
     }
 }
 
+namespace
+{
+    cairo_t* syncCairoContext(cairo_t* cr)
+    {
+        //rhbz#1283420 tdf#117413 bodge to force a read from the underlying surface which has
+        //the side effect of making the mysterious xrender related problem go away
+        cairo_surface_t *target = cairo_get_target(cr);
+        if (cairo_surface_get_type(target) == CAIRO_SURFACE_TYPE_XLIB)
+        {
+            cairo_surface_t *throw_away = cairo_surface_create_similar(target, cairo_surface_get_content(target), 1, 1);
+            cairo_t *force_read_cr = cairo_create(throw_away);
+            cairo_set_source_surface(force_read_cr, target, 0, 0);
+            cairo_paint(force_read_cr);
+            cairo_destroy(force_read_cr);
+            cairo_surface_destroy(throw_away);
+        }
+        return cr;
+    }
+}
+
 void CairoTextRender::DrawTextLayout(const CommonSalLayout& rLayout)
 {
     const FreetypeFont& rFont = *rLayout.getFreetypeFont();
@@ -196,7 +216,7 @@ void CairoTextRender::DrawTextLayout(const CommonSalLayout& rLayout)
      * least change the SalFrame etc impls to dtor the SalGraphics *before* the
      * destruction of the windows they reference
     */
-    cairo_t *cr = getCairoContext();
+    cairo_t *cr = syncCairoContext(getCairoContext());
     if (!cr)
     {
         SAL_WARN("vcl", "no cairo context for text");
diff --git a/vcl/unx/generic/gdi/x11cairotextrender.cxx b/vcl/unx/generic/gdi/x11cairotextrender.cxx
index 105d0a0392bd..8960bd1c6bb1 100644
--- a/vcl/unx/generic/gdi/x11cairotextrender.cxx
+++ b/vcl/unx/generic/gdi/x11cairotextrender.cxx
@@ -36,21 +36,7 @@ GlyphCache& X11CairoTextRender::getPlatformGlyphCache()
 
 cairo_t* X11CairoTextRender::getCairoContext()
 {
-    cairo_t *cr = mrParent.getCairoContext();
-
-    //rhbz#1283420 bodge to force a read from the underlying surface which has
-    //the side effect of making the mysterious xrender related problem go away
-    {
-        cairo_surface_t *target = cairo_get_target(cr);
-        cairo_surface_t *throw_away = cairo_surface_create_similar(target, cairo_surface_get_content(target), 1, 1);
-        cairo_t *force_read_cr = cairo_create(throw_away);
-        cairo_set_source_surface(force_read_cr, target, 0, 0);
-        cairo_paint(force_read_cr);
-        cairo_destroy(force_read_cr);
-        cairo_surface_destroy(throw_away);
-    }
-
-    return cr;
+    return mrParent.getCairoContext();
 }
 
 void X11CairoTextRender::getSurfaceOffset( double& nDX, double& nDY )


More information about the Libreoffice-commits mailing list