diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2015-05-18 10:42:48 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2015-05-18 10:42:48 +0200 |
commit | f457f9b985a8b5d4fcaae0e524d35c6bcc30a0c5 (patch) | |
tree | b396cee0a3577f4f337d0ae5e6d4e6878877876c /extensions | |
parent | 4257f4db06f6dd7c35281a89f5aafebe9c2ccb0b (diff) |
loplugin:staticmethods
Change-Id: I11dfc42c11c4a689e4bde6f511751e5fb89471ca
Diffstat (limited to 'extensions')
-rw-r--r-- | extensions/source/scanner/sanedlg.cxx | 57 |
1 files changed, 30 insertions, 27 deletions
diff --git a/extensions/source/scanner/sanedlg.cxx b/extensions/source/scanner/sanedlg.cxx index 3d743a3ca6bd..0aee63fdc57d 100644 --- a/extensions/source/scanner/sanedlg.cxx +++ b/extensions/source/scanner/sanedlg.cxx @@ -34,6 +34,36 @@ #define PREVIEW_WIDTH 113 #define PREVIEW_HEIGHT 160 +#define RECT_SIZE_PIX 7 + +namespace { + +void DrawRectangles(vcl::RenderContext& rRenderContext, Point& rUL, Point& rBR) +{ + int nMiddleX, nMiddleY; + Point aBL, aUR; + + aUR = Point(rBR.X(), rUL.Y()); + aBL = Point(rUL.X(), rBR.Y()); + nMiddleX = (rBR.X() - rUL.X()) / 2 + rUL.X(); + nMiddleY = (rBR.Y() - rUL.Y()) / 2 + rUL.Y(); + + rRenderContext.DrawLine(rUL, aBL); + rRenderContext.DrawLine(aBL, rBR); + rRenderContext.DrawLine(rBR, aUR); + rRenderContext.DrawLine(aUR, rUL); + rRenderContext.DrawRect(Rectangle(rUL, Size(RECT_SIZE_PIX,RECT_SIZE_PIX))); + rRenderContext.DrawRect(Rectangle(aBL, Size(RECT_SIZE_PIX, -RECT_SIZE_PIX))); + rRenderContext.DrawRect(Rectangle(rBR, Size(-RECT_SIZE_PIX, -RECT_SIZE_PIX))); + rRenderContext.DrawRect(Rectangle(aUR, Size(-RECT_SIZE_PIX, RECT_SIZE_PIX ))); + rRenderContext.DrawRect(Rectangle(Point(nMiddleX - RECT_SIZE_PIX / 2, rUL.Y()), Size(RECT_SIZE_PIX, RECT_SIZE_PIX))); + rRenderContext.DrawRect(Rectangle(Point(nMiddleX - RECT_SIZE_PIX / 2, rBR.Y()), Size(RECT_SIZE_PIX, -RECT_SIZE_PIX))); + rRenderContext.DrawRect(Rectangle(Point(rUL.X(), nMiddleY - RECT_SIZE_PIX / 2), Size(RECT_SIZE_PIX, RECT_SIZE_PIX))); + rRenderContext.DrawRect(Rectangle(Point(rBR.X(), nMiddleY - RECT_SIZE_PIX / 2), Size(-RECT_SIZE_PIX, RECT_SIZE_PIX))); +} + +} + class ScanPreview : public vcl::Window { private: @@ -50,7 +80,6 @@ private: bool mbDragDrawn; bool mbIsDragging; - void DrawRectangles(vcl::RenderContext& rRenderContext, Point& rUL, Point& rBR); public: ScanPreview(vcl::Window* pParent, WinBits nStyle) : Window(pParent, nStyle) @@ -1074,8 +1103,6 @@ void SaneDlg::EstablishButtonOption() mpButtonOption->Show( true ); } -#define RECT_SIZE_PIX 7 - void ScanPreview::MouseMove(const MouseEvent& rMEvt) { if( mbIsDragging ) @@ -1217,30 +1244,6 @@ void ScanPreview::MouseButtonUp( const MouseEvent& rMEvt ) Window::MouseButtonUp( rMEvt ); } -void ScanPreview::DrawRectangles(vcl::RenderContext& rRenderContext, Point& rUL, Point& rBR) -{ - int nMiddleX, nMiddleY; - Point aBL, aUR; - - aUR = Point(rBR.X(), rUL.Y()); - aBL = Point(rUL.X(), rBR.Y()); - nMiddleX = (rBR.X() - rUL.X()) / 2 + rUL.X(); - nMiddleY = (rBR.Y() - rUL.Y()) / 2 + rUL.Y(); - - rRenderContext.DrawLine(rUL, aBL); - rRenderContext.DrawLine(aBL, rBR); - rRenderContext.DrawLine(rBR, aUR); - rRenderContext.DrawLine(aUR, rUL); - rRenderContext.DrawRect(Rectangle(rUL, Size(RECT_SIZE_PIX,RECT_SIZE_PIX))); - rRenderContext.DrawRect(Rectangle(aBL, Size(RECT_SIZE_PIX, -RECT_SIZE_PIX))); - rRenderContext.DrawRect(Rectangle(rBR, Size(-RECT_SIZE_PIX, -RECT_SIZE_PIX))); - rRenderContext.DrawRect(Rectangle(aUR, Size(-RECT_SIZE_PIX, RECT_SIZE_PIX ))); - rRenderContext.DrawRect(Rectangle(Point(nMiddleX - RECT_SIZE_PIX / 2, rUL.Y()), Size(RECT_SIZE_PIX, RECT_SIZE_PIX))); - rRenderContext.DrawRect(Rectangle(Point(nMiddleX - RECT_SIZE_PIX / 2, rBR.Y()), Size(RECT_SIZE_PIX, -RECT_SIZE_PIX))); - rRenderContext.DrawRect(Rectangle(Point(rUL.X(), nMiddleY - RECT_SIZE_PIX / 2), Size(RECT_SIZE_PIX, RECT_SIZE_PIX))); - rRenderContext.DrawRect(Rectangle(Point(rBR.X(), nMiddleY - RECT_SIZE_PIX / 2), Size(-RECT_SIZE_PIX, RECT_SIZE_PIX))); -} - void ScanPreview::DrawDrag(vcl::RenderContext& rRenderContext) { static Point aLastUL, aLastBR; |