[Libreoffice-commits] .: 6 commits - canvas/inc canvas/source slideshow/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Thu Nov 22 01:48:41 PST 2012
canvas/inc/canvas/canvastools.hxx | 8
canvas/source/cairo/cairo_canvashelper.cxx | 327 +++
canvas/source/cairo/cairo_canvashelper.hxx | 2
canvas/source/tools/canvastools.cxx | 348 +++
canvas/source/vcl/canvasbitmaphelper.cxx | 6
canvas/source/vcl/canvashelper.cxx | 6
canvas/source/vcl/devicehelper.cxx | 4
slideshow/source/engine/OGLTrans/unx/OGLTrans_TransitionImpl.cxx | 1019 ++++++----
slideshow/source/engine/OGLTrans/unx/OGLTrans_TransitionImpl.hxx | 337 ++-
slideshow/source/engine/OGLTrans/unx/OGLTrans_TransitionerImpl.cxx | 464 ++++
slideshow/source/engine/eventqueue.cxx | 60
slideshow/source/engine/rehearsetimingsactivity.cxx | 4
slideshow/source/engine/transitions/slidetransitionfactory.cxx | 9
slideshow/source/engine/wakeupevent.cxx | 4
slideshow/source/inc/delayevent.hxx | 25
slideshow/source/inc/event.hxx | 8
slideshow/source/inc/interruptabledelayevent.hxx | 4
17 files changed, 2050 insertions(+), 585 deletions(-)
New commits:
commit 642b86aa541aa977143ac5a084550f3390423926
Author: David Tardon <dtardon at redhat.com>
Date: Thu Nov 22 09:41:19 2012 +0100
fix 3D 'fade' transitions
* canvas bitmaps created without transparency get an appropriate color
space
* implement a color space for OpenGL RGBA to use instead of
canvas::tools::getStdColorSpace(), which apparently uses VCL's
interpretation of alpha (alpha == 0xff means full transparency,
alpha == 0 full opacity).
Change-Id: I97f30533206b75132abd0bb0d290a279f15ae8a9
diff --git a/canvas/inc/canvas/canvastools.hxx b/canvas/inc/canvas/canvastools.hxx
index 4f38c0b..b2627d4 100644
--- a/canvas/inc/canvas/canvastools.hxx
+++ b/canvas/inc/canvas/canvastools.hxx
@@ -359,6 +359,14 @@ namespace canvas
*/
CANVASTOOLS_DLLPUBLIC ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XIntegerBitmapColorSpace> getStdColorSpace();
+ /** Return a color space for a default RGB integer format
+
+ Use this method for dead-simple bitmap implementations,
+ that map all their formats to 8888 RGB color (the last byte
+ is unused).
+ */
+ CANVASTOOLS_DLLPUBLIC ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XIntegerBitmapColorSpace> getStdColorSpaceWithoutAlpha();
+
/** Return a memory layout for a default RGBA integer format
Use this method for dead-simple bitmap implementations,
diff --git a/canvas/source/cairo/cairo_canvashelper.cxx b/canvas/source/cairo/cairo_canvashelper.cxx
index f18d2dc..cbda60a 100644
--- a/canvas/source/cairo/cairo_canvashelper.cxx
+++ b/canvas/source/cairo/cairo_canvashelper.cxx
@@ -1583,14 +1583,13 @@ namespace cairocanvas
{
if( mpCairo )
{
- aLayout = getMemoryLayout();
-
const sal_Int32 nWidth( rect.X2 - rect.X1 );
const sal_Int32 nHeight( rect.Y2 - rect.Y1 );
+ const Format eFormat( mbHaveAlpha ? CAIRO_FORMAT_ARGB32 : CAIRO_FORMAT_RGB24 );
uno::Sequence< sal_Int8 > aRes( 4*nWidth*nHeight );
sal_Int8* pData = aRes.getArray();
cairo_surface_t* pImageSurface = cairo_image_surface_create_for_data( (unsigned char *) pData,
- CAIRO_FORMAT_ARGB32,
+ eFormat,
nWidth, nHeight, 4*nWidth );
cairo_t* pCairo = cairo_create( pImageSurface );
cairo_set_source_surface( pCairo, mpSurface->getCairoSurface().get(), -rect.X1, -rect.Y1);
@@ -1598,9 +1597,7 @@ namespace cairocanvas
cairo_destroy( pCairo );
cairo_surface_destroy( pImageSurface );
- aLayout.ScanLines = nHeight;
- aLayout.ScanLineBytes = nWidth*4;
- aLayout.ScanLineStride = aLayout.ScanLineBytes;
+ aLayout = impl_getMemoryLayout( nWidth, nHeight );
return aRes;
}
@@ -1985,6 +1982,310 @@ namespace cairocanvas
}
};
+ class CairoNoAlphaColorSpace : public cppu::WeakImplHelper1< com::sun::star::rendering::XIntegerBitmapColorSpace >
+ {
+ private:
+ uno::Sequence< sal_Int8 > maComponentTags;
+ uno::Sequence< sal_Int32 > maBitCounts;
+
+ virtual ::sal_Int8 SAL_CALL getType( ) throw (uno::RuntimeException)
+ {
+ return rendering::ColorSpaceType::RGB;
+ }
+ virtual uno::Sequence< ::sal_Int8 > SAL_CALL getComponentTags( ) throw (uno::RuntimeException)
+ {
+ return maComponentTags;
+ }
+ virtual ::sal_Int8 SAL_CALL getRenderingIntent( ) throw (uno::RuntimeException)
+ {
+ return rendering::RenderingIntent::PERCEPTUAL;
+ }
+ virtual uno::Sequence< beans::PropertyValue > SAL_CALL getProperties( ) throw (uno::RuntimeException)
+ {
+ return uno::Sequence< beans::PropertyValue >();
+ }
+ virtual uno::Sequence< double > SAL_CALL convertColorSpace( const uno::Sequence< double >& deviceColor,
+ const uno::Reference< rendering::XColorSpace >& targetColorSpace ) throw (lang::IllegalArgumentException,
+ uno::RuntimeException)
+ {
+ // TODO(P3): if we know anything about target
+ // colorspace, this can be greatly sped up
+ uno::Sequence<rendering::ARGBColor> aIntermediate(
+ convertToARGB(deviceColor));
+ return targetColorSpace->convertFromARGB(aIntermediate);
+ }
+ virtual uno::Sequence< rendering::RGBColor > SAL_CALL convertToRGB( const uno::Sequence< double >& deviceColor ) throw (lang::IllegalArgumentException, uno::RuntimeException)
+ {
+ const double* pIn( deviceColor.getConstArray() );
+ const sal_Size nLen( deviceColor.getLength() );
+ ENSURE_ARG_OR_THROW2(nLen%4==0,
+ "number of channels no multiple of 4",
+ static_cast<rendering::XColorSpace*>(this), 0);
+
+ uno::Sequence< rendering::RGBColor > aRes(nLen/4);
+ rendering::RGBColor* pOut( aRes.getArray() );
+ for( sal_Size i=0; i<nLen; i+=4 )
+ {
+ *pOut++ = rendering::RGBColor(pIn[2], pIn[1], pIn[0]);
+ pIn += 4;
+ }
+ return aRes;
+ }
+ uno::Sequence< rendering::ARGBColor > impl_convertToARGB( const uno::Sequence< double >& deviceColor )
+ {
+ const double* pIn( deviceColor.getConstArray() );
+ const sal_Size nLen( deviceColor.getLength() );
+ ENSURE_ARG_OR_THROW2(nLen%4==0,
+ "number of channels no multiple of 4",
+ static_cast<rendering::XColorSpace*>(this), 0);
+
+ uno::Sequence< rendering::ARGBColor > aRes(nLen/4);
+ rendering::ARGBColor* pOut( aRes.getArray() );
+ for( sal_Size i=0; i<nLen; i+=4 )
+ {
+ *pOut++ = rendering::ARGBColor(1.0, pIn[2], pIn[1], pIn[0]);
+ pIn += 4;
+ }
+ return aRes;
+ }
+ virtual uno::Sequence< rendering::ARGBColor > SAL_CALL convertToARGB( const uno::Sequence< double >& deviceColor ) throw (lang::IllegalArgumentException, uno::RuntimeException)
+ {
+ return impl_convertToARGB( deviceColor );
+ }
+ virtual uno::Sequence< rendering::ARGBColor > SAL_CALL convertToPARGB( const uno::Sequence< double >& deviceColor ) throw (lang::IllegalArgumentException, uno::RuntimeException)
+ {
+ return impl_convertToARGB( deviceColor );
+ }
+ virtual uno::Sequence< double > SAL_CALL convertFromRGB( const uno::Sequence< rendering::RGBColor >& rgbColor ) throw (lang::IllegalArgumentException, uno::RuntimeException)
+ {
+ const rendering::RGBColor* pIn( rgbColor.getConstArray() );
+ const sal_Size nLen( rgbColor.getLength() );
+
+ uno::Sequence< double > aRes(nLen*4);
+ double* pColors=aRes.getArray();
+ for( sal_Size i=0; i<nLen; ++i )
+ {
+ *pColors++ = pIn->Blue;
+ *pColors++ = pIn->Green;
+ *pColors++ = pIn->Red;
+ *pColors++ = 1.0; // the value does not matter
+ ++pIn;
+ }
+ return aRes;
+ }
+ uno::Sequence< double > impl_convertFromARGB( const uno::Sequence< rendering::ARGBColor >& rgbColor )
+ {
+ const rendering::ARGBColor* pIn( rgbColor.getConstArray() );
+ const sal_Size nLen( rgbColor.getLength() );
+
+ uno::Sequence< double > aRes(nLen*4);
+ double* pColors=aRes.getArray();
+ for( sal_Size i=0; i<nLen; ++i )
+ {
+ *pColors++ = pIn->Blue;
+ *pColors++ = pIn->Green;
+ *pColors++ = pIn->Red;
+ *pColors++ = 1.0; // the value does not matter
+ ++pIn;
+ }
+ return aRes;
+ }
+ virtual uno::Sequence< double > SAL_CALL convertFromARGB( const uno::Sequence< rendering::ARGBColor >& rgbColor ) throw (lang::IllegalArgumentException, uno::RuntimeException)
+ {
+ return impl_convertFromARGB( rgbColor );
+ }
+ virtual uno::Sequence< double > SAL_CALL convertFromPARGB( const uno::Sequence< rendering::ARGBColor >& rgbColor ) throw (lang::IllegalArgumentException, uno::RuntimeException)
+ {
+ return impl_convertFromARGB( rgbColor );
+ }
+
+ // XIntegerBitmapColorSpace
+ virtual ::sal_Int32 SAL_CALL getBitsPerPixel( ) throw (uno::RuntimeException)
+ {
+ return 32;
+ }
+ virtual uno::Sequence< ::sal_Int32 > SAL_CALL getComponentBitCounts( ) throw (uno::RuntimeException)
+ {
+ return maBitCounts;
+ }
+ virtual ::sal_Int8 SAL_CALL getEndianness( ) throw (uno::RuntimeException)
+ {
+ return util::Endianness::LITTLE;
+ }
+ virtual uno::Sequence<double> SAL_CALL convertFromIntegerColorSpace( const uno::Sequence< ::sal_Int8 >& deviceColor,
+ const uno::Reference< rendering::XColorSpace >& targetColorSpace )
+ throw (lang::IllegalArgumentException, uno::RuntimeException)
+ {
+ if( dynamic_cast<CairoColorSpace*>(targetColorSpace.get()) )
+ {
+ const sal_Int8* pIn( deviceColor.getConstArray() );
+ const sal_Size nLen( deviceColor.getLength() );
+ ENSURE_ARG_OR_THROW2(nLen%4==0,
+ "number of channels no multiple of 4",
+ static_cast<rendering::XColorSpace*>(this), 0);
+
+ uno::Sequence<double> aRes(nLen);
+ double* pOut( aRes.getArray() );
+ for( sal_Size i=0; i<nLen; i+=4 )
+ {
+ *pOut++ = vcl::unotools::toDoubleColor(*pIn++);
+ *pOut++ = vcl::unotools::toDoubleColor(*pIn++);
+ *pOut++ = vcl::unotools::toDoubleColor(*pIn++);
+ *pOut++ = 1.0; // the value does not matter
+ }
+ return aRes;
+ }
+ else
+ {
+ // TODO(P3): if we know anything about target
+ // colorspace, this can be greatly sped up
+ uno::Sequence<rendering::ARGBColor> aIntermediate(
+ convertIntegerToARGB(deviceColor));
+ return targetColorSpace->convertFromARGB(aIntermediate);
+ }
+ }
+ virtual uno::Sequence< ::sal_Int8 > SAL_CALL convertToIntegerColorSpace( const uno::Sequence< ::sal_Int8 >& deviceColor,
+ const uno::Reference< rendering::XIntegerBitmapColorSpace >& targetColorSpace )
+ throw (lang::IllegalArgumentException, uno::RuntimeException)
+ {
+ if( dynamic_cast<CairoNoAlphaColorSpace*>(targetColorSpace.get()) )
+ {
+ // it's us, so simply pass-through the data
+ return deviceColor;
+ }
+ else
+ {
+ // TODO(P3): if we know anything about target
+ // colorspace, this can be greatly sped up
+ uno::Sequence<rendering::ARGBColor> aIntermediate(
+ convertIntegerToARGB(deviceColor));
+ return targetColorSpace->convertIntegerFromARGB(aIntermediate);
+ }
+ }
+ virtual uno::Sequence< rendering::RGBColor > SAL_CALL convertIntegerToRGB( const uno::Sequence< ::sal_Int8 >& deviceColor )
+ throw (lang::IllegalArgumentException, uno::RuntimeException)
+ {
+ const sal_Int8* pIn( deviceColor.getConstArray() );
+ const sal_Size nLen( deviceColor.getLength() );
+ ENSURE_ARG_OR_THROW2(nLen%4==0,
+ "number of channels no multiple of 4",
+ static_cast<rendering::XColorSpace*>(this), 0);
+
+ uno::Sequence< rendering::RGBColor > aRes(nLen/4);
+ rendering::RGBColor* pOut( aRes.getArray() );
+ for( sal_Size i=0; i<nLen; i+=4 )
+ {
+ *pOut++ = rendering::RGBColor( pIn[2], pIn[1], pIn[0] );
+ pIn += 4;
+ }
+ return aRes;
+ }
+
+ virtual uno::Sequence< rendering::ARGBColor > SAL_CALL convertIntegerToARGB( const uno::Sequence< ::sal_Int8 >& deviceColor )
+ throw (lang::IllegalArgumentException, uno::RuntimeException)
+ {
+ return impl_convertIntegerToARGB( deviceColor );
+ }
+ virtual uno::Sequence< rendering::ARGBColor > SAL_CALL convertIntegerToPARGB( const uno::Sequence< ::sal_Int8 >& deviceColor )
+ throw (lang::IllegalArgumentException, uno::RuntimeException)
+ {
+ return impl_convertIntegerToARGB( deviceColor );
+ }
+ uno::Sequence< rendering::ARGBColor > impl_convertIntegerToARGB( const uno::Sequence< ::sal_Int8 >& deviceColor )
+ {
+ const sal_Int8* pIn( deviceColor.getConstArray() );
+ const sal_Size nLen( deviceColor.getLength() );
+ ENSURE_ARG_OR_THROW2(nLen%4==0,
+ "number of channels no multiple of 4",
+ static_cast<rendering::XColorSpace*>(this), 0);
+
+ uno::Sequence< rendering::ARGBColor > aRes(nLen/4);
+ rendering::ARGBColor* pOut( aRes.getArray() );
+ for( sal_Size i=0; i<nLen; i+=4 )
+ {
+ *pOut++ = rendering::ARGBColor(
+ 1.0,
+ vcl::unotools::toDoubleColor(pIn[2]),
+ vcl::unotools::toDoubleColor(pIn[1]),
+ vcl::unotools::toDoubleColor(pIn[0]));
+ pIn += 4;
+ }
+ return aRes;
+ }
+
+ virtual uno::Sequence< ::sal_Int8 > SAL_CALL convertIntegerFromRGB( const uno::Sequence< rendering::RGBColor >& rgbColor )
+ throw (lang::IllegalArgumentException, uno::RuntimeException)
+ {
+ const rendering::RGBColor* pIn( rgbColor.getConstArray() );
+ const sal_Size nLen( rgbColor.getLength() );
+
+ uno::Sequence< sal_Int8 > aRes(nLen*4);
+ sal_Int8* pColors=aRes.getArray();
+ for( sal_Size i=0; i<nLen; ++i )
+ {
+ *pColors++ = vcl::unotools::toByteColor(pIn->Blue);
+ *pColors++ = vcl::unotools::toByteColor(pIn->Green);
+ *pColors++ = vcl::unotools::toByteColor(pIn->Red);
+ *pColors++ = -1; // the value does not matter
+ ++pIn;
+ }
+ return aRes;
+ }
+
+ virtual uno::Sequence< ::sal_Int8 > SAL_CALL convertIntegerFromARGB( const uno::Sequence< rendering::ARGBColor >& rgbColor )
+ throw (lang::IllegalArgumentException, uno::RuntimeException)
+ {
+ return impl_convertIntegerFromARGB( rgbColor );
+ }
+ virtual uno::Sequence< ::sal_Int8 > SAL_CALL convertIntegerFromPARGB( const uno::Sequence< rendering::ARGBColor >& rgbColor )
+ throw (lang::IllegalArgumentException, uno::RuntimeException)
+ {
+ return impl_convertIntegerFromARGB( rgbColor );
+ }
+ uno::Sequence< ::sal_Int8 > impl_convertIntegerFromARGB( const uno::Sequence< rendering::ARGBColor >& rgbColor )
+ {
+ const rendering::ARGBColor* pIn( rgbColor.getConstArray() );
+ const sal_Size nLen( rgbColor.getLength() );
+
+ uno::Sequence< sal_Int8 > aRes(nLen*4);
+ sal_Int8* pColors=aRes.getArray();
+ for( sal_Size i=0; i<nLen; ++i )
+ {
+ *pColors++ = vcl::unotools::toByteColor(pIn->Blue);
+ *pColors++ = vcl::unotools::toByteColor(pIn->Green);
+ *pColors++ = vcl::unotools::toByteColor(pIn->Red);
+ *pColors++ = -1; // the value does not matter
+ ++pIn;
+ }
+ return aRes;
+ }
+
+ public:
+ CairoNoAlphaColorSpace() :
+ maComponentTags(3),
+ maBitCounts(3)
+ {
+ sal_Int8* pTags = maComponentTags.getArray();
+ sal_Int32* pBitCounts = maBitCounts.getArray();
+ pTags[0] = rendering::ColorComponentTag::RGB_BLUE;
+ pTags[1] = rendering::ColorComponentTag::RGB_GREEN;
+ pTags[2] = rendering::ColorComponentTag::RGB_RED;
+
+ pBitCounts[0] =
+ pBitCounts[1] =
+ pBitCounts[2] = 8;
+ }
+ };
+
+ struct CairoNoAlphaColorSpaceHolder : public rtl::StaticWithInit<uno::Reference<rendering::XIntegerBitmapColorSpace>,
+ CairoNoAlphaColorSpaceHolder>
+ {
+ uno::Reference<rendering::XIntegerBitmapColorSpace> operator()()
+ {
+ return new CairoNoAlphaColorSpace();
+ }
+ };
+
struct CairoColorSpaceHolder : public rtl::StaticWithInit<uno::Reference<rendering::XIntegerBitmapColorSpace>,
CairoColorSpaceHolder>
{
@@ -1993,6 +2294,7 @@ namespace cairocanvas
return new CairoColorSpace();
}
};
+
}
rendering::IntegerBitmapLayout CanvasHelper::getMemoryLayout()
@@ -2001,13 +2303,20 @@ namespace cairocanvas
return rendering::IntegerBitmapLayout(); // we're disposed
const geometry::IntegerSize2D aSize(getSize());
+
+ return impl_getMemoryLayout( aSize.Width, aSize.Height );
+ }
+
+ rendering::IntegerBitmapLayout
+ CanvasHelper::impl_getMemoryLayout( const sal_Int32 nWidth, const sal_Int32 nHeight )
+ {
rendering::IntegerBitmapLayout aLayout;
- aLayout.ScanLines = aSize.Height;
- aLayout.ScanLineBytes = aSize.Width*4;
+ aLayout.ScanLines = nHeight;
+ aLayout.ScanLineBytes = nWidth*4;
aLayout.ScanLineStride = aLayout.ScanLineBytes;
aLayout.PlaneStride = 0;
- aLayout.ColorSpace = CairoColorSpaceHolder::get();
+ aLayout.ColorSpace = mbHaveAlpha ? CairoColorSpaceHolder::get() : CairoNoAlphaColorSpaceHolder::get();
aLayout.Palette.clear();
aLayout.IsMsbFirst = sal_False;
diff --git a/canvas/source/cairo/cairo_canvashelper.hxx b/canvas/source/cairo/cairo_canvashelper.hxx
index 3ae1de7..8dc7fdb 100644
--- a/canvas/source/cairo/cairo_canvashelper.hxx
+++ b/canvas/source/cairo/cairo_canvashelper.hxx
@@ -301,6 +301,8 @@ namespace cairocanvas
const ::com::sun::star::rendering::RenderState& renderState,
bool setColor );
+ com::sun::star::rendering::IntegerBitmapLayout impl_getMemoryLayout( sal_Int32 nWidth, sal_Int32 nHeight );
+
/// When true, content is able to represent alpha
bool mbHaveAlpha;
diff --git a/canvas/source/tools/canvastools.cxx b/canvas/source/tools/canvastools.cxx
index a3dcfa6..25977f6 100644
--- a/canvas/source/tools/canvastools.cxx
+++ b/canvas/source/tools/canvastools.cxx
@@ -557,6 +557,340 @@ namespace canvas
}
};
+ class StandardNoAlphaColorSpace : public cppu::WeakImplHelper1< com::sun::star::rendering::XIntegerBitmapColorSpace >
+ {
+ private:
+ uno::Sequence< sal_Int8 > maComponentTags;
+ uno::Sequence< sal_Int32 > maBitCounts;
+
+ virtual ::sal_Int8 SAL_CALL getType( ) throw (uno::RuntimeException)
+ {
+ return rendering::ColorSpaceType::RGB;
+ }
+ virtual uno::Sequence< ::sal_Int8 > SAL_CALL getComponentTags( ) throw (uno::RuntimeException)
+ {
+ return maComponentTags;
+ }
+ virtual ::sal_Int8 SAL_CALL getRenderingIntent( ) throw (uno::RuntimeException)
+ {
+ return rendering::RenderingIntent::PERCEPTUAL;
+ }
+ virtual uno::Sequence< beans::PropertyValue > SAL_CALL getProperties( ) throw (uno::RuntimeException)
+ {
+ return uno::Sequence< beans::PropertyValue >();
+ }
+ virtual uno::Sequence< double > SAL_CALL convertColorSpace( const uno::Sequence< double >& deviceColor,
+ const uno::Reference< rendering::XColorSpace >& targetColorSpace ) throw (lang::IllegalArgumentException,
+ uno::RuntimeException)
+ {
+ // TODO(P3): if we know anything about target
+ // colorspace, this can be greatly sped up
+ uno::Sequence<rendering::ARGBColor> aIntermediate(
+ convertToARGB(deviceColor));
+ return targetColorSpace->convertFromARGB(aIntermediate);
+ }
+ virtual uno::Sequence< rendering::RGBColor > SAL_CALL convertToRGB( const uno::Sequence< double >& deviceColor ) throw (lang::IllegalArgumentException, uno::RuntimeException)
+ {
+ const double* pIn( deviceColor.getConstArray() );
+ const sal_Size nLen( deviceColor.getLength() );
+ ENSURE_ARG_OR_THROW2(nLen%4==0,
+ "number of channels no multiple of 4",
+ static_cast<rendering::XColorSpace*>(this), 0);
+
+ uno::Sequence< rendering::RGBColor > aRes(nLen/4);
+ rendering::RGBColor* pOut( aRes.getArray() );
+ for( sal_Size i=0; i<nLen; i+=4 )
+ {
+ *pOut++ = rendering::RGBColor(pIn[0],pIn[1],pIn[2]);
+ pIn += 4;
+ }
+ return aRes;
+ }
+ virtual uno::Sequence< rendering::ARGBColor > SAL_CALL convertToARGB( const uno::Sequence< double >& deviceColor ) throw (lang::IllegalArgumentException, uno::RuntimeException)
+ {
+ const double* pIn( deviceColor.getConstArray() );
+ const sal_Size nLen( deviceColor.getLength() );
+ ENSURE_ARG_OR_THROW2(nLen%4==0,
+ "number of channels no multiple of 4",
+ static_cast<rendering::XColorSpace*>(this), 0);
+
+ uno::Sequence< rendering::ARGBColor > aRes(nLen/4);
+ rendering::ARGBColor* pOut( aRes.getArray() );
+ for( sal_Size i=0; i<nLen; i+=4 )
+ {
+ *pOut++ = rendering::ARGBColor(1.0,pIn[0],pIn[1],pIn[2]);
+ pIn += 4;
+ }
+ return aRes;
+ }
+ virtual uno::Sequence< rendering::ARGBColor > SAL_CALL convertToPARGB( const uno::Sequence< double >& deviceColor ) throw (lang::IllegalArgumentException, uno::RuntimeException)
+ {
+ const double* pIn( deviceColor.getConstArray() );
+ const sal_Size nLen( deviceColor.getLength() );
+ ENSURE_ARG_OR_THROW2(nLen%4==0,
+ "number of channels no multiple of 4",
+ static_cast<rendering::XColorSpace*>(this), 0);
+
+ uno::Sequence< rendering::ARGBColor > aRes(nLen/4);
+ rendering::ARGBColor* pOut( aRes.getArray() );
+ for( sal_Size i=0; i<nLen; i+=4 )
+ {
+ *pOut++ = rendering::ARGBColor(1.0,pIn[0],pIn[1],pIn[2]);
+ pIn += 4;
+ }
+ return aRes;
+ }
+ virtual uno::Sequence< double > SAL_CALL convertFromRGB( const uno::Sequence< rendering::RGBColor >& rgbColor ) throw (lang::IllegalArgumentException, uno::RuntimeException)
+ {
+ const rendering::RGBColor* pIn( rgbColor.getConstArray() );
+ const sal_Size nLen( rgbColor.getLength() );
+
+ uno::Sequence< double > aRes(nLen*4);
+ double* pColors=aRes.getArray();
+ for( sal_Size i=0; i<nLen; ++i )
+ {
+ *pColors++ = pIn->Red;
+ *pColors++ = pIn->Green;
+ *pColors++ = pIn->Blue;
+ *pColors++ = 1.0; // the value does not matter
+ ++pIn;
+ }
+ return aRes;
+ }
+ virtual uno::Sequence< double > SAL_CALL convertFromARGB( const uno::Sequence< rendering::ARGBColor >& rgbColor ) throw (lang::IllegalArgumentException, uno::RuntimeException)
+ {
+ const rendering::ARGBColor* pIn( rgbColor.getConstArray() );
+ const sal_Size nLen( rgbColor.getLength() );
+
+ uno::Sequence< double > aRes(nLen*4);
+ double* pColors=aRes.getArray();
+ for( sal_Size i=0; i<nLen; ++i )
+ {
+ *pColors++ = pIn->Red;
+ *pColors++ = pIn->Green;
+ *pColors++ = pIn->Blue;
+ *pColors++ = 1.0; // the value does not matter
+ ++pIn;
+ }
+ return aRes;
+ }
+ virtual uno::Sequence< double > SAL_CALL convertFromPARGB( const uno::Sequence< rendering::ARGBColor >& rgbColor ) throw (lang::IllegalArgumentException, uno::RuntimeException)
+ {
+ const rendering::ARGBColor* pIn( rgbColor.getConstArray() );
+ const sal_Size nLen( rgbColor.getLength() );
+
+ uno::Sequence< double > aRes(nLen*4);
+ double* pColors=aRes.getArray();
+ for( sal_Size i=0; i<nLen; ++i )
+ {
+ *pColors++ = pIn->Red/pIn->Alpha;
+ *pColors++ = pIn->Green/pIn->Alpha;
+ *pColors++ = pIn->Blue/pIn->Alpha;
+ *pColors++ = 1.0; // the value does not matter
+ ++pIn;
+ }
+ return aRes;
+ }
+
+ // XIntegerBitmapColorSpace
+ virtual ::sal_Int32 SAL_CALL getBitsPerPixel( ) throw (uno::RuntimeException)
+ {
+ return 32;
+ }
+ virtual uno::Sequence< ::sal_Int32 > SAL_CALL getComponentBitCounts( ) throw (uno::RuntimeException)
+ {
+ return maBitCounts;
+ }
+ virtual ::sal_Int8 SAL_CALL getEndianness( ) throw (uno::RuntimeException)
+ {
+ return util::Endianness::LITTLE;
+ }
+ virtual uno::Sequence<double> SAL_CALL convertFromIntegerColorSpace( const uno::Sequence< ::sal_Int8 >& deviceColor,
+ const uno::Reference< rendering::XColorSpace >& targetColorSpace ) throw (lang::IllegalArgumentException,
+ uno::RuntimeException)
+ {
+ if( dynamic_cast<StandardNoAlphaColorSpace*>(targetColorSpace.get()) )
+ {
+ const sal_Int8* pIn( deviceColor.getConstArray() );
+ const sal_Size nLen( deviceColor.getLength() );
+ ENSURE_ARG_OR_THROW2(nLen%4==0,
+ "number of channels no multiple of 4",
+ static_cast<rendering::XColorSpace*>(this), 0);
+
+ uno::Sequence<double> aRes(nLen);
+ double* pOut( aRes.getArray() );
+ for( sal_Size i=0; i<nLen; i+=4 )
+ {
+ *pOut++ = vcl::unotools::toDoubleColor(*pIn++);
+ *pOut++ = vcl::unotools::toDoubleColor(*pIn++);
+ *pOut++ = vcl::unotools::toDoubleColor(*pIn++);
+ *pOut++ = 1.0;
+ }
+ return aRes;
+ }
+ else
+ {
+ // TODO(P3): if we know anything about target
+ // colorspace, this can be greatly sped up
+ uno::Sequence<rendering::ARGBColor> aIntermediate(
+ convertIntegerToARGB(deviceColor));
+ return targetColorSpace->convertFromARGB(aIntermediate);
+ }
+ }
+ virtual uno::Sequence< ::sal_Int8 > SAL_CALL convertToIntegerColorSpace( const uno::Sequence< ::sal_Int8 >& deviceColor,
+ const uno::Reference< rendering::XIntegerBitmapColorSpace >& targetColorSpace ) throw (lang::IllegalArgumentException,
+ uno::RuntimeException)
+ {
+ if( dynamic_cast<StandardNoAlphaColorSpace*>(targetColorSpace.get()) )
+ {
+ // it's us, so simply pass-through the data
+ return deviceColor;
+ }
+ else
+ {
+ // TODO(P3): if we know anything about target
+ // colorspace, this can be greatly sped up
+ uno::Sequence<rendering::ARGBColor> aIntermediate(
+ convertIntegerToARGB(deviceColor));
+ return targetColorSpace->convertIntegerFromARGB(aIntermediate);
+ }
+ }
+ virtual uno::Sequence< rendering::RGBColor > SAL_CALL convertIntegerToRGB( const uno::Sequence< ::sal_Int8 >& deviceColor ) throw (lang::IllegalArgumentException, uno::RuntimeException)
+ {
+ const sal_Int8* pIn( deviceColor.getConstArray() );
+ const sal_Size nLen( deviceColor.getLength() );
+ ENSURE_ARG_OR_THROW2(nLen%4==0,
+ "number of channels no multiple of 4",
+ static_cast<rendering::XColorSpace*>(this), 0);
+
+ uno::Sequence< rendering::RGBColor > aRes(nLen/4);
+ rendering::RGBColor* pOut( aRes.getArray() );
+ for( sal_Size i=0; i<nLen; i+=4 )
+ {
+ *pOut++ = rendering::RGBColor(
+ vcl::unotools::toDoubleColor(pIn[0]),
+ vcl::unotools::toDoubleColor(pIn[1]),
+ vcl::unotools::toDoubleColor(pIn[2]));
+ pIn += 4;
+ }
+ return aRes;
+ }
+
+ virtual uno::Sequence< rendering::ARGBColor > SAL_CALL convertIntegerToARGB( const uno::Sequence< ::sal_Int8 >& deviceColor ) throw (lang::IllegalArgumentException, uno::RuntimeException)
+ {
+ const sal_Int8* pIn( deviceColor.getConstArray() );
+ const sal_Size nLen( deviceColor.getLength() );
+ ENSURE_ARG_OR_THROW2(nLen%4==0,
+ "number of channels no multiple of 4",
+ static_cast<rendering::XColorSpace*>(this), 0);
+
+ uno::Sequence< rendering::ARGBColor > aRes(nLen/4);
+ rendering::ARGBColor* pOut( aRes.getArray() );
+ for( sal_Size i=0; i<nLen; i+=4 )
+ {
+ *pOut++ = rendering::ARGBColor(
+ 1.0,
+ vcl::unotools::toDoubleColor(pIn[0]),
+ vcl::unotools::toDoubleColor(pIn[1]),
+ vcl::unotools::toDoubleColor(pIn[2]));
+ pIn += 4;
+ }
+ return aRes;
+ }
+
+ virtual uno::Sequence< rendering::ARGBColor > SAL_CALL convertIntegerToPARGB( const uno::Sequence< ::sal_Int8 >& deviceColor ) throw (lang::IllegalArgumentException, uno::RuntimeException)
+ {
+ const sal_Int8* pIn( deviceColor.getConstArray() );
+ const sal_Size nLen( deviceColor.getLength() );
+ ENSURE_ARG_OR_THROW2(nLen%4==0,
+ "number of channels no multiple of 4",
+ static_cast<rendering::XColorSpace*>(this), 0);
+
+ uno::Sequence< rendering::ARGBColor > aRes(nLen/4);
+ rendering::ARGBColor* pOut( aRes.getArray() );
+ for( sal_Size i=0; i<nLen; i+=4 )
+ {
+ *pOut++ = rendering::ARGBColor(
+ 1.0,
+ vcl::unotools::toDoubleColor(pIn[0]),
+ vcl::unotools::toDoubleColor(pIn[1]),
+ vcl::unotools::toDoubleColor(pIn[2]));
+ pIn += 4;
+ }
+ return aRes;
+ }
+
+ virtual uno::Sequence< ::sal_Int8 > SAL_CALL convertIntegerFromRGB( const uno::Sequence< rendering::RGBColor >& rgbColor ) throw (lang::IllegalArgumentException, uno::RuntimeException)
+ {
+ const rendering::RGBColor* pIn( rgbColor.getConstArray() );
+ const sal_Size nLen( rgbColor.getLength() );
+
+ uno::Sequence< sal_Int8 > aRes(nLen*4);
+ sal_Int8* pColors=aRes.getArray();
+ for( sal_Size i=0; i<nLen; ++i )
+ {
+ *pColors++ = vcl::unotools::toByteColor(pIn->Red);
+ *pColors++ = vcl::unotools::toByteColor(pIn->Green);
+ *pColors++ = vcl::unotools::toByteColor(pIn->Blue);
+ *pColors++ = 1.0;
+ ++pIn;
+ }
+ return aRes;
+ }
+
+ virtual uno::Sequence< ::sal_Int8 > SAL_CALL convertIntegerFromARGB( const uno::Sequence< rendering::ARGBColor >& rgbColor ) throw (lang::IllegalArgumentException, uno::RuntimeException)
+ {
+ const rendering::ARGBColor* pIn( rgbColor.getConstArray() );
+ const sal_Size nLen( rgbColor.getLength() );
+
+ uno::Sequence< sal_Int8 > aRes(nLen*4);
+ sal_Int8* pColors=aRes.getArray();
+ for( sal_Size i=0; i<nLen; ++i )
+ {
+ *pColors++ = vcl::unotools::toByteColor(pIn->Red);
+ *pColors++ = vcl::unotools::toByteColor(pIn->Green);
+ *pColors++ = vcl::unotools::toByteColor(pIn->Blue);
+ *pColors++ = 255;
+ ++pIn;
+ }
+ return aRes;
+ }
+
+ virtual uno::Sequence< ::sal_Int8 > SAL_CALL convertIntegerFromPARGB( const uno::Sequence< rendering::ARGBColor >& rgbColor ) throw (lang::IllegalArgumentException, uno::RuntimeException)
+ {
+ const rendering::ARGBColor* pIn( rgbColor.getConstArray() );
+ const sal_Size nLen( rgbColor.getLength() );
+
+ uno::Sequence< sal_Int8 > aRes(nLen*4);
+ sal_Int8* pColors=aRes.getArray();
+ for( sal_Size i=0; i<nLen; ++i )
+ {
+ *pColors++ = vcl::unotools::toByteColor(pIn->Red/pIn->Alpha);
+ *pColors++ = vcl::unotools::toByteColor(pIn->Green/pIn->Alpha);
+ *pColors++ = vcl::unotools::toByteColor(pIn->Blue/pIn->Alpha);
+ *pColors++ = 255;
+ ++pIn;
+ }
+ return aRes;
+ }
+
+ public:
+ StandardNoAlphaColorSpace() :
+ maComponentTags(3),
+ maBitCounts(3)
+ {
+ sal_Int8* pTags = maComponentTags.getArray();
+ sal_Int32* pBitCounts = maBitCounts.getArray();
+ pTags[0] = rendering::ColorComponentTag::RGB_RED;
+ pTags[1] = rendering::ColorComponentTag::RGB_GREEN;
+ pTags[2] = rendering::ColorComponentTag::RGB_BLUE;
+
+ pBitCounts[0] =
+ pBitCounts[1] =
+ pBitCounts[2] = 8;
+ }
+ };
+
struct StandardColorSpaceHolder : public rtl::StaticWithInit<uno::Reference<rendering::XIntegerBitmapColorSpace>,
StandardColorSpaceHolder>
{
@@ -565,6 +899,15 @@ namespace canvas
return new StandardColorSpace();
}
};
+
+ struct StandardNoAlphaColorSpaceHolder : public rtl::StaticWithInit<uno::Reference<rendering::XIntegerBitmapColorSpace>,
+ StandardNoAlphaColorSpaceHolder>
+ {
+ uno::Reference<rendering::XIntegerBitmapColorSpace> operator()()
+ {
+ return new StandardNoAlphaColorSpace();
+ }
+ };
}
uno::Reference<rendering::XIntegerBitmapColorSpace> getStdColorSpace()
@@ -572,6 +915,11 @@ namespace canvas
return StandardColorSpaceHolder::get();
}
+ uno::Reference<rendering::XIntegerBitmapColorSpace> getStdColorSpaceWithoutAlpha()
+ {
+ return StandardNoAlphaColorSpaceHolder::get();
+ }
+
rendering::IntegerBitmapLayout getStdMemoryLayout( const geometry::IntegerSize2D& rBmpSize )
{
rendering::IntegerBitmapLayout aLayout;
diff --git a/canvas/source/vcl/canvasbitmaphelper.cxx b/canvas/source/vcl/canvasbitmaphelper.cxx
index 12e57ec..7b60410 100644
--- a/canvas/source/vcl/canvasbitmaphelper.cxx
+++ b/canvas/source/vcl/canvasbitmaphelper.cxx
@@ -539,7 +539,11 @@ namespace vclcanvas
if( !mpOutDev.get() )
return rendering::IntegerBitmapLayout(); // we're disposed
- return ::canvas::tools::getStdMemoryLayout(getSize());
+ rendering::IntegerBitmapLayout xBitmapLayout( ::canvas::tools::getStdMemoryLayout(getSize()) );
+ if ( !hasAlpha() )
+ xBitmapLayout.ColorSpace = canvas::tools::getStdColorSpaceWithoutAlpha();
+
+ return xBitmapLayout;
}
BitmapEx CanvasBitmapHelper::getBitmap() const
diff --git a/canvas/source/vcl/canvashelper.cxx b/canvas/source/vcl/canvashelper.cxx
index 2454dde..8c393fd 100644
--- a/canvas/source/vcl/canvashelper.cxx
+++ b/canvas/source/vcl/canvashelper.cxx
@@ -1195,7 +1195,11 @@ namespace vclcanvas
if( !mpOutDev.get() )
return rendering::IntegerBitmapLayout(); // we're disposed
- return ::canvas::tools::getStdMemoryLayout(getSize());
+ rendering::IntegerBitmapLayout xBitmapLayout( ::canvas::tools::getStdMemoryLayout(getSize()) );
+ if ( !mbHaveAlpha )
+ xBitmapLayout.ColorSpace = canvas::tools::getStdColorSpaceWithoutAlpha();
+
+ return xBitmapLayout;
}
int CanvasHelper::setupOutDevState( const rendering::ViewState& viewState,
diff --git a/canvas/source/vcl/devicehelper.cxx b/canvas/source/vcl/devicehelper.cxx
index 2d5af8e..c9f7139 100644
--- a/canvas/source/vcl/devicehelper.cxx
+++ b/canvas/source/vcl/devicehelper.cxx
@@ -194,7 +194,9 @@ namespace vclcanvas
{
uno::Reference<rendering::XColorSpace> operator()()
{
- return vcl::unotools::createStandardColorSpace();
+ uno::Reference< rendering::XColorSpace > xColorSpace( canvas::tools::getStdColorSpace(), uno::UNO_QUERY );
+ assert( xColorSpace.is() );
+ return xColorSpace;
}
};
}
diff --git a/slideshow/source/engine/OGLTrans/unx/OGLTrans_TransitionerImpl.cxx b/slideshow/source/engine/OGLTrans/unx/OGLTrans_TransitionerImpl.cxx
index 67db263..03e7c4c 100644
--- a/slideshow/source/engine/OGLTrans/unx/OGLTrans_TransitionerImpl.cxx
+++ b/slideshow/source/engine/OGLTrans/unx/OGLTrans_TransitionerImpl.cxx
@@ -33,6 +33,8 @@
#include <com/sun/star/rendering/IntegerBitmapLayout.hpp>
#include <com/sun/star/rendering/ColorComponentTag.hpp>
#include <com/sun/star/rendering/ColorSpaceType.hpp>
+#include <com/sun/star/rendering/RenderingIntent.hpp>
+#include <com/sun/star/util/Endianness.hpp>
#include <com/sun/star/animations/TransitionType.hpp>
#include <com/sun/star/animations/TransitionSubType.hpp>
#include <com/sun/star/presentation/XTransitionFactory.hpp>
@@ -50,7 +52,11 @@
#include <comphelper/servicedecl.hxx>
#include <canvas/canvastools.hxx>
+
+#include <tools/diagnose_ex.h>
#include <tools/gen.hxx>
+
+#include <vcl/canvastools.hxx>
#include <vcl/window.hxx>
#include <vcl/syschild.hxx>
@@ -915,6 +921,360 @@ void OGLTransitionerImpl::createTexture( unsigned int* texID,
SAL_WARN_IF(!glIsTexture(*texID), "slideshow.opengl", "Can't generate Leaving slide textures in OpenGL");
}
+namespace
+{
+ class OGLColorSpace : public cppu::WeakImplHelper1< com::sun::star::rendering::XIntegerBitmapColorSpace >
+ {
+ private:
+ uno::Sequence< sal_Int8 > maComponentTags;
+ uno::Sequence< sal_Int32 > maBitCounts;
+
+ virtual ::sal_Int8 SAL_CALL getType( ) throw (uno::RuntimeException)
+ {
+ return rendering::ColorSpaceType::RGB;
+ }
+ virtual uno::Sequence< ::sal_Int8 > SAL_CALL getComponentTags( ) throw (uno::RuntimeException)
+ {
+ return maComponentTags;
+ }
+ virtual ::sal_Int8 SAL_CALL getRenderingIntent( ) throw (uno::RuntimeException)
+ {
+ return rendering::RenderingIntent::PERCEPTUAL;
+ }
+ virtual uno::Sequence< beans::PropertyValue > SAL_CALL getProperties( ) throw (uno::RuntimeException)
+ {
+ return uno::Sequence< beans::PropertyValue >();
+ }
+ virtual uno::Sequence< double > SAL_CALL convertColorSpace( const uno::Sequence< double >& deviceColor,
+ const uno::Reference< rendering::XColorSpace >& targetColorSpace ) throw (lang::IllegalArgumentException,
+ uno::RuntimeException)
+ {
+ // TODO(P3): if we know anything about target
+ // colorspace, this can be greatly sped up
+ uno::Sequence<rendering::ARGBColor> aIntermediate(
+ convertToARGB(deviceColor));
+ return targetColorSpace->convertFromARGB(aIntermediate);
+ }
+ virtual uno::Sequence< rendering::RGBColor > SAL_CALL convertToRGB( const uno::Sequence< double >& deviceColor ) throw (lang::IllegalArgumentException, uno::RuntimeException)
+ {
+ const double* pIn( deviceColor.getConstArray() );
+ const sal_Size nLen( deviceColor.getLength() );
+ ENSURE_ARG_OR_THROW2(nLen%4==0,
+ "number of channels no multiple of 4",
+ static_cast<rendering::XColorSpace*>(this), 0);
+
+ uno::Sequence< rendering::RGBColor > aRes(nLen/4);
+ rendering::RGBColor* pOut( aRes.getArray() );
+ for( sal_Size i=0; i<nLen; i+=4 )
+ {
+ *pOut++ = rendering::RGBColor(pIn[0],pIn[1],pIn[2]);
+ pIn += 4;
+ }
+ return aRes;
+ }
+ virtual uno::Sequence< rendering::ARGBColor > SAL_CALL convertToARGB( const uno::Sequence< double >& deviceColor ) throw (lang::IllegalArgumentException, uno::RuntimeException)
+ {
+ const double* pIn( deviceColor.getConstArray() );
+ const sal_Size nLen( deviceColor.getLength() );
+ ENSURE_ARG_OR_THROW2(nLen%4==0,
+ "number of channels no multiple of 4",
+ static_cast<rendering::XColorSpace*>(this), 0);
+
+ uno::Sequence< rendering::ARGBColor > aRes(nLen/4);
+ rendering::ARGBColor* pOut( aRes.getArray() );
+ for( sal_Size i=0; i<nLen; i+=4 )
+ {
+ *pOut++ = rendering::ARGBColor(pIn[3],pIn[0],pIn[1],pIn[2]);
+ pIn += 4;
+ }
+ return aRes;
+ }
+ virtual uno::Sequence< rendering::ARGBColor > SAL_CALL convertToPARGB( const uno::Sequence< double >& deviceColor ) throw (lang::IllegalArgumentException, uno::RuntimeException)
+ {
+ const double* pIn( deviceColor.getConstArray() );
+ const sal_Size nLen( deviceColor.getLength() );
+ ENSURE_ARG_OR_THROW2(nLen%4==0,
+ "number of channels no multiple of 4",
+ static_cast<rendering::XColorSpace*>(this), 0);
+
+ uno::Sequence< rendering::ARGBColor > aRes(nLen/4);
+ rendering::ARGBColor* pOut( aRes.getArray() );
+ for( sal_Size i=0; i<nLen; i+=4 )
+ {
+ *pOut++ = rendering::ARGBColor(pIn[3],pIn[3]*pIn[0],pIn[3]*pIn[1],pIn[3]*pIn[2]);
+ pIn += 4;
+ }
+ return aRes;
+ }
+ virtual uno::Sequence< double > SAL_CALL convertFromRGB( const uno::Sequence< rendering::RGBColor >& rgbColor ) throw (lang::IllegalArgumentException, uno::RuntimeException)
+ {
+ const rendering::RGBColor* pIn( rgbColor.getConstArray() );
+ const sal_Size nLen( rgbColor.getLength() );
+
+ uno::Sequence< double > aRes(nLen*4);
+ double* pColors=aRes.getArray();
+ for( sal_Size i=0; i<nLen; ++i )
+ {
+ *pColors++ = pIn->Red;
+ *pColors++ = pIn->Green;
+ *pColors++ = pIn->Blue;
+ *pColors++ = 1.0;
+ ++pIn;
+ }
+ return aRes;
+ }
+ virtual uno::Sequence< double > SAL_CALL convertFromARGB( const uno::Sequence< rendering::ARGBColor >& rgbColor ) throw (lang::IllegalArgumentException, uno::RuntimeException)
+ {
+ const rendering::ARGBColor* pIn( rgbColor.getConstArray() );
+ const sal_Size nLen( rgbColor.getLength() );
+
+ uno::Sequence< double > aRes(nLen*4);
+ double* pColors=aRes.getArray();
+ for( sal_Size i=0; i<nLen; ++i )
+ {
+ *pColors++ = pIn->Red;
+ *pColors++ = pIn->Green;
+ *pColors++ = pIn->Blue;
+ *pColors++ = pIn->Alpha;
+ ++pIn;
+ }
+ return aRes;
+ }
+ virtual uno::Sequence< double > SAL_CALL convertFromPARGB( const uno::Sequence< rendering::ARGBColor >& rgbColor ) throw (lang::IllegalArgumentException, uno::RuntimeException)
+ {
+ const rendering::ARGBColor* pIn( rgbColor.getConstArray() );
+ const sal_Size nLen( rgbColor.getLength() );
+
+ uno::Sequence< double > aRes(nLen*4);
+ double* pColors=aRes.getArray();
+ for( sal_Size i=0; i<nLen; ++i )
+ {
+ *pColors++ = pIn->Red/pIn->Alpha;
+ *pColors++ = pIn->Green/pIn->Alpha;
+ *pColors++ = pIn->Blue/pIn->Alpha;
+ *pColors++ = pIn->Alpha;
+ ++pIn;
+ }
+ return aRes;
+ }
+
+ // XIntegerBitmapColorSpace
+ virtual ::sal_Int32 SAL_CALL getBitsPerPixel( ) throw (uno::RuntimeException)
+ {
+ return 32;
+ }
+ virtual uno::Sequence< ::sal_Int32 > SAL_CALL getComponentBitCounts( ) throw (uno::RuntimeException)
+ {
+ return maBitCounts;
+ }
+ virtual ::sal_Int8 SAL_CALL getEndianness( ) throw (uno::RuntimeException)
+ {
+ return util::Endianness::LITTLE;
+ }
+ virtual uno::Sequence<double> SAL_CALL convertFromIntegerColorSpace( const uno::Sequence< ::sal_Int8 >& deviceColor,
+ const uno::Reference< rendering::XColorSpace >& targetColorSpace ) throw (lang::IllegalArgumentException,
+ uno::RuntimeException)
+ {
+ if( dynamic_cast<OGLColorSpace*>(targetColorSpace.get()) )
+ {
+ const sal_Int8* pIn( deviceColor.getConstArray() );
+ const sal_Size nLen( deviceColor.getLength() );
+ ENSURE_ARG_OR_THROW2(nLen%4==0,
+ "number of channels no multiple of 4",
+ static_cast<rendering::XColorSpace*>(this), 0);
+
+ uno::Sequence<double> aRes(nLen);
+ double* pOut( aRes.getArray() );
+ for( sal_Size i=0; i<nLen; i+=4 )
+ {
+ *pOut++ = vcl::unotools::toDoubleColor(*pIn++);
+ *pOut++ = vcl::unotools::toDoubleColor(*pIn++);
+ *pOut++ = vcl::unotools::toDoubleColor(*pIn++);
+ *pOut++ = vcl::unotools::toDoubleColor(*pIn++);
+ }
+ return aRes;
+ }
+ else
+ {
+ // TODO(P3): if we know anything about target
+ // colorspace, this can be greatly sped up
+ uno::Sequence<rendering::ARGBColor> aIntermediate(
+ convertIntegerToARGB(deviceColor));
+ return targetColorSpace->convertFromARGB(aIntermediate);
+ }
+ }
+ virtual uno::Sequence< ::sal_Int8 > SAL_CALL convertToIntegerColorSpace( const uno::Sequence< ::sal_Int8 >& deviceColor,
+ const uno::Reference< rendering::XIntegerBitmapColorSpace >& targetColorSpace ) throw (lang::IllegalArgumentException,
+ uno::RuntimeException)
+ {
+ if( dynamic_cast<OGLColorSpace*>(targetColorSpace.get()) )
+ {
+ // it's us, so simply pass-through the data
+ return deviceColor;
+ }
+ else
+ {
+ // TODO(P3): if we know anything about target
+ // colorspace, this can be greatly sped up
+ uno::Sequence<rendering::ARGBColor> aIntermediate(
+ convertIntegerToARGB(deviceColor));
+ return targetColorSpace->convertIntegerFromARGB(aIntermediate);
+ }
+ }
+ virtual uno::Sequence< rendering::RGBColor > SAL_CALL convertIntegerToRGB( const uno::Sequence< ::sal_Int8 >& deviceColor ) throw (lang::IllegalArgumentException, uno::RuntimeException)
+ {
+ const sal_Int8* pIn( deviceColor.getConstArray() );
+ const sal_Size nLen( deviceColor.getLength() );
+ ENSURE_ARG_OR_THROW2(nLen%4==0,
+ "number of channels no multiple of 4",
+ static_cast<rendering::XColorSpace*>(this), 0);
+
+ uno::Sequence< rendering::RGBColor > aRes(nLen/4);
+ rendering::RGBColor* pOut( aRes.getArray() );
+ for( sal_Size i=0; i<nLen; i+=4 )
+ {
+ *pOut++ = rendering::RGBColor(
+ vcl::unotools::toDoubleColor(pIn[0]),
+ vcl::unotools::toDoubleColor(pIn[1]),
+ vcl::unotools::toDoubleColor(pIn[2]));
+ pIn += 4;
+ }
+ return aRes;
+ }
+
+ virtual uno::Sequence< rendering::ARGBColor > SAL_CALL convertIntegerToARGB( const uno::Sequence< ::sal_Int8 >& deviceColor ) throw (lang::IllegalArgumentException, uno::RuntimeException)
+ {
+ const sal_Int8* pIn( deviceColor.getConstArray() );
+ const sal_Size nLen( deviceColor.getLength() );
+ ENSURE_ARG_OR_THROW2(nLen%4==0,
+ "number of channels no multiple of 4",
+ static_cast<rendering::XColorSpace*>(this), 0);
+
+ uno::Sequence< rendering::ARGBColor > aRes(nLen/4);
+ rendering::ARGBColor* pOut( aRes.getArray() );
+ for( sal_Size i=0; i<nLen; i+=4 )
+ {
+ *pOut++ = rendering::ARGBColor(
+ vcl::unotools::toDoubleColor(pIn[3]),
+ vcl::unotools::toDoubleColor(pIn[0]),
+ vcl::unotools::toDoubleColor(pIn[1]),
+ vcl::unotools::toDoubleColor(pIn[2]));
+ pIn += 4;
+ }
+ return aRes;
+ }
+
+ virtual uno::Sequence< rendering::ARGBColor > SAL_CALL convertIntegerToPARGB( const uno::Sequence< ::sal_Int8 >& deviceColor ) throw (lang::IllegalArgumentException, uno::RuntimeException)
+ {
+ const sal_Int8* pIn( deviceColor.getConstArray() );
+ const sal_Size nLen( deviceColor.getLength() );
+ ENSURE_ARG_OR_THROW2(nLen%4==0,
+ "number of channels no multiple of 4",
+ static_cast<rendering::XColorSpace*>(this), 0);
+
+ uno::Sequence< rendering::ARGBColor > aRes(nLen/4);
+ rendering::ARGBColor* pOut( aRes.getArray() );
+ for( sal_Size i=0; i<nLen; i+=4 )
+ {
+ const sal_Int8 nAlpha( pIn[3] );
+ *pOut++ = rendering::ARGBColor(
+ vcl::unotools::toDoubleColor(nAlpha),
+ vcl::unotools::toDoubleColor(nAlpha*pIn[0]),
+ vcl::unotools::toDoubleColor(nAlpha*pIn[1]),
+ vcl::unotools::toDoubleColor(nAlpha*pIn[2]));
+ pIn += 4;
+ }
+ return aRes;
+ }
+
+ virtual uno::Sequence< ::sal_Int8 > SAL_CALL convertIntegerFromRGB( const uno::Sequence< rendering::RGBColor >& rgbColor ) throw (lang::IllegalArgumentException, uno::RuntimeException)
+ {
+ const rendering::RGBColor* pIn( rgbColor.getConstArray() );
+ const sal_Size nLen( rgbColor.getLength() );
+
+ uno::Sequence< sal_Int8 > aRes(nLen*4);
+ sal_Int8* pColors=aRes.getArray();
+ for( sal_Size i=0; i<nLen; ++i )
+ {
+ *pColors++ = vcl::unotools::toByteColor(pIn->Red);
+ *pColors++ = vcl::unotools::toByteColor(pIn->Green);
+ *pColors++ = vcl::unotools::toByteColor(pIn->Blue);
+ *pColors++ = 255;
+ ++pIn;
+ }
+ return aRes;
+ }
+
+ virtual uno::Sequence< ::sal_Int8 > SAL_CALL convertIntegerFromARGB( const uno::Sequence< rendering::ARGBColor >& rgbColor ) throw (lang::IllegalArgumentException, uno::RuntimeException)
+ {
+ const rendering::ARGBColor* pIn( rgbColor.getConstArray() );
+ const sal_Size nLen( rgbColor.getLength() );
+
+ uno::Sequence< sal_Int8 > aRes(nLen*4);
+ sal_Int8* pColors=aRes.getArray();
+ for( sal_Size i=0; i<nLen; ++i )
+ {
+ *pColors++ = vcl::unotools::toByteColor(pIn->Red);
+ *pColors++ = vcl::unotools::toByteColor(pIn->Green);
+ *pColors++ = vcl::unotools::toByteColor(pIn->Blue);
+ *pColors++ = vcl::unotools::toByteColor(pIn->Alpha);
+ ++pIn;
+ }
+ return aRes;
+ }
+
+ virtual uno::Sequence< ::sal_Int8 > SAL_CALL convertIntegerFromPARGB( const uno::Sequence< rendering::ARGBColor >& rgbColor ) throw (lang::IllegalArgumentException, uno::RuntimeException)
+ {
+ const rendering::ARGBColor* pIn( rgbColor.getConstArray() );
+ const sal_Size nLen( rgbColor.getLength() );
+
+ uno::Sequence< sal_Int8 > aRes(nLen*4);
+ sal_Int8* pColors=aRes.getArray();
+ for( sal_Size i=0; i<nLen; ++i )
+ {
+ *pColors++ = vcl::unotools::toByteColor(pIn->Red/pIn->Alpha);
+ *pColors++ = vcl::unotools::toByteColor(pIn->Green/pIn->Alpha);
+ *pColors++ = vcl::unotools::toByteColor(pIn->Blue/pIn->Alpha);
+ *pColors++ = vcl::unotools::toByteColor(pIn->Alpha);
+ ++pIn;
+ }
+ return aRes;
+ }
+
+ public:
+ OGLColorSpace() :
+ maComponentTags(4),
+ maBitCounts(4)
+ {
+ sal_Int8* pTags = maComponentTags.getArray();
+ sal_Int32* pBitCounts = maBitCounts.getArray();
+ pTags[0] = rendering::ColorComponentTag::RGB_RED;
+ pTags[1] = rendering::ColorComponentTag::RGB_GREEN;
+ pTags[2] = rendering::ColorComponentTag::RGB_BLUE;
+ pTags[3] = rendering::ColorComponentTag::ALPHA;
+
+ pBitCounts[0] =
+ pBitCounts[1] =
+ pBitCounts[2] =
+ pBitCounts[3] = 8;
+ }
+ };
+
+ struct OGLColorSpaceHolder : public rtl::StaticWithInit<uno::Reference<rendering::XIntegerBitmapColorSpace>, OGLColorSpaceHolder>
+ {
+ uno::Reference<rendering::XIntegerBitmapColorSpace> operator()()
+ {
+ return new OGLColorSpace();
+ }
+ };
+
+ uno::Reference<rendering::XIntegerBitmapColorSpace>
+ getOGLColorSpace()
+ {
+ return OGLColorSpaceHolder::get();
+ }
+}
+
void OGLTransitionerImpl::impl_createTexture(
bool useMipmap,
uno::Sequence<sal_Int8>& data,
@@ -926,7 +1286,7 @@ void OGLTransitionerImpl::impl_createTexture(
uno::Sequence<sal_Int8> tempBytes(
SlideBitmapLayout.ColorSpace->convertToIntegerColorSpace(
data,
- canvas::tools::getStdColorSpace()));
+ getOGLColorSpace()));
gluBuild2DMipmaps(GL_TEXTURE_2D,
4,
SlideSize.Width,
@@ -1085,7 +1445,10 @@ const OGLFormat* OGLTransitionerImpl::chooseFormats()
}
break;
case 32:
- pDetectedFormat = &lcl_ARGB32[nComponentOrderIndex];
+ if ( nNumComponents == 4 )
+ {
+ pDetectedFormat = &lcl_ARGB32[nComponentOrderIndex];
+ }
break;
}
}
commit e02f655318c14e58b151c9be0109f3100c38f876
Author: David Tardon <dtardon at redhat.com>
Date: Mon Nov 12 12:35:45 2012 +0100
fix Fade Smoothly transition
Change-Id: I833bd800491bce81ccaef97d9320a4df10aaff79
diff --git a/slideshow/source/engine/transitions/slidetransitionfactory.cxx b/slideshow/source/engine/transitions/slidetransitionfactory.cxx
index 60ea705..057c96e 100644
--- a/slideshow/source/engine/transitions/slidetransitionfactory.cxx
+++ b/slideshow/source/engine/transitions/slidetransitionfactory.cxx
@@ -1092,13 +1092,14 @@ NumberAnimationSharedPtr TransitionFactory::createSlideTransition(
{
// black page:
boost::optional<SlideSharedPtr> leavingSlide;
+ boost::optional<RGBColor> aFadeColor;
switch( nTransitionSubType )
{
case animations::TransitionSubType::CROSSFADE:
// crossfade needs no further setup,
- // just blend new slide over existing
- // background.
+ // just blend new slide over current
+ // slide.
break;
// TODO(F1): Implement toColor/fromColor fades
@@ -1112,6 +1113,7 @@ NumberAnimationSharedPtr TransitionFactory::createSlideTransition(
// effect really needs it.
leavingSlide.reset( pLeavingSlide );
}
+ aFadeColor = rTransitionFadeColor;
break;
default:
@@ -1124,8 +1126,7 @@ NumberAnimationSharedPtr TransitionFactory::createSlideTransition(
new FadingSlideChange(
leavingSlide,
pEnteringSlide,
- comphelper::make_optional(
- rTransitionFadeColor),
+ aFadeColor,
pSoundPlayer,
rViewContainer,
rScreenUpdater,
commit d6ce23bbf2ea9a326eb377e6fcef3f6034c9c31a
Author: David Tardon <dtardon at redhat.com>
Date: Tue Nov 6 14:54:36 2012 +0100
refactor OpenGL transition creation
Change-Id: I1f2de591906f3560cc60d1323e8dcfb66448f4eb
diff --git a/slideshow/source/engine/OGLTrans/unx/OGLTrans_TransitionImpl.cxx b/slideshow/source/engine/OGLTrans/unx/OGLTrans_TransitionImpl.cxx
index 5bbedb6..14b999a 100644
--- a/slideshow/source/engine/OGLTrans/unx/OGLTrans_TransitionImpl.cxx
+++ b/slideshow/source/engine/OGLTrans/unx/OGLTrans_TransitionImpl.cxx
@@ -26,71 +26,87 @@
*
************************************************************************/
+#include <utility>
+
+#include <boost/make_shared.hpp>
+
#include "OGLTrans_TransitionImpl.hxx"
#include "OGLTrans_Shaders.hxx"
#include <GL/gl.h>
#include <math.h>
+using boost::make_shared;
+using boost::shared_ptr;
-void OGLTransitionImpl::clear()
+using std::max;
+using std::min;
+using std::vector;
+
+TransitionScene::TransitionScene(TransitionScene const& rOther)
+ : maLeavingSlidePrimitives(rOther.maLeavingSlidePrimitives)
+ , maEnteringSlidePrimitives(rOther.maEnteringSlidePrimitives)
+ , maOverallOperations(rOther.maOverallOperations)
+ , maSceneObjects(rOther.maSceneObjects)
{
- for(unsigned int i( 0 ); i < OverallOperations.size(); ++i)
- delete OverallOperations[i];
- OverallOperations.clear();
- maLeavingSlidePrimitives.clear();
- maEnteringSlidePrimitives.clear();
- for(unsigned int i(0); i < maSceneObjects.size(); ++i)
- delete maSceneObjects[i];
- maSceneObjects.clear();
+}
- mbReflectSlides = false;
+TransitionScene& TransitionScene::operator=(const TransitionScene& rOther)
+{
+ TransitionScene aTmp(rOther);
+ swap(aTmp);
+ return *this;
+}
-#ifdef GL_VERSION_2_0
- if( mProgramObject ) {
- OGLShaders::glDeleteProgram( mProgramObject );
- mProgramObject = 0;
- }
+void TransitionScene::swap(TransitionScene& rOther)
+{
+ using std::swap;
- if( mVertexObject ) {
- OGLShaders::glDeleteShader( mVertexObject );
- mVertexObject = 0;
- }
+ swap(maLeavingSlidePrimitives, rOther.maLeavingSlidePrimitives);
+ swap(maEnteringSlidePrimitives, rOther.maEnteringSlidePrimitives);
+ swap(maOverallOperations, rOther.maOverallOperations);
+ swap(maSceneObjects, rOther.maSceneObjects);
+}
- if( mFragmentObject ) {
- OGLShaders::glDeleteShader( mFragmentObject );
- mFragmentObject = 0;
- }
-#endif
+void TransitionScene::clear()
+{
+ maLeavingSlidePrimitives.clear();
+ maEnteringSlidePrimitives.clear();
+ maOverallOperations.clear();
+ maSceneObjects.clear();
+}
- if( maHelperTexture ) {
- glDeleteTextures( 1, &maHelperTexture );
- maHelperTexture = 0;
- }
+OGLTransitionImpl::~OGLTransitionImpl()
+{
+}
- if( mmClearTransition )
- (this->*mmClearTransition)();
+void OGLTransitionImpl::setScene(TransitionScene const& rScene)
+{
+ maScene = rScene;
}
-OGLTransitionImpl::~OGLTransitionImpl()
+void OGLTransitionImpl::clearScene()
{
- clear();
+ maScene.clear();
}
void OGLTransitionImpl::prepare( ::sal_Int32 glLeavingSlideTex, ::sal_Int32 glEnteringSlideTex )
{
- for(unsigned int i(0); i < maSceneObjects.size(); ++i) {
- maSceneObjects[i]->prepare();
+ const SceneObjects_t& rSceneObjects(maScene.getSceneObjects());
+ for(unsigned int i(0); i != rSceneObjects.size(); ++i) {
+ rSceneObjects[i]->prepare();
}
- if( mmPrepareTransition )
- (this->*mmPrepareTransition)( glLeavingSlideTex, glEnteringSlideTex );
+ prepareTransition_( glLeavingSlideTex, glEnteringSlideTex );
}
void OGLTransitionImpl::finish()
{
- for(unsigned int i(0); i < maSceneObjects.size(); ++i) {
- maSceneObjects[i]->finish();
+ const SceneObjects_t& rSceneObjects(maScene.getSceneObjects());
+ for(unsigned int i(0); i != rSceneObjects.size(); ++i) {
+ rSceneObjects[i]->finish();
}
+
+ finishTransition_();
}
static void blendSlide( double depth )
@@ -119,7 +135,7 @@ static void blendSlide( double depth )
glEnable( GL_DEPTH_TEST );
}
-static void slideShadow( double nTime, Primitive& primitive, double sw, double sh )
+static void slideShadow( double nTime, const Primitive& primitive, double sw, double sh )
{
double reflectionDepth = 0.3;
@@ -136,33 +152,53 @@ static void slideShadow( double nTime, Primitive& primitive, double sw, double s
glEnable(GL_LIGHTING);
}
+void OGLTransitionImpl::prepare_( double, double, double, double, double )
+{
+}
+
+void OGLTransitionImpl::prepareTransition_( ::sal_Int32, ::sal_Int32 )
+{
+}
+
+void OGLTransitionImpl::finishTransition_()
+{
+}
+
+void OGLTransitionImpl::displaySlides_( double nTime, ::sal_Int32 glLeavingSlideTex, ::sal_Int32 glEnteringSlideTex, double SlideWidthScale, double SlideHeightScale )
+{
+ applyOverallOperations( nTime, SlideWidthScale, SlideHeightScale );
+
+ glEnable(GL_TEXTURE_2D);
+ displaySlide( nTime, glLeavingSlideTex, maScene.getLeavingSlide(), SlideWidthScale, SlideHeightScale );
+ displaySlide( nTime, glEnteringSlideTex, maScene.getEnteringSlide(), SlideWidthScale, SlideHeightScale );
+}
+
void OGLTransitionImpl::display( double nTime, ::sal_Int32 glLeavingSlideTex, ::sal_Int32 glEnteringSlideTex,
double SlideWidth, double SlideHeight, double DispWidth, double DispHeight )
{
- double SlideWidthScale, SlideHeightScale;
+ const double SlideWidthScale = SlideWidth/DispWidth;
+ const double SlideHeightScale = SlideHeight/DispHeight;
- SlideWidthScale = SlideWidth/DispWidth;
- SlideHeightScale = SlideHeight/DispHeight;
-
- if( mmPrepare ) {
- clear();
- (this->*mmPrepare)( nTime, SlideWidth, SlideHeight, DispWidth, DispHeight );
- }
+ prepare_( nTime, SlideWidth, SlideHeight, DispWidth, DispHeight );
glPushMatrix();
- displaySlides( nTime, glLeavingSlideTex, glEnteringSlideTex, SlideWidthScale, SlideHeightScale );
+ displaySlides_( nTime, glLeavingSlideTex, glEnteringSlideTex, SlideWidthScale, SlideHeightScale );
displayScene( nTime, SlideWidth, SlideHeight, DispWidth, DispHeight );
glPopMatrix();
}
void OGLTransitionImpl::applyOverallOperations( double nTime, double SlideWidthScale, double SlideHeightScale )
{
- for(unsigned int i(0); i < OverallOperations.size(); ++i)
- OverallOperations[i]->interpolate(nTime,SlideWidthScale,SlideHeightScale);
+ const Operations_t& rOverallOperations(maScene.getOperations());
+ for(unsigned int i(0); i != rOverallOperations.size(); ++i)
+ rOverallOperations[i]->interpolate(nTime,SlideWidthScale,SlideHeightScale);
}
-void OGLTransitionImpl::displaySlide( double nTime, ::sal_Int32 glSlideTex, std::vector<Primitive>& primitives,
- double SlideWidthScale, double SlideHeightScale )
+void
+OGLTransitionImpl::displaySlide(
+ const double nTime,
+ const ::sal_Int32 glSlideTex, const Primitives_t& primitives,
+ double SlideWidthScale, double SlideHeightScale )
{
//TODO change to foreach
glBindTexture(GL_TEXTURE_2D, glSlideTex);
@@ -170,7 +206,7 @@ void OGLTransitionImpl::displaySlide( double nTime, ::sal_Int32 glSlideTex, std:
// display slide reflection
// note that depth test is turned off while blending the shadow
// so the slides has to be rendered in right order, see rochade as example
- if( mbReflectSlides ) {
+ if( maSettings.mbReflectSlides ) {
double surfaceLevel = -0.04;
/* reflected slides */
@@ -193,28 +229,15 @@ void OGLTransitionImpl::displaySlide( double nTime, ::sal_Int32 glSlideTex, std:
primitives[i].display(nTime, SlideWidthScale, SlideHeightScale);
}
-void OGLTransitionImpl::displaySlides( double nTime, ::sal_Int32 glLeavingSlideTex, ::sal_Int32 glEnteringSlideTex,
- double SlideWidthScale, double SlideHeightScale )
-{
- if( mmDisplaySlides )
- (this->*mmDisplaySlides)( nTime, glLeavingSlideTex, glEnteringSlideTex, SlideWidthScale, SlideHeightScale );
- else {
- applyOverallOperations( nTime, SlideWidthScale, SlideHeightScale );
-
- glEnable(GL_TEXTURE_2D);
- displaySlide( nTime, glLeavingSlideTex, maLeavingSlidePrimitives, SlideWidthScale, SlideHeightScale );
- displaySlide( nTime, glEnteringSlideTex, maEnteringSlidePrimitives, SlideWidthScale, SlideHeightScale );
- }
-}
-
void OGLTransitionImpl::displayScene( double nTime, double SlideWidth, double SlideHeight, double DispWidth, double DispHeight )
{
+ const SceneObjects_t& rSceneObjects(maScene.getSceneObjects());
glEnable(GL_TEXTURE_2D);
- for(unsigned int i(0); i < maSceneObjects.size(); ++i)
- maSceneObjects[i]->display(nTime, SlideWidth, SlideHeight, DispWidth, DispHeight);
+ for(unsigned int i(0); i != rSceneObjects.size(); ++i)
+ rSceneObjects[i]->display(nTime, SlideWidth, SlideHeight, DispWidth, DispHeight);
}
-void Primitive::display(double nTime, double WidthScale, double HeightScale)
+void Primitive::display(double nTime, double WidthScale, double HeightScale) const
{
glPushMatrix();
@@ -233,21 +256,14 @@ void Primitive::display(double nTime, double WidthScale, double HeightScale)
glPopMatrix();
}
-void Primitive::applyOperations(double nTime, double WidthScale, double HeightScale)
+void Primitive::applyOperations(double nTime, double WidthScale, double HeightScale) const
{
for(unsigned int i(0); i < Operations.size(); ++i)
Operations[i]->interpolate( nTime ,WidthScale,HeightScale);
glScaled(WidthScale,HeightScale,1);
}
-Primitive::~Primitive()
-{
- for(unsigned int i( 0 ); i < Operations.size(); ++i)
- delete Operations[i];
-}
-
-
-void SceneObject::display(double nTime, double /* SlideWidth */, double /* SlideHeight */, double DispWidth, double DispHeight )
+void SceneObject::display(double nTime, double /* SlideWidth */, double /* SlideHeight */, double DispWidth, double DispHeight ) const
{
for(unsigned int i(0); i < maPrimitives.size(); ++i) {
// fixme: allow various model spaces, now we make it so that
@@ -281,7 +297,7 @@ Iris::Iris()
{
}
-void Iris::display(double nTime, double SlideWidth, double SlideHeight, double DispWidth, double DispHeight )
+void Iris::display(double nTime, double SlideWidth, double SlideHeight, double DispWidth, double DispHeight ) const
{
glBindTexture(GL_TEXTURE_2D, maTexture);
SceneObject::display(nTime, SlideWidth, SlideHeight, DispWidth, DispHeight);
@@ -305,103 +321,194 @@ void Iris::finish()
glDeleteTextures(1, &maTexture);
}
-void OGLTransitionImpl::makeOutsideCubeFaceToLeft()
+namespace
+{
+
+class SimpleTransition : public OGLTransitionImpl
+{
+public:
+ SimpleTransition()
+ : OGLTransitionImpl()
+ {
+ }
+
+ SimpleTransition(const TransitionScene& rScene, const TransitionSettings& rSettings)
+ : OGLTransitionImpl(rScene, rSettings)
+ {
+ }
+};
+
+shared_ptr<OGLTransitionImpl>
+makeSimpleTransition()
+{
+ return make_shared<SimpleTransition>();
+}
+
+shared_ptr<OGLTransitionImpl>
+makeSimpleTransition(
+ const Primitives_t& rLeavingSlidePrimitives,
+ const Primitives_t& rEnteringSlidePrimitives,
+ const Operations_t& rOverallOperations,
+ const SceneObjects_t& rSceneObjects,
+ const TransitionSettings& rSettings = TransitionSettings())
+{
+ return make_shared<SimpleTransition>(
+ TransitionScene(rLeavingSlidePrimitives, rEnteringSlidePrimitives, rOverallOperations, rSceneObjects),
+ rSettings)
+ ;
+}
+
+shared_ptr<OGLTransitionImpl>
+makeSimpleTransition(
+ const Primitives_t& rLeavingSlidePrimitives,
+ const Primitives_t& rEnteringSlidePrimitives,
+ const Operations_t& rOverallOperations,
+ const TransitionSettings& rSettings = TransitionSettings())
+{
+ return makeSimpleTransition(rLeavingSlidePrimitives, rEnteringSlidePrimitives, rOverallOperations, SceneObjects_t(), rSettings);
+}
+
+shared_ptr<OGLTransitionImpl>
+makeSimpleTransition(
+ const Primitives_t& rLeavingSlidePrimitives,
+ const Primitives_t& rEnteringSlidePrimitives,
+ const SceneObjects_t& rSceneObjects,
+ const TransitionSettings& rSettings = TransitionSettings())
+{
+ return makeSimpleTransition(rLeavingSlidePrimitives, rEnteringSlidePrimitives, Operations_t(), rSceneObjects, rSettings);
+}
+
+shared_ptr<OGLTransitionImpl>
+makeSimpleTransition(
+ const Primitives_t& rLeavingSlidePrimitives,
+ const Primitives_t& rEnteringSlidePrimitives,
+ const TransitionSettings& rSettings = TransitionSettings())
+{
+ return makeSimpleTransition(rLeavingSlidePrimitives, rEnteringSlidePrimitives, Operations_t(), SceneObjects_t(), rSettings);
+}
+
+}
+
+boost::shared_ptr<OGLTransitionImpl> makeOutsideCubeFaceToLeft()
{
- clear();
Primitive Slide;
Slide.pushTriangle(basegfx::B2DVector(0,0),basegfx::B2DVector(1,0),basegfx::B2DVector(0,1));
Slide.pushTriangle(basegfx::B2DVector(1,0),basegfx::B2DVector(0,1),basegfx::B2DVector(1,1));
- maLeavingSlidePrimitives.push_back(Slide);
+ Primitives_t aLeavingPrimitives;
+ aLeavingPrimitives.push_back(Slide);
- Slide.Operations.push_back(new RotateAndScaleDepthByWidth(basegfx::B3DVector(0,1,0),basegfx::B3DVector(0,0,-1),90,false,0.0,1.0));
+ Slide.Operations.push_back(makeRotateAndScaleDepthByWidth(basegfx::B3DVector(0,1,0),basegfx::B3DVector(0,0,-1),90,false,0.0,1.0));
- maEnteringSlidePrimitives.push_back(Slide);
+ Primitives_t aEnteringPrimitives;
+ aEnteringPrimitives.push_back(Slide);
- OverallOperations.push_back(new RotateAndScaleDepthByWidth(basegfx::B3DVector(0,1,0),basegfx::B3DVector(0,0,-1),-90,true,0.0,1.0));
+ Operations_t aOperations;
+ aOperations.push_back(makeRotateAndScaleDepthByWidth(basegfx::B3DVector(0,1,0),basegfx::B3DVector(0,0,-1),-90,true,0.0,1.0));
+
+ return makeSimpleTransition(aLeavingPrimitives, aEnteringPrimitives, aOperations);
}
-void OGLTransitionImpl::makeInsideCubeFaceToLeft()
+boost::shared_ptr<OGLTransitionImpl> makeInsideCubeFaceToLeft()
{
- clear();
Primitive Slide;
Slide.pushTriangle(basegfx::B2DVector(0,0),basegfx::B2DVector(1,0),basegfx::B2DVector(0,1));
Slide.pushTriangle(basegfx::B2DVector(1,0),basegfx::B2DVector(0,1),basegfx::B2DVector(1,1));
- maLeavingSlidePrimitives.push_back(Slide);
+ Primitives_t aLeavingPrimitives;
+ aLeavingPrimitives.push_back(Slide);
+
+ Slide.Operations.push_back(makeRotateAndScaleDepthByWidth(basegfx::B3DVector(0,1,0),basegfx::B3DVector(0,0,1),-90,false,0.0,1.0));
- Slide.Operations.push_back(new RotateAndScaleDepthByWidth(basegfx::B3DVector(0,1,0),basegfx::B3DVector(0,0,1),-90,false,0.0,1.0));
+ Primitives_t aEnteringPrimitives;
+ aEnteringPrimitives.push_back(Slide);
- maEnteringSlidePrimitives.push_back(Slide);
+ Operations_t aOperations;
+ aOperations.push_back(makeRotateAndScaleDepthByWidth(basegfx::B3DVector(0,1,0),basegfx::B3DVector(0,0,1),90,true,0.0,1.0));
- OverallOperations.push_back(new RotateAndScaleDepthByWidth(basegfx::B3DVector(0,1,0),basegfx::B3DVector(0,0,1),90,true,0.0,1.0));
+ return makeSimpleTransition(aLeavingPrimitives, aEnteringPrimitives, aOperations);
}
-void OGLTransitionImpl::makeFallLeaving()
+boost::shared_ptr<OGLTransitionImpl> makeFallLeaving()
{
- clear();
Primitive Slide;
Slide.pushTriangle(basegfx::B2DVector(0,0),basegfx::B2DVector(1,0),basegfx::B2DVector(0,1));
Slide.pushTriangle(basegfx::B2DVector(1,0),basegfx::B2DVector(0,1),basegfx::B2DVector(1,1));
- maEnteringSlidePrimitives.push_back(Slide);
- Slide.Operations.push_back(new RotateAndScaleDepthByWidth(basegfx::B3DVector(1,0,0),basegfx::B3DVector(0,-1,0), 90,true,0.0,1.0));
- maLeavingSlidePrimitives.push_back(Slide);
+ Primitives_t aEnteringPrimitives;
+ aEnteringPrimitives.push_back(Slide);
- mbUseMipMapEntering = false;
+ Slide.Operations.push_back(makeRotateAndScaleDepthByWidth(basegfx::B3DVector(1,0,0),basegfx::B3DVector(0,-1,0), 90,true,0.0,1.0));
+ Primitives_t aLeavingPrimitives;
+ aLeavingPrimitives.push_back(Slide);
+
+ TransitionSettings aSettings;
+ aSettings.mbUseMipMapEntering = false;
+
+ return makeSimpleTransition(aLeavingPrimitives, aEnteringPrimitives, aSettings);
}
-void OGLTransitionImpl::makeTurnAround()
+boost::shared_ptr<OGLTransitionImpl> makeTurnAround()
{
- clear();
Primitive Slide;
- mbReflectSlides = true;
+ TransitionSettings aSettings;
+ aSettings.mbReflectSlides = true;
Slide.pushTriangle(basegfx::B2DVector(0,0),basegfx::B2DVector(1,0),basegfx::B2DVector(0,1));
Slide.pushTriangle(basegfx::B2DVector(1,0),basegfx::B2DVector(0,1),basegfx::B2DVector(1,1));
- maLeavingSlidePrimitives.push_back(Slide);
+ Primitives_t aLeavingPrimitives;
+ aLeavingPrimitives.push_back(Slide);
- Slide.Operations.push_back(new RotateAndScaleDepthByWidth(basegfx::B3DVector(0,1,0),basegfx::B3DVector(0,0,0),-180,false,0.0,1.0));
- maEnteringSlidePrimitives.push_back(Slide);
+ Slide.Operations.push_back(makeRotateAndScaleDepthByWidth(basegfx::B3DVector(0,1,0),basegfx::B3DVector(0,0,0),-180,false,0.0,1.0));
+ Primitives_t aEnteringPrimitives;
+ aEnteringPrimitives.push_back(Slide);
- OverallOperations.push_back(new STranslate(basegfx::B3DVector(0, 0, -1.5),true, 0, 0.5));
- OverallOperations.push_back(new STranslate(basegfx::B3DVector(0, 0, 1.5), true, 0.5, 1));
- OverallOperations.push_back(new RotateAndScaleDepthByWidth(basegfx::B3DVector(0, 1, 0),basegfx::B3DVector(0, 0, 0), -180, true, 0.0, 1.0));
+ Operations_t aOperations;
+ aOperations.push_back(makeSTranslate(basegfx::B3DVector(0, 0, -1.5),true, 0, 0.5));
+ aOperations.push_back(makeSTranslate(basegfx::B3DVector(0, 0, 1.5), true, 0.5, 1));
+ aOperations.push_back(makeRotateAndScaleDepthByWidth(basegfx::B3DVector(0, 1, 0),basegfx::B3DVector(0, 0, 0), -180, true, 0.0, 1.0));
+
+ return makeSimpleTransition(aLeavingPrimitives, aEnteringPrimitives, aOperations, aSettings);
}
-void OGLTransitionImpl::makeTurnDown()
+boost::shared_ptr<OGLTransitionImpl> makeTurnDown()
{
- clear();
Primitive Slide;
Slide.pushTriangle(basegfx::B2DVector(0,0),basegfx::B2DVector(1,0),basegfx::B2DVector(0,1));
Slide.pushTriangle(basegfx::B2DVector(1,0),basegfx::B2DVector(0,1),basegfx::B2DVector(1,1));
- maLeavingSlidePrimitives.push_back(Slide);
+ Primitives_t aLeavingPrimitives;
+ aLeavingPrimitives.push_back(Slide);
+
+ Slide.Operations.push_back(makeSTranslate(basegfx::B3DVector(0, 0, 0.0001), false, -1.0, 0.0));
+ Slide.Operations.push_back(makeSRotate (basegfx::B3DVector(0, 0, 1), basegfx::B3DVector(-1, 1, 0), -90, true, 0.0, 1.0));
+ Slide.Operations.push_back(makeSRotate (basegfx::B3DVector(0, 0, 1), basegfx::B3DVector(-1, 1, 0), 90, false, -1.0, 0.0));
+ Primitives_t aEnteringPrimitives;
+ aEnteringPrimitives.push_back(Slide);
- Slide.Operations.push_back(new STranslate(basegfx::B3DVector(0, 0, 0.0001), false, -1.0, 0.0));
- Slide.Operations.push_back(new SRotate (basegfx::B3DVector(0, 0, 1), basegfx::B3DVector(-1, 1, 0), -90, true, 0.0, 1.0));
- Slide.Operations.push_back(new SRotate (basegfx::B3DVector(0, 0, 1), basegfx::B3DVector(-1, 1, 0), 90, false, -1.0, 0.0));
- maEnteringSlidePrimitives.push_back(Slide);
+ TransitionSettings aSettings;
+ aSettings.mbUseMipMapLeaving = false;
- mbUseMipMapLeaving = false;
+ return makeSimpleTransition(aLeavingPrimitives, aEnteringPrimitives, aSettings);
}
-void OGLTransitionImpl::makeIris()
+boost::shared_ptr<OGLTransitionImpl> makeIris()
{
- clear();
Primitive Slide;
Slide.pushTriangle (basegfx::B2DVector (0,0), basegfx::B2DVector (1,0), basegfx::B2DVector (0,1));
Slide.pushTriangle (basegfx::B2DVector (1,0), basegfx::B2DVector (0,1), basegfx::B2DVector (1,1));
- maEnteringSlidePrimitives.push_back (Slide);
+ Primitives_t aEnteringPrimitives;
+ aEnteringPrimitives.push_back (Slide);
- Slide.Operations.push_back (new STranslate (basegfx::B3DVector (0, 0, 0.000001), false, -1, 0));
- Slide.Operations.push_back (new STranslate (basegfx::B3DVector (0, 0, -0.000002), false, 0.5, 1));
- maLeavingSlidePrimitives.push_back (Slide);
+ Slide.Operations.push_back (makeSTranslate (basegfx::B3DVector (0, 0, 0.000001), false, -1, 0));
+ Slide.Operations.push_back (makeSTranslate (basegfx::B3DVector (0, 0, -0.000002), false, 0.5, 1));
+ Primitives_t aLeavingPrimitives;
+ aLeavingPrimitives.push_back (Slide);
Primitive irisPart, part;
@@ -430,7 +537,7 @@ void OGLTransitionImpl::makeIris()
t += 1.0/nSteps;
}
- Iris* pIris = new Iris();
+ shared_ptr<Iris> pIris = make_shared<Iris>();
double angle = 87;
for (i = 0; i < nParts; i++) {
@@ -439,46 +546,76 @@ void OGLTransitionImpl::makeIris()
rx = cos ((2*M_PI*i)/nParts);
ry = sin ((2*M_PI*i)/nParts);
- irisPart.Operations.push_back (new SRotate (basegfx::B3DVector(0, 0, 1), basegfx::B3DVector(rx, ry, 0), angle, true, 0.0, 0.5));
- irisPart.Operations.push_back (new SRotate (basegfx::B3DVector(0, 0, 1), basegfx::B3DVector(rx, ry, 0), -angle, true, 0.5, 1));
+ irisPart.Operations.push_back (makeSRotate (basegfx::B3DVector(0, 0, 1), basegfx::B3DVector(rx, ry, 0), angle, true, 0.0, 0.5));
+ irisPart.Operations.push_back (makeSRotate (basegfx::B3DVector(0, 0, 1), basegfx::B3DVector(rx, ry, 0), -angle, true, 0.5, 1));
if (i > 0) {
- irisPart.Operations.push_back (new STranslate (basegfx::B3DVector(rx, ry, 0), false, -1, 0));
- irisPart.Operations.push_back (new SRotate (basegfx::B3DVector(0, 0, 1), basegfx::B3DVector(0, 0, 0), i*360.0/nParts, false, -1, 0));
- irisPart.Operations.push_back (new STranslate (basegfx::B3DVector(-1, 0, 0), false, -1, 0));
+ irisPart.Operations.push_back (makeSTranslate (basegfx::B3DVector(rx, ry, 0), false, -1, 0));
+ irisPart.Operations.push_back (makeSRotate (basegfx::B3DVector(0, 0, 1), basegfx::B3DVector(0, 0, 0), i*360.0/nParts, false, -1, 0));
+ irisPart.Operations.push_back (makeSTranslate (basegfx::B3DVector(-1, 0, 0), false, -1, 0));
}
- irisPart.Operations.push_back(new STranslate(basegfx::B3DVector(0, 0, 1), false, -2, 0.0));
- irisPart.Operations.push_back (new SRotate (basegfx::B3DVector(1, .5, 0), basegfx::B3DVector(1, 0, 0), -30, false, -1, 0));
+ irisPart.Operations.push_back(makeSTranslate(basegfx::B3DVector(0, 0, 1), false, -2, 0.0));
+ irisPart.Operations.push_back (makeSRotate (basegfx::B3DVector(1, .5, 0), basegfx::B3DVector(1, 0, 0), -30, false, -1, 0));
pIris->pushPrimitive (irisPart);
}
- maSceneObjects.push_back (pIris);
+ SceneObjects_t aSceneObjects;
+ aSceneObjects.push_back (pIris);
- mbUseMipMapLeaving = mbUseMipMapEntering = false;
+ TransitionSettings aSettings;
+ aSettings.mbUseMipMapLeaving = aSettings.mbUseMipMapEntering = false;
+
+ return makeSimpleTransition(aLeavingPrimitives, aEnteringPrimitives, aSceneObjects, aSettings);
}
-void OGLTransitionImpl::displaySlidesRochade( double nTime, ::sal_Int32 glLeavingSlideTex, ::sal_Int32 glEnteringSlideTex,
- double SlideWidthScale, double SlideHeightScale )
+namespace
+{
+
+class RochadeTransition : public OGLTransitionImpl
+{
+public:
+ RochadeTransition(const TransitionScene& rScene, const TransitionSettings& rSettings)
+ : OGLTransitionImpl(rScene, rSettings)
+ {}
+
+private:
+ virtual void displaySlides_( double nTime, ::sal_Int32 glLeavingSlideTex, ::sal_Int32 glEnteringSlideTex, double SlideWidthScale, double SlideHeightScale );
+};
+
+void RochadeTransition::displaySlides_( double nTime, ::sal_Int32 glLeavingSlideTex, ::sal_Int32 glEnteringSlideTex, double SlideWidthScale, double SlideHeightScale )
{
applyOverallOperations( nTime, SlideWidthScale, SlideHeightScale );
glEnable(GL_TEXTURE_2D);
if( nTime > .5) {
- displaySlide( nTime, glLeavingSlideTex, maLeavingSlidePrimitives, SlideWidthScale, SlideHeightScale );
- displaySlide( nTime, glEnteringSlideTex, maEnteringSlidePrimitives, SlideWidthScale, SlideHeightScale );
+ displaySlide( nTime, glLeavingSlideTex, getScene().getLeavingSlide(), SlideWidthScale, SlideHeightScale );
+ displaySlide( nTime, glEnteringSlideTex, getScene().getEnteringSlide(), SlideWidthScale, SlideHeightScale );
} else {
- displaySlide( nTime, glEnteringSlideTex, maEnteringSlidePrimitives, SlideWidthScale, SlideHeightScale );
- displaySlide( nTime, glLeavingSlideTex, maLeavingSlidePrimitives, SlideWidthScale, SlideHeightScale );
+ displaySlide( nTime, glEnteringSlideTex, getScene().getEnteringSlide(), SlideWidthScale, SlideHeightScale );
+ displaySlide( nTime, glLeavingSlideTex, getScene().getLeavingSlide(), SlideWidthScale, SlideHeightScale );
}
}
-void OGLTransitionImpl::makeRochade()
+shared_ptr<OGLTransitionImpl>
+makeRochadeTransition(
+ const Primitives_t& rLeavingSlidePrimitives,
+ const Primitives_t& rEnteringSlidePrimitives,
+ const TransitionSettings& rSettings)
+{
+ return make_shared<RochadeTransition>(
+ TransitionScene(rLeavingSlidePrimitives, rEnteringSlidePrimitives),
+ rSettings)
+ ;
+
+}
+}
+
+boost::shared_ptr<OGLTransitionImpl> makeRochade()
{
- clear();
Primitive Slide;
- mbReflectSlides = true;
- mmDisplaySlides = &OGLTransitionImpl::displaySlidesRochade;
+ TransitionSettings aSettings;
+ aSettings.mbReflectSlides = true;
double w, h;
@@ -488,17 +625,20 @@ void OGLTransitionImpl::makeRochade()
Slide.pushTriangle(basegfx::B2DVector(0,0),basegfx::B2DVector(1,0),basegfx::B2DVector(0,1));
Slide.pushTriangle(basegfx::B2DVector(1,0),basegfx::B2DVector(0,1),basegfx::B2DVector(1,1));
- Slide.Operations.push_back(new SEllipseTranslate(w, h, 0.25, -0.25, true, 0, 1));
- Slide.Operations.push_back(new RotateAndScaleDepthByWidth(basegfx::B3DVector(0,1,0),basegfx::B3DVector(0,0,0), -45, true, 0, 1));
- maLeavingSlidePrimitives.push_back(Slide);
+ Slide.Operations.push_back(makeSEllipseTranslate(w, h, 0.25, -0.25, true, 0, 1));
+ Slide.Operations.push_back(makeRotateAndScaleDepthByWidth(basegfx::B3DVector(0,1,0),basegfx::B3DVector(0,0,0), -45, true, 0, 1));
+ Primitives_t aLeavingSlide;
+ aLeavingSlide.push_back(Slide);
Slide.Operations.clear();
- Slide.Operations.push_back(new SEllipseTranslate(w, h, 0.75, 0.25, true, 0, 1));
- Slide.Operations.push_back(new STranslate(basegfx::B3DVector(0, 0, -h), false, -1, 0));
- Slide.Operations.push_back(new RotateAndScaleDepthByWidth(basegfx::B3DVector(0,1,0),basegfx::B3DVector(0,0,0), -45, true, 0, 1));
- Slide.Operations.push_back(new RotateAndScaleDepthByWidth(basegfx::B3DVector(0,1,0),basegfx::B3DVector(0,0,0), 45, false, -1, 0));
- maEnteringSlidePrimitives.push_back(Slide);
+ Slide.Operations.push_back(makeSEllipseTranslate(w, h, 0.75, 0.25, true, 0, 1));
+ Slide.Operations.push_back(makeSTranslate(basegfx::B3DVector(0, 0, -h), false, -1, 0));
+ Slide.Operations.push_back(makeRotateAndScaleDepthByWidth(basegfx::B3DVector(0,1,0),basegfx::B3DVector(0,0,0), -45, true, 0, 1));
+ Slide.Operations.push_back(makeRotateAndScaleDepthByWidth(basegfx::B3DVector(0,1,0),basegfx::B3DVector(0,0,0), 45, false, -1, 0));
+ Primitives_t aEnteringSlide;
+ aEnteringSlide.push_back(Slide);
+ return makeRochadeTransition(aLeavingSlide, aEnteringSlide, aSettings);
}
// TODO(Q3): extract to basegfx
@@ -528,14 +668,13 @@ inline basegfx::B3DVector randNormVectorInXYPlane()
return toReturn/toReturn.getLength();
}
-void OGLTransitionImpl::makeRevolvingCircles( ::sal_uInt16 nCircles , ::sal_uInt16 nPointsOnCircles )
+boost::shared_ptr<OGLTransitionImpl> makeRevolvingCircles( ::sal_uInt16 nCircles , ::sal_uInt16 nPointsOnCircles )
{
- clear();
double dAngle(2*3.1415926/static_cast<double>( nPointsOnCircles ));
if(nCircles < 2 || nPointsOnCircles < 4)
{
makeNByMTileFlip(1,1);
- return;
+ return makeSimpleTransition();
}
double Radius(1.0/static_cast<double>( nCircles ));
double dRadius(Radius);
@@ -556,6 +695,8 @@ void OGLTransitionImpl::makeRevolvingCircles( ::sal_uInt16 nCircles , ::sal_uInt
TempAngle += dAngle;
}
+ Primitives_t aLeavingSlide;
+ Primitives_t aEnteringSlide;
{
Primitive EnteringSlide;
Primitive LeavingSlide;
@@ -568,12 +709,12 @@ void OGLTransitionImpl::makeRevolvingCircles( ::sal_uInt16 nCircles , ::sal_uInt
LeavingSlide.pushTriangle( basegfx::B2DVector(0.5,0.5) , Radius*unScaledTexCoords[0]/2.0 + basegfx::B2DVector(0.5,0.5) , Radius*unScaledTexCoords[nPointsOnCircles - 1]/2.0 + basegfx::B2DVector(0.5,0.5) );
basegfx::B3DVector axis(randNormVectorInXYPlane());
- EnteringSlide.Operations.push_back( new SRotate( axis , basegfx::B3DVector(0,0,0) , 180, true, Radius/2.0 , (NextRadius + 1)/2.0 ) );
- LeavingSlide.Operations.push_back( new SRotate( axis , basegfx::B3DVector(0,0,0) , 180, true, Radius/2.0 , (NextRadius + 1)/2.0 ) );
- EnteringSlide.Operations.push_back( new SRotate( axis , basegfx::B3DVector(0,0,0) , -180, false,0.0,1.0) );
+ EnteringSlide.Operations.push_back( makeSRotate( axis , basegfx::B3DVector(0,0,0) , 180, true, Radius/2.0 , (NextRadius + 1)/2.0 ) );
+ LeavingSlide.Operations.push_back( makeSRotate( axis , basegfx::B3DVector(0,0,0) , 180, true, Radius/2.0 , (NextRadius + 1)/2.0 ) );
+ EnteringSlide.Operations.push_back( makeSRotate( axis , basegfx::B3DVector(0,0,0) , -180, false,0.0,1.0) );
- maEnteringSlidePrimitives.push_back(EnteringSlide);
- maLeavingSlidePrimitives.push_back(LeavingSlide);
+ aEnteringSlide.push_back(EnteringSlide);
+ aLeavingSlide.push_back(LeavingSlide);
LastRadius = Radius;
Radius = NextRadius;
NextRadius += dRadius;
@@ -599,12 +740,12 @@ void OGLTransitionImpl::makeRevolvingCircles( ::sal_uInt16 nCircles , ::sal_uInt
LeavingSlide.pushTriangle(Radius*unScaledTexCoords[nPointsOnCircles - 1]/2.0 + basegfx::B2DVector(0.5,0.5) , LastRadius*unScaledTexCoords[0]/2.0 + basegfx::B2DVector(0.5,0.5) , Radius*unScaledTexCoords[0]/2.0 + basegfx::B2DVector(0.5,0.5) );
basegfx::B3DVector axis(randNormVectorInXYPlane());
- EnteringSlide.Operations.push_back( new SRotate( axis , basegfx::B3DVector(0,0,0) , 180, true, Radius/2.0 , (NextRadius + 1)/2.0 ) );
- LeavingSlide.Operations.push_back( new SRotate( axis , basegfx::B3DVector(0,0,0) , 180, true, Radius/2.0 , (NextRadius + 1)/2.0 ) );
- EnteringSlide.Operations.push_back( new SRotate( axis , basegfx::B3DVector(0,0,0) , -180, false,0.0,1.0) );
+ EnteringSlide.Operations.push_back( makeSRotate( axis , basegfx::B3DVector(0,0,0) , 180, true, Radius/2.0 , (NextRadius + 1)/2.0 ) );
+ LeavingSlide.Operations.push_back( makeSRotate( axis , basegfx::B3DVector(0,0,0) , 180, true, Radius/2.0 , (NextRadius + 1)/2.0 ) );
+ EnteringSlide.Operations.push_back( makeSRotate( axis , basegfx::B3DVector(0,0,0) , -180, false,0.0,1.0) );
- maEnteringSlidePrimitives.push_back(EnteringSlide);
- maLeavingSlidePrimitives.push_back(LeavingSlide);
+ aEnteringSlide.push_back(EnteringSlide);
+ aLeavingSlide.push_back(LeavingSlide);
LastRadius = Radius;
Radius = NextRadius;
@@ -631,21 +772,24 @@ void OGLTransitionImpl::makeRevolvingCircles( ::sal_uInt16 nCircles , ::sal_uInt
LeavingSlide.pushTriangle(clamp(Radius*unScaledTexCoords[nPointsOnCircles - 1])/2.0 + basegfx::B2DVector(0.5,0.5) , LastRadius*unScaledTexCoords[0]/2.0 + basegfx::B2DVector(0.5,0.5) , clamp(Radius*unScaledTexCoords[0])/2.0 + basegfx::B2DVector(0.5,0.5) );
basegfx::B3DVector axis(randNormVectorInXYPlane());
- EnteringSlide.Operations.push_back( new SRotate( axis , basegfx::B3DVector(0,0,0) , 180, true, (LastRadius + dRadius)/2.0 , 1.0 ) );
- LeavingSlide.Operations.push_back( new SRotate( axis , basegfx::B3DVector(0,0,0) , 180, true, (LastRadius + dRadius)/2.0 , 1.0 ) );
- EnteringSlide.Operations.push_back( new SRotate( axis , basegfx::B3DVector(0,0,0) , -180, false,0.0,1.0) );
+ EnteringSlide.Operations.push_back( makeSRotate( axis , basegfx::B3DVector(0,0,0) , 180, true, (LastRadius + dRadius)/2.0 , 1.0 ) );
+ LeavingSlide.Operations.push_back( makeSRotate( axis , basegfx::B3DVector(0,0,0) , 180, true, (LastRadius + dRadius)/2.0 , 1.0 ) );
+ EnteringSlide.Operations.push_back( makeSRotate( axis , basegfx::B3DVector(0,0,0) , -180, false,0.0,1.0) );
- maEnteringSlidePrimitives.push_back(EnteringSlide);
- maLeavingSlidePrimitives.push_back(LeavingSlide);
+ aEnteringSlide.push_back(EnteringSlide);
+ aLeavingSlide.push_back(LeavingSlide);
}
+
+ return makeSimpleTransition(aLeavingSlide, aEnteringSlide);
}
-void OGLTransitionImpl::makeHelix( ::sal_uInt16 nRows )
+boost::shared_ptr<OGLTransitionImpl> makeHelix( ::sal_uInt16 nRows )
{
- clear();
double invN(1.0/static_cast<double>(nRows));
double iDn = 0.0;
double iPDn = invN;
+ Primitives_t aLeavingSlide;
+ Primitives_t aEnteringSlide;
for(unsigned int i(0); i < nRows; ++i)
{
Primitive Tile;
@@ -654,28 +798,31 @@ void OGLTransitionImpl::makeHelix( ::sal_uInt16 nRows )
Tile.pushTriangle(basegfx::B2DVector( 1.0 , iPDn ) , basegfx::B2DVector( 1.0 , iDn ) , basegfx::B2DVector( 0.0 , iPDn ));
- Tile.Operations.push_back( new SRotate( basegfx::B3DVector( 0 , 1 , 0 ) , ( Tile.getVertices()[1] + Tile.getVertices()[3] )/2.0 , 180 ,
+ Tile.Operations.push_back( makeSRotate( basegfx::B3DVector( 0 , 1 , 0 ) , ( Tile.getVertices()[1] + Tile.getVertices()[3] )/2.0 , 180 ,
true,min(max(static_cast<double>(i - nRows/2.0)*invN/2.0,0.0),1.0),
min(max(static_cast<double>(i + nRows/2.0)*invN/2.0,0.0),1.0) ) );
- maLeavingSlidePrimitives.push_back(Tile);
+ aLeavingSlide.push_back(Tile);
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list