796
StaticSwitchScreen::paintRect (CompRect &box,
796
StaticSwitchScreen::paintRect (const GLMatrix &transform,
798
799
unsigned short *color,
800
unsigned short opacity)
801
glColor4us (color[0], color[1], color[2], color[3] * opacity / 100);
802
glBegin (GL_LINE_LOOP);
803
glVertex2i (box.x1 () + offset, box.y1 () + offset);
804
glVertex2i (box.x2 () - offset, box.y1 () + offset);
805
glVertex2i (box.x2 () - offset, box.y2 () - offset);
806
glVertex2i (box.x1 () + offset, box.y2 () - offset);
802
GLushort colorData[4] = {
806
static_cast <GLushort> (color[3] * opacity / 100)
809
GLfloat vertexData[12] = {
810
static_cast <GLfloat> (box.x1 () + offset), static_cast <GLfloat> (box.y1 () + offset), 0,
811
static_cast <GLfloat> (box.x2 () - offset), static_cast <GLfloat> (box.y1 () + offset), 0,
812
static_cast <GLfloat> (box.x2 () - offset), static_cast <GLfloat> (box.y2 () - offset), 0,
813
static_cast <GLfloat> (box.x1 () + offset), static_cast <GLfloat> (box.y2 () - offset), 0
816
GLVertexBuffer *streamingBuffer = GLVertexBuffer::streamingBuffer ();
817
streamingBuffer->begin (GL_LINE_LOOP);
819
streamingBuffer->addColors (1, colorData);
820
streamingBuffer->addVertices (4, vertexData);
822
streamingBuffer->end ();
823
streamingBuffer->render (transform);
891
904
if (getPaintRectangle (w, box, &opacity))
893
906
unsigned short *color;
907
GLushort colorData[4];
908
GLfloat vertexData[12];
909
GLVertexBuffer *streamingBuffer = GLVertexBuffer::streamingBuffer ();
896
911
glEnable (GL_BLEND);
898
913
/* fill rectangle */
899
r = optionGetHighlightColorRed ();
900
g = optionGetHighlightColorGreen ();
901
b = optionGetHighlightColorBlue ();
902
a = optionGetHighlightColorAlpha ();
903
a = a * opacity / 100;
905
glColor4us (r, g, b, a);
906
glRecti (box.x1 (), box.y2 (), box.x2 (), box.y1 ());
914
colorData[0] = optionGetHighlightColorRed ();
915
colorData[1] = optionGetHighlightColorGreen ();
916
colorData[2] = optionGetHighlightColorBlue ();
917
colorData[3] = optionGetHighlightColorAlpha ();
918
colorData[3] = colorData[3] * opacity / 100;
920
vertexData[0] = box.x1 ();
921
vertexData[1] = box.y2 ();
922
vertexData[2] = 0.0f;
923
vertexData[3] = box.x1 ();
924
vertexData[4] = box.y1 ();
925
vertexData[5] = 0.0f;
926
vertexData[6] = box.x2 ();
927
vertexData[7] = box.y2 ();
928
vertexData[8] = 0.0f;
929
vertexData[9] = box.x2 ();
930
vertexData[10] = box.y1 ();
931
vertexData[11] = 0.0f;
933
streamingBuffer->begin (GL_TRIANGLE_STRIP);
934
streamingBuffer->addColors (1, colorData);
935
streamingBuffer->addVertices (4, vertexData);
936
streamingBuffer->end ();
937
streamingBuffer->render (sTransform);
908
939
/* draw outline */
909
940
glLineWidth (1.0);
910
glDisable (GL_LINE_SMOOTH);
912
942
color = optionGetHighlightBorderColor ();
913
paintRect (box, 0, color, opacity);
914
paintRect (box, 2, color, opacity);
943
paintRect (sTransform, box, 0, color, opacity);
944
paintRect (sTransform, box, 2, color, opacity);
915
945
color = optionGetHighlightBorderInlayColor ();
916
paintRect (box, 1, color, opacity);
946
paintRect (sTransform, box, 1, color, opacity);
919
glColor4usv (defaultColor);
920
948
glDisable (GL_BLEND);
981
StaticSwitchScreen::paintSelectionRect (int x,
1007
StaticSwitchScreen::paintSelectionRect (const GLMatrix &transform,
985
1012
unsigned int opacity)
1014
GLVertexBuffer *streamingBuffer = GLVertexBuffer::streamingBuffer ();
1015
GLushort colorData[4];
1016
GLfloat vertexData[18];
1017
GLMatrix sTransform (transform);
989
1020
int count = windows.size ();
1005
1036
for (unsigned int i = 0; i < 4; i++)
1006
color[i] = (float)fgColor[i] * opacity * op / 0xffffffff;
1037
colorData[i] = (float)fgColor[i] * opacity * op / 0xffff;
1010
glTranslatef (x + previewBorder / 2 + (dx * w),
1039
sTransform.translate (x + previewBorder / 2 + (dx * w),
1011
1040
y + previewBorder / 2 + (dy * h), 0.0f);
1014
glVertex2i (-1, -1);
1016
glVertex2i (w + 1, 1);
1017
glVertex2i (w + 1, -1);
1018
glVertex2i (-1, h - 1);
1019
glVertex2i (-1, h + 1);
1020
glVertex2i (w + 1, h + 1);
1021
glVertex2i (w + 1, h - 1);
1023
glVertex2i (-1, h - 1);
1024
glVertex2i (1, h - 1);
1026
glVertex2i (w - 1, 1);
1027
glVertex2i (w - 1, h - 1);
1028
glVertex2i (w + 1, h - 1);
1029
glVertex2i (w + 1, 1);
1033
glColor4usv (defaultColor);
1042
streamingBuffer->begin (GL_TRIANGLE_STRIP);
1050
vertexData[6] = w + 1;
1053
vertexData[9] = w + 1;
1057
streamingBuffer->addColors (1, colorData);
1058
streamingBuffer->addVertices (4, vertexData);
1060
streamingBuffer->end ();
1061
streamingBuffer->render (sTransform);
1064
streamingBuffer->begin (GL_TRIANGLE_STRIP);
1067
vertexData[1] = h - 1;
1070
vertexData[4] = h + 1;
1072
vertexData[6] = w + 1;
1073
vertexData[7] = h - 1;
1075
vertexData[9] = w + 1;
1076
vertexData[10] = h + 1;
1079
streamingBuffer->addColors (1, colorData);
1080
streamingBuffer->addVertices (4, vertexData);
1082
streamingBuffer->end ();
1083
streamingBuffer->render (sTransform);
1086
streamingBuffer->begin (GL_TRIANGLE_STRIP);
1092
vertexData[4] = h - 1;
1098
vertexData[10] = h - 1;
1101
streamingBuffer->addColors (1, colorData);
1102
streamingBuffer->addVertices (4, vertexData);
1104
streamingBuffer->end ();
1105
streamingBuffer->render (sTransform);
1108
streamingBuffer->begin (GL_TRIANGLE_STRIP);
1110
vertexData[0] = w - 1;
1113
vertexData[3] = w - 1;
1114
vertexData[4] = h - 1;
1116
vertexData[6] = w + 1;
1119
vertexData[9] = w + 1;
1120
vertexData[10] = h - 1;
1123
streamingBuffer->addColors (1, colorData);
1124
streamingBuffer->addVertices (4, vertexData);
1126
streamingBuffer->end ();
1127
streamingBuffer->render (sTransform);
1034
1129
glDisable (GL_BLEND);
1181
1274
if (pos > count - 1)
1183
1276
px = fmod (pos - count, sScreen->xCount);
1184
sScreen->paintSelectionRect (g.x (), g.y (), px, 0.0,
1277
sScreen->paintSelectionRect (transform, g.x (), g.y (), px, 0.0,
1185
1278
gWindow->lastPaintAttrib ().opacity);
1187
1280
px = fmod (pos, sScreen->xCount);
1188
sScreen->paintSelectionRect (g.x () + offX, g.y (),
1281
sScreen->paintSelectionRect (transform, g.x () + offX, g.y (),
1190
1283
gWindow->lastPaintAttrib ().opacity);
1192
1285
if (px > sScreen->xCount - 1)
1194
sScreen->paintSelectionRect (g.x (), g.y (), px, py,
1287
sScreen->paintSelectionRect (transform, g.x (), g.y (), px, py,
1195
1288
gWindow->lastPaintAttrib ().opacity);
1197
1290
py = fmod (py + 1, ceil ((double) count / sScreen->xCount));
1198
1291
offX = sScreen->getRowXOffset (py);
1200
sScreen->paintSelectionRect (g.x () + offX, g.y (),
1293
sScreen->paintSelectionRect (transform, g.x () + offX, g.y (),
1201
1294
px - sScreen->xCount, py,
1202
1295
gWindow->lastPaintAttrib ().opacity);
1206
sScreen->paintSelectionRect (g.x () + offX, g.y (),
1299
sScreen->paintSelectionRect (transform, g.x () + offX, g.y (),
1208
1301
gWindow->lastPaintAttrib ().opacity);
1210
1303
glDisable (GL_SCISSOR_TEST);
1213
1305
/* Adjust opacity/brightness/saturation of windows that are