[Libreoffice-commits] core.git: vcl/source

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Sun Sep 6 15:16:12 UTC 2020


 vcl/source/outdev/text.cxx |   20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)

New commits:
commit b5fcfb7ff9c02b1aa0578bb52da2bd7a8ade06f0
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Sun Sep 6 15:13:48 2020 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Sun Sep 6 17:15:32 2020 +0200

    ofz#23573 speed up fuzzing
    
    Change-Id: I57823bb2a04da46ad1b66d1ba3d69f323406f612
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102107
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/vcl/source/outdev/text.cxx b/vcl/source/outdev/text.cxx
index 6de59729d91e..ac4b10eef3b0 100644
--- a/vcl/source/outdev/text.cxx
+++ b/vcl/source/outdev/text.cxx
@@ -42,6 +42,7 @@
 # include <vcl/opengl/OpenGLHelper.hxx>
 #endif
 
+#include <config_fuzzers.h>
 #include <outdata.hxx>
 #include <outdev.h>
 #include <salgdi.hxx>
@@ -784,6 +785,13 @@ vcl::Region OutputDevice::GetOutputBoundsClipRegion() const
     return GetClipRegion();
 }
 
+#if !ENABLE_FUZZERS
+const SalLayoutFlags eDefaultLayout = SalLayoutFlags::NONE;
+#else
+// ofz#23573 skip detecting bidi directions
+const SalLayoutFlags eDefaultLayout = SalLayoutFlags::BiDiStrong;
+#endif
+
 void OutputDevice::DrawText( const Point& rStartPt, const OUString& rStr,
                              sal_Int32 nIndex, sal_Int32 nLen,
                              MetricVector* pVector, OUString* pDisplayText,
@@ -871,7 +879,7 @@ void OutputDevice::DrawText( const Point& rStartPt, const OUString& rStr,
         pLayoutCache = nullptr;
 #endif
 
-    std::unique_ptr<SalLayout> pSalLayout = ImplLayout(rStr, nIndex, nLen, rStartPt, 0, nullptr, SalLayoutFlags::NONE, nullptr, pLayoutCache);
+    std::unique_ptr<SalLayout> pSalLayout = ImplLayout(rStr, nIndex, nLen, rStartPt, 0, nullptr, eDefaultLayout, nullptr, pLayoutCache);
     if(pSalLayout)
     {
         ImplDrawText( *pSalLayout );
@@ -966,7 +974,7 @@ long OutputDevice::GetTextArray( const OUString& rStr, long* pDXAry,
 
     // do layout
     std::unique_ptr<SalLayout> pSalLayout = ImplLayout(rStr, nIndex, nLen,
-            Point(0,0), 0, nullptr, SalLayoutFlags::NONE, pLayoutCache, pSalLayoutCache);
+            Point(0,0), 0, nullptr, eDefaultLayout, pLayoutCache, pSalLayoutCache);
     if( !pSalLayout )
     {
         // The caller expects this to init the elements of pDXAry.
@@ -1072,7 +1080,7 @@ void OutputDevice::GetCaretPositions( const OUString& rStr, long* pCaretXArray,
 
     // layout complex text
     std::unique_ptr<SalLayout> pSalLayout = ImplLayout(rStr, nIndex, nLen, Point(0, 0), 0, nullptr,
-                                                       SalLayoutFlags::NONE, nullptr, pGlyphs);
+                                                       eDefaultLayout, nullptr, pGlyphs);
     if( !pSalLayout )
         return;
 
@@ -1382,7 +1390,7 @@ sal_Int32 OutputDevice::GetTextBreak( const OUString& rStr, long nTextWidth,
          const SalLayoutGlyphs* pGlyphs) const
 {
     std::unique_ptr<SalLayout> pSalLayout = ImplLayout( rStr, nIndex, nLen,
-            Point(0,0), 0, nullptr, SalLayoutFlags::NONE, pLayoutCache, pGlyphs);
+            Point(0,0), 0, nullptr, eDefaultLayout, pLayoutCache, pGlyphs);
     sal_Int32 nRetVal = -1;
     if( pSalLayout )
     {
@@ -1415,7 +1423,7 @@ sal_Int32 OutputDevice::GetTextBreak( const OUString& rStr, long nTextWidth,
     rHyphenPos = -1;
 
     std::unique_ptr<SalLayout> pSalLayout = ImplLayout( rStr, nIndex, nLen,
-            Point(0,0), 0, nullptr, SalLayoutFlags::NONE, pLayoutCache);
+            Point(0,0), 0, nullptr, eDefaultLayout, pLayoutCache);
     sal_Int32 nRetVal = -1;
     if( pSalLayout )
     {
@@ -2282,7 +2290,7 @@ bool OutputDevice::GetTextBoundRect( tools::Rectangle& rRect,
         }
     }
 
-    pSalLayout = ImplLayout(rStr, nIndex, nLen, aPoint, nLayoutWidth, pDXAry, SalLayoutFlags::NONE,
+    pSalLayout = ImplLayout(rStr, nIndex, nLen, aPoint, nLayoutWidth, pDXAry, eDefaultLayout,
                             nullptr, pGlyphs);
     tools::Rectangle aPixelRect;
     if( pSalLayout )


More information about the Libreoffice-commits mailing list