include/vcl/outdev.hxx | 3 +++ include/vcl/print.hxx | 6 ++++++ vcl/source/gdi/graph.cxx | 19 +------------------ vcl/source/outdev/rect.cxx | 19 +++++++++++++++++++ 4 files changed, 29 insertions(+), 18 deletions(-)
New commits: commit f4b4b27af975504fd9b85451eaa333e75b580305 Author: Chris Sherlock <chris.sherloc...@gmail.com> AuthorDate: Sat May 23 23:41:50 2020 +1000 Commit: Mike Kaganski <mike.kagan...@collabora.com> CommitDate: Fri Jun 19 21:20:34 2020 +0200 tdf#74702 vcl: extract DrawBorder() Change-Id: Iba9cc10daa1b6b0ab7097145a3f40832d2165435 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94721 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com> diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx index 86c18f06782e..8c258a48f790 100644 --- a/include/vcl/outdev.hxx +++ b/include/vcl/outdev.hxx @@ -699,6 +699,9 @@ private: SAL_DLLPRIVATE void SetDeviceClipRegion( const vcl::Region* pRegion ); ///@} +public: + virtual void DrawBorder(tools::Rectangle aBorderRect); + /** @name Pixel functions */ diff --git a/include/vcl/print.hxx b/include/vcl/print.hxx index e17e5e1dcc6d..8c91df7d8ec8 100644 --- a/include/vcl/print.hxx +++ b/include/vcl/print.hxx @@ -237,6 +237,12 @@ public: bool IsScreenComp() const override { return false; } + void DrawBorder(tools::Rectangle aBorderRect) override + { + SetLineColor(COL_BLACK); + DrawRect(aBorderRect); + } + protected: virtual void DrawDeviceMask( const Bitmap& rMask, const Color& rMaskColor, const Point& rDestPt, const Size& rDestSize, diff --git a/vcl/source/gdi/graph.cxx b/vcl/source/gdi/graph.cxx index 4c635b454fd3..05ad9657d8d9 100644 --- a/vcl/source/gdi/graph.cxx +++ b/vcl/source/gdi/graph.cxx @@ -50,24 +50,7 @@ void ImplDrawDefault( OutputDevice* pOutDev, const OUString* pText, pOutDev->SetFillColor(); // On the printer a black rectangle and on the screen one with 3D effect - if ( pOutDev->GetOutDevType() == OUTDEV_PRINTER ) - pOutDev->SetLineColor( COL_BLACK ); - else - { - aBorderRect.AdjustLeft(nPixel ); - aBorderRect.AdjustTop(nPixel ); - - pOutDev->SetLineColor( COL_LIGHTGRAY ); - pOutDev->DrawRect( aBorderRect ); - - aBorderRect.AdjustLeft( -nPixel ); - aBorderRect.AdjustTop( -nPixel ); - aBorderRect.AdjustRight( -nPixel ); - aBorderRect.AdjustBottom( -nPixel ); - pOutDev->SetLineColor( COL_GRAY ); - } - - pOutDev->DrawRect( aBorderRect ); + pOutDev->DrawBorder(aBorderRect); aPoint.AdjustX(nPixelWidth + 2*nPixel ); aPoint.AdjustY(nPixelWidth + 2*nPixel ); diff --git a/vcl/source/outdev/rect.cxx b/vcl/source/outdev/rect.cxx index ecbeb12fbfee..2d8fe4524155 100644 --- a/vcl/source/outdev/rect.cxx +++ b/vcl/source/outdev/rect.cxx @@ -29,6 +29,25 @@ #include <salgdi.hxx> +void OutputDevice::DrawBorder(tools::Rectangle aBorderRect) +{ + sal_uInt16 nPixel = static_cast<sal_uInt16>(PixelToLogic(Size(1, 1)).Width()); + + aBorderRect.AdjustLeft(nPixel); + aBorderRect.AdjustTop(nPixel); + + SetLineColor(COL_LIGHTGRAY); + DrawRect(aBorderRect); + + aBorderRect.AdjustLeft(-nPixel); + aBorderRect.AdjustTop(-nPixel); + aBorderRect.AdjustRight(-nPixel); + aBorderRect.AdjustBottom(-nPixel); + SetLineColor(COL_GRAY); + + DrawRect(aBorderRect); +} + void OutputDevice::DrawRect( const tools::Rectangle& rRect ) { assert(!is_double_buffered_window()); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits