27aea6
From dd53132119ca8640eea82bfaf26c85f4542ce8c2 Mon Sep 17 00:00:00 2001
27aea6
From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= <caolanm@redhat.com>
27aea6
Date: Thu, 12 Apr 2018 14:53:20 +0100
27aea6
Subject: [PATCH] Related: tdf#100925 background not getting set under X
27aea6
 sometimes
27aea6
27aea6
not sure why this is the case, but it is reminiscent of rhbz#1283420 which
27aea6
results in missing glyphs in some circumstances
27aea6
X11CairoTextRender::getCairoContext has a hack in it for that problem, whic
27aea6
forces a read from the underlying X Drawable before writing to it which seems
27aea6
to have the effect of syncing it up.
27aea6
27aea6
So, just before drawing the bg, draw a glyph on it to get it synced, and then
27aea6
overwrite it.
27aea6
27aea6
Change-Id: I2ffff7e8e989b91821869d8b75a59728ac513d1b
27aea6
Reviewed-on: https://gerrit.libreoffice.org/52819
27aea6
Tested-by: Jenkins <ci@libreoffice.org>
27aea6
Reviewed-by: Eike Rathke <erack@redhat.com>
27aea6
---
27aea6
 sc/source/ui/view/gridwin4.cxx | 7 ++++++-
27aea6
 1 file changed, 6 insertions(+), 1 deletion(-)
27aea6
27aea6
diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx
27aea6
index cc8b0ee..ba3622d 100644
27aea6
--- a/sc/source/ui/view/gridwin4.cxx
27aea6
+++ b/sc/source/ui/view/gridwin4.cxx
27aea6
@@ -1038,7 +1038,12 @@ void ScGridWindow::DrawContent(OutputDevice &rDevice, const ScTableInfo& rTableI
27aea6
         }
27aea6
 
27aea6
         // paint the background
27aea6
-        rDevice.DrawRect(rDevice.PixelToLogic(aBackground));
27aea6
+        Rectangle aLogicRect(rDevice.PixelToLogic(aBackground));
27aea6
+        //tdf#100925, rhbz#1283420, Draw some text here, to get
27aea6
+        //X11CairoTextRender::getCairoContext called, so that the forced read
27aea6
+        //from the underlying X Drawable gets it to sync.
27aea6
+        rDevice.DrawText(aLogicRect.BottomLeft(), " ");
27aea6
+        rDevice.DrawRect(aLogicRect);
27aea6
 
27aea6
         // paint the editeng text
27aea6
         Rectangle aEditRect(Point(nScrX, nScrY), Size(aOutputData.GetScrW(), aOutputData.GetScrH()));
27aea6
-- 
27aea6
2.14.3
27aea6