summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Tardon <dtardon@redhat.com>2016-12-01 09:02:09 +0100
committerDavid Tardon <dtardon@redhat.com>2016-12-02 15:17:52 +0100
commit3830059b658cb3cde642c824b161d89c769314c1 (patch)
tree52f1bcf8ac95e5d7e67fc688606ff45b02affa94
parent8ca055f56ffbc3229c211903adb9fee7049385cf (diff)
get vertices count without jumping through hoops
Change-Id: I0cab6b2f9fffc8cf9fc5059b8dc48fa9407e42b5
-rw-r--r--slideshow/source/engine/opengl/TransitionImpl.cxx3
-rw-r--r--slideshow/source/engine/opengl/TransitionImpl.hxx7
2 files changed, 8 insertions, 2 deletions
diff --git a/slideshow/source/engine/opengl/TransitionImpl.cxx b/slideshow/source/engine/opengl/TransitionImpl.cxx
index d1faed2e8a3a..df753c6a784b 100644
--- a/slideshow/source/engine/opengl/TransitionImpl.cxx
+++ b/slideshow/source/engine/opengl/TransitionImpl.cxx
@@ -1998,9 +1998,8 @@ void GlitterTransition::prepareTransition( sal_Int32 glLeavingSlideTex, sal_Int3
// Upload the center of each hexagon.
const Primitive& primitive = getScene().getLeavingSlide()[0];
- int nbVertices = primitive.getVerticesByteSize() / sizeof(Vertex);
std::vector<ThreeFloats> vertices;
- for (int i = 2; i < nbVertices; i += 18) {
+ for (int i = 2; i < primitive.getVerticesCount(); i += 18) {
const glm::vec3& center = primitive.getVertex(i);
for (int j = 0; j < 18; ++j)
vertices.push_back({center.x, center.y, center.z});
diff --git a/slideshow/source/engine/opengl/TransitionImpl.hxx b/slideshow/source/engine/opengl/TransitionImpl.hxx
index 3f8449508dea..f27fd7743e72 100644
--- a/slideshow/source/engine/opengl/TransitionImpl.hxx
+++ b/slideshow/source/engine/opengl/TransitionImpl.hxx
@@ -33,6 +33,7 @@
#include <GL/glew.h>
+#include <limits>
#include <memory>
#include <vector>
@@ -335,6 +336,12 @@ public:
*/
const glm::vec3& getVertex(int n) const {return Vertices[n].position;}
+ int getVerticesCount() const
+ {
+ assert(Vertices.size() < std::numeric_limits<int>::max());
+ return int(unsigned(Vertices.size()));
+ }
+
/** accessor for the size of the vertices data
@return