diff options
Diffstat (limited to 'drawinglayer/source/processor3d/defaultprocessor3d.cxx')
-rw-r--r-- | drawinglayer/source/processor3d/defaultprocessor3d.cxx | 106 |
1 files changed, 37 insertions, 69 deletions
diff --git a/drawinglayer/source/processor3d/defaultprocessor3d.cxx b/drawinglayer/source/processor3d/defaultprocessor3d.cxx index 51dfefb6ac5d..1e1212470a56 100644 --- a/drawinglayer/source/processor3d/defaultprocessor3d.cxx +++ b/drawinglayer/source/processor3d/defaultprocessor3d.cxx @@ -31,7 +31,7 @@ #include <com/sun/star/drawing/ShadeMode.hpp> #include <drawinglayer/primitive3d/transformprimitive3d.hxx> #include <drawinglayer/primitive3d/drawinglayer_primitivetypes3d.hxx> -#include <vcl/bitmapex.hxx> +#include <vcl/bitmap.hxx> #include <drawinglayer/attribute/sdrsceneattribute3d.hxx> #include <drawinglayer/attribute/sdrlightingattribute3d.hxx> #include <vcl/graph.hxx> @@ -59,106 +59,82 @@ namespace drawinglayer::processor3d // create texture const attribute::FillGradientAttribute& rFillGradient = rPrimitive.getGradient(); const basegfx::B2DRange aOutlineRange(0.0, 0.0, rPrimitive.getTextureSize().getX(), rPrimitive.getTextureSize().getY()); - const attribute::GradientStyle aGradientStyle(rFillGradient.getStyle()); - sal_uInt32 nSteps(rFillGradient.getSteps()); - const basegfx::BColor& aStart(rFillGradient.getStartColor()); - const basegfx::BColor& aEnd(rFillGradient.getEndColor()); - const sal_uInt32 nMaxSteps(sal_uInt32((aStart.getMaximumDistance(aEnd) * 127.5) + 0.5)); + const css::awt::GradientStyle aGradientStyle(rFillGradient.getStyle()); std::shared_ptr< texture::GeoTexSvx > pNewTex; + basegfx::BColor aSingleColor; - if(nMaxSteps) + if (!rFillGradient.getColorStops().isSingleColor(aSingleColor)) { - // there IS a color distance - if(nSteps == 0) - { - nSteps = nMaxSteps; - } - - if(nSteps < 2) - { - nSteps = 2; - } - - if(nSteps > nMaxSteps) - { - nSteps = nMaxSteps; - } - switch(aGradientStyle) { - case attribute::GradientStyle::Linear: + default: // GradientStyle_MAKE_FIXED_SIZE + case css::awt::GradientStyle_LINEAR: { pNewTex = std::make_shared<texture::GeoTexSvxGradientLinear>( aOutlineRange, aOutlineRange, - aStart, - aEnd, - nSteps, + rFillGradient.getSteps(), + rFillGradient.getColorStops(), rFillGradient.getBorder(), rFillGradient.getAngle()); break; } - case attribute::GradientStyle::Axial: + case css::awt::GradientStyle_AXIAL: { pNewTex = std::make_shared<texture::GeoTexSvxGradientAxial>( aOutlineRange, aOutlineRange, - aStart, - aEnd, - nSteps, + rFillGradient.getSteps(), + rFillGradient.getColorStops(), rFillGradient.getBorder(), rFillGradient.getAngle()); break; } - case attribute::GradientStyle::Radial: + case css::awt::GradientStyle_RADIAL: { pNewTex = std::make_shared<texture::GeoTexSvxGradientRadial>( aOutlineRange, - aStart, - aEnd, - nSteps, + rFillGradient.getSteps(), + rFillGradient.getColorStops(), rFillGradient.getBorder(), rFillGradient.getOffsetX(), rFillGradient.getOffsetY()); break; } - case attribute::GradientStyle::Elliptical: + case css::awt::GradientStyle_ELLIPTICAL: { pNewTex = std::make_shared<texture::GeoTexSvxGradientElliptical>( aOutlineRange, - aStart, - aEnd, - nSteps, + rFillGradient.getSteps(), + rFillGradient.getColorStops(), rFillGradient.getBorder(), rFillGradient.getOffsetX(), rFillGradient.getOffsetY(), rFillGradient.getAngle()); break; } - case attribute::GradientStyle::Square: + case css::awt::GradientStyle_SQUARE: { pNewTex = std::make_shared<texture::GeoTexSvxGradientSquare>( aOutlineRange, - aStart, - aEnd, - nSteps, + rFillGradient.getSteps(), + rFillGradient.getColorStops(), rFillGradient.getBorder(), rFillGradient.getOffsetX(), rFillGradient.getOffsetY(), rFillGradient.getAngle()); break; } - case attribute::GradientStyle::Rect: + case css::awt::GradientStyle_RECT: { pNewTex = std::make_shared<texture::GeoTexSvxGradientRect>( aOutlineRange, - aStart, - aEnd, - nSteps, + rFillGradient.getSteps(), + rFillGradient.getColorStops(), rFillGradient.getBorder(), rFillGradient.getOffsetX(), rFillGradient.getOffsetY(), @@ -171,20 +147,16 @@ namespace drawinglayer::processor3d } else { - // no color distance -> same color, use simple texture - pNewTex = std::make_shared<texture::GeoTexSvxMono>(aStart, 1.0 - aStart.luminance()); + // only one color, so no real gradient -> use simple texture + pNewTex = std::make_shared<texture::GeoTexSvxMono>(aSingleColor, 1.0 - aSingleColor.luminance()); mbSimpleTextureActive = true; } // set created texture if(bTransparence) - { - mpTransparenceGeoTexSvx = pNewTex; - } + mpTransparenceGeoTexSvx = std::move(pNewTex); else - { - mpGeoTexSvx = pNewTex; - } + mpGeoTexSvx = std::move(pNewTex); // process sub-list process(rSubSequence); @@ -196,11 +168,11 @@ namespace drawinglayer::processor3d if(bTransparence) { - mpTransparenceGeoTexSvx = pOldTex; + mpTransparenceGeoTexSvx = std::move(pOldTex); } else { - mpGeoTexSvx = pOldTex; + mpGeoTexSvx = std::move(pOldTex); } } @@ -214,7 +186,7 @@ namespace drawinglayer::processor3d // rescue values const bool bOldModulate(getModulate()); mbModulate = rPrimitive.getModulate(); const bool bOldFilter(getFilter()); mbFilter = rPrimitive.getFilter(); - std::shared_ptr< texture::GeoTexSvx > pOldTex = mpGeoTexSvx; + std::shared_ptr<texture::GeoTexSvx> xOldTex(mpGeoTexSvx); // calculate logic pixel size in object coordinates. Create transformation view // to object by inverting ObjectToView @@ -242,7 +214,7 @@ namespace drawinglayer::processor3d // restore values mbModulate = bOldModulate; mbFilter = bOldFilter; - mpGeoTexSvx = pOldTex; + mpGeoTexSvx = std::move(xOldTex); } void DefaultProcessor3D::impRenderBitmapTexturePrimitive3D(const primitive3d::BitmapTexturePrimitive3D& rPrimitive) @@ -261,7 +233,7 @@ namespace drawinglayer::processor3d const attribute::FillGraphicAttribute& rFillGraphicAttribute = rPrimitive.getFillGraphicAttribute(); // #121194# For 3D texture we will use the BitmapRex representation - const BitmapEx aBitmapEx(rFillGraphicAttribute.getGraphic().GetBitmapEx()); + const Bitmap aBitmap(rFillGraphicAttribute.getGraphic().GetBitmap()); // create range scaled by texture size basegfx::B2DRange aGraphicRange(rFillGraphicAttribute.getGraphicRange()); @@ -274,7 +246,7 @@ namespace drawinglayer::processor3d { mpGeoTexSvx = std::make_shared<texture::GeoTexSvxBitmapExTiled>( - aBitmapEx, + aBitmap, aGraphicRange, rFillGraphicAttribute.getOffsetX(), rFillGraphicAttribute.getOffsetY()); @@ -283,7 +255,7 @@ namespace drawinglayer::processor3d { mpGeoTexSvx = std::make_shared<texture::GeoTexSvxBitmapEx>( - aBitmapEx, + aBitmap, aGraphicRange); } @@ -293,7 +265,7 @@ namespace drawinglayer::processor3d // restore values mbModulate = bOldModulate; mbFilter = bOldFilter; - mpGeoTexSvx = pOldTex; + mpGeoTexSvx = std::move(pOldTex); } void DefaultProcessor3D::impRenderModifiedColorPrimitive3D(const primitive3d::ModifiedColorPrimitive3D& rModifiedCandidate) @@ -489,13 +461,13 @@ namespace drawinglayer::processor3d aLastViewInformation3D.getDeviceToView(), aLastViewInformation3D.getViewTime(), aLastViewInformation3D.getExtendedInformationSequence()); - updateViewInformation(aNewViewInformation3D); + setViewInformation3D(aNewViewInformation3D); // let break down recursively process(rTransformCandidate.getChildren()); // restore transformations - updateViewInformation(aLastViewInformation3D); + setViewInformation3D(aLastViewInformation3D); } void DefaultProcessor3D::processBasePrimitive3D(const primitive3d::BasePrimitive3D& rBasePrimitive) @@ -577,11 +549,7 @@ namespace drawinglayer::processor3d : BaseProcessor3D(rViewInformation), mrSdrSceneAttribute(rSdrSceneAttribute), mrSdrLightingAttribute(rSdrLightingAttribute), - maRasterRange(), maBColorModifierStack(), - mpGeoTexSvx(), - mpTransparenceGeoTexSvx(), - maDrawinglayerOpt(), mnTransparenceCounter(0), mbModulate(false), mbFilter(false), |