[Libreoffice-commits] core.git: extensions/source
Stephan Bergmann
sbergman at redhat.com
Mon May 18 01:43:22 PDT 2015
extensions/source/scanner/sanedlg.cxx | 57 +++++++++++++++++-----------------
1 file changed, 30 insertions(+), 27 deletions(-)
New commits:
commit f457f9b985a8b5d4fcaae0e524d35c6bcc30a0c5
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Mon May 18 10:42:48 2015 +0200
loplugin:staticmethods
Change-Id: I11dfc42c11c4a689e4bde6f511751e5fb89471ca
diff --git a/extensions/source/scanner/sanedlg.cxx b/extensions/source/scanner/sanedlg.cxx
index 3d743a3..0aee63f 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;
More information about the Libreoffice-commits
mailing list