diff options
Diffstat (limited to 'drawinglayer')
5 files changed, 109 insertions, 112 deletions
diff --git a/drawinglayer/source/primitive2d/borderlineprimitive2d.cxx b/drawinglayer/source/primitive2d/borderlineprimitive2d.cxx index cc48f6467364..3aa4f01b6d53 100644 --- a/drawinglayer/source/primitive2d/borderlineprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/borderlineprimitive2d.cxx @@ -276,22 +276,22 @@ namespace drawinglayer::primitive2d bool BorderLinePrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const { - if(BufferedDecompositionPrimitive2D::operator==(rPrimitive)) - { - const BorderLinePrimitive2D& rCompare = static_cast<const BorderLinePrimitive2D&>(rPrimitive); + if(!BufferedDecompositionPrimitive2D::operator==(rPrimitive)) + return false; + + const BorderLinePrimitive2D& rCompare = static_cast<const BorderLinePrimitive2D&>(rPrimitive); - if (getStart() == rCompare.getStart() - && getEnd() == rCompare.getEnd() - && getStrokeAttribute() == rCompare.getStrokeAttribute()) + if (getStart() == rCompare.getStart() + && getEnd() == rCompare.getEnd() + && getStrokeAttribute() == rCompare.getStrokeAttribute()) + { + if (getBorderLines().size() == rCompare.getBorderLines().size()) { - if (getBorderLines().size() == rCompare.getBorderLines().size()) + for (size_t a(0); a < getBorderLines().size(); a++) { - for (size_t a(0); a < getBorderLines().size(); a++) + if (!(getBorderLines()[a] == rCompare.getBorderLines()[a])) { - if (!(getBorderLines()[a] == rCompare.getBorderLines()[a])) - { - return false; - } + return false; } } } diff --git a/drawinglayer/source/primitive2d/controlprimitive2d.cxx b/drawinglayer/source/primitive2d/controlprimitive2d.cxx index 24094bb58210..db27950df5d5 100644 --- a/drawinglayer/source/primitive2d/controlprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/controlprimitive2d.cxx @@ -271,38 +271,37 @@ namespace drawinglayer::primitive2d bool ControlPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const { // use base class compare operator - if(BufferedDecompositionPrimitive2D::operator==(rPrimitive)) - { - const ControlPrimitive2D& rCompare = static_cast<const ControlPrimitive2D&>(rPrimitive); + if(!BufferedDecompositionPrimitive2D::operator==(rPrimitive)) + return false; - if(getTransform() == rCompare.getTransform()) - { - // check if ControlModel references both are/are not - bool bRetval(getControlModel().is() == rCompare.getControlModel().is()); + const ControlPrimitive2D& rCompare = static_cast<const ControlPrimitive2D&>(rPrimitive); - if(bRetval && getControlModel().is()) - { - // both exist, check for equality - bRetval = (getControlModel() == rCompare.getControlModel()); - } + if(getTransform() != rCompare.getTransform()) + return false; - if(bRetval) - { - // check if XControl references both are/are not - bRetval = (getXControl().is() == rCompare.getXControl().is()); - } + // check if ControlModel references both are/are not + if (getControlModel().is() != rCompare.getControlModel().is()) + return false; - if(bRetval && getXControl().is()) - { - // both exist, check for equality - bRetval = (getXControl() == rCompare.getXControl()); - } + if(getControlModel().is()) + { + // both exist, check for equality + if (getControlModel() != rCompare.getControlModel()) + return false; + } - return bRetval; - } + // check if XControl references both are/are not + if (getXControl().is() != rCompare.getXControl().is()) + return false; + + if(getXControl().is()) + { + // both exist, check for equality + if (getXControl() != rCompare.getXControl()) + return false; } - return false; + return true; } basegfx::B2DRange ControlPrimitive2D::getB2DRange(const geometry::ViewInformation2D& /*rViewInformation*/) const diff --git a/drawinglayer/source/primitive2d/sceneprimitive2d.cxx b/drawinglayer/source/primitive2d/sceneprimitive2d.cxx index da8618614fd3..4f238cef4792 100644 --- a/drawinglayer/source/primitive2d/sceneprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/sceneprimitive2d.cxx @@ -525,43 +525,41 @@ namespace drawinglayer::primitive2d bool ScenePrimitive2D::tryToCheckLastVisualisationDirectHit(const basegfx::B2DPoint& rLogicHitPoint, bool& o_rResult) const { - if(!maOldRenderedBitmap.IsEmpty() && !maOldUnitVisiblePart.isEmpty()) - { - basegfx::B2DHomMatrix aInverseSceneTransform(getObjectTransformation()); - aInverseSceneTransform.invert(); - const basegfx::B2DPoint aRelativePoint(aInverseSceneTransform * rLogicHitPoint); - - if(maOldUnitVisiblePart.isInside(aRelativePoint)) - { - // calculate coordinates relative to visualized part - double fDivisorX(maOldUnitVisiblePart.getWidth()); - double fDivisorY(maOldUnitVisiblePart.getHeight()); + if(maOldRenderedBitmap.IsEmpty() || maOldUnitVisiblePart.isEmpty()) + return false; - if(basegfx::fTools::equalZero(fDivisorX)) - { - fDivisorX = 1.0; - } + basegfx::B2DHomMatrix aInverseSceneTransform(getObjectTransformation()); + aInverseSceneTransform.invert(); + const basegfx::B2DPoint aRelativePoint(aInverseSceneTransform * rLogicHitPoint); - if(basegfx::fTools::equalZero(fDivisorY)) - { - fDivisorY = 1.0; - } + if(!maOldUnitVisiblePart.isInside(aRelativePoint)) + return false; - const double fRelativeX((aRelativePoint.getX() - maOldUnitVisiblePart.getMinX()) / fDivisorX); - const double fRelativeY((aRelativePoint.getY() - maOldUnitVisiblePart.getMinY()) / fDivisorY); + // calculate coordinates relative to visualized part + double fDivisorX(maOldUnitVisiblePart.getWidth()); + double fDivisorY(maOldUnitVisiblePart.getHeight()); - // combine with real BitmapSizePixel to get bitmap coordinates - const Size aBitmapSizePixel(maOldRenderedBitmap.GetSizePixel()); - const sal_Int32 nX(basegfx::fround(fRelativeX * aBitmapSizePixel.Width())); - const sal_Int32 nY(basegfx::fround(fRelativeY * aBitmapSizePixel.Height())); + if(basegfx::fTools::equalZero(fDivisorX)) + { + fDivisorX = 1.0; + } - // try to get a statement about transparency in that pixel - o_rResult = (0 != maOldRenderedBitmap.GetAlpha(nX, nY)); - return true; - } + if(basegfx::fTools::equalZero(fDivisorY)) + { + fDivisorY = 1.0; } - return false; + const double fRelativeX((aRelativePoint.getX() - maOldUnitVisiblePart.getMinX()) / fDivisorX); + const double fRelativeY((aRelativePoint.getY() - maOldUnitVisiblePart.getMinY()) / fDivisorY); + + // combine with real BitmapSizePixel to get bitmap coordinates + const Size aBitmapSizePixel(maOldRenderedBitmap.GetSizePixel()); + const sal_Int32 nX(basegfx::fround(fRelativeX * aBitmapSizePixel.Width())); + const sal_Int32 nY(basegfx::fround(fRelativeY * aBitmapSizePixel.Height())); + + // try to get a statement about transparency in that pixel + o_rResult = (0 != maOldRenderedBitmap.GetAlpha(nX, nY)); + return true; } ScenePrimitive2D::ScenePrimitive2D( diff --git a/drawinglayer/source/primitive2d/svggradientprimitive2d.cxx b/drawinglayer/source/primitive2d/svggradientprimitive2d.cxx index f4970777d13c..5295cbedc37d 100644 --- a/drawinglayer/source/primitive2d/svggradientprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/svggradientprimitive2d.cxx @@ -817,22 +817,22 @@ namespace drawinglayer::primitive2d { const SvgGradientHelper* pSvgGradientHelper = dynamic_cast< const SvgGradientHelper* >(&rPrimitive); - if(pSvgGradientHelper && SvgGradientHelper::operator==(*pSvgGradientHelper)) - { - const SvgRadialGradientPrimitive2D& rCompare = static_cast< const SvgRadialGradientPrimitive2D& >(rPrimitive); + if(!pSvgGradientHelper || !SvgGradientHelper::operator==(*pSvgGradientHelper)) + return false; + + const SvgRadialGradientPrimitive2D& rCompare = static_cast< const SvgRadialGradientPrimitive2D& >(rPrimitive); - if(getRadius() == rCompare.getRadius()) + if(getRadius() == rCompare.getRadius()) + { + if(isFocalSet() == rCompare.isFocalSet()) { - if(isFocalSet() == rCompare.isFocalSet()) + if(isFocalSet()) { - if(isFocalSet()) - { - return getFocal() == rCompare.getFocal(); - } - else - { - return true; - } + return getFocal() == rCompare.getFocal(); + } + else + { + return true; } } } @@ -1061,24 +1061,24 @@ namespace drawinglayer::primitive2d bool SvgRadialAtomPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const { - if(DiscreteMetricDependentPrimitive2D::operator==(rPrimitive)) - { - const SvgRadialAtomPrimitive2D& rCompare = static_cast< const SvgRadialAtomPrimitive2D& >(rPrimitive); + if(!DiscreteMetricDependentPrimitive2D::operator==(rPrimitive)) + return false; - if(getColorA() == rCompare.getColorA() - && getColorB() == rCompare.getColorB() - && getScaleA() == rCompare.getScaleA() - && getScaleB() == rCompare.getScaleB()) + const SvgRadialAtomPrimitive2D& rCompare = static_cast< const SvgRadialAtomPrimitive2D& >(rPrimitive); + + if(getColorA() == rCompare.getColorA() + && getColorB() == rCompare.getColorB() + && getScaleA() == rCompare.getScaleA() + && getScaleB() == rCompare.getScaleB()) + { + if(isTranslateSet() && rCompare.isTranslateSet()) { - if(isTranslateSet() && rCompare.isTranslateSet()) - { - return (getTranslateA() == rCompare.getTranslateA() - && getTranslateB() == rCompare.getTranslateB()); - } - else if(!isTranslateSet() && !rCompare.isTranslateSet()) - { - return true; - } + return (getTranslateA() == rCompare.getTranslateA() + && getTranslateB() == rCompare.getTranslateB()); + } + else if(!isTranslateSet() && !rCompare.isTranslateSet()) + { + return true; } } diff --git a/drawinglayer/source/primitive3d/sdrextrudelathetools3d.cxx b/drawinglayer/source/primitive3d/sdrextrudelathetools3d.cxx index 2993b1dd27c3..a7015ff8e578 100644 --- a/drawinglayer/source/primitive3d/sdrextrudelathetools3d.cxx +++ b/drawinglayer/source/primitive3d/sdrextrudelathetools3d.cxx @@ -312,26 +312,26 @@ namespace // polygon is closed, one of the points is a member const sal_uInt32 nPointCount(rPoly.count()); - if(nPointCount) - { - basegfx::B2DPoint aCurrent(rPoly.getB2DPoint(0)); - const basegfx::B2DVector aVector(rEnd - rStart); + if(!nPointCount) + return false; - for(sal_uInt32 a(0); a < nPointCount; a++) - { - const sal_uInt32 nNextIndex((a + 1) % nPointCount); - const basegfx::B2DPoint aNext(rPoly.getB2DPoint(nNextIndex)); - const basegfx::B2DVector aEdgeVector(aNext - aCurrent); + basegfx::B2DPoint aCurrent(rPoly.getB2DPoint(0)); + const basegfx::B2DVector aVector(rEnd - rStart); - if(basegfx::utils::findCut( - rStart, aVector, - aCurrent, aEdgeVector) != CutFlagValue::NONE) - { - return true; - } + for(sal_uInt32 a(0); a < nPointCount; a++) + { + const sal_uInt32 nNextIndex((a + 1) % nPointCount); + const basegfx::B2DPoint aNext(rPoly.getB2DPoint(nNextIndex)); + const basegfx::B2DVector aEdgeVector(aNext - aCurrent); - aCurrent = aNext; + if(basegfx::utils::findCut( + rStart, aVector, + aCurrent, aEdgeVector) != CutFlagValue::NONE) + { + return true; } + + aCurrent = aNext; } return false; |