[Libreoffice-commits] core.git: Branch 'feature/opengl-canvas-rework' - canvas/source
Michael Jaumann
meta_dev at yahoo.com
Fri Feb 27 02:50:44 PST 2015
canvas/source/opengl/ogl_canvascustomsprite.cxx | 15 +++++++++------
canvas/source/opengl/ogl_canvastools.cxx | 9 ++++++---
2 files changed, 15 insertions(+), 9 deletions(-)
New commits:
commit 50f1e7e71bc59cec9c1afee473a94ff49c6de32a
Author: Michael Jaumann <meta_dev at yahoo.com>
Date: Fri Feb 27 10:46:49 2015 +0000
don't try to render with no vertices
Change-Id: I42a5c21b32771fcff1fd148b55cad2d697648409
diff --git a/canvas/source/opengl/ogl_canvascustomsprite.cxx b/canvas/source/opengl/ogl_canvascustomsprite.cxx
index 7acaceb..be4372e 100644
--- a/canvas/source/opengl/ogl_canvascustomsprite.cxx
+++ b/canvas/source/opengl/ogl_canvascustomsprite.cxx
@@ -218,14 +218,17 @@ namespace oglcanvas
aSpriteSizePixel.x,
aSpriteSizePixel.y)));
- std::vector<glm::vec2> vertices;
- vertices.reserve(rTriangulatedPolygon.count());
- for( sal_uInt32 i=0; i<rTriangulatedPolygon.count(); i++ )
+ if(rTriangulatedPolygon.count()!=0)
{
- const ::basegfx::B2DPoint& rPt( rTriangulatedPolygon.getB2DPoint(i) );
- vertices.push_back(glm::vec2(rPt.getX(), rPt.getY()));
+ std::vector<glm::vec2> vertices;
+ vertices.reserve(rTriangulatedPolygon.count());
+ for( sal_uInt32 i=0; i<rTriangulatedPolygon.count(); i++ )
+ {
+ const ::basegfx::B2DPoint& rPt( rTriangulatedPolygon.getB2DPoint(i) );
+ vertices.push_back(glm::vec2(rPt.getX(), rPt.getY()));
+ }
+ pRenderHelper->renderVertexTex( vertices, fWidth, fHeight, color, GL_TRIANGLES);
}
- pRenderHelper->renderVertexTex( vertices, fWidth, fHeight, color, GL_TRIANGLES);
}
else
{
diff --git a/canvas/source/opengl/ogl_canvastools.cxx b/canvas/source/opengl/ogl_canvastools.cxx
index 6490cff..3c09f96 100644
--- a/canvas/source/opengl/ogl_canvastools.cxx
+++ b/canvas/source/opengl/ogl_canvastools.cxx
@@ -48,7 +48,8 @@ namespace oglcanvas
vertices.push_back(glm::vec2(rPt.getX(),rPt.getY()));
}
- renderHelper->renderVertexConstColor(vertices, color, GL_TRIANGLES);
+ if(vertices.size() !=0)
+ renderHelper->renderVertexConstColor(vertices, color, GL_TRIANGLES);
}
}
@@ -72,7 +73,8 @@ namespace oglcanvas
const ::basegfx::B2DPoint& rPt( rTriangulatedPolygon.getB2DPoint(i) );
vertices.push_back(glm::vec2(rPt.getX(),rPt.getY()));
}
- renderHelper->renderTextureTransform( vertices, nWidth, nHeight, color, GL_TRIANGLES, transform);
+ if(vertices.size()!=0)
+ renderHelper->renderTextureTransform( vertices, nWidth, nHeight, color, GL_TRIANGLES, transform);
}
}
@@ -102,7 +104,8 @@ namespace oglcanvas
const ::basegfx::B2DPoint& rPt( rPolygon.getB2DPoint( j % nPts ) );
vertices.push_back(glm::vec2(rPt.getX(),rPt.getY()));
}
- renderHelper->renderVertexConstColor(vertices, color, GL_LINE_STRIP);
+ if(vertices.size()!=0)
+ renderHelper->renderVertexConstColor(vertices, color, GL_LINE_STRIP);
}
}
More information about the Libreoffice-commits
mailing list