summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott Moreau <oreaus@gmail.com>2010-02-22 10:40:01 -0700
committerScott Moreau <oreaus@gmail.com>2010-02-22 11:06:09 -0700
commit3f6c5425d108bcd8684c2d13ae7f6f55a991bec9 (patch)
tree87b63bd5b1a993a859937de14c3cfdd233973bce
parentdb87069dab2edec369a1c347e4b9f382c26289ec (diff)
downloadcompiz-core-doc-3f6c5425d108bcd8684c2d13ae7f6f55a991bec9.tar.gz
compiz-core-doc-3f6c5425d108bcd8684c2d13ae7f6f55a991bec9.tar.bz2
Make corners of rectangles square while dragging.
-rw-r--r--plugins/annotate/src/annotate.cpp28
1 files changed, 15 insertions, 13 deletions
diff --git a/plugins/annotate/src/annotate.cpp b/plugins/annotate/src/annotate.cpp
index ecbc888..b418a12 100644
--- a/plugins/annotate/src/annotate.cpp
+++ b/plugins/annotate/src/annotate.cpp
@@ -610,12 +610,12 @@ AnnoScreen::glPaintOutput (const GLScreenPaintAttrib &attrib,
if (status)
{
- CompRect rect;
- GLMatrix sTransform = transform;
- int numRect;
- int pos = 0;
- float vectorX, vectorY;
- int angle;
+ CompRect rect;
+ GLMatrix sTransform = transform;
+ int numRect;
+ int pos = 0;
+ float vectorX, vectorY, offset;
+ int angle;
/* This replaced prepareXCoords (s, output, -DEFAULT_Z_CAMERA) */
sTransform.toScreenSpace (output, -DEFAULT_Z_CAMERA);
@@ -686,13 +686,15 @@ AnnoScreen::glPaintOutput (const GLScreenPaintAttrib &attrib,
/* draw rectangle outline */
glColor4usv (optionGetStrokeColor ());
- glLineWidth (optionGetStrokeWidth ());
- glBegin (GL_LINE_LOOP);
- glVertex2i (rectangle.x1 (), rectangle.y1 ());
- glVertex2i (rectangle.x2 (), rectangle.y1 ());
- glVertex2i (rectangle.x2 (), rectangle.y2 ());
- glVertex2i (rectangle.x1 (), rectangle.y2 ());
- glEnd ();
+ offset = optionGetStrokeWidth () / 2;
+ glRecti (rectangle.x1 () - offset, rectangle.y2 (),
+ rectangle.x1 () + offset, rectangle.y1 ());
+ glRecti (rectangle.x2 () - offset, rectangle.y2 (),
+ rectangle.x2 () + offset, rectangle.y1 ());
+ glRecti (rectangle.x1 () - offset, rectangle.y1 () + offset,
+ rectangle.x2 () + offset, rectangle.y1 () - offset);
+ glRecti (rectangle.x1 () - offset, rectangle.y2 () + offset,
+ rectangle.x2 () + offset, rectangle.y2 () - offset);
break;
case EllipseMode: