diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2015-06-30 18:07:41 +0900 |
---|---|---|
committer | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2015-07-03 14:52:28 +0900 |
commit | 149e62670ed01f33612e841c8d17b6bd416e2d88 (patch) | |
tree | ec7b29888318577b28f931c0c84bec3325cb4a7e /vcl/opengl | |
parent | 33d32a78943d19b0d06821ad1a06054f633f60fc (diff) |
opengl: draw rectangle lines with only one glDrawArrays call
Change-Id: I33e065fe6c084d0bed04ee99c447004fe573278a
Diffstat (limited to 'vcl/opengl')
-rw-r--r-- | vcl/opengl/gdiimpl.cxx | 25 |
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(); |