[Libreoffice-commits] core.git: vcl/inc vcl/source
vcl/inc/impanmvw.hxx|2 +- vcl/source/gdi/impanmvw.cxx |2 +- 2 files changed, 2 insertions(+), 2 deletions(-) New commits: commit 22d2ad9135eca2a3d793cc1709148d4a5b6ec1c4 Author: Adrien Ollier AuthorDate: Sat Jan 25 18:10:13 2020 +0100 Commit: Noel Grandin CommitDate: Sun Jan 26 11:37:35 2020 +0100 const parameter for ImplAnimView::matches pOut is a const OutputDevice* instead of OutputDevice* Change-Id: I369fea42a19afaeca3c5a9714e5a6043921be3b4 Signed-off-by: Adrien Ollier Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87416 Reviewed-by: Noel Grandin Tested-by: Noel Grandin diff --git a/vcl/inc/impanmvw.hxx b/vcl/inc/impanmvw.hxx index 69949e9252ce..a9f5e959ee58 100644 --- a/vcl/inc/impanmvw.hxx +++ b/vcl/inc/impanmvw.hxx @@ -74,7 +74,7 @@ private: const Point& rPt, const Size& rSz, sal_uLong nExtraData, OutputDevice* pFirstFrameOutDev = nullptr ); -boolmatches( OutputDevice* pOut, long nExtraData ) const; +boolmatches(const OutputDevice* pOut, long nExtraData) const; voiddrawToPos( sal_uLong nPos ); voiddraw( sal_uLong nPos, VirtualDevice* pVDev=nullptr ); voidrepaint(); diff --git a/vcl/source/gdi/impanmvw.cxx b/vcl/source/gdi/impanmvw.cxx index b27a7cc70581..abdc376b2567 100644 --- a/vcl/source/gdi/impanmvw.cxx +++ b/vcl/source/gdi/impanmvw.cxx @@ -96,7 +96,7 @@ ImplAnimView::~ImplAnimView() Animation::ImplDecAnimCount(); } -bool ImplAnimView::matches(OutputDevice* pOut, long nExtraData) const +bool ImplAnimView::matches(const OutputDevice* pOut, long nExtraData) const { return (!pOut || pOut == mpRenderContext) && (nExtraData == 0 || nExtraData == mnExtraData); } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: vcl/source
vcl/source/gdi/impanmvw.cxx | 14 ++ 1 file changed, 2 insertions(+), 12 deletions(-) New commits: commit 70457e664cc12958f1938f0154b9c085525f4c26 Author: Adrien Ollier AuthorDate: Wed Jan 22 08:13:40 2020 +0100 Commit: Mike Kaganski CommitDate: Fri Jan 24 10:01:31 2020 +0100 Rewrite of ImplAnimView::matches using a boolean expression Change-Id: Id9a38229fa2906eea4c8e9cb7ea6529f3b126ba4 Signed-off-by: Adrien Ollier Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87172 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/vcl/source/gdi/impanmvw.cxx b/vcl/source/gdi/impanmvw.cxx index 7818a3dcc0ed..b27a7cc70581 100644 --- a/vcl/source/gdi/impanmvw.cxx +++ b/vcl/source/gdi/impanmvw.cxx @@ -96,19 +96,9 @@ ImplAnimView::~ImplAnimView() Animation::ImplDecAnimCount(); } -bool ImplAnimView::matches( OutputDevice* pOut, long nExtraData ) const +bool ImplAnimView::matches(OutputDevice* pOut, long nExtraData) const { -bool bRet = false; - -if( nExtraData ) -{ -if( ( mnExtraData == nExtraData ) && ( !pOut || ( pOut == mpRenderContext ) ) ) -bRet = true; -} -else if( !pOut || ( pOut == mpRenderContext ) ) -bRet = true; - -return bRet; +return (!pOut || pOut == mpRenderContext) && (nExtraData == 0 || nExtraData == mnExtraData); } void ImplAnimView::getPosSize( const AnimationBitmap& rAnimationBitmap, Point& rPosPix, Size& rSizePix ) ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: vcl/source
vcl/source/animate/Animation.cxx | 27 +++ 1 file changed, 11 insertions(+), 16 deletions(-) New commits: commit f6c01b471a08ad1cb38377b8d82dba89206ea8cb Author: Adrien Ollier AuthorDate: Tue Jan 21 22:38:06 2020 +0100 Commit: Mike Kaganski CommitDate: Wed Jan 22 08:12:52 2020 +0100 rework of painting and removal of ImplAnimView using the STL Change-Id: I9bcfd3e034097c0a3ba17a566201d708cec2b016 Signed-off-by: Adrien Ollier Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87167 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/vcl/source/animate/Animation.cxx b/vcl/source/animate/Animation.cxx index 80115aa730ce..d9eaed56ce73 100644 --- a/vcl/source/animate/Animation.cxx +++ b/vcl/source/animate/Animation.cxx @@ -350,22 +350,17 @@ IMPL_LINK_NOARG(Animation, ImplTimeoutHdl, Timer*, void) } } -// Paint all views; after painting check, if view is -// marked; in this case remove view, because area of output -// lies out of display area of window; mark state is -// set from view itself -for (size_t i = 0; i < maViewList.size();) -{ -ImplAnimView* pView = maViewList[i].get(); -pView->draw(mnPos); - -if (pView->isMarked()) -{ -maViewList.erase(maViewList.begin() + i); -} -else -i++; -} +// Paint all views. +std::for_each(maViewList.cbegin(), maViewList.cend(), + [this](const auto& pView) { pView->draw(mnPos); }); +/* + * If a view is marked, remove the view, because + * area of output lies out of display area of window. + * Mark state is set from view itself. + */ +auto removeStart = std::remove_if(maViewList.begin(), maViewList.end(), + [](const auto& pView) { return pView->isMarked(); }); +maViewList.erase(removeStart, maViewList.cend()); // stop or restart timer if (maViewList.empty()) ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: vcl/source
vcl/source/animate/Animation.cxx | 35 ++- 1 file changed, 14 insertions(+), 21 deletions(-) New commits: commit e03abf9f97a251174dbb81445fbd5f66ae695cd4 Author: Adrien Ollier AuthorDate: Sat Jan 18 17:46:25 2020 +0100 Commit: Mike Kaganski CommitDate: Tue Jan 21 19:45:12 2020 +0100 rework ImplAnimView cleanup using STL algorithms Change-Id: Ie8c857f992d27bb0d70968256eea5d8f2491405e Signed-off-by: Adrien Ollier Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87030 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/vcl/source/animate/Animation.cxx b/vcl/source/animate/Animation.cxx index 7326def3ba5d..80115aa730ce 100644 --- a/vcl/source/animate/Animation.cxx +++ b/vcl/source/animate/Animation.cxx @@ -279,8 +279,7 @@ IMPL_LINK_NOARG(Animation, ImplTimeoutHdl, Timer*, void) if (nAnimCount) { -ImplAnimView* pView; -bool bGlobalPause = true; +bool bGlobalPause = false; if (maNotifyLink.IsSet()) { @@ -294,6 +293,7 @@ IMPL_LINK_NOARG(Animation, ImplTimeoutHdl, Timer*, void) // set view state from AInfo structure for (auto& pAInfo : aAInfoList) { +ImplAnimView* pView = nullptr; if (!pAInfo->pViewData) { pView = new ImplAnimView(this, pAInfo->pOutDev, pAInfo->aStartOrg, @@ -308,26 +308,19 @@ IMPL_LINK_NOARG(Animation, ImplTimeoutHdl, Timer*, void) pView->setMarked(true); } -// delete all unmarked views and reset marked state -for (size_t i = 0; i < maViewList.size();) -{ -pView = maViewList[i].get(); -if (!pView->isMarked()) -{ -maViewList.erase(maViewList.begin() + i); -} -else -{ -if (!pView->isPause()) -bGlobalPause = false; +// delete all unmarked views +auto removeStart = std::remove_if(maViewList.begin(), maViewList.end(), + [](const auto& pView) { return !pView->isMarked(); }); +maViewList.erase(removeStart, maViewList.cend()); -pView->setMarked(false); -i++; -} -} +// check if every remaining view is paused +bGlobalPause = std::all_of(maViewList.cbegin(), maViewList.cend(), + [](const auto& pView) { return pView->isPause(); }); + +// reset marked state +std::for_each(maViewList.cbegin(), maViewList.cend(), + [](const auto& pView) { pView->setMarked(false); }); } -else -bGlobalPause = false; if (maViewList.empty()) Stop(); @@ -363,7 +356,7 @@ IMPL_LINK_NOARG(Animation, ImplTimeoutHdl, Timer*, void) // set from view itself for (size_t i = 0; i < maViewList.size();) { -pView = maViewList[i].get(); +ImplAnimView* pView = maViewList[i].get(); pView->draw(mnPos); if (pView->isMarked()) ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: vcl/source
vcl/source/animate/Animation.cxx | 34 +++--- 1 file changed, 15 insertions(+), 19 deletions(-) New commits: commit ec1c08a68e45306d455b9df0432b8e915d74d124 Author: Adrien Ollier AuthorDate: Sat Jan 18 20:30:43 2020 +0100 Commit: Tomaž Vajngerl CommitDate: Mon Jan 20 10:00:36 2020 +0100 rewrite of Animation::Start using the STL Change-Id: Ieca520db4e3ea754dd8574809e366db11c451c2d Signed-off-by: Adrien Ollier Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87031 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl diff --git a/vcl/source/animate/Animation.cxx b/vcl/source/animate/Animation.cxx index e3fb37125af9..7326def3ba5d 100644 --- a/vcl/source/animate/Animation.cxx +++ b/vcl/source/animate/Animation.cxx @@ -169,28 +169,24 @@ bool Animation::Start(OutputDevice* pOut, const Point& rDestPt, const Size& rDes if ((pOut->GetOutDevType() == OUTDEV_WINDOW) && !mbLoopTerminated && (ANIMATION_TIMEOUT_ON_CLICK != maList[mnPos]->mnWait)) { -ImplAnimView* pView; -ImplAnimView* pMatch = nullptr; +bool differs = true; -for (size_t i = 0; i < maViewList.size(); ++i) +auto itAnimView = std::find_if( +maViewList.begin(), maViewList.end(), +[pOut, nExtraData](const std::unique_ptr& pAnimView) -> bool { +return pAnimView->matches(pOut, nExtraData); +}); + +if (itAnimView != maViewList.end()) { -pView = maViewList[i].get(); -if (pView->matches(pOut, nExtraData)) +if ((*itAnimView)->getOutPos() == rDestPt +&& (*itAnimView)->getOutSizePix() == pOut->LogicToPixel(rDestSz)) { -if (pView->getOutPos() == rDestPt -&& pView->getOutSizePix() == pOut->LogicToPixel(rDestSz)) -{ -pView->repaint(); -pMatch = pView; -} -else -{ -maViewList.erase(maViewList.begin() + i); -pView = nullptr; -} - -break; +(*itAnimView)->repaint(); +differs = false; } +else +maViewList.erase(itAnimView); } if (maViewList.empty()) @@ -200,7 +196,7 @@ bool Animation::Start(OutputDevice* pOut, const Point& rDestPt, const Size& rDes mnPos = 0; } -if (!pMatch) +if (differs) maViewList.emplace_back( new ImplAnimView(this, pOut, rDestPt, rDestSz, nExtraData, pFirstFrameOutDev)); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: include/vcl vcl/source
include/vcl/outdev.hxx|4 include/vcl/window.hxx|1 + vcl/source/outdev/map.cxx | 14 -- vcl/source/window/window3.cxx |9 - 4 files changed, 17 insertions(+), 11 deletions(-) New commits: commit fcc0fea62a6985699dfa88136f22cb19be6232bd Author: Adrien Ollier AuthorDate: Sun Nov 24 11:08:15 2019 +0100 Commit: Mike Kaganski CommitDate: Sun Jan 19 11:33:40 2020 +0100 tdf#74702: clean up of OutputDevice::SetMapMode All changes are formatted using clang-format utility. Change-Id: Icfa7ae22bc06e57c7f7cb512813966dcefd4fc40 Signed-off-by: Adrien Ollier Reviewed-on: https://gerrit.libreoffice.org/c/core/+/83601 Reviewed-by: Mike Kaganski Tested-by: Jenkins diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx index d0578b39095a..64ba3f135ad2 100644 --- a/include/vcl/outdev.hxx +++ b/include/vcl/outdev.hxx @@ -1673,6 +1673,10 @@ public: voidSetRelativeMapMode( const MapMode& rNewMapMode ); const MapMode& GetMapMode() const { return maMapMode; } +protected: +virtual void ImplInitMapModeObjects(); + +public: // #i75163# basegfx::B2DHomMatrix GetViewTransformation() const; basegfx::B2DHomMatrix GetInverseViewTransformation() const; diff --git a/include/vcl/window.hxx b/include/vcl/window.hxx index 8ea622a8898e..a78259c5f222 100644 --- a/include/vcl/window.hxx +++ b/include/vcl/window.hxx @@ -746,6 +746,7 @@ protected: void ImplClearFontData(bool bNewFontLists) override; void ImplRefreshFontData(bool bNewFontLists) override; +void ImplInitMapModeObjects() override; // FIXME: this is a hack to workaround missing layout functionality virtual voidImplAdjustNWFSizes(); diff --git a/vcl/source/outdev/map.cxx b/vcl/source/outdev/map.cxx index 7ac99f6b4a37..92d9e63224e7 100644 --- a/vcl/source/outdev/map.cxx +++ b/vcl/source/outdev/map.cxx @@ -666,11 +666,7 @@ void OutputDevice::SetMapMode() // create new objects (clip region are not re-scaled) mbNewFont = true; mbInitFont = true; -if ( GetOutDevType() == OUTDEV_WINDOW ) -{ -if ( static_cast(this)->mpWindowImpl->mpCursor ) - static_cast(this)->mpWindowImpl->mpCursor->ImplNew(); -} +ImplInitMapModeObjects(); // #106426# Adapt logical offset when changing mapmode mnOutOffLogicX = mnOutOffOrigX; // no mapping -> equal offsets @@ -760,11 +756,7 @@ void OutputDevice::SetMapMode( const MapMode& rNewMapMode ) // create new objects (clip region are not re-scaled) mbNewFont = true; mbInitFont = true; -if ( GetOutDevType() == OUTDEV_WINDOW ) -{ -if ( static_cast(this)->mpWindowImpl->mpCursor ) -static_cast(this)->mpWindowImpl->mpCursor->ImplNew(); -} +ImplInitMapModeObjects(); // #106426# Adapt logical offset when changing mapmode mnOutOffLogicX = ImplPixelToLogic( mnOutOffOrigX, mnDPIX, @@ -778,6 +770,8 @@ void OutputDevice::SetMapMode( const MapMode& rNewMapMode ) ImplInvalidateViewTransform(); } +void OutputDevice::ImplInitMapModeObjects() {} + void OutputDevice::SetRelativeMapMode( const MapMode& rNewMapMode ) { // do nothing if MapMode did not change diff --git a/vcl/source/window/window3.cxx b/vcl/source/window/window3.cxx index 565a81eb292e..c99d085f41e5 100644 --- a/vcl/source/window/window3.cxx +++ b/vcl/source/window/window3.cxx @@ -20,6 +20,7 @@ #include #include #include +#include WaitObject::~WaitObject() { @@ -55,7 +56,13 @@ void Window::ImplRefreshFontData(bool bNewFontLists) pChild->ImplRefreshFontData(bNewFontLists); } -} /* namespace vcl */ +void Window::ImplInitMapModeObjects() +{ +OutputDevice::ImplInitMapModeObjects(); +if (mpWindowImpl->mpCursor) +mpWindowImpl->mpCursor->ImplNew(); +} +} /* namespace vcl */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: include/vcl vcl/source
include/vcl/button.hxx|4 ++-- include/vcl/window.hxx|2 +- vcl/source/control/button.cxx |4 ++-- vcl/source/window/window3.cxx | 24 +++- 4 files changed, 8 insertions(+), 26 deletions(-) New commits: commit 7ae70706ad3a3e3aa86fbc7cbd1fcc28f0d2e1b2 Author: Adrien Ollier AuthorDate: Tue Nov 26 20:17:11 2019 +0100 Commit: Mike Kaganski CommitDate: Tue Jan 7 15:13:59 2020 +0100 Use virtual method instead of switch in parent class Change-Id: I53129ed6b57eb13898a426de0a2ba72c7d6674de Signed-off-by: Adrien Ollier Reviewed-on: https://gerrit.libreoffice.org/c/core/+/83825 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/include/vcl/button.hxx b/include/vcl/button.hxx index be4ccb334a6b..d0aa24757ae1 100644 --- a/include/vcl/button.hxx +++ b/include/vcl/button.hxx @@ -307,7 +307,6 @@ protected: public: SAL_DLLPRIVATE void ImplCallClick( bool bGrabFocus = false, GetFocusFlags nFocusFlags = GetFocusFlags::NONE ); -SAL_DLLPRIVATE void ImplSetMinimumNWFSize(); protected: virtual voidFillLayoutData() const override; @@ -315,6 +314,7 @@ protected: GetCanonicalFont( const StyleSettings& _rStyle ) const override; virtual const Color& GetCanonicalTextColor( const StyleSettings& _rStyle ) const override; +voidImplAdjustNWFSizes() override; public: explicitRadioButton( vcl::Window* pParent, WinBits nWinStyle = 0 ); @@ -418,6 +418,7 @@ protected: virtual voidFillLayoutData() const override; virtual const vcl::Font&GetCanonicalFont( const StyleSettings& _rStyle ) const override; virtual const Color&GetCanonicalTextColor( const StyleSettings& _rStyle ) const override; +voidImplAdjustNWFSizes() override; virtual void ImplDrawCheckBoxState(vcl::RenderContext& rRenderContext); SAL_DLLPRIVATE const tools::Rectangle& GetStateRect() const { return maStateRect; } @@ -425,7 +426,6 @@ protected: public: SAL_DLLPRIVATE void ImplCheck(); -SAL_DLLPRIVATE void ImplSetMinimumNWFSize(); public: explicitCheckBox( vcl::Window* pParent, WinBits nStyle = 0 ); diff --git a/include/vcl/window.hxx b/include/vcl/window.hxx index 8c87a78510cb..8ea622a8898e 100644 --- a/include/vcl/window.hxx +++ b/include/vcl/window.hxx @@ -748,7 +748,7 @@ protected: void ImplRefreshFontData(bool bNewFontLists) override; // FIXME: this is a hack to workaround missing layout functionality -SAL_DLLPRIVATE void ImplAdjustNWFSizes(); +virtual voidImplAdjustNWFSizes(); virtual voidCopyDeviceArea( SalTwoRect& aPosAry, bool bWindowInvalidate) override; virtual voidClipToPaintRegion( tools::Rectangle& rDstRect ) override; diff --git a/vcl/source/control/button.cxx b/vcl/source/control/button.cxx index 715752c146c4..e35ab9de4ef6 100644 --- a/vcl/source/control/button.cxx +++ b/vcl/source/control/button.cxx @@ -2739,7 +2739,7 @@ Image RadioButton::GetRadioImage( const AllSettings& rSettings, DrawButtonFlags return pSVData->maCtrlData.maRadioImgList[nIndex]; } -void RadioButton::ImplSetMinimumNWFSize() +void RadioButton::ImplAdjustNWFSizes() { Push( PushFlags::MAPMODE ); SetMapMode(MapMode(MapUnit::MapPixel)); @@ -3579,7 +3579,7 @@ Image CheckBox::GetCheckImage( const AllSettings& rSettings, DrawButtonFlags nFl return pSVData->maCtrlData.maCheckImgList[nIndex]; } -void CheckBox::ImplSetMinimumNWFSize() +void CheckBox::ImplAdjustNWFSizes() { Push( PushFlags::MAPMODE ); SetMapMode(MapMode(MapUnit::MapPixel)); diff --git a/vcl/source/window/window3.cxx b/vcl/source/window/window3.cxx index c3412e0dda46..565a81eb292e 100644 --- a/vcl/source/window/window3.cxx +++ b/vcl/source/window/window3.cxx @@ -19,7 +19,6 @@ #include #include -#include #include WaitObject::~WaitObject() @@ -37,26 +36,9 @@ Size Window::GetOptimalSize() const void Window::ImplAdjustNWFSizes() { -switch( GetType() ) -{ -case WindowType::CHECKBOX: -static_cast(this)->ImplSetMinimumNWFSize(); -break; -case WindowType::RADIOBUTTON: -static_cast(this)->ImplSetMinimumNWFSize(); -break; -default: -{ -// iterate over children -vcl::Window* pWin = GetWindow( GetWindowType::FirstChild ); -while( pWin ) -{ -pWin->ImplAdjustNWFSizes(); -pWin = pWin->GetWindow( GetWindowType::Next ); -} -} -break; -} +for (Window* pWin = GetWindow(GetWindowType::FirstChild); pWin; + pWin = pWin->GetWindow(GetWindowType::Next)) +pWin->ImplAdjustNWFSizes(); } void Window::ImplClearFontData(bool bNewFontLists) _
[Libreoffice-commits] core.git: writerfilter/source
writerfilter/source/rtftok/rtfsprm.cxx | 54 ++--- 1 file changed, 30 insertions(+), 24 deletions(-) New commits: commit a56f2d01687512d4ecdf5b3df949d909aa8834b6 Author: Adrien Ollier AuthorDate: Fri Aug 16 01:52:36 2019 +0200 Commit: Mike Kaganski CommitDate: Sun Sep 1 08:10:10 2019 +0200 makes RTFSprms::set clearer Change-Id: Ic1aab40c8a4abdd73c616b2faaf95ef183fa2e38 Signed-off-by: Adrien Ollier Reviewed-on: https://gerrit.libreoffice.org/77556 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/writerfilter/source/rtftok/rtfsprm.cxx b/writerfilter/source/rtftok/rtfsprm.cxx index 5404dd9176ea..76838e3aa620 100644 --- a/writerfilter/source/rtftok/rtfsprm.cxx +++ b/writerfilter/source/rtftok/rtfsprm.cxx @@ -103,32 +103,38 @@ void RTFSprms::set(Id nKeyword, const RTFValue::Pointer_t& pValue, RTFOverwrite { ensureCopyBeforeWrite(); -if (eOverwrite == RTFOverwrite::YES_PREPEND) +switch (eOverwrite) { -auto it = std::remove_if(m_pSprms->begin(), m_pSprms->end(), RTFSprms_compare{ nKeyword }); -m_pSprms->erase(it, m_pSprms->end()); -m_pSprms->insert(m_pSprms->begin(), std::make_pair(nKeyword, pValue)); -return; -} - -bool bFound = false; -if (eOverwrite == RTFOverwrite::YES || eOverwrite == RTFOverwrite::NO_IGNORE) -{ -for (auto& rSprm : *m_pSprms) -if (rSprm.first == nKeyword) -{ -if (eOverwrite == RTFOverwrite::YES) -{ -rSprm.second = pValue; -return; -} - -bFound = true; -break; -} +case RTFOverwrite::YES_PREPEND: +{ +m_pSprms->erase( +std::remove_if(m_pSprms->begin(), m_pSprms->end(), RTFSprms_compare{ nKeyword }), +m_pSprms->end()); +m_pSprms->emplace(m_pSprms->cbegin(), nKeyword, pValue); +break; +} +case RTFOverwrite::YES: +{ +auto it += std::find_if(m_pSprms->begin(), m_pSprms->end(), RTFSprms_compare{ nKeyword }); +if (it != m_pSprms->end()) +it->second = pValue; +else +m_pSprms->emplace_back(nKeyword, pValue); +break; +} +case RTFOverwrite::NO_IGNORE: +{ +if (std::none_of(m_pSprms->cbegin(), m_pSprms->cend(), RTFSprms_compare{ nKeyword })) +m_pSprms->emplace_back(nKeyword, pValue); +break; +} +case RTFOverwrite::NO_APPEND: +{ +m_pSprms->emplace_back(nKeyword, pValue); +break; +} } -if (eOverwrite == RTFOverwrite::NO_APPEND || !bFound) -m_pSprms->push_back(std::make_pair(nKeyword, pValue)); } bool RTFSprms::erase(Id nKeyword) ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: vcl/source
vcl/source/outdev/font.cxx |4 vcl/source/outdev/outdev.cxx |4 2 files changed, 4 insertions(+), 4 deletions(-) New commits: commit 5735a2ce6941264e90f6b0593c54f661291d4987 Author: Adrien Ollier AuthorDate: Sat Aug 10 09:34:05 2019 +0200 Commit: Tomaž Vajngerl CommitDate: Fri Aug 30 03:57:40 2019 +0200 moves outdev font functions in font.cxx Change-Id: I02e133b1682d4d1aab1d56eae0528856b0fabe55 Signed-off-by: Adrien Ollier Reviewed-on: https://gerrit.libreoffice.org/77232 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl diff --git a/vcl/source/outdev/font.cxx b/vcl/source/outdev/font.cxx index a306d1a2ae98..b4a57c9c025e 100644 --- a/vcl/source/outdev/font.cxx +++ b/vcl/source/outdev/font.cxx @@ -1465,6 +1465,10 @@ sal_Int32 OutputDevice::HasGlyphs( const vcl::Font& rTempFont, const OUString& r return -1; } +void OutputDevice::ReleaseFontCache() { mxFontCache.reset(); } + +void OutputDevice::ReleaseFontCollection() { mxFontCollection.reset(); } + void OutputDevice::SetFontCollectionFromSVData() { mxFontCollection = ImplGetSVData()->maGDIData.mxScreenFontList->Clone(); diff --git a/vcl/source/outdev/outdev.cxx b/vcl/source/outdev/outdev.cxx index 6a6be6958a25..6776cb3d7c85 100644 --- a/vcl/source/outdev/outdev.cxx +++ b/vcl/source/outdev/outdev.cxx @@ -720,8 +720,4 @@ bool OutputDevice::DrawEPS( const Point& rPoint, const Size& rSize, return bDrawn; } -void OutputDevice::ReleaseFontCache() { mxFontCache.reset(); } - -void OutputDevice::ReleaseFontCollection() { mxFontCollection.reset(); } - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: writerfilter/source
writerfilter/source/rtftok/rtfsprm.cxx | 34 + 1 file changed, 22 insertions(+), 12 deletions(-) New commits: commit ed71dcc9996c507ecb2bca24f38e09f66134fbfc Author: Adrien Ollier AuthorDate: Wed Jul 24 05:29:03 2019 +0200 Commit: Tomaž Vajngerl CommitDate: Fri Aug 30 03:56:42 2019 +0200 RTFSprms: code refactorization Four lambda expressions were declared doing the same thing, which leads to the creation of four internal different types for the same thing. That makes no sense. Class RTFSprms_compare allows to factorize this code and makes code shorter where it is used. Change-Id: I5ed6821a67a50e96d9425064841c2b3421323001 Signed-off-by: Adrien Ollier Reviewed-on: https://gerrit.libreoffice.org/76214 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl diff --git a/writerfilter/source/rtftok/rtfsprm.cxx b/writerfilter/source/rtftok/rtfsprm.cxx index 6ba986e6b987..5404dd9176ea 100644 --- a/writerfilter/source/rtftok/rtfsprm.cxx +++ b/writerfilter/source/rtftok/rtfsprm.cxx @@ -57,14 +57,30 @@ std::string RTFSprm::toString() const } #endif +namespace +{ +class RTFSprms_compare +{ +Id keyword; + +public: +RTFSprms_compare(Id kw) +: keyword{ kw } +{ +} +bool operator()(const std::pair& raPair) const +{ +return raPair.first == keyword; +} +}; +} + RTFValue::Pointer_t RTFSprms::find(Id nKeyword, bool bFirst, bool bForWrite) { if (bForWrite) ensureCopyBeforeWrite(); -auto cmp = [&nKeyword](const std::pair& raPair) -> bool { -return raPair.first == nKeyword; -}; +RTFSprms_compare cmp{ nKeyword }; if (bFirst) { @@ -89,9 +105,7 @@ void RTFSprms::set(Id nKeyword, const RTFValue::Pointer_t& pValue, RTFOverwrite if (eOverwrite == RTFOverwrite::YES_PREPEND) { -auto it = std::remove_if( -m_pSprms->begin(), m_pSprms->end(), -[nKeyword](const RTFSprms::Entry_t& rSprm) { return rSprm.first == nKeyword; }); +auto it = std::remove_if(m_pSprms->begin(), m_pSprms->end(), RTFSprms_compare{ nKeyword }); m_pSprms->erase(it, m_pSprms->end()); m_pSprms->insert(m_pSprms->begin(), std::make_pair(nKeyword, pValue)); return; @@ -121,9 +135,7 @@ bool RTFSprms::erase(Id nKeyword) { ensureCopyBeforeWrite(); -auto i = std::find_if( -m_pSprms->begin(), m_pSprms->end(), -[&nKeyword](RTFSprmsImpl::value_type& rEntry) { return rEntry.first == nKeyword; }); +auto i = std::find_if(m_pSprms->begin(), m_pSprms->end(), RTFSprms_compare{ nKeyword }); if (i != m_pSprms->end()) { m_pSprms->erase(i); @@ -136,9 +148,7 @@ void RTFSprms::eraseLast(Id nKeyword) { ensureCopyBeforeWrite(); -auto i = std::find_if( -m_pSprms->rbegin(), m_pSprms->rend(), -[&nKeyword](RTFSprmsImpl::value_type& rEntry) { return rEntry.first == nKeyword; }); +auto i = std::find_if(m_pSprms->rbegin(), m_pSprms->rend(), RTFSprms_compare{ nKeyword }); if (i != m_pSprms->rend()) m_pSprms->erase(std::next(i).base()); } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: editeng/source
editeng/source/editeng/editobj.cxx | 28 ++-- 1 file changed, 10 insertions(+), 18 deletions(-) New commits: commit a3b2c6b8b3ac67dca29605aa1ae856f663683c4b Author: Adrien Ollier AuthorDate: Sun Jul 28 19:06:49 2019 +0200 Commit: Noel Grandin CommitDate: Wed Aug 28 08:35:53 2019 +0200 ContentInfo::Equals uses std::equal Change-Id: Ia99cd1cb9594d6398ff351f6ded7888a75c83dd6 Signed-off-by: Adrien Ollier Reviewed-on: https://gerrit.libreoffice.org/76504 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/editeng/source/editeng/editobj.cxx b/editeng/source/editeng/editobj.cxx index ad096dfa7f82..a0112468af5b 100644 --- a/editeng/source/editeng/editobj.cxx +++ b/editeng/source/editeng/editobj.cxx @@ -217,24 +217,16 @@ void ContentInfo::Dump() const } #endif -bool ContentInfo::Equals( const ContentInfo& rCompare, bool bComparePool ) const -{ -if( (maText == rCompare.maText) && -(aStyle == rCompare.aStyle ) && -(maCharAttribs.size() == rCompare.maCharAttribs.size()) && -(eFamily == rCompare.eFamily ) && -aParaAttribs.Equals( rCompare.aParaAttribs, bComparePool ) ) -{ -for (size_t i = 0, n = maCharAttribs.size(); i < n; ++i) -{ -if (!(*(maCharAttribs[i]) == *(rCompare.maCharAttribs[i]))) -return false; -} - -return true; -} - -return false; +bool ContentInfo::Equals(const ContentInfo& rCompare, bool bComparePool) const +{ +return maText == rCompare.maText && aStyle == rCompare.aStyle && eFamily == rCompare.eFamily + && aParaAttribs.Equals(rCompare.aParaAttribs, bComparePool) + && std::equal(maCharAttribs.cbegin(), maCharAttribs.cend(), + rCompare.maCharAttribs.cbegin(), rCompare.maCharAttribs.cend(), + [](const std::unique_ptr& pAttribute1, +const std::unique_ptr& pAttribute2) -> bool { + return *pAttribute1 == *pAttribute2; + }); } EditTextObject::EditTextObject( SfxItemPool* pPool ) : ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: writerfilter/source
writerfilter/source/rtftok/rtfsprm.cxx |4 ++-- writerfilter/source/rtftok/rtfsprm.hxx |2 +- writerfilter/source/rtftok/rtfvalue.cxx |2 +- writerfilter/source/rtftok/rtfvalue.hxx |2 +- 4 files changed, 5 insertions(+), 5 deletions(-) New commits: commit e1c7cb5d2759341fc235eb41c80a0dbc9107db5c Author: Adrien Ollier AuthorDate: Wed Jul 24 04:14:58 2019 +0200 Commit: Noel Grandin CommitDate: Sat Aug 24 14:28:19 2019 +0200 equality test functions are const RTFSprms::equals and RTFValue::equals are mutually dependent, which is insane. Change-Id: Ib6de7954e97d5a1620ea3f8db92fe9a989ee8667 Signed-off-by: Adrien Ollier Reviewed-on: https://gerrit.libreoffice.org/76211 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/writerfilter/source/rtftok/rtfsprm.cxx b/writerfilter/source/rtftok/rtfsprm.cxx index 7ede5a30e2b9..7d2de7c0bb79 100644 --- a/writerfilter/source/rtftok/rtfsprm.cxx +++ b/writerfilter/source/rtftok/rtfsprm.cxx @@ -374,9 +374,9 @@ RTFSprms RTFSprms::cloneAndDeduplicate(RTFSprms& rReference, Id const nStyleType return ret; } -bool RTFSprms::equals(RTFValue& rOther) +bool RTFSprms::equals(const RTFValue& rOther) const { -return std::all_of(m_pSprms->begin(), m_pSprms->end(), +return std::all_of(m_pSprms->cbegin(), m_pSprms->cend(), [&](const std::pair& raPair) -> bool { return raPair.second->equals(rOther); }); diff --git a/writerfilter/source/rtftok/rtfsprm.hxx b/writerfilter/source/rtftok/rtfsprm.hxx index 561f716e603b..b2eb9f25102d 100644 --- a/writerfilter/source/rtftok/rtfsprm.hxx +++ b/writerfilter/source/rtftok/rtfsprm.hxx @@ -75,7 +75,7 @@ public: Iterator_t begin() { return m_pSprms->begin(); } Iterator_t end() { return m_pSprms->end(); } void clear(); -bool equals(RTFValue& rOther); +bool equals(const RTFValue& rOther) const; private: void ensureCopyBeforeWrite(); diff --git a/writerfilter/source/rtftok/rtfvalue.cxx b/writerfilter/source/rtftok/rtfvalue.cxx index 15648f9dba9b..49ebfc10eef4 100644 --- a/writerfilter/source/rtftok/rtfvalue.cxx +++ b/writerfilter/source/rtftok/rtfvalue.cxx @@ -186,7 +186,7 @@ RTFValue* RTFValue::CloneWithSprms(RTFSprms const& rAttributes, RTFSprms const& m_bForceString, *m_pShape, *m_pPicture); } -bool RTFValue::equals(RTFValue& rOther) +bool RTFValue::equals(const RTFValue& rOther) const { if (m_nValue != rOther.m_nValue) return false; diff --git a/writerfilter/source/rtftok/rtfvalue.hxx b/writerfilter/source/rtftok/rtfvalue.hxx index e2ff4e9e8fcc..8fbd49bd0a8e 100644 --- a/writerfilter/source/rtftok/rtfvalue.hxx +++ b/writerfilter/source/rtftok/rtfvalue.hxx @@ -73,7 +73,7 @@ public: RTFSprms& getSprms(); RTFShape& getShape() const; RTFPicture& getPicture() const; -bool equals(RTFValue& rOther); +bool equals(const RTFValue& rOther) const; RTFValue& operator=(RTFValue const& rOther) = delete; private: ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: include/vcl vcl/source
include/vcl/outdev.hxx |4 +++- include/vcl/window.hxx |1 + vcl/source/gdi/pdfwriter_impl.hxx |1 + vcl/source/gdi/pdfwriter_impl2.cxx | 10 ++ vcl/source/outdev/font.cxx | 31 ++- vcl/source/window/window3.cxx |8 6 files changed, 33 insertions(+), 22 deletions(-) New commits: commit 7e88bc73030c7708f1a8b47491070aae5b73aac1 Author: Adrien Ollier AuthorDate: Thu Jul 4 05:06:10 2019 +0200 Commit: Tomaž Vajngerl CommitDate: Thu Aug 8 13:02:38 2019 +0200 tdf#74702: removes GetOutDevType() from OutputDevice::ImplRefreshFontData Change-Id: I8a51afe0979d83862bbe384e6d67702f4687072d Signed-off-by: Adrien Ollier Reviewed-on: https://gerrit.libreoffice.org/75068 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx index 3151abbe1e9c..8d385e003dd2 100644 --- a/include/vcl/outdev.hxx +++ b/include/vcl/outdev.hxx @@ -1289,8 +1289,11 @@ protected: virtual longGetFontExtLeading() const; virtual void ImplClearFontData(bool bNewFontLists); +virtual void ImplRefreshFontData(bool bNewFontLists); void ReleaseFontCache(); void ReleaseFontCollection(); +void SetFontCollectionFromSVData(); +void ResetNewFontCache(); private: @@ -1298,7 +1301,6 @@ private: SAL_DLLPRIVATE bool ImplNewFont() const; -SAL_DLLPRIVATE void ImplRefreshFontData( bool bNewFontLists ); SAL_DLLPRIVATE static void ImplUpdateFontDataForAllFrames( FontUpdateHandler_t pHdl, bool bNewFontLists ); static diff --git a/include/vcl/window.hxx b/include/vcl/window.hxx index bdc4ea3d0019..ce8669895fe5 100644 --- a/include/vcl/window.hxx +++ b/include/vcl/window.hxx @@ -742,6 +742,7 @@ protected: virtual voidInitClipRegion() override; void ImplClearFontData(bool bNewFontLists) override; +void ImplRefreshFontData(bool bNewFontLists) override; // FIXME: this is a hack to workaround missing layout functionality SAL_DLLPRIVATE void ImplAdjustNWFSizes(); diff --git a/vcl/source/gdi/pdfwriter_impl.hxx b/vcl/source/gdi/pdfwriter_impl.hxx index cd8f5eac31bb..7dd40d96e039 100644 --- a/vcl/source/gdi/pdfwriter_impl.hxx +++ b/vcl/source/gdi/pdfwriter_impl.hxx @@ -594,6 +594,7 @@ public: protected: void ImplClearFontData(bool bNewFontLists) override; +void ImplRefreshFontData(bool bNewFontLists) override; vcl::Region ClipToDeviceBounds(vcl::Region aRegion) const override; void DrawHatchLine_DrawLine(const Point& rStartPoint, const Point& rEndPoint) override; diff --git a/vcl/source/gdi/pdfwriter_impl2.cxx b/vcl/source/gdi/pdfwriter_impl2.cxx index a060cd580fe0..4dbc13bc6079 100644 --- a/vcl/source/gdi/pdfwriter_impl2.cxx +++ b/vcl/source/gdi/pdfwriter_impl2.cxx @@ -2027,9 +2027,19 @@ void PDFWriterImpl::ImplClearFontData(bool bNewFontLists) } } +void PDFWriterImpl::ImplRefreshFontData(bool bNewFontLists) +{ +if (bNewFontLists && AcquireGraphics()) +{ +SetFontCollectionFromSVData(); +ResetNewFontCache(); +} +} + vcl::Region PDFWriterImpl::ClipToDeviceBounds(vcl::Region aRegion) const { return aRegion; } + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/outdev/font.cxx b/vcl/source/outdev/font.cxx index dbecc1d550fe..a306d1a2ae98 100644 --- a/vcl/source/outdev/font.cxx +++ b/vcl/source/outdev/font.cxx @@ -523,29 +523,8 @@ void OutputDevice::RefreshFontData( const bool bNewFontLists ) void OutputDevice::ImplRefreshFontData( const bool bNewFontLists ) { -ImplSVData* pSVData = ImplGetSVData(); - if (bNewFontLists && AcquireGraphics()) -{ -if (GetOutDevType() == OUTDEV_PDF) -{ -mxFontCollection = pSVData->maGDIData.mxScreenFontList->Clone(); -mxFontCache.reset(new ImplFontCache); -} -else mpGraphics->GetDevFontList( mxFontCollection.get() ); -} - -// also update child windows if needed -if ( GetOutDevType() == OUTDEV_WINDOW ) -{ -vcl::Window* pChild = static_cast(this)->mpWindowImpl->mpFirstChild; -while ( pChild ) -{ -pChild->ImplRefreshFontData( true ); -pChild = pChild->mpWindowImpl->mpNext; -} -} } void OutputDevice::ImplUpdateFontData() @@ -1486,4 +1465,14 @@ sal_Int32 OutputDevice::HasGlyphs( const vcl::Font& rTempFont, const OUString& r return -1; } +void OutputDevice::SetFontCollectionFromSVData() +{ +mxFontCollection = ImplGetSVData()->maGDIData.mxScreenFontList->Clone(); +} + +void OutputDevice::ResetNewFontCache() +{ +mxFontCache.reset(new ImplFontCache{}); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/window/window3.cxx b/vcl/source/window/window3.cxx index 492839f05415..c3412e0dda46 100644 ---
[Libreoffice-commits] core.git: writerfilter/source
writerfilter/source/rtftok/rtfsprm.cxx | 28 ++-- 1 file changed, 18 insertions(+), 10 deletions(-) New commits: commit 347b26ae3e332c206724fe5ec9d46fef38798281 Author: Adrien Ollier AuthorDate: Mon Jul 22 20:16:05 2019 +0200 Commit: Noel Grandin CommitDate: Tue Jul 23 15:45:52 2019 +0200 better implementation of RTFSprms::find if not bFirst, then it is more efficient to start the search from the end. Change-Id: I89bcb3b70ada7746ab983878f2868f58b89f37a5 Signed-off-by: Adrien Ollier Reviewed-on: https://gerrit.libreoffice.org/76126 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/writerfilter/source/rtftok/rtfsprm.cxx b/writerfilter/source/rtftok/rtfsprm.cxx index b50d9b166344..109dd20474e5 100644 --- a/writerfilter/source/rtftok/rtfsprm.cxx +++ b/writerfilter/source/rtftok/rtfsprm.cxx @@ -59,20 +59,28 @@ std::string RTFSprm::toString() const RTFValue::Pointer_t RTFSprms::find(Id nKeyword, bool bFirst, bool bForWrite) { -RTFValue::Pointer_t pValue; - if (bForWrite) ensureCopyBeforeWrite(); -for (auto& rSprm : *m_pSprms) -if (rSprm.first == nKeyword) -{ -if (bFirst) -return rSprm.second; +auto cmp = [&nKeyword](const std::pair& raPair) -> bool { +return raPair.first == nKeyword; +}; -pValue = rSprm.second; -} -return pValue; +if (bFirst) +{ +auto it = std::find_if(m_pSprms->begin(), m_pSprms->end(), cmp); +if (it != m_pSprms->end()) +return it->second; +} +else +// find last +{ +auto rit = std::find_if(m_pSprms->rbegin(), m_pSprms->rend(), cmp); +if (rit != m_pSprms->rend()) +return rit->second; +} + +return RTFValue::Pointer_t{}; } void RTFSprms::set(Id nKeyword, const RTFValue::Pointer_t& pValue, RTFOverwrite eOverwrite) ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: writerfilter/source
writerfilter/source/rtftok/rtfsprm.cxx |9 + 1 file changed, 5 insertions(+), 4 deletions(-) New commits: commit 4ad77ab737a00fd1325753592acca9ae00a838af Author: Adrien Ollier AuthorDate: Mon Jul 22 18:48:00 2019 +0200 Commit: Noel Grandin CommitDate: Tue Jul 23 06:47:18 2019 +0200 using an algorithm of the STL makes code clearer Change-Id: I0bf26b6a75354ccbb79d431c947277d621985385 Signed-off-by: Adrien Ollier Reviewed-on: https://gerrit.libreoffice.org/76127 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/writerfilter/source/rtftok/rtfsprm.cxx b/writerfilter/source/rtftok/rtfsprm.cxx index 15026cb93ea4..b50d9b166344 100644 --- a/writerfilter/source/rtftok/rtfsprm.cxx +++ b/writerfilter/source/rtftok/rtfsprm.cxx @@ -12,6 +12,7 @@ #include #include #include "rtfdocumentimpl.hxx" +#include namespace writerfilter { @@ -367,10 +368,10 @@ RTFSprms RTFSprms::cloneAndDeduplicate(RTFSprms& rReference, Id const nStyleType bool RTFSprms::equals(RTFValue& rOther) { -for (auto& rSprm : *m_pSprms) -if (!rSprm.second->equals(rOther)) -return false; -return true; +return std::all_of(m_pSprms->begin(), m_pSprms->end(), + [&](const std::pair& raPair) -> bool { + return raPair.second->equals(rOther); + }); } void RTFSprms::ensureCopyBeforeWrite() ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: include/vcl vcl/source
include/vcl/outdev.hxx |3 +++ vcl/source/gdi/pdfwriter_impl.hxx |1 + vcl/source/gdi/pdfwriter_impl2.cxx |5 + vcl/source/outdev/hatch.cxx| 17 +++-- 4 files changed, 16 insertions(+), 10 deletions(-) New commits: commit c5e7cba6fe712aecc7131be550de37b93db27b18 Author: Adrien Ollier AuthorDate: Thu Jun 20 18:58:39 2019 +0200 Commit: Tomaž Vajngerl CommitDate: Tue Jul 2 09:18:09 2019 +0200 tdf#74702: cleans OutputDevice::DrawHatchLine up Change-Id: Ie90e0f75018edee178f1f02056e59b35956c4142 Signed-off-by: Adrien Ollier Reviewed-on: https://gerrit.libreoffice.org/74464 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx index e23e3552fe0c..959a8ccdc036 100644 --- a/include/vcl/outdev.hxx +++ b/include/vcl/outdev.hxx @@ -729,6 +729,9 @@ public: voidDrawLine( const Point& rStartPt, const Point& rEndPt, const LineInfo& rLineInfo ); +protected: +virtual void DrawHatchLine_DrawLine(const Point& rStartPoint, const Point& rEndPoint); + private: /** Helper for line geometry paint with support for graphic expansion (pattern and fat_to_area) diff --git a/vcl/source/gdi/pdfwriter_impl.hxx b/vcl/source/gdi/pdfwriter_impl.hxx index b615ac24feb9..c728b16c21f4 100644 --- a/vcl/source/gdi/pdfwriter_impl.hxx +++ b/vcl/source/gdi/pdfwriter_impl.hxx @@ -596,6 +596,7 @@ public: protected: void ImplClearFontData(bool bNewFontLists) override; void ClipRegionIntersectRectangle(vcl::Region&) override; +void DrawHatchLine_DrawLine(const Point& rStartPoint, const Point& rEndPoint) override; private: MapMode m_aMapMode; // PDFWriterImpl scaled units diff --git a/vcl/source/gdi/pdfwriter_impl2.cxx b/vcl/source/gdi/pdfwriter_impl2.cxx index a1bc6472fbfd..bf24fd2978dc 100644 --- a/vcl/source/gdi/pdfwriter_impl2.cxx +++ b/vcl/source/gdi/pdfwriter_impl2.cxx @@ -2001,6 +2001,11 @@ void PDFWriterImpl::writeG4Stream( BitmapReadAccess const * i_pBitmap ) } } +void PDFWriterImpl::DrawHatchLine_DrawLine(const Point& rStartPoint, const Point& rEndPoint) +{ +drawLine(rStartPoint, rEndPoint); +} + static bool lcl_canUsePDFAxialShading(const Gradient& rGradient) { switch (rGradient.GetStyle()) { diff --git a/vcl/source/outdev/hatch.cxx b/vcl/source/outdev/hatch.cxx index 89319393c8b7..5fba38ad5c25 100644 --- a/vcl/source/outdev/hatch.cxx +++ b/vcl/source/outdev/hatch.cxx @@ -394,18 +394,15 @@ void OutputDevice::DrawHatchLine( const tools::Line& rLine, const tools::PolyPol else { for( long i = 0; i < nPCounter; i += 2 ) -{ -if (GetOutDevType() == OUTDEV_PDF) - static_cast(this)->drawLine(pPtBuffer[ i ], pPtBuffer[ i+1 ]); -else -{ -const Point aPt1( ImplLogicToDevicePixel( pPtBuffer[ i ] ) ); -const Point aPt2( ImplLogicToDevicePixel( pPtBuffer[ i + 1 ] ) ); -mpGraphics->DrawLine( aPt1.X(), aPt1.Y(), aPt2.X(), aPt2.Y(), this ); -} -} +DrawHatchLine_DrawLine(pPtBuffer[i], pPtBuffer[i+1]); } } } +void OutputDevice::DrawHatchLine_DrawLine(const Point& rStartPoint, const Point& rEndPoint) +{ +Point aPt1{ImplLogicToDevicePixel(rStartPoint)}, aPt2{ImplLogicToDevicePixel(rEndPoint)}; +mpGraphics->DrawLine(aPt1.X(), aPt1.Y(), aPt2.X(), aPt2.Y(), this); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: include/vcl vcl/source
include/vcl/outdev.hxx |1 + include/vcl/print.hxx |1 + vcl/source/gdi/pdfwriter_impl.hxx |1 + vcl/source/gdi/pdfwriter_impl2.cxx |2 ++ vcl/source/gdi/print.cxx |2 ++ vcl/source/outdev/clipping.cxx | 24 6 files changed, 19 insertions(+), 12 deletions(-) New commits: commit 3a99d7f6210363cef47641481b82bae6fb1e997c Author: Adrien Ollier AuthorDate: Tue May 14 19:51:24 2019 +0200 Commit: Tomaž Vajngerl CommitDate: Mon Jul 1 02:03:55 2019 +0200 tdf#74702: cleans OutputDevice::InitClipRegion up Change-Id: I2d6e35c68d1ab99a19b5b2256b1f8fae4d614720 Signed-off-by: Adrien Ollier Reviewed-on: https://gerrit.libreoffice.org/72327 Reviewed-by: Tomaž Vajngerl Tested-by: Tomaž Vajngerl diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx index 52b5602d69b0..e23e3552fe0c 100644 --- a/include/vcl/outdev.hxx +++ b/include/vcl/outdev.hxx @@ -666,6 +666,7 @@ public: protected: virtual voidInitClipRegion(); +virtual voidClipRegionIntersectRectangle(vcl::Region&); virtual voidClipToPaintRegion( tools::Rectangle& rDstRect ); private: diff --git a/include/vcl/print.hxx b/include/vcl/print.hxx index be077d8017f9..6210acb5bac1 100644 --- a/include/vcl/print.hxx +++ b/include/vcl/print.hxx @@ -233,6 +233,7 @@ protected: const tools::PolyPolygon &rPolyPoly ) override; voidScaleBitmap ( Bitmap&, SalTwoRect& ) override { }; +voidClipRegionIntersectRectangle(vcl::Region&) override; public: voidDrawGradientEx( OutputDevice* pOut, const tools::Rectangle& rRect, diff --git a/vcl/source/gdi/pdfwriter_impl.hxx b/vcl/source/gdi/pdfwriter_impl.hxx index b5a0f5ff87e1..b615ac24feb9 100644 --- a/vcl/source/gdi/pdfwriter_impl.hxx +++ b/vcl/source/gdi/pdfwriter_impl.hxx @@ -595,6 +595,7 @@ public: protected: void ImplClearFontData(bool bNewFontLists) override; +void ClipRegionIntersectRectangle(vcl::Region&) override; private: MapMode m_aMapMode; // PDFWriterImpl scaled units diff --git a/vcl/source/gdi/pdfwriter_impl2.cxx b/vcl/source/gdi/pdfwriter_impl2.cxx index 5db8a6b1677c..a1bc6472fbfd 100644 --- a/vcl/source/gdi/pdfwriter_impl2.cxx +++ b/vcl/source/gdi/pdfwriter_impl2.cxx @@ -2025,4 +2025,6 @@ void PDFWriterImpl::ImplClearFontData(bool bNewFontLists) } } +void PDFWriterImpl::ClipRegionIntersectRectangle(vcl::Region&) {} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/gdi/print.cxx b/vcl/source/gdi/print.cxx index ed6be53ecd87..8678dc1986b2 100644 --- a/vcl/source/gdi/print.cxx +++ b/vcl/source/gdi/print.cxx @@ -1669,6 +1669,8 @@ void Printer::SetFontOrientation( LogicalFontInstance* const pFontEntry ) const pFontEntry->mnOrientation = pFontEntry->mxFontMetric->GetOrientation(); } +void Printer::ClipRegionIntersectRectangle(vcl::Region&) {} + Bitmap Printer::GetBitmap( const Point& rSrcPt, const Size& rSize ) const { SAL_WARN("vcl.gdi", "GetBitmap(): This should never be called on by a Printer instance"); diff --git a/vcl/source/outdev/clipping.cxx b/vcl/source/outdev/clipping.cxx index 3503b9555970..6e3fa877bc4b 100644 --- a/vcl/source/outdev/clipping.cxx +++ b/vcl/source/outdev/clipping.cxx @@ -154,18 +154,7 @@ void OutputDevice::InitClipRegion() // #102532# Respect output offset also for clip region vcl::Region aRegion( ImplPixelToDevicePixel( maRegion ) ); -const bool bClipDeviceBounds((OUTDEV_PDF != GetOutDevType()) - && (OUTDEV_PRINTER != GetOutDevType())); -if( bClipDeviceBounds ) -{ -// Perform actual rect clip against outdev -// dimensions, to generate empty clips whenever one of the -// values is completely off the device. -tools::Rectangle aDeviceBounds( mnOutOffX, mnOutOffY, - mnOutOffX+GetOutputWidthPixel()-1, - mnOutOffY+GetOutputHeightPixel()-1 ); -aRegion.Intersect( aDeviceBounds ); -} +ClipRegionIntersectRectangle(aRegion); if ( aRegion.IsEmpty() ) { @@ -194,6 +183,17 @@ void OutputDevice::InitClipRegion() mbInitClipRegion = false; } +void OutputDevice::ClipRegionIntersectRectangle(vcl::Region& rRegion) +{ +// Perform actual rect clip against outdev dimensions, +// to generate empty clips whenever one of the values is completely off the device. +rRegion.Intersect(tools::Rectangle{mnOutOffX, + mnOutOffY, + mnOutOffX + GetOutputWidthPixel() - 1, +
[Libreoffice-commits] core.git: include/vcl vcl/source
include/vcl/outdev.hxx |5 - include/vcl/window.hxx |2 ++ vcl/source/gdi/pdfwriter_impl.hxx |3 +++ vcl/source/gdi/pdfwriter_impl2.cxx | 10 ++ vcl/source/outdev/font.cxx | 17 - vcl/source/outdev/outdev.cxx |4 vcl/source/window/window3.cxx |7 +++ 7 files changed, 30 insertions(+), 18 deletions(-) New commits: commit 19057bca87abf09ec6701c1d28084faa24ba9c3f Author: Adrien Ollier AuthorDate: Thu May 9 19:41:35 2019 +0200 Commit: Tomaž Vajngerl CommitDate: Mon Jul 1 02:01:35 2019 +0200 tdf#74702 partial cleanup of OutDevType makes OutputDevice::ImplClearFontData clean Change-Id: Iee0683bd4567f85e20d5017b8eaa8a46490678db Signed-off-by: Adrien Ollier Reviewed-on: https://gerrit.libreoffice.org/72084 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx index 15491e8d2807..52b5602d69b0 100644 --- a/include/vcl/outdev.hxx +++ b/include/vcl/outdev.hxx @@ -1274,13 +1274,16 @@ protected: virtual voidSetFontOrientation( LogicalFontInstance* const pFontInstance ) const; virtual longGetFontExtLeading() const; +virtual void ImplClearFontData(bool bNewFontLists); +void ReleaseFontCache(); +void ReleaseFontCollection(); + private: typedef void ( OutputDevice::* FontUpdateHandler_t )( bool ); SAL_DLLPRIVATE bool ImplNewFont() const; -SAL_DLLPRIVATE void ImplClearFontData( bool bNewFontLists ); SAL_DLLPRIVATE void ImplRefreshFontData( bool bNewFontLists ); SAL_DLLPRIVATE static void ImplUpdateFontDataForAllFrames( FontUpdateHandler_t pHdl, bool bNewFontLists ); diff --git a/include/vcl/window.hxx b/include/vcl/window.hxx index 3b28f9a503a0..433ace0b73c9 100644 --- a/include/vcl/window.hxx +++ b/include/vcl/window.hxx @@ -741,6 +741,8 @@ protected: virtual voidInitClipRegion() override; +void ImplClearFontData(bool bNewFontLists) override; + // FIXME: this is a hack to workaround missing layout functionality SAL_DLLPRIVATE void ImplAdjustNWFSizes(); diff --git a/vcl/source/gdi/pdfwriter_impl.hxx b/vcl/source/gdi/pdfwriter_impl.hxx index 923454d424be..b5a0f5ff87e1 100644 --- a/vcl/source/gdi/pdfwriter_impl.hxx +++ b/vcl/source/gdi/pdfwriter_impl.hxx @@ -593,6 +593,9 @@ public: static void convertLineInfoToExtLineInfo( const LineInfo& rIn, PDFWriter::ExtLineInfo& rOut ); +protected: +void ImplClearFontData(bool bNewFontLists) override; + private: MapMode m_aMapMode; // PDFWriterImpl scaled units std::vector< PDFPage > m_aPages; diff --git a/vcl/source/gdi/pdfwriter_impl2.cxx b/vcl/source/gdi/pdfwriter_impl2.cxx index 5e5c0e5fbf6a..5db8a6b1677c 100644 --- a/vcl/source/gdi/pdfwriter_impl2.cxx +++ b/vcl/source/gdi/pdfwriter_impl2.cxx @@ -2015,4 +2015,14 @@ static bool lcl_canUsePDFAxialShading(const Gradient& rGradient) { return rGradient.GetSteps() <= 0; } +void PDFWriterImpl::ImplClearFontData(bool bNewFontLists) +{ +VirtualDevice::ImplClearFontData(bNewFontLists); +if (bNewFontLists && AcquireGraphics()) +{ +ReleaseFontCollection(); +ReleaseFontCache(); +} +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/outdev/font.cxx b/vcl/source/outdev/font.cxx index 22fd7b4e0d9c..0467f2f7c1ae 100644 --- a/vcl/source/outdev/font.cxx +++ b/vcl/source/outdev/font.cxx @@ -513,23 +513,6 @@ void OutputDevice::ImplClearFontData( const bool bNewFontLists ) { if (mxFontCollection && mxFontCollection != pSVData->maGDIData.mxScreenFontList) mxFontCollection->Clear(); - -if (GetOutDevType() == OUTDEV_PDF) -{ -mxFontCollection.reset(); -mxFontCache.reset(); -} -} - -// also update child windows if needed -if ( GetOutDevType() == OUTDEV_WINDOW ) -{ -vcl::Window* pChild = static_cast(this)->mpWindowImpl->mpFirstChild; -while ( pChild ) -{ -pChild->ImplClearFontData( true ); -pChild = pChild->mpWindowImpl->mpNext; -} } } diff --git a/vcl/source/outdev/outdev.cxx b/vcl/source/outdev/outdev.cxx index ef512a80d6e4..a7fa60287a29 100644 --- a/vcl/source/outdev/outdev.cxx +++ b/vcl/source/outdev/outdev.cxx @@ -729,4 +729,8 @@ bool OutputDevice::DrawEPS( const Point& rPoint, const Size& rSize, return bDrawn; } +void OutputDevice::ReleaseFontCache() { mxFontCache.reset(); } + +void OutputDevice::ReleaseFontCollection() { mxFontCollection.reset(); } + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/window/window3.cxx b/vcl/source/window/window3.cxx index 283aee05918e..492839f05415 100644 --- a/vcl/source/window/window3.cxx +++ b/vcl/source/
[Libreoffice-commits] core.git: include/vcl vcl/source
include/vcl/outdev.hxx |5 + include/vcl/virdev.hxx |2 ++ vcl/source/gdi/virdev.cxx|5 + vcl/source/outdev/outdev.cxx |5 + 4 files changed, 13 insertions(+), 4 deletions(-) New commits: commit 01813e6e86709c929f5e545ba206224f0bb25e5f Author: Adrien Ollier AuthorDate: Mon May 6 18:59:13 2019 +0200 Commit: Noel Grandin CommitDate: Mon Jun 10 10:56:52 2019 +0200 tdf#74702 partial cleanup of OutDevType VirtualDevice and children are virtual, others not. Change-Id: I9ef7f4d13b26e554b000b2b51216fbdbc6892b08 Signed-off-by: Adrien Ollier Reviewed-on: https://gerrit.libreoffice.org/71875 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx index 8f8c009fa291..fc52c7890b48 100644 --- a/include/vcl/outdev.hxx +++ b/include/vcl/outdev.hxx @@ -520,10 +520,7 @@ public: } OutDevType GetOutDevType() const { return meOutDevType; } -bool IsVirtual() const -{ -return (meOutDevType == OUTDEV_VIRDEV) || (meOutDevType == OUTDEV_PDF); -} +virtual bool IsVirtual() const; /** Query an OutputDevice to see whether it supports a specific operation diff --git a/include/vcl/virdev.hxx b/include/vcl/virdev.hxx index 7e9ba25dfca1..2ae778eb73ba 100644 --- a/include/vcl/virdev.hxx +++ b/include/vcl/virdev.hxx @@ -170,6 +170,8 @@ public: virtual sal_uInt16 GetBitCount() const override; +bool IsVirtual() const override; + private: SAL_DLLPRIVATE void ImplSetReferenceDevice( RefDevMode, sal_Int32 i_nDPIX, sal_Int32 i_nDPIY ); diff --git a/vcl/source/gdi/virdev.cxx b/vcl/source/gdi/virdev.cxx index 4463ad1ac8b9..ed6123ce2055 100644 --- a/vcl/source/gdi/virdev.cxx +++ b/vcl/source/gdi/virdev.cxx @@ -443,6 +443,11 @@ void VirtualDevice::SetReferenceDevice( sal_Int32 i_nDPIX, sal_Int32 i_nDPIY ) ImplSetReferenceDevice( RefDevMode::Custom, i_nDPIX, i_nDPIY ); } +bool VirtualDevice::IsVirtual() const +{ +return true; +} + void VirtualDevice::ImplSetReferenceDevice( RefDevMode i_eRefDevMode, sal_Int32 i_nDPIX, sal_Int32 i_nDPIY ) { mnDPIX = i_nDPIX; diff --git a/vcl/source/outdev/outdev.cxx b/vcl/source/outdev/outdev.cxx index 65db4d0a51ef..ef512a80d6e4 100644 --- a/vcl/source/outdev/outdev.cxx +++ b/vcl/source/outdev/outdev.cxx @@ -189,6 +189,11 @@ void OutputDevice::dispose() VclReferenceBase::dispose(); } +bool OutputDevice::IsVirtual() const +{ +return false; +} + SalGraphics* OutputDevice::GetGraphics() { DBG_TESTSOLARMUTEX(); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: vcl/source
vcl/source/animate/Animation.cxx |9 ++--- 1 file changed, 6 insertions(+), 3 deletions(-) New commits: commit 865371a35d7f9d9fac08e9e75ac3c9c173144746 Author: Adrien Ollier AuthorDate: Sat May 4 09:19:31 2019 +0200 Commit: Tomaž Vajngerl CommitDate: Thu May 9 07:07:56 2019 +0200 replaces one macro by a constant in the C++ style Change-Id: I4b4fc85024d64f94197bd0fd25ed8ba0ada004ba Signed-off-by: Adrien Ollier Reviewed-on: https://gerrit.libreoffice.org/71807 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl diff --git a/vcl/source/animate/Animation.cxx b/vcl/source/animate/Animation.cxx index 7885343b7fa8..37af008d036e 100644 --- a/vcl/source/animate/Animation.cxx +++ b/vcl/source/animate/Animation.cxx @@ -31,8 +31,6 @@ #include -#define MIN_TIMEOUT 2 - sal_uLong Animation::mnAnimCount = 0; Animation::Animation() @@ -268,9 +266,14 @@ void Animation::Draw(OutputDevice* pOut, const Point& rDestPt, const Size& rDest } } +namespace +{ +constexpr sal_uLong constMinTimeout = 2; +} + void Animation::ImplRestartTimer(sal_uLong nTimeout) { -maTimer.SetTimeout(std::max(nTimeout, static_cast(MIN_TIMEOUT)) * 10); +maTimer.SetTimeout(std::max(nTimeout, constMinTimeout) * 10); maTimer.Start(); } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: vcl/source
vcl/source/animate/Animation.cxx | 15 --- 1 file changed, 8 insertions(+), 7 deletions(-) New commits: commit c1f04103a0bbe93a4c67cde50dda7a8eae2f955f Author: Adrien Ollier AuthorDate: Mon May 6 22:58:27 2019 +0200 Commit: Julien Nabet CommitDate: Tue May 7 10:24:50 2019 +0200 inverts the tests for performance optimization Change-Id: Ib65ec7fd957ab19c703d31da9eb74390126d2d04 Signed-off-by: Adrien Ollier Reviewed-on: https://gerrit.libreoffice.org/71881 Tested-by: Jenkins Reviewed-by: Julien Nabet diff --git a/vcl/source/animate/Animation.cxx b/vcl/source/animate/Animation.cxx index 3aeeadc649a8..7885343b7fa8 100644 --- a/vcl/source/animate/Animation.cxx +++ b/vcl/source/animate/Animation.cxx @@ -115,13 +115,14 @@ bool Animation::IsTransparent() const // as the application (?) does not invalidate on non-transparent // graphics due to performance reasons. -return std::any_of(maList.begin(), maList.end(), - [&aRect](const std::unique_ptr& pAnim) -> bool { - return pAnim->meDisposal == Disposal::Back - && tools::Rectangle{ pAnim->maPositionPixel, pAnim->maSizePixel } - != aRect; - }) - || maBitmapEx.IsTransparent(); +return maBitmapEx.IsTransparent() + || std::any_of(maList.begin(), maList.end(), + [&aRect](const std::unique_ptr& pAnim) -> bool { + return pAnim->meDisposal == Disposal::Back + && tools::Rectangle{ pAnim->maPositionPixel, + pAnim->maSizePixel } +!= aRect; + }); } sal_uLong Animation::GetSizeBytes() const ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: editeng/source
editeng/source/editeng/editobj.cxx |3 +-- editeng/source/editeng/editobj2.hxx |8 +++- 2 files changed, 4 insertions(+), 7 deletions(-) New commits: commit 0e791f4e59f0288081375d26d281a5aef41b628d Author: Adrien Ollier AuthorDate: Wed Apr 24 04:18:09 2019 +0200 Commit: Stephan Bergmann CommitDate: Tue May 7 08:28:43 2019 +0200 tdf#74702 partial cleanup of OutDevType XParaPortionList::RefDevIsVirtual() does not depend on eRefDevType Change-Id: I22182bbe26502552125d24aa1a8c33ffb5a38971 Signed-off-by: Adrien Ollier Reviewed-on: https://gerrit.libreoffice.org/71649 Tested-by: Jenkins Reviewed-by: Stephan Bergmann diff --git a/editeng/source/editeng/editobj.cxx b/editeng/source/editeng/editobj.cxx index c33d17d62ee8..dd4b710f3ef4 100644 --- a/editeng/source/editeng/editobj.cxx +++ b/editeng/source/editeng/editobj.cxx @@ -91,8 +91,7 @@ void XEditAttribute::SetItem(const SfxPoolItem& rNew) XParaPortionList::XParaPortionList( OutputDevice* pRefDev, sal_uLong nPW, sal_uInt16 _nStretchX, sal_uInt16 _nStretchY) -: nRefDevPtr(pRefDev) -, eRefDevType(pRefDev->GetOutDevType()) +: pRefDevPtr(pRefDev) , aRefMapMode(pRefDev->GetMapMode()) , nStretchX(_nStretchX) , nStretchY(_nStretchY) diff --git a/editeng/source/editeng/editobj2.hxx b/editeng/source/editeng/editobj2.hxx index 24c399db53a1..c833e4b57d99 100644 --- a/editeng/source/editeng/editobj2.hxx +++ b/editeng/source/editeng/editobj2.hxx @@ -96,8 +96,7 @@ class XParaPortionList typedef std::vector > ListType; ListType maList; -VclPtr nRefDevPtr; -OutDevType eRefDevType; +VclPtr pRefDevPtr; MapMode aRefMapMode; sal_uInt16 nStretchX; sal_uInt16 nStretchY; @@ -109,10 +108,9 @@ public: void push_back(XParaPortion* p); const XParaPortion& operator[](size_t i) const; -OutputDevice* GetRefDevPtr() const{ return nRefDevPtr; } +OutputDevice* GetRefDevPtr() const{ return pRefDevPtr; } sal_uLong GetPaperWidth() const { return nPaperWidth; } -bool RefDevIsVirtual() const -{ return (eRefDevType == OUTDEV_VIRDEV) || (eRefDevType == OUTDEV_PDF); } +boolRefDevIsVirtual() const {return pRefDevPtr->IsVirtual();} const MapMode& GetRefMapMode() const { return aRefMapMode; } sal_uInt16 GetStretchX() const { return nStretchX; } sal_uInt16 GetStretchY() const { return nStretchY; } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: vcl/source
vcl/source/animate/Animation.cxx | 15 +-- 1 file changed, 5 insertions(+), 10 deletions(-) New commits: commit 007d6b5b9e7c94ab93b2798f832467c26291cf31 Author: Adrien Ollier AuthorDate: Sun May 5 01:06:41 2019 +0200 Commit: Noel Grandin CommitDate: Sun May 5 08:03:30 2019 +0200 using STL and lambda expressions is better Change-Id: I0224dccb130ead02da46f2376b3df5ec889f8e8c Signed-off-by: Adrien Ollier Reviewed-on: https://gerrit.libreoffice.org/71812 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/vcl/source/animate/Animation.cxx b/vcl/source/animate/Animation.cxx index 9462d0e75a74..1382178aa6a0 100644 --- a/vcl/source/animate/Animation.cxx +++ b/vcl/source/animate/Animation.cxx @@ -229,16 +229,11 @@ bool Animation::Start(OutputDevice* pOut, const Point& rDestPt, const Size& rDes void Animation::Stop(OutputDevice* pOut, long nExtraData) { -for (size_t i = 0; i < maViewList.size();) -{ -ImplAnimView* pView = maViewList[i].get(); -if (pView->matches(pOut, nExtraData)) -{ -maViewList.erase(maViewList.begin() + i); -} -else -i++; -} +maViewList.erase(std::remove_if(maViewList.begin(), maViewList.end(), +[=](const std::unique_ptr& pAnimView) -> bool { +return pAnimView->matches(pOut, nExtraData); +}), + maViewList.end()); if (maViewList.empty()) { ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: vcl/source
vcl/source/animate/Animation.cxx |9 +++-- 1 file changed, 7 insertions(+), 2 deletions(-) New commits: commit 27434647540b2bd3f30139983a3d5f7da9b77a44 Author: Adrien Ollier AuthorDate: Wed May 1 23:11:12 2019 +0200 Commit: Mike Kaganski CommitDate: Fri May 3 20:38:49 2019 +0200 rewritting in a more conventional way - mnPos is modified only if mbLoopTerminated is true - using new and delete operators is less efficient than building an object on the stack - skipping a line makes instructions clearer Change-Id: I9bec0cf02a581c1e0033880fcad83f17e83ea3f2 Signed-off-by: Adrien Ollier Reviewed-on: https://gerrit.libreoffice.org/71652 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/vcl/source/animate/Animation.cxx b/vcl/source/animate/Animation.cxx index bb3935a41c78..9462d0e75a74 100644 --- a/vcl/source/animate/Animation.cxx +++ b/vcl/source/animate/Animation.cxx @@ -267,8 +267,13 @@ void Animation::Draw(OutputDevice* pOut, const Point& rDestPt, const Size& rDest else { const size_t nOldPos = mnPos; -const_cast(this)->mnPos = mbLoopTerminated ? (nCount - 1) : mnPos; -delete new ImplAnimView(const_cast(this), pOut, rDestPt, rDestSz, 0); +if (mbLoopTerminated) +const_cast(this)->mnPos = nCount - 1; + +{ +ImplAnimView{ const_cast(this), pOut, rDestPt, rDestSz, 0 }; +} + const_cast(this)->mnPos = nOldPos; } } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: vcl/source
vcl/source/animate/Animation.cxx | 26 +++--- 1 file changed, 7 insertions(+), 19 deletions(-) New commits: commit 69bf59d63d4d2708a7840ff1ffad821a032c90fc Author: Adrien Ollier AuthorDate: Wed May 1 23:05:53 2019 +0200 Commit: Mike Kaganski CommitDate: Fri May 3 20:36:20 2019 +0200 makes implementation of Animation::operator =(const Animation&) concise Using the logical AND, we can evaluate all the expressions from left to right into a single and condensed expression. Change-Id: I973061dcd34322c29565a478bf9b7ba757965231 Signed-off-by: Adrien Ollier Reviewed-on: https://gerrit.libreoffice.org/71651 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/vcl/source/animate/Animation.cxx b/vcl/source/animate/Animation.cxx index c4c15584b050..bb3935a41c78 100644 --- a/vcl/source/animate/Animation.cxx +++ b/vcl/source/animate/Animation.cxx @@ -86,25 +86,13 @@ Animation& Animation::operator=(const Animation& rAnimation) bool Animation::operator==(const Animation& rAnimation) const { -const size_t nCount = maList.size(); -bool bRet = false; - -if (rAnimation.maList.size() == nCount && rAnimation.maBitmapEx == maBitmapEx -&& rAnimation.maGlobalSize == maGlobalSize) -{ -bRet = true; - -for (size_t n = 0; n < nCount; n++) -{ -if ((*maList[n]) != (*rAnimation.maList[n])) -{ -bRet = false; -break; -} -} -} - -return bRet; +return maList.size() == rAnimation.maList.size() && maBitmapEx == rAnimation.maBitmapEx + && maGlobalSize == rAnimation.maGlobalSize + && std::equal(maList.begin(), maList.end(), rAnimation.maList.begin(), + [](const std::unique_ptr& pAnim1, +const std::unique_ptr& pAnim2) -> bool { + return *pAnim1 == *pAnim2; + }); } void Animation::Clear() ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits