drawinglayer/Library_drawinglayer.mk                         |    1 
 drawinglayer/source/processor2d/helperwrongspellrenderer.cxx |   78 -----------
 drawinglayer/source/processor2d/helperwrongspellrenderer.hxx |   47 ------
 drawinglayer/source/processor2d/vclpixelprocessor2d.cxx      |   19 --
 drawinglayer/source/processor2d/vclpixelprocessor2d.hxx      |    2 
 svx/source/svdraw/svdotextdecomposition.cxx                  |    6 
 6 files changed, 153 deletions(-)

New commits:
commit 79ab5c3775f8d0685585810583b84c0f4d49a1bf
Author:     Armin Le Grand (Collabora) <armin.le.gr...@me.com>
AuthorDate: Fri Aug 23 20:59:55 2024 +0200
Commit:     Armin Le Grand <armin.le.gr...@me.com>
CommitDate: Sat Aug 24 15:10:45 2024 +0200

    CairoSDPR: Let VclPixelProcessor2D use RedLining decompose
    
    VclPixelProcessor2D used PRIMITIVE2D_ID_WRONGSPELLPRIMITIVE2D
    to render WrongSpellPrimitive2D using processWrongSpellPrimitive2D
    and there renderWrongSpellPrimitive2D. That again used
    DrawWaveLine at OutputDevice.
    
    This again does some very special things, e.g. it uses the set
    Font at the OutputDevice which hopefully is the one the
    redlining refers to (info from that has to be added to the
    WrongSpellPrimitive2D if needed, in this case the
    LogicalFontInstance's GetWavelineUnderlineSize result). It
    seems to rely on the Text being redlined being 'painted'
    directly before this.
    It also renders the WaveLine to a BitmapEx and does pixel-
    based operations on it (probably to 'clip' the WaveLine instead
    of adding needed partial curve geometry), and adds that
    BitmapData to a cache.
    It also mentions it 'make sure the waveline does not exceed the
    descent to avoid paint problems', probably because when not
    handling it as Primitive from a PrimitiveProcessor the
    invalidation Range will not fit (it still uses the getB2DRange
    of the WrongSpellPrimitive2D to do that part indirectly), so
    these regions will probably not always have fit.
    
    Nothing of this is needed, after I made the
    WrongSpellPrimitive2D to use view-independent (aka pixel-
    oriented scaling, fixed size) to behave like the current paint
    the VclPixelProcessor2D can just use the decompose and render
    the view-dependent and buffered visualization of the WaveLine.
    
    NOTE: It is not possible to completely get rid of
    OutputDevice::DrawWaveLine since it is used in some cases in
    Writer directly, also in ImpEditEngine::Paint when the
    EditEngine is painting directly (very rare now).
    
    NOTE: Also impCreateTextPortionPrimitive did swap start/end
    in preparationm to create a WrongSpellPrimitive2D (look for
    tdf#151968), this will no longer be needed.
    
    Change-Id: I31aec8ea9c2e3c574ad471082612a10d95810f3b
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172331
    Tested-by: Jenkins
    Reviewed-by: Armin Le Grand <armin.le.gr...@me.com>

diff --git a/drawinglayer/Library_drawinglayer.mk 
b/drawinglayer/Library_drawinglayer.mk
index e8e3dde7c952..6409e379df6b 100644
--- a/drawinglayer/Library_drawinglayer.mk
+++ b/drawinglayer/Library_drawinglayer.mk
@@ -194,7 +194,6 @@ $(eval $(call 
gb_Library_add_exception_objects,drawinglayer,\
     drawinglayer/source/processor2d/processor2dtools \
     drawinglayer/source/processor2d/contourextractor2d \
     drawinglayer/source/processor2d/getdigitlanguage \
-    drawinglayer/source/processor2d/helperwrongspellrenderer \
     drawinglayer/source/processor2d/hittestprocessor2d \
     drawinglayer/source/processor2d/linegeometryextractor2d \
     drawinglayer/source/processor2d/objectinfoextractor2d \
diff --git a/drawinglayer/source/processor2d/helperwrongspellrenderer.cxx 
b/drawinglayer/source/processor2d/helperwrongspellrenderer.cxx
deleted file mode 100644
index d4f14a13ce6c..000000000000
--- a/drawinglayer/source/processor2d/helperwrongspellrenderer.cxx
+++ /dev/null
@@ -1,78 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- *   Licensed to the Apache Software Foundation (ASF) under one or more
- *   contributor license agreements. See the NOTICE file distributed
- *   with this work for additional information regarding copyright
- *   ownership. The ASF licenses this file to you under the Apache
- *   License, Version 2.0 (the "License"); you may not use this file
- *   except in compliance with the License. You may obtain a copy of
- *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#include "helperwrongspellrenderer.hxx"
-#include <drawinglayer/primitive2d/wrongspellprimitive2d.hxx>
-#include <tools/gen.hxx>
-#include <vcl/outdev.hxx>
-#include <basegfx/color/bcolormodifier.hxx>
-#include <vcl/outdev/ScopedStates.hxx>
-
-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,
-                                 const basegfx::BColorModifierStack& 
rBColorModifierStack)
-{
-    const basegfx::B2DHomMatrix aLocalTransform(rObjectToViewTransformation
-                                                * 
rWrongSpellCandidate.getTransformation());
-    const basegfx::B2DVector aFontVectorPixel(aLocalTransform * 
basegfx::B2DVector(0.0, 1.0));
-    const sal_uInt32 
nFontPixelHeight(basegfx::fround(aFontVectorPixel.getLength()));
-
-    if (nFontPixelHeight <= constMinimumFontHeight)
-        return true;
-
-    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<tools::Long>(aStart.getX()),
-                          basegfx::fround<tools::Long>(aStart.getY()));
-    const Point aVclStop(basegfx::fround<tools::Long>(aStop.getX()),
-                         basegfx::fround<tools::Long>(aStop.getY()));
-
-    // #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::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;
-}
-} // end of namespace drawinglayer
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/drawinglayer/source/processor2d/helperwrongspellrenderer.hxx 
b/drawinglayer/source/processor2d/helperwrongspellrenderer.hxx
deleted file mode 100644
index 886ce99bb7ff..000000000000
--- a/drawinglayer/source/processor2d/helperwrongspellrenderer.hxx
+++ /dev/null
@@ -1,47 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- *   Licensed to the Apache Software Foundation (ASF) under one or more
- *   contributor license agreements. See the NOTICE file distributed
- *   with this work for additional information regarding copyright
- *   ownership. The ASF licenses this file to you under the Apache
- *   License, Version 2.0 (the "License"); you may not use this file
- *   except in compliance with the License. You may obtain a copy of
- *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#pragma once
-
-class OutputDevice;
-
-namespace drawinglayer::primitive2d
-{
-class WrongSpellPrimitive2D;
-}
-
-namespace basegfx
-{
-class B2DHomMatrix;
-class BColorModifierStack;
-}
-
-// support WrongSpell rendering using VCL from primitives due to VCLs nice
-// and fast solution with wavelines
-
-namespace drawinglayer
-{
-bool renderWrongSpellPrimitive2D(const primitive2d::WrongSpellPrimitive2D& 
rWrongSpellCandidate,
-                                 OutputDevice& rOutputDevice,
-                                 const basegfx::B2DHomMatrix& 
rObjectToViewTransformation,
-                                 const basegfx::BColorModifierStack& 
rBColorModifierStack);
-
-} // end of namespace drawinglayer
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx 
b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
index f6d684c06c3f..0ed950e5ffdb 100644
--- a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
@@ -19,7 +19,6 @@
 
 #include "vclpixelprocessor2d.hxx"
 #include "vclhelperbufferdevice.hxx"
-#include "helperwrongspellrenderer.hxx"
 #include <comphelper/lok.hxx>
 
 #include <sal/log.hxx>
@@ -46,7 +45,6 @@
 #include <drawinglayer/primitive2d/transformprimitive2d.hxx>
 #include <drawinglayer/primitive2d/markerarrayprimitive2d.hxx>
 #include <drawinglayer/primitive2d/glowprimitive2d.hxx>
-#include <drawinglayer/primitive2d/wrongspellprimitive2d.hxx>
 #include <drawinglayer/primitive2d/controlprimitive2d.hxx>
 #include <drawinglayer/primitive2d/borderlineprimitive2d.hxx>
 #include <drawinglayer/primitive2d/fillgradientprimitive2d.hxx>
@@ -197,12 +195,6 @@ void VclPixelProcessor2D::processBasePrimitive2D(const 
primitive2d::BasePrimitiv
 {
     switch (rCandidate.getPrimitive2DID())
     {
-        case PRIMITIVE2D_ID_WRONGSPELLPRIMITIVE2D:
-        {
-            processWrongSpellPrimitive2D(
-                static_cast<const 
primitive2d::WrongSpellPrimitive2D&>(rCandidate));
-            break;
-        }
         case PRIMITIVE2D_ID_TEXTSIMPLEPORTIONPRIMITIVE2D:
         {
             processTextSimplePortionPrimitive2D(
@@ -389,17 +381,6 @@ void VclPixelProcessor2D::processBasePrimitive2D(const 
primitive2d::BasePrimitiv
     }
 }
 
-void VclPixelProcessor2D::processWrongSpellPrimitive2D(
-    const primitive2d::WrongSpellPrimitive2D& rWrongSpellPrimitive)
-{
-    if (!renderWrongSpellPrimitive2D(rWrongSpellPrimitive, *mpOutputDevice, 
maCurrentTransformation,
-                                     maBColorModifierStack))
-    {
-        // fallback to decomposition (MetaFile)
-        process(rWrongSpellPrimitive);
-    }
-}
-
 void VclPixelProcessor2D::processTextSimplePortionPrimitive2D(
     const primitive2d::TextSimplePortionPrimitive2D& rCandidate)
 {
diff --git a/drawinglayer/source/processor2d/vclpixelprocessor2d.hxx 
b/drawinglayer/source/processor2d/vclpixelprocessor2d.hxx
index 185ed52ed897..3cecf6622228 100644
--- a/drawinglayer/source/processor2d/vclpixelprocessor2d.hxx
+++ b/drawinglayer/source/processor2d/vclpixelprocessor2d.hxx
@@ -72,8 +72,6 @@ class VclPixelProcessor2D final : public VclProcessor2D
     bool tryDrawPolygonStrokePrimitive2DDirect(const 
primitive2d::PolygonStrokePrimitive2D& rSource,
                                                double fTransparency);
 
-    void
-    processWrongSpellPrimitive2D(const primitive2d::WrongSpellPrimitive2D& 
rWrongSpellPrimitive);
     void processTextSimplePortionPrimitive2D(
         const primitive2d::TextSimplePortionPrimitive2D& rCandidate);
     void processTextDecoratedPortionPrimitive2D(
diff --git a/svx/source/svdraw/svdotextdecomposition.cxx 
b/svx/source/svdraw/svdotextdecomposition.cxx
index e0068fd159c7..39e5431a2581 100644
--- a/svx/source/svdraw/svdotextdecomposition.cxx
+++ b/svx/source/svdraw/svdotextdecomposition.cxx
@@ -435,12 +435,6 @@ namespace
 
                         fStart = fTextWidth - fStart;
                         fEnd = fTextWidth - fEnd;
-
-                        // tdf#151968
-                        // if start < end, OutputDevice::DrawWaveLine() will
-                        // think it is a rotated line, so we swap fStart and
-                        // fEnd to avoid this.
-                        std::swap(fStart, fEnd);
                     }
 
                     // need to take FontScaling out of values; it's already 
part of

Reply via email to