summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2015-06-30 18:07:41 +0900
committerCaolán McNamara <caolanm@redhat.com>2015-07-08 15:36:23 +0000
commite1ab783539b495e12fc769ac493db3f5cebec106 (patch)
tree35ecee8c483a3c043ef640ddacdbd06ad3099b15 /vcl
parentc2cdfb398dda20ae0bd71b8efe55994b88e40fb1 (diff)
opengl: draw rectangle lines with only one glDrawArrays call
Change-Id: I33e065fe6c084d0bed04ee99c447004fe573278a Reviewed-on: https://gerrit.libreoffice.org/16859 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/opengl/gdiimpl.cxx25
1 files changed, 18 insertions, 7 deletions
diff --git a/vcl/opengl/gdiimpl.cxx b/vcl/opengl/gdiimpl.cxx
index 2526cde6ff40..f56dd4af2a38 100644
--- a/vcl/opengl/gdiimpl.cxx
+++ b/vcl/opengl/gdiimpl.cxx
@@ -1195,13 +1195,24 @@ void OpenGLSalGraphicsImpl::drawRect( long nX, long nY, long nWidth, long nHeigh
if( UseSolid( mnLineColor ) )
{
- const long nX1( nX );
- const long nY1( nY );
- const long nX2( nX + nWidth );
- const long nY2( nY + nHeight );
- const SalPoint aPoints[] = { { nX1, nY1 }, { nX2, nY1 },
- { nX2, nY2 }, { nX1, nY2 } };
- DrawLines( 4, aPoints, true ); // No need for AA.
+ GLfloat fX1 = OPENGL_COORD_X(nX);
+ GLfloat fY1 = OPENGL_COORD_Y(nY);
+ GLfloat fX2 = OPENGL_COORD_X(nX + nWidth);
+ GLfloat fY2 = OPENGL_COORD_Y(nY + nHeight);
+
+ GLfloat pPoints[16];
+
+ pPoints[0] = fX1;
+ pPoints[1] = fY1;
+ pPoints[2] = fX2;
+ pPoints[3] = fY1;
+ pPoints[4] = fX2;
+ pPoints[5] = fY2;
+ pPoints[6] = fX1;
+ pPoints[7] = fY2;
+
+ mpProgram->SetVertices(pPoints);
+ glDrawArrays(GL_LINE_LOOP, 0, 4);
}
PostDraw();