optimize the text drawing, that's what we do most of

maybe the alternative branch should be dropped, turned into a debugging
option because it is obscure and presumably doesn't result in better
results that using the platform text rendering

Change-Id: Ief6882f7acf8737ca64b10e74e5d94aade60d71a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163791
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
diff --git a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
index 21939efa..bb3e29b 100644
--- a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
@@ -75,6 +75,10 @@ VclPixelProcessor2D::VclPixelProcessor2D(const geometry::ViewInformation2D& rVie
                                         const basegfx::BColorModifierStack& rInitStack)
    : VclProcessor2D(rViewInformation, rOutDev, rInitStack)
    , m_nOrigAntiAliasing(rOutDev.GetAntialiasing())
    , m_bRenderSimpleTextDirect(
          officecfg::Office::Common::Drawinglayer::RenderSimpleTextDirect::get())
    , m_bRenderDecoratedTextDirect(
          officecfg::Office::Common::Drawinglayer::RenderDecoratedTextDirect::get())
{
    // prepare maCurrentTransformation matrix with viewTransformation to target directly to pixels
    maCurrentTransformation = rViewInformation.getObjectToViewTransformation();
@@ -414,7 +418,7 @@ void VclPixelProcessor2D::processTextSimplePortionPrimitive2D(
    const DrawModeFlags nOriginalDrawMode(mpOutputDevice->GetDrawMode());
    adaptTextToFillDrawMode();

    if (officecfg::Office::Common::Drawinglayer::RenderSimpleTextDirect::get())
    if (SAL_LIKELY(m_bRenderSimpleTextDirect))
    {
        RenderTextSimpleOrDecoratedPortionPrimitive2D(rCandidate);
    }
@@ -434,7 +438,7 @@ void VclPixelProcessor2D::processTextDecoratedPortionPrimitive2D(
    const DrawModeFlags nOriginalDrawMode(mpOutputDevice->GetDrawMode());
    adaptTextToFillDrawMode();

    if (officecfg::Office::Common::Drawinglayer::RenderDecoratedTextDirect::get())
    if (SAL_LIKELY(m_bRenderDecoratedTextDirect))
    {
        RenderTextSimpleOrDecoratedPortionPrimitive2D(rCandidate);
    }
diff --git a/drawinglayer/source/processor2d/vclpixelprocessor2d.hxx b/drawinglayer/source/processor2d/vclpixelprocessor2d.hxx
index c144ba9..185ed52 100644
--- a/drawinglayer/source/processor2d/vclpixelprocessor2d.hxx
+++ b/drawinglayer/source/processor2d/vclpixelprocessor2d.hxx
@@ -55,6 +55,9 @@ class VclPixelProcessor2D final : public VclProcessor2D
{
    AntialiasingFlags m_nOrigAntiAliasing;

    bool m_bRenderSimpleTextDirect;
    bool m_bRenderDecoratedTextDirect;

    /*  the local processor for BasePrimitive2D-Implementation based primitives,
        called from the common process()-implementation
     */