[Libreoffice-commits] core.git: vcl/headless vcl/inc vcl/unx

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Thu Jul 26 08:22:53 UTC 2018


 vcl/headless/svptext.cxx                |    2 +-
 vcl/inc/textrender.hxx                  |    2 +-
 vcl/inc/unx/cairotextrender.hxx         |    2 +-
 vcl/unx/generic/gdi/cairotextrender.cxx |   14 ++++++++++++--
 vcl/unx/generic/gdi/font.cxx            |    2 +-
 5 files changed, 16 insertions(+), 6 deletions(-)

New commits:
commit 3ecd8f19a91ed7141304a2080fb11612b5ff30b3
Author:     Miklos Vajna <vmiklos at collabora.co.uk>
AuthorDate: Thu Jul 26 09:06:21 2018 +0200
Commit:     Miklos Vajna <vmiklos at collabora.co.uk>
CommitDate: Thu Jul 26 10:22:29 2018 +0200

    vcl cairo text renderer: support non-AA text
    
    Non-AA lines were already working, but text was always anti-aliased.
    
    (Use-case is reference bitmaps in a testsuite, where AA just makes it
    harder to determine if the expected and actual rendering output match.)
    
    Change-Id: I7c5ab4c80675e1a523d67b71f3cd3cbc9c6416c3
    Reviewed-on: https://gerrit.libreoffice.org/58035
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
    Tested-by: Jenkins

diff --git a/vcl/headless/svptext.cxx b/vcl/headless/svptext.cxx
index 1e0b578f800b..dbef813cd658 100644
--- a/vcl/headless/svptext.cxx
+++ b/vcl/headless/svptext.cxx
@@ -108,7 +108,7 @@ std::unique_ptr<SalLayout> SvpSalGraphics::GetTextLayout( ImplLayoutArgs& rArgs,
 
 void SvpSalGraphics::DrawTextLayout(const GenericSalLayout& rLayout)
 {
-    m_aTextRenderImpl.DrawTextLayout(rLayout);
+    m_aTextRenderImpl.DrawTextLayout(rLayout, *this);
 }
 
 void SvpSalGraphics::SetTextColor( Color nColor )
diff --git a/vcl/inc/textrender.hxx b/vcl/inc/textrender.hxx
index 88de2076aca3..eb86e3b2bcf4 100644
--- a/vcl/inc/textrender.hxx
+++ b/vcl/inc/textrender.hxx
@@ -63,7 +63,7 @@ public:
     virtual bool                    GetGlyphOutline(const GlyphItem&, basegfx::B2DPolyPolygon&) = 0;
     virtual std::unique_ptr<SalLayout>
                                     GetTextLayout( ImplLayoutArgs&, int nFallbackLevel ) = 0;
-    virtual void                    DrawTextLayout(const GenericSalLayout&) = 0;
+    virtual void                    DrawTextLayout(const GenericSalLayout&, const SalGraphics&) = 0;
 #if ENABLE_CAIRO_CANVAS
     virtual SystemFontData          GetSysFontData( int nFallbackLevel ) const = 0;
 #endif // ENABLE_CAIRO_CANVAS
diff --git a/vcl/inc/unx/cairotextrender.hxx b/vcl/inc/unx/cairotextrender.hxx
index 896a0254b923..65d2bed2918e 100644
--- a/vcl/inc/unx/cairotextrender.hxx
+++ b/vcl/inc/unx/cairotextrender.hxx
@@ -79,7 +79,7 @@ public:
     virtual bool                GetGlyphOutline(const GlyphItem&, basegfx::B2DPolyPolygon&) override;
     virtual std::unique_ptr<SalLayout>
                                 GetTextLayout( ImplLayoutArgs&, int nFallbackLevel ) override;
-    virtual void                DrawTextLayout(const GenericSalLayout&) override;
+    virtual void                DrawTextLayout(const GenericSalLayout&, const SalGraphics&) override;
 #if ENABLE_CAIRO_CANVAS
     virtual SystemFontData      GetSysFontData( int nFallbackLevel ) const override;
 #endif
diff --git a/vcl/unx/generic/gdi/cairotextrender.cxx b/vcl/unx/generic/gdi/cairotextrender.cxx
index 36d1dc9cf1a0..55316ed9926a 100644
--- a/vcl/unx/generic/gdi/cairotextrender.cxx
+++ b/vcl/unx/generic/gdi/cairotextrender.cxx
@@ -168,7 +168,7 @@ namespace
     }
 }
 
-void CairoTextRender::DrawTextLayout(const GenericSalLayout& rLayout)
+void CairoTextRender::DrawTextLayout(const GenericSalLayout& rLayout, const SalGraphics& rGraphics)
 {
     const FreetypeFontInstance& rInstance = static_cast<FreetypeFontInstance&>(rLayout.GetFont());
     const FreetypeFont& rFont = *rInstance.GetFreetypeFont();
@@ -218,7 +218,17 @@ void CairoTextRender::DrawTextLayout(const GenericSalLayout& rLayout)
 
     ImplSVData* pSVData = ImplGetSVData();
     if (const cairo_font_options_t* pFontOptions = pSVData->mpDefInst->GetCairoFontOptions())
-        cairo_set_font_options(cr, pFontOptions);
+    {
+        if (!rGraphics.getAntiAliasB2DDraw())
+        {
+            cairo_font_options_t* pOptions = cairo_font_options_copy(pFontOptions);
+            cairo_font_options_set_antialias(pOptions, CAIRO_ANTIALIAS_NONE);
+            cairo_set_font_options(cr, pOptions);
+            cairo_font_options_destroy(pOptions);
+        }
+        else
+            cairo_set_font_options(cr, pFontOptions);
+    }
 
     double nDX, nDY;
     getSurfaceOffset(nDX, nDY);
diff --git a/vcl/unx/generic/gdi/font.cxx b/vcl/unx/generic/gdi/font.cxx
index ae4ef22e21b9..9cdbff3ea69d 100644
--- a/vcl/unx/generic/gdi/font.cxx
+++ b/vcl/unx/generic/gdi/font.cxx
@@ -55,7 +55,7 @@ X11SalGraphics::GetFontGC()
 
 void X11SalGraphics::DrawTextLayout(const GenericSalLayout& rLayout)
 {
-    mxTextRenderImpl->DrawTextLayout(rLayout);
+    mxTextRenderImpl->DrawTextLayout(rLayout, *this);
 }
 
 const FontCharMapRef X11SalGraphics::GetFontCharMap() const


More information about the Libreoffice-commits mailing list