basegfx/source/inc/hommatrixtemplate.hxx | 48 -------- basegfx/source/inc/stringconversiontools.hxx | 7 - basegfx/source/polygon/b2dpolygontools.cxx | 33 ------ basegfx/source/polygon/b2dpolypolygontools.cxx | 18 --- basegfx/source/vector/b2ivector.cxx | 6 - compilerplugins/clang/unusedmethods.cxx | 93 ----------------- compilerplugins/clang/unusedmethods.py | 9 + include/basegfx/matrix/b2dhommatrix.hxx | 30 ----- include/basegfx/matrix/b3dhommatrix.hxx | 30 ----- include/basegfx/pixel/bpixel.hxx | 64 ----------- include/basegfx/polygon/b2dpolygontools.hxx | 5 include/basegfx/polygon/b2dpolypolygontools.hxx | 5 include/basegfx/polygon/b3dpolygontools.hxx | 3 include/basegfx/range/b2dconnectedranges.hxx | 9 - include/basegfx/raster/bpixelraster.hxx | 3 include/basegfx/raster/bzpixelraster.hxx | 7 - include/basegfx/tools/canvastools.hxx | 4 include/basegfx/tuple/b2dtuple.hxx | 29 ----- include/basegfx/tuple/b2i64tuple.hxx | 117 --------------------- include/basegfx/tuple/b2ituple.hxx | 36 ------ include/basegfx/tuple/b3dtuple.hxx | 54 ---------- include/basegfx/tuple/b3ituple.hxx | 129 ------------------------ include/basegfx/vector/b2ivector.hxx | 7 - include/basegfx/vector/b3dvector.hxx | 17 --- vcl/win/source/gdi/gdiimpl.cxx | 53 +++++++++ 25 files changed, 60 insertions(+), 756 deletions(-)
New commits: commit 3ce9af420afafa1a81de646220706fcdc8d84b55 Author: Noel Grandin <n...@peralex.com> Date: Tue Oct 27 01:59:25 2015 +0100 loplugin:unusedmethods Change-Id: I73180266c0af98dbd8d29bd3b11850996b94def9 Reviewed-on: https://gerrit.libreoffice.org/19195 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Thorsten Behrens <thorsten.behr...@cib.de> diff --git a/basegfx/source/inc/hommatrixtemplate.hxx b/basegfx/source/inc/hommatrixtemplate.hxx index 52ffd0b..58a3b46 100644 --- a/basegfx/source/inc/hommatrixtemplate.hxx +++ b/basegfx/source/inc/hommatrixtemplate.hxx @@ -418,25 +418,6 @@ namespace basegfx testLastLine(); } - void doNormalize() - { - if(mpLine) - { - const double fHomValue(get((RowSize - 1), (RowSize - 1))); - - for(sal_uInt16 a(0); a < RowSize; a++) - { - for(sal_uInt16 b(0); b < RowSize; b++) - { - set(a, b, get(a, b) / fHomValue); - } - } - - // evtl. get rid of last matrix line - testLastLine(); - } - } - double doDeterminant() const { ImplHomMatrixTemplate aWork(*this); @@ -461,35 +442,6 @@ namespace basegfx return fRetval; } - double doTrace() const - { - double fTrace = (mpLine) ? 0.0 : 1.0; - const sal_uInt16 nMaxLine( - sal::static_int_cast<sal_uInt16>(mpLine ? RowSize : (RowSize - 1)) ); - - for(sal_uInt16 a(0); a < nMaxLine; a++) - { - fTrace += get(a, a); - } - - return fTrace; - } - - void doTranspose() - { - for(sal_uInt16 a(0); a < (RowSize - 1); a++) - { - for(sal_uInt16 b(a + 1); b < RowSize; b++) - { - const double fTemp(get(a, b)); - set(a, b, get(b, a)); - set(b, a, fTemp); - } - } - - testLastLine(); - } - void doAddMatrix(const ImplHomMatrixTemplate& rMat) { for(sal_uInt16 a(0); a < RowSize; a++) diff --git a/basegfx/source/inc/stringconversiontools.hxx b/basegfx/source/inc/stringconversiontools.hxx index 92713bf..26fabdb 100644 --- a/basegfx/source/inc/stringconversiontools.hxx +++ b/basegfx/source/inc/stringconversiontools.hxx @@ -69,13 +69,6 @@ namespace basegfx const OUString& rStr, const sal_Int32 nLen); - void skipNumber(sal_Int32& io_rPos, - const OUString& rStr, - const sal_Int32 nLen); - - void skipDouble(sal_Int32& io_rPos, - const OUString& rStr); - void putNumberCharWithSpace(OUStringBuffer& rStr, double fValue, double fOldValue, diff --git a/basegfx/source/polygon/b2dpolygontools.cxx b/basegfx/source/polygon/b2dpolygontools.cxx index 95ee250..54f8521 100644 --- a/basegfx/source/polygon/b2dpolygontools.cxx +++ b/basegfx/source/polygon/b2dpolygontools.cxx @@ -3191,39 +3191,6 @@ namespace basegfx } } - bool containsOnlyHorizontalAndVerticalEdges(const B2DPolygon& rCandidate) - { - if(rCandidate.areControlPointsUsed()) - { - return false; - } - - const sal_uInt32 nPointCount(rCandidate.count()); - - if(nPointCount < 2) - { - return true; - } - - const sal_uInt32 nEdgeCount(rCandidate.isClosed() ? nPointCount + 1 : nPointCount); - basegfx::B2DPoint aLast(rCandidate.getB2DPoint(0)); - - for(sal_uInt32 a(1); a < nEdgeCount; a++) - { - const sal_uInt32 nNextIndex(a % nPointCount); - const basegfx::B2DPoint aCurrent(rCandidate.getB2DPoint(nNextIndex)); - - if(!basegfx::fTools::equal(aLast.getX(), aCurrent.getX()) && !basegfx::fTools::equal(aLast.getY(), aCurrent.getY())) - { - return false; - } - - aLast = aCurrent; - } - - return true; - } - B2DVector getTangentEnteringPoint(const B2DPolygon& rCandidate, sal_uInt32 nIndex) { B2DVector aRetval(0.0, 0.0); diff --git a/basegfx/source/polygon/b2dpolypolygontools.cxx b/basegfx/source/polygon/b2dpolypolygontools.cxx index f290f37..b473367 100644 --- a/basegfx/source/polygon/b2dpolypolygontools.cxx +++ b/basegfx/source/polygon/b2dpolypolygontools.cxx @@ -495,24 +495,6 @@ namespace basegfx return aRetval; } - bool containsOnlyHorizontalAndVerticalEdges(const B2DPolyPolygon& rCandidate) - { - if(rCandidate.areControlPointsUsed()) - { - return false; - } - - for(sal_uInt32 a(0); a < rCandidate.count(); a++) - { - if(!containsOnlyHorizontalAndVerticalEdges(rCandidate.getB2DPolygon(a))) - { - return false; - } - } - - return true; - } - B2DPolyPolygon createSevenSegmentPolyPolygon(sal_Char nNumber, bool bLitSegments) { // config here diff --git a/basegfx/source/vector/b2ivector.cxx b/basegfx/source/vector/b2ivector.cxx index 7e3e65d..5b45871 100644 --- a/basegfx/source/vector/b2ivector.cxx +++ b/basegfx/source/vector/b2ivector.cxx @@ -60,12 +60,6 @@ namespace basegfx return *this; } - B2IVector operator*( const B2DHomMatrix& rMat, const B2IVector& rVec ) - { - B2IVector aRes( rVec ); - return aRes*=rMat; - } - } // end of namespace basegfx /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/compilerplugins/clang/unusedmethods.cxx b/compilerplugins/clang/unusedmethods.cxx index e5fab5b..a555031 100644 --- a/compilerplugins/clang/unusedmethods.cxx +++ b/compilerplugins/clang/unusedmethods.cxx @@ -19,7 +19,7 @@ Dump a list of calls to methods, and a list of method definitions. Then we will post-process the 2 lists and find the set of unused methods. -Be warned that it produces around 4G of log file. +Be warned that it produces around 5G of log file. The process goes something like this: $ make check @@ -99,9 +99,6 @@ public: bool VisitCallExpr(CallExpr* ); bool VisitFunctionDecl( const FunctionDecl* decl ); bool VisitDeclRefExpr( const DeclRefExpr* ); - bool VisitCXXConstructExpr( const CXXConstructExpr* ); - bool VisitVarDecl( const VarDecl* ); - bool VisitCXXRecordDecl( CXXRecordDecl* ); private: void logCallToRootMethods(const FunctionDecl* functionDecl); MyFuncInfo niceName(const FunctionDecl* functionDecl); @@ -216,22 +213,7 @@ bool UnusedMethods::VisitCallExpr(CallExpr* expr) goto gotfunc; } /* - // ignore case where we can't determine the target of the call because we're inside a template - if (isa<CXXDependentScopeMemberExpr>(callee)) - return true; - if (isa<UnresolvedLookupExpr>(callee)) - return true; - if (isa<UnresolvedMemberExpr>(callee)) - return true; - if (isa<DependentScopeDeclRefExpr>(callee)) - return true; - // ignore this, doesn't really exist (side-effect of template expansion on scalar types) - if (isa<CXXPseudoDestructorExpr>(callee)) - return true; expr->dump(); - std::string name = compiler.getSourceManager().getFilename(expansionLoc); - std::string sourceLocation = name + ":" + std::to_string(compiler.getSourceManager().getSpellingLineNumber(expansionLoc)); - cout << sourceLocation << endl; throw "Cant touch this"; */ return true; @@ -249,28 +231,6 @@ gotfunc: return true; } -bool UnusedMethods::VisitCXXConstructExpr(const CXXConstructExpr* expr) -{ - const CXXConstructorDecl *consDecl = expr->getConstructor(); - consDecl = consDecl->getCanonicalDecl(); - if (consDecl->getTemplatedKind() == FunctionDecl::TemplatedKind::TK_NonTemplate - && !consDecl->isFunctionTemplateSpecialization()) { - return true; - } - // if we see a call to a constructor, it may effectively create a whole new class, - // if the constructor's class is templated. - if (!traversedFunctionSet.insert(fullyQualifiedName(consDecl)).second) - return true; - - const CXXRecordDecl* parent = consDecl->getParent(); - for( CXXRecordDecl::ctor_iterator it = parent->ctor_begin(); it != parent->ctor_end(); ++it) - TraverseCXXConstructorDecl(*it); - for( CXXRecordDecl::method_iterator it = parent->method_begin(); it != parent->method_end(); ++it) - TraverseCXXMethodDecl(*it); - - return true; -} - bool UnusedMethods::VisitFunctionDecl( const FunctionDecl* functionDecl ) { functionDecl = functionDecl->getCanonicalDecl(); @@ -311,57 +271,6 @@ bool UnusedMethods::VisitDeclRefExpr( const DeclRefExpr* declRefExpr ) return true; } -// this is for declarations of static variables that involve a template -bool UnusedMethods::VisitVarDecl( const VarDecl* varDecl ) -{ - varDecl = varDecl->getCanonicalDecl(); - - if (varDecl->getStorageClass() != SC_Static) - return true; - const CXXRecordDecl* recordDecl = varDecl->getType()->getAsCXXRecordDecl(); - if (!recordDecl) - return true; -// workaround clang-3.5 issue -#if __clang_major__ > 3 || ( __clang_major__ == 3 && __clang_minor__ >= 6 ) - if (!recordDecl->getTemplateInstantiationPattern()) - return true; -#endif - for( CXXRecordDecl::ctor_iterator it = recordDecl->ctor_begin(); it != recordDecl->ctor_end(); ++it) - TraverseCXXConstructorDecl(*it); - for( CXXRecordDecl::method_iterator it = recordDecl->method_begin(); it != recordDecl->method_end(); ++it) - TraverseCXXMethodDecl(*it); - return true; -} - -// Sometimes a class will inherit from something, and in the process invoke a template, -// which can create new methods. -// -bool UnusedMethods::VisitCXXRecordDecl( CXXRecordDecl* recordDecl ) -{ - recordDecl = recordDecl->getCanonicalDecl(); - if (!recordDecl->hasDefinition()) - return true; -// workaround clang-3.5 issue -#if __clang_major__ > 3 || ( __clang_major__ == 3 && __clang_minor__ >= 6 ) - for(CXXBaseSpecifier* baseSpecifier = recordDecl->bases_begin(); - baseSpecifier != recordDecl->bases_end(); ++baseSpecifier) - { - const Type *baseType = baseSpecifier->getType().getTypePtr(); - if (isa<TypedefType>(baseSpecifier->getType())) { - baseType = dyn_cast<TypedefType>(baseType)->desugar().getTypePtr(); - } - if (isa<RecordType>(baseType)) { - const RecordType *baseRecord = dyn_cast<RecordType>(baseType); - CXXRecordDecl* baseRecordDecl = dyn_cast<CXXRecordDecl>(baseRecord->getDecl()); - if (baseRecordDecl && baseRecordDecl->getTemplateInstantiationPattern()) { - TraverseCXXRecordDecl(baseRecordDecl); - } - } - } -#endif - return true; -} - loplugin::Plugin::Registration< UnusedMethods > X("unusedmethods", false); } diff --git a/compilerplugins/clang/unusedmethods.py b/compilerplugins/clang/unusedmethods.py index 1ea2394..fd17cb5 100755 --- a/compilerplugins/clang/unusedmethods.py +++ b/compilerplugins/clang/unusedmethods.py @@ -103,6 +103,11 @@ exclusionSet = set([ "class vcl::Window * CreateWindow(class VCLXWindow **,const struct com::sun::star::awt::WindowDescriptor *,class vcl::Window *,long)", ]) +# clang does not always use exactly the same numbers in the type-parameter vars it generates +# so I need to substitute them to ensure we can match correctly. +normalizeTypeParamsRegex = re.compile(r"type-parameter-\d+-\d+") +def normalizeTypeParams( line ): + return normalizeTypeParamsRegex.sub("type-parameter-?-?", line) # The parsing here is designed to avoid grabbing stuff which is mixed in from gbuild. # I have not yet found a way of suppressing the gbuild output. @@ -111,12 +116,12 @@ with io.open(sys.argv[1], "rb", buffering=1024*1024) as txt: if line.startswith("definition:\t"): idx1 = line.find("\t",12) idx2 = line.find("\t",idx1+1) - funcInfo = (line[12:idx1], line[idx1+1:idx2]) + funcInfo = (normalizeTypeParams(line[12:idx1]), normalizeTypeParams(line[idx1+1:idx2])) definitionSet.add(funcInfo) definitionToSourceLocationMap[funcInfo] = line[idx2+1:].strip() elif line.startswith("call:\t"): idx1 = line.find("\t",6) - callSet.add((line[6:idx1], line[idx1+1:].strip())) + callSet.add((normalizeTypeParams(line[6:idx1]), normalizeTypeParams(line[idx1+1:].strip()))) tmp1set = set() for d in definitionSet: diff --git a/include/basegfx/matrix/b2dhommatrix.hxx b/include/basegfx/matrix/b2dhommatrix.hxx index 68c119c..a3e6fcd 100644 --- a/include/basegfx/matrix/b2dhommatrix.hxx +++ b/include/basegfx/matrix/b2dhommatrix.hxx @@ -96,36 +96,6 @@ namespace basegfx bool decompose(B2DTuple& rScale, B2DTuple& rTranslate, double& rRotate, double& rShearX) const; }; - // addition, subtraction - inline B2DHomMatrix operator+(const B2DHomMatrix& rMatA, const B2DHomMatrix& rMatB) - { - B2DHomMatrix aSum(rMatA); - aSum += rMatB; - return aSum; - } - - inline B2DHomMatrix operator-(const B2DHomMatrix& rMatA, const B2DHomMatrix& rMatB) - { - B2DHomMatrix aDiv(rMatA); - aDiv -= rMatB; - return aDiv; - } - - // multiplication, division by a constant - inline B2DHomMatrix operator*(const B2DHomMatrix& rMat, double fValue) - { - B2DHomMatrix aNew(rMat); - aNew *= fValue; - return aNew; - } - - inline B2DHomMatrix operator/(const B2DHomMatrix& rMat, double fValue) - { - B2DHomMatrix aNew(rMat); - aNew *= 1.0 / fValue; - return aNew; - } - inline B2DHomMatrix operator*(const B2DHomMatrix& rMatA, const B2DHomMatrix& rMatB) { B2DHomMatrix aMul(rMatB); diff --git a/include/basegfx/matrix/b3dhommatrix.hxx b/include/basegfx/matrix/b3dhommatrix.hxx index 0ffd911..b8e1c5b 100644 --- a/include/basegfx/matrix/b3dhommatrix.hxx +++ b/include/basegfx/matrix/b3dhommatrix.hxx @@ -112,36 +112,6 @@ namespace basegfx bool decompose(B3DTuple& rScale, B3DTuple& rTranslate, B3DTuple& rRotate, B3DTuple& rShear) const; }; - // addition, subtraction - inline B3DHomMatrix operator+(const B3DHomMatrix& rMatA, const B3DHomMatrix& rMatB) - { - B3DHomMatrix aSum(rMatA); - aSum += rMatB; - return aSum; - } - - inline B3DHomMatrix operator-(const B3DHomMatrix& rMatA, const B3DHomMatrix& rMatB) - { - B3DHomMatrix aDiv(rMatA); - aDiv -= rMatB; - return aDiv; - } - - // multiplication, division by constant value - inline B3DHomMatrix operator*(const B3DHomMatrix& rMat, double fValue) - { - B3DHomMatrix aNew(rMat); - aNew *= fValue; - return aNew; - } - - inline B3DHomMatrix operator/(const B3DHomMatrix& rMat, double fValue) - { - B3DHomMatrix aNew(rMat); - aNew *= 1.0 / fValue; - return aNew; - } - inline B3DHomMatrix operator*(const B3DHomMatrix& rMatA, const B3DHomMatrix& rMatB) { B3DHomMatrix aMul(rMatB); diff --git a/include/basegfx/pixel/bpixel.hxx b/include/basegfx/pixel/bpixel.hxx index f42e757..a9fea5b 100644 --- a/include/basegfx/pixel/bpixel.hxx +++ b/include/basegfx/pixel/bpixel.hxx @@ -115,70 +115,6 @@ namespace basegfx }; - // external operators - - inline BPixel minimum(const BPixel& rTupA, const BPixel& rTupB) - { - return BPixel( - std::min(rTupB.getRed(), rTupA.getRed()), - std::min(rTupB.getGreen(), rTupA.getGreen()), - std::min(rTupB.getBlue(), rTupA.getBlue()), - std::min(rTupB.getOpacity(), rTupA.getOpacity())); - } - - inline BPixel maximum(const BPixel& rTupA, const BPixel& rTupB) - { - return BPixel( - std::max(rTupB.getRed(), rTupA.getRed()), - std::max(rTupB.getGreen(), rTupA.getGreen()), - std::max(rTupB.getBlue(), rTupA.getBlue()), - std::max(rTupB.getOpacity(), rTupA.getOpacity())); - } - - inline BPixel interpolate(const BPixel& rOld1, const BPixel& rOld2, double t) - { - if(rOld1 == rOld2) - { - return rOld1; - } - else if(0.0 >= t) - { - return rOld1; - } - else if(1.0 <= t) - { - return rOld2; - } - else - { - const sal_uInt32 nFactor(fround(256.0 * t)); - const sal_uInt32 nNegFac(256L - nFactor); - - return BPixel( - (sal_uInt8)(((sal_uInt32)rOld1.getRed() * nNegFac + (sal_uInt32)rOld2.getRed() * nFactor) >> 8L), - (sal_uInt8)(((sal_uInt32)rOld1.getGreen() * nNegFac + (sal_uInt32)rOld2.getGreen() * nFactor) >> 8L), - (sal_uInt8)(((sal_uInt32)rOld1.getBlue() * nNegFac + (sal_uInt32)rOld2.getBlue() * nFactor) >> 8L), - (sal_uInt8)(((sal_uInt32)rOld1.getOpacity() * nNegFac + (sal_uInt32)rOld2.getOpacity() * nFactor) >> 8L)); - } - } - - inline BPixel average(const BPixel& rOld1, const BPixel& rOld2) - { - return BPixel( - rOld1.getRed() == rOld2.getRed() ? rOld1.getRed() : (sal_uInt8)(((sal_uInt32)rOld1.getRed() + (sal_uInt32)rOld2.getRed()) >> 1L), - rOld1.getGreen() == rOld2.getGreen() ? rOld1.getGreen() : (sal_uInt8)(((sal_uInt32)rOld1.getGreen() + (sal_uInt32)rOld2.getGreen()) >> 1L), - rOld1.getBlue() == rOld2.getBlue() ? rOld1.getBlue() : (sal_uInt8)(((sal_uInt32)rOld1.getBlue() + (sal_uInt32)rOld2.getBlue()) >> 1L), - rOld1.getOpacity() == rOld2.getOpacity() ? rOld1.getOpacity() : (sal_uInt8)(((sal_uInt32)rOld1.getOpacity() + (sal_uInt32)rOld2.getOpacity()) >> 1L)); - } - - inline BPixel average(const BPixel& rOld1, const BPixel& rOld2, const BPixel& rOld3) - { - return BPixel( - (rOld1.getRed() == rOld2.getRed() && rOld2.getRed() == rOld3.getRed()) ? rOld1.getRed() : (sal_uInt8)(((sal_uInt32)rOld1.getRed() + (sal_uInt32)rOld2.getRed() + (sal_uInt32)rOld3.getRed()) / 3L), - (rOld1.getGreen() == rOld2.getGreen() && rOld2.getGreen() == rOld3.getGreen()) ? rOld1.getGreen() : (sal_uInt8)(((sal_uInt32)rOld1.getGreen() + (sal_uInt32)rOld2.getGreen() + (sal_uInt32)rOld3.getGreen()) / 3L), - (rOld1.getBlue() == rOld2.getBlue() && rOld2.getBlue() == rOld3.getBlue()) ? rOld1.getBlue() : (sal_uInt8)(((sal_uInt32)rOld1.getBlue() + (sal_uInt32)rOld2.getBlue() + (sal_uInt32)rOld3.getBlue()) / 3L), - (rOld1.getOpacity() == rOld2.getOpacity() && rOld2.getOpacity() == rOld3.getOpacity()) ? rOld1.getOpacity() : (sal_uInt8)(((sal_uInt32)rOld1.getOpacity() + (sal_uInt32)rOld2.getOpacity() + (sal_uInt32)rOld3.getOpacity()) / 3L)); - } } // end of namespace basegfx #endif // INCLUDED_BASEGFX_PIXEL_BPIXEL_HXX diff --git a/include/basegfx/polygon/b2dpolygontools.hxx b/include/basegfx/polygon/b2dpolygontools.hxx index e963fa0..3edf22e 100644 --- a/include/basegfx/polygon/b2dpolygontools.hxx +++ b/include/basegfx/polygon/b2dpolygontools.hxx @@ -442,11 +442,6 @@ namespace basegfx */ BASEGFX_DLLPUBLIC B2DPolygon snapPointsOfHorizontalOrVerticalEdges(const B2DPolygon& rCandidate); - /** returns true if the Polygon only contains horizontal or vertical edges - so that it could be represented by RegionBands - */ - bool containsOnlyHorizontalAndVerticalEdges(const B2DPolygon& rCandidate); - /// get the tangent with which the given point is entered seen from the previous /// polygon path data. Take into account all stuff like closed state, zero-length edges and others. BASEGFX_DLLPUBLIC B2DVector getTangentEnteringPoint(const B2DPolygon& rCandidate, sal_uInt32 nIndex); diff --git a/include/basegfx/polygon/b2dpolypolygontools.hxx b/include/basegfx/polygon/b2dpolypolygontools.hxx index 2c84287d..4059e22 100644 --- a/include/basegfx/polygon/b2dpolypolygontools.hxx +++ b/include/basegfx/polygon/b2dpolypolygontools.hxx @@ -287,11 +287,6 @@ namespace basegfx */ BASEGFX_DLLPUBLIC B2DPolyPolygon snapPointsOfHorizontalOrVerticalEdges(const B2DPolyPolygon& rCandidate); - /** returns true if the Polygon only contains horizontal or vertical edges - so that it could be represented by RegionBands - */ - BASEGFX_DLLPUBLIC bool containsOnlyHorizontalAndVerticalEdges(const B2DPolyPolygon& rCandidate); - /// converters for css::drawing::PointSequence BASEGFX_DLLPUBLIC B2DPolyPolygon UnoPointSequenceSequenceToB2DPolyPolygon( const css::drawing::PointSequenceSequence& rPointSequenceSequenceSource, diff --git a/include/basegfx/polygon/b3dpolygontools.hxx b/include/basegfx/polygon/b3dpolygontools.hxx index bcee8be..49ba730 100644 --- a/include/basegfx/polygon/b3dpolygontools.hxx +++ b/include/basegfx/polygon/b3dpolygontools.hxx @@ -55,9 +55,6 @@ namespace basegfx // get size of polygon. Control vectors are included in that ranges. BASEGFX_DLLPUBLIC B3DRange getRange(const B3DPolygon& rCandidate); - // get area of polygon - BASEGFX_DLLPUBLIC double getArea(const ::basegfx::B3DPolygon& rCandidate); - // get length of polygon BASEGFX_DLLPUBLIC double getLength(const B3DPolygon& rCandidate); diff --git a/include/basegfx/range/b2dconnectedranges.hxx b/include/basegfx/range/b2dconnectedranges.hxx index 6feb867..7679f5a 100644 --- a/include/basegfx/range/b2dconnectedranges.hxx +++ b/include/basegfx/range/b2dconnectedranges.hxx @@ -83,15 +83,6 @@ namespace basegfx { } - /** Query total bounds of all added ranges. - - @return the union bound rect over all added ranges. - */ - B2DRange getBounds() const - { - return maTotalBounds; - } - /** Add an additional range. This method integrates a new range into the connected diff --git a/include/basegfx/raster/bpixelraster.hxx b/include/basegfx/raster/bpixelraster.hxx index 67eea7d..f85c0af 100644 --- a/include/basegfx/raster/bpixelraster.hxx +++ b/include/basegfx/raster/bpixelraster.hxx @@ -64,13 +64,10 @@ namespace basegfx // coordinate calcs between X/Y and span sal_uInt32 getIndexFromXY(sal_uInt32 nX, sal_uInt32 nY) const { return (nX + (nY * mnWidth)); } - sal_uInt32 getXFromIndex(sal_uInt32 nIndex) const { return (nIndex % mnWidth); } - sal_uInt32 getYFromIndex(sal_uInt32 nIndex) const { return (nIndex / mnWidth); } // data access read sal_uInt32 getWidth() const { return mnWidth; } sal_uInt32 getHeight() const { return mnHeight; } - sal_uInt32 getCount() const { return mnCount; } // data access read only const BPixel& getBPixel(sal_uInt32 nIndex) const diff --git a/include/basegfx/raster/bzpixelraster.hxx b/include/basegfx/raster/bzpixelraster.hxx index f11dcf2..722abde 100644 --- a/include/basegfx/raster/bzpixelraster.hxx +++ b/include/basegfx/raster/bzpixelraster.hxx @@ -33,13 +33,6 @@ namespace basegfx sal_uInt16* mpZBuffer; public: - // reset - void resetZ() - { - reset(); - memset(mpZBuffer, 0, sizeof(sal_uInt16) * mnCount); - } - // constructor/destructor BZPixelRaster(sal_uInt32 nWidth, sal_uInt32 nHeight) : BPixelRaster(nWidth, nHeight), diff --git a/include/basegfx/tools/canvastools.hxx b/include/basegfx/tools/canvastools.hxx index 7e2c0c0..79b72f2 100644 --- a/include/basegfx/tools/canvastools.hxx +++ b/include/basegfx/tools/canvastools.hxx @@ -122,10 +122,6 @@ namespace basegfx BASEGFX_DLLPUBLIC ::basegfx::B3DHomMatrix homMatrixFromAffineMatrix3D( const css::geometry::AffineMatrix3D& matrix ); - BASEGFX_DLLPUBLIC css::geometry::Matrix2D& - matrixFromHomMatrix( css::geometry::Matrix2D& matrix, - const ::basegfx::B2DHomMatrix& transform); - // Geometry conversions diff --git a/include/basegfx/tuple/b2dtuple.hxx b/include/basegfx/tuple/b2dtuple.hxx index 5659c7b..3819a5b 100644 --- a/include/basegfx/tuple/b2dtuple.hxx +++ b/include/basegfx/tuple/b2dtuple.hxx @@ -221,20 +221,6 @@ namespace basegfx // external operators - inline B2DTuple minimum(const B2DTuple& rTupA, const B2DTuple& rTupB) - { - return B2DTuple( - std::min(rTupB.getX(), rTupA.getX()), - std::min(rTupB.getY(), rTupA.getY())); - } - - inline B2DTuple maximum(const B2DTuple& rTupA, const B2DTuple& rTupB) - { - return B2DTuple( - std::max(rTupB.getX(), rTupA.getX()), - std::max(rTupB.getY(), rTupA.getY())); - } - inline B2DTuple absolute(const B2DTuple& rTup) { B2DTuple aAbs( @@ -272,13 +258,6 @@ namespace basegfx rOld1.getY() == rOld2.getY() ? rOld1.getY() : (rOld1.getY() + rOld2.getY()) * 0.5); } - inline B2DTuple average(const B2DTuple& rOld1, const B2DTuple& rOld2, const B2DTuple& rOld3) - { - return B2DTuple( - (rOld1.getX() == rOld2.getX() && rOld2.getX() == rOld3.getX()) ? rOld1.getX() : (rOld1.getX() + rOld2.getX() + rOld3.getX()) * (1.0 / 3.0), - (rOld1.getY() == rOld2.getY() && rOld2.getY() == rOld3.getY()) ? rOld1.getY() : (rOld1.getY() + rOld2.getY() + rOld3.getY()) * (1.0 / 3.0)); - } - inline B2DTuple operator+(const B2DTuple& rTupA, const B2DTuple& rTupB) { B2DTuple aSum(rTupA); @@ -328,14 +307,6 @@ namespace basegfx return aNew; } - inline B2DTuple operator/(double t, const B2DTuple& rTup) - { - B2DTuple aNew(t, t); - B2DTuple aTmp(rTup); - aNew /= aTmp; - return aNew; - } - /** Round double to nearest integer for 2D tuple @return the nearest integer for this tuple diff --git a/include/basegfx/tuple/b2i64tuple.hxx b/include/basegfx/tuple/b2i64tuple.hxx index e4b40ac..5c5aac7 100644 --- a/include/basegfx/tuple/b2i64tuple.hxx +++ b/include/basegfx/tuple/b2i64tuple.hxx @@ -177,123 +177,6 @@ namespace basegfx } }; - // external operators - - - inline B2I64Tuple minimum(const B2I64Tuple& rTupA, const B2I64Tuple& rTupB) - { - return B2I64Tuple( - std::min(rTupB.getX(), rTupA.getX()), - std::min(rTupB.getY(), rTupA.getY())); - } - - inline B2I64Tuple maximum(const B2I64Tuple& rTupA, const B2I64Tuple& rTupB) - { - return B2I64Tuple( - std::max(rTupB.getX(), rTupA.getX()), - std::max(rTupB.getY(), rTupA.getY())); - } - - inline B2I64Tuple absolute(const B2I64Tuple& rTup) - { - B2I64Tuple aAbs( - (0 > rTup.getX()) ? -rTup.getX() : rTup.getX(), - (0 > rTup.getY()) ? -rTup.getY() : rTup.getY()); - return aAbs; - } - - inline B2I64Tuple interpolate(const B2I64Tuple& rOld1, const B2I64Tuple& rOld2, double t) - { - if(rOld1 == rOld2) - { - return rOld1; - } - else if(0.0 >= t) - { - return rOld1; - } - else if(1.0 <= t) - { - return rOld2; - } - else - { - return B2I64Tuple( - basegfx::fround64(((rOld2.getX() - rOld1.getX()) * t) + rOld1.getX()), - basegfx::fround64(((rOld2.getY() - rOld1.getY()) * t) + rOld1.getY())); - } - } - - inline B2I64Tuple average(const B2I64Tuple& rOld1, const B2I64Tuple& rOld2) - { - return B2I64Tuple( - rOld1.getX() == rOld2.getX() ? rOld1.getX() : basegfx::fround64((rOld1.getX() + rOld2.getX()) * 0.5), - rOld1.getY() == rOld2.getY() ? rOld1.getY() : basegfx::fround64((rOld1.getY() + rOld2.getY()) * 0.5)); - } - - inline B2I64Tuple average(const B2I64Tuple& rOld1, const B2I64Tuple& rOld2, const B2I64Tuple& rOld3) - { - return B2I64Tuple( - (rOld1.getX() == rOld2.getX() && rOld2.getX() == rOld3.getX()) ? rOld1.getX() : basegfx::fround64((rOld1.getX() + rOld2.getX() + rOld3.getX()) * (1.0 / 3.0)), - (rOld1.getY() == rOld2.getY() && rOld2.getY() == rOld3.getY()) ? rOld1.getY() : basegfx::fround64((rOld1.getY() + rOld2.getY() + rOld3.getY()) * (1.0 / 3.0))); - } - - inline B2I64Tuple operator+(const B2I64Tuple& rTupA, const B2I64Tuple& rTupB) - { - B2I64Tuple aSum(rTupA); - aSum += rTupB; - return aSum; - } - - inline B2I64Tuple operator-(const B2I64Tuple& rTupA, const B2I64Tuple& rTupB) - { - B2I64Tuple aSub(rTupA); - aSub -= rTupB; - return aSub; - } - - inline B2I64Tuple operator/(const B2I64Tuple& rTupA, const B2I64Tuple& rTupB) - { - B2I64Tuple aDiv(rTupA); - aDiv /= rTupB; - return aDiv; - } - - inline B2I64Tuple operator*(const B2I64Tuple& rTupA, const B2I64Tuple& rTupB) - { - B2I64Tuple aMul(rTupA); - aMul *= rTupB; - return aMul; - } - - inline B2I64Tuple operator*(const B2I64Tuple& rTup, sal_Int64 t) - { - B2I64Tuple aNew(rTup); - aNew *= t; - return aNew; - } - - inline B2I64Tuple operator*(sal_Int64 t, const B2I64Tuple& rTup) - { - B2I64Tuple aNew(rTup); - aNew *= t; - return aNew; - } - - inline B2I64Tuple operator/(const B2I64Tuple& rTup, sal_Int64 t) - { - B2I64Tuple aNew(rTup); - aNew /= t; - return aNew; - } - - inline B2I64Tuple operator/(sal_Int64 t, const B2I64Tuple& rTup) - { - B2I64Tuple aNew(t, t); - B2I64Tuple aTmp(rTup); - aNew /= aTmp; - return aNew; - } } // end of namespace basegfx #endif // INCLUDED_BASEGFX_TUPLE_B2I64TUPLE_HXX diff --git a/include/basegfx/tuple/b2ituple.hxx b/include/basegfx/tuple/b2ituple.hxx index d75e41c..e7a4c0f 100644 --- a/include/basegfx/tuple/b2ituple.hxx +++ b/include/basegfx/tuple/b2ituple.hxx @@ -212,27 +212,6 @@ namespace basegfx return aSub; } - inline B2ITuple operator/(const B2ITuple& rTupA, const B2ITuple& rTupB) - { - B2ITuple aDiv(rTupA); - aDiv /= rTupB; - return aDiv; - } - - inline B2ITuple operator*(const B2ITuple& rTupA, const B2ITuple& rTupB) - { - B2ITuple aMul(rTupA); - aMul *= rTupB; - return aMul; - } - - inline B2ITuple operator*(const B2ITuple& rTup, sal_Int32 t) - { - B2ITuple aNew(rTup); - aNew *= t; - return aNew; - } - inline B2ITuple operator*(sal_Int32 t, const B2ITuple& rTup) { B2ITuple aNew(rTup); @@ -240,21 +219,6 @@ namespace basegfx return aNew; } - inline B2ITuple operator/(const B2ITuple& rTup, sal_Int32 t) - { - B2ITuple aNew(rTup); - aNew /= t; - return aNew; - } - - inline B2ITuple operator/(sal_Int32 t, const B2ITuple& rTup) - { - B2ITuple aNew(t, t); - B2ITuple aTmp(rTup); - aNew /= aTmp; - return aNew; - } - } // end of namespace basegfx #endif // INCLUDED_BASEGFX_TUPLE_B2ITUPLE_HXX diff --git a/include/basegfx/tuple/b3dtuple.hxx b/include/basegfx/tuple/b3dtuple.hxx index 5bd5cc9..a1d4add 100644 --- a/include/basegfx/tuple/b3dtuple.hxx +++ b/include/basegfx/tuple/b3dtuple.hxx @@ -282,31 +282,6 @@ namespace basegfx // external operators - inline B3DTuple minimum(const B3DTuple& rTupA, const B3DTuple& rTupB) - { - return B3DTuple( - std::min(rTupB.getX(), rTupA.getX()), - std::min(rTupB.getY(), rTupA.getY()), - std::min(rTupB.getZ(), rTupA.getZ())); - } - - inline B3DTuple maximum(const B3DTuple& rTupA, const B3DTuple& rTupB) - { - return B3DTuple( - std::max(rTupB.getX(), rTupA.getX()), - std::max(rTupB.getY(), rTupA.getY()), - std::max(rTupB.getZ(), rTupA.getZ())); - } - - inline B3DTuple absolute(const B3DTuple& rTup) - { - B3DTuple aAbs( - fabs(rTup.getX()), - fabs(rTup.getY()), - fabs(rTup.getZ())); - return aAbs; - } - inline B3DTuple interpolate(const B3DTuple& rOld1, const B3DTuple& rOld2, double t) { if(rOld1 == rOld2) @@ -338,14 +313,6 @@ namespace basegfx rOld1.getZ() == rOld2.getZ() ? rOld1.getZ() : (rOld1.getZ() + rOld2.getZ()) * 0.5); } - inline B3DTuple average(const B3DTuple& rOld1, const B3DTuple& rOld2, const B3DTuple& rOld3) - { - return B3DTuple( - (rOld1.getX() == rOld2.getX() && rOld2.getX() == rOld3.getX()) ? rOld1.getX() : (rOld1.getX() + rOld2.getX() + rOld3.getX()) * (1.0 / 3.0), - (rOld1.getY() == rOld2.getY() && rOld2.getY() == rOld3.getY()) ? rOld1.getY() : (rOld1.getY() + rOld2.getY() + rOld3.getY()) * (1.0 / 3.0), - (rOld1.getZ() == rOld2.getZ() && rOld2.getZ() == rOld3.getZ()) ? rOld1.getZ() : (rOld1.getZ() + rOld2.getZ() + rOld3.getZ()) * (1.0 / 3.0)); - } - inline B3DTuple operator+(const B3DTuple& rTupA, const B3DTuple& rTupB) { B3DTuple aSum(rTupA); @@ -360,13 +327,6 @@ namespace basegfx return aSub; } - inline B3DTuple operator/(const B3DTuple& rTupA, const B3DTuple& rTupB) - { - B3DTuple aDiv(rTupA); - aDiv /= rTupB; - return aDiv; - } - inline B3DTuple operator*(const B3DTuple& rTupA, const B3DTuple& rTupB) { B3DTuple aMul(rTupA); @@ -381,13 +341,6 @@ namespace basegfx return aNew; } - inline B3DTuple operator*(double t, const B3DTuple& rTup) - { - B3DTuple aNew(rTup); - aNew *= t; - return aNew; - } - inline B3DTuple operator/(const B3DTuple& rTup, double t) { B3DTuple aNew(rTup); @@ -395,13 +348,6 @@ namespace basegfx return aNew; } - inline B3DTuple operator/(double t, const B3DTuple& rTup) - { - B3DTuple aNew(rTup); - aNew /= t; - return aNew; - } - /** Round double to nearest integer for 3D tuple @return the nearest integer for this tuple diff --git a/include/basegfx/tuple/b3ituple.hxx b/include/basegfx/tuple/b3ituple.hxx index 7802101..69a2cca 100644 --- a/include/basegfx/tuple/b3ituple.hxx +++ b/include/basegfx/tuple/b3ituple.hxx @@ -98,12 +98,6 @@ namespace basegfx return mnY; } - /// get Z-Coordinate of 3D Tuple - sal_Int32 getZ() const - { - return mnZ; - } - /// Array-access to 3D Tuple const sal_Int32& operator[] (int nPos) const { @@ -197,129 +191,6 @@ namespace basegfx } }; - // external operators - - - inline B3ITuple minimum(const B3ITuple& rTupA, const B3ITuple& rTupB) - { - return B3ITuple( - std::min(rTupB.getX(), rTupA.getX()), - std::min(rTupB.getY(), rTupA.getY()), - std::min(rTupB.getZ(), rTupA.getZ())); - } - - inline B3ITuple maximum(const B3ITuple& rTupA, const B3ITuple& rTupB) - { - return B3ITuple( - std::max(rTupB.getX(), rTupA.getX()), - std::max(rTupB.getY(), rTupA.getY()), - std::max(rTupB.getZ(), rTupA.getZ())); - } - - inline B3ITuple absolute(const B3ITuple& rTup) - { - B3ITuple aAbs( - (0 > rTup.getX()) ? -rTup.getX() : rTup.getX(), - (0 > rTup.getY()) ? -rTup.getY() : rTup.getY(), - (0 > rTup.getZ()) ? -rTup.getZ() : rTup.getZ()); - return aAbs; - } - - inline B3ITuple interpolate(const B3ITuple& rOld1, const B3ITuple& rOld2, double t) - { - if(rOld1 == rOld2) - { - return rOld1; - } - else if(0.0 >= t) - { - return rOld1; - } - else if(1.0 <= t) - { - return rOld2; - } - else - { - return B3ITuple( - basegfx::fround(((rOld2.getX() - rOld1.getX()) * t) + rOld1.getX()), - basegfx::fround(((rOld2.getY() - rOld1.getY()) * t) + rOld1.getY()), - basegfx::fround(((rOld2.getZ() - rOld1.getZ()) * t) + rOld1.getZ())); - } - } - - inline B3ITuple average(const B3ITuple& rOld1, const B3ITuple& rOld2) - { - return B3ITuple( - rOld1.getX() == rOld2.getX() ? rOld1.getX() : basegfx::fround((rOld1.getX() + rOld2.getX()) * 0.5), - rOld1.getY() == rOld2.getY() ? rOld1.getY() : basegfx::fround((rOld1.getY() + rOld2.getY()) * 0.5), - rOld1.getZ() == rOld2.getZ() ? rOld1.getZ() : basegfx::fround((rOld1.getZ() + rOld2.getZ()) * 0.5)); - } - - inline B3ITuple average(const B3ITuple& rOld1, const B3ITuple& rOld2, const B3ITuple& rOld3) - { - return B3ITuple( - (rOld1.getX() == rOld2.getX() && rOld2.getX() == rOld3.getX()) ? rOld1.getX() : basegfx::fround((rOld1.getX() + rOld2.getX() + rOld3.getX()) * (1.0 / 3.0)), - (rOld1.getY() == rOld2.getY() && rOld2.getY() == rOld3.getY()) ? rOld1.getX() : basegfx::fround((rOld1.getY() + rOld2.getY() + rOld3.getY()) * (1.0 / 3.0)), - (rOld1.getZ() == rOld2.getZ() && rOld2.getZ() == rOld3.getZ()) ? rOld1.getX() : basegfx::fround((rOld1.getZ() + rOld2.getZ() + rOld3.getZ()) * (1.0 / 3.0))); - } - - inline B3ITuple operator+(const B3ITuple& rTupA, const B3ITuple& rTupB) - { - B3ITuple aSum(rTupA); - aSum += rTupB; - return aSum; - } - - inline B3ITuple operator-(const B3ITuple& rTupA, const B3ITuple& rTupB) - { - B3ITuple aSub(rTupA); - aSub -= rTupB; - return aSub; - } - - inline B3ITuple operator/(const B3ITuple& rTupA, const B3ITuple& rTupB) - { - B3ITuple aDiv(rTupA); - aDiv /= rTupB; - return aDiv; - } - - inline B3ITuple operator*(const B3ITuple& rTupA, const B3ITuple& rTupB) - { - B3ITuple aMul(rTupA); - aMul *= rTupB; - return aMul; - } - - inline B3ITuple operator*(const B3ITuple& rTup, sal_Int32 t) - { - B3ITuple aNew(rTup); - aNew *= t; - return aNew; - } - - inline B3ITuple operator*(sal_Int32 t, const B3ITuple& rTup) - { - B3ITuple aNew(rTup); - aNew *= t; - return aNew; - } - - inline B3ITuple operator/(const B3ITuple& rTup, sal_Int32 t) - { - B3ITuple aNew(rTup); - aNew /= t; - return aNew; - } - - inline B3ITuple operator/(sal_Int32 t, const B3ITuple& rTup) - { - B3ITuple aNew(t, t, t); - B3ITuple aTmp(rTup); - aNew /= aTmp; - return aNew; - } } // end of namespace basegfx #endif // INCLUDED_BASEGFX_TUPLE_B3ITUPLE_HXX diff --git a/include/basegfx/vector/b2ivector.hxx b/include/basegfx/vector/b2ivector.hxx index e8fac19..3896852 100644 --- a/include/basegfx/vector/b2ivector.hxx +++ b/include/basegfx/vector/b2ivector.hxx @@ -132,13 +132,6 @@ namespace basegfx // external operators - /** Transform vector by given transformation matrix. - - Since this is a vector, translational components of the - matrix are disregarded. - */ - BASEGFX_DLLPUBLIC B2IVector operator*( const B2DHomMatrix& rMat, const B2IVector& rVec ); - template< typename charT, typename traits > inline std::basic_ostream<charT, traits> & operator <<( std::basic_ostream<charT, traits> & stream, const basegfx::B2IVector& vector ) diff --git a/include/basegfx/vector/b3dvector.hxx b/include/basegfx/vector/b3dvector.hxx index 1e8572e..cf4b1b2 100644 --- a/include/basegfx/vector/b3dvector.hxx +++ b/include/basegfx/vector/b3dvector.hxx @@ -227,23 +227,6 @@ namespace basegfx // external operators - /** get a 3D Vector which is in 2D (ignoring - the Z-Coordinate) perpendicular to a given 3D Vector - - @attention This only works if the given 3D Vector is normalized. - - @param rNormalizedVec - A normalized 3D Vector. - - @return - A 3D Vector perpendicular to the given one in X,Y (2D). - */ - inline B3DVector getPerpendicular2D( const B3DVector& rNormalizedVec ) - { - B3DVector aPerpendicular(-rNormalizedVec.getY(), rNormalizedVec.getX(), rNormalizedVec.getZ()); - return aPerpendicular; - } - /** Test two vectors which need not to be normalized for parallelism @param rVecA diff --git a/vcl/win/source/gdi/gdiimpl.cxx b/vcl/win/source/gdi/gdiimpl.cxx index 408639c..c6afb9d 100644 --- a/vcl/win/source/gdi/gdiimpl.cxx +++ b/vcl/win/source/gdi/gdiimpl.cxx @@ -1051,6 +1051,57 @@ void WinSalGraphicsImpl::ResetClipRegion() SelectClipRgn( mrParent.getHDC(), 0 ); } +static bool containsOnlyHorizontalAndVerticalEdges(const basegfx::B2DPolygon& rCandidate) +{ + if(rCandidate.areControlPointsUsed()) + { + return false; + } + + const sal_uInt32 nPointCount(rCandidate.count()); + + if(nPointCount < 2) + { + return true; + } + + const sal_uInt32 nEdgeCount(rCandidate.isClosed() ? nPointCount + 1 : nPointCount); + basegfx::B2DPoint aLast(rCandidate.getB2DPoint(0)); + + for(sal_uInt32 a(1); a < nEdgeCount; a++) + { + const sal_uInt32 nNextIndex(a % nPointCount); + const basegfx::B2DPoint aCurrent(rCandidate.getB2DPoint(nNextIndex)); + + if(!basegfx::fTools::equal(aLast.getX(), aCurrent.getX()) && !basegfx::fTools::equal(aLast.getY(), aCurrent.getY())) + { + return false; + } + + aLast = aCurrent; + } + + return true; +} + +static bool containsOnlyHorizontalAndVerticalEdges(const basegfx::B2DPolyPolygon& rCandidate) +{ + if(rCandidate.areControlPointsUsed()) + { + return false; + } + + for(sal_uInt32 a(0); a < rCandidate.count(); a++) + { + if(!containsOnlyHorizontalAndVerticalEdges(rCandidate.getB2DPolygon(a))) + { + return false; + } + } + + return true; +} + bool WinSalGraphicsImpl::setClipRegion( const vcl::Region& i_rClip ) { if ( mrParent.mhRegion ) @@ -1078,7 +1129,7 @@ bool WinSalGraphicsImpl::setClipRegion( const vcl::Region& i_rClip ) if(!aPolyPolygon.areControlPointsUsed()) { - if(basegfx::tools::containsOnlyHorizontalAndVerticalEdges(aPolyPolygon)) + if(containsOnlyHorizontalAndVerticalEdges(aPolyPolygon)) { bUsePolygon = false; } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits