summaryrefslogtreecommitdiff
path: root/slideshow
diff options
context:
space:
mode:
authorDavid Tardon <dtardon@redhat.com>2016-07-11 15:26:17 +0200
committerDavid Tardon <dtardon@redhat.com>2016-07-11 16:04:59 +0200
commitc726059adf71f9c812df3363b4902c52023827b6 (patch)
tree6dc967731cd1a2882f652014b080d032e64f879d /slideshow
parenta125527a0d1a81a3f1089cebbb91dbc5e7890b68 (diff)
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
Diffstat (limited to 'slideshow')
-rw-r--r--slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionImpl.cxx38
-rw-r--r--slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionImpl.hxx4
2 files changed, 25 insertions, 17 deletions
diff --git a/slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionImpl.cxx b/slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionImpl.cxx
index cd43fedac4a3..d1d4c5ea27c8 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 bf2f1c1e84d2..488a035adef8 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.