summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Sherlock <chris.sherlock79@gmail.com>2020-05-23 23:41:50 +1000
committerMike Kaganski <mike.kaganski@collabora.com>2020-06-19 21:20:34 +0200
commitf4b4b27af975504fd9b85451eaa333e75b580305 (patch)
tree3630ea07ef93791f2381d75c02f207610dd2a850
parent327153471ae38abe90463f6272e00aaa996c5ba3 (diff)
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.kaganski@collabora.com>
-rw-r--r--include/vcl/outdev.hxx3
-rw-r--r--include/vcl/print.hxx6
-rw-r--r--vcl/source/gdi/graph.cxx19
-rw-r--r--vcl/source/outdev/rect.cxx19
4 files changed, 29 insertions, 18 deletions
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());