[Libreoffice-commits] core.git: vcl/headless vcl/inc vcl/qt5 vcl/quartz vcl/skia vcl/source vcl/unx vcl/win
vcl/headless/CairoCommon.cxx| 10 ++ vcl/headless/SvpGraphicsBackend.cxx |5 +-- vcl/inc/headless/CairoCommon.hxx|2 - vcl/inc/headless/SvpGraphicsBackend.hxx |2 - vcl/inc/qt5/QtGraphics.hxx |2 - vcl/inc/quartz/salgdi.h |2 - vcl/inc/salgdi.hxx |8 ++--- vcl/inc/salgdiimpl.hxx |2 - vcl/inc/skia/gdiimpl.hxx|2 - vcl/inc/win/salgdi.h|2 - vcl/qt5/QtGraphics_GDI.cxx |9 ++--- vcl/quartz/AquaGraphicsBackend.cxx | 12 +++ vcl/skia/gdiimpl.cxx|7 +--- vcl/source/gdi/salgdilayout.cxx |7 ++-- vcl/source/outdev/line.cxx |3 + vcl/source/outdev/polygon.cxx | 22 +++--- vcl/source/outdev/transparent.cxx | 37 +++- vcl/unx/generic/gdi/X11CairoSalGraphicsImpl.cxx |5 +-- vcl/unx/generic/gdi/X11CairoSalGraphicsImpl.hxx |2 - vcl/win/gdi/gdiimpl.cxx |6 +-- vcl/win/gdi/gdiimpl.hxx |2 - vcl/win/gdi/salgdi_gdiplus.cxx |4 +- 22 files changed, 71 insertions(+), 82 deletions(-) New commits: commit 74963f654768d6f25ac1ea907736731d9a886853 Author: Caolán McNamara AuthorDate: Sun Jul 30 22:03:39 2023 +0100 Commit: Caolán McNamara CommitDate: Mon Jul 31 09:58:28 2023 +0200 all drawPolyPolygon variants return true now since: commit 4998de76ed1da4039e30718941d50d6f1dfe4f82 Date: Sun Jul 30 07:40:48 2023 + tdf#156230: Drop freshly unused GenPspGfxBackend Change-Id: I7fc2a068f80ed392c5d58772d130bf7f51c8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155076 Tested-by: Jenkins Reviewed-by: Caolán McNamara diff --git a/vcl/headless/CairoCommon.cxx b/vcl/headless/CairoCommon.cxx index 417fd633f87e..d1a20ec1624b 100644 --- a/vcl/headless/CairoCommon.cxx +++ b/vcl/headless/CairoCommon.cxx @@ -872,7 +872,7 @@ void CairoCommon::drawPolyPolygon(sal_uInt32 nPoly, const sal_uInt32* pPointCoun drawPolyPolygon(basegfx::B2DHomMatrix(), aPolyPoly, 0.0, bAntiAlias); } -bool CairoCommon::drawPolyPolygon(const basegfx::B2DHomMatrix& rObjectToDevice, +void CairoCommon::drawPolyPolygon(const basegfx::B2DHomMatrix& rObjectToDevice, const basegfx::B2DPolyPolygon& rPolyPolygon, double fTransparency, bool bAntiAlias) { @@ -882,14 +882,14 @@ bool CairoCommon::drawPolyPolygon(const basegfx::B2DHomMatrix& rObjectToDevice, if (0 == rPolyPolygon.count() || !(bHasFill || bHasLine) || fTransparency < 0.0 || fTransparency >= 1.0) { -return true; +return; } // don't bother trying to draw stuff which is effectively invisible basegfx::B2DRange aPolygonRange = rPolyPolygon.getB2DRange(); aPolygonRange.transform(rObjectToDevice); if (aPolygonRange.getWidth() < 0.1 || aPolygonRange.getHeight() < 0.1) -return true; +return; cairo_t* cr = getCairoContext(true, bAntiAlias); if (cairo_status(cr) != CAIRO_STATUS_SUCCESS) @@ -897,7 +897,7 @@ bool CairoCommon::drawPolyPolygon(const basegfx::B2DHomMatrix& rObjectToDevice, SAL_WARN("vcl.gdi", "cannot render to surface: " << cairo_status_to_string(cairo_status(cr))); releaseCairoContext(cr, true, basegfx::B2DRange()); -return true; +return; } clipRegion(cr); @@ -949,8 +949,6 @@ bool CairoCommon::drawPolyPolygon(const basegfx::B2DHomMatrix& rObjectToDevice, // of damage so they can be correctly redrawn extents.transform(rObjectToDevice); releaseCairoContext(cr, true, extents); - -return true; } void CairoCommon::drawPolyLine(sal_uInt32 nPoints, const Point* pPtAry, bool bAntiAlias) diff --git a/vcl/headless/SvpGraphicsBackend.cxx b/vcl/headless/SvpGraphicsBackend.cxx index dafbe75ff3ca..e8d582b98fcc 100644 --- a/vcl/headless/SvpGraphicsBackend.cxx +++ b/vcl/headless/SvpGraphicsBackend.cxx @@ -109,12 +109,11 @@ void SvpGraphicsBackend::drawPolyPolygon(sal_uInt32 nPoly, const sal_uInt32* pPo m_rCairoCommon.drawPolyPolygon(nPoly, pPointCounts, pPtAry, getAntiAlias()); } -bool SvpGraphicsBackend::drawPolyPolygon(const basegfx::B2DHomMatrix& rObjectToDevice, +void SvpGraphicsBackend::drawPolyPolygon(const basegfx::B2DHomMatrix& rObjectToDevice, const basegfx::B2DPolyPolygon& rPolyPolygon, double fTransparency) { -return m_rCairoCommon.drawPolyPolygon(rObjectToDevice, rPolyPolygon, fTransparency, - getAntiAlias()); +
[Libreoffice-commits] core.git: vcl/headless vcl/inc vcl/qt5 vcl/quartz vcl/skia vcl/source vcl/unx vcl/win
vcl/headless/SvpGraphicsBackend.cxx |3 +-- vcl/inc/headless/SvpGraphicsBackend.hxx |2 +- vcl/inc/qt5/QtGraphics.hxx |2 +- vcl/inc/quartz/salgdi.h |2 +- vcl/inc/salgdi.hxx |8 vcl/inc/salgdiimpl.hxx |2 +- vcl/inc/skia/gdiimpl.hxx|2 +- vcl/inc/unx/GenPspGfxBackend.hxx|2 +- vcl/inc/win/salgdi.h|2 +- vcl/qt5/QtGraphics_GDI.cxx |3 +-- vcl/quartz/AquaGraphicsBackend.cxx |4 +--- vcl/skia/gdiimpl.cxx|5 ++--- vcl/source/gdi/salgdilayout.cxx |6 +++--- vcl/source/outdev/clipping.cxx |5 ++--- vcl/unx/generic/gdi/X11CairoSalGraphicsImpl.hxx |4 ++-- vcl/unx/generic/gdi/gdiimpl.cxx |3 +-- vcl/unx/generic/gdi/gdiimpl.hxx |2 +- vcl/unx/generic/print/GenPspGfxBackend.cxx |4 +--- vcl/win/gdi/gdiimpl.cxx |5 + vcl/win/gdi/gdiimpl.hxx |2 +- vcl/win/gdi/salgdi.cxx |4 ++-- 21 files changed, 30 insertions(+), 42 deletions(-) New commits: commit 6f43f00279252265fe4892b46fe0b4686ff721ed Author: Noel Grandin AuthorDate: Tue Dec 20 18:02:32 2022 +0200 Commit: Noel Grandin CommitDate: Wed Dec 21 06:44:59 2022 + No need for bool return value here all of the implementations of this method return true. Change-Id: I6dc02499af1809110edd482a48d9f6d5d42ead19 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144620 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/vcl/headless/SvpGraphicsBackend.cxx b/vcl/headless/SvpGraphicsBackend.cxx index cd5487031a63..10667e53e4dd 100644 --- a/vcl/headless/SvpGraphicsBackend.cxx +++ b/vcl/headless/SvpGraphicsBackend.cxx @@ -34,10 +34,9 @@ void SvpGraphicsBackend::Init() {} void SvpGraphicsBackend::freeResources() {} -bool SvpGraphicsBackend::setClipRegion(const vcl::Region& i_rClip) +void SvpGraphicsBackend::setClipRegion(const vcl::Region& i_rClip) { m_rCairoCommon.m_aClipRegion = i_rClip; -return true; } void SvpGraphicsBackend::ResetClipRegion() { m_rCairoCommon.m_aClipRegion.SetNull(); } diff --git a/vcl/inc/headless/SvpGraphicsBackend.hxx b/vcl/inc/headless/SvpGraphicsBackend.hxx index 997f1bc84e9d..7bd78118f6f4 100644 --- a/vcl/inc/headless/SvpGraphicsBackend.hxx +++ b/vcl/inc/headless/SvpGraphicsBackend.hxx @@ -40,7 +40,7 @@ public: OUString getRenderBackendName() const override { return "svp"; } -bool setClipRegion(vcl::Region const& rRegion) override; +void setClipRegion(vcl::Region const& rRegion) override; void ResetClipRegion() override; sal_uInt16 GetBitCount() const override; diff --git a/vcl/inc/qt5/QtGraphics.hxx b/vcl/inc/qt5/QtGraphics.hxx index b8a168d1a3cf..b87e6d80b648 100644 --- a/vcl/inc/qt5/QtGraphics.hxx +++ b/vcl/inc/qt5/QtGraphics.hxx @@ -68,7 +68,7 @@ public: OUString getRenderBackendName() const override { return "qt5"; } -bool setClipRegion(vcl::Region const& rRegion) override; +void setClipRegion(vcl::Region const& rRegion) override; void ResetClipRegion() override; sal_uInt16 GetBitCount() const override; diff --git a/vcl/inc/quartz/salgdi.h b/vcl/inc/quartz/salgdi.h index 9e070c4215ce..8886d19700a7 100644 --- a/vcl/inc/quartz/salgdi.h +++ b/vcl/inc/quartz/salgdi.h @@ -340,7 +340,7 @@ public: return "aqua"; } -bool setClipRegion(vcl::Region const& rRegion) override; +void setClipRegion(vcl::Region const& rRegion) override; void ResetClipRegion() override; sal_uInt16 GetBitCount() const override; diff --git a/vcl/inc/salgdi.hxx b/vcl/inc/salgdi.hxx index 0b8952b74123..a7fbe287fc48 100644 --- a/vcl/inc/salgdi.hxx +++ b/vcl/inc/salgdi.hxx @@ -183,7 +183,7 @@ public: // non virtual methods; these do possible coordinate mirroring and // then delegate to protected virtual methods -boolSetClipRegion( const vcl::Region&, const OutputDevice& rOutDev ); +voidSetClipRegion( const vcl::Region&, const OutputDevice& rOutDev ); // draw --> LineColor and FillColor and RasterOp and ClipRegion voidDrawPixel( tools::Long nX, tools::Long nY, const OutputDevice& rOutDev ); @@ -426,7 +426,7 @@ protected: friend class vcl::FileDefinitionWidgetDraw; -virtual boolsetClipRegion( const vcl::Region& ) = 0; +virtual voidsetClipRegion( const vcl::Region& ) = 0; // draw --> LineColor and FillColor and RasterOp and ClipRegion virtual voiddrawPixel( tools::Long nX, tools::Long nY ) = 0; @@ -661,9 +661,9 @@ public:
[Libreoffice-commits] core.git: vcl/headless vcl/inc vcl/qt5 vcl/quartz vcl/source vcl/unx vcl/win
vcl/headless/svptext.cxx | 10 - vcl/inc/headless/svpgdi.hxx|2 - vcl/inc/qt5/QtGraphics.hxx |4 -- vcl/inc/quartz/salgdi.h|9 vcl/inc/salgdi.hxx |9 vcl/inc/textrender.hxx |3 - vcl/inc/unx/freetypetextrender.hxx |3 - vcl/inc/unx/genpspgraphics.h |4 -- vcl/inc/unx/salgdi.h |3 - vcl/inc/win/salgdi.h |8 vcl/qt5/QtGraphics_Text.cxx|8 vcl/quartz/salgdi.cxx | 12 -- vcl/source/font/PhysicalFontFace.cxx |6 ++- vcl/source/gdi/embeddedfontshelper.cxx |9 ++-- vcl/unx/generic/gdi/font.cxx | 10 - vcl/unx/generic/gdi/freetypetextrender.cxx | 10 - vcl/unx/generic/print/genpspgraphics.cxx | 47 - vcl/win/gdi/salfont.cxx| 53 - 18 files changed, 10 insertions(+), 200 deletions(-) New commits: commit 112d07027c4484dd571519911596d11eae897524 Author: Khaled Hosny AuthorDate: Sat Oct 1 08:21:58 2022 +0200 Commit: خالد حسني CommitDate: Sat Oct 1 13:09:48 2022 +0200 vcl: Use PhysicalFontFace::GetRawFontData() for font embedding Change-Id: I6f7c4508f7cef022eaf65a998cb242078d3771c6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140826 Tested-by: Jenkins Reviewed-by: خالد حسني diff --git a/vcl/headless/svptext.cxx b/vcl/headless/svptext.cxx index 782caba56971..a41d3df1705a 100644 --- a/vcl/headless/svptext.cxx +++ b/vcl/headless/svptext.cxx @@ -62,16 +62,6 @@ bool SvpSalGraphics::AddTempDevFont( vcl::font::PhysicalFontCollection* pFontCol return m_aTextRenderImpl.AddTempDevFont(pFontCollection, rFileURL, rFontName); } -const void* SvpSalGraphics::GetEmbedFontData(const vcl::font::PhysicalFontFace* pFont, tools::Long* pDataLen) -{ -return m_aTextRenderImpl.GetEmbedFontData(pFont, pDataLen); -} - -void SvpSalGraphics::FreeEmbedFontData( const void* pData, tools::Long nLen ) -{ -m_aTextRenderImpl.FreeEmbedFontData(pData, nLen); -} - std::unique_ptr SvpSalGraphics::GetTextLayout(int nFallbackLevel) { return m_aTextRenderImpl.GetTextLayout(nFallbackLevel); diff --git a/vcl/inc/headless/svpgdi.hxx b/vcl/inc/headless/svpgdi.hxx index 7158a020eb6b..9197e83c20db 100644 --- a/vcl/inc/headless/svpgdi.hxx +++ b/vcl/inc/headless/svpgdi.hxx @@ -77,8 +77,6 @@ public: virtual voidGetDevFontList( vcl::font::PhysicalFontCollection* ) override; virtual void ClearDevFontCache() override; virtual boolAddTempDevFont( vcl::font::PhysicalFontCollection*, const OUString& rFileURL, const OUString& rFontName ) override; -virtual const void* GetEmbedFontData(const vcl::font::PhysicalFontFace*, tools::Long* pDataLen) override; -virtual voidFreeEmbedFontData( const void* pData, tools::Long nDataLen ) override; virtual std::unique_ptr GetTextLayout(int nFallbackLevel) override; virtual voidDrawTextLayout( const GenericSalLayout& ) override; diff --git a/vcl/inc/qt5/QtGraphics.hxx b/vcl/inc/qt5/QtGraphics.hxx index 987ab1601f38..b8a168d1a3cf 100644 --- a/vcl/inc/qt5/QtGraphics.hxx +++ b/vcl/inc/qt5/QtGraphics.hxx @@ -232,10 +232,6 @@ public: virtual bool AddTempDevFont(vcl::font::PhysicalFontCollection*, const OUString& rFileURL, const OUString& rFontName) override; -virtual const void* GetEmbedFontData(const vcl::font::PhysicalFontFace*, - tools::Long* pDataLen) override; -virtual void FreeEmbedFontData(const void* pData, tools::Long nDataLen) override; - virtual std::unique_ptr GetTextLayout(int nFallbackLevel) override; virtual void DrawTextLayout(const GenericSalLayout&) override; }; diff --git a/vcl/inc/quartz/salgdi.h b/vcl/inc/quartz/salgdi.h index ec63592431e3..0bf004033c52 100644 --- a/vcl/inc/quartz/salgdi.h +++ b/vcl/inc/quartz/salgdi.h @@ -536,15 +536,6 @@ public: virtual voidClearDevFontCache() override; virtual boolAddTempDevFont( vcl::font::PhysicalFontCollection*, const OUString& rFileURL, const OUString& rFontName ) override; -// GetEmbedFontData: gets the font data for a font marked -// embeddable by GetDevFontList or NULL in case of error -// parameters: pFont: describes the font in question -// pDataLen: out parameter, contains the byte length of the returned buffer -virtual const void* GetEmbedFontData(const vcl::font::PhysicalFontFace*, tools::Long* pDataLen) -override; -// frees the font data again -virtual voidFreeEmbedFontData( const void* pData, tools::Long nDataLen ) override; - virtual std::unique_ptr
[Libreoffice-commits] core.git: vcl/headless vcl/inc vcl/qt5 vcl/quartz vcl/source vcl/unx vcl/win
vcl/headless/svptext.cxx| 11 -- vcl/inc/font/PhysicalFontFace.hxx | 14 +++ vcl/inc/headless/svpgdi.hxx |7 - vcl/inc/qt5/QtGraphics.hxx |5 - vcl/inc/quartz/salgdi.h | 19 vcl/inc/salgdi.hxx | 21 - vcl/inc/textrender.hxx |7 - vcl/inc/unx/fontmanager.hxx | 18 vcl/inc/unx/freetypetextrender.hxx |7 - vcl/inc/unx/genpspgraphics.h|6 - vcl/inc/unx/salgdi.h|8 - vcl/inc/win/salgdi.h| 19 vcl/qt5/QtGraphics_Text.cxx | 32 --- vcl/quartz/salgdicommon.cxx | 44 -- vcl/source/font/PhysicalFontFace.cxx| 35 vcl/source/gdi/pdfwriter_impl.cxx | 13 --- vcl/unx/generic/fontmanager/fontmanager.cxx | 113 vcl/unx/generic/gdi/font.cxx| 13 --- vcl/unx/generic/gdi/freetypetextrender.cxx | 19 vcl/unx/generic/print/genpspgraphics.cxx| 19 vcl/win/gdi/salfont.cxx | 33 21 files changed, 53 insertions(+), 410 deletions(-) New commits: commit 38db900c1f7b471dfdf575bbda522a792db51372 Author: Khaled Hosny AuthorDate: Sun Sep 11 06:27:23 2022 +0200 Commit: خالد حسني CommitDate: Sun Sep 11 09:54:16 2022 +0200 vcl: Move CreateFontSubset() to PhysicalFontFace Having it in SalGraphics is not necessary as the code now depends on PhysicalFontFace for accessing raw font data, and this consolidates all the near identical copies of this code into one. Change-Id: I8a411f102fd2188a456bdeb8a0d794078d74e47b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139762 Tested-by: Jenkins Reviewed-by: خالد حسني diff --git a/vcl/headless/svptext.cxx b/vcl/headless/svptext.cxx index 26d0d3966f4e..782caba56971 100644 --- a/vcl/headless/svptext.cxx +++ b/vcl/headless/svptext.cxx @@ -62,17 +62,6 @@ bool SvpSalGraphics::AddTempDevFont( vcl::font::PhysicalFontCollection* pFontCol return m_aTextRenderImpl.AddTempDevFont(pFontCollection, rFileURL, rFontName); } -bool SvpSalGraphics::CreateFontSubset( -const OUString& rToFile, -const vcl::font::PhysicalFontFace* pFont, -const sal_GlyphId* pGlyphIds, -const sal_uInt8* pEncoding, -int nGlyphCount, -FontSubsetInfo& rInfo) -{ -return m_aTextRenderImpl.CreateFontSubset(rToFile, pFont, pGlyphIds, pEncoding, nGlyphCount, rInfo); -} - const void* SvpSalGraphics::GetEmbedFontData(const vcl::font::PhysicalFontFace* pFont, tools::Long* pDataLen) { return m_aTextRenderImpl.GetEmbedFontData(pFont, pDataLen); diff --git a/vcl/inc/font/PhysicalFontFace.hxx b/vcl/inc/font/PhysicalFontFace.hxx index 3f59dd3b25e4..8521ce752f32 100644 --- a/vcl/inc/font/PhysicalFontFace.hxx +++ b/vcl/inc/font/PhysicalFontFace.hxx @@ -29,6 +29,7 @@ #include #include +#include #include @@ -111,6 +112,19 @@ public: bool IsBetterMatch(const vcl::font::FontSelectPattern&, FontMatchStatus&) const; sal_Int32 CompareIgnoreSize(const PhysicalFontFace&) const; +// CreateFontSubset: a method to get a subset of glyhps of a font inside a +// new valid font file +// returns true if creation of subset was successful +// parameters: rToFile: contains an osl file URL to write the subset to +// pGlyphIDs: the glyph ids to be extracted +// pEncoding: the character code corresponding to each glyph +// nGlyphs: the number of glyphs +// rInfo: additional outgoing information +// implementation note: encoding 0 with glyph id 0 should be added implicitly +// as "undefined character" +bool CreateFontSubset(const OUString&, const sal_GlyphId*, const sal_uInt8*, const int, + FontSubsetInfo&) const; + virtual hb_face_t* GetHbFace() const; virtual hb_blob_t* GetHbTable(hb_tag_t) const { diff --git a/vcl/inc/headless/svpgdi.hxx b/vcl/inc/headless/svpgdi.hxx index 441ccf201861..04e6bfa3eddf 100644 --- a/vcl/inc/headless/svpgdi.hxx +++ b/vcl/inc/headless/svpgdi.hxx @@ -77,13 +77,6 @@ public: virtual voidGetDevFontList( vcl::font::PhysicalFontCollection* ) override; virtual void ClearDevFontCache() override; virtual boolAddTempDevFont( vcl::font::PhysicalFontCollection*, const OUString& rFileURL, const OUString& rFontName ) override; -virtual boolCreateFontSubset( const OUString& rToFile, - const vcl::font::PhysicalFontFace*, - const sal_GlyphId* pGlyphIds, - const sal_uInt8* pEncoding, - int nGlyphs, -
[Libreoffice-commits] core.git: vcl/headless vcl/inc vcl/qt5 vcl/quartz vcl/source vcl/unx vcl/win
vcl/headless/svptext.cxx|3 +-- vcl/inc/fontsubset.hxx |8 vcl/inc/headless/svpgdi.hxx |1 - vcl/inc/qt5/QtGraphics.hxx |2 +- vcl/inc/quartz/salgdi.h |1 - vcl/inc/salgdi.hxx |7 +++ vcl/inc/textrender.hxx |1 - vcl/inc/unx/fontmanager.hxx |1 - vcl/inc/unx/freetypetextrender.hxx |1 - vcl/inc/unx/genpspgraphics.h|1 - vcl/inc/unx/salgdi.h|1 - vcl/inc/win/salgdi.h|1 - vcl/qt5/QtGraphics_Text.cxx |7 +++ vcl/quartz/salgdicommon.cxx |8 vcl/source/fontsubset/cff.cxx | 14 -- vcl/source/fontsubset/fontsubset.cxx| 15 +++ vcl/source/gdi/pdfwriter_impl.cxx |4 ++-- vcl/source/gdi/salgdilayout.cxx | 23 --- vcl/unx/generic/fontmanager/fontmanager.cxx | 23 +-- vcl/unx/generic/gdi/font.cxx|3 +-- vcl/unx/generic/gdi/freetypetextrender.cxx |2 -- vcl/unx/generic/print/genpspgraphics.cxx|2 -- vcl/win/gdi/salfont.cxx |8 23 files changed, 39 insertions(+), 98 deletions(-) New commits: commit 394655636307de3ba3c4b2d52f3c1abf4b900e18 Author: Khaled Hosny AuthorDate: Mon Sep 5 22:36:20 2022 +0200 Commit: خالد حسني CommitDate: Tue Sep 6 15:09:57 2022 +0200 vcl: Drop unused SalGraphics::CreateFontSubset() argument pWidths is always nullptr. Change-Id: I1c666f146865786269e9513cbb6c8ffdc7df96e7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139461 Tested-by: Jenkins Reviewed-by: خالد حسني diff --git a/vcl/headless/svptext.cxx b/vcl/headless/svptext.cxx index 269061ea831d..26d0d3966f4e 100644 --- a/vcl/headless/svptext.cxx +++ b/vcl/headless/svptext.cxx @@ -67,11 +67,10 @@ bool SvpSalGraphics::CreateFontSubset( const vcl::font::PhysicalFontFace* pFont, const sal_GlyphId* pGlyphIds, const sal_uInt8* pEncoding, -sal_Int32* pWidths, int nGlyphCount, FontSubsetInfo& rInfo) { -return m_aTextRenderImpl.CreateFontSubset(rToFile, pFont, pGlyphIds, pEncoding, pWidths, nGlyphCount, rInfo); +return m_aTextRenderImpl.CreateFontSubset(rToFile, pFont, pGlyphIds, pEncoding, nGlyphCount, rInfo); } const void* SvpSalGraphics::GetEmbedFontData(const vcl::font::PhysicalFontFace* pFont, tools::Long* pDataLen) diff --git a/vcl/inc/fontsubset.hxx b/vcl/inc/fontsubset.hxx index 2aed0a393e82..fef6603cd2fd 100644 --- a/vcl/inc/fontsubset.hxx +++ b/vcl/inc/fontsubset.hxx @@ -59,7 +59,7 @@ public: boolCreateFontSubset( FontType nOutFontTypeMask, FILE* pOutFile, const char* pOutFontName, const sal_GlyphId* pGlyphIds, const sal_uInt8* pEncodedIds, -int nReqGlyphCount, sal_Int32* pOutGlyphWidths = nullptr ); +int nReqGlyphCount); public: // TODO: make subsetter results private and provide accessor methods instead // subsetter-provided subset details needed by e.g. Postscript or PDF @@ -85,9 +85,9 @@ private: const sal_uInt8*mpReqEncodedIds; int mnReqGlyphCount; -boolCreateFontSubsetFromCff( sal_Int32* pOutGlyphWidths ); -boolCreateFontSubsetFromSfnt( sal_Int32* pOutGlyphWidths ); -static bool CreateFontSubsetFromType1( const sal_Int32* pOutGlyphWidths ); +boolCreateFontSubsetFromCff(); +boolCreateFontSubsetFromSfnt(); +static bool CreateFontSubsetFromType1(); }; int VCL_DLLPUBLIC TestFontSubset(const void* data, sal_uInt32 size); diff --git a/vcl/inc/headless/svpgdi.hxx b/vcl/inc/headless/svpgdi.hxx index 83db19878f4d..441ccf201861 100644 --- a/vcl/inc/headless/svpgdi.hxx +++ b/vcl/inc/headless/svpgdi.hxx @@ -81,7 +81,6 @@ public: const vcl::font::PhysicalFontFace*, const sal_GlyphId* pGlyphIds, const sal_uInt8* pEncoding, - sal_Int32* pWidths, int nGlyphs, FontSubsetInfo& rInfo ) override; diff --git a/vcl/inc/qt5/QtGraphics.hxx b/vcl/inc/qt5/QtGraphics.hxx index d7b25a9a150a..e8f5fdd9a58e 100644 --- a/vcl/inc/qt5/QtGraphics.hxx +++ b/vcl/inc/qt5/QtGraphics.hxx @@ -233,7 +233,7 @@ public: const OUString& rFontName) override; virtual bool CreateFontSubset(const OUString& rToFile, const vcl::font::PhysicalFontFace* pFont, const sal_GlyphId*
[Libreoffice-commits] core.git: vcl/headless vcl/inc vcl/qt5 vcl/quartz vcl/source vcl/unx vcl/win
vcl/headless/svptext.cxx|8 vcl/inc/headless/svpgdi.hxx |4 -- vcl/inc/qt5/QtGraphics.hxx |3 - vcl/inc/quartz/salgdi.h |5 -- vcl/inc/salgdi.hxx | 15 --- vcl/inc/textrender.hxx |5 -- vcl/inc/unx/fontmanager.hxx |4 -- vcl/inc/unx/freetypetextrender.hxx |5 -- vcl/inc/unx/genpspgraphics.h|8 vcl/inc/unx/salgdi.h|6 --- vcl/inc/win/salgdi.h|4 -- vcl/qt5/QtGraphics_Text.cxx |9 vcl/quartz/salgdi.cxx | 26 - vcl/source/gdi/salgdilayout.cxx | 46 vcl/unx/generic/fontmanager/fontmanager.cxx | 53 vcl/unx/generic/gdi/font.cxx|8 vcl/unx/generic/gdi/freetypetextrender.cxx |8 vcl/unx/generic/print/genpspgraphics.cxx| 17 vcl/win/gdi/salfont.cxx | 28 -- 19 files changed, 262 deletions(-) New commits: commit 70e97793769baaa8e0fbb8d8d3949655c4aeb654 Author: Khaled Hosny AuthorDate: Mon Sep 5 21:50:05 2022 +0200 Commit: خالد حسني CommitDate: Tue Sep 6 15:08:34 2022 +0200 vcl: Drop now unused SalGraphics::GetGlyphWidths() Change-Id: Iec8974d6fc67d9d599c5e92aa325225963da0021 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139459 Tested-by: Jenkins Reviewed-by: خالد حسني diff --git a/vcl/headless/svptext.cxx b/vcl/headless/svptext.cxx index d702ec89a5ca..269061ea831d 100644 --- a/vcl/headless/svptext.cxx +++ b/vcl/headless/svptext.cxx @@ -84,14 +84,6 @@ void SvpSalGraphics::FreeEmbedFontData( const void* pData, tools::Long nLen ) m_aTextRenderImpl.FreeEmbedFontData(pData, nLen); } -void SvpSalGraphics::GetGlyphWidths( const vcl::font::PhysicalFontFace* pFont, - bool bVertical, - std::vector< sal_Int32 >& rWidths, - Ucs2UIntMap& rUnicodeEnc ) -{ -m_aTextRenderImpl.GetGlyphWidths(pFont, bVertical, rWidths, rUnicodeEnc); -} - std::unique_ptr SvpSalGraphics::GetTextLayout(int nFallbackLevel) { return m_aTextRenderImpl.GetTextLayout(nFallbackLevel); diff --git a/vcl/inc/headless/svpgdi.hxx b/vcl/inc/headless/svpgdi.hxx index a63e7f289abf..83db19878f4d 100644 --- a/vcl/inc/headless/svpgdi.hxx +++ b/vcl/inc/headless/svpgdi.hxx @@ -87,10 +87,6 @@ public: ) override; virtual const void* GetEmbedFontData(const vcl::font::PhysicalFontFace*, tools::Long* pDataLen) override; virtual voidFreeEmbedFontData( const void* pData, tools::Long nDataLen ) override; -virtual voidGetGlyphWidths( const vcl::font::PhysicalFontFace*, -bool bVertical, -std::vector< sal_Int32 >& rWidths, -Ucs2UIntMap& rUnicodeEnc ) override; virtual std::unique_ptr GetTextLayout(int nFallbackLevel) override; virtual voidDrawTextLayout( const GenericSalLayout& ) override; diff --git a/vcl/inc/qt5/QtGraphics.hxx b/vcl/inc/qt5/QtGraphics.hxx index fed7c2cb88f0..d7b25a9a150a 100644 --- a/vcl/inc/qt5/QtGraphics.hxx +++ b/vcl/inc/qt5/QtGraphics.hxx @@ -241,9 +241,6 @@ public: tools::Long* pDataLen) override; virtual void FreeEmbedFontData(const void* pData, tools::Long nDataLen) override; -virtual void GetGlyphWidths(const vcl::font::PhysicalFontFace*, bool bVertical, -std::vector& rWidths, Ucs2UIntMap& rUnicodeEnc) override; - virtual std::unique_ptr GetTextLayout(int nFallbackLevel) override; virtual void DrawTextLayout(const GenericSalLayout&) override; }; diff --git a/vcl/inc/quartz/salgdi.h b/vcl/inc/quartz/salgdi.h index 6ec586ac1bdd..e2bd63306158 100644 --- a/vcl/inc/quartz/salgdi.h +++ b/vcl/inc/quartz/salgdi.h @@ -566,11 +566,6 @@ public: // frees the font data again virtual voidFreeEmbedFontData( const void* pData, tools::Long nDataLen ) override; -virtual voidGetGlyphWidths( const vcl::font::PhysicalFontFace*, -bool bVertical, -std::vector< sal_Int32 >& rWidths, -Ucs2UIntMap& rUnicodeEnc ) override; - virtual std::unique_ptr GetTextLayout(int nFallbackLevel) override; virtual voidDrawTextLayout( const GenericSalLayout& ) override; diff --git a/vcl/inc/salgdi.hxx b/vcl/inc/salgdi.hxx index a050e4588042..4b2304ac8efd 100644 ---
[Libreoffice-commits] core.git: vcl/headless vcl/inc vcl/qt5 vcl/unx
vcl/headless/svpcairotextrender.cxx |4 ++-- vcl/inc/headless/svpgdi.hxx |8 vcl/qt5/QtSvpSurface.cxx |2 +- vcl/unx/gtk3/gtkcairo.cxx |2 +- vcl/unx/gtk3/salnativewidgets-gtk.cxx |2 +- 5 files changed, 9 insertions(+), 9 deletions(-) New commits: commit 463c851ac898a81465632d090a1d2c8fcc3ca297 Author: Noel Grandin AuthorDate: Thu Mar 24 09:05:07 2022 +0200 Commit: Noel Grandin CommitDate: Thu Mar 24 19:54:04 2022 +0100 loplugin:constantparam Change-Id: I6bfbd0cb5c2eac60bdac69fd862154fb2f537a89 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132030 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/vcl/headless/svpcairotextrender.cxx b/vcl/headless/svpcairotextrender.cxx index 9abd5902864d..c64bafae0969 100644 --- a/vcl/headless/svpcairotextrender.cxx +++ b/vcl/headless/svpcairotextrender.cxx @@ -16,7 +16,7 @@ SvpCairoTextRender::SvpCairoTextRender(SvpSalGraphics& rParent) { } -cairo_t* SvpCairoTextRender::getCairoContext() { return mrParent.getCairoContext(false); } +cairo_t* SvpCairoTextRender::getCairoContext() { return mrParent.getCairoContext(); } void SvpCairoTextRender::getSurfaceOffset(double& nDX, double& nDY) { @@ -28,7 +28,7 @@ void SvpCairoTextRender::clipRegion(cairo_t* cr) { mrParent.clipRegion(cr); } void SvpCairoTextRender::releaseCairoContext(cairo_t* cr) { -mrParent.releaseCairoContext(cr, false, basegfx::B2DRange()); +mrParent.releaseCairoContext(cr, basegfx::B2DRange()); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/headless/svpgdi.hxx b/vcl/inc/headless/svpgdi.hxx index b3b932cc3d73..a63e7f289abf 100644 --- a/vcl/inc/headless/svpgdi.hxx +++ b/vcl/inc/headless/svpgdi.hxx @@ -105,14 +105,14 @@ public: virtual css::uno::Any GetNativeSurfaceHandle(cairo::SurfaceSharedPtr& rSurface, const basegfx::B2ISize& rSize) const override; #endif // ENABLE_CAIRO_CANVAS -cairo_t* getCairoContext(bool bXorModeAllowed) const +cairo_t* getCairoContext() const { -return m_aCairoCommon.getCairoContext(bXorModeAllowed, getAntiAlias()); +return m_aCairoCommon.getCairoContext(/*bXorModeAllowed*/false, getAntiAlias()); } -void releaseCairoContext(cairo_t* cr, bool bXorModeAllowed, const basegfx::B2DRange& rExtents) const +void releaseCairoContext(cairo_t* cr, const basegfx::B2DRange& rExtents) const { -return m_aCairoCommon.releaseCairoContext(cr, bXorModeAllowed, rExtents); +return m_aCairoCommon.releaseCairoContext(cr, /*bXorModeAllowed*/false, rExtents); } void clipRegion(cairo_t* cr) diff --git a/vcl/qt5/QtSvpSurface.cxx b/vcl/qt5/QtSvpSurface.cxx index 456de177ce2c..a2a39c12b387 100644 --- a/vcl/qt5/QtSvpSurface.cxx +++ b/vcl/qt5/QtSvpSurface.cxx @@ -42,7 +42,7 @@ QtSvpSurface::QtSvpSurface(const CairoSurfaceSharedPtr& pSurface) QtSvpSurface::QtSvpSurface(const QtSvpGraphics* pGraphics, int x, int y, int width, int height) : m_pGraphics(pGraphics) -, m_pCairoContext(pGraphics->getCairoContext(false)) +, m_pCairoContext(pGraphics->getCairoContext()) { cairo_surface_t* surface = cairo_get_target(m_pCairoContext); m_pSurface.reset(cairo_surface_create_for_rectangle(surface, x, y, width, height), diff --git a/vcl/unx/gtk3/gtkcairo.cxx b/vcl/unx/gtk3/gtkcairo.cxx index 8c684295f046..202e3244d617 100644 --- a/vcl/unx/gtk3/gtkcairo.cxx +++ b/vcl/unx/gtk3/gtkcairo.cxx @@ -55,7 +55,7 @@ namespace cairo **/ Gtk3Surface::Gtk3Surface(const GtkSalGraphics* pGraphics, int x, int y, int width, int height) : mpGraphics(pGraphics) -, cr(pGraphics->getCairoContext(false)) +, cr(pGraphics->getCairoContext()) { cairo_surface_t* surface = cairo_get_target(cr); mpSurface.reset( diff --git a/vcl/unx/gtk3/salnativewidgets-gtk.cxx b/vcl/unx/gtk3/salnativewidgets-gtk.cxx index 0505010bea81..e2cef41100ec 100644 --- a/vcl/unx/gtk3/salnativewidgets-gtk.cxx +++ b/vcl/unx/gtk3/salnativewidgets-gtk.cxx @@ -1802,7 +1802,7 @@ bool GtkSalGraphics::drawNativeControl( ControlType nType, ControlPart nPart, co return false; } -cairo_t *cr = getCairoContext(false); +cairo_t *cr = getCairoContext(); clipRegion(cr); cairo_translate(cr, rControlRegion.Left(), rControlRegion.Top());
[Libreoffice-commits] core.git: vcl/headless vcl/inc vcl/qt5
vcl/headless/SvpGraphicsBackend.cxx | 177 +- vcl/headless/svpgdi.cxx | 185 vcl/inc/headless/SvpGraphicsBackend.hxx |3 vcl/inc/headless/svpgdi.hxx | 13 -- vcl/qt5/QtSvpGraphics.cxx |3 5 files changed, 175 insertions(+), 206 deletions(-) New commits: commit 581bed6233f31ec5eafb1231fcb93bc3f583f9cb Author: Tomaž Vajngerl AuthorDate: Thu Dec 30 00:14:26 2021 +0900 Commit: Tomaž Vajngerl CommitDate: Wed Jan 5 04:36:06 2022 +0100 vcl: move drawBitmap, drawMask functions to SvpGraphicsBackend Also fix the QTSvpGraphics that uses a special drawBitmap (renamed to drawBitmapBuffer) call and moved in also to SvpGraphicsBackend. Change-Id: Ic50630ba23e35a62ea3d5aaa0955a7666f2bca68 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127980 Tested-by: Tomaž Vajngerl Reviewed-by: Tomaž Vajngerl diff --git a/vcl/headless/SvpGraphicsBackend.cxx b/vcl/headless/SvpGraphicsBackend.cxx index 71670cb37bd1..c67f19d5665d 100644 --- a/vcl/headless/SvpGraphicsBackend.cxx +++ b/vcl/headless/SvpGraphicsBackend.cxx @@ -23,6 +23,7 @@ #include #include #include +#include SvpGraphicsBackend::SvpGraphicsBackend(CairoCommon& rCairoCommon) : m_rCairoCommon(rCairoCommon) @@ -380,18 +381,103 @@ void SvpGraphicsBackend::copyBits(const SalTwoRect& rTR, SalGraphics* pSrcGraphi m_rCairoCommon.copyBitsCairo(rTR, source, getAntiAlias()); } -void SvpGraphicsBackend::drawBitmap(const SalTwoRect& /*rPosAry*/, const SalBitmap& /*rSalBitmap*/) +void SvpGraphicsBackend::drawBitmap(const SalTwoRect& rPosAry, const SalBitmap& rSalBitmap) { +// MM02 try to access buffered BitmapHelper +std::shared_ptr aSurface; +tryToUseSourceBuffer(rSalBitmap, aSurface); +cairo_surface_t* source = aSurface->getSurface(rPosAry.mnDestWidth, rPosAry.mnDestHeight); + +if (!source) +{ +SAL_WARN("vcl.gdi", "unsupported SvpSalGraphics::drawAlphaBitmap case"); +return; +} + +#if 0 // LO code is not yet bitmap32-ready. \ +// if m_bSupportsBitmap32 becomes true for Svp revisit this +m_rCairoCommon.copyWithOperator(rPosAry, source, CAIRO_OPERATOR_OVER, getAntiAlias()); +#else +m_rCairoCommon.copyWithOperator(rPosAry, source, CAIRO_OPERATOR_SOURCE, getAntiAlias()); +#endif } -void SvpGraphicsBackend::drawBitmap(const SalTwoRect& /*rPosAry*/, const SalBitmap& /*rSalBitmap*/, -const SalBitmap& /*rMaskBitmap*/) +void SvpGraphicsBackend::drawBitmap(const SalTwoRect& rPosAry, const SalBitmap& rSalBitmap, +const SalBitmap& rTransparentBitmap) { +drawAlphaBitmap(rPosAry, rSalBitmap, rTransparentBitmap); } -void SvpGraphicsBackend::drawMask(const SalTwoRect& /*rPosAry*/, const SalBitmap& /*rSalBitmap*/, - Color /*nMaskColor*/) +void SvpGraphicsBackend::drawMask(const SalTwoRect& rTR, const SalBitmap& rSalBitmap, + Color nMaskColor) { +/** creates an image from the given rectangle, replacing all black pixels + * with nMaskColor and make all other full transparent */ +// MM02 here decided *against* using buffered BitmapHelper +// because the data gets somehow 'unmuliplied'. This may also be +// done just once, but I am not sure if this is safe to do. +// So for now dispense re-using data here. +BitmapHelper aSurface(rSalBitmap, true); // The mask is argb32 +if (!aSurface.getSurface()) +{ +SAL_WARN("vcl.gdi", "unsupported SvpSalGraphics::drawMask case"); +return; +} +sal_Int32 nStride; +unsigned char* mask_data = aSurface.getBits(nStride); +vcl::bitmap::lookup_table const& unpremultiply_table = vcl::bitmap::get_unpremultiply_table(); +for (tools::Long y = rTR.mnSrcY; y < rTR.mnSrcY + rTR.mnSrcHeight; ++y) +{ +unsigned char* row = mask_data + (nStride * y); +unsigned char* data = row + (rTR.mnSrcX * 4); +for (tools::Long x = rTR.mnSrcX; x < rTR.mnSrcX + rTR.mnSrcWidth; ++x) +{ +sal_uInt8 a = data[SVP_CAIRO_ALPHA]; +sal_uInt8 b = unpremultiply_table[a][data[SVP_CAIRO_BLUE]]; +sal_uInt8 g = unpremultiply_table[a][data[SVP_CAIRO_GREEN]]; +sal_uInt8 r = unpremultiply_table[a][data[SVP_CAIRO_RED]]; +if (r == 0 && g == 0 && b == 0) +{ +data[0] = nMaskColor.GetBlue(); +data[1] = nMaskColor.GetGreen(); +data[2] = nMaskColor.GetRed(); +data[3] = 0xff; +} +else +{ +data[0] = 0; +data[1] = 0; +data[2] = 0; +data[3] = 0; +} +data += 4; +} +} +
[Libreoffice-commits] core.git: vcl/headless vcl/inc vcl/qt5 vcl/quartz vcl/skia vcl/source vcl/unx vcl/win
vcl/headless/svpinst.cxx |4 ++-- vcl/inc/headless/svpinst.hxx |2 +- vcl/inc/osx/salinst.h |2 +- vcl/inc/qt5/Qt5Instance.hxx |2 +- vcl/inc/salinst.hxx |2 +- vcl/inc/skia/x11/salvd.hxx|2 +- vcl/inc/unx/gtk/gtkinst.hxx |2 +- vcl/inc/unx/salinst.h |4 ++-- vcl/inc/unx/salvd.h |2 +- vcl/inc/win/salinst.h |2 +- vcl/qt5/Qt5Instance.cxx |4 ++-- vcl/quartz/salvd.cxx |6 +++--- vcl/skia/x11/salvd.cxx|5 ++--- vcl/source/gdi/virdev.cxx |4 ++-- vcl/unx/generic/gdi/salvd.cxx | 18 -- vcl/unx/gtk3/gtk3gtkinst.cxx |4 ++-- vcl/win/gdi/salvd.cxx | 10 +- 17 files changed, 36 insertions(+), 39 deletions(-) New commits: commit 3d65c10f39e191b7e1ceb6fc94fed9e6196de0aa Author: Caolán McNamara AuthorDate: Fri Apr 30 21:14:57 2021 +0100 Commit: Caolán McNamara CommitDate: Sat May 1 17:08:41 2021 +0200 Related: cid#1478001 CreateVirtualDevice never passed a null pGraphics arg Change-Id: I0701b15a28ab3583586c0c8018c511e100b41a93 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114948 Tested-by: Jenkins Reviewed-by: Caolán McNamara diff --git a/vcl/headless/svpinst.cxx b/vcl/headless/svpinst.cxx index 422928f98d38..700c6b87f645 100644 --- a/vcl/headless/svpinst.cxx +++ b/vcl/headless/svpinst.cxx @@ -241,12 +241,12 @@ void SvpSalInstance::DestroyObject( SalObject* pObject ) #ifndef IOS -std::unique_ptr SvpSalInstance::CreateVirtualDevice(SalGraphics* pGraphics, +std::unique_ptr SvpSalInstance::CreateVirtualDevice(SalGraphics& rGraphics, tools::Long , tools::Long , DeviceFormat /*eFormat*/, const SystemGraphicsData* pGd) { -SvpSalGraphics *pSvpSalGraphics = dynamic_cast(pGraphics); +SvpSalGraphics *pSvpSalGraphics = dynamic_cast(); assert(pSvpSalGraphics); #ifndef ANDROID // tdf#127529 normally pPreExistingTarget is null and we are a true virtualdevice drawing to a backing buffer. diff --git a/vcl/inc/headless/svpinst.hxx b/vcl/inc/headless/svpinst.hxx index e95353a0c227..2f48049b4839 100644 --- a/vcl/inc/headless/svpinst.hxx +++ b/vcl/inc/headless/svpinst.hxx @@ -134,7 +134,7 @@ public: // nBitCount: 0 == Default(=as window) / 1 == Mono // pData allows for using a system dependent graphics or device context virtual std::unique_ptr -CreateVirtualDevice( SalGraphics* pGraphics, +CreateVirtualDevice( SalGraphics& rGraphics, tools::Long , tools::Long , DeviceFormat eFormat, const SystemGraphicsData *pData = nullptr ) override; diff --git a/vcl/inc/osx/salinst.h b/vcl/inc/osx/salinst.h index 97cbe37e2038..e143f970db0d 100644 --- a/vcl/inc/osx/salinst.h +++ b/vcl/inc/osx/salinst.h @@ -101,7 +101,7 @@ public: bool bShow ) override; virtual voidDestroyObject( SalObject* pObject ) override; virtual std::unique_ptr -CreateVirtualDevice( SalGraphics* pGraphics, +CreateVirtualDevice( SalGraphics& rGraphics, tools::Long , tools::Long , DeviceFormat eFormat, const SystemGraphicsData *pData = nullptr ) override; diff --git a/vcl/inc/qt5/Qt5Instance.hxx b/vcl/inc/qt5/Qt5Instance.hxx index 111e86f0878a..41b9aca894d0 100644 --- a/vcl/inc/qt5/Qt5Instance.hxx +++ b/vcl/inc/qt5/Qt5Instance.hxx @@ -111,7 +111,7 @@ public: virtual void DestroyObject(SalObject* pObject) override; virtual std::unique_ptr -CreateVirtualDevice(SalGraphics* pGraphics, tools::Long& nDX, tools::Long& nDY, +CreateVirtualDevice(SalGraphics& rGraphics, tools::Long& nDX, tools::Long& nDY, DeviceFormat eFormat, const SystemGraphicsData* pData = nullptr) override; virtual SalInfoPrinter* CreateInfoPrinter(SalPrinterQueueInfo* pQueueInfo, diff --git a/vcl/inc/salinst.hxx b/vcl/inc/salinst.hxx index 1a6ce96cf809..6ce6a3d2743d 100644 --- a/vcl/inc/salinst.hxx +++ b/vcl/inc/salinst.hxx @@ -105,7 +105,7 @@ public: // if a system context is passed in nDX and nDY are updated to reflect // its size; otherwise these remain unchanged. virtual std::unique_ptr -CreateVirtualDevice( SalGraphics* pGraphics, +CreateVirtualDevice( SalGraphics& rGraphics, tools::Long , tools::Long , DeviceFormat
[Libreoffice-commits] core.git: vcl/headless vcl/inc vcl/qt5 vcl/quartz vcl/source vcl/unx
vcl/headless/svpgdi.cxx |1 + vcl/inc/textrender.hxx |2 ++ vcl/inc/unx/cairotextrender.hxx |4 +--- vcl/qt5/Qt5Graphics.cxx | 11 +-- vcl/quartz/salgdi.cxx |7 +-- vcl/source/gdi/salgdilayout.cxx |1 + vcl/unx/generic/gdi/cairotextrender.cxx | 12 ++-- 7 files changed, 13 insertions(+), 25 deletions(-) New commits: commit f8e1f8652255cadd80a991aa3e059ee631b333b8 Author: Jan-Marek Glogowski AuthorDate: Mon Nov 18 16:04:24 2019 + Commit: Jan-Marek Glogowski CommitDate: Tue Nov 19 03:13:33 2019 +0100 tdf#128434 correctly release fonts in destructors This adds ReleaseFonts() calls to all destructors of SalGraphics and TextRenderImpl derivated classes, which implement SetFont. During destruction a base class can't call into derivated classes, as these are already destructed, so we have to spread these calls manually. Change-Id: Ia57db04f7df665e5205212ce512119e2f60e3379 Reviewed-on: https://gerrit.libreoffice.org/82967 Tested-by: Jenkins Reviewed-by: Jan-Marek Glogowski diff --git a/vcl/headless/svpgdi.cxx b/vcl/headless/svpgdi.cxx index 57f66d4fabf6..e34678a93932 100644 --- a/vcl/headless/svpgdi.cxx +++ b/vcl/headless/svpgdi.cxx @@ -612,6 +612,7 @@ SvpSalGraphics::SvpSalGraphics() SvpSalGraphics::~SvpSalGraphics() { +ReleaseFonts(); } void SvpSalGraphics::setSurface(cairo_surface_t* pSurface, const basegfx::B2IVector& rSize) diff --git a/vcl/inc/textrender.hxx b/vcl/inc/textrender.hxx index 742d8445299b..1aec8fba2301 100644 --- a/vcl/inc/textrender.hxx +++ b/vcl/inc/textrender.hxx @@ -32,10 +32,12 @@ class PhysicalFontFace; class TextRenderImpl { public: +// can't call ReleaseFonts here, as the destructor just calls this classes SetFont (pure virtual)! virtual ~TextRenderImpl() {} virtual voidSetTextColor( Color nColor ) = 0; virtual voidSetFont(LogicalFontInstance*, int nFallbackLevel) = 0; +void ReleaseFonts() { SetFont(nullptr, 0); } virtual voidGetFontMetric( ImplFontMetricDataRef&, int nFallbackLevel ) = 0; virtual FontCharMapRef GetFontCharMap() const = 0; virtual boolGetFontCapabilities(vcl::FontCapabilities ) const = 0; diff --git a/vcl/inc/unx/cairotextrender.hxx b/vcl/inc/unx/cairotextrender.hxx index 33b1a622945e..c0882bc35f86 100644 --- a/vcl/inc/unx/cairotextrender.hxx +++ b/vcl/inc/unx/cairotextrender.hxx @@ -38,13 +38,11 @@ protected: virtual voidgetSurfaceOffset(double& nDX, double& nDY) = 0; virtual voidreleaseCairoContext(cairo_t* cr) = 0; -voidsetFont(LogicalFontInstance *pEntry, int nFallbackLevel); - virtual voidclipRegion(cairo_t* cr) = 0; public: CairoTextRender(); - +virtual ~CairoTextRender() override; virtual voidSetTextColor( Color nColor ) override; virtual voidSetFont(LogicalFontInstance*, int nFallbackLevel) override; diff --git a/vcl/qt5/Qt5Graphics.cxx b/vcl/qt5/Qt5Graphics.cxx index 5192f0b42416..8228699a2602 100644 --- a/vcl/qt5/Qt5Graphics.cxx +++ b/vcl/qt5/Qt5Graphics.cxx @@ -44,16 +44,7 @@ Qt5Graphics::Qt5Graphics( Qt5Frame *pFrame, QImage *pQImage ) m_pWidgetDraw.reset(new Qt5Graphics_Controls()); } -Qt5Graphics::~Qt5Graphics() -{ -// release the text styles -for (int i = 0; i < MAX_FALLBACK; ++i) -{ -if (!m_pTextStyle[i]) -break; -m_pTextStyle[i].clear(); -} -} +Qt5Graphics::~Qt5Graphics() { ReleaseFonts(); } void Qt5Graphics::ChangeQImage(QImage* pQImage) { diff --git a/vcl/quartz/salgdi.cxx b/vcl/quartz/salgdi.cxx index 8884d0bd9f3b..b6df53319e28 100644 --- a/vcl/quartz/salgdi.cxx +++ b/vcl/quartz/salgdi.cxx @@ -222,12 +222,7 @@ AquaSalGraphics::~AquaSalGraphics() CGPathRelease( mxClipPath ); } -for (int i = 0; i < MAX_FALLBACK; ++i) -{ -if (!mpTextStyle[i]) -break; -mpTextStyle[i].clear(); -} +ReleaseFonts(); if( mpXorEmulation ) delete mpXorEmulation; diff --git a/vcl/source/gdi/salgdilayout.cxx b/vcl/source/gdi/salgdilayout.cxx index b0fefa665bd5..de11058e4507 100644 --- a/vcl/source/gdi/salgdilayout.cxx +++ b/vcl/source/gdi/salgdilayout.cxx @@ -82,6 +82,7 @@ bool SalGraphics::initWidgetDrawBackends(bool bForce) SalGraphics::~SalGraphics() COVERITY_NOEXCEPT_FALSE { +// can't call ReleaseFonts here, as the destructor just calls this classes SetFont (pure virtual)! } #if HAVE_FEATURE_OPENGL diff --git a/vcl/unx/generic/gdi/cairotextrender.cxx b/vcl/unx/generic/gdi/cairotextrender.cxx index 3b1c7f24f01a..9610a73bc1d6 100644 --- a/vcl/unx/generic/gdi/cairotextrender.cxx +++
[Libreoffice-commits] core.git: vcl/headless vcl/inc vcl/qt5 vcl/quartz vcl/source vcl/unx vcl/win
vcl/headless/svptext.cxx |4 ++-- vcl/inc/headless/svpgdi.hxx |4 ++-- vcl/inc/qt5/Qt5Graphics.hxx |2 +- vcl/inc/quartz/salgdi.h |4 ++-- vcl/inc/salgdi.hxx |4 ++-- vcl/inc/textrender.hxx |4 ++-- vcl/inc/unx/cairotextrender.hxx |4 ++-- vcl/inc/unx/genpspgraphics.h |4 ++-- vcl/inc/unx/salgdi.h |4 ++-- vcl/inc/win/salgdi.h |4 ++-- vcl/qt5/Qt5Graphics_Text.cxx |2 +- vcl/quartz/salgdi.cxx|2 +- vcl/source/outdev/font.cxx |2 +- vcl/source/outdev/text.cxx | 11 +++ vcl/unx/generic/gdi/cairotextrender.cxx |2 +- vcl/unx/generic/gdi/font.cxx |4 ++-- vcl/unx/generic/print/genpspgraphics.cxx |2 +- vcl/win/gdi/winlayout.cxx|2 +- 18 files changed, 30 insertions(+), 35 deletions(-) New commits: commit f205e4530ef4245ee29b934d050c4ac5c2ce7257 Author: Jan-Marek Glogowski AuthorDate: Thu Jan 24 19:00:10 2019 + Commit: Jan-Marek Glogowski CommitDate: Fri Jan 25 08:15:54 2019 +0100 Change SalGraphics::GetTextLayout definition * drop the unused ImplLayoutArgs argument * return a std::unique_ptr Change-Id: I150a2a46f67f1ffbbd3ba0ffa68f5bffb30206c8 Reviewed-on: https://gerrit.libreoffice.org/66884 Tested-by: Jenkins Reviewed-by: Noel Grandin Reviewed-by: Jan-Marek Glogowski diff --git a/vcl/headless/svptext.cxx b/vcl/headless/svptext.cxx index aead84a1467b..d81dfa19649a 100644 --- a/vcl/headless/svptext.cxx +++ b/vcl/headless/svptext.cxx @@ -92,11 +92,11 @@ void SvpSalGraphics::GetGlyphWidths( const PhysicalFontFace* pFont, m_aTextRenderImpl.GetGlyphWidths(pFont, bVertical, rWidths, rUnicodeEnc); } -std::unique_ptr SvpSalGraphics::GetTextLayout( ImplLayoutArgs& rArgs, int nFallbackLevel ) +std::unique_ptr SvpSalGraphics::GetTextLayout(int nFallbackLevel) { if (utl::ConfigManager::IsFuzzing()) return nullptr; -return m_aTextRenderImpl.GetTextLayout(rArgs, nFallbackLevel); +return m_aTextRenderImpl.GetTextLayout(nFallbackLevel); } void SvpSalGraphics::DrawTextLayout(const GenericSalLayout& rLayout) diff --git a/vcl/inc/headless/svpgdi.hxx b/vcl/inc/headless/svpgdi.hxx index e62c508d0863..89e141b78d21 100644 --- a/vcl/inc/headless/svpgdi.hxx +++ b/vcl/inc/headless/svpgdi.hxx @@ -190,8 +190,8 @@ public: bool bVertical, std::vector< sal_Int32 >& rWidths, Ucs2UIntMap& rUnicodeEnc ) override; -virtual std::unique_ptr -GetTextLayout( ImplLayoutArgs&, int nFallbackLevel ) override; +virtual std::unique_ptr +GetTextLayout(int nFallbackLevel) override; virtual voidDrawTextLayout( const GenericSalLayout& ) override; virtual boolsupportsOperation( OutDevSupportType ) const override; virtual voiddrawPixel( long nX, long nY ) override; diff --git a/vcl/inc/qt5/Qt5Graphics.hxx b/vcl/inc/qt5/Qt5Graphics.hxx index 9430be94a112..b11f926f72bb 100644 --- a/vcl/inc/qt5/Qt5Graphics.hxx +++ b/vcl/inc/qt5/Qt5Graphics.hxx @@ -195,7 +195,7 @@ public: virtual void GetGlyphWidths(const PhysicalFontFace*, bool bVertical, std::vector& rWidths, Ucs2UIntMap& rUnicodeEnc) override; -virtual std::unique_ptr GetTextLayout(ImplLayoutArgs&, int nFallbackLevel) override; +virtual std::unique_ptr GetTextLayout(int nFallbackLevel) override; virtual void DrawTextLayout(const GenericSalLayout&) override; // Native control support diff --git a/vcl/inc/quartz/salgdi.h b/vcl/inc/quartz/salgdi.h index cacf56dcb84f..63bf71090c21 100644 --- a/vcl/inc/quartz/salgdi.h +++ b/vcl/inc/quartz/salgdi.h @@ -373,8 +373,8 @@ public: std::vector< sal_Int32 >& rWidths, Ucs2UIntMap& rUnicodeEnc ) override; -virtual std::unique_ptr -GetTextLayout( ImplLayoutArgs&, int nFallbackLevel ) override; +virtual std::unique_ptr +GetTextLayout(int nFallbackLevel) override; virtual voidDrawTextLayout( const GenericSalLayout& ) override; virtual boolsupportsOperation( OutDevSupportType ) const override; diff --git a/vcl/inc/salgdi.hxx b/vcl/inc/salgdi.hxx index d3d459d058fe..5313f24c73b8 100644 --- a/vcl/inc/salgdi.hxx +++ b/vcl/inc/salgdi.hxx @@ -191,8 +191,8 @@ public: std::vector< sal_Int32 >& rWidths, Ucs2UIntMap& rUnicodeEnc ) = 0; -virtual std::unique_ptr -
[Libreoffice-commits] core.git: vcl/headless vcl/inc vcl/qt5 vcl/unx
vcl/headless/svpinst.cxx |2 +- vcl/headless/svpvd.cxx | 34 ++ vcl/inc/headless/svpvd.hxx |3 +-- vcl/qt5/Qt5Instance.cxx|3 +-- vcl/unx/gtk/gtkinst.cxx|2 +- 5 files changed, 22 insertions(+), 22 deletions(-) New commits: commit b524de950c6eb0bc61d05d41fe69b67ab59b16c6 Author: Caolán McNamaraDate: Wed Apr 11 12:09:45 2018 +0100 Related: rhbz#1396729 use cairo_surface_create_similar where we can Change-Id: If6fd729a9cbf834faef33586b5bd886aad2fbe1d Reviewed-on: https://gerrit.libreoffice.org/52726 Tested-by: Jenkins Reviewed-by: Caolán McNamara Tested-by: Caolán McNamara diff --git a/vcl/headless/svpinst.cxx b/vcl/headless/svpinst.cxx index 81a8f332723b..664547a69a52 100644 --- a/vcl/headless/svpinst.cxx +++ b/vcl/headless/svpinst.cxx @@ -243,7 +243,7 @@ SalVirtualDevice* SvpSalInstance::CreateVirtualDevice( SalGraphics* pGraphics, { SvpSalGraphics *pSvpSalGraphics = dynamic_cast (pGraphics); assert(pSvpSalGraphics); -SvpSalVirtualDevice* pNew = new SvpSalVirtualDevice(eFormat, pSvpSalGraphics->getScale(), pSvpSalGraphics->getSurface()); +SvpSalVirtualDevice* pNew = new SvpSalVirtualDevice(eFormat, pSvpSalGraphics->getSurface()); pNew->SetSize( nDX, nDY ); return pNew; } diff --git a/vcl/headless/svpvd.cxx b/vcl/headless/svpvd.cxx index decca08a76eb..4172fc383744 100644 --- a/vcl/headless/svpvd.cxx +++ b/vcl/headless/svpvd.cxx @@ -30,11 +30,10 @@ using namespace basegfx; -SvpSalVirtualDevice::SvpSalVirtualDevice(DeviceFormat eFormat, double fScale, cairo_surface_t* pRefSurface) +SvpSalVirtualDevice::SvpSalVirtualDevice(DeviceFormat eFormat, cairo_surface_t* pRefSurface) : m_eFormat(eFormat) , m_pRefSurface(pRefSurface) , m_pSurface(nullptr) -, m_fScale(fScale) { cairo_surface_reference(m_pRefSurface); } @@ -77,9 +76,6 @@ bool SvpSalVirtualDevice::SetSizeUsingBuffer( long nNewDX, long nNewDY, { m_aFrameSize = basegfx::B2IVector(nNewDX, nNewDY); -nNewDX *= m_fScale; -nNewDY *= m_fScale; - if (m_pSurface) { cairo_surface_destroy(m_pSurface); @@ -87,23 +83,29 @@ bool SvpSalVirtualDevice::SetSizeUsingBuffer( long nNewDX, long nNewDY, if (m_eFormat == DeviceFormat::BITMASK) { -m_pSurface = cairo_surface_create_similar_image(m_pRefSurface, CAIRO_FORMAT_A1, +m_pSurface = cairo_surface_create_similar(m_pRefSurface, CAIRO_CONTENT_ALPHA, nNewDX, nNewDY); } -else +else if (pBuffer) { -m_pSurface = pBuffer ? - cairo_image_surface_create_for_data(pBuffer, CAIRO_FORMAT_ARGB32, - nNewDX, nNewDY, - cairo_format_stride_for_width(CAIRO_FORMAT_ARGB32, nNewDX)) - : - cairo_surface_create_similar_image(m_pRefSurface, CAIRO_FORMAT_ARGB32, - nNewDX, nNewDY); -} +#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 14, 0) +double fXScale, fYScale; +cairo_surface_get_device_scale(m_pRefSurface, , ); +nNewDX *= fXScale; +nNewDY *= fYScale; +#endif + +m_pSurface = cairo_image_surface_create_for_data(pBuffer, CAIRO_FORMAT_ARGB32, +nNewDX, nNewDY, cairo_format_stride_for_width(CAIRO_FORMAT_ARGB32, nNewDX)); #if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 14, 0) -cairo_surface_set_device_scale(m_pSurface, m_fScale, m_fScale); +cairo_surface_set_device_scale(m_pSurface, fXScale, fYScale); #endif +} +else +{ +m_pSurface = cairo_surface_create_similar(m_pRefSurface, CAIRO_CONTENT_COLOR_ALPHA, nNewDX, nNewDY); +} // update device in existing graphics for (auto const& graphic : m_aGraphics) diff --git a/vcl/inc/headless/svpvd.hxx b/vcl/inc/headless/svpvd.hxx index 990915169d56..51d6af9cb499 100644 --- a/vcl/inc/headless/svpvd.hxx +++ b/vcl/inc/headless/svpvd.hxx @@ -33,11 +33,10 @@ class VCL_DLLPUBLIC SvpSalVirtualDevice : public SalVirtualDevice cairo_surface_t*m_pRefSurface; cairo_surface_t*m_pSurface; basegfx::B2IVector m_aFrameSize; -double m_fScale; std::vector< SvpSalGraphics* > m_aGraphics; public: -SvpSalVirtualDevice(DeviceFormat eFormat, double fScale, cairo_surface_t* pRefSurface); +SvpSalVirtualDevice(DeviceFormat eFormat, cairo_surface_t* pRefSurface); virtual ~SvpSalVirtualDevice() override; // SalVirtualDevice diff --git a/vcl/qt5/Qt5Instance.cxx
[Libreoffice-commits] core.git: vcl/headless vcl/inc vcl/qt5 vcl/source vcl/unx
vcl/headless/svpgdi.cxx |4 ++-- vcl/headless/svpinst.cxx |6 -- vcl/headless/svpvd.cxx| 14 -- vcl/inc/headless/svpgdi.hxx |1 + vcl/inc/headless/svpvd.hxx|8 ++-- vcl/qt5/Qt5Instance.cxx |9 ++--- vcl/source/bitmap/BitmapTools.cxx |4 ++-- vcl/unx/gtk/gtkinst.cxx |2 +- 8 files changed, 30 insertions(+), 18 deletions(-) New commits: commit 6eea5cffc4399fd31f97b19359eb6ae9c75d21b8 Author: Caolán McNamaraDate: Wed Apr 11 11:06:37 2018 +0100 Related: rhbz#1396729 use cairo_surface_create_similar_image don't expect it to make much of a difference but does allow bubbling the initial widget surface type around through the virtual devices Change-Id: I414a4b10b0ae4195345b81d9da7f748652d4f566 Reviewed-on: https://gerrit.libreoffice.org/52718 Tested-by: Jenkins Reviewed-by: Caolán McNamara Tested-by: Caolán McNamara diff --git a/vcl/headless/svpgdi.cxx b/vcl/headless/svpgdi.cxx index 487796755ec5..cad5f5ea21a5 100644 --- a/vcl/headless/svpgdi.cxx +++ b/vcl/headless/svpgdi.cxx @@ -1320,7 +1320,7 @@ SalBitmap* SvpSalGraphics::getBitmap( long nX, long nY, long nWidth, long nHeigh Color SvpSalGraphics::getPixel( long nX, long nY ) { -cairo_surface_t *target = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, 1, 1); +cairo_surface_t *target = cairo_surface_create_similar_image(m_pSurface, CAIRO_FORMAT_ARGB32, 1, 1); cairo_t* cr = cairo_create(target); cairo_rectangle(cr, 0, 0, 1, 1); @@ -1484,7 +1484,7 @@ cairo_surface_t* SvpSalGraphics::createCairoSurface(const BitmapBuffer *pBuffer) cairo_t* SvpSalGraphics::createTmpCompatibleCairoContext() const { -cairo_surface_t *target = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, +cairo_surface_t *target = cairo_surface_create_similar_image(m_pSurface, CAIRO_FORMAT_ARGB32, m_aFrameSize.getX() * m_fScale, m_aFrameSize.getY() * m_fScale); #if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 14, 0) diff --git a/vcl/headless/svpinst.cxx b/vcl/headless/svpinst.cxx index 412e86c55351..81a8f332723b 100644 --- a/vcl/headless/svpinst.cxx +++ b/vcl/headless/svpinst.cxx @@ -236,12 +236,14 @@ void SvpSalInstance::DestroyObject( SalObject* pObject ) #ifndef IOS -SalVirtualDevice* SvpSalInstance::CreateVirtualDevice( SalGraphics* /* pGraphics */, +SalVirtualDevice* SvpSalInstance::CreateVirtualDevice( SalGraphics* pGraphics, long , long , DeviceFormat eFormat, const SystemGraphicsData* /* pData */ ) { -SvpSalVirtualDevice* pNew = new SvpSalVirtualDevice(eFormat, 1); +SvpSalGraphics *pSvpSalGraphics = dynamic_cast (pGraphics); +assert(pSvpSalGraphics); +SvpSalVirtualDevice* pNew = new SvpSalVirtualDevice(eFormat, pSvpSalGraphics->getScale(), pSvpSalGraphics->getSurface()); pNew->SetSize( nDX, nDY ); return pNew; } diff --git a/vcl/headless/svpvd.cxx b/vcl/headless/svpvd.cxx index cf78ebc8eb7d..decca08a76eb 100644 --- a/vcl/headless/svpvd.cxx +++ b/vcl/headless/svpvd.cxx @@ -30,9 +30,19 @@ using namespace basegfx; +SvpSalVirtualDevice::SvpSalVirtualDevice(DeviceFormat eFormat, double fScale, cairo_surface_t* pRefSurface) +: m_eFormat(eFormat) +, m_pRefSurface(pRefSurface) +, m_pSurface(nullptr) +, m_fScale(fScale) +{ +cairo_surface_reference(m_pRefSurface); +} + SvpSalVirtualDevice::~SvpSalVirtualDevice() { cairo_surface_destroy(m_pSurface); +cairo_surface_destroy(m_pRefSurface); } SalGraphics* SvpSalVirtualDevice::AcquireGraphics() @@ -77,7 +87,7 @@ bool SvpSalVirtualDevice::SetSizeUsingBuffer( long nNewDX, long nNewDY, if (m_eFormat == DeviceFormat::BITMASK) { -m_pSurface = cairo_image_surface_create(CAIRO_FORMAT_A1, +m_pSurface = cairo_surface_create_similar_image(m_pRefSurface, CAIRO_FORMAT_A1, nNewDX, nNewDY); } else @@ -87,7 +97,7 @@ bool SvpSalVirtualDevice::SetSizeUsingBuffer( long nNewDX, long nNewDY, nNewDX, nNewDY, cairo_format_stride_for_width(CAIRO_FORMAT_ARGB32, nNewDX)) : - cairo_image_surface_create(CAIRO_FORMAT_ARGB32, + cairo_surface_create_similar_image(m_pRefSurface, CAIRO_FORMAT_ARGB32, nNewDX, nNewDY); } diff --git a/vcl/inc/headless/svpgdi.hxx b/vcl/inc/headless/svpgdi.hxx index 28c453d0cfbe..7569476c1600 100644