[Libreoffice-commits] core.git: Branch 'libreoffice-5-2' - slideshow/source

David Tardon dtardon at redhat.com
Wed Jul 20 07:49:19 UTC 2016


 slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionImpl.cxx |   38 ++++++----
 slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionImpl.hxx |    4 -
 2 files changed, 25 insertions(+), 17 deletions(-)

New commits:
commit 439df080e7e82908cd80e01ca1b3a03ddb3ac8ec
Author: David Tardon <dtardon at redhat.com>
Date:   Mon Jul 11 15:26:17 2016 +0200

    tdf#97195 fix crash in diamond shape transition
    
    The setScene() function was a hack from the beginning--it was only
    introduced to avoid the need to override displaySlides_() in
    DiamondTransition. And it worked until someone started to make false
    assumptions about the scene, like that it is unchanging or that both
    slides have the same (non-zero) number of elements...
    
    Change-Id: I401cccc4dfbcba0a5f5544d3aac94d1cae027c99
    (cherry picked from commit c726059adf71f9c812df3363b4902c52023827b6)
    Reviewed-on: https://gerrit.libreoffice.org/27312
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionImpl.cxx b/slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionImpl.cxx
index 6b7cd60..b6c3a6e 100644
--- a/slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionImpl.cxx
+++ b/slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionImpl.cxx
@@ -70,11 +70,6 @@ OGLTransitionImpl::~OGLTransitionImpl()
 {
 }
 
-void OGLTransitionImpl::setScene(TransitionScene const& rScene)
-{
-    maScene = rScene;
-}
-
 void OGLTransitionImpl::uploadModelViewProjectionMatrices()
 {
     double EyePos(10.0);
@@ -1138,18 +1133,26 @@ public:
         {}
 
 private:
-    virtual void prepare( double nTime, double SlideWidth, double SlideHeight, double DispWidth, double DispHeight ) override;
+    virtual void displaySlides_( double nTime, sal_Int32 glLeavingSlideTex, sal_Int32 glEnteringSlideTex, double SlideWidthScale, double SlideHeightScale ) override;
+
+    Primitives_t makeLeavingSlide(double nTime) const;
 };
 
-void DiamondTransition::prepare( double nTime, double /* SlideWidth */, double /* SlideHeight */, double /* DispWidth */, double /* DispHeight */ )
+void DiamondTransition::displaySlides_( double nTime, sal_Int32 glLeavingSlideTex, sal_Int32 glEnteringSlideTex,
+                                              double SlideWidthScale, double SlideHeightScale )
 {
-    Primitive Slide1, Slide2;
+    CHECK_GL_ERROR();
+    applyOverallOperations( nTime, SlideWidthScale, SlideHeightScale );
 
-    Slide1.pushTriangle (glm::vec2 (0,0), glm::vec2 (1,0), glm::vec2 (0,1));
-    Slide1.pushTriangle (glm::vec2 (1,0), glm::vec2 (0,1), glm::vec2 (1,1));
-    Primitives_t aEnteringSlidePrimitives;
-    aEnteringSlidePrimitives.push_back (Slide1);
+    CHECK_GL_ERROR();
+    displaySlide( nTime, glLeavingSlideTex, makeLeavingSlide(nTime), SlideWidthScale, SlideHeightScale );
+    displaySlide( nTime, glEnteringSlideTex, getScene().getEnteringSlide(), SlideWidthScale, SlideHeightScale );
+    CHECK_GL_ERROR();
+}
 
+Primitives_t DiamondTransition::makeLeavingSlide(double nTime) const
+{
+    Primitive Slide2;
     if( nTime >= 0.5 ) {
         double m = 1 - nTime;
 
@@ -1174,13 +1177,20 @@ void DiamondTransition::prepare( double nTime, double /* SlideWidth */, double /
     Primitives_t aLeavingSlidePrimitives;
     aLeavingSlidePrimitives.push_back (Slide2);
 
-    setScene(TransitionScene(aLeavingSlidePrimitives, aEnteringSlidePrimitives));
+    return aLeavingSlidePrimitives;
 }
 
 std::shared_ptr<OGLTransitionImpl>
 makeDiamondTransition(const TransitionSettings& rSettings)
 {
-    return std::make_shared<DiamondTransition>(TransitionScene(), rSettings);
+    Primitive Slide1;
+    Slide1.pushTriangle (glm::vec2 (0,0), glm::vec2 (1,0), glm::vec2 (0,1));
+    Slide1.pushTriangle (glm::vec2 (1,0), glm::vec2 (0,1), glm::vec2 (1,1));
+    Primitives_t aEnteringSlidePrimitives;
+    aEnteringSlidePrimitives.push_back (Slide1);
+    Primitives_t aLeavingSlidePrimitives;
+    aLeavingSlidePrimitives.push_back (Slide1);
+    return std::make_shared<DiamondTransition>(TransitionScene(aLeavingSlidePrimitives, aEnteringSlidePrimitives), rSettings);
 }
 
 }
diff --git a/slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionImpl.hxx b/slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionImpl.hxx
index bf2f1c1..488a035 100644
--- a/slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionImpl.hxx
+++ b/slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionImpl.hxx
@@ -165,8 +165,6 @@ protected:
         return maScene;
     }
 
-    void setScene(TransitionScene const& rScene);
-
     void displaySlide( double nTime, sal_Int32 glSlideTex, const Primitives_t& primitives, double SlideWidthScale, double SlideHeightScale );
     void displayScene( double nTime, double SlideWidth, double SlideHeight, double DispWidth, double DispHeight);
     void applyOverallOperations( double nTime, double SlideWidthScale, double SlideHeightScale );
@@ -210,7 +208,7 @@ private:
     virtual GLuint makeShader() const = 0;
 
 private:
-    TransitionScene maScene;
+    const TransitionScene maScene;
     const TransitionSettings maSettings;
 
     /** Calculates the projection and model/view matrices, and upload them.


More information about the Libreoffice-commits mailing list