diff options
author | Vladimir Glazounov <vg@openoffice.org> | 2009-03-15 14:43:10 +0000 |
---|---|---|
committer | Vladimir Glazounov <vg@openoffice.org> | 2009-03-15 14:43:10 +0000 |
commit | d75a74bf2a45c3ee051fa424b0e7350f5b77c518 (patch) | |
tree | b3450fc9c64c09aaf4d15b351c4757fe85372ec1 | |
parent | 1bad9334e8d2683dec2218ac9c632f658d46d8e0 (diff) |
CWS-TOOLING: integrate CWS aw064
2009-02-10 17:39:02 +0100 aw r267569 : #i98314# adapted texture size to object size
2009-02-05 15:26:16 +0100 aw r267427 : #i98532# added mirroring of redline info when RTL is on
2009-02-04 16:31:27 +0100 aw r267392 : #i98314# corrected texturing for E3dPolygonObj's primitive creation
2009-02-02 17:58:49 +0100 aw r267285 : #i98295# corrected orientation of E3dPolygonObj's polygon definition on it's way to prmitives
2009-02-02 17:57:32 +0100 aw r267283 : #i98295# optimized SdrPolyPolygonPrimitive3D::createLocalDecomposition data flow
8 files changed, 261 insertions, 170 deletions
diff --git a/drawinglayer/inc/drawinglayer/primitive3d/sdrdecompositiontools3d.hxx b/drawinglayer/inc/drawinglayer/primitive3d/sdrdecompositiontools3d.hxx index bcbc8c67f847..772e030781fe 100644 --- a/drawinglayer/inc/drawinglayer/primitive3d/sdrdecompositiontools3d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive3d/sdrdecompositiontools3d.hxx @@ -37,6 +37,7 @@ #define INCLUDED_DRAWINGLAYER_PRIMITIVE3D_SDRDECOMPOSITIONTOOLS3D_HXX #include <drawinglayer/primitive3d/baseprimitive3d.hxx> +#include <com/sun/star/drawing/TextureProjectionMode.hpp> #include <vector> ////////////////////////////////////////////////////////////////////////////// @@ -62,6 +63,20 @@ namespace drawinglayer { namespace primitive3d { + // #i98295# + basegfx::B3DRange getRangeFrom3DGeometry(::std::vector< basegfx::B3DPolyPolygon >& rFill); + void applyNormalsKindSphereTo3DGeometry(::std::vector< basegfx::B3DPolyPolygon >& rFill, const basegfx::B3DRange& rRange); + void applyNormalsKindFlatTo3DGeometry(::std::vector< basegfx::B3DPolyPolygon >& rFill); + void applyNormalsInvertTo3DGeometry(::std::vector< basegfx::B3DPolyPolygon >& rFill); + + // #i98314# + void applyTextureTo3DGeometry( + ::com::sun::star::drawing::TextureProjectionMode eModeX, + ::com::sun::star::drawing::TextureProjectionMode eModeY, + ::std::vector< basegfx::B3DPolyPolygon >& rFill, + const basegfx::B3DRange& rRange, + const basegfx::B2DVector& rTextureSize); + Primitive3DSequence create3DPolyPolygonLinePrimitives( const basegfx::B3DPolyPolygon& rUnitPolyPolygon, const basegfx::B3DHomMatrix& rObjectTransform, diff --git a/drawinglayer/source/primitive3d/sdrdecompositiontools3d.cxx b/drawinglayer/source/primitive3d/sdrdecompositiontools3d.cxx index 241d02926cc1..df682ab04e6f 100644 --- a/drawinglayer/source/primitive3d/sdrdecompositiontools3d.cxx +++ b/drawinglayer/source/primitive3d/sdrdecompositiontools3d.cxx @@ -64,6 +64,93 @@ namespace drawinglayer { namespace primitive3d { + basegfx::B3DRange getRangeFrom3DGeometry(::std::vector< basegfx::B3DPolyPolygon >& rFill) + { + basegfx::B3DRange aRetval; + + for(sal_uInt32 a(0); a < rFill.size(); a++) + { + aRetval.expand(basegfx::tools::getRange(rFill[a])); + } + + return aRetval; + } + + void applyNormalsKindSphereTo3DGeometry(::std::vector< basegfx::B3DPolyPolygon >& rFill, const basegfx::B3DRange& rRange) + { + // create sphere normals + const basegfx::B3DPoint aCenter(rRange.getCenter()); + + for(sal_uInt32 a(0); a < rFill.size(); a++) + { + rFill[a] = basegfx::tools::applyDefaultNormalsSphere(rFill[a], aCenter); + } + } + + void applyNormalsKindFlatTo3DGeometry(::std::vector< basegfx::B3DPolyPolygon >& rFill) + { + for(sal_uInt32 a(0); a < rFill.size(); a++) + { + rFill[a].clearNormals(); + } + } + + void applyNormalsInvertTo3DGeometry(::std::vector< basegfx::B3DPolyPolygon >& rFill) + { + // invert normals + for(sal_uInt32 a(0); a < rFill.size(); a++) + { + rFill[a] = basegfx::tools::invertNormals(rFill[a]); + } + } + + void applyTextureTo3DGeometry( + ::com::sun::star::drawing::TextureProjectionMode eModeX, + ::com::sun::star::drawing::TextureProjectionMode eModeY, + ::std::vector< basegfx::B3DPolyPolygon >& rFill, + const basegfx::B3DRange& rRange, + const basegfx::B2DVector& rTextureSize) + { + sal_uInt32 a; + + // handle texture coordinates X + const bool bParallelX(::com::sun::star::drawing::TextureProjectionMode_PARALLEL == eModeX); + const bool bSphereX(!bParallelX && (::com::sun::star::drawing::TextureProjectionMode_SPHERE == eModeX)); + + // handle texture coordinates Y + const bool bParallelY(::com::sun::star::drawing::TextureProjectionMode_PARALLEL == eModeY); + const bool bSphereY(!bParallelY && (::com::sun::star::drawing::TextureProjectionMode_SPHERE == eModeY)); + + if(bParallelX || bParallelY) + { + // apply parallel texture coordinates in X and/or Y + for(a = 0; a < rFill.size(); a++) + { + rFill[a] = basegfx::tools::applyDefaultTextureCoordinatesParallel(rFill[a], rRange, bParallelX, bParallelY); + } + } + + if(bSphereX || bSphereY) + { + // apply spherical texture coordinates in X and/or Y + const basegfx::B3DPoint aCenter(rRange.getCenter()); + + for(a = 0; a < rFill.size(); a++) + { + rFill[a] = basegfx::tools::applyDefaultTextureCoordinatesSphere(rFill[a], aCenter, bSphereX, bSphereY); + } + } + + // transform texture coordinates to texture size + basegfx::B2DHomMatrix aTexMatrix; + aTexMatrix.scale(rTextureSize.getX(), rTextureSize.getY()); + + for(a = 0; a < rFill.size(); a++) + { + rFill[a].transformTextureCoordiantes(aTexMatrix); + } + } + Primitive3DSequence create3DPolyPolygonLinePrimitives( const basegfx::B3DPolyPolygon& rUnitPolyPolygon, const basegfx::B3DHomMatrix& rObjectTransform, diff --git a/drawinglayer/source/primitive3d/sdrextrudeprimitive3d.cxx b/drawinglayer/source/primitive3d/sdrextrudeprimitive3d.cxx index a83147da5022..e9ef154c95f3 100644 --- a/drawinglayer/source/primitive3d/sdrextrudeprimitive3d.cxx +++ b/drawinglayer/source/primitive3d/sdrextrudeprimitive3d.cxx @@ -67,10 +67,10 @@ namespace drawinglayer if(rSliceVector.size()) { sal_uInt32 a; - basegfx::B3DRange aRange; // decide what to create - const bool bCreateNormals(::com::sun::star::drawing::NormalsKind_SPECIFIC == getSdr3DObjectAttribute().getNormalsKind()); + const ::com::sun::star::drawing::NormalsKind eNormalsKind(getSdr3DObjectAttribute().getNormalsKind()); + const bool bCreateNormals(::com::sun::star::drawing::NormalsKind_SPECIFIC == eNormalsKind); const bool bCreateTextureCoordiantesX(::com::sun::star::drawing::TextureProjectionMode_OBJECTSPECIFIC == getSdr3DObjectAttribute().getTextureProjectionX()); const bool bCreateTextureCoordiantesY(::com::sun::star::drawing::TextureProjectionMode_OBJECTSPECIFIC == getSdr3DObjectAttribute().getTextureProjectionY()); double fRelativeTextureWidth(1.0); @@ -103,82 +103,35 @@ namespace drawinglayer 0.5, 0.6, bCreateTextureCoordiantesX || bCreateTextureCoordiantesY, aTexTransform); // get full range - for(a = 0L; a < aFill.size(); a++) - { - aRange.expand(basegfx::tools::getRange(aFill[a])); - } + const basegfx::B3DRange aRange(getRangeFrom3DGeometry(aFill)); // normal creation if(getSdrLFSAttribute().getFill()) { - if(::com::sun::star::drawing::NormalsKind_SPHERE == getSdr3DObjectAttribute().getNormalsKind()) + if(::com::sun::star::drawing::NormalsKind_SPHERE == eNormalsKind) { - // create sphere normals - const basegfx::B3DPoint aCenter(aRange.getCenter()); - - for(a = 0L; a < aFill.size(); a++) - { - aFill[a] = basegfx::tools::applyDefaultNormalsSphere(aFill[a], aCenter); - } + applyNormalsKindSphereTo3DGeometry(aFill, aRange); } - else if(::com::sun::star::drawing::NormalsKind_FLAT == getSdr3DObjectAttribute().getNormalsKind()) + else if(::com::sun::star::drawing::NormalsKind_FLAT == eNormalsKind) { - for(a = 0L; a < aFill.size(); a++) - { - aFill[a].clearNormals(); - } + applyNormalsKindFlatTo3DGeometry(aFill); } if(getSdr3DObjectAttribute().getNormalsInvert()) { - // invert normals - for(a = 0L; a < aFill.size(); a++) - { - aFill[a] = basegfx::tools::invertNormals(aFill[a]); - } + applyNormalsInvertTo3DGeometry(aFill); } } // texture coordinates if(getSdrLFSAttribute().getFill()) { - // handle texture coordinates X - const bool bParallelX(::com::sun::star::drawing::TextureProjectionMode_PARALLEL == getSdr3DObjectAttribute().getTextureProjectionX()); - const bool bSphereX(!bParallelX && (::com::sun::star::drawing::TextureProjectionMode_SPHERE == getSdr3DObjectAttribute().getTextureProjectionX())); - - // handle texture coordinates Y - const bool bParallelY(::com::sun::star::drawing::TextureProjectionMode_PARALLEL == getSdr3DObjectAttribute().getTextureProjectionY()); - const bool bSphereY(!bParallelY && (::com::sun::star::drawing::TextureProjectionMode_SPHERE == getSdr3DObjectAttribute().getTextureProjectionY())); - - if(bParallelX || bParallelY) - { - // apply parallel texture coordinates in X and/or Y - - for(a = 0L; a < aFill.size(); a++) - { - aFill[a] = basegfx::tools::applyDefaultTextureCoordinatesParallel(aFill[a], aRange, bParallelX, bParallelY); - } - } - - if(bSphereX || bSphereY) - { - // apply spherical texture coordinates in X and/or Y - const basegfx::B3DPoint aCenter(aRange.getCenter()); - - for(a = 0L; a < aFill.size(); a++) - { - aFill[a] = basegfx::tools::applyDefaultTextureCoordinatesSphere(aFill[a], aCenter, bSphereX, bSphereY); - } - } - - // transform texture coordinates to texture size - basegfx::B2DHomMatrix aTexMatrix; - aTexMatrix.scale(getTextureSize().getX(), getTextureSize().getY()); - - for(a = 0L; a < aFill.size(); a++) - { - aFill[a].transformTextureCoordiantes(aTexMatrix); - } + applyTextureTo3DGeometry( + getSdr3DObjectAttribute().getTextureProjectionX(), + getSdr3DObjectAttribute().getTextureProjectionY(), + aFill, + aRange, + getTextureSize()); } if(getSdrLFSAttribute().getFill()) diff --git a/drawinglayer/source/primitive3d/sdrlatheprimitive3d.cxx b/drawinglayer/source/primitive3d/sdrlatheprimitive3d.cxx index f51aa3a85e24..33008e762c0a 100644 --- a/drawinglayer/source/primitive3d/sdrlatheprimitive3d.cxx +++ b/drawinglayer/source/primitive3d/sdrlatheprimitive3d.cxx @@ -69,10 +69,10 @@ namespace drawinglayer const bool bBackScale(!basegfx::fTools::equal(getBackScale(), 1.0)); const bool bClosedRotation(!bBackScale && getHorizontalSegments() && basegfx::fTools::equal(getRotation(), F_2PI)); sal_uInt32 a; - basegfx::B3DRange aRange; // decide what to create - const bool bCreateNormals(::com::sun::star::drawing::NormalsKind_SPECIFIC == getSdr3DObjectAttribute().getNormalsKind()); + const ::com::sun::star::drawing::NormalsKind eNormalsKind(getSdr3DObjectAttribute().getNormalsKind()); + const bool bCreateNormals(::com::sun::star::drawing::NormalsKind_SPECIFIC == eNormalsKind); const bool bCreateTextureCoordiantesX(::com::sun::star::drawing::TextureProjectionMode_OBJECTSPECIFIC == getSdr3DObjectAttribute().getTextureProjectionX()); const bool bCreateTextureCoordiantesY(::com::sun::star::drawing::TextureProjectionMode_OBJECTSPECIFIC == getSdr3DObjectAttribute().getTextureProjectionY()); basegfx::B2DHomMatrix aTexTransform; @@ -96,82 +96,35 @@ namespace drawinglayer 0.85, 0.6, bCreateTextureCoordiantesX || bCreateTextureCoordiantesY, aTexTransform); // get full range - for(a = 0L; a < aFill.size(); a++) - { - aRange.expand(basegfx::tools::getRange(aFill[a])); - } + const basegfx::B3DRange aRange(getRangeFrom3DGeometry(aFill)); // normal creation if(getSdrLFSAttribute().getFill()) { - if(::com::sun::star::drawing::NormalsKind_SPHERE == getSdr3DObjectAttribute().getNormalsKind()) + if(::com::sun::star::drawing::NormalsKind_SPHERE == eNormalsKind) { - // create sphere normals - const basegfx::B3DPoint aCenter(aRange.getCenter()); - - for(a = 0L; a < aFill.size(); a++) - { - aFill[a] = basegfx::tools::applyDefaultNormalsSphere(aFill[a], aCenter); - } + applyNormalsKindSphereTo3DGeometry(aFill, aRange); } - else if(::com::sun::star::drawing::NormalsKind_FLAT == getSdr3DObjectAttribute().getNormalsKind()) + else if(::com::sun::star::drawing::NormalsKind_FLAT == eNormalsKind) { - for(a = 0L; a < aFill.size(); a++) - { - aFill[a].clearNormals(); - } + applyNormalsKindFlatTo3DGeometry(aFill); } if(getSdr3DObjectAttribute().getNormalsInvert()) { - // invert normals - for(a = 0L; a < aFill.size(); a++) - { - aFill[a] = basegfx::tools::invertNormals(aFill[a]); - } + applyNormalsInvertTo3DGeometry(aFill); } } // texture coordinates if(getSdrLFSAttribute().getFill()) { - // handle texture coordinates X - const bool bParallelX(::com::sun::star::drawing::TextureProjectionMode_PARALLEL == getSdr3DObjectAttribute().getTextureProjectionX()); - const bool bSphereX(!bParallelX && (::com::sun::star::drawing::TextureProjectionMode_SPHERE == getSdr3DObjectAttribute().getTextureProjectionX())); - - // handle texture coordinates Y - const bool bParallelY(::com::sun::star::drawing::TextureProjectionMode_PARALLEL == getSdr3DObjectAttribute().getTextureProjectionY()); - const bool bSphereY(!bParallelY && (::com::sun::star::drawing::TextureProjectionMode_SPHERE == getSdr3DObjectAttribute().getTextureProjectionY())); - - if(bParallelX || bParallelY) - { - // apply parallel texture coordinates in X and/or Y - - for(a = 0L; a < aFill.size(); a++) - { - aFill[a] = basegfx::tools::applyDefaultTextureCoordinatesParallel(aFill[a], aRange, bParallelX, bParallelY); - } - } - - if(bSphereX || bSphereY) - { - // apply spherical texture coordinates in X and/or Y - const basegfx::B3DPoint aCenter(aRange.getCenter()); - - for(a = 0L; a < aFill.size(); a++) - { - aFill[a] = basegfx::tools::applyDefaultTextureCoordinatesSphere(aFill[a], aCenter, bSphereX, bSphereY); - } - } - - // transform texture coordinates to texture size - basegfx::B2DHomMatrix aTexMatrix; - aTexMatrix.scale(getTextureSize().getX(), getTextureSize().getY()); - - for(a = 0L; a < aFill.size(); a++) - { - aFill[a].transformTextureCoordiantes(aTexMatrix); - } + applyTextureTo3DGeometry( + getSdr3DObjectAttribute().getTextureProjectionX(), + getSdr3DObjectAttribute().getTextureProjectionY(), + aFill, + aRange, + getTextureSize()); } if(getSdrLFSAttribute().getFill()) diff --git a/drawinglayer/source/primitive3d/sdrpolypolygonprimitive3d.cxx b/drawinglayer/source/primitive3d/sdrpolypolygonprimitive3d.cxx index e27b8b43fe93..a0813d3202a8 100644 --- a/drawinglayer/source/primitive3d/sdrpolypolygonprimitive3d.cxx +++ b/drawinglayer/source/primitive3d/sdrpolypolygonprimitive3d.cxx @@ -62,6 +62,38 @@ namespace drawinglayer ::std::vector< basegfx::B3DPolyPolygon > aFill; aFill.push_back(getPolyPolygon3D()); + // get full range + const basegfx::B3DRange aRange(getRangeFrom3DGeometry(aFill)); + + // #i98295# normal creation + if(getSdrLFSAttribute().getFill()) + { + if(::com::sun::star::drawing::NormalsKind_SPHERE == getSdr3DObjectAttribute().getNormalsKind()) + { + applyNormalsKindSphereTo3DGeometry(aFill, aRange); + } + else if(::com::sun::star::drawing::NormalsKind_FLAT == getSdr3DObjectAttribute().getNormalsKind()) + { + applyNormalsKindFlatTo3DGeometry(aFill); + } + + if(getSdr3DObjectAttribute().getNormalsInvert()) + { + applyNormalsInvertTo3DGeometry(aFill); + } + } + + // #i98314# texture coordinates + if(getSdrLFSAttribute().getFill()) + { + applyTextureTo3DGeometry( + getSdr3DObjectAttribute().getTextureProjectionX(), + getSdr3DObjectAttribute().getTextureProjectionY(), + aFill, + aRange, + getTextureSize()); + } + if(getSdrLFSAttribute().getFill()) { // add fill diff --git a/drawinglayer/source/processor3d/defaultprocessor3d.cxx b/drawinglayer/source/processor3d/defaultprocessor3d.cxx index 9631bd344e6f..d9194ca4b5eb 100644 --- a/drawinglayer/source/processor3d/defaultprocessor3d.cxx +++ b/drawinglayer/source/processor3d/defaultprocessor3d.cxx @@ -312,6 +312,11 @@ namespace drawinglayer basegfx::BColor aObjectColor(rPrimitive.getMaterial().getColor()); bool bPaintIt(aFill.count()); + // #i98295# get ShadeMode. Correct early when only flat is possible due to missing normals + const ::com::sun::star::drawing::ShadeMode aShadeMode( + aFill.areNormalsUsed() ? + getSdrSceneAttribute().getShadeMode() : ::com::sun::star::drawing::ShadeMode_FLAT); + if(bPaintIt) { // get rid of texture coordinates if there is no texture @@ -320,6 +325,13 @@ namespace drawinglayer aFill.clearTextureCoordinates(); } + // #i98295# get rid of normals and color early when not needed + if(::com::sun::star::drawing::ShadeMode_FLAT == aShadeMode) + { + aFill.clearNormals(); + aFill.clearBColors(); + } + // transform to device coordinates (-1.0 .. 1.0) and check for visibility aFill.transform(getViewInformation3D().getObjectToView()); const basegfx::B3DRange a3DRange(basegfx::tools::getRange(aFill)); @@ -344,7 +356,6 @@ namespace drawinglayer if(bPaintIt) { // prepare ObjectToEye in NormalTransform - ::com::sun::star::drawing::ShadeMode aShadeMode(getSdrSceneAttribute().getShadeMode()); basegfx::B3DHomMatrix aNormalTransform(getViewInformation3D().getOrientation() * getViewInformation3D().getObjectTransformation()); if(getSdrSceneAttribute().getTwoSidedLighting()) @@ -360,27 +371,17 @@ namespace drawinglayer } } - if(::com::sun::star::drawing::ShadeMode_PHONG == aShadeMode) + switch(aShadeMode) { - // phong shading - if(aFill.areNormalsUsed()) + case ::com::sun::star::drawing::ShadeMode_PHONG: { - // transform normals to eye coor + // phong shading. Transform normals to eye coor aFill.transformNormals(aNormalTransform); + break; } - else - { - // fallback to gouraud when no normals available - aShadeMode = ::com::sun::star::drawing::ShadeMode_SMOOTH; - } - } - - if(::com::sun::star::drawing::ShadeMode_SMOOTH == aShadeMode) - { - // gouraud shading - if(aFill.areNormalsUsed()) + case ::com::sun::star::drawing::ShadeMode_SMOOTH: { - // transform normals to eye coor + // gouraud shading. Transform normals to eye coor aFill.transformNormals(aNormalTransform); // prepare color model parameters, evtl. use blend color @@ -406,38 +407,30 @@ namespace drawinglayer aPartFill.clearNormals(); aFill.setB3DPolygon(a, aPartFill); } + break; } - else + case ::com::sun::star::drawing::ShadeMode_FLAT: { - // fallback to flat when no normals available - aShadeMode = ::com::sun::star::drawing::ShadeMode_FLAT; - } - } + // flat shading. Get plane vector in eye coordinates + const basegfx::B3DVector aPlaneEyeNormal(aNormalTransform * rPrimitive.getB3DPolyPolygon().getB3DPolygon(0L).getNormal()); - if(::com::sun::star::drawing::ShadeMode_FLAT == aShadeMode) - { - // flat shading. Clear normals and colors - aFill.clearNormals(); - aFill.clearBColors(); - - // get plane vector in eye coordinates - const basegfx::B3DVector aPlaneEyeNormal(aNormalTransform * rPrimitive.getB3DPolyPolygon().getB3DPolygon(0L).getNormal()); - - // prepare color model parameters, evtl. use blend color - const basegfx::BColor aColor(getModulate() ? basegfx::BColor(1.0, 1.0, 1.0) : rPrimitive.getMaterial().getColor()); - const basegfx::BColor& rSpecular(rPrimitive.getMaterial().getSpecular()); - const basegfx::BColor& rEmission(rPrimitive.getMaterial().getEmission()); - const sal_uInt16 nSpecularIntensity(rPrimitive.getMaterial().getSpecularIntensity()); - - // solve color model for plane vector and use that color for whole plane - aObjectColor = getSdrLightingAttribute().solveColorModel(aPlaneEyeNormal, aColor, rSpecular, rEmission, nSpecularIntensity); - } + // prepare color model parameters, evtl. use blend color + const basegfx::BColor aColor(getModulate() ? basegfx::BColor(1.0, 1.0, 1.0) : rPrimitive.getMaterial().getColor()); + const basegfx::BColor& rSpecular(rPrimitive.getMaterial().getSpecular()); + const basegfx::BColor& rEmission(rPrimitive.getMaterial().getEmission()); + const sal_uInt16 nSpecularIntensity(rPrimitive.getMaterial().getSpecularIntensity()); - if(::com::sun::star::drawing::ShadeMode_DRAFT == aShadeMode) - { - // draft, just use object color which is already set. Delete all other infos - aFill.clearNormals(); - aFill.clearBColors(); + // solve color model for plane vector and use that color for whole plane + aObjectColor = getSdrLightingAttribute().solveColorModel(aPlaneEyeNormal, aColor, rSpecular, rEmission, nSpecularIntensity); + break; + } + default: // case ::com::sun::star::drawing::ShadeMode_DRAFT: + { + // draft, just use object color which is already set. Delete all other infos + aFill.clearNormals(); + aFill.clearBColors(); + break; + } } // draw it to ZBuffer diff --git a/svx/source/sdr/contact/viewcontactofe3dpolygon.cxx b/svx/source/sdr/contact/viewcontactofe3dpolygon.cxx index fbe39a6f3034..851ee1f3da58 100644 --- a/svx/source/sdr/contact/viewcontactofe3dpolygon.cxx +++ b/svx/source/sdr/contact/viewcontactofe3dpolygon.cxx @@ -38,6 +38,7 @@ #include <svx/sdr/primitive2d/sdrattributecreator.hxx> #include <svx/sdr/primitive3d/sdrattributecreator3d.hxx> #include <basegfx/polygon/b3dpolygon.hxx> +#include <basegfx/polygon/b3dpolypolygontools.hxx> ////////////////////////////////////////////////////////////////////////////// @@ -120,11 +121,57 @@ namespace sdr if(bTexture) { - const basegfx::B2DRange aTxRange(basegfx::tools::getRange(aPolyTexture2D)); - aTextureSize.setX(aTxRange.getWidth()); - aTextureSize.setY(aTxRange.getHeight()); + // #i98314# + // create texture size from object's size + const basegfx::B3DRange aObjectRange(basegfx::tools::getRange(aPolyPolygon3D)); + + double fWidth(0.0); + double fHeight(0.0); + + // this is a polygon object, so Width/Height and/or Depth may be zero (e.g. left + // wall of chart). Take this into account + if(basegfx::fTools::equalZero(aObjectRange.getWidth())) + { + // width is zero, use height and depth + fWidth = aObjectRange.getHeight(); + fHeight = aObjectRange.getDepth(); + } + else if(basegfx::fTools::equalZero(aObjectRange.getHeight())) + { + // height is zero, use width and depth + fWidth = aObjectRange.getWidth(); + fHeight = aObjectRange.getDepth(); + } + else + { + // use width and height + fWidth = aObjectRange.getWidth(); + fHeight = aObjectRange.getHeight(); + } + + if(basegfx::fTools::lessOrEqual(fWidth, 0.0) ||basegfx::fTools::lessOrEqual(fHeight, 0.0)) + { + // no texture; fallback to very small size + aTextureSize.setX(0.01); + aTextureSize.setY(0.01); + } + else + { + aTextureSize.setX(fWidth); + aTextureSize.setY(fHeight); + } } + // #i98295# + // unfortunately, this SdrObject type which allows a free 3d geometry definition was defined + // wrong topologically in relation to it's plane normal and 3D visibility when it was invented + // a long time ago. Since the API allows creation of this SDrObject type, it is not possible to + // simply change this definition. Only the chart should use it, and at least this object type + // only exists at Runtime (is not saved and/or loaded in any FileFormat). Still someone external + // may have used it in it's API. To not risk wrong 3D lightings, i have to switch the orientation + // of the polygon here + aPolyPolygon3D.flip(); + // create primitive and add const basegfx::B3DHomMatrix aWorldTransform; const drawinglayer::primitive3d::Primitive3DReference xReference(new drawinglayer::primitive3d::SdrPolyPolygonPrimitive3D( diff --git a/svx/source/svdraw/svdotextdecomposition.cxx b/svx/source/svdraw/svdotextdecomposition.cxx index 316cec90337f..b6dc0a8186f2 100644 --- a/svx/source/svdraw/svdotextdecomposition.cxx +++ b/svx/source/svdraw/svdotextdecomposition.cxx @@ -435,6 +435,17 @@ namespace if(!basegfx::fTools::equal(fStart, fEnd)) { + if(rInfo.IsRTL()) + { + // #i98523# + // When the portion is RTL, mirror the redlining using the + // full portion width + const double fTextWidth(aDXArray[aDXArray.size() - 1]); + + fStart = fTextWidth - fStart; + fEnd = fTextWidth - fEnd; + } + maTextPortionPrimitives.push_back(new drawinglayer::primitive2d::WrongSpellPrimitive2D( aNewTransform, fStart, |