[Libreoffice-commits] core.git: Branch 'feature/drawinglayercore' - 2 commits - drawinglayer/source

Tomaž Vajngerl (via logerrit) logerrit at kemper.freedesktop.org
Sun May 3 09:35:50 UTC 2020


 drawinglayer/source/processor2d/helperwrongspellrenderer.cxx |   47 +++++------
 1 file changed, 25 insertions(+), 22 deletions(-)

New commits:
commit 0e17dcd48602c3b0549044616a56eaa217b74279
Author:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Sun May 3 11:34:51 2020 +0200
Commit:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
CommitDate: Sun May 3 11:34:51 2020 +0200

    drawinglayer: extract constant in renderWrongSpellPrimitive2D
    
    Change-Id: I131e2d5620d027f32dc2929cd12fedb168e30e9c

diff --git a/drawinglayer/source/processor2d/helperwrongspellrenderer.cxx b/drawinglayer/source/processor2d/helperwrongspellrenderer.cxx
index 27df21201efe..9f838a7e1b61 100644
--- a/drawinglayer/source/processor2d/helperwrongspellrenderer.cxx
+++ b/drawinglayer/source/processor2d/helperwrongspellrenderer.cxx
@@ -28,6 +28,11 @@ using namespace css;
 
 namespace drawinglayer
 {
+namespace
+{
+constexpr sal_uInt32 constMinimumFontHeight = 5; // #define WRONG_SHOW_MIN 5
+}
+
 bool renderWrongSpellPrimitive2D(const primitive2d::WrongSpellPrimitive2D& rWrongSpellCandidate,
                                  OutputDevice& rOutputDevice,
                                  const basegfx::B2DHomMatrix& rObjectToViewTransformation,
@@ -38,9 +43,7 @@ bool renderWrongSpellPrimitive2D(const primitive2d::WrongSpellPrimitive2D& rWron
     const basegfx::B2DVector aFontVectorPixel(aLocalTransform * basegfx::B2DVector(0.0, 1.0));
     const sal_uInt32 nFontPixelHeight(basegfx::fround(aFontVectorPixel.getLength()));
 
-    static const sal_uInt32 nMinimumFontHeight(5); // #define WRONG_SHOW_MIN 5
-
-    if (nFontPixelHeight <= nMinimumFontHeight)
+    if (nFontPixelHeight <= constMinimumFontHeight)
         return true;
 
     const basegfx::B2DPoint aStart(aLocalTransform
commit 9bcb740c659eae3df897057a2ae71060b9d23ed6
Author:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Sun May 3 11:32:25 2020 +0200
Commit:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
CommitDate: Sun May 3 11:32:25 2020 +0200

    drawinglayer: flatten renderWrongSpellPrimitive2D
    
    Change-Id: I93ff19f9f54b6f14c660af554d697b9ba525f81c

diff --git a/drawinglayer/source/processor2d/helperwrongspellrenderer.cxx b/drawinglayer/source/processor2d/helperwrongspellrenderer.cxx
index 83fdba7cc1f5..27df21201efe 100644
--- a/drawinglayer/source/processor2d/helperwrongspellrenderer.cxx
+++ b/drawinglayer/source/processor2d/helperwrongspellrenderer.cxx
@@ -40,30 +40,30 @@ bool renderWrongSpellPrimitive2D(const primitive2d::WrongSpellPrimitive2D& rWron
 
     static const sal_uInt32 nMinimumFontHeight(5); // #define WRONG_SHOW_MIN 5
 
-    if (nFontPixelHeight > nMinimumFontHeight)
-    {
-        const basegfx::B2DPoint aStart(aLocalTransform
-                                       * basegfx::B2DPoint(rWrongSpellCandidate.getStart(), 0.0));
-        const basegfx::B2DPoint aStop(aLocalTransform
-                                      * basegfx::B2DPoint(rWrongSpellCandidate.getStop(), 0.0));
-        const Point aVclStart(basegfx::fround(aStart.getX()), basegfx::fround(aStart.getY()));
-        const Point aVclStop(basegfx::fround(aStop.getX()), basegfx::fround(aStop.getY()));
+    if (nFontPixelHeight <= nMinimumFontHeight)
+        return true;
 
-        // #i101075# draw it. Do not forget to use the evtl. offsetted origin of the target device,
-        // e.g. when used with mask/transparence buffer device
-        const Point aOrigin(rOutputDevice.GetMapMode().GetOrigin());
+    const basegfx::B2DPoint aStart(aLocalTransform
+                                   * basegfx::B2DPoint(rWrongSpellCandidate.getStart(), 0.0));
+    const basegfx::B2DPoint aStop(aLocalTransform
+                                  * basegfx::B2DPoint(rWrongSpellCandidate.getStop(), 0.0));
+    const Point aVclStart(basegfx::fround(aStart.getX()), basegfx::fround(aStart.getY()));
+    const Point aVclStop(basegfx::fround(aStop.getX()), basegfx::fround(aStop.getY()));
 
-        const basegfx::BColor aProcessedColor(
-            rBColorModifierStack.getModifiedColor(rWrongSpellCandidate.getColor()));
-        const bool bMapModeEnabledState(rOutputDevice.IsMapModeEnabled());
+    // #i101075# draw it. Do not forget to use the evtl. offsetted origin of the target device,
+    // e.g. when used with mask/transparence buffer device
+    const Point aOrigin(rOutputDevice.GetMapMode().GetOrigin());
 
-        vcl::ScopedAntialiasing a(rOutputDevice, true);
-        rOutputDevice.EnableMapMode(false);
-        rOutputDevice.SetLineColor(Color(aProcessedColor));
-        rOutputDevice.SetFillColor();
-        rOutputDevice.DrawWaveLine(aOrigin + aVclStart, aOrigin + aVclStop);
-        rOutputDevice.EnableMapMode(bMapModeEnabledState);
-    }
+    const basegfx::BColor aProcessedColor(
+        rBColorModifierStack.getModifiedColor(rWrongSpellCandidate.getColor()));
+    const bool bMapModeEnabledState(rOutputDevice.IsMapModeEnabled());
+
+    vcl::ScopedAntialiasing a(rOutputDevice, true);
+    rOutputDevice.EnableMapMode(false);
+    rOutputDevice.SetLineColor(Color(aProcessedColor));
+    rOutputDevice.SetFillColor();
+    rOutputDevice.DrawWaveLine(aOrigin + aVclStart, aOrigin + aVclStop);
+    rOutputDevice.EnableMapMode(bMapModeEnabledState);
 
     // cannot really go wrong
     return true;


More information about the Libreoffice-commits mailing list