From a909afbc21e8cdd03a7f27db798f830c76aa91d2 Mon Sep 17 00:00:00 2001 From: Khaled Hosny Date: Thu, 10 May 2018 12:48:13 +0200 Subject: Fold CommonSalLayout into GenericSalLayout Now the crazy constructors of CommonSalLayout are gone, we can merge the two and drop one level of indirection. Change-Id: I166e4ed2c9d22c1ce75246d486f7526c4928f652 Reviewed-on: https://gerrit.libreoffice.org/54077 Tested-by: Jenkins Reviewed-by: Khaled Hosny --- solenv/clang-format/blacklist | 1 - vcl/CppunitTest_vcl_complextext.mk | 5 ++- vcl/Executable_vcldemo.mk | 1 + vcl/headless/svptext.cxx | 4 +- vcl/inc/CommonSalLayout.hxx | 64 -------------------------------- vcl/inc/headless/svpgdi.hxx | 2 +- vcl/inc/quartz/salgdi.h | 3 +- vcl/inc/salgdi.hxx | 3 +- vcl/inc/sallayout.hxx | 61 ++++++++++++++++++++++-------- vcl/inc/textrender.hxx | 2 +- vcl/inc/unx/cairotextrender.hxx | 2 +- vcl/inc/unx/genpspgraphics.h | 2 +- vcl/inc/unx/salgdi.h | 2 +- vcl/inc/win/DWriteTextRenderer.hxx | 4 +- vcl/inc/win/salgdi.h | 9 ++--- vcl/inc/win/winlayout.hxx | 5 +-- vcl/qt5/Qt5Graphics.hxx | 2 +- vcl/qt5/Qt5Graphics_Text.cxx | 6 +-- vcl/quartz/salgdi.cxx | 7 ++-- vcl/source/gdi/CommonSalLayout.cxx | 33 ++++++++-------- vcl/source/gdi/sallayout.cxx | 6 --- vcl/unx/generic/gdi/cairotextrender.cxx | 8 ++-- vcl/unx/generic/gdi/font.cxx | 4 +- vcl/unx/generic/print/genpspgraphics.cxx | 20 +++++----- vcl/win/gdi/DWriteTextRenderer.cxx | 5 +-- vcl/win/gdi/winlayout.cxx | 23 ++++++------ 26 files changed, 119 insertions(+), 165 deletions(-) delete mode 100644 vcl/inc/CommonSalLayout.hxx diff --git a/solenv/clang-format/blacklist b/solenv/clang-format/blacklist index f63ff7be8ab7..f1cf302e060a 100644 --- a/solenv/clang-format/blacklist +++ b/solenv/clang-format/blacklist @@ -17547,7 +17547,6 @@ vcl/inc/BitmapProcessor.hxx vcl/inc/BitmapScaleConvolutionFilter.hxx vcl/inc/BitmapScaleSuperFilter.hxx vcl/inc/BitmapSymmetryCheck.hxx -vcl/inc/CommonSalLayout.hxx vcl/inc/ControlCacheKey.hxx vcl/inc/PhysicalFontCollection.hxx vcl/inc/PhysicalFontFace.hxx diff --git a/vcl/CppunitTest_vcl_complextext.mk b/vcl/CppunitTest_vcl_complextext.mk index 81dc60fe67d7..ec4c071c5a9b 100644 --- a/vcl/CppunitTest_vcl_complextext.mk +++ b/vcl/CppunitTest_vcl_complextext.mk @@ -19,7 +19,10 @@ $(eval $(call gb_CppunitTest_add_exception_objects,vcl_complextext, \ vcl/qa/cppunit/complextext \ )) -$(eval $(call gb_CppunitTest_use_externals,vcl_complextext,boost_headers)) +$(eval $(call gb_CppunitTest_use_externals,vcl_complextext,\ + boost_headers \ + harfbuzz \ +)) ifneq ($(filter MORE_FONTS,$(BUILD_TYPE)),) $(eval $(call gb_CppunitTest_use_package,vcl_complextext,fonts_dejavu)) diff --git a/vcl/Executable_vcldemo.mk b/vcl/Executable_vcldemo.mk index a09d3b4936e1..c06725c297cf 100644 --- a/vcl/Executable_vcldemo.mk +++ b/vcl/Executable_vcldemo.mk @@ -18,6 +18,7 @@ $(eval $(call gb_Executable_use_api,vcldemo,\ $(eval $(call gb_Executable_use_externals,vcldemo,\ boost_headers \ glm_headers \ + harfbuzz \ )) ifeq ($(ENABLE_HEADLESS),) $(eval $(call gb_Executable_use_externals,vcldemo,\ diff --git a/vcl/headless/svptext.cxx b/vcl/headless/svptext.cxx index caa34e33f7b9..1e0b578f800b 100644 --- a/vcl/headless/svptext.cxx +++ b/vcl/headless/svptext.cxx @@ -23,7 +23,7 @@ #include #include #include -#include +#include void SvpSalGraphics::SetFont( const FontSelectPattern* pIFSD, int nFallbackLevel ) { @@ -106,7 +106,7 @@ std::unique_ptr SvpSalGraphics::GetTextLayout( ImplLayoutArgs& rArgs, return m_aTextRenderImpl.GetTextLayout(rArgs, nFallbackLevel); } -void SvpSalGraphics::DrawTextLayout(const CommonSalLayout& rLayout) +void SvpSalGraphics::DrawTextLayout(const GenericSalLayout& rLayout) { m_aTextRenderImpl.DrawTextLayout(rLayout); } diff --git a/vcl/inc/CommonSalLayout.hxx b/vcl/inc/CommonSalLayout.hxx deleted file mode 100644 index ae5804d5df95..000000000000 --- a/vcl/inc/CommonSalLayout.hxx +++ /dev/null @@ -1,64 +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 . - */ - -#ifndef INCLUDED_VCL_INC_COMMONSALLAYOUT_HXX -#define INCLUDED_VCL_INC_COMMONSALLAYOUT_HXX - -#include - -#include "sallayout.hxx" -#include "fontinstance.hxx" - -#include - -class VCL_DLLPUBLIC CommonSalLayout : public GenericSalLayout -{ - LogicalFontInstance* const mpFont; - css::uno::Reference mxBreak; - - void ParseFeatures(const OUString& name); - OString msLanguage; - std::vector maFeatures; - - hb_set_t* mpVertGlyphs; - const bool mbFuzzing; - bool HasVerticalAlternate(sal_UCS4 aChar, sal_UCS4 aNextChar); - - void SetNeedFallback(ImplLayoutArgs&, sal_Int32, bool); - -public: - CommonSalLayout(LogicalFontInstance&); - ~CommonSalLayout() override; - LogicalFontInstance& getFont() const { return *mpFont; } - - virtual void InitFont() const override; - void AdjustLayout(ImplLayoutArgs&) final override; - bool LayoutText(ImplLayoutArgs&) final override; - void DrawText(SalGraphics&) const final override; - std::shared_ptr CreateTextLayoutCache(OUString const&) const final override; - - bool GetCharWidths(DeviceCoordinate* pCharWidths) const final override; - void ApplyDXArray(ImplLayoutArgs&) final override; - - bool IsKashidaPosValid(int nCharPos) const final override; -}; - -#endif // INCLUDED_VCL_INC_COMMONSALLAYOUT_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/headless/svpgdi.hxx b/vcl/inc/headless/svpgdi.hxx index 2576feb0f60f..3384522c33ca 100644 --- a/vcl/inc/headless/svpgdi.hxx +++ b/vcl/inc/headless/svpgdi.hxx @@ -171,7 +171,7 @@ public: virtual bool GetGlyphOutline(const GlyphItem&, basegfx::B2DPolyPolygon&) override; virtual std::unique_ptr GetTextLayout( ImplLayoutArgs&, int nFallbackLevel ) override; - virtual void DrawTextLayout( const CommonSalLayout& ) override; + virtual void DrawTextLayout( const GenericSalLayout& ) override; virtual bool supportsOperation( OutDevSupportType ) const override; virtual void drawPixel( long nX, long nY ) override; virtual void drawPixel( long nX, long nY, Color nColor ) override; diff --git a/vcl/inc/quartz/salgdi.h b/vcl/inc/quartz/salgdi.h index dbbbdee612e8..1d6969d906a0 100644 --- a/vcl/inc/quartz/salgdi.h +++ b/vcl/inc/quartz/salgdi.h @@ -53,7 +53,6 @@ class AquaSalFrame; class FontAttributes; class CoreTextStyle; class XorEmulation; -class CommonSalLayout; // CoreText-specific physically available font face class CoreTextFontFace : public PhysicalFontFace @@ -380,7 +379,7 @@ public: virtual std::unique_ptr GetTextLayout( ImplLayoutArgs&, int nFallbackLevel ) override; - virtual void DrawTextLayout( const CommonSalLayout& ) override; + virtual void DrawTextLayout( const GenericSalLayout& ) override; virtual bool supportsOperation( OutDevSupportType ) const override; #ifdef MACOSX diff --git a/vcl/inc/salgdi.hxx b/vcl/inc/salgdi.hxx index 71ef1eae1c08..ceae6fd6160c 100644 --- a/vcl/inc/salgdi.hxx +++ b/vcl/inc/salgdi.hxx @@ -44,7 +44,6 @@ class FontSubsetInfo; class OpenGLContext; class OutputDevice; class FreetypeFont; -class CommonSalLayout; struct SystemGraphicsData; #if ENABLE_CAIRO_CANVAS @@ -194,7 +193,7 @@ public: virtual std::unique_ptr GetTextLayout( ImplLayoutArgs&, int nFallbackLevel ) = 0; - virtual void DrawTextLayout( const CommonSalLayout& ) = 0; + virtual void DrawTextLayout( const GenericSalLayout& ) = 0; virtual bool supportsOperation( OutDevSupportType ) const = 0; diff --git a/vcl/inc/sallayout.hxx b/vcl/inc/sallayout.hxx index e07d51e8b3e8..e94dcefeea50 100644 --- a/vcl/inc/sallayout.hxx +++ b/vcl/inc/sallayout.hxx @@ -25,6 +25,10 @@ #include #include +#include + +#include + #include #include #include @@ -32,6 +36,8 @@ #include // for typedef sal_UCS4 #include +#include "fontinstance.hxx" + #define MAX_FALLBACK 16 @@ -304,12 +310,15 @@ public: class VCL_PLUGIN_PUBLIC GenericSalLayout : public SalLayout { public: - // used by layout engines - void AppendGlyph( const GlyphItem& ); - void Reserve(int size) { m_GlyphItems.reserve(size + 1); } - virtual void ApplyDXArray(ImplLayoutArgs&) = 0; - void Justify(DeviceCoordinate nNewWidth); - void ApplyAsianKerning(const OUString& rStr); + GenericSalLayout(LogicalFontInstance&); + ~GenericSalLayout() override; + + void AdjustLayout(ImplLayoutArgs&) final override; + bool LayoutText(ImplLayoutArgs&) final override; + void DrawText(SalGraphics&) const final override; + std::shared_ptr CreateTextLayoutCache(OUString const&) const final override; + + bool IsKashidaPosValid(int nCharPos) const final override; // used by upper layers virtual DeviceCoordinate GetTextWidth() const override; @@ -318,25 +327,45 @@ public: virtual void GetCaretPositions( int nArraySize, long* pCaretXArray ) const override; // used by display layers + LogicalFontInstance& GetFont() const { return *mpFont; } + virtual bool GetNextGlyph(const GlyphItem** pGlyph, Point& rPos, int&, const PhysicalFontFace** pFallbackFont = nullptr) const override; protected: - GenericSalLayout(); - virtual ~GenericSalLayout() override; - // for glyph+font+script fallback - virtual void MoveGlyph( int nStart, long nNewXPos ) override; - virtual void DropGlyph( int nStart ) override; - virtual void Simplify( bool bIsBase ) override; - - virtual bool GetCharWidths(DeviceCoordinate* pCharWidths) const = 0; - - std::vector m_GlyphItems; + void MoveGlyph(int nStart, long nNewXPos) final override; + void DropGlyph(int nStart) final override; + void Simplify(bool bIsBase) final override; private: GenericSalLayout( const GenericSalLayout& ) = delete; GenericSalLayout& operator=( const GenericSalLayout& ) = delete; + + void AppendGlyph( const GlyphItem& ); + void Reserve(int size) { m_GlyphItems.reserve(size + 1); } + void ApplyDXArray(ImplLayoutArgs&); + void Justify(DeviceCoordinate nNewWidth); + void ApplyAsianKerning(const OUString& rStr); + + bool GetCharWidths(DeviceCoordinate* pCharWidths) const; + + void SetNeedFallback(ImplLayoutArgs&, sal_Int32, bool); + + bool HasVerticalAlternate(sal_UCS4 aChar, sal_UCS4 aNextChar); + + void ParseFeatures(const OUString& name); + + LogicalFontInstance* const mpFont; + css::uno::Reference mxBreak; + + std::vector m_GlyphItems; + + OString msLanguage; + std::vector maFeatures; + + hb_set_t* mpVertGlyphs; + const bool mbFuzzing; }; #undef SalGraphics diff --git a/vcl/inc/textrender.hxx b/vcl/inc/textrender.hxx index 8a33c7b07abe..88de2076aca3 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 GetTextLayout( ImplLayoutArgs&, int nFallbackLevel ) = 0; - virtual void DrawTextLayout(const CommonSalLayout&) = 0; + virtual void DrawTextLayout(const GenericSalLayout&) = 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 bdbc201780b4..896a0254b923 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 GetTextLayout( ImplLayoutArgs&, int nFallbackLevel ) override; - virtual void DrawTextLayout(const CommonSalLayout&) override; + virtual void DrawTextLayout(const GenericSalLayout&) override; #if ENABLE_CAIRO_CANVAS virtual SystemFontData GetSysFontData( int nFallbackLevel ) const override; #endif diff --git a/vcl/inc/unx/genpspgraphics.h b/vcl/inc/unx/genpspgraphics.h index 52ef103aaf7d..2f95f3fdb676 100644 --- a/vcl/inc/unx/genpspgraphics.h +++ b/vcl/inc/unx/genpspgraphics.h @@ -115,7 +115,7 @@ public: virtual bool GetGlyphOutline(const GlyphItem&, basegfx::B2DPolyPolygon&) override; virtual std::unique_ptr GetTextLayout( ImplLayoutArgs&, int nFallbackLevel ) override; - virtual void DrawTextLayout( const CommonSalLayout& ) override; + virtual void DrawTextLayout( const GenericSalLayout& ) override; virtual bool supportsOperation( OutDevSupportType ) const override; virtual void drawPixel( long nX, long nY ) override; virtual void drawPixel( long nX, long nY, Color nColor ) override; diff --git a/vcl/inc/unx/salgdi.h b/vcl/inc/unx/salgdi.h index 8cfc5abb2add..bc09b3e2be3a 100644 --- a/vcl/inc/unx/salgdi.h +++ b/vcl/inc/unx/salgdi.h @@ -145,7 +145,7 @@ public: virtual bool GetGlyphOutline(const GlyphItem&, basegfx::B2DPolyPolygon&) override; virtual std::unique_ptr GetTextLayout( ImplLayoutArgs&, int nFallbackLevel ) override; - virtual void DrawTextLayout( const CommonSalLayout& ) override; + virtual void DrawTextLayout( const GenericSalLayout& ) override; virtual bool supportsOperation( OutDevSupportType ) const override; virtual void drawPixel( long nX, long nY ) override; diff --git a/vcl/inc/win/DWriteTextRenderer.hxx b/vcl/inc/win/DWriteTextRenderer.hxx index f6781d5c1c1d..0e81b67167d1 100644 --- a/vcl/inc/win/DWriteTextRenderer.hxx +++ b/vcl/inc/win/DWriteTextRenderer.hxx @@ -52,7 +52,7 @@ public: explicit D2DWriteTextOutRenderer(); virtual ~D2DWriteTextOutRenderer() override; - bool operator ()(CommonSalLayout const &rLayout, + bool operator ()(GenericSalLayout const &rLayout, SalGraphics &rGraphics, HDC hDC) override; @@ -81,7 +81,7 @@ private: D2DWriteTextOutRenderer & operator = (const D2DWriteTextOutRenderer &) = delete; bool GetDWriteFaceFromHDC(HDC hDC, IDWriteFontFace ** ppFontFace, float * lfSize) const; - bool performRender(CommonSalLayout const &rLayout, SalGraphics &rGraphics, HDC hDC, bool& bRetry); + bool performRender(GenericSalLayout const &rLayout, SalGraphics &rGraphics, HDC hDC, bool& bRetry); ID2D1Factory * mpD2DFactory; IDWriteFactory * mpDWriteFactory; diff --git a/vcl/inc/win/salgdi.h b/vcl/inc/win/salgdi.h index 85b88e8e5f10..f2580aa05d5d 100644 --- a/vcl/inc/win/salgdi.h +++ b/vcl/inc/win/salgdi.h @@ -50,7 +50,6 @@ class PhysicalFontCollection; class SalGraphicsImpl; class WinOpenGLSalGraphicsImpl; class ImplFontMetricData; -class CommonSalLayout; #define RGB_TO_PALRGB(nRGB) ((nRGB)|0x02000000) #define PALRGB_TO_RGB(nPalRGB) ((nPalRGB)&0x00ffffff) @@ -174,8 +173,8 @@ private: LogicalFontInstance* GetWinFontEntry(int nFallbackLevel); - bool CacheGlyphs(const CommonSalLayout& rLayout); - bool DrawCachedGlyphs(const CommonSalLayout& rLayout); + bool CacheGlyphs(const GenericSalLayout& rLayout); + bool DrawCachedGlyphs(const GenericSalLayout& rLayout); public: HDC getHDC() const { return mhLocalDC; } @@ -295,7 +294,7 @@ protected: private: // local helpers - void DrawTextLayout(const CommonSalLayout&, HDC, bool bUseDWrite); + void DrawTextLayout(const GenericSalLayout&, HDC, bool bUseDWrite); public: // public SalGraphics methods, the interface to the independent vcl part @@ -378,7 +377,7 @@ public: virtual std::unique_ptr GetTextLayout( ImplLayoutArgs&, int nFallbackLevel ) override; - virtual void DrawTextLayout( const CommonSalLayout& ) override; + virtual void DrawTextLayout( const GenericSalLayout& ) override; virtual bool supportsOperation( OutDevSupportType ) const override; // Query the platform layer for control support diff --git a/vcl/inc/win/winlayout.hxx b/vcl/inc/win/winlayout.hxx index bd10aa997aa8..a3229a4010b6 100644 --- a/vcl/inc/win/winlayout.hxx +++ b/vcl/inc/win/winlayout.hxx @@ -25,7 +25,6 @@ #include #include #include -#include #include @@ -180,7 +179,7 @@ public: virtual ~TextOutRenderer() = default; - virtual bool operator ()(CommonSalLayout const &rLayout, + virtual bool operator ()(GenericSalLayout const &rLayout, SalGraphics &rGraphics, HDC hDC) = 0; }; @@ -193,7 +192,7 @@ class ExTextOutRenderer : public TextOutRenderer public: explicit ExTextOutRenderer() = default; - bool operator ()(CommonSalLayout const &rLayout, + bool operator ()(GenericSalLayout const &rLayout, SalGraphics &rGraphics, HDC hDC) override; }; diff --git a/vcl/qt5/Qt5Graphics.hxx b/vcl/qt5/Qt5Graphics.hxx index 8b37232f7e5c..af21ee462b18 100644 --- a/vcl/qt5/Qt5Graphics.hxx +++ b/vcl/qt5/Qt5Graphics.hxx @@ -184,7 +184,7 @@ public: virtual bool GetGlyphOutline(const GlyphItem&, basegfx::B2DPolyPolygon&) override; virtual std::unique_ptr GetTextLayout(ImplLayoutArgs&, int nFallbackLevel) override; - virtual void DrawTextLayout(const CommonSalLayout&) override; + virtual void DrawTextLayout(const GenericSalLayout&) override; // Native control support diff --git a/vcl/qt5/Qt5Graphics_Text.cxx b/vcl/qt5/Qt5Graphics_Text.cxx index ed3d849aa3f4..2af33b0d97a5 100644 --- a/vcl/qt5/Qt5Graphics_Text.cxx +++ b/vcl/qt5/Qt5Graphics_Text.cxx @@ -23,7 +23,7 @@ #include -#include +#include #include #include @@ -142,10 +142,10 @@ bool Qt5Graphics::GetGlyphOutline(const GlyphItem&, basegfx::B2DPolyPolygon&) { std::unique_ptr Qt5Graphics::GetTextLayout(ImplLayoutArgs&, int nFallbackLevel) { if (m_pTextStyle[nFallbackLevel]) - return std::unique_ptr(new CommonSalLayout(*m_pTextStyle[nFallbackLevel])); + return std::unique_ptr(new GenericSalLayout(*m_pTextStyle[nFallbackLevel])); return std::unique_ptr(); } -void Qt5Graphics::DrawTextLayout(const CommonSalLayout&) {} +void Qt5Graphics::DrawTextLayout(const GenericSalLayout&) {} /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/quartz/salgdi.cxx b/vcl/quartz/salgdi.cxx index 9e8d8df100a4..b0f074b61303 100644 --- a/vcl/quartz/salgdi.cxx +++ b/vcl/quartz/salgdi.cxx @@ -40,7 +40,6 @@ #include #include #include -#include #include #include @@ -407,9 +406,9 @@ bool AquaSalGraphics::GetGlyphBoundRect(const GlyphItem& rGlyph, tools::Rectangl return false; } -void AquaSalGraphics::DrawTextLayout(const CommonSalLayout& rLayout) +void AquaSalGraphics::DrawTextLayout(const GenericSalLayout& rLayout) { - const CoreTextStyle& rStyle = *static_cast(&rLayout.getFont()); + const CoreTextStyle& rStyle = *static_cast(&rLayout.GetFont()); const FontSelectPattern& rFontSelect = rStyle.GetFontSelectPattern(); if (rFontSelect.mnHeight == 0) return; @@ -521,7 +520,7 @@ void AquaSalGraphics::SetFont(const FontSelectPattern* pReqFont, int nFallbackLe std::unique_ptr AquaSalGraphics::GetTextLayout(ImplLayoutArgs& /*rArgs*/, int nFallbackLevel) { if (mpTextStyle[nFallbackLevel]) - return std::unique_ptr(new CommonSalLayout(*mpTextStyle[nFallbackLevel])); + return std::unique_ptr(new GenericSalLayout(*mpTextStyle[nFallbackLevel])); return nullptr; } diff --git a/vcl/source/gdi/CommonSalLayout.cxx b/vcl/source/gdi/CommonSalLayout.cxx index 0cc0c06c382c..33a3a0c83ed3 100644 --- a/vcl/source/gdi/CommonSalLayout.cxx +++ b/vcl/source/gdi/CommonSalLayout.cxx @@ -18,7 +18,10 @@ */ #include -#include + +#include + +#include #include #include @@ -50,7 +53,7 @@ static hb_unicode_funcs_t* getUnicodeFuncs() } #endif -CommonSalLayout::CommonSalLayout(LogicalFontInstance &rFont) +GenericSalLayout::GenericSalLayout(LogicalFontInstance &rFont) : mpFont(&rFont) , mpVertGlyphs(nullptr) , mbFuzzing(utl::ConfigManager::IsFuzzing()) @@ -58,12 +61,12 @@ CommonSalLayout::CommonSalLayout(LogicalFontInstance &rFont) mpFont->Acquire(); } -CommonSalLayout::~CommonSalLayout() +GenericSalLayout::~GenericSalLayout() { mpFont->Release(); } -void CommonSalLayout::ParseFeatures(const OUString& aName) +void GenericSalLayout::ParseFeatures(const OUString& aName) { if (aName.indexOf(FontSelectPatternAttributes::FEAT_PREFIX) < 0) return; @@ -88,10 +91,6 @@ void CommonSalLayout::ParseFeatures(const OUString& aName) while (nIndex >= 0); } -void CommonSalLayout::InitFont() const -{ -} - struct SubRun { int32_t mnMin; @@ -175,12 +174,12 @@ namespace { } // namespace -std::shared_ptr CommonSalLayout::CreateTextLayoutCache(OUString const& rString) const +std::shared_ptr GenericSalLayout::CreateTextLayoutCache(OUString const& rString) const { return std::make_shared(rString.getStr(), rString.getLength()); } -void CommonSalLayout::SetNeedFallback(ImplLayoutArgs& rArgs, sal_Int32 nCharPos, bool bRightToLeft) +void GenericSalLayout::SetNeedFallback(ImplLayoutArgs& rArgs, sal_Int32 nCharPos, bool bRightToLeft) { if (nCharPos < 0 || mbFuzzing) return; @@ -206,7 +205,7 @@ void CommonSalLayout::SetNeedFallback(ImplLayoutArgs& rArgs, sal_Int32 nCharPos, rArgs.NeedFallback(nGraphemeStartPos, nGraphemeEndPos, bRightToLeft); } -void CommonSalLayout::AdjustLayout(ImplLayoutArgs& rArgs) +void GenericSalLayout::AdjustLayout(ImplLayoutArgs& rArgs) { SalLayout::AdjustLayout(rArgs); @@ -222,7 +221,7 @@ void CommonSalLayout::AdjustLayout(ImplLayoutArgs& rArgs) ApplyAsianKerning(rArgs.mrStr); } -void CommonSalLayout::DrawText(SalGraphics& rSalGraphics) const +void GenericSalLayout::DrawText(SalGraphics& rSalGraphics) const { //call platform dependent DrawText functions rSalGraphics.DrawTextLayout( *this ); @@ -232,7 +231,7 @@ void CommonSalLayout::DrawText(SalGraphics& rSalGraphics) const // We don’t check for a specific script or language as it shouldn’t matter // here; if the glyph would be the result from applying “vert” for any // script/language then we want to always treat it as upright glyph. -bool CommonSalLayout::HasVerticalAlternate(sal_UCS4 aChar, sal_UCS4 aVariationSelector) +bool GenericSalLayout::HasVerticalAlternate(sal_UCS4 aChar, sal_UCS4 aVariationSelector) { hb_codepoint_t nGlyphIndex = 0; hb_font_t *pHbFont = mpFont->GetHbFont(); @@ -269,7 +268,7 @@ bool CommonSalLayout::HasVerticalAlternate(sal_UCS4 aChar, sal_UCS4 aVariationSe return hb_set_has(mpVertGlyphs, nGlyphIndex) != 0; } -bool CommonSalLayout::LayoutText(ImplLayoutArgs& rArgs) +bool GenericSalLayout::LayoutText(ImplLayoutArgs& rArgs) { hb_font_t *pHbFont = mpFont->GetHbFont(); hb_face_t* pHbFace = hb_font_get_face(pHbFont); @@ -584,7 +583,7 @@ bool CommonSalLayout::LayoutText(ImplLayoutArgs& rArgs) return true; } -bool CommonSalLayout::GetCharWidths(DeviceCoordinate* pCharWidths) const +bool GenericSalLayout::GetCharWidths(DeviceCoordinate* pCharWidths) const { int nCharCount = mnEndCharPos - mnMinCharPos; @@ -614,7 +613,7 @@ bool CommonSalLayout::GetCharWidths(DeviceCoordinate* pCharWidths) const // * For any RTL glyph that has DX adjustment, insert enough Kashidas to // fill in the added space. -void CommonSalLayout::ApplyDXArray(ImplLayoutArgs& rArgs) +void GenericSalLayout::ApplyDXArray(ImplLayoutArgs& rArgs) { if (rArgs.mpDXArray == nullptr) return; @@ -780,7 +779,7 @@ void CommonSalLayout::ApplyDXArray(ImplLayoutArgs& rArgs) } } -bool CommonSalLayout::IsKashidaPosValid(int nCharPos) const +bool GenericSalLayout::IsKashidaPosValid(int nCharPos) const { for (auto pIter = m_GlyphItems.begin(); pIter != m_GlyphItems.end(); ++pIter) { diff --git a/vcl/source/gdi/sallayout.cxx b/vcl/source/gdi/sallayout.cxx index c1ddd412ca70..2ec7ee80ed66 100644 --- a/vcl/source/gdi/sallayout.cxx +++ b/vcl/source/gdi/sallayout.cxx @@ -691,12 +691,6 @@ bool SalLayout::GetBoundRect( SalGraphics& rSalGraphics, tools::Rectangle& rRect return bRet; } -GenericSalLayout::GenericSalLayout() -{} - -GenericSalLayout::~GenericSalLayout() -{} - void GenericSalLayout::AppendGlyph( const GlyphItem& rGlyphItem ) { m_GlyphItems.push_back(rGlyphItem); diff --git a/vcl/unx/generic/gdi/cairotextrender.cxx b/vcl/unx/generic/gdi/cairotextrender.cxx index d856821de72c..36d1dc9cf1a0 100644 --- a/vcl/unx/generic/gdi/cairotextrender.cxx +++ b/vcl/unx/generic/gdi/cairotextrender.cxx @@ -38,7 +38,7 @@ #include #include -#include +#include namespace { @@ -168,9 +168,9 @@ namespace } } -void CairoTextRender::DrawTextLayout(const CommonSalLayout& rLayout) +void CairoTextRender::DrawTextLayout(const GenericSalLayout& rLayout) { - const FreetypeFontInstance& rInstance = static_cast(rLayout.getFont()); + const FreetypeFontInstance& rInstance = static_cast(rLayout.GetFont()); const FreetypeFont& rFont = *rInstance.GetFreetypeFont(); std::vector cairo_glyphs; @@ -472,7 +472,7 @@ bool CairoTextRender::GetGlyphOutline(const GlyphItem& rGlyph, std::unique_ptr CairoTextRender::GetTextLayout(ImplLayoutArgs& /*rArgs*/, int nFallbackLevel) { if (mpFreetypeFont[nFallbackLevel]) - return std::unique_ptr(new CommonSalLayout(*mpFreetypeFont[nFallbackLevel]->GetFontInstance())); + return std::unique_ptr(new GenericSalLayout(*mpFreetypeFont[nFallbackLevel]->GetFontInstance())); return nullptr; } diff --git a/vcl/unx/generic/gdi/font.cxx b/vcl/unx/generic/gdi/font.cxx index 4de3a9a75acf..ae4ef22e21b9 100644 --- a/vcl/unx/generic/gdi/font.cxx +++ b/vcl/unx/generic/gdi/font.cxx @@ -24,7 +24,7 @@ #include #include #include -#include +#include GC X11SalGraphics::GetFontGC() @@ -53,7 +53,7 @@ X11SalGraphics::GetFontGC() return pFontGC_; } -void X11SalGraphics::DrawTextLayout(const CommonSalLayout& rLayout) +void X11SalGraphics::DrawTextLayout(const GenericSalLayout& rLayout) { mxTextRenderImpl->DrawTextLayout(rLayout); } diff --git a/vcl/unx/generic/print/genpspgraphics.cxx b/vcl/unx/generic/print/genpspgraphics.cxx index c1f1caf014a0..5d0eeeaa405a 100644 --- a/vcl/unx/generic/print/genpspgraphics.cxx +++ b/vcl/unx/generic/print/genpspgraphics.cxx @@ -54,7 +54,7 @@ #include #include #include -#include +#include using namespace psp; @@ -529,12 +529,12 @@ ImplPspFontData::ImplPspFontData(const psp::FastPrintFontInfo& rInfo) mnFontId( rInfo.m_nID ) {} -class PspCommonSalLayout : public CommonSalLayout +class PspSalLayout : public GenericSalLayout { public: - PspCommonSalLayout(psp::PrinterGfx&, FreetypeFont& rFont); + PspSalLayout(psp::PrinterGfx&, FreetypeFont& rFont); - virtual void InitFont() const override; + void InitFont() const final override; private: ::psp::PrinterGfx& mrPrinterGfx; @@ -546,8 +546,8 @@ private: bool mbArtBold; }; -PspCommonSalLayout::PspCommonSalLayout(::psp::PrinterGfx& rGfx, FreetypeFont& rFont) -: CommonSalLayout(*rFont.GetFontInstance()) +PspSalLayout::PspSalLayout(::psp::PrinterGfx& rGfx, FreetypeFont& rFont) +: GenericSalLayout(*rFont.GetFontInstance()) , mrPrinterGfx(rGfx) { mnFontID = mrPrinterGfx.GetFontID(); @@ -558,14 +558,14 @@ PspCommonSalLayout::PspCommonSalLayout(::psp::PrinterGfx& rGfx, FreetypeFont& rF mbArtBold = mrPrinterGfx.GetArtificialBold(); } -void PspCommonSalLayout::InitFont() const +void PspSalLayout::InitFont() const { - CommonSalLayout::InitFont(); + GenericSalLayout::InitFont(); mrPrinterGfx.SetFont(mnFontID, mnFontHeight, mnFontWidth, mnOrientation, mbVertical, mbArtItalic, mbArtBold); } -void GenPspGraphics::DrawTextLayout(const CommonSalLayout& rLayout) +void GenPspGraphics::DrawTextLayout(const GenericSalLayout& rLayout) { const GlyphItem* pGlyph; Point aPos; @@ -763,7 +763,7 @@ bool GenPspGraphics::GetGlyphOutline(const GlyphItem& rGlyph, std::unique_ptr GenPspGraphics::GetTextLayout(ImplLayoutArgs& /*rArgs*/, int nFallbackLevel) { if (m_pFreetypeFont[nFallbackLevel]) - return std::unique_ptr(new PspCommonSalLayout(*m_pPrinterGfx, *m_pFreetypeFont[nFallbackLevel])); + return std::unique_ptr(new PspSalLayout(*m_pPrinterGfx, *m_pFreetypeFont[nFallbackLevel])); return nullptr; } diff --git a/vcl/win/gdi/DWriteTextRenderer.cxx b/vcl/win/gdi/DWriteTextRenderer.cxx index 8006d3f7d0d5..27f24a9332d6 100644 --- a/vcl/win/gdi/DWriteTextRenderer.cxx +++ b/vcl/win/gdi/DWriteTextRenderer.cxx @@ -25,7 +25,6 @@ #include #include -#include #include #include @@ -233,7 +232,7 @@ HRESULT D2DWriteTextOutRenderer::BindDC(HDC hDC, tools::Rectangle const & rRect) return CHECKHR(mpRT->BindDC(hDC, &rc)); } -bool D2DWriteTextOutRenderer::operator ()(CommonSalLayout const & rLayout, SalGraphics& rGraphics, HDC hDC) +bool D2DWriteTextOutRenderer::operator ()(GenericSalLayout const & rLayout, SalGraphics& rGraphics, HDC hDC) { bool bRetry = false; bool bResult = false; @@ -247,7 +246,7 @@ bool D2DWriteTextOutRenderer::operator ()(CommonSalLayout const & rLayout, SalGr return bResult; } -bool D2DWriteTextOutRenderer::performRender(CommonSalLayout const & rLayout, SalGraphics& rGraphics, HDC hDC, bool& bRetry) +bool D2DWriteTextOutRenderer::performRender(GenericSalLayout const & rLayout, SalGraphics& rGraphics, HDC hDC, bool& bRetry) { if (!Ready()) return false; diff --git a/vcl/win/gdi/winlayout.cxx b/vcl/win/gdi/winlayout.cxx index 3b7b6c044083..95034c97372b 100644 --- a/vcl/win/gdi/winlayout.cxx +++ b/vcl/win/gdi/winlayout.cxx @@ -35,7 +35,6 @@ #include #include -#include #include #include @@ -226,7 +225,7 @@ TextOutRenderer & TextOutRenderer::get(bool bUseDWrite) } -bool ExTextOutRenderer::operator ()(CommonSalLayout const &rLayout, +bool ExTextOutRenderer::operator ()(GenericSalLayout const &rLayout, SalGraphics & /*rGraphics*/, HDC hDC) { @@ -234,7 +233,7 @@ bool ExTextOutRenderer::operator ()(CommonSalLayout const &rLayout, HFONT hAltFont = nullptr; bool bUseAltFont = false; bool bShift = false; - if (rLayout.getFont().GetFontSelectPattern().mbVertical) + if (rLayout.GetFont().GetFontSelectPattern().mbVertical) { LOGFONTW aLogFont; GetObjectW(hFont, sizeof(aLogFont), &aLogFont); @@ -291,7 +290,7 @@ std::unique_ptr WinSalGraphics::GetTextLayout(ImplLayoutArgs& /*rArgs assert(mpWinFontEntry[nFallbackLevel]->GetFontFace()); mpWinFontEntry[nFallbackLevel]->SetHDC(getHDC()); - CommonSalLayout *aLayout = new CommonSalLayout(*mpWinFontEntry[nFallbackLevel]); + GenericSalLayout *aLayout = new GenericSalLayout(*mpWinFontEntry[nFallbackLevel]); return std::unique_ptr(aLayout); } @@ -381,14 +380,14 @@ void WinFontInstance::SetHDC(const HDC hDC) m_hDC = hDC; } -bool WinSalGraphics::CacheGlyphs(const CommonSalLayout& rLayout) +bool WinSalGraphics::CacheGlyphs(const GenericSalLayout& rLayout) { static bool bDoGlyphCaching = (std::getenv("SAL_DISABLE_GLYPH_CACHING") == nullptr); if (!bDoGlyphCaching) return false; HDC hDC = getHDC(); - WinFontInstance& rFont = *static_cast(&rLayout.getFont()); + WinFontInstance& rFont = *static_cast(&rLayout.GetFont()); int nStart = 0; Point aPos(0, 0); @@ -405,7 +404,7 @@ bool WinSalGraphics::CacheGlyphs(const CommonSalLayout& rLayout) return true; } -bool WinSalGraphics::DrawCachedGlyphs(const CommonSalLayout& rLayout) +bool WinSalGraphics::DrawCachedGlyphs(const GenericSalLayout& rLayout) { HDC hDC = getHDC(); @@ -419,7 +418,7 @@ bool WinSalGraphics::DrawCachedGlyphs(const CommonSalLayout& rLayout) if (!pImpl) return false; - WinFontInstance& rFont = *static_cast(&rLayout.getFont()); + WinFontInstance& rFont = *static_cast(&rLayout.GetFont()); int nStart = 0; Point aPos(0, 0); @@ -444,22 +443,22 @@ bool WinSalGraphics::DrawCachedGlyphs(const CommonSalLayout& rLayout) return true; } -void WinSalGraphics::DrawTextLayout(const CommonSalLayout& rLayout, HDC hDC, bool bUseDWrite) +void WinSalGraphics::DrawTextLayout(const GenericSalLayout& rLayout, HDC hDC, bool bUseDWrite) { TextOutRenderer &render = TextOutRenderer::get(bUseDWrite); render(rLayout, *this, hDC); } -void WinSalGraphics::DrawTextLayout(const CommonSalLayout& rLayout) +void WinSalGraphics::DrawTextLayout(const GenericSalLayout& rLayout) { HDC hDC = getHDC(); - HFONT hFont = static_cast(&rLayout.getFont())->GetHFONT(); + HFONT hFont = static_cast(&rLayout.GetFont())->GetHFONT(); HGDIOBJ hOrigFont = SelectObject(hDC, hFont); // Our DirectWrite renderer is incomplete, skip it for non-horizontal or // stretched text. - bool bForceGDI = rLayout.GetOrientation() || static_cast(&rLayout.getFont())->hasHScale(); + bool bForceGDI = rLayout.GetOrientation() || static_cast(&rLayout.GetFont())->hasHScale(); bool bUseOpenGL = OpenGLHelper::isVCLOpenGLEnabled() && !mbPrinter; if (!bUseOpenGL) -- cgit