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 <[email protected]> AuthorDate: Tue May 14 19:51:24 2019 +0200 Commit: Tomaž Vajngerl <[email protected]> CommitDate: Mon Jul 1 02:03:55 2019 +0200 tdf#74702: cleans OutputDevice::InitClipRegion up Change-Id: I2d6e35c68d1ab99a19b5b2256b1f8fae4d614720 Signed-off-by: Adrien Ollier <[email protected]> Reviewed-on: https://gerrit.libreoffice.org/72327 Reviewed-by: Tomaž Vajngerl <[email protected]> Tested-by: Tomaž Vajngerl <[email protected]> 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 void InitClipRegion(); + virtual void ClipRegionIntersectRectangle(vcl::Region&); virtual void ClipToPaintRegion ( 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; void ScaleBitmap ( Bitmap&, SalTwoRect& ) override { }; + void ClipRegionIntersectRectangle(vcl::Region&) override; public: void DrawGradientEx( 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, + mnOutOffY + GetOutputHeightPixel() - 1 + }); +} + vcl::Region OutputDevice::GetActiveClipRegion() const { return GetClipRegion(); _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
