summaryrefslogtreecommitdiff
path: root/slideshow
diff options
context:
space:
mode:
authorArmin Le Grand <Armin.Le.Grand@Sun.COM>2010-05-05 16:54:24 +0200
committerArmin Le Grand <Armin.Le.Grand@Sun.COM>2010-05-05 16:54:24 +0200
commitac8b5e0d06a1d6520acc1e9232c18b6e88fe63b7 (patch)
tree9eb595a8f92c1eeff5dad5b9066089b9128e1995 /slideshow
parent613cb2b85d6c0bd2b1c9fb04890f6772f25143f1 (diff)
parentb316ddbb7c819779c7fca6ef7a86dfe4fd66324a (diff)
aw081 resync to m77
Diffstat (limited to 'slideshow')
-rw-r--r--slideshow/source/engine/OGLTrans/exports.map8
-rw-r--r--slideshow/source/engine/OGLTrans/makefile.mk2
-rw-r--r--slideshow/source/engine/activities/activitybase.cxx2
-rw-r--r--slideshow/source/engine/activities/continuouskeytimeactivitybase.cxx69
-rw-r--r--slideshow/source/engine/activities/continuouskeytimeactivitybase.hxx7
-rw-r--r--slideshow/source/engine/activities/interpolation.hxx21
-rw-r--r--slideshow/source/engine/shapes/viewshape.cxx7
-rw-r--r--slideshow/source/engine/slide/layer.cxx11
-rw-r--r--slideshow/source/engine/slide/layer.hxx6
-rw-r--r--slideshow/source/engine/tools.cxx26
-rw-r--r--slideshow/source/inc/lerp.hxx59
-rw-r--r--slideshow/test/export.map2
-rw-r--r--slideshow/util/exports.map8
-rw-r--r--slideshow/util/makefile.mk2
14 files changed, 58 insertions, 172 deletions
diff --git a/slideshow/source/engine/OGLTrans/exports.map b/slideshow/source/engine/OGLTrans/exports.map
deleted file mode 100644
index ebc8f13ea1bd..000000000000
--- a/slideshow/source/engine/OGLTrans/exports.map
+++ /dev/null
@@ -1,8 +0,0 @@
-SLI_1_0 {
- global:
- component_getImplementationEnvironment;
- component_writeInfo;
- component_getFactory;
- local:
- *;
-};
diff --git a/slideshow/source/engine/OGLTrans/makefile.mk b/slideshow/source/engine/OGLTrans/makefile.mk
index 7e767ec8b1d1..dd945a06b1aa 100644
--- a/slideshow/source/engine/OGLTrans/makefile.mk
+++ b/slideshow/source/engine/OGLTrans/makefile.mk
@@ -68,7 +68,7 @@ SHL1IMPLIB=i$(TARGET)
SHL1LIBS=$(SLB)$/$(TARGET).lib
SHL1DEF=$(MISC)$/$(SHL1TARGET).def
-SHL1VERSIONMAP=exports.map
+SHL1VERSIONMAP=$(SOLARENV)/src/component.map
DEF1NAME=$(SHL1TARGET)
DEF1EXPORTFILE=exports.dxp
diff --git a/slideshow/source/engine/activities/activitybase.cxx b/slideshow/source/engine/activities/activitybase.cxx
index 06cc0739fe6b..479715b5ccd8 100644
--- a/slideshow/source/engine/activities/activitybase.cxx
+++ b/slideshow/source/engine/activities/activitybase.cxx
@@ -159,7 +159,7 @@ namespace slideshow
// ================================
// clamp nT to permissible [0,1] range
- nT = ::canvas::tools::clamp( nT, 0.0, 1.0 );
+ nT = ::basegfx::clamp( nT, 0.0, 1.0 );
// take acceleration/deceleration into account. if the sum
// of mnAccelerationFraction and mnDecelerationFraction
diff --git a/slideshow/source/engine/activities/continuouskeytimeactivitybase.cxx b/slideshow/source/engine/activities/continuouskeytimeactivitybase.cxx
index 11a8463d87f3..5c6943614437 100644
--- a/slideshow/source/engine/activities/continuouskeytimeactivitybase.cxx
+++ b/slideshow/source/engine/activities/continuouskeytimeactivitybase.cxx
@@ -35,6 +35,7 @@
#include <continuouskeytimeactivitybase.hxx>
+#include <boost/tuple/tuple.hpp>
#include <algorithm>
#include <iterator>
@@ -45,34 +46,14 @@ namespace slideshow
{
ContinuousKeyTimeActivityBase::ContinuousKeyTimeActivityBase( const ActivityParameters& rParms ) :
SimpleContinuousActivityBase( rParms ),
- maKeyTimes( rParms.maDiscreteTimes ),
- mnLastIndex( 0 )
+ maLerper( rParms.maDiscreteTimes )
{
- ENSURE_OR_THROW( maKeyTimes.size() > 1,
+ ENSURE_OR_THROW( rParms.maDiscreteTimes.size() > 1,
"ContinuousKeyTimeActivityBase::ContinuousKeyTimeActivityBase(): key times vector must have two entries or more" );
-
-#ifdef DBG_UTIL
- // check parameters: rKeyTimes must be sorted in
- // ascending order, and contain values only from the range
- // [0,1]
- for( ::std::size_t i=1, len=maKeyTimes.size(); i<len; ++i )
- {
- if( maKeyTimes[i] < 0.0 ||
- maKeyTimes[i] > 1.0 ||
- maKeyTimes[i-1] < 0.0 ||
- maKeyTimes[i-1] > 1.0 )
- {
- ENSURE_OR_THROW( false, "ContinuousKeyTimeActivityBase::ContinuousKeyTimeActivityBase(): time values not within [0,1] range!" );
- }
-
- if( maKeyTimes[i-1] > maKeyTimes[i] )
- {
- ENSURE_OR_THROW( false, "ContinuousKeyTimeActivityBase::ContinuousKeyTimeActivityBase(): time vector is not sorted in ascending order!" );
- }
- }
-
- // TODO(E2): check this also in production code?
-#endif
+ ENSURE_OR_THROW( rParms.maDiscreteTimes.front() == 0.0,
+ "ContinuousKeyTimeActivityBase::ContinuousKeyTimeActivityBase(): key times vector first entry must be zero" );
+ ENSURE_OR_THROW( rParms.maDiscreteTimes.back() <= 1.0,
+ "ContinuousKeyTimeActivityBase::ContinuousKeyTimeActivityBase(): key times vector last entry must be less or equal 1" );
}
void ContinuousKeyTimeActivityBase::simplePerform( double nSimpleTime,
@@ -81,40 +62,14 @@ namespace slideshow
// calc simple time from global time - sweep through the
// array multiple times for repeated animations (according to
// SMIL spec).
- const double nT( calcAcceleratedTime( nSimpleTime ) );
-
- // determine position within key times vector from
- // current simple time
-
- // shortcut: cached value still okay?
- if( maKeyTimes[ mnLastIndex ] < nT ||
- maKeyTimes[ mnLastIndex+1 ] >= nT )
- {
- // nope, find new index
- mnLastIndex = ::std::min< ::std::ptrdiff_t >(
- maKeyTimes.size()-2,
- // range is ensured by max below
- ::std::max< ::std::ptrdiff_t >(
- 0,
- ::std::distance( maKeyTimes.begin(),
- ::std::lower_bound( maKeyTimes.begin(),
- maKeyTimes.end(),
- nT ) ) - 1 ) );
- }
-
- OSL_ENSURE( mnLastIndex+1 < maKeyTimes.size(),
- "ContinuousKeyTimeActivityBase::simplePerform(): index out of range" );
-
- // mnLastIndex is now valid and up-to-date
+ double fAlpha( calcAcceleratedTime( nSimpleTime ) );
+ std::ptrdiff_t nIndex;
- // calc current simple time, as a fractional value ([0,1] range).
- // I.e. the relative position between the two index times.
- const double nCurrFractionalSimplTime( (nT - maKeyTimes[ mnLastIndex ]) /
- (maKeyTimes[ mnLastIndex+1 ] - maKeyTimes[ mnLastIndex ]) );
+ boost::tuples::tie(nIndex,fAlpha) = maLerper.lerp(fAlpha);
perform(
- mnLastIndex,
- nCurrFractionalSimplTime,
+ nIndex,
+ fAlpha,
nRepeatCount );
}
}
diff --git a/slideshow/source/engine/activities/continuouskeytimeactivitybase.hxx b/slideshow/source/engine/activities/continuouskeytimeactivitybase.hxx
index a0267188a02d..cb851bab3730 100644
--- a/slideshow/source/engine/activities/continuouskeytimeactivitybase.hxx
+++ b/slideshow/source/engine/activities/continuouskeytimeactivitybase.hxx
@@ -29,6 +29,8 @@
#define INCLUDED_SLIDESHOW_CONTINUOUSKEYTIMEACTIVITYBASE_HXX
#include "simplecontinuousactivitybase.hxx"
+
+#include <basegfx/tools/keystoplerp.hxx>
#include <vector>
@@ -73,10 +75,7 @@ namespace slideshow
sal_uInt32 nRepeatCount ) const;
private:
- const ::std::vector< double > maKeyTimes;
-
- /// last active index in maKeyTimes (to avoid frequent searching)
- mutable ::std::size_t mnLastIndex;
+ const ::basegfx::tools::KeyStopLerp maLerper;
};
}
}
diff --git a/slideshow/source/engine/activities/interpolation.hxx b/slideshow/source/engine/activities/interpolation.hxx
index 620a019f661d..9409965c8846 100644
--- a/slideshow/source/engine/activities/interpolation.hxx
+++ b/slideshow/source/engine/activities/interpolation.hxx
@@ -28,11 +28,11 @@
#ifndef INCLUDED_SLIDESHOW_INTERPOLATION_HXX
#define INCLUDED_SLIDESHOW_INTERPOLATION_HXX
-#include "lerp.hxx"
+#include <basegfx/tools/lerp.hxx>
-namespace slideshow
+namespace basegfx
{
- namespace internal
+ namespace tools
{
// Interpolator specializations
// ============================
@@ -42,9 +42,10 @@ namespace slideshow
// not-straight-forward-interpolatable types
/// Specialization for RGBColor, to employ color-specific interpolator
- template<> RGBColor lerp< RGBColor >( const RGBColor& rFrom,
- const RGBColor& rTo,
- double t )
+ template<> ::slideshow::internal::RGBColor lerp< ::slideshow::internal::RGBColor >(
+ const ::slideshow::internal::RGBColor& rFrom,
+ const ::slideshow::internal::RGBColor& rTo,
+ double t )
{
return interpolate( rFrom, rTo, t );
}
@@ -78,14 +79,20 @@ namespace slideshow
"lerp<bool> called" );
return rTo;
}
+ }
+}
+namespace slideshow
+{
+ namespace internal
+ {
template< typename ValueType > struct Interpolator
{
ValueType operator()( const ValueType& rFrom,
const ValueType& rTo,
double t ) const
{
- return lerp( rFrom, rTo, t );
+ return basegfx::tools::lerp( rFrom, rTo, t );
}
};
diff --git a/slideshow/source/engine/shapes/viewshape.cxx b/slideshow/source/engine/shapes/viewshape.cxx
index 76bce5ebe3e7..00a4ef4006f8 100644
--- a/slideshow/source/engine/shapes/viewshape.cxx
+++ b/slideshow/source/engine/shapes/viewshape.cxx
@@ -57,7 +57,6 @@
#include "viewshape.hxx"
#include "tools.hxx"
-#include "lerp.hxx"
#include <boost/bind.hpp>
@@ -461,9 +460,9 @@ namespace slideshow
if( mbForceUpdate || (nUpdateFlags & ALPHA) )
{
mpSprite->setAlpha( (pAttr && pAttr->isAlphaValid()) ?
- ::canvas::tools::clamp(pAttr->getAlpha(),
- 0.0,
- 1.0) :
+ ::basegfx::clamp(pAttr->getAlpha(),
+ 0.0,
+ 1.0) :
1.0 );
}
if( mbForceUpdate || (nUpdateFlags & CLIP) )
diff --git a/slideshow/source/engine/slide/layer.cxx b/slideshow/source/engine/slide/layer.cxx
index 080594a3350f..be67b220962e 100644
--- a/slideshow/source/engine/slide/layer.cxx
+++ b/slideshow/source/engine/slide/layer.cxx
@@ -33,7 +33,7 @@
#include <basegfx/range/b2drange.hxx>
#include <basegfx/range/b1drange.hxx>
-#include <basegfx/range/b2dmultirange.hxx>
+#include <basegfx/range/b2dpolyrange.hxx>
#include <basegfx/matrix/b2dhommatrix.hxx>
#include <basegfx/polygon/b2dpolypolygon.hxx>
@@ -199,7 +199,8 @@ namespace slideshow
{
// TODO(Q1): move this to B2DMultiRange
if( !rUpdateRange.isEmpty() )
- maUpdateAreas.addRange( rUpdateRange );
+ maUpdateAreas.appendElement( rUpdateRange,
+ basegfx::ORIENTATION_POSITIVE );
}
void Layer::updateBounds( ShapeSharedPtr const& rShape )
@@ -245,7 +246,7 @@ namespace slideshow
void Layer::clearUpdateRanges()
{
- maUpdateAreas.reset();
+ maUpdateAreas.clear();
}
void Layer::clearContent()
@@ -281,12 +282,12 @@ namespace slideshow
Layer::EndUpdater Layer::beginUpdate()
{
- if( !maUpdateAreas.isEmpty() )
+ if( maUpdateAreas.count() )
{
// perform proper layer update. That means, setup proper
// clipping, and render each shape that intersects with
// the calculated update area
- ::basegfx::B2DPolyPolygon aClip( maUpdateAreas.getPolyPolygon() );
+ ::basegfx::B2DPolyPolygon aClip( maUpdateAreas.solveCrossovers() );
// actually, if there happen to be shapes with zero
// update area in the maUpdateAreas vector, the
diff --git a/slideshow/source/engine/slide/layer.hxx b/slideshow/source/engine/slide/layer.hxx
index 3001bc3b8e6d..28605efc733b 100644
--- a/slideshow/source/engine/slide/layer.hxx
+++ b/slideshow/source/engine/slide/layer.hxx
@@ -28,7 +28,7 @@
#ifndef INCLUDED_SLIDESHOW_LAYER_HXX
#define INCLUDED_SLIDESHOW_LAYER_HXX
-#include <basegfx/range/b2dmultirange.hxx>
+#include <basegfx/range/b2dpolyrange.hxx>
#include <cppcanvas/spritecanvas.hxx>
#include "view.hxx"
@@ -184,7 +184,7 @@ namespace slideshow
@return true, if any non-empty addUpdateRange() calls
have been made since the last render()/update() call.
*/
- bool isUpdatePending() const { return !maUpdateAreas.isEmpty(); }
+ bool isUpdatePending() const { return maUpdateAreas.count()!=0; }
/** Update layer bound rect from shape bounds
*/
@@ -294,7 +294,7 @@ namespace slideshow
typedef ::std::vector< ViewEntry > ViewEntryVector;
ViewEntryVector maViewEntries;
- basegfx::B2DMultiRange maUpdateAreas;
+ basegfx::B2DPolyRange maUpdateAreas;
basegfx::B2DRange maBounds;
basegfx::B2DRange maNewBounds;
const basegfx::B2DRange maMaxBounds; // maBounds is clipped against this
diff --git a/slideshow/source/engine/tools.cxx b/slideshow/source/engine/tools.cxx
index 281118993ccf..c8ca3dd86ef9 100644
--- a/slideshow/source/engine/tools.cxx
+++ b/slideshow/source/engine/tools.cxx
@@ -48,11 +48,11 @@
#include <basegfx/vector/b2ivector.hxx>
#include <basegfx/matrix/b2dhommatrix.hxx>
#include <basegfx/numeric/ftools.hxx>
+#include <basegfx/tools/lerp.hxx>
#include <basegfx/matrix/b2dhommatrixtools.hxx>
#include <cppcanvas/basegfxfactory.hxx>
-#include "lerp.hxx"
#include "unoview.hxx"
#include "smilfunctionparser.hxx"
#include "tools.hxx"
@@ -638,18 +638,18 @@ namespace slideshow
const ::basegfx::B2DRange& rShapeBounds )
{
return ::basegfx::B2DRectangle(
- lerp( rShapeBounds.getMinX(),
- rShapeBounds.getMaxX(),
- rUnitBounds.getMinX() ),
- lerp( rShapeBounds.getMinY(),
- rShapeBounds.getMaxY(),
- rUnitBounds.getMinY() ),
- lerp( rShapeBounds.getMinX(),
- rShapeBounds.getMaxX(),
- rUnitBounds.getMaxX() ),
- lerp( rShapeBounds.getMinY(),
- rShapeBounds.getMaxY(),
- rUnitBounds.getMaxY() ) );
+ basegfx::tools::lerp( rShapeBounds.getMinX(),
+ rShapeBounds.getMaxX(),
+ rUnitBounds.getMinX() ),
+ basegfx::tools::lerp( rShapeBounds.getMinY(),
+ rShapeBounds.getMaxY(),
+ rUnitBounds.getMinY() ),
+ basegfx::tools::lerp( rShapeBounds.getMinX(),
+ rShapeBounds.getMaxX(),
+ rUnitBounds.getMaxX() ),
+ basegfx::tools::lerp( rShapeBounds.getMinY(),
+ rShapeBounds.getMaxY(),
+ rUnitBounds.getMaxY() ) );
}
::basegfx::B2DRectangle getShapePosSize( const ::basegfx::B2DRectangle& rOrigBounds,
diff --git a/slideshow/source/inc/lerp.hxx b/slideshow/source/inc/lerp.hxx
deleted file mode 100644
index 5aad41f4099f..000000000000
--- a/slideshow/source/inc/lerp.hxx
+++ /dev/null
@@ -1,59 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef INCLUDED_SLIDESHOW_LERP_HXX
-#define INCLUDED_SLIDESHOW_LERP_HXX
-
-#include <sal/types.h>
-
-namespace slideshow
-{
- namespace internal
- {
-
- /** Generic linear interpolator
-
- @tpl ValueType
- Must have operator+ and operator* defined, and should
- have value semantics.
-
- @param t
- As usual, t must be in the [0,1] range
- */
- template< typename ValueType > ValueType lerp( const ValueType& rFrom,
- const ValueType& rTo,
- double t )
- {
- // This is only to suppress a double->int warning. All other
- // types should be okay here.
- return static_cast<ValueType>( (1.0-t)*rFrom + t*rTo );
- }
-
- }
-}
-
-#endif /* INCLUDED_SLIDESHOW_LERP_HXX */
diff --git a/slideshow/test/export.map b/slideshow/test/export.map
index 709047ae63e5..7321bbca16ad 100644
--- a/slideshow/test/export.map
+++ b/slideshow/test/export.map
@@ -25,7 +25,7 @@
#
#*************************************************************************
-UDK_3.1 {
+UDK_3_0_0 {
global:
registerAllTestFunction;
diff --git a/slideshow/util/exports.map b/slideshow/util/exports.map
deleted file mode 100644
index 1c294f38c851..000000000000
--- a/slideshow/util/exports.map
+++ /dev/null
@@ -1,8 +0,0 @@
-SHW_1_0 {
- global:
- component_getImplementationEnvironment;
- component_writeInfo;
- component_getFactory;
- local:
- *;
-};
diff --git a/slideshow/util/makefile.mk b/slideshow/util/makefile.mk
index cdd4508ff289..def425b60469 100644
--- a/slideshow/util/makefile.mk
+++ b/slideshow/util/makefile.mk
@@ -70,7 +70,7 @@ SHL1IMPLIB=i$(TARGET)
SHL1LIBS=$(SLB)$/$(TARGET).lib
SHL1DEF=$(MISC)$/$(SHL1TARGET).def
-SHL1VERSIONMAP=exports.map
+SHL1VERSIONMAP=$(SOLARENV)/src/component.map
DEF1NAME=$(SHL1TARGET)
DEF1EXPORTFILE=exports.dxp