[Libreoffice-commits] core.git: basegfx/source
basegfx/source/curve/b2dcubicbezier.cxx | 26 +++-- basegfx/source/matrix/b2dhommatrix.cxx| 31 +- basegfx/source/matrix/b3dhommatrix.cxx| 31 +- basegfx/source/polygon/b2dpolygon.cxx | 28 +-- basegfx/source/polygon/b2dpolypolygon.cxx | 31 +- basegfx/source/polygon/b3dpolygon.cxx | 26 - basegfx/source/polygon/b3dpolypolygon.cxx | 26 - basegfx/source/range/b2dpolyrange.cxx | 17 +++- basegfx/source/tools/b2dclipstate.cxx | 27 +- 9 files changed, 48 insertions(+), 195 deletions(-) New commits: commit b3e0ef4cacfa63be7a6d4f152f197d07a3bbe255 Author: Jochen Nitschke Date: Sat Apr 21 17:02:04 2018 +0200 clang-tidy modernize-use-equals-default in basegfx Change-Id: If4ee51e022eba1f9f36c262abf9ba407db2b158e Reviewed-on: https://gerrit.libreoffice.org/53260 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/basegfx/source/curve/b2dcubicbezier.cxx b/basegfx/source/curve/b2dcubicbezier.cxx index d8f03de46c33..db2c7baed0b1 100644 --- a/basegfx/source/curve/b2dcubicbezier.cxx +++ b/basegfx/source/curve/b2dcubicbezier.cxx @@ -325,17 +325,9 @@ namespace basegfx namespace basegfx { -B2DCubicBezier::B2DCubicBezier(const B2DCubicBezier& rBezier) -: maStartPoint(rBezier.maStartPoint), -maEndPoint(rBezier.maEndPoint), -maControlPointA(rBezier.maControlPointA), -maControlPointB(rBezier.maControlPointB) -{ -} +B2DCubicBezier::B2DCubicBezier(const B2DCubicBezier&) = default; -B2DCubicBezier::B2DCubicBezier() -{ -} +B2DCubicBezier::B2DCubicBezier() = default; B2DCubicBezier::B2DCubicBezier(const B2DPoint& rStart, const B2DPoint& rControlPointA, const B2DPoint& rControlPointB, const B2DPoint& rEnd) : maStartPoint(rStart), @@ -345,20 +337,10 @@ namespace basegfx { } -B2DCubicBezier::~B2DCubicBezier() -{ -} +B2DCubicBezier::~B2DCubicBezier() = default; // assignment operator -B2DCubicBezier& B2DCubicBezier::operator=(const B2DCubicBezier& rBezier) -{ -maStartPoint = rBezier.maStartPoint; -maEndPoint = rBezier.maEndPoint; -maControlPointA = rBezier.maControlPointA; -maControlPointB = rBezier.maControlPointB; - -return *this; -} +B2DCubicBezier& B2DCubicBezier::operator=(const B2DCubicBezier&) = default; // compare operators bool B2DCubicBezier::operator==(const B2DCubicBezier& rBezier) const diff --git a/basegfx/source/matrix/b2dhommatrix.cxx b/basegfx/source/matrix/b2dhommatrix.cxx index 466e9037d149..053ca89d02de 100644 --- a/basegfx/source/matrix/b2dhommatrix.cxx +++ b/basegfx/source/matrix/b2dhommatrix.cxx @@ -31,24 +31,13 @@ namespace basegfx { }; -B2DHomMatrix::B2DHomMatrix() -: mpImpl() // identity -{ -} +B2DHomMatrix::B2DHomMatrix() = default; -B2DHomMatrix::B2DHomMatrix(const B2DHomMatrix& rMat) : -mpImpl(rMat.mpImpl) -{ -} +B2DHomMatrix::B2DHomMatrix(const B2DHomMatrix&) = default; -B2DHomMatrix::B2DHomMatrix(B2DHomMatrix&& rMat) : -mpImpl(std::move(rMat.mpImpl)) -{ -} +B2DHomMatrix::B2DHomMatrix(B2DHomMatrix&&) = default; -B2DHomMatrix::~B2DHomMatrix() -{ -} +B2DHomMatrix::~B2DHomMatrix() = default; B2DHomMatrix::B2DHomMatrix(double f_0x0, double f_0x1, double f_0x2, double f_1x0, double f_1x1, double f_1x2) : mpImpl() // identity @@ -61,17 +50,9 @@ namespace basegfx mpImpl->set(1, 2, f_1x2); } -B2DHomMatrix& B2DHomMatrix::operator=(const B2DHomMatrix& rMat) -{ -mpImpl = rMat.mpImpl; -return *this; -} +B2DHomMatrix& B2DHomMatrix::operator=(const B2DHomMatrix&) = default; -B2DHomMatrix& B2DHomMatrix::operator=(B2DHomMatrix&& rMat) -{ -mpImpl = std::move(rMat.mpImpl); -return *this; -} +B2DHomMatrix& B2DHomMatrix::operator=(B2DHomMatrix&&) = default; double B2DHomMatrix::get(sal_uInt16 nRow, sal_uInt16 nColumn) const { diff --git a/basegfx/source/matrix/b3dhommatrix.cxx b/basegfx/source/matrix/b3dhommatrix.cxx index b55dd079b514..2e5e798fb001 100644 --- a/basegfx/source/matrix/b3dhommatrix.cxx +++ b/basegfx/source/matrix/b3dhommatrix.cxx @@ -29,36 +29,17 @@ namespace basegfx { }; -B3DHomMatrix::B3DHomMatrix() -: mpImpl() // identity -{ -} +B3DHomMatrix::B3DHomMatrix() = default; -B3DHomMatrix::B3DHomMatrix(const B3DHomMatrix& rMat) : -mpImpl(rMat.mpImpl) -{ -} +B3DHomMatrix::B3DHomMatrix(const B3DHomMatrix&) = default; -B3DHomMatrix::B3DHomMatrix(B3DHomMatrix&& rMat) : -mpImpl(std::move(rMat.mpImpl)) -{ -} +B3DHomMatrix::B3DHomMatrix(B3DHomM
[ANN] libetonyek 0.1.8 has been released
libetonyek is a library for parsing Apple Keynote, Pages and Numbers formats. Special thanks to Laurent Alonso, who did most of the work for this release! List of changes: - All formats: + Parse fields. + Improve parsing of lists. + Fix output of orphans and widows paragraph properties. + Correctly handle rectangles with rounded corners. + Improve output of callouts. + Parse line ends (arrows). + Parse curves with multiple components. + Improve parsing of fills. + Improve parsing of tables. + Handle cropped images. + Parse grouped shapes. + Parse audio/video preview images. + Parse text wrap. - Keynote 2-5: + Parse old-style images (Keynote 2-3?). + Parse slide styles. + Output master slides. + Parse connection lines. - Keynote 6: + Improve detection of Keynote 6 documents. (tdf#113737) + Output master slides. + Parse connection lines. - Numbers 1-2: + Properly parse TRUE and FALSE functions. - Pages 1-4: + Parse annotations. + Improve parsing of images (position etc.). + Handle tables in a group. + Parse page dimensions from print settings. - Pages 5: + Parse page dimensions. + Parse footnotes/endnotes. + Parse comments. + Parse headers/footers. + Parse tables. + Parse textboxes. + Fix line spacing and paragraph margins. + Parse more text properties. - Miscellaneous: + Add support for Keynote 1 documents. + Add support for Numbers 3 documents. + Fix several issues found by oss-fuzz. + Fix build with glm 0.9.9. + Other fixes and improvements. Home page: https://wiki.documentfoundation.org/DLP/Libraries/libetonyek Download from: http://dev-www.libreoffice.org/src/libetonyek/ D. ___ LibreOffice mailing list LibreOffice@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice
[Libreoffice-commits] core.git: vcl/source
vcl/source/gdi/CommonSalLayout.cxx |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) New commits: commit 88d0b8ac42a6d60c385d1e90c5cb84e9e9d194be Author: Khaled Hosny Date: Sat Apr 21 19:03:38 2018 +0200 Glyph flags is now an int not long Change-Id: Ica262bf1f1d36ae731647ee0a0345901aa7265ec Reviewed-on: https://gerrit.libreoffice.org/53267 Tested-by: Jenkins Reviewed-by: Khaled Hosny diff --git a/vcl/source/gdi/CommonSalLayout.cxx b/vcl/source/gdi/CommonSalLayout.cxx index c455475ba53d..5f27b744779d 100644 --- a/vcl/source/gdi/CommonSalLayout.cxx +++ b/vcl/source/gdi/CommonSalLayout.cxx @@ -753,7 +753,7 @@ bool CommonSalLayout::LayoutText(ImplLayoutArgs& rArgs) continue; } -long nGlyphFlags = 0; +int nGlyphFlags = 0; if (bRightToLeft) nGlyphFlags |= GlyphItem::IS_RTL_GLYPH; @@ -767,7 +767,7 @@ bool CommonSalLayout::LayoutText(ImplLayoutArgs& rArgs) nGlyphFlags |= GlyphItem::IS_DIACRITIC; if (u_isUWhiteSpace(aChar)) - nGlyphFlags |= GlyphItem::IS_SPACING; +nGlyphFlags |= GlyphItem::IS_SPACING; if (aSubRun.maScript == HB_SCRIPT_ARABIC && HB_DIRECTION_IS_BACKWARD(aSubRun.maDirection) && ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: vcl/inc vcl/source
vcl/inc/sallayout.hxx|4 +++- vcl/source/gdi/sallayout.cxx |9 - 2 files changed, 7 insertions(+), 6 deletions(-) New commits: commit bb56e2ded30d190c57810812983e5010f6945915 Author: Khaled Hosny Date: Sat Apr 21 20:38:58 2018 +0200 Don’t abuse glyph id for flagging dropped glyphs Use a bitflag instead. Change-Id: I7833a37578112b5326f4a30578596e53085ff3c0 Reviewed-on: https://gerrit.libreoffice.org/53269 Tested-by: Jenkins Reviewed-by: Khaled Hosny diff --git a/vcl/inc/sallayout.hxx b/vcl/inc/sallayout.hxx index ba9cd3bd08e9..ffc38d4b8adf 100644 --- a/vcl/inc/sallayout.hxx +++ b/vcl/inc/sallayout.hxx @@ -286,7 +286,8 @@ public: IS_DIACRITIC = 0x004, IS_VERTICAL = 0x008, IS_SPACING= 0x010, -ALLOW_KASHIDA = 0x020 +ALLOW_KASHIDA = 0x020, +IS_DROPPED= 0x040 }; boolIsClusterStart() const { return ((mnFlags & IS_IN_CLUSTER) == 0); } @@ -295,6 +296,7 @@ public: boolIsVertical() const { return ((mnFlags & IS_VERTICAL) != 0); } boolIsSpacing() const { return ((mnFlags & IS_SPACING) != 0); } boolAllowKashida() const{ return ((mnFlags & ALLOW_KASHIDA) != 0); } +boolIsDropped() const { return ((mnFlags & IS_DROPPED) != 0); } }; class VCL_PLUGIN_PUBLIC GenericSalLayout : public SalLayout diff --git a/vcl/source/gdi/sallayout.cxx b/vcl/source/gdi/sallayout.cxx index 616fc63e27fc..2d73d55517ea 100644 --- a/vcl/source/gdi/sallayout.cxx +++ b/vcl/source/gdi/sallayout.cxx @@ -47,7 +47,6 @@ // Glyph Flags #define GF_FONTMASK 0xF000 #define GF_FONTSHIFT 28 -#define GF_DROPPED 0x std::ostream &operator <<(std::ostream& s, ImplLayoutArgs const &rArgs) @@ -1003,19 +1002,19 @@ void GenericSalLayout::DropGlyph( int nStart ) std::vector::iterator pGlyphIter = m_GlyphItems.begin(); pGlyphIter += nStart; -pGlyphIter->maGlyphId = GF_DROPPED; pGlyphIter->mnCharPos = -1; +pGlyphIter->mnFlags |= GlyphItem::IS_DROPPED; } void GenericSalLayout::Simplify( bool bIsBase ) { -const sal_GlyphId nDropMarker = bIsBase ? GF_DROPPED : 0; - // remove dropped glyphs inplace size_t j = 0; for(size_t i = 0; i < m_GlyphItems.size(); i++ ) { -if( m_GlyphItems[i].maGlyphId == nDropMarker ) +if (bIsBase && m_GlyphItems[i].IsDropped()) +continue; +if (!bIsBase && m_GlyphItems[i].maGlyphId == 0) continue; if( i != j ) ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: include/vcl vcl/Library_vcl.mk vcl/source
include/vcl/BitmapMosaicFilter.hxx | 36 + include/vcl/bitmap.hxx |1 vcl/Library_vcl.mk |1 vcl/source/bitmap/BitmapMosaicFilter.cxx | 187 +++ vcl/source/gdi/bitmap4.cxx | 183 +- 5 files changed, 233 insertions(+), 175 deletions(-) New commits: commit 63a716783a555e91ad3a32f25f20cffc88ca15e4 Author: Chris Sherlock Date: Fri Apr 20 20:39:48 2018 +1000 vcl: ImplMosaic() -> BitmapMosaicFilter Change-Id: Ia0910ae9166c4eb6b870ab25db761bc1703fec68 Reviewed-on: https://gerrit.libreoffice.org/53203 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl diff --git a/include/vcl/BitmapMosaicFilter.hxx b/include/vcl/BitmapMosaicFilter.hxx new file mode 100644 index ..0fbf19613b5f --- /dev/null +++ b/include/vcl/BitmapMosaicFilter.hxx @@ -0,0 +1,36 @@ +/* -*- 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/. + * + */ + +#ifndef INCLUDED_VCL_BITMAPMOSAICFILTER_HXX +#define INCLUDED_VCL_BITMAPMOSAICFILTER_HXX + +#include + +class BitmapEx; + +class VCL_DLLPUBLIC BitmapMosaicFilter : public BitmapFilter +{ +public: +BitmapMosaicFilter(sal_uLong nTileWidth, sal_uLong nTileHeight) +: mnTileWidth(nTileWidth) +, mnTileHeight(nTileHeight) +{ +} + +virtual BitmapEx execute(BitmapEx const& rBitmapEx) override; + +private: +sal_uLong mnTileWidth; +sal_uLong mnTileHeight; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/vcl/bitmap.hxx b/include/vcl/bitmap.hxx index b71f8a4224ba..2c1621041d7a 100644 --- a/include/vcl/bitmap.hxx +++ b/include/vcl/bitmap.hxx @@ -659,7 +659,6 @@ public: SAL_DLLPRIVATE bool ImplDitherFloyd16(); SAL_DLLPRIVATE bool ImplEmbossGrey( const BmpFilterParam* pFilterParam ); -SAL_DLLPRIVATE bool ImplMosaic( const BmpFilterParam* pFilterParam ); SAL_DLLPRIVATE bool ImplDuotoneFilter( const sal_uLong nColorOne, sal_uLong nColorTwo ); public: diff --git a/vcl/Library_vcl.mk b/vcl/Library_vcl.mk index 82f67dd845b9..49044708edd3 100644 --- a/vcl/Library_vcl.mk +++ b/vcl/Library_vcl.mk @@ -315,6 +315,7 @@ $(eval $(call gb_Library_add_exception_objects,vcl,\ vcl/source/bitmap/BitmapSobelGreyFilter \ vcl/source/bitmap/BitmapSolarizeFilter \ vcl/source/bitmap/BitmapSepiaFilter \ +vcl/source/bitmap/BitmapMosaicFilter \ vcl/source/bitmap/BitmapPopArtFilter \ vcl/source/bitmap/BitmapConvolutionMatrixFilter \ vcl/source/bitmap/BitmapMedianFilter \ diff --git a/vcl/source/bitmap/BitmapMosaicFilter.cxx b/vcl/source/bitmap/BitmapMosaicFilter.cxx new file mode 100644 index ..faefbe5d3766 --- /dev/null +++ b/vcl/source/bitmap/BitmapMosaicFilter.cxx @@ -0,0 +1,187 @@ +/* -*- 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/. + * + */ + +#include +#include +#include +#include + +#include + +BitmapEx BitmapMosaicFilter::execute(BitmapEx const& rBitmapEx) +{ +Bitmap aBitmap(rBitmapEx.GetBitmap()); + +bool bRet = false; + +if (!mnTileWidth) +mnTileWidth = 1; + +if (!mnTileHeight) +mnTileHeight = 1; + +if (mnTileWidth > 1 || mnTileHeight > 1) +{ +Bitmap* pNewBmp; +BitmapReadAccess* pReadAcc; +BitmapWriteAccess* pWriteAcc; + +if (aBitmap.GetBitCount() > 8) +{ +pNewBmp = nullptr; +pReadAcc = pWriteAcc = aBitmap.AcquireWriteAccess(); +} +else +{ +pNewBmp = new Bitmap(aBitmap.GetSizePixel(), 24); +pReadAcc = aBitmap.AcquireReadAccess(); +pWriteAcc = pNewBmp->AcquireWriteAccess(); +} + +bool bConditionsMet = false; +long nWidth(0); +long nHeight(0); +if (pReadAcc && pWriteAcc) +{ +nWidth = pReadAcc->Width(); +nHeight = pReadAcc->Height(); +bConditionsMet = (nWidth > 0 && nHeight > 0); +} + +if (bConditionsMet) +{ +BitmapColor aCol; +long nX, nY, nX1, nX2, nY1, nY2, nSumR, nSumG, nSumB; +double fArea_1; + +nY1 = 0; +nY2 = mnTileHeight - 1; + +if (nY2 >= nHeight) +nY2 = nHeight - 1; + +do +{ +nX1 = 0; +nX2 = mnTileWidth - 1;
[Libreoffice-commits] core.git: 3 commits - include/vcl vcl/Library_vcl.mk vcl/source
include/vcl/BitmapPopArtFilter.hxx | 33 include/vcl/BitmapSepiaFilter.hxx | 34 include/vcl/BitmapSolarizeFilter.hxx | 34 include/vcl/bitmap.hxx |3 vcl/Library_vcl.mk |3 vcl/source/bitmap/BitmapPopArtFilter.cxx | 118 ++ vcl/source/bitmap/BitmapSepiaFilter.cxx| 106 vcl/source/bitmap/BitmapSolarizeFilter.cxx | 68 vcl/source/gdi/bitmap4.cxx | 239 ++--- 9 files changed, 414 insertions(+), 224 deletions(-) New commits: commit 1ab12471f3a69c4d502e6271e84ddf8a981f507f Author: Chris Sherlock Date: Fri Apr 20 20:32:23 2018 +1000 vcl: ImplSepia -> BitmapSepiaFilter Change-Id: I96a4072bf919bd37b30c01ab16d98779c76717ab Reviewed-on: https://gerrit.libreoffice.org/53202 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl diff --git a/include/vcl/BitmapSepiaFilter.hxx b/include/vcl/BitmapSepiaFilter.hxx new file mode 100644 index ..717f10d1466b --- /dev/null +++ b/include/vcl/BitmapSepiaFilter.hxx @@ -0,0 +1,34 @@ +/* -*- 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/. + * + */ + +#ifndef INCLUDED_VCL_BITMAPSEPIAFILTER_HXX +#define INCLUDED_VCL_BITMAPSEPIAFILTER_HXX + +#include + +class BitmapEx; + +class VCL_DLLPUBLIC BitmapSepiaFilter : public BitmapFilter +{ +public: +BitmapSepiaFilter(double nSepiaPercent) +: mnSepiaPercent(nSepiaPercent) +{ +} + +virtual BitmapEx execute(BitmapEx const& rBitmapEx) override; + +private: +sal_uInt16 mnSepiaPercent; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/vcl/bitmap.hxx b/include/vcl/bitmap.hxx index bffeca808ea2..b71f8a4224ba 100644 --- a/include/vcl/bitmap.hxx +++ b/include/vcl/bitmap.hxx @@ -659,7 +659,6 @@ public: SAL_DLLPRIVATE bool ImplDitherFloyd16(); SAL_DLLPRIVATE bool ImplEmbossGrey( const BmpFilterParam* pFilterParam ); -SAL_DLLPRIVATE bool ImplSepia( const BmpFilterParam* pFilterParam ); SAL_DLLPRIVATE bool ImplMosaic( const BmpFilterParam* pFilterParam ); SAL_DLLPRIVATE bool ImplDuotoneFilter( const sal_uLong nColorOne, sal_uLong nColorTwo ); diff --git a/vcl/Library_vcl.mk b/vcl/Library_vcl.mk index 940bd8b35974..82f67dd845b9 100644 --- a/vcl/Library_vcl.mk +++ b/vcl/Library_vcl.mk @@ -314,6 +314,7 @@ $(eval $(call gb_Library_add_exception_objects,vcl,\ vcl/source/bitmap/bitmapfilter \ vcl/source/bitmap/BitmapSobelGreyFilter \ vcl/source/bitmap/BitmapSolarizeFilter \ +vcl/source/bitmap/BitmapSepiaFilter \ vcl/source/bitmap/BitmapPopArtFilter \ vcl/source/bitmap/BitmapConvolutionMatrixFilter \ vcl/source/bitmap/BitmapMedianFilter \ diff --git a/vcl/source/bitmap/BitmapSepiaFilter.cxx b/vcl/source/bitmap/BitmapSepiaFilter.cxx new file mode 100644 index ..a953fcbee2a8 --- /dev/null +++ b/vcl/source/bitmap/BitmapSepiaFilter.cxx @@ -0,0 +1,106 @@ +/* -*- 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/. + * + */ + +#include +#include +#include +#include + +#include + +BitmapEx BitmapSepiaFilter::execute(BitmapEx const& rBitmapEx) +{ +Bitmap aBitmap(rBitmapEx.GetBitmap()); +Bitmap::ScopedReadAccess pReadAcc(aBitmap); +bool bRet = false; + +if (pReadAcc) +{ +const long nSepia = 1 - 100 * SAL_BOUND(mnSepiaPercent, 0, 100); +BitmapPalette aSepiaPal(256); + +for (sal_uInt16 i = 0; i < 256; i++) +{ +BitmapColor& rCol = aSepiaPal[i]; +const sal_uInt8 cSepiaValue = static_cast(nSepia * i / 1); + +rCol.SetRed(static_cast(i)); +rCol.SetGreen(cSepiaValue); +rCol.SetBlue(cSepiaValue); +} + +Bitmap aNewBmp(aBitmap.GetSizePixel(), 8, &aSepiaPal); +BitmapScopedWriteAccess pWriteAcc(aNewBmp); + +if (pWriteAcc) +{ +BitmapColor aCol(sal_uInt8(0)); +const long nWidth = pWriteAcc->Width(); +const long nHeight = pWriteAcc->Height(); + +if (pReadAcc->HasPalette()) +{ +const sal_uInt16 nPalCount = pReadAcc->GetPaletteEntryCount(); +std::unique_ptr pIndexMap(new sal_uInt8[nPalCount]); +for (sal_uInt16 i = 0; i < nPalCount; i++) +{ +
[Libreoffice-commits] core.git: include/vcl vcl/Library_vcl.mk vcl/source
include/vcl/BitmapSobelGreyFilter.hxx | 26 include/vcl/bitmap.hxx |1 vcl/Library_vcl.mk |1 vcl/source/bitmap/BitmapSobelGreyFilter.cxx | 166 vcl/source/gdi/bitmap4.cxx | 135 +- 5 files changed, 199 insertions(+), 130 deletions(-) New commits: commit 0474be6d5527baab609b16846d6cb38ed89d47fc Author: Chris Sherlock Date: Thu Apr 19 20:36:10 2018 +1000 vcl: ImplSobelGrey() -> BitmapSobelGreyFilter Change-Id: I2082d7e3b90172b4517ad0f4be75f85006eb5891 Reviewed-on: https://gerrit.libreoffice.org/53150 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl diff --git a/include/vcl/BitmapSobelGreyFilter.hxx b/include/vcl/BitmapSobelGreyFilter.hxx new file mode 100644 index ..ac4cd9498d65 --- /dev/null +++ b/include/vcl/BitmapSobelGreyFilter.hxx @@ -0,0 +1,26 @@ +/* -*- 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/. + * + */ + +#ifndef INCLUDED_VCL_BITMAPSOBELGREYILTER_HXX +#define INCLUDED_VCL_BITMAPSOBELGREYILTER_HXX + +#include + +class VCL_DLLPUBLIC BitmapSobelGreyFilter : public BitmapFilter +{ +public: +BitmapSobelGreyFilter() {} + +virtual BitmapEx execute(BitmapEx const& rBitmapEx) override; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/vcl/bitmap.hxx b/include/vcl/bitmap.hxx index b89b2004fed6..7f560e517ab0 100644 --- a/include/vcl/bitmap.hxx +++ b/include/vcl/bitmap.hxx @@ -658,7 +658,6 @@ public: SAL_DLLPRIVATE bool ImplDitherFloyd(); SAL_DLLPRIVATE bool ImplDitherFloyd16(); -SAL_DLLPRIVATE bool ImplSobelGrey(); SAL_DLLPRIVATE bool ImplEmbossGrey( const BmpFilterParam* pFilterParam ); SAL_DLLPRIVATE bool ImplSolarize( const BmpFilterParam* pFilterParam ); SAL_DLLPRIVATE bool ImplSepia( const BmpFilterParam* pFilterParam ); diff --git a/vcl/Library_vcl.mk b/vcl/Library_vcl.mk index ba26fb7fa91e..72aa7e122217 100644 --- a/vcl/Library_vcl.mk +++ b/vcl/Library_vcl.mk @@ -312,6 +312,7 @@ $(eval $(call gb_Library_add_exception_objects,vcl,\ vcl/source/graphic/UnoGraphicTransformer \ vcl/source/bitmap/bitmap \ vcl/source/bitmap/bitmapfilter \ +vcl/source/bitmap/BitmapSobelGreyFilter \ vcl/source/bitmap/BitmapConvolutionMatrixFilter \ vcl/source/bitmap/BitmapMedianFilter \ vcl/source/bitmap/BitmapInterpolateScaleFilter \ diff --git a/vcl/source/bitmap/BitmapSobelGreyFilter.cxx b/vcl/source/bitmap/BitmapSobelGreyFilter.cxx new file mode 100644 index ..450772dd2abe --- /dev/null +++ b/vcl/source/bitmap/BitmapSobelGreyFilter.cxx @@ -0,0 +1,166 @@ +/* -*- 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/. + * + */ + +#include +#include +#include +#include + +#include + +BitmapEx BitmapSobelGreyFilter::execute(BitmapEx const& rBitmapEx) +{ +Bitmap aBitmap(rBitmapEx.GetBitmap()); + +bool bRet = aBitmap.ImplMakeGreyscales(256); + +if (bRet) +{ +bRet = false; + +Bitmap::ScopedReadAccess pReadAcc(aBitmap); + +if (pReadAcc) +{ +Bitmap aNewBmp(aBitmap.GetSizePixel(), 8, &pReadAcc->GetPalette()); +BitmapScopedWriteAccess pWriteAcc(aNewBmp); + +if (pWriteAcc) +{ +BitmapColor aGrey(sal_uInt8(0)); +const long nWidth = pWriteAcc->Width(); +const long nHeight = pWriteAcc->Height(); +const long nMask111 = -1, nMask121 = 0, nMask131 = 1; +const long nMask211 = -2, nMask221 = 0, nMask231 = 2; +const long nMask311 = -1, nMask321 = 0, nMask331 = 1; +const long nMask112 = 1, nMask122 = 2, nMask132 = 1; +const long nMask212 = 0, nMask222 = 0, nMask232 = 0; +const long nMask312 = -1, nMask322 = -2, nMask332 = -1; +long nGrey11, nGrey12, nGrey13; +long nGrey21, nGrey22, nGrey23; +long nGrey31, nGrey32, nGrey33; +long* pHMap = new long[nWidth + 2]; +long* pVMap = new long[nHeight + 2]; +long nX, nY, nSum1, nSum2; + +// fill mapping tables +pHMap[0] = 0; + +for (nX = 1; nX <= nWidth; nX++) +{ +pHMap[nX] = nX - 1; +
[Libreoffice-commits] core.git: include/vcl vcl/Library_vcl.mk vcl/source
include/vcl/BitmapMedianFilter.hxx | 28 +++ include/vcl/bitmap.hxx |1 vcl/Library_vcl.mk |1 vcl/source/bitmap/BitmapMedianFilter.cxx | 226 +++ vcl/source/gdi/bitmap4.cxx | 175 5 files changed, 261 insertions(+), 170 deletions(-) New commits: commit 5b5d84df69765b9bd2fccb76a16d824720eea462 Author: Chris Sherlock Date: Thu Apr 19 07:02:34 2018 +1000 vcl: ImplMedianFilter() -> BitmapMedianFilter Change-Id: I72a0546c11d6ef8a8a4eb467d566d639c88dc8b9 Reviewed-on: https://gerrit.libreoffice.org/53130 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl diff --git a/include/vcl/BitmapMedianFilter.hxx b/include/vcl/BitmapMedianFilter.hxx new file mode 100644 index ..e51a66eabcb7 --- /dev/null +++ b/include/vcl/BitmapMedianFilter.hxx @@ -0,0 +1,28 @@ +/* -*- 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/. + * + */ + +#ifndef INCLUDED_VCL_BITMAPMEDIANFILTER_HXX +#define INCLUDED_VCL_BITMAPMEDIANFILTER_HXX + +#include + +class BitmapEx; + +class VCL_DLLPUBLIC BitmapMedianFilter : public BitmapFilter +{ +public: +BitmapMedianFilter() {} + +virtual BitmapEx execute(BitmapEx const& rBitmapEx) override; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/vcl/bitmap.hxx b/include/vcl/bitmap.hxx index df6d094a9886..b89b2004fed6 100644 --- a/include/vcl/bitmap.hxx +++ b/include/vcl/bitmap.hxx @@ -658,7 +658,6 @@ public: SAL_DLLPRIVATE bool ImplDitherFloyd(); SAL_DLLPRIVATE bool ImplDitherFloyd16(); -SAL_DLLPRIVATE bool ImplMedianFilter(); SAL_DLLPRIVATE bool ImplSobelGrey(); SAL_DLLPRIVATE bool ImplEmbossGrey( const BmpFilterParam* pFilterParam ); SAL_DLLPRIVATE bool ImplSolarize( const BmpFilterParam* pFilterParam ); diff --git a/vcl/Library_vcl.mk b/vcl/Library_vcl.mk index 57cd8d3962c7..ba26fb7fa91e 100644 --- a/vcl/Library_vcl.mk +++ b/vcl/Library_vcl.mk @@ -313,6 +313,7 @@ $(eval $(call gb_Library_add_exception_objects,vcl,\ vcl/source/bitmap/bitmap \ vcl/source/bitmap/bitmapfilter \ vcl/source/bitmap/BitmapConvolutionMatrixFilter \ +vcl/source/bitmap/BitmapMedianFilter \ vcl/source/bitmap/BitmapInterpolateScaleFilter \ vcl/source/bitmap/BitmapLightenFilter \ vcl/source/bitmap/BitmapDisabledImageFilter \ diff --git a/vcl/source/bitmap/BitmapMedianFilter.cxx b/vcl/source/bitmap/BitmapMedianFilter.cxx new file mode 100644 index ..45f1149a1c0c --- /dev/null +++ b/vcl/source/bitmap/BitmapMedianFilter.cxx @@ -0,0 +1,226 @@ +/* -*- 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/. + * + */ + +#include + +#include +#include +#include +#include + +#include + +#define S2(a, b) \ +{ \ +long t; \ +if ((t = b - a) < 0) \ +{ \ +a += t; \ +b -= t; \ +} \ +} +#define MN3(a, b, c) \ +S2(a, b); \ +S2(a, c); +#define MX3(a, b, c) \ +S2(b, c); \ +S2(a, c); +#define MNMX3(a, b, c) \ +MX3(a, b, c); \ +S2(a, b); +#define MNMX4(a, b, c, d) \ +S2(a, b);
[Libreoffice-commits] core.git: include/vcl vcl/source
include/vcl/BitmapConvolutionMatrixFilter.hxx |7 +- include/vcl/BitmapSharpenFilter.hxx | 28 ++ vcl/source/gdi/bitmap4.cxx|5 +--- 3 files changed, 36 insertions(+), 4 deletions(-) New commits: commit 8559353af24123c7a736e64311d57d85bb3cb44c Author: Chris Sherlock Date: Thu Apr 19 06:50:32 2018 +1000 vcl: introduce BitmapSharpenFilter Change-Id: Ib503efa3634b3a000261d2398d04f779079bfe3f Reviewed-on: https://gerrit.libreoffice.org/53129 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl diff --git a/include/vcl/BitmapConvolutionMatrixFilter.hxx b/include/vcl/BitmapConvolutionMatrixFilter.hxx index d27bfffb0fcd..a2189326322b 100644 --- a/include/vcl/BitmapConvolutionMatrixFilter.hxx +++ b/include/vcl/BitmapConvolutionMatrixFilter.hxx @@ -20,6 +20,11 @@ class BitmapEx; class VCL_DLLPUBLIC BitmapConvolutionMatrixFilter : public BitmapFilter { public: +BitmapConvolutionMatrixFilter() +: mpMatrix(nullptr) +{ +} + BitmapConvolutionMatrixFilter(const long* pMatrix) : mpMatrix(pMatrix) { @@ -29,7 +34,7 @@ public: virtual BitmapEx execute(BitmapEx const& rBitmapEx) override; -private: +protected: const long* mpMatrix; }; diff --git a/include/vcl/BitmapSharpenFilter.hxx b/include/vcl/BitmapSharpenFilter.hxx new file mode 100644 index ..7e965976d5e8 --- /dev/null +++ b/include/vcl/BitmapSharpenFilter.hxx @@ -0,0 +1,28 @@ +/* -*- 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/. + * + */ + +#ifndef INCLUDED_VCL_BITMAPSHARPENFILTER_HXX +#define INCLUDED_VCL_BITMAPSHARPENFILTER_HXX + +#include + +class VCL_DLLPUBLIC BitmapSharpenFilter : public BitmapConvolutionMatrixFilter +{ +public: +BitmapSharpenFilter() +{ +const long pSharpenMatrix[] = { -1, -1, -1, -1, 16, -1, -1, -1, -1 }; +mpMatrix = &pSharpenMatrix[0]; +} +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/gdi/bitmap4.cxx b/vcl/source/gdi/bitmap4.cxx index e7c18f01718d..f13aa0bb9d24 100644 --- a/vcl/source/gdi/bitmap4.cxx +++ b/vcl/source/gdi/bitmap4.cxx @@ -21,7 +21,7 @@ #include #include #include -#include +#include #include @@ -60,9 +60,8 @@ bool Bitmap::Filter( BmpFilter eFilter, const BmpFilterParam* pFilterParam ) case BmpFilter::Sharpen: { -const long pSharpenMatrix[] = { -1, -1, -1, -1, 16, -1, -1, -1, -1 }; BitmapEx aBmpEx(*this); -bRet = BitmapFilter::Filter(aBmpEx, BitmapConvolutionMatrixFilter(&pSharpenMatrix[0])); +bRet = BitmapFilter::Filter(aBmpEx, BitmapSharpenFilter()); *this = aBmpEx.GetBitmap(); } break; ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: include/vcl vcl/Library_vcl.mk vcl/source
include/vcl/BitmapSmoothenFilter.hxx | 34 +++ vcl/Library_vcl.mk |3 +- vcl/source/bitmap/BitmapSmoothenFilter.cxx | 36 + vcl/source/gdi/bitmap4.cxx | 24 +++ 4 files changed, 76 insertions(+), 21 deletions(-) New commits: commit 57faa86592ddfc60be206b70ee16671585b7ca60 Author: Chris Sherlock Date: Wed Apr 18 21:19:58 2018 +1000 vcl: create BitmapSmoothenFilter Change-Id: I5259035e18daada3cd8963f045731a0a65150718 Reviewed-on: https://gerrit.libreoffice.org/53099 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl diff --git a/include/vcl/BitmapSmoothenFilter.hxx b/include/vcl/BitmapSmoothenFilter.hxx new file mode 100644 index ..131809700680 --- /dev/null +++ b/include/vcl/BitmapSmoothenFilter.hxx @@ -0,0 +1,34 @@ +/* -*- 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/. + * + */ + +#ifndef INCLUDED_VCL_BITMAPSMOOTHENFILTER_HXX +#define INCLUDED_VCL_BITMAPSMOOTHENFILTER_HXX + +#include + +class BitmapEx; + +class VCL_DLLPUBLIC BitmapSmoothenFilter : public BitmapFilter +{ +public: +BitmapSmoothenFilter(double fRadius) +: mfRadius(fRadius) +{ +} + +virtual BitmapEx execute(BitmapEx const& rBitmapEx) override; + +private: +double mfRadius; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/Library_vcl.mk b/vcl/Library_vcl.mk index 644620981c94..57cd8d3962c7 100644 --- a/vcl/Library_vcl.mk +++ b/vcl/Library_vcl.mk @@ -320,7 +320,8 @@ $(eval $(call gb_Library_add_exception_objects,vcl,\ vcl/source/bitmap/bitmappaint \ vcl/source/bitmap/BitmapGaussianSeparableBlurFilter \ vcl/source/bitmap/BitmapSeparableUnsharpenFilter \ -vcl/source/bitmap/BitmapFastScaleFilter \ +vcl/source/bitmap/BitmapSmoothenFilter \ + vcl/source/bitmap/BitmapFastScaleFilter \ vcl/source/bitmap/BitmapScaleSuperFilter \ vcl/source/bitmap/BitmapScaleConvolutionFilter \ vcl/source/bitmap/BitmapSymmetryCheck \ diff --git a/vcl/source/bitmap/BitmapSmoothenFilter.cxx b/vcl/source/bitmap/BitmapSmoothenFilter.cxx new file mode 100644 index ..4c3b3f53c368 --- /dev/null +++ b/vcl/source/bitmap/BitmapSmoothenFilter.cxx @@ -0,0 +1,36 @@ +/* -*- 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/. + * + */ + +#include +#include +#include +#include +#include +#include + +#include + +BitmapEx BitmapSmoothenFilter::execute(BitmapEx const& rBitmapEx) +{ +BitmapEx aBitmapEx(rBitmapEx); +bool bRet = false; + +if (mfRadius > 0.0) // Blur for positive values of mnRadius +bRet = BitmapFilter::Filter(aBitmapEx, BitmapGaussianSeparableBlurFilter(mfRadius)); +else if (mfRadius < 0.0) // Unsharpen mask for negative values of mnRadius +bRet = BitmapFilter::Filter(aBitmapEx, BitmapSeparableUnsharpenFilter(mfRadius)); + +if (bRet) +return BitmapEx(rBitmapEx); + +return BitmapEx(); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/gdi/bitmap4.cxx b/vcl/source/gdi/bitmap4.cxx index 8e4d7a7d2f36..e7c18f01718d 100644 --- a/vcl/source/gdi/bitmap4.cxx +++ b/vcl/source/gdi/bitmap4.cxx @@ -20,8 +20,7 @@ #include #include #include -#include -#include +#include #include #include @@ -53,24 +52,9 @@ bool Bitmap::Filter( BmpFilter eFilter, const BmpFilterParam* pFilterParam ) { case BmpFilter::Smooth: { -// Blur for positive values of mnRadius -if (pFilterParam->mnRadius > 0.0) -{ -BitmapEx aBmpEx(*this); -bRet = BitmapFilter::Filter(aBmpEx, BitmapGaussianSeparableBlurFilter(pFilterParam->mnRadius)); -*this = aBmpEx.GetBitmap(); -} -// Unsharpen Mask for negative values of mnRadius -else if (pFilterParam->mnRadius < 0.0) -{ -BitmapEx aBmpEx(*this); -bRet = BitmapFilter::Filter(aBmpEx, BitmapSeparableUnsharpenFilter(pFilterParam->mnRadius)); -*this = aBmpEx.GetBitmap(); -} -else -{ -bRet = false; -} +BitmapEx aBmpEx(*this); +bRet = BitmapFilter::Filter(aBmpEx, BitmapSmoothenFilter(pFilterParam->mnRadius)); +*this = aBmpEx.GetBitmap();
[Libreoffice-commits] core.git: include/vcl vcl/Library_vcl.mk vcl/source
include/vcl/BitmapConvolutionMatrixFilter.hxx | 38 +++ include/vcl/bitmap.hxx |2 vcl/Library_vcl.mk |1 vcl/source/bitmap/BitmapConvolutionMatrixFilter.cxx | 199 vcl/source/gdi/bitmap4.cxx | 163 5 files changed, 242 insertions(+), 161 deletions(-) New commits: commit 7b06fcddf8d9a0b51bf396d29487f1fd715b82d3 Author: Chris Sherlock Date: Wed Apr 18 21:06:15 2018 +1000 vcl: ImplConvolute3() -> BitmapConvolutionMatrixFilter Change-Id: I0203e98d29192ef098719c0a297b967710b8729a Reviewed-on: https://gerrit.libreoffice.org/53097 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl diff --git a/include/vcl/BitmapConvolutionMatrixFilter.hxx b/include/vcl/BitmapConvolutionMatrixFilter.hxx new file mode 100644 index ..d27bfffb0fcd --- /dev/null +++ b/include/vcl/BitmapConvolutionMatrixFilter.hxx @@ -0,0 +1,38 @@ +/* -*- 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/. + * + */ + +#ifndef INCLUDED_VCL_BITMAPCONVOLUTIONMATRIXFILTER_HXX +#define INCLUDED_VCL_BITMAPCONVOLUTIONMATRIXFILTER_HXX + +#include + +class BitmapEx; + +/** Filter image based on a 3x3 convolution matrix + */ +class VCL_DLLPUBLIC BitmapConvolutionMatrixFilter : public BitmapFilter +{ +public: +BitmapConvolutionMatrixFilter(const long* pMatrix) +: mpMatrix(pMatrix) +{ +} + +~BitmapConvolutionMatrixFilter() override { delete mpMatrix; } + +virtual BitmapEx execute(BitmapEx const& rBitmapEx) override; + +private: +const long* mpMatrix; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/vcl/bitmap.hxx b/include/vcl/bitmap.hxx index 07573b1af1b0..df6d094a9886 100644 --- a/include/vcl/bitmap.hxx +++ b/include/vcl/bitmap.hxx @@ -658,8 +658,6 @@ public: SAL_DLLPRIVATE bool ImplDitherFloyd(); SAL_DLLPRIVATE bool ImplDitherFloyd16(); -SAL_DLLPRIVATE bool ImplConvolute3( const long* pMatrix ); - SAL_DLLPRIVATE bool ImplMedianFilter(); SAL_DLLPRIVATE bool ImplSobelGrey(); SAL_DLLPRIVATE bool ImplEmbossGrey( const BmpFilterParam* pFilterParam ); diff --git a/vcl/Library_vcl.mk b/vcl/Library_vcl.mk index 8a2edf75b2b4..644620981c94 100644 --- a/vcl/Library_vcl.mk +++ b/vcl/Library_vcl.mk @@ -312,6 +312,7 @@ $(eval $(call gb_Library_add_exception_objects,vcl,\ vcl/source/graphic/UnoGraphicTransformer \ vcl/source/bitmap/bitmap \ vcl/source/bitmap/bitmapfilter \ +vcl/source/bitmap/BitmapConvolutionMatrixFilter \ vcl/source/bitmap/BitmapInterpolateScaleFilter \ vcl/source/bitmap/BitmapLightenFilter \ vcl/source/bitmap/BitmapDisabledImageFilter \ diff --git a/vcl/source/bitmap/BitmapConvolutionMatrixFilter.cxx b/vcl/source/bitmap/BitmapConvolutionMatrixFilter.cxx new file mode 100644 index ..fea2e6dac4f4 --- /dev/null +++ b/vcl/source/bitmap/BitmapConvolutionMatrixFilter.cxx @@ -0,0 +1,199 @@ +/* -*- 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/. + * + */ + +#include + +#include +#include +#include +#include + +#include + +BitmapEx BitmapConvolutionMatrixFilter::execute(BitmapEx const& rBitmapEx) +{ +Bitmap aBitmap(rBitmapEx.GetBitmap()); + +const long nDivisor = 8; +Bitmap::ScopedReadAccess pReadAcc(aBitmap); +bool bRet = false; + +if (pReadAcc) +{ +Bitmap aNewBmp(aBitmap.GetSizePixel(), 24); +BitmapScopedWriteAccess pWriteAcc(aNewBmp); + +if (pWriteAcc) +{ +const long nWidth = pWriteAcc->Width(), nWidth2 = nWidth + 2; +const long nHeight = pWriteAcc->Height(), nHeight2 = nHeight + 2; +long* pColm = new long[nWidth2]; +long* pRows = new long[nHeight2]; +BitmapColor* pColRow1 += reinterpret_cast(new sal_uInt8[sizeof(BitmapColor) * nWidth2]); +BitmapColor* pColRow2 += reinterpret_cast(new sal_uInt8[sizeof(BitmapColor) * nWidth2]); +BitmapColor* pColRow3 += reinterpret_cast(new sal_uInt8[sizeof(BitmapColor) * nWidth2]); +BitmapColor* pRowTmp1 = pColRow1; +BitmapColor* pRowTmp2 = pColRow2; +BitmapColor* pRowTmp3 = pColRow3; +BitmapColor* pColor; +long nY, nX, i, nSumR, nSumG, nSumB, nMatrixVal, nT
[Libreoffice-commits] core.git: vcl/inc
vcl/inc/fontsubset.hxx |2 +- vcl/inc/pch/precompiled_vcl.hxx |1 - vcl/inc/salglyphid.hxx | 27 --- vcl/inc/sallayout.hxx |4 ++-- vcl/inc/unx/fontmanager.hxx |2 +- 5 files changed, 4 insertions(+), 32 deletions(-) New commits: commit 2ed7c02478968852d7d39c2c4677f2ecf3441bc7 Author: Khaled Hosny Date: Sat Apr 21 20:15:03 2018 +0200 Drop header that had just one typedef Move the typedef elsewhere. Change-Id: I7a91ffd5ed4d1f182d6d57c80eb5188892fa5ccd Reviewed-on: https://gerrit.libreoffice.org/53268 Tested-by: Jenkins Reviewed-by: Khaled Hosny diff --git a/vcl/inc/fontsubset.hxx b/vcl/inc/fontsubset.hxx index 7973061eafd8..66368b7cbcb9 100644 --- a/vcl/inc/fontsubset.hxx +++ b/vcl/inc/fontsubset.hxx @@ -24,7 +24,7 @@ #include #include -#include "salglyphid.hxx" +#include "sallayout.hxx" namespace vcl { struct TrueTypeFont; } ///< SFT's idea of a TTF font diff --git a/vcl/inc/pch/precompiled_vcl.hxx b/vcl/inc/pch/precompiled_vcl.hxx index d3ca3bf1e6f3..509a0493ffec 100644 --- a/vcl/inc/pch/precompiled_vcl.hxx +++ b/vcl/inc/pch/precompiled_vcl.hxx @@ -111,7 +111,6 @@ #include #include #include -#include #include #include #include diff --git a/vcl/inc/salglyphid.hxx b/vcl/inc/salglyphid.hxx deleted file mode 100644 index 6f9550e50bca.. --- a/vcl/inc/salglyphid.hxx +++ /dev/null @@ -1,27 +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_SALGLYPHID_HXX -#define INCLUDED_VCL_INC_SALGLYPHID_HXX - -typedef sal_uInt32 sal_GlyphId; - - -#endif // INCLUDED_VCL_INC_SALGLYPHID_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/sallayout.hxx b/vcl/inc/sallayout.hxx index 3e75b606fd75..ba9cd3bd08e9 100644 --- a/vcl/inc/sallayout.hxx +++ b/vcl/inc/sallayout.hxx @@ -32,8 +32,6 @@ #include // for typedef sal_UCS4 #include -#include "salglyphid.hxx" - #define MAX_FALLBACK 16 @@ -251,6 +249,8 @@ private: boolmbIncomplete; }; +typedef sal_uInt32 sal_GlyphId; + struct GlyphItem { int mnFlags; diff --git a/vcl/inc/unx/fontmanager.hxx b/vcl/inc/unx/fontmanager.hxx index 8b791722b4a8..8b2c70c25000 100644 --- a/vcl/inc/unx/fontmanager.hxx +++ b/vcl/inc/unx/fontmanager.hxx @@ -25,7 +25,7 @@ #include #include #include -#include +#include #include #include ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
CppCheck Report Update
A new cppcheck report is available at : http://dev-builds.libreoffice.org/cppcheck_reports/master/ Note: The script generating this report was run at : 2018-22-04 02:18:43 with user buildslave at host vm140 as /home/buildslave/source/dev-tools/cppcheck/cppcheck-report.sh -s /home/buildslave/source/libo-core -c /home/buildslave/source/cppcheck -w /home/buildslave/tmp/www It can be found and improved here: https://gerrit.libreoffice.org/gitweb?p=dev-tools.git;a=blob;f=cppcheck/cppcheck-report.sh ___ LibreOffice mailing list LibreOffice@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice
[Libreoffice-commits] core.git: Branch 'aoo/trunk' - 2 commits - extensions/source sc/source solenv/gbuild solenv/inc svtools/source
extensions/source/update/check/updatecheckconfig.hxx |4 ++-- sc/source/ui/miscdlgs/retypepassdlg.src |2 +- solenv/gbuild/platform/freebsd.mk|7 +++ solenv/inc/unxfbsd.mk|7 ++- svtools/source/java/javaerror.src|2 +- 5 files changed, 17 insertions(+), 5 deletions(-) New commits: commit 2549527d994cd3747a35ca51781f5fb79bb5b9c6 Author: Matthias Seidel Date: Sun Apr 22 00:00:24 2018 + Fixed typos, removed whitespace diff --git a/extensions/source/update/check/updatecheckconfig.hxx b/extensions/source/update/check/updatecheckconfig.hxx index 27262b2cb0cc..b5b311ada4da 100755 --- a/extensions/source/update/check/updatecheckconfig.hxx +++ b/extensions/source/update/check/updatecheckconfig.hxx @@ -80,8 +80,8 @@ private: /* This class implements the non published UNO service com.sun.star.setup.UpdateCheckConfig, - * which primary use is to be able to track changes done in the Toos -> Options page of this - * component, as this is not supported by the OOo configuration for extendable groups. + * which primary use is to be able to track changes done in the Tools -> Options page of this + * component, as this is not supported by the AOO configuration for extendable groups. */ class UpdateCheckConfig : public ::cppu::WeakImplHelper3< diff --git a/sc/source/ui/miscdlgs/retypepassdlg.src b/sc/source/ui/miscdlgs/retypepassdlg.src index daba4b3ede34..9717acaca5b4 100644 --- a/sc/source/ui/miscdlgs/retypepassdlg.src +++ b/sc/source/ui/miscdlgs/retypepassdlg.src @@ -58,7 +58,7 @@ ModalDialog RID_SCDLG_RETYPEPASS WordBreak = TRUE ; -Text [ en-US ] = "The document you are about to export has one or more protected items with password that cannot be exported. Please re-type your password to be able to export your document." ; +Text [ en-US ] = "The document you are about to export has one or more protected items with password that cannot be exported. Please re-type your password to be able to export your document." ; }; FixedLine FL_DOCUMENT diff --git a/svtools/source/java/javaerror.src b/svtools/source/java/javaerror.src index ec24338661f0..3a2a118ab522 100644 --- a/svtools/source/java/javaerror.src +++ b/svtools/source/java/javaerror.src @@ -48,7 +48,7 @@ ErrorBox ERRORBOX_JVMCREATIONFAILED { Buttons = WB_OK; DefButton = WB_DEF_OK ; -Message[ en-US ] = "%PRODUCTNAME requires a Java runtime environment (JRE) to perform this task. The selected JRE is defective. Please select another version or install a new JRE and select it under Tools - Options - %PRODUCTNAME - Java."; +Message[ en-US ] = "%PRODUCTNAME requires a Java runtime environment (JRE) to perform this task. The selected JRE is defective. Please select another version or install a new JRE and select it under Tools - Options - %PRODUCTNAME - Java."; }; ErrorBox ERRORBOX_RESTARTREQUIRED commit 00df62bded7abff051b3defcc56ad0731693c8cd Author: Don Lewis Date: Sat Apr 21 23:17:08 2018 + Unbreak build on FreeBSD with clang 6.0 and newer. Clang 6 changed the its default C++ standard from C++98 to C++14 and our old code is not prepared for that. Avoid the problem by adding the -std=gnu++98 compiler flag. Add the -fstack-protector compiler flag on FreeBSD INTEL and X86_64. diff --git a/solenv/gbuild/platform/freebsd.mk b/solenv/gbuild/platform/freebsd.mk index 5f4bc943186e..0148fc23fe57 100644 --- a/solenv/gbuild/platform/freebsd.mk +++ b/solenv/gbuild/platform/freebsd.mk @@ -92,6 +92,7 @@ gb_CXXFLAGS := \ -fno-use-cxa-atexit \ -fvisibility-inlines-hidden \ -fvisibility=hidden \ + -std=gnu++98 \ -pipe ifeq ($(COM),CLANG) gb_CXXFLAGS += -DHAVE_STL_INCLUDE_PATH @@ -142,6 +143,12 @@ gb_LinkTarget_LDFLAGS += \ endif +ifneq ($(filter $(CPUNAME),INTEL X86_64),) +gb_CFLAGS += -fstack-protector +gb_CXXFLAGS += -fstack-protector +gb_LinkTarget_LDFLAGS += -fstack-protector +endif + ifeq ($(gb_DEBUGLEVEL),2) gb_COMPILEROPTFLAGS := -O0 gb_COMPILEROPT1FLAGS := -O0 diff --git a/solenv/inc/unxfbsd.mk b/solenv/inc/unxfbsd.mk index baa01f5ba4bb..92db30a813d4 100644 --- a/solenv/inc/unxfbsd.mk +++ b/solenv/inc/unxfbsd.mk @@ -105,11 +105,16 @@ CFLAGSEXCEPTIONS=-fexceptions -fno-enforce-eh-specs CFLAGS_NO_EXCEPTIONS=-fno-exceptions # -fpermissive should be removed as soon as possible -CFLAGSCXX= -pipe $(ARCH_FLAGS) +CFLAGSCXX= -pipe $(ARCH_FLAGS) -std=gnu++98 .IF "$(HAVE_GCC_VISIBILITY_FEATURE)" == "TRUE" CFLAGSCXX += -fvisibility-inlines-hidden .ENDIF # "$(HAVE_GCC_VISIBILITY_FEATURE)" == "TRUE" +.IF "$(CPUNAME)" == "INTEL" || "$(CPUNAME)" == "X86_64" +CFLAGSCC += -fstack-protector +CFLAGSCXX += -fstack-protector +.ENDIF + # Compiler flags for compiling static object in multi threaded environment with graphical user interface CFLAGSOBJGUIMT= # Compiler flags for compiling s
[Libreoffice-commits] core.git: vcl/source
vcl/source/gdi/CommonSalLayout.cxx | 11 +++ 1 file changed, 7 insertions(+), 4 deletions(-) New commits: commit 63a4ecc3881596a448d47f564c722ad944ff7e67 Author: Khaled Hosny Date: Sat Apr 21 18:39:30 2018 +0200 tdf#86399 Correctly set cluster start for RTL runs A followup for the fix in b1030f75d3e47719ca63ec518f1da75196bead1a (from 2015) that didn’t work for Arabic because we were setting cluster start for RTL runs incorrectly. I’ve been suffering from this for so long but too lazy to debug it, until I saw this pace of code by pure chance and it looked dubious, finding where this flag is used and then seeing the comment referring to tdf#86399, then WOW I know what is going on! Change-Id: Ib7850e5a90ed3184738e995885f7f8b459ea2bb9 Reviewed-on: https://gerrit.libreoffice.org/53261 Tested-by: Jenkins Reviewed-by: Khaled Hosny diff --git a/vcl/source/gdi/CommonSalLayout.cxx b/vcl/source/gdi/CommonSalLayout.cxx index 463eb255c1dc..c455475ba53d 100644 --- a/vcl/source/gdi/CommonSalLayout.cxx +++ b/vcl/source/gdi/CommonSalLayout.cxx @@ -695,6 +695,7 @@ bool CommonSalLayout::LayoutText(ImplLayoutArgs& rArgs) int32_t nGlyphIndex = pHbGlyphInfos[i].codepoint; int32_t nCharPos = pHbGlyphInfos[i].cluster; int32_t nCharCount = 0; +bool bInCluster = false; // Find the number of characters that make up this glyph. if (!bRightToLeft) @@ -702,7 +703,10 @@ bool CommonSalLayout::LayoutText(ImplLayoutArgs& rArgs) // If the cluster is the same as previous glyph, then this // already consumed, skip. if (i > 0 && pHbGlyphInfos[i].cluster == pHbGlyphInfos[i - 1].cluster) +{ nCharCount = 0; +bInCluster = true; +} else { // Find the next glyph with a different cluster, or the @@ -722,7 +726,10 @@ bool CommonSalLayout::LayoutText(ImplLayoutArgs& rArgs) // If the cluster is the same as previous glyph, then this // will be consumed later, skip. if (i < nRunGlyphCount - 1 && pHbGlyphInfos[i].cluster == pHbGlyphInfos[i + 1].cluster) +{ nCharCount = 0; +bInCluster = true; +} else { // Find the previous glyph with a different cluster, or @@ -746,10 +753,6 @@ bool CommonSalLayout::LayoutText(ImplLayoutArgs& rArgs) continue; } -bool bInCluster = false; -if (i > 0 && pHbGlyphInfos[i].cluster == pHbGlyphInfos[i - 1].cluster) -bInCluster = true; - long nGlyphFlags = 0; if (bRightToLeft) nGlyphFlags |= GlyphItem::IS_RTL_GLYPH; ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
Re: How to make a locale available for CTL text
On Fri, Mar 30, 2018 at 01:59:51PM +0200, Khaled Hosny wrote: > Hi, > > I want to set a text in Malay [1] but using the Arabic script (AKA Jawi > [2]), but it seems that Malay is only allowed for “Western” text and not > “CTL” and free-form language tags are not allowed in CTL as well. Do I > need to add a new locale or do something else? Any reason why free-form > language tags are not allowed for CTL text? I found https://bugs.documentfoundation.org/show_bug.cgi?id=81714 which answers the last question somehow (though it is not clear what is exactly needed). My main question about supporting Jawi is still unanswered. Regards, Khaled > 1. https://en.wikipedia.org/wiki/Malaysian_language > 2. https://en.wikipedia.org/wiki/Jawi_alphabet ___ LibreOffice mailing list LibreOffice@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice
[Libreoffice-commits] core.git: sc/source
sc/source/filter/lotus/op.cxx | 28 ++-- 1 file changed, 14 insertions(+), 14 deletions(-) New commits: commit 5289441ffa227f5f358ca4dc28df416be922aa66 Author: Johnny_M Date: Sat Apr 21 12:53:08 2018 +0200 Translate German variable names Puffer -> Buffer in Lotus filter Change-Id: If6d5190c7bc2f884083a2a47b6bd665b3f95b3b0 Reviewed-on: https://gerrit.libreoffice.org/53250 Tested-by: Jenkins Reviewed-by: Khaled Hosny diff --git a/sc/source/filter/lotus/op.cxx b/sc/source/filter/lotus/op.cxx index e78419726141..7dec5cfbd0d1 100644 --- a/sc/source/filter/lotus/op.cxx +++ b/sc/source/filter/lotus/op.cxx @@ -196,9 +196,9 @@ void OP_NamedRange(LotusContext& rContext, SvStream& r, sal_uInt16 /*n*/) // POST: don't save for invalid coordinates sal_uInt16 nColSt, nRowSt, nColEnd, nRowEnd; -sal_Char cPuffer[ 16+1 ]; -r.ReadBytes(cPuffer, 16); -cPuffer[ 16 ] = 0; +sal_Char cBuffer[ 16+1 ]; +r.ReadBytes(cBuffer, 16); +cBuffer[ 16 ] = 0; r.ReadUInt16( nColSt ).ReadUInt16( nRowSt ).ReadUInt16( nColEnd ).ReadUInt16( nRowEnd ); @@ -212,14 +212,14 @@ void OP_NamedRange(LotusContext& rContext, SvStream& r, sal_uInt16 /*n*/) pRange = new LotusRange( static_cast (nColSt), static_cast (nRowSt), static_cast (nColEnd), static_cast (nRowEnd) ); -sal_Char cBuf[sizeof(cPuffer)+1]; -if( rtl::isAsciiDigit( static_cast(*cPuffer) ) ) +sal_Char cBuf[sizeof(cBuffer)+1]; +if( rtl::isAsciiDigit( static_cast(*cBuffer) ) ) { // first char in name is a number -> prepend 'A' cBuf[0] = 'A'; -strcpy( cBuf + 1, cPuffer ); // #100211# - checked +strcpy( cBuf + 1, cBuffer ); // #100211# - checked } else -strcpy( cBuf, cPuffer ); // #100211# - checked +strcpy( cBuf, cBuffer ); // #100211# - checked OUString aTmp( cBuf, strlen(cBuf), rContext.pLotusRoot->eCharsetQ ); @@ -235,9 +235,9 @@ void OP_SymphNamedRange(LotusContext& rContext, SvStream& r, sal_uInt16 /*n*/) sal_uInt16 nColSt, nRowSt, nColEnd, nRowEnd; sal_uInt8 nType; -sal_Char cPuffer[ 16+1 ]; -r.ReadBytes(cPuffer, 16); -cPuffer[ 16 ] = 0; +sal_Char cBuffer[ 16+1 ]; +r.ReadBytes(cBuffer, 16); +cBuffer[ 16 ] = 0; r.ReadUInt16( nColSt ).ReadUInt16( nRowSt ).ReadUInt16( nColEnd ).ReadUInt16( nRowEnd ).ReadUChar( nType ); @@ -251,14 +251,14 @@ void OP_SymphNamedRange(LotusContext& rContext, SvStream& r, sal_uInt16 /*n*/) pRange = new LotusRange( static_cast (nColSt), static_cast (nRowSt), static_cast (nColEnd), static_cast (nRowEnd) ); -sal_Char cBuf[sizeof(cPuffer)+1]; -if( rtl::isAsciiDigit( static_cast(*cPuffer) ) ) +sal_Char cBuf[sizeof(cBuffer)+1]; +if( rtl::isAsciiDigit( static_cast(*cBuffer) ) ) { // first char in name is a number -> prepend 'A' cBuf[0] = 'A'; -strcpy( cBuf + 1, cPuffer ); // #100211# - checked +strcpy( cBuf + 1, cBuffer ); // #100211# - checked } else -strcpy( cBuf, cPuffer ); // #100211# - checked +strcpy( cBuf, cBuffer ); // #100211# - checked OUString aTmp( cBuf, strlen(cBuf), rContext.pLotusRoot->eCharsetQ ); aTmp = ScfTools::ConvertToScDefinedName( aTmp ); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: vcl/inc vcl/source
vcl/inc/sallayout.hxx | 13 - vcl/source/gdi/CommonSalLayout.cxx |2 +- 2 files changed, 1 insertion(+), 14 deletions(-) New commits: commit b9fde7e7b73c4902a8eb35fab46abd137e36856e Author: Khaled Hosny Date: Sat Apr 21 16:17:43 2018 +0200 Drop GlyphItem constructor that is used only once Change-Id: I36aed033ea811daf2dfae89a89cf0ff5fc86b270 Reviewed-on: https://gerrit.libreoffice.org/53257 Tested-by: Jenkins Reviewed-by: Khaled Hosny diff --git a/vcl/inc/sallayout.hxx b/vcl/inc/sallayout.hxx index 962f0f6905ac..3e75b606fd75 100644 --- a/vcl/inc/sallayout.hxx +++ b/vcl/inc/sallayout.hxx @@ -267,19 +267,6 @@ struct GlyphItem int mnFallbackLevel; public: -GlyphItem( int nCharPos, sal_GlyphId aGlyphId, const Point& rLinearPos, -long nFlags, int nOrigWidth ) -: mnFlags(nFlags) -, mnCharPos(nCharPos) -, mnCharCount(1) -, mnOrigWidth(nOrigWidth) -, mnNewWidth(nOrigWidth) -, mnXOffset(0) -, maGlyphId(aGlyphId) -, maLinearPos(rLinearPos) -, mnFallbackLevel(0) -{ } - GlyphItem(int nCharPos, int nCharCount, sal_GlyphId aGlyphId, const Point& rLinearPos, long nFlags, int nOrigWidth, int nXOffset ) : mnFlags(nFlags) diff --git a/vcl/source/gdi/CommonSalLayout.cxx b/vcl/source/gdi/CommonSalLayout.cxx index e00b21693091..463eb255c1dc 100644 --- a/vcl/source/gdi/CommonSalLayout.cxx +++ b/vcl/source/gdi/CommonSalLayout.cxx @@ -975,7 +975,7 @@ void CommonSalLayout::ApplyDXArray(ImplLayoutArgs& rArgs) int const nFlags = GlyphItem::IS_IN_CLUSTER | GlyphItem::IS_RTL_GLYPH; while (nCopies--) { -GlyphItem aKashida(nCharPos, nKashidaIndex, aPos, nFlags, nKashidaWidth); +GlyphItem aKashida(nCharPos, 0, nKashidaIndex, aPos, nFlags, nKashidaWidth, 0); pGlyphIter = m_GlyphItems.insert(pGlyphIter, aKashida); aPos.AdjustX(nKashidaWidth ); aPos.AdjustX( -nOverlap ); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: sw/inc sw/source
sw/inc/swtable.hxx |2 +- sw/source/core/table/swnewtable.cxx | 13 ++--- 2 files changed, 7 insertions(+), 8 deletions(-) New commits: commit 97fe7d5f0eed7d3ef4940f4e7a70a7dd64d2390f Author: Mike Kaganski Date: Sat Apr 21 11:47:43 2018 +0100 Use unique_ptr Change-Id: I8fea12c523e07b895c47ee410120549398fc8f37 Reviewed-on: https://gerrit.libreoffice.org/53249 Tested-by: Jenkins Reviewed-by: Noel Grandin Reviewed-by: Mike Kaganski diff --git a/sw/inc/swtable.hxx b/sw/inc/swtable.hxx index 619d37dd432e..edeb04509d18 100644 --- a/sw/inc/swtable.hxx +++ b/sw/inc/swtable.hxx @@ -164,7 +164,7 @@ private: bool NewMerge( SwDoc*, const SwSelBoxes&, const SwSelBoxes& rMerged, SwUndoTableMerge* ); bool NewSplitRow( SwDoc*, const SwSelBoxes&, sal_uInt16, bool ); -SwBoxSelection* CollectBoxSelection( const SwPaM& rPam ) const; +std::unique_ptr CollectBoxSelection( const SwPaM& rPam ) const; void InsertSpannedRow( SwDoc* pDoc, sal_uInt16 nIdx, sal_uInt16 nCnt ); bool InsertRow_( SwDoc*, const SwSelBoxes&, sal_uInt16 nCnt, bool bBehind ); bool NewInsertCol( SwDoc*, const SwSelBoxes& rBoxes, sal_uInt16 nCnt, bool ); diff --git a/sw/source/core/table/swnewtable.cxx b/sw/source/core/table/swnewtable.cxx index e6a9a590187c..96702150011b 100644 --- a/sw/source/core/table/swnewtable.cxx +++ b/sw/source/core/table/swnewtable.cxx @@ -41,6 +41,7 @@ #include #include #include +#include #ifdef DBG_UTIL #define CHECK_TABLE(t) (t).CheckConsistency(); @@ -322,7 +323,7 @@ static void lcl_ChangeRowSpan( const SwTable& rTable, const long nDiff, and prepares the selected cells for merging */ -SwBoxSelection* SwTable::CollectBoxSelection( const SwPaM& rPam ) const +std::unique_ptr SwTable::CollectBoxSelection( const SwPaM& rPam ) const { OSL_ENSURE( m_bNewModel, "Don't call me for old tables" ); if( m_aLines.empty() ) @@ -370,7 +371,7 @@ SwBoxSelection* SwTable::CollectBoxSelection( const SwPaM& rPam ) const bool bOkay = true; long nMid = ( nMin + nMax ) / 2; -SwBoxSelection* pRet = new SwBoxSelection(); +auto pRet(o3tl::make_unique()); std::vector< std::pair< SwTableBox*, long > > aNewWidthVector; size_t nCheckBottom = nBottom; long nLeftSpan = 0; @@ -560,11 +561,11 @@ SwBoxSelection* SwTable::CollectBoxSelection( const SwPaM& rPam ) const --nRightSpanCnt; pRet->push_back(aBoxes); } -pRet->mnMergeWidth = nMax - nMin; if( nCheckBottom > nBottom ) bOkay = false; if( bOkay ) { +pRet->mnMergeWidth = nMax - nMin; for (auto const& newWidth : aNewWidthVector) { SwFrameFormat* pFormat = newWidth.first->ClaimFrameFormat(); @@ -573,10 +574,8 @@ SwBoxSelection* SwTable::CollectBoxSelection( const SwPaM& rPam ) const } } else -{ -delete pRet; -pRet = nullptr; -} +pRet.reset(); + return pRet; } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: vcl/qa
vcl/qa/cppunit/bitmaprender/BitmapRenderTest.cxx | 15 +++ 1 file changed, 11 insertions(+), 4 deletions(-) New commits: commit d2d57d25aa71b71606c2112914831f25279fa279 Author: Thorsten Behrens Date: Sat Apr 21 16:32:43 2018 +0200 Tweak unit test for 1bpp images a bit for robustness Seems we're suffering gamma correction issue on a number of target platforms, so let's compare colors a bit more fuzzily. Fixup for eb5c0ccd47330fc726f4b4f854cf4cc518ac21cd Change-Id: Ieace78d1054efa6f49d42f1878774604e85c1965 Reviewed-on: https://gerrit.libreoffice.org/53259 Tested-by: Jenkins Reviewed-by: Thorsten Behrens diff --git a/vcl/qa/cppunit/bitmaprender/BitmapRenderTest.cxx b/vcl/qa/cppunit/bitmaprender/BitmapRenderTest.cxx index 2ee32a812d55..2f9274ddb7bc 100644 --- a/vcl/qa/cppunit/bitmaprender/BitmapRenderTest.cxx +++ b/vcl/qa/cppunit/bitmaprender/BitmapRenderTest.cxx @@ -62,9 +62,12 @@ void BitmapRenderTest::testTdf104141() BitmapEx aBitmap = aGraphic.GetBitmapEx(); pVDev->DrawBitmapEx(Point(20, 20), aBitmap); -// Check drawing resuts: ensure that it contains transparent (green) pixels +// Check drawing resuts: ensure that it contains transparent +// (greenish) pixels #if !defined MACOSX //TODO: on Mac colors are drifted, so exact compare fails -CPPUNIT_ASSERT_EQUAL(COL_GREEN, pVDev->GetPixel(Point(21, 21))); +const Color aColor = pVDev->GetPixel(Point(21, 21)); +CPPUNIT_ASSERT(aColor.GetGreen() > 10 * aColor.GetRed() + && aColor.GetGreen() > 10 * aColor.GetBlue()); #endif } @@ -84,9 +87,13 @@ void BitmapRenderTest::testTdf113918() BitmapEx aBitmap = aGraphic.GetBitmapEx(); pVDev->DrawBitmapEx(Point(0, 0), aBitmap); -// Ensure that image is drawn with gray color from palette +// Ensure that image is drawn with white background color from palette CPPUNIT_ASSERT_EQUAL(COL_WHITE, pVDev->GetPixel(Point(21, 21))); -CPPUNIT_ASSERT_EQUAL(Color(0x979797), pVDev->GetPixel(Point(1298, 1368))); + +// Ensure that image is drawn with gray text color from palette +const Color aColor = pVDev->GetPixel(Point(1298, 1368)); +CPPUNIT_ASSERT(aColor.GetGreen() == aColor.GetRed() && aColor.GetGreen() == aColor.GetBlue()); +CPPUNIT_ASSERT(aColor.GetGreen() > 100); } CPPUNIT_TEST_SUITE_REGISTRATION(BitmapRenderTest); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: include/vcl vcl/Library_vcl.mk vcl/source
include/vcl/BitmapSeparableUnsharpenFilter.hxx | 37 + include/vcl/bitmap.hxx |2 vcl/Library_vcl.mk |1 vcl/source/bitmap/BitmapSeparableUnsharpenFilter.cxx | 76 +++ vcl/source/gdi/bitmap4.cxx | 53 + 5 files changed, 118 insertions(+), 51 deletions(-) New commits: commit 6a3d2dea1da847f5bd6674b344162f087cceda8b Author: Chris Sherlock Date: Wed Apr 18 20:18:47 2018 +1000 vcl: Bitmap::ImplSeparableUnsharpenFilter() -> BitmapSeparableUnsharpenFilter Change-Id: I62d95cc8bbf7b9349b1abc3e58bf0a202e3afec5 Reviewed-on: https://gerrit.libreoffice.org/53091 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl diff --git a/include/vcl/BitmapSeparableUnsharpenFilter.hxx b/include/vcl/BitmapSeparableUnsharpenFilter.hxx new file mode 100644 index ..1812b9013fe8 --- /dev/null +++ b/include/vcl/BitmapSeparableUnsharpenFilter.hxx @@ -0,0 +1,37 @@ +/* -*- 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/. + * + */ + +#ifndef INCLUDED_VCL_BITMAPSEPARABLEUNSHARPENFILTER_HXX +#define INCLUDED_VCL_BITMAPSEPARABLEUNSHARPENFILTER_HXX + +#include + +class BitmapEx; + +/** Separable Unsharpen Mask filter is actually a subtracted blurred +image from the original image. + */ +class VCL_DLLPUBLIC BitmapSeparableUnsharpenFilter : public BitmapFilter +{ +public: +BitmapSeparableUnsharpenFilter(double fRadius) +: mfRadius(fRadius) +{ +} + +virtual BitmapEx execute(BitmapEx const& rBitmapEx) override; + +private: +double mfRadius; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/vcl/bitmap.hxx b/include/vcl/bitmap.hxx index d46dc7ddf24e..07573b1af1b0 100644 --- a/include/vcl/bitmap.hxx +++ b/include/vcl/bitmap.hxx @@ -667,8 +667,6 @@ public: SAL_DLLPRIVATE bool ImplSepia( const BmpFilterParam* pFilterParam ); SAL_DLLPRIVATE bool ImplMosaic( const BmpFilterParam* pFilterParam ); SAL_DLLPRIVATE bool ImplPopArt(); - -SAL_DLLPRIVATE bool ImplSeparableUnsharpenFilter( const double aRadius ); SAL_DLLPRIVATE bool ImplDuotoneFilter( const sal_uLong nColorOne, sal_uLong nColorTwo ); public: diff --git a/vcl/Library_vcl.mk b/vcl/Library_vcl.mk index dc3b8a3318c6..8a2edf75b2b4 100644 --- a/vcl/Library_vcl.mk +++ b/vcl/Library_vcl.mk @@ -318,6 +318,7 @@ $(eval $(call gb_Library_add_exception_objects,vcl,\ vcl/source/bitmap/BitmapColorizeFilter \ vcl/source/bitmap/bitmappaint \ vcl/source/bitmap/BitmapGaussianSeparableBlurFilter \ +vcl/source/bitmap/BitmapSeparableUnsharpenFilter \ vcl/source/bitmap/BitmapFastScaleFilter \ vcl/source/bitmap/BitmapScaleSuperFilter \ vcl/source/bitmap/BitmapScaleConvolutionFilter \ diff --git a/vcl/source/bitmap/BitmapSeparableUnsharpenFilter.cxx b/vcl/source/bitmap/BitmapSeparableUnsharpenFilter.cxx new file mode 100644 index ..f594a808cc14 --- /dev/null +++ b/vcl/source/bitmap/BitmapSeparableUnsharpenFilter.cxx @@ -0,0 +1,76 @@ +/* -*- 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/. + * + */ + +#include + +#include +#include +#include +#include +#include + +#include + +BitmapEx BitmapSeparableUnsharpenFilter::execute(BitmapEx const& rBitmapEx) +{ +Bitmap aBitmap(rBitmapEx.GetBitmap()); + +const long nWidth = aBitmap.GetSizePixel().Width(); +const long nHeight = aBitmap.GetSizePixel().Height(); + +Bitmap aBlur(aBitmap); +BitmapEx aBlurEx(aBlur); + +BitmapFilter::Filter(aBlurEx, BitmapGaussianSeparableBlurFilter(-mfRadius)); +aBlur = aBlurEx.GetBitmap(); + +// Amount of unsharpening effect on image - currently set to a fixed value +double aAmount = 2.0; + +Bitmap aResultBitmap(Size(nWidth, nHeight), 24); + +Bitmap::ScopedReadAccess pReadAccBlur(aBlur); +Bitmap::ScopedReadAccess pReadAcc(aBitmap); +BitmapScopedWriteAccess pWriteAcc(aResultBitmap); + +BitmapColor aColor, aColorBlur; + +// For all pixels in original image subtract pixels values from blurred image +for (long y = 0; y < nHeight; y++) +{ +Scanline pScanline = pWriteAcc->GetScanline(y); +for (long x = 0; x < nWidth; x++) +{ +aColorBlur = pReadAccBlur->GetColor(y, x); +aColor = pReadAcc->GetColor(y, x); + +B
[Libreoffice-commits] core.git: extensions/source
extensions/source/propctrlr/formcomponenthandler.cxx | 11 +++ extensions/source/propctrlr/formstrings.hxx |1 + 2 files changed, 4 insertions(+), 8 deletions(-) New commits: commit 4671c863815826c1fbbb4343b53f9d74803aaa7d Author: Tomaž Vajngerl Date: Sat Apr 21 14:10:23 2018 +0900 Get rid of GraphicObject URL in extensions - PropertyController Instead of that, use "Graphic" property and set an XGraphic. Change-Id: Ib3084d22b422b82b69be3d410560caac303e780d Reviewed-on: https://gerrit.libreoffice.org/53240 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl diff --git a/extensions/source/propctrlr/formcomponenthandler.cxx b/extensions/source/propctrlr/formcomponenthandler.cxx index 9d8a6f43292b..06e7cb3d6398 100644 --- a/extensions/source/propctrlr/formcomponenthandler.cxx +++ b/extensions/source/propctrlr/formcomponenthandler.cxx @@ -103,8 +103,6 @@ #include #include -#define GRAPHOBJ_URLPREFIX "vnd.sun.star.GraphicObject:" - extern "C" void createRegistryInfo_FormComponentPropertyHandler() { ::pcr::FormComponentPropertyHandler::registerImplementation(); @@ -319,9 +317,7 @@ namespace pcr if ( PROPERTY_ID_IMAGE_URL == nPropId && ( _rValue >>= xGrfObj ) ) { DBG_ASSERT( xGrfObj.is(), "FormComponentPropertyHandler::setPropertyValue() xGrfObj is invalid"); -OUString sObjectID( GRAPHOBJ_URLPREFIX ); -sObjectID = sObjectID + xGrfObj->getUniqueID(); -m_xComponent->setPropertyValue( _rPropertyName, uno::makeAny( sObjectID ) ); +m_xComponent->setPropertyValue(PROPERTY_GRAPHIC, uno::makeAny(xGrfObj->getGraphic())); } else if ( PROPERTY_ID_FONT == nPropId ) { @@ -2726,7 +2722,7 @@ namespace pcr OUString sCurValue; OSL_VERIFY( impl_getPropertyValue_throw( PROPERTY_IMAGE_URL ) >>= sCurValue ); -if ( !sCurValue.isEmpty() && !sCurValue.startsWith(GRAPHOBJ_URLPREFIX) ) +if (!sCurValue.isEmpty()) { aFileDlg.SetDisplayDirectory( sCurValue ); // TODO: need to set the display directory _and_ the default name @@ -2743,12 +2739,11 @@ namespace pcr if ( !bIsLink ) { Graphic aGraphic; -aFileDlg.GetGraphic( aGraphic ); +aFileDlg.GetGraphic(aGraphic); Reference< graphic::XGraphicObject > xGrfObj = graphic::GraphicObject::create( m_xContext ); xGrfObj->setGraphic( aGraphic.GetXGraphic() ); - _out_rNewValue <<= xGrfObj; } diff --git a/extensions/source/propctrlr/formstrings.hxx b/extensions/source/propctrlr/formstrings.hxx index a4d8955b348d..ad06d8989b32 100644 --- a/extensions/source/propctrlr/formstrings.hxx +++ b/extensions/source/propctrlr/formstrings.hxx @@ -73,6 +73,7 @@ namespace pcr #define PROPERTY_SUBMIT_METHOD "SubmitMethod" #define PROPERTY_SUBMIT_ENCODING"SubmitEncoding" #define PROPERTY_IMAGE_URL "ImageURL" +#define PROPERTY_GRAPHIC"Graphic" #define PROPERTY_EMPTY_IS_NULL "ConvertEmptyToNull" #define PROPERTY_LISTSOURCETYPE "ListSourceType" #define PROPERTY_LISTSOURCE "ListSource" ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
Jovan Maric license statement
All of my past & future contributions to LibreOffice may be licensed under the MPLv2/LGPLv3+ dual license. ___ LibreOffice mailing list LibreOffice@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice
[Libreoffice-commits] core.git: basegfx/source basic/source filter/source framework/source sfx2/source sot/source svx/source sw/source vcl/source vcl/unx xmloff/source
basegfx/source/polygon/b3dpolygontools.cxx|5 -- basic/source/sbx/sbxscan.cxx |3 - basic/source/uno/scriptcont.cxx | 29 + filter/source/svg/svgexport.cxx |4 - framework/source/xml/imagesdocumenthandler.cxx|3 - sfx2/source/doc/guisaveas.cxx |3 - sot/source/sdstor/stgstrms.cxx|3 - svx/source/customshapes/EnhancedCustomShape2d.cxx | 33 ++ svx/source/svdraw/svdedtv1.cxx|2 svx/source/svdraw/svdomeas.cxx|3 - svx/source/xml/xmlexport.cxx | 49 ++ sw/source/core/text/itrform2.cxx |7 +-- sw/source/filter/ww8/ww8par2.cxx | 44 +-- sw/source/ui/dbui/mmgreetingspage.cxx | 18 +++- sw/source/uibase/utlui/content.cxx|4 - vcl/source/window/event.cxx |8 +-- vcl/unx/generic/gdi/cairotextrender.cxx | 21 - xmloff/source/draw/shapeexport.cxx| 24 -- 18 files changed, 117 insertions(+), 146 deletions(-) New commits: commit de07f40030bbd604bc42d58f0e954cca284a2646 Author: Jochen Nitschke Date: Sat Apr 21 07:50:54 2018 +0200 cppcheck: identicalInnerCondition renamed temporary list in EnhancedCustomShape2d.cxx to avoid shadow of a local variable Change-Id: I17a2261dafd2067480fcc5314af4f48765d6b690 Reviewed-on: https://gerrit.libreoffice.org/53244 Tested-by: Jenkins Reviewed-by: Jochen Nitschke diff --git a/basegfx/source/polygon/b3dpolygontools.cxx b/basegfx/source/polygon/b3dpolygontools.cxx index 17dd77600f96..2059d91bdef6 100644 --- a/basegfx/source/polygon/b3dpolygontools.cxx +++ b/basegfx/source/polygon/b3dpolygontools.cxx @@ -147,10 +147,7 @@ namespace basegfx aSnippet.append(interpolate(aCurrentPoint, aNextPoint, fDotDashMovingLength / fEdgeLength)); -if(bHandleLine) -{ -pLineTarget->append(aSnippet); -} +pLineTarget->append(aSnippet); aSnippet.clear(); } diff --git a/basic/source/sbx/sbxscan.cxx b/basic/source/sbx/sbxscan.cxx index dc598bb05d0f..c725aff2397d 100644 --- a/basic/source/sbx/sbxscan.cxx +++ b/basic/source/sbx/sbxscan.cxx @@ -90,8 +90,7 @@ ErrCode ImpScan( const OUString& rWSrc, double& nVal, SbxDataType& rType, if( bOnlyIntntl ) { ImpGetIntntlSep( cIntntlDecSep, cIntntlGrpSep, cIntntlDecSepAlt ); -if( bOnlyIntntl ) -cNonIntntlDecSep = cIntntlDecSep; +cNonIntntlDecSep = cIntntlDecSep; // Ensure that the decimal separator alternative is really one. if (cIntntlDecSepAlt && cIntntlDecSepAlt == cNonIntntlDecSep) cIntntlDecSepAlt = 0; diff --git a/basic/source/uno/scriptcont.cxx b/basic/source/uno/scriptcont.cxx index 3f391e81b03f..aba9aabbee01 100644 --- a/basic/source/uno/scriptcont.cxx +++ b/basic/source/uno/scriptcont.cxx @@ -861,26 +861,23 @@ bool SfxScriptLibraryContainer::implLoadPasswordLibrary { uno::Reference< embed::XStorage > xLibrariesStor; uno::Reference< embed::XStorage > xLibraryStor; -if( bStorage ) -{ -try { -xLibrariesStor = mxStorage->openStorageElement( maLibrariesDir, embed::ElementModes::READ ); -if ( !xLibrariesStor.is() ) -{ -throw uno::RuntimeException("null returned from openStorageElement"); -} -xLibraryStor = xLibrariesStor->openStorageElement( Name, embed::ElementModes::READ ); -if ( !xLibraryStor.is() ) -{ -throw uno::RuntimeException("null returned from openStorageElement"); -} +try { +xLibrariesStor = mxStorage->openStorageElement( maLibrariesDir, embed::ElementModes::READ ); +if ( !xLibrariesStor.is() ) +{ +throw uno::RuntimeException("null returned from openStorageElement"); } -catch(const uno::Exception& ) +xLibraryStor = xLibrariesStor->openStorageElement( Name, embed::ElementModes::READ ); +if ( !xLibraryStor.is() ) { -OSL_FAIL( "### couldn't open sub storage for library" ); -return false; +throw uno::RuntimeException("null returned from openStorageElement"); } } +catch(const uno::Exception& ) +{ +OSL_FAIL( "### couldn't open sub storage for library" ); +return false; +} for( sal_Int32 i = 0 ; i < nN