diff options
author | Armin Le Grand <alg@apache.org> | 2013-09-09 12:23:48 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2013-09-09 19:56:46 +0100 |
commit | e79f590e94dce54b54cd50b9cc851785b5221cb0 (patch) | |
tree | ca262144f42cb416415a30ac9e15c2028ce59d34 | |
parent | Cleanup Connection and rename from OConnection. (firebird-sdbc) (diff) | |
download | core-e79f590e94dce54b54cd50b9cc851785b5221cb0.tar.gz core-e79f590e94dce54b54cd50b9cc851785b5221cb0.zip |
Resolves: #i122777# Corrected texture mapping for 3D CustomShapes
(cherry picked from commit d747eabca2eab1032fd16257c9a502eaaa98c5d4)
Change-Id: I19139af9e9530214d581720963da6739afd1b987
-rw-r--r-- | svx/source/customshapes/EnhancedCustomShape3d.cxx | 40 |
1 files changed, 27 insertions, 13 deletions
diff --git a/svx/source/customshapes/EnhancedCustomShape3d.cxx b/svx/source/customshapes/EnhancedCustomShape3d.cxx index 7ab45770678d..c2d5187f757c 100644 --- a/svx/source/customshapes/EnhancedCustomShape3d.cxx +++ b/svx/source/customshapes/EnhancedCustomShape3d.cxx @@ -364,7 +364,11 @@ SdrObject* EnhancedCustomShape3d::Create3DObject( const SdrObject* pShape2d, con // #116336# // If shapes are mirrored once (mirroring two times correct geometry again) // double-sided at the object and two-sided-lighting at the scene need to be set. - if((bIsMirroredX && !bIsMirroredY) || (!bIsMirroredX && bIsMirroredY)) + // + // #i122777# Also use double sided for two fill styles since there several 3d objects get + // created with a depth of 0; one of them is the backside which needs double-sided to + // get visible + if(bUseTwoFillStyles || (bIsMirroredX && !bIsMirroredY) || (!bIsMirroredX && bIsMirroredY)) { aSet.Put( Svx3DDoubleSidedItem( sal_True ) ); pScene->GetProperties().SetObjectItem( Svx3DTwoSidedLightingItem( sal_True ) ); @@ -483,7 +487,9 @@ SdrObject* EnhancedCustomShape3d::Create3DObject( const SdrObject* pShape2d, con const Rectangle aBoundRect(basegfx::fround(aTempRange.getMinX()), basegfx::fround(aTempRange.getMinY()), basegfx::fround(aTempRange.getMaxX()), basegfx::fround(aTempRange.getMaxY())); aBoundRect2d.Union( aBoundRect ); - E3dCompoundObject* p3DObj = new E3dExtrudeObj( a3DDefaultAttr, aPolyPoly, bUseTwoFillStyles ? 10 : fDepth ); + // #i122777# depth 0 is okay for planes when using double-sided + E3dCompoundObject* p3DObj = new E3dExtrudeObj( a3DDefaultAttr, aPolyPoly, bUseTwoFillStyles ? 0 : fDepth ); + p3DObj->NbcSetLayer( pShape2d->GetLayer() ); p3DObj->SetMergedItemSet( aLocalSet ); if ( bIsPlaceholderObject ) @@ -496,16 +502,21 @@ SdrObject* EnhancedCustomShape3d::Create3DObject( const SdrObject* pShape2d, con { const XFillBitmapItem& rBmpItm = (XFillBitmapItem&)p3DObj->GetMergedItem(XATTR_FILLBITMAP); aFillBmp = rBmpItm.GetGraphicObject().GetGraphic().GetBitmapEx(); - Size aLogicalSize = aFillBmp.GetPrefSize(); - if ( aFillBmp.GetPrefMapMode() == MAP_PIXEL ) - aLogicalSize = Application::GetDefaultDevice()->PixelToLogic( aLogicalSize, MAP_100TH_MM ); - else - aLogicalSize = OutputDevice::LogicToLogic( aLogicalSize, aFillBmp.GetPrefMapMode(), MAP_100TH_MM ); - aLogicalSize.Width() *= 5; ;// :-( nice scaling, look at engine3d/obj3d.cxx - aLogicalSize.Height() *= 5; - aFillBmp.SetPrefSize( aLogicalSize ); - aFillBmp.SetPrefMapMode( MAP_100TH_MM ); - p3DObj->SetMergedItem(XFillBitmapItem(String(), Graphic(aFillBmp))); + + // #i122777# old adaption of FillStyle bitmap size to 5-times the original size; this is not needed + // anymore and was used in old times to male the fill look better when converting to 3D. Removed + // from regular 3D objects for some time, also needs to be removed from CustomShapes + // + //Size aLogicalSize = aFillBmp.GetPrefSize(); + //if ( aFillBmp.GetPrefMapMode() == MAP_PIXEL ) + // aLogicalSize = Application::GetDefaultDevice()->PixelToLogic( aLogicalSize, MAP_100TH_MM ); + //else + // aLogicalSize = OutputDevice::LogicToLogic( aLogicalSize, aFillBmp.GetPrefMapMode(), MAP_100TH_MM ); + //aLogicalSize.Width() *= 5; ;// :-( nice scaling, look at engine3d/obj3d.cxx + //aLogicalSize.Height() *= 5; + //aFillBmp.SetPrefSize( aLogicalSize ); + //aFillBmp.SetPrefMapMode( MAP_100TH_MM ); + //p3DObj->SetMergedItem(XFillBitmapItem(String(), Graphic(aFillBmp))); } else { @@ -536,7 +547,10 @@ SdrObject* EnhancedCustomShape3d::Create3DObject( const SdrObject* pShape2d, con p3DObj->SetMergedItem( Svx3DCloseFrontItem( sal_False ) ); p3DObj->SetMergedItem( Svx3DCloseBackItem( sal_False ) ); pScene->Insert3DObj( p3DObj ); - p3DObj = new E3dExtrudeObj( a3DDefaultAttr, aPolyPoly, 10 ); + + // #i122777# depth 0 is okay for planes when using double-sided + p3DObj = new E3dExtrudeObj( a3DDefaultAttr, aPolyPoly, 0 ); + p3DObj->NbcSetLayer( pShape2d->GetLayer() ); p3DObj->SetMergedItemSet( aLocalSet ); |