You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by al...@apache.org on 2014/02/18 22:18:14 UTC
svn commit: r1569529 - in /openoffice/trunk/main/svx:
inc/svx/sdr/contact/viewcontactofsdrole2obj.hxx source/engine3d/scene3d.cxx
source/sdr/contact/viewcontactofsdrole2obj.cxx source/unodraw/unoshape.cxx
Author: alg
Date: Tue Feb 18 21:18:13 2014
New Revision: 1569529
URL: http://svn.apache.org/r1569529
Log:
i123539 some optimizations for 3D chart geometry creation using UNO API
Modified:
openoffice/trunk/main/svx/inc/svx/sdr/contact/viewcontactofsdrole2obj.hxx
openoffice/trunk/main/svx/source/engine3d/scene3d.cxx
openoffice/trunk/main/svx/source/sdr/contact/viewcontactofsdrole2obj.cxx
openoffice/trunk/main/svx/source/unodraw/unoshape.cxx
Modified: openoffice/trunk/main/svx/inc/svx/sdr/contact/viewcontactofsdrole2obj.hxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/svx/inc/svx/sdr/contact/viewcontactofsdrole2obj.hxx?rev=1569529&r1=1569528&r2=1569529&view=diff
==============================================================================
--- openoffice/trunk/main/svx/inc/svx/sdr/contact/viewcontactofsdrole2obj.hxx (original)
+++ openoffice/trunk/main/svx/inc/svx/sdr/contact/viewcontactofsdrole2obj.hxx Tue Feb 18 21:18:13 2014
@@ -41,6 +41,10 @@ namespace sdr
{
class ViewContactOfSdrOle2Obj : public ViewContactOfSdrRectObj
{
+ private:
+ // #123539# allow local buffering of chart data (if chart)
+ drawinglayer::primitive2d::Primitive2DReference mxChartContent;
+
protected:
// Create a Object-Specific ViewObjectContact, set ViewContact and
// ObjectContact. Always needs to return something.
@@ -66,6 +70,9 @@ namespace sdr
// from the VOC which knows that
drawinglayer::primitive2d::Primitive2DSequence createPrimitive2DSequenceWithParameters(bool bHighContrast) const;
+ // #123539# get rid of buffered chart content (if there) on change
+ virtual void ActionChanged();
+
protected:
// This method is responsible for creating the graphical visualisation data
// ONLY based on model data, just wraps to call createPrimitive2DSequenceWithParameters(false)
Modified: openoffice/trunk/main/svx/source/engine3d/scene3d.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/svx/source/engine3d/scene3d.cxx?rev=1569529&r1=1569528&r2=1569529&view=diff
==============================================================================
--- openoffice/trunk/main/svx/source/engine3d/scene3d.cxx (original)
+++ openoffice/trunk/main/svx/source/engine3d/scene3d.cxx Tue Feb 18 21:18:13 2014
@@ -53,6 +53,7 @@
#include <drawinglayer/geometry/viewinformation3d.hxx>
#include <basegfx/polygon/b2dpolypolygontools.hxx>
#include <svx/e3dsceneupdater.hxx>
+#include <svx/svdmodel.hxx>
#define ITEMVALUE(ItemSet,Id,Cast) ((const Cast&)(ItemSet).Get(Id)).GetValue()
@@ -455,7 +456,14 @@ void E3dScene::NewObjectInserted(const E
void E3dScene::StructureChanged()
{
E3dObject::StructureChanged();
- SetRectsDirty();
+
+ if(!GetModel() || !GetModel()->isLocked())
+ {
+ // #123539# optimization for 3D chart object generation: do not reset
+ // already calculated scene projection data every time an object gets
+ // initialized
+ SetRectsDirty();
+ }
// #110988#
ImpCleanup3DDepthMapper();
Modified: openoffice/trunk/main/svx/source/sdr/contact/viewcontactofsdrole2obj.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/svx/source/sdr/contact/viewcontactofsdrole2obj.cxx?rev=1569529&r1=1569528&r2=1569529&view=diff
==============================================================================
--- openoffice/trunk/main/svx/source/sdr/contact/viewcontactofsdrole2obj.cxx (original)
+++ openoffice/trunk/main/svx/source/sdr/contact/viewcontactofsdrole2obj.cxx Tue Feb 18 21:18:13 2014
@@ -58,7 +58,8 @@ namespace sdr
}
ViewContactOfSdrOle2Obj::ViewContactOfSdrOle2Obj(SdrOle2Obj& rOle2Obj)
- : ViewContactOfSdrRectObj(rOle2Obj)
+ : ViewContactOfSdrRectObj(rOle2Obj),
+ mxChartContent()
{
}
@@ -104,30 +105,45 @@ namespace sdr
if(GetOle2Obj().IsChart())
{
- // try to get chart primitives and chart range directly from xChartModel
- basegfx::B2DRange aChartContentRange;
- const drawinglayer::primitive2d::Primitive2DSequence aChartSequence(
- ChartHelper::tryToGetChartContentAsPrimitive2DSequence(
- GetOle2Obj().getXModel(),
- aChartContentRange));
- const double fWidth(aChartContentRange.getWidth());
- const double fHeight(aChartContentRange.getHeight());
-
- if(aChartSequence.hasElements()
- && basegfx::fTools::more(fWidth, 0.0)
- && basegfx::fTools::more(fHeight, 0.0))
+ // #123539# allow buffering and reuse of local chart data to not need to rebuild it
+ // on every ViewObjectContact::getPrimitive2DSequence call. TTTT: No tneeded for
+ // aw080, there this mechanism alraedy works differently
+ if(mxChartContent.is())
{
- // create embedding transformation
- basegfx::B2DHomMatrix aEmbed(
- basegfx::tools::createTranslateB2DHomMatrix(
- -aChartContentRange.getMinX(),
- -aChartContentRange.getMinY()));
-
- aEmbed.scale(1.0 / fWidth, 1.0 / fHeight);
- aEmbed = aObjectMatrix * aEmbed;
- xContent = new drawinglayer::primitive2d::TransformPrimitive2D(
- aEmbed,
- aChartSequence);
+ xContent = mxChartContent;
+ }
+ else
+ {
+ // try to get chart primitives and chart range directly from xChartModel
+ basegfx::B2DRange aChartContentRange;
+ const drawinglayer::primitive2d::Primitive2DSequence aChartSequence(
+ ChartHelper::tryToGetChartContentAsPrimitive2DSequence(
+ GetOle2Obj().getXModel(),
+ aChartContentRange));
+ const double fWidth(aChartContentRange.getWidth());
+ const double fHeight(aChartContentRange.getHeight());
+
+ if(aChartSequence.hasElements()
+ && basegfx::fTools::more(fWidth, 0.0)
+ && basegfx::fTools::more(fHeight, 0.0))
+ {
+ // create embedding transformation
+ basegfx::B2DHomMatrix aEmbed(
+ basegfx::tools::createTranslateB2DHomMatrix(
+ -aChartContentRange.getMinX(),
+ -aChartContentRange.getMinY()));
+
+ aEmbed.scale(1.0 / fWidth, 1.0 / fHeight);
+ aEmbed = aObjectMatrix * aEmbed;
+ xContent = new drawinglayer::primitive2d::TransformPrimitive2D(
+ aEmbed,
+ aChartSequence);
+ }
+
+ if(xContent.is())
+ {
+ const_cast< ViewContactOfSdrOle2Obj* >(this)->mxChartContent = xContent;
+ }
}
}
@@ -160,6 +176,18 @@ namespace sdr
return drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
}
+ void ViewContactOfSdrOle2Obj::ActionChanged()
+ {
+ // call parent
+ ViewContactOfSdrRectObj::ActionChanged();
+
+ // #123539# if we have buffered chart data, reset it
+ if(mxChartContent.is())
+ {
+ mxChartContent.clear();
+ }
+ }
+
drawinglayer::primitive2d::Primitive2DSequence ViewContactOfSdrOle2Obj::createViewIndependentPrimitive2DSequence() const
{
// do as if no HC and call standard creator
Modified: openoffice/trunk/main/svx/source/unodraw/unoshape.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/svx/source/unodraw/unoshape.cxx?rev=1569529&r1=1569528&r2=1569529&view=diff
==============================================================================
--- openoffice/trunk/main/svx/source/unodraw/unoshape.cxx (original)
+++ openoffice/trunk/main/svx/source/unodraw/unoshape.cxx Tue Feb 18 21:18:13 2014
@@ -1313,7 +1313,15 @@ void SAL_CALL SvxShape::setSize( const a
if( mpObj.is() && mpModel)
{
- Rectangle aRect( svx_getLogicRectHack(mpObj.get()) );
+ // #123539# optimization for 3D chart object generation: do not use UNO
+ // API commmands to get the range, this is too expensive since for 3D
+ // scenes it may recalculate the whole scene since in AOO this depends
+ // on the contained geometry (layouted to show all content)
+ const bool b3DConstruction(dynamic_cast< E3dObject* >(mpObj.get()) && mpModel->isLocked());
+ Rectangle aRect(
+ b3DConstruction ?
+ Rectangle(maPosition.X, maPosition.Y, maSize.Width, maSize.Height) :
+ svx_getLogicRectHack(mpObj.get()) );
Size aLocalSize( rSize.Width, rSize.Height );
ForceMetricToItemPoolMetric(aLocalSize);