[Libreoffice-commits] core.git: 2 commits - include/svl include/svx svl/source vcl/source
Noel Grandin (via logerrit)
logerrit at kemper.freedesktop.org
Mon Apr 29 06:30:53 UTC 2019
include/svl/custritm.hxx | 2 +
include/svx/xbtmpit.hxx | 2 +
include/svx/xcolit.hxx | 2 +
include/svx/xflgrit.hxx | 2 +
include/svx/xflhtit.hxx | 2 +
include/svx/xlndsit.hxx | 2 +
include/svx/xlnedit.hxx | 2 +
include/svx/xlnstit.hxx | 2 +
svl/source/items/custritm.cxx | 11 ++++++-
vcl/source/bitmap/BitmapScaleConvolutionFilter.cxx | 31 ++++++++-------------
10 files changed, 38 insertions(+), 20 deletions(-)
New commits:
commit beacd77aa985ed90532cd5fdd7b56314c0a7b0eb
Author: Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Sat Apr 27 09:43:28 2019 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Mon Apr 29 08:30:07 2019 +0200
optimise ImplScaleConvolutionVer a little
cache the reading of the source scan line, and use sal_Int32 for pixels
and counts (long is 64-bit on 64-bit linux)
Change-Id: Iaa0abc3ed3316d3137184b0c051612874885ddf4
Reviewed-on: https://gerrit.libreoffice.org/71462
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/vcl/source/bitmap/BitmapScaleConvolutionFilter.cxx b/vcl/source/bitmap/BitmapScaleConvolutionFilter.cxx
index 7375d0260dfb..389b2a3b11b3 100644
--- a/vcl/source/bitmap/BitmapScaleConvolutionFilter.cxx
+++ b/vcl/source/bitmap/BitmapScaleConvolutionFilter.cxx
@@ -39,8 +39,8 @@ void ImplCalculateContributions(
const long aDestinationSize,
long& aNumberOfContributions,
std::vector<double>& rWeights,
- std::vector<long>& rPixels,
- std::vector<long>& rCounts,
+ std::vector<sal_Int32>& rPixels,
+ std::vector<sal_Int32>& rCounts,
const Kernel& aKernel)
{
const double fSamplingRadius(aKernel.GetWidth());
@@ -103,8 +103,8 @@ bool ImplScaleConvolutionHor(Bitmap& rSource, Bitmap& rTarget, const double& rSc
if(pReadAcc)
{
std::vector<double> aWeights;
- std::vector<long> aPixels;
- std::vector<long> aCounts;
+ std::vector<sal_Int32> aPixels;
+ std::vector<sal_Int32> aCounts;
long aNumberOfContributions(0);
const long nHeight(rSource.GetSizePixel().Height());
@@ -191,8 +191,8 @@ bool ImplScaleConvolutionVer(Bitmap& rSource, Bitmap& rTarget, const double& rSc
if(pReadAcc)
{
std::vector<double> aWeights;
- std::vector<long> aPixels;
- std::vector<long> aCounts;
+ std::vector<sal_Int32> aPixels;
+ std::vector<sal_Int32> aCounts;
long aNumberOfContributions(0);
const long nWidth(rSource.GetSizePixel().Width());
@@ -203,8 +203,14 @@ bool ImplScaleConvolutionVer(Bitmap& rSource, Bitmap& rTarget, const double& rSc
if(pWriteAcc)
{
+ std::vector<BitmapColor> aScanline(nHeight);
for(long x(0); x < nWidth; x++)
{
+ for(long y(0); y < nHeight; y++)
+ if(pReadAcc->HasPalette())
+ aScanline[y] = pReadAcc->GetPaletteColor(pReadAcc->GetPixelIndex(y, x));
+ else
+ aScanline[y] = pReadAcc->GetPixel(y, x);
for(long y(0); y < nNewHeight; y++)
{
const long aBaseIndex(y * aNumberOfContributions);
@@ -217,19 +223,8 @@ bool ImplScaleConvolutionVer(Bitmap& rSource, Bitmap& rTarget, const double& rSc
{
const long aIndex(aBaseIndex + j);
const double aWeight(aWeights[aIndex]);
- BitmapColor aColor;
-
aSum += aWeight;
-
- if(pReadAcc->HasPalette())
- {
- aColor = pReadAcc->GetPaletteColor(pReadAcc->GetPixelIndex(aPixels[aIndex], x));
- }
- else
- {
- aColor = pReadAcc->GetPixel(aPixels[aIndex], x);
- }
-
+ const BitmapColor & aColor = aScanline[aPixels[aIndex]];
aValueRed += aWeight * aColor.GetRed();
aValueGreen += aWeight * aColor.GetGreen();
aValueBlue += aWeight * aColor.GetBlue();
commit 24503d5ddfc0a83ac88aa23d03b69ed47f989e8e
Author: Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Fri Apr 26 18:59:17 2019 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Mon Apr 29 08:30:00 2019 +0200
tdf#63640 FILEOPEN/FILESAVE: particular .odt loads/saves very slow, part1
Make CntUnencodedStringItem sortable, implementing operator<.
This takes the load time from 4s to 3.3s
Change-Id: I532cdf65149a733d41d2caf367675800d2ba4d41
Reviewed-on: https://gerrit.libreoffice.org/71460
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/include/svl/custritm.hxx b/include/svl/custritm.hxx
index 65facd5cd54e..3899df7b2fbc 100644
--- a/include/svl/custritm.hxx
+++ b/include/svl/custritm.hxx
@@ -38,6 +38,8 @@ public:
{}
virtual bool operator ==(const SfxPoolItem & rItem) const override;
+ virtual bool operator <(const SfxPoolItem & rItem) const override;
+ virtual bool IsSortable() const override { return true; }
virtual bool GetPresentation(SfxItemPresentation,
MapUnit, MapUnit,
diff --git a/include/svx/xbtmpit.hxx b/include/svx/xbtmpit.hxx
index bce24f860a4b..dedff05369ec 100644
--- a/include/svx/xbtmpit.hxx
+++ b/include/svx/xbtmpit.hxx
@@ -42,6 +42,8 @@ public:
XFillBitmapItem( const XFillBitmapItem& rItem );
virtual bool operator==( const SfxPoolItem& rItem ) const override;
+ // NameOrIndex is sortable, but we are not
+ virtual bool IsSortable() const override { return false; }
virtual SfxPoolItem* Clone( SfxItemPool* pPool = nullptr ) const override;
virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
diff --git a/include/svx/xcolit.hxx b/include/svx/xcolit.hxx
index df3723542516..63d5e475ec31 100644
--- a/include/svx/xcolit.hxx
+++ b/include/svx/xcolit.hxx
@@ -47,6 +47,8 @@ public:
XColorItem(const XColorItem& rItem);
virtual bool operator==(const SfxPoolItem& rItem) const override;
+ // NameOrIndex is sortable, but we are not
+ virtual bool IsSortable() const override { return false; }
virtual SfxPoolItem* Clone(SfxItemPool* pPool = nullptr) const override;
const Color& GetColorValue() const;
diff --git a/include/svx/xflgrit.hxx b/include/svx/xflgrit.hxx
index 159c6862dc79..8e931cb40ef0 100644
--- a/include/svx/xflgrit.hxx
+++ b/include/svx/xflgrit.hxx
@@ -42,6 +42,8 @@ public:
XFillGradientItem(const XFillGradientItem& rItem);
virtual bool operator==(const SfxPoolItem& rItem) const override;
+ // NameOrIndex is sortable, but we are not
+ virtual bool IsSortable() const override { return false; }
virtual SfxPoolItem* Clone(SfxItemPool* pPool = nullptr) const override;
virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
diff --git a/include/svx/xflhtit.hxx b/include/svx/xflhtit.hxx
index a81e7232abfa..1f85088ad7cb 100644
--- a/include/svx/xflhtit.hxx
+++ b/include/svx/xflhtit.hxx
@@ -41,6 +41,8 @@ public:
XFillHatchItem(const XFillHatchItem& rItem);
virtual bool operator==(const SfxPoolItem& rItem) const override;
+ // NameOrIndex is sortable, but we are not
+ virtual bool IsSortable() const override { return false; }
virtual SfxPoolItem* Clone(SfxItemPool* pPool = nullptr) const override;
virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
diff --git a/include/svx/xlndsit.hxx b/include/svx/xlndsit.hxx
index a19e50608d15..8afc71545301 100644
--- a/include/svx/xlndsit.hxx
+++ b/include/svx/xlndsit.hxx
@@ -42,6 +42,8 @@ public:
XLineDashItem(const XLineDashItem& rItem);
virtual bool operator==(const SfxPoolItem& rItem) const override;
+ // NameOrIndex is sortable, but we are not
+ virtual bool IsSortable() const override { return false; }
virtual SfxPoolItem* Clone(SfxItemPool* pPool = nullptr) const override;
virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
diff --git a/include/svx/xlnedit.hxx b/include/svx/xlnedit.hxx
index b24d4825946f..2896138a7e87 100644
--- a/include/svx/xlnedit.hxx
+++ b/include/svx/xlnedit.hxx
@@ -41,6 +41,8 @@ public:
XLineEndItem(const XLineEndItem& rItem);
virtual bool operator==(const SfxPoolItem& rItem) const override;
+ // NameOrIndex is sortable, but we are not
+ virtual bool IsSortable() const override { return false; }
virtual SfxPoolItem* Clone(SfxItemPool* pPool = nullptr) const override;
virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
diff --git a/include/svx/xlnstit.hxx b/include/svx/xlnstit.hxx
index 3e9c402e8bb9..c37cfc3bdd6d 100644
--- a/include/svx/xlnstit.hxx
+++ b/include/svx/xlnstit.hxx
@@ -41,6 +41,8 @@ public:
XLineStartItem(const XLineStartItem& rItem);
virtual bool operator==(const SfxPoolItem& rItem) const override;
+ // NameOrIndex is sortable, but we are not
+ virtual bool IsSortable() const override { return false; }
virtual SfxPoolItem* Clone(SfxItemPool* pPool = nullptr) const override;
virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
diff --git a/svl/source/items/custritm.cxx b/svl/source/items/custritm.cxx
index b1324567ecbf..4cba9175d001 100644
--- a/svl/source/items/custritm.cxx
+++ b/svl/source/items/custritm.cxx
@@ -28,13 +28,20 @@
// virtual
bool CntUnencodedStringItem::operator ==(const SfxPoolItem & rItem) const
{
- DBG_ASSERT(dynamic_cast<const CntUnencodedStringItem*>( &rItem ) != nullptr,
- "CntUnencodedStringItem::operator ==(): Bad type");
+ assert(dynamic_cast<const CntUnencodedStringItem*>( &rItem ));
return m_aValue
== static_cast< const CntUnencodedStringItem * >(&rItem)->
m_aValue;
}
+bool CntUnencodedStringItem::operator<(const SfxPoolItem & rItem) const
+{
+ assert(dynamic_cast<const CntUnencodedStringItem*>( &rItem ));
+ return m_aValue
+ < static_cast< const CntUnencodedStringItem * >(&rItem)->
+ m_aValue;
+}
+
// virtual
bool CntUnencodedStringItem::GetPresentation(SfxItemPresentation, MapUnit,
MapUnit, OUString & rText,
More information about the Libreoffice-commits
mailing list