slideshow/source/engine/opengl/TransitionImpl.cxx | 5 ++--- slideshow/source/engine/opengl/TransitionImpl.hxx | 9 ++++++++- svx/source/gallery2/galobj.cxx | 2 +- 3 files changed, 11 insertions(+), 5 deletions(-)
New commits: commit 3830059b658cb3cde642c824b161d89c769314c1 Author: David Tardon <[email protected]> Date: Thu Dec 1 09:02:09 2016 +0100 get vertices count without jumping through hoops Change-Id: I0cab6b2f9fffc8cf9fc5059b8dc48fa9407e42b5 diff --git a/slideshow/source/engine/opengl/TransitionImpl.cxx b/slideshow/source/engine/opengl/TransitionImpl.cxx index d1faed2..df753c6 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 3f84495..f27fd77 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 commit 8ca055f56ffbc3229c211903adb9fee7049385cf Author: David Tardon <[email protected]> Date: Thu Dec 1 08:57:46 2016 +0100 rename to avoid further misunderstandings Change-Id: Ibcfae1b3ec118d74921312a80eb56c97c623f4a9 diff --git a/slideshow/source/engine/opengl/TransitionImpl.cxx b/slideshow/source/engine/opengl/TransitionImpl.cxx index a2b11c3..d1faed2 100644 --- a/slideshow/source/engine/opengl/TransitionImpl.cxx +++ b/slideshow/source/engine/opengl/TransitionImpl.cxx @@ -111,7 +111,7 @@ static std::vector<int> uploadPrimitives(const Primitives_t& primitives) { int size = 0; for (const Primitive& primitive: primitives) - size += primitive.getVerticesSize(); + size += primitive.getVerticesByteSize(); CHECK_GL_ERROR(); glBufferData(GL_ARRAY_BUFFER, size, nullptr, GL_STATIC_DRAW); @@ -1998,7 +1998,7 @@ void GlitterTransition::prepareTransition( sal_Int32 glLeavingSlideTex, sal_Int3 // Upload the center of each hexagon. const Primitive& primitive = getScene().getLeavingSlide()[0]; - int nbVertices = primitive.getVerticesSize() / sizeof(Vertex); + int nbVertices = primitive.getVerticesByteSize() / sizeof(Vertex); std::vector<ThreeFloats> vertices; for (int i = 2; i < nbVertices; i += 18) { const glm::vec3& center = primitive.getVertex(i); diff --git a/slideshow/source/engine/opengl/TransitionImpl.hxx b/slideshow/source/engine/opengl/TransitionImpl.hxx index 66ecb6b..3f84495 100644 --- a/slideshow/source/engine/opengl/TransitionImpl.hxx +++ b/slideshow/source/engine/opengl/TransitionImpl.hxx @@ -340,7 +340,7 @@ public: @return the size in bytes of the Vertices data */ - int getVerticesSize() const {return Vertices.size() * sizeof(Vertex);} + int getVerticesByteSize() const {return Vertices.size() * sizeof(Vertex);} /** copies all vertices to the C array passed commit 9d902e264f8535fcf54cca6044f7bc32a60579b4 Author: David Tardon <[email protected]> Date: Wed Nov 30 17:41:07 2016 +0100 avoid valgrind warning Change-Id: I8ffb08bdab452f6a8618eaf466b722e7c8d226d9 diff --git a/svx/source/gallery2/galobj.cxx b/svx/source/gallery2/galobj.cxx index 45af5e5..270ad42 100644 --- a/svx/source/gallery2/galobj.cxx +++ b/svx/source/gallery2/galobj.cxx @@ -296,7 +296,7 @@ void SgaObjectBmp::WriteData( SvStream& rOut, const OUString& rDestDir ) const { // Set version SgaObject::WriteData( rOut, rDestDir ); - char aDummy[ 10 ]; + char aDummy[ 10 ] = { 0 }; rOut.WriteBytes(aDummy, 10); write_uInt16_lenPrefixed_uInt8s_FromOString(rOut, OString()); //dummy write_uInt16_lenPrefixed_uInt8s_FromOUString(rOut, aTitle, RTL_TEXTENCODING_UTF8); _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
