include/vcl/metric.hxx | 50 +++++++++++++++++++++--------------------- vcl/qa/cppunit/fontmetric.cxx | 28 +++++++++++------------ 2 files changed, 39 insertions(+), 39 deletions(-)
New commits: commit 6f45c0cf86b21772740bb0cafb3d462b058523f3 Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Tue Oct 10 13:19:00 2023 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Wed Oct 11 11:19:10 2023 +0200 cool#7318 Calc rendering acceleration we are spending a lot of time in SalLayoutGlyphsCache::GetLayoutGlyphs, and most of that is inserting into the GlyphsCache, which has a very very large key. Shrink that key a little bit on 64-bit machines, where tools::Long is 64-bit, which is quite unnecessary for FontMetric fields. Change-Id: I64983d191ba9aeb76671671443ea90f90fd2c401 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157753 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/include/vcl/metric.hxx b/include/vcl/metric.hxx index 1e03232d70f7..5cf1d6e23246 100644 --- a/include/vcl/metric.hxx +++ b/include/vcl/metric.hxx @@ -40,23 +40,23 @@ public: FontMetric(vcl::font::PhysicalFontFace const& rFace); ~FontMetric() override; - tools::Long GetAscent() const { return mnAscent; } - tools::Long GetDescent() const { return mnDescent; } - tools::Long GetInternalLeading() const { return mnIntLeading; } - tools::Long GetExternalLeading() const { return mnExtLeading; } - tools::Long GetLineHeight() const { return mnLineHeight; } // TODO this is ascent + descnt - tools::Long GetSlant() const { return mnSlant; } - tools::Long GetBulletOffset() const { return mnBulletOffset; } - tools::Long GetHangingBaseline() const { return mnHangingBaseline; } - - void SetAscent( tools::Long nAscent ) { mnAscent = nAscent; } - void SetDescent( tools::Long nDescent ) { mnDescent = nDescent; } - void SetExternalLeading( tools::Long nExtLeading ) { mnExtLeading = nExtLeading; } - void SetInternalLeading( tools::Long nIntLeading ) { mnIntLeading = nIntLeading; } - void SetLineHeight( tools::Long nHeight ) { mnLineHeight = nHeight; } // TODO this is ascent + descent - void SetSlant( tools::Long nSlant ) { mnSlant = nSlant; } - void SetBulletOffset( tools::Long nOffset ) { mnBulletOffset = nOffset; } - void SetHangingBaseline( tools::Long nBaseline ) { mnHangingBaseline = nBaseline; } + sal_Int32 GetAscent() const { return mnAscent; } + sal_Int32 GetDescent() const { return mnDescent; } + sal_Int32 GetInternalLeading() const { return mnIntLeading; } + sal_Int32 GetExternalLeading() const { return mnExtLeading; } + sal_Int32 GetLineHeight() const { return mnLineHeight; } // TODO this is ascent + descnt + sal_Int32 GetSlant() const { return mnSlant; } + sal_Int32 GetBulletOffset() const { return mnBulletOffset; } + sal_Int32 GetHangingBaseline() const { return mnHangingBaseline; } + + void SetAscent( sal_Int32 nAscent ) { mnAscent = nAscent; } + void SetDescent( sal_Int32 nDescent ) { mnDescent = nDescent; } + void SetExternalLeading( sal_Int32 nExtLeading ) { mnExtLeading = nExtLeading; } + void SetInternalLeading( sal_Int32 nIntLeading ) { mnIntLeading = nIntLeading; } + void SetLineHeight( sal_Int32 nHeight ) { mnLineHeight = nHeight; } // TODO this is ascent + descent + void SetSlant( sal_Int32 nSlant ) { mnSlant = nSlant; } + void SetBulletOffset( sal_Int32 nOffset ) { mnBulletOffset = nOffset; } + void SetHangingBaseline( sal_Int32 nBaseline ) { mnHangingBaseline = nBaseline; } bool IsFullstopCentered() const { return mbFullstopCentered; } @@ -77,14 +77,14 @@ public: private: bool EqualNoBase( const FontMetric& ) const; size_t GetHashValueNoBase() const; - tools::Long mnAscent; // Ascent - tools::Long mnDescent; // Descent - tools::Long mnIntLeading; // Internal Leading - tools::Long mnExtLeading; // External Leading - tools::Long mnLineHeight; // Ascent+Descent+EmphasisMark - tools::Long mnSlant; // Slant - tools::Long mnBulletOffset; // Offset for non-printing character - tools::Long mnHangingBaseline; // Offset from Romn baseline to hanging baseline. + sal_Int32 mnAscent; // Ascent + sal_Int32 mnDescent; // Descent + sal_Int32 mnIntLeading; // Internal Leading + sal_Int32 mnExtLeading; // External Leading + sal_Int32 mnLineHeight; // Ascent+Descent+EmphasisMark + sal_Int32 mnSlant; // Slant + sal_Int32 mnBulletOffset; // Offset for non-printing character + sal_Int32 mnHangingBaseline; // Offset from Romn baseline to hanging baseline. bool mbFullstopCentered; }; diff --git a/vcl/qa/cppunit/fontmetric.cxx b/vcl/qa/cppunit/fontmetric.cxx index 8ee42f170a10..bf2585ac38a7 100644 --- a/vcl/qa/cppunit/fontmetric.cxx +++ b/vcl/qa/cppunit/fontmetric.cxx @@ -49,27 +49,27 @@ void VclFontMetricTest::testSpacings() // default constructor should set scalable flag to false FontMetric aFontMetric; - CPPUNIT_ASSERT_EQUAL(tools::Long(0), aFontMetric.GetAscent()); - CPPUNIT_ASSERT_EQUAL(tools::Long(0), aFontMetric.GetDescent()); - CPPUNIT_ASSERT_EQUAL(tools::Long(0), aFontMetric.GetExternalLeading()); - CPPUNIT_ASSERT_EQUAL(tools::Long(0), aFontMetric.GetInternalLeading()); - CPPUNIT_ASSERT_EQUAL(tools::Long(0), aFontMetric.GetLineHeight()); + CPPUNIT_ASSERT_EQUAL(sal_Int32(0), aFontMetric.GetAscent()); + CPPUNIT_ASSERT_EQUAL(sal_Int32(0), aFontMetric.GetDescent()); + CPPUNIT_ASSERT_EQUAL(sal_Int32(0), aFontMetric.GetExternalLeading()); + CPPUNIT_ASSERT_EQUAL(sal_Int32(0), aFontMetric.GetInternalLeading()); + CPPUNIT_ASSERT_EQUAL(sal_Int32(0), aFontMetric.GetLineHeight()); aFontMetric.SetAscent( 100 ); - CPPUNIT_ASSERT_EQUAL(tools::Long(100), aFontMetric.GetAscent()); + CPPUNIT_ASSERT_EQUAL(sal_Int32(100), aFontMetric.GetAscent()); aFontMetric.SetDescent( 100 ); - CPPUNIT_ASSERT_EQUAL(tools::Long(100), aFontMetric.GetDescent()); + CPPUNIT_ASSERT_EQUAL(sal_Int32(100), aFontMetric.GetDescent()); aFontMetric.SetExternalLeading( 100 ); - CPPUNIT_ASSERT_EQUAL(tools::Long(100), aFontMetric.GetExternalLeading()); + CPPUNIT_ASSERT_EQUAL(sal_Int32(100), aFontMetric.GetExternalLeading()); aFontMetric.SetInternalLeading( 100 ); - CPPUNIT_ASSERT_EQUAL(tools::Long(100), aFontMetric.GetInternalLeading()); + CPPUNIT_ASSERT_EQUAL(sal_Int32(100), aFontMetric.GetInternalLeading()); aFontMetric.SetLineHeight( 100 ); - CPPUNIT_ASSERT_EQUAL(tools::Long(100), aFontMetric.GetLineHeight()); + CPPUNIT_ASSERT_EQUAL(sal_Int32(100), aFontMetric.GetLineHeight()); } void VclFontMetricTest::testSlant() @@ -77,10 +77,10 @@ void VclFontMetricTest::testSlant() // default constructor should set scalable flag to false FontMetric aFontMetric; - CPPUNIT_ASSERT_EQUAL(tools::Long(0), aFontMetric.GetSlant()); + CPPUNIT_ASSERT_EQUAL(sal_Int32(0), aFontMetric.GetSlant()); aFontMetric.SetSlant( 45 ); - CPPUNIT_ASSERT_EQUAL(tools::Long(45), aFontMetric.GetSlant()); + CPPUNIT_ASSERT_EQUAL(sal_Int32(45), aFontMetric.GetSlant()); } void VclFontMetricTest::testBulletOffset() @@ -88,10 +88,10 @@ void VclFontMetricTest::testBulletOffset() // default constructor should set scalable flag to false FontMetric aFontMetric; - CPPUNIT_ASSERT_EQUAL(tools::Long(0), aFontMetric.GetBulletOffset()); + CPPUNIT_ASSERT_EQUAL(sal_Int32(0), aFontMetric.GetBulletOffset()); aFontMetric.SetBulletOffset( 45 ); - CPPUNIT_ASSERT_EQUAL(tools::Long(45), aFontMetric.GetBulletOffset()); + CPPUNIT_ASSERT_EQUAL(sal_Int32(45), aFontMetric.GetBulletOffset()); } void VclFontMetricTest::testEqualityOperator()