Change in core[libreoffice-4-0]: fdo#54629 MultiSalLayout::GetBoundRect always uses level 0 f...

Lior Kaplan (via Code Review) gerrit at gerrit.libreoffice.org
Mon Jan 28 12:54:02 PST 2013


Hi,

I have submitted a patch for review:

    https://gerrit.libreoffice.org/1907

To pull it, you can do:

    git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/07/1907/1

fdo#54629 MultiSalLayout::GetBoundRect always uses level 0 fallback font

...in X11SalGraphics::GetGlyphBoundRect

In MultiSalLayout::GetBoundRect we loop through each fallback font and union
each level's GetBoundRect to get the result, which seems reasonable, except
that for each level that means a call to SalLayout::GetBoundRect which calls
X11SalGraphics::GetGlyphBoundRect.

Those sublevel SalLayouts don't know that they are sublevels so they never set
the level bits on their glyphs. Which results in
X11SalGraphics::GetGlyphBoundRect always searching for that glyph in the level
0 font, so there's a mismatch between the font the SalLayout's are created to
use and the font that gets used.

Now, SalLayout::GetBoundRect is a fairly simple thing, it just calls
GetNextGlyphs 1 by 1 and X11SalGraphics::GetGlyphBoundRect on the result of
that.  So I *think* that if we remove the specialized
MultiSalLayout::GetBoundRect in favour of the default implementation, then
because MultiSalLayout::GetNextGlyphs is specialized to do-the-right-thing and
set up the glyph ids correctly, then we bubble the ids down
to X11SalGraphics::GetGlyphBoundRect correctly to get it to
use the right font and we get the correct bounding size.

defb4d60a2d22fd36a0ff3f077faa6a0932b45a4
defb4d60a2d22fd36a0ff3f077faa6a0932b45a4

Change-Id: Idefb4d60a2d22fd36a0ff3f077faa6a0932b45a4
---
M vcl/inc/sallayout.hxx
M vcl/source/gdi/sallayout.cxx
2 files changed, 0 insertions(+), 27 deletions(-)



diff --git a/vcl/inc/sallayout.hxx b/vcl/inc/sallayout.hxx
index bef64af..b45d122 100644
--- a/vcl/inc/sallayout.hxx
+++ b/vcl/inc/sallayout.hxx
@@ -253,7 +253,6 @@
     virtual int     GetNextGlyphs( int nLen, sal_GlyphId* pGlyphIdxAry, Point& rPos,
                         int&, sal_Int32* pGlyphAdvAry, int* pCharPosAry ) const;
     virtual bool    GetOutline( SalGraphics&, ::basegfx::B2DPolyPolygonVector& ) const;
-    virtual bool    GetBoundRect( SalGraphics&, Rectangle& ) const;
 
     // used only by OutputDevice::ImplLayout, TODO: make friend
     explicit        MultiSalLayout( SalLayout& rBaseLayout,
diff --git a/vcl/source/gdi/sallayout.cxx b/vcl/source/gdi/sallayout.cxx
index 140037d..fe5cf8b 100644
--- a/vcl/source/gdi/sallayout.cxx
+++ b/vcl/source/gdi/sallayout.cxx
@@ -2080,30 +2080,4 @@
     return bRet;
 }
 
-// -----------------------------------------------------------------------
-
-bool MultiSalLayout::GetBoundRect( SalGraphics& rGraphics, Rectangle& rRect ) const
-{
-    bool bRet = false;
-
-    Rectangle aRectangle;
-    for( int i = mnLevel; --i >= 0; )
-    {
-        SalLayout& rLayout = *mpLayouts[ i ];
-        rLayout.DrawBase() = maDrawBase;
-        rLayout.DrawOffset() += maDrawOffset;
-        rLayout.InitFont();
-        if( rLayout.GetBoundRect( rGraphics, aRectangle ) )
-        {
-            rRect.Union( aRectangle );
-            bRet = true;
-        }
-        rLayout.DrawOffset() -= maDrawOffset;
-    }
-
-    return bRet;
-}
-
-// =======================================================================
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

-- 
To view, visit https://gerrit.libreoffice.org/1907
To unsubscribe, visit https://gerrit.libreoffice.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Idefb4d60a2d22fd36a0ff3f077faa6a0932b45a4
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: libreoffice-4-0
Gerrit-Owner: Lior Kaplan <kaplanlior at gmail.com>
Gerrit-Reviewer: Caolán McNamara <caolanm at redhat.com>


More information about the LibreOffice mailing list