diff --git a/toonz/sources/CMakeLists.txt b/toonz/sources/CMakeLists.txt index 3e2316b..3cb7ff3 100644 --- a/toonz/sources/CMakeLists.txt +++ b/toonz/sources/CMakeLists.txt @@ -336,9 +336,11 @@ set(CXX_WARNINGS) if(CMAKE_COMPILER_IS_GNUCC) ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_WRITE_STRINGS -Wwrite-strings) ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_UNDEF -Wundef) + ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_MISSING_DECLARATIONS -Wmissing-declarations) ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_WRITE_STRINGS -Wwrite-strings) ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_UNDEF -Wundef) + ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_MISSING_DECLARATIONS -Wmissing-declarations) endif() diff --git a/toonz/sources/colorfx/regionstyles.cpp b/toonz/sources/colorfx/regionstyles.cpp index e4b904c..9a9d472 100644 --- a/toonz/sources/colorfx/regionstyles.cpp +++ b/toonz/sources/colorfx/regionstyles.cpp @@ -661,7 +661,7 @@ double ShadowStyle2::getParamValue(TColorStyle::double_tag, int index) const { //----------------------------------------------------------------------------- -int nbDiffVerts(const std::vector &pv) { +static int nbDiffVerts(const std::vector &pv) { std::vector lpv; bool isMissing[4] = {true, true, true, true}; if (pv.size() == 0) return 0; diff --git a/toonz/sources/common/expressions/tgrammar.cpp b/toonz/sources/common/expressions/tgrammar.cpp index 818e201..9a21c8a 100644 --- a/toonz/sources/common/expressions/tgrammar.cpp +++ b/toonz/sources/common/expressions/tgrammar.cpp @@ -23,9 +23,9 @@ #include "tgrammar.h" -const double PI = 4 * atan(1.0); -const double toDeg(double rad) { return rad * 180.0 / PI; } -const double toRad(double deg) { return deg / 180.0 * PI; } +static const double PI = 4 * atan(1.0); +static const double toDeg(double rad) { return rad * 180.0 / PI; } +static const double toRad(double deg) { return deg / 180.0 * PI; } namespace TSyntax { diff --git a/toonz/sources/common/psdlib/psd.cpp b/toonz/sources/common/psdlib/psd.cpp index 9ec24de..aceb37b 100644 --- a/toonz/sources/common/psdlib/psd.cpp +++ b/toonz/sources/common/psdlib/psd.cpp @@ -41,7 +41,7 @@ void readKey(FILE *f, struct dictentry *parent, TPSDLayerInfo *li); void readLayer16(FILE *f, struct dictentry *parent, TPSDLayerInfo *li); //----end forward declarations -char swapByte(unsigned char src) { +static char swapByte(unsigned char src) { unsigned char out = 0; for (int i = 0; i < 8; ++i) { out = out << 1; diff --git a/toonz/sources/common/tapptools/tcli.cpp b/toonz/sources/common/tapptools/tcli.cpp index 22dab09..652a9f8 100644 --- a/toonz/sources/common/tapptools/tcli.cpp +++ b/toonz/sources/common/tapptools/tcli.cpp @@ -744,7 +744,7 @@ void RangeQualifier::fetch(int index, int &argc, char *argv[]) { } } -std::ostream &operator<<(std::ostream &out, const RangeQualifier &range) { +static std::ostream &operator<<(std::ostream &out, const RangeQualifier &range) { return out << "[" << range.getFrom() << ", " << range.getTo() << "]"; } diff --git a/toonz/sources/common/tapptools/tcolorutils.cpp b/toonz/sources/common/tapptools/tcolorutils.cpp index 6b3e0e7..71ed04c 100644 --- a/toonz/sources/common/tapptools/tcolorutils.cpp +++ b/toonz/sources/common/tapptools/tcolorutils.cpp @@ -456,7 +456,7 @@ assert(areAlmostEqual(a*v*v*v+b*v*v+c*v+d, 0.0)); //------------------------------------------------------------------------------ -void clusterize(ClusterContainer &clusters, int clustersCount) { +static void clusterize(ClusterContainer &clusters, int clustersCount) { unsigned int clustersSize = clusters.size(); assert(clustersSize >= 1); @@ -737,8 +737,8 @@ void Cluster::getMeanAxis(KEYER_FLOAT axis[3]) { //#define METODO_USATO_SU_TOONZ46 -void buildPaletteForBlendedImages(std::set &palette, - const TRaster32P &raster, int maxColorCount) { +static void buildPaletteForBlendedImages(std::set &palette, + const TRaster32P &raster, int maxColorCount) { int lx = raster->getLx(); int ly = raster->getLy(); diff --git a/toonz/sources/common/tcolor/tpixel.cpp b/toonz/sources/common/tcolor/tpixel.cpp index 30a97de..00a64fc 100644 --- a/toonz/sources/common/tcolor/tpixel.cpp +++ b/toonz/sources/common/tcolor/tpixel.cpp @@ -47,17 +47,17 @@ const TPixelGR8 TPixelGR8::Black(0); const TPixelGR16 TPixelGR16::White(maxChannelValue); const TPixelGR16 TPixelGR16::Black(0); -std::ostream &operator<<(std::ostream &out, const TPixel32 &pixel) { +static std::ostream &operator<<(std::ostream &out, const TPixel32 &pixel) { return out << "PixRGBM32(" << (int)pixel.r << ", " << (int)pixel.g << ", " << (int)pixel.b << ", " << (int)pixel.m << ")"; } -std::ostream &operator<<(std::ostream &out, const TPixel64 &pixel) { +static std::ostream &operator<<(std::ostream &out, const TPixel64 &pixel) { return out << "PixRGBM64(" << pixel.r << ", " << pixel.g << ", " << pixel.b << ", " << pixel.m << ")"; } -std::ostream &operator<<(std::ostream &out, const TPixelD &pixel) { +static std::ostream &operator<<(std::ostream &out, const TPixelD &pixel) { return out << "PixD(" << pixel.r << ", " << pixel.g << ", " << pixel.b << ", " << pixel.m << ")"; } diff --git a/toonz/sources/common/tcontenthistory.cpp b/toonz/sources/common/tcontenthistory.cpp index 6eada27..8f157fb 100644 --- a/toonz/sources/common/tcontenthistory.cpp +++ b/toonz/sources/common/tcontenthistory.cpp @@ -83,7 +83,7 @@ inline QString getStr(const TFrameId &id) { const QString Fmt = "dd MMM yy hh:mm"; -QString getLine(int counter, const QDateTime &date, +static QString getLine(int counter, const QDateTime &date, const set &frames) { static QString user; static QString machine; @@ -127,7 +127,7 @@ QString getLine(int counter, const QDateTime &date, //-------------------------------------------------------------------- -int getCurrentCount(const QString &str) { +static int getCurrentCount(const QString &str) { if (str == "") return 0; int from = str.lastIndexOf('#') + 1; diff --git a/toonz/sources/common/tiio/tiio_jpg.cpp b/toonz/sources/common/tiio/tiio_jpg.cpp index 991d5ff..c4991bf 100644 --- a/toonz/sources/common/tiio/tiio_jpg.cpp +++ b/toonz/sources/common/tiio/tiio_jpg.cpp @@ -29,9 +29,11 @@ const std::string Tiio::JpgWriterProperties::QUALITY("Quality"); //========================================================= -extern "C" void tnz_error_exit(j_common_ptr cinfo) { +extern "C" { +static void tnz_error_exit(j_common_ptr cinfo) { // throw "merda"; } +} #ifdef CICCIO JMETHOD(void, error_exit, (j_common_ptr cinfo)); diff --git a/toonz/sources/common/timage_io/timage_io.cpp b/toonz/sources/common/timage_io/timage_io.cpp index 4d8c849..6134817 100644 --- a/toonz/sources/common/timage_io/timage_io.cpp +++ b/toonz/sources/common/timage_io/timage_io.cpp @@ -527,7 +527,7 @@ void TImageWriter::setProperties(const TPropertyGroup *g) { //----------------------------------------------------------- -void convertForWriting(TRasterP &ras, const TRasterP &rin, int bpp) { +static void convertForWriting(TRasterP &ras, const TRasterP &rin, int bpp) { switch (bpp) { case 1: case 8: diff --git a/toonz/sources/common/tmeshimage/tmeshimage.cpp b/toonz/sources/common/tmeshimage/tmeshimage.cpp index 2efc173..a5cd662 100644 --- a/toonz/sources/common/tmeshimage/tmeshimage.cpp +++ b/toonz/sources/common/tmeshimage/tmeshimage.cpp @@ -34,7 +34,7 @@ static TTextureMeshP cloneMesh_(const TTextureMeshP &other) { return TTextureMeshP(new TTextureMesh(*other)); } -void static_check() { +static void static_check() { /* input iterator */ static_assert( std::is_same 0) bSpeedTrunc.x = 0; diff --git a/toonz/sources/common/tparam/ttonecurveparam.cpp b/toonz/sources/common/tparam/ttonecurveparam.cpp index 24d95d3..b2a91c2 100644 --- a/toonz/sources/common/tparam/ttonecurveparam.cpp +++ b/toonz/sources/common/tparam/ttonecurveparam.cpp @@ -50,7 +50,7 @@ TToneCurveParam::TToneCurveParam() : TParam() { //--------------------------------------------------------- -TParamSetP getClonedParamSet(TParamSetP srcParamSet) { +static TParamSetP getClonedParamSet(TParamSetP srcParamSet) { TParamSetP dstParamSet = new TParamSet(srcParamSet->getName()); int i; for (i = 0; i < srcParamSet->getParamCount(); i++) { diff --git a/toonz/sources/common/trop/quickput.cpp b/toonz/sources/common/trop/quickput.cpp index e90c306..92b3db6 100644 --- a/toonz/sources/common/trop/quickput.cpp +++ b/toonz/sources/common/trop/quickput.cpp @@ -3,6 +3,7 @@ #include "trop.h" #include "loop_macros.h" #include "tpixelutils.h" +#include "quickputP.h" #ifndef TNZCORE_LIGHT #include "tpalette.h" diff --git a/toonz/sources/common/trop/quickputP.h b/toonz/sources/common/trop/quickputP.h index a0ce3e0..54d4414 100644 --- a/toonz/sources/common/trop/quickputP.h +++ b/toonz/sources/common/trop/quickputP.h @@ -11,6 +11,11 @@ void quickPut(const TRasterP &dn, const TRasterP &up, const TAffine &aff, bool doPremultiply = false, bool whiteTransp = false, bool firstColumn = false, bool doRasterDarkenBlendedView = false); +void quickPut(const TRasterP &dn, const TRasterP &up, const TAffine &aff, + TRop::ResampleFilterType filterType, const TPixel32 &colorScale, + bool doPremultiply, bool whiteTransp, bool firstColumn, + bool doRasterDarkenBlendedView); + void quickResample(const TRasterP &dn, const TRasterP &up, const TAffine &aff, TRop::ResampleFilterType filterType); diff --git a/toonz/sources/common/trop/tconvert.cpp b/toonz/sources/common/trop/tconvert.cpp index 83fe96e..413ae34 100644 --- a/toonz/sources/common/trop/tconvert.cpp +++ b/toonz/sources/common/trop/tconvert.cpp @@ -11,7 +11,7 @@ // Conversion functions //****************************************************************** -void do_convert(const TRaster64P &dst, const TRaster32P &src) { +static void do_convert(const TRaster64P &dst, const TRaster32P &src) { assert(dst->getSize() == src->getSize()); int lx = src->getLx(); for (int y = 0; y < src->getLy(); y++) { @@ -29,7 +29,7 @@ void do_convert(const TRaster64P &dst, const TRaster32P &src) { //----------------------------------------------------------------------------- -void do_convert(const TRasterGR8P &dst, const TRaster32P &src) { +static void do_convert(const TRasterGR8P &dst, const TRaster32P &src) { assert(dst->getSize() == src->getSize()); int lx = src->getLx(); @@ -45,7 +45,7 @@ void do_convert(const TRasterGR8P &dst, const TRaster32P &src) { //----------------------------------------------------------------------------- -void do_convert(const TRasterGR16P &dst, const TRaster32P &src) { +static void do_convert(const TRasterGR16P &dst, const TRaster32P &src) { assert(dst->getSize() == src->getSize()); int lx = src->getLx(); @@ -62,7 +62,7 @@ void do_convert(const TRasterGR16P &dst, const TRaster32P &src) { //----------------------------------------------------------------------------- -void do_convert(const TRasterGR16P &dst, const TRaster64P &src) { +static void do_convert(const TRasterGR16P &dst, const TRaster64P &src) { assert(dst->getSize() == src->getSize()); int lx = src->getLx(); for (int y = 0; y < src->getLy(); y++) { @@ -79,7 +79,7 @@ void do_convert(const TRasterGR16P &dst, const TRaster64P &src) { //----------------------------------------------------------------------------- -void do_convert(const TRaster32P &dst, const TRasterGR8P &src) { +static void do_convert(const TRaster32P &dst, const TRasterGR8P &src) { assert(dst->getSize() == src->getSize()); int lx = src->getLx(); for (int y = 0; y < src->getLy(); y++) { @@ -150,7 +150,7 @@ inline void ditherConvert(TRaster64P inRas, TRaster32P outRas) { // Obsolete conversion functions //****************************************************************** -void do_convert(const TRasterCM32P &dst, const TRasterGR8P &src) { +static void do_convert(const TRasterCM32P &dst, const TRasterGR8P &src) { assert(dst->getSize() == src->getSize()); TPixelCM32 bg = TPixelCM32(0, 0, TPixelCM32::getMaxTone()); @@ -169,7 +169,7 @@ void do_convert(const TRasterCM32P &dst, const TRasterGR8P &src) { //----------------------------------------------------------------------------- -void do_convert(const TRasterCM32P &dst, const TRaster32P &src) { +static void do_convert(const TRasterCM32P &dst, const TRaster32P &src) { assert(dst->getSize() == src->getSize()); TPixelCM32 bg = TPixelCM32(0, 0, TPixelCM32::getMaxTone()); @@ -220,7 +220,7 @@ void do_convert(const TRasterCM32P &dst, const TRaster32P &src) { //----------------------------------------------------------------------------- -void do_convert(const TRasterYUV422P &dst, const TRaster32P &src) { +static void do_convert(const TRasterYUV422P &dst, const TRaster32P &src) { assert(src->getLx() & 0); long y1, y2, u, v, u1, u2, v1, v2; TPixel32 *pix = (TPixel32 *)src->pixels(); @@ -271,7 +271,7 @@ void do_convert(const TRasterYUV422P &dst, const TRaster32P &src) { //----------------------------------------------------------------------------- -void do_convert(const TRaster32P &dst, const TRasterYUV422P &src) { +static void do_convert(const TRaster32P &dst, const TRasterYUV422P &src) { int long r, g, b, y1, y2, u, v; TPixel32 *buf = dst->pixels(); const UCHAR *in = src->getRawData(); diff --git a/toonz/sources/common/trop/tdespeckle.cpp b/toonz/sources/common/trop/tdespeckle.cpp index d7d41ba..26c3704 100644 --- a/toonz/sources/common/trop/tdespeckle.cpp +++ b/toonz/sources/common/trop/tdespeckle.cpp @@ -444,8 +444,8 @@ void doDespeckleGR(const TRasterPT &ras, int sizeThreshold) { //---------------------------------------------------- -void doDespeckleCM32(const TRasterPT &ras, int sizeThreshold, - bool check) { +static void doDespeckleCM32(const TRasterPT &ras, int sizeThreshold, + bool check) { TRasterCM32P rasCM(ras); rasCM->lock(); diff --git a/toonz/sources/common/trop/tover.cpp b/toonz/sources/common/trop/tover.cpp index d03825b..aa67fe1 100644 --- a/toonz/sources/common/trop/tover.cpp +++ b/toonz/sources/common/trop/tover.cpp @@ -250,7 +250,7 @@ void do_over(TRasterGR8P rout, const TRaster32P &rup) { //----------------------------------------------------------------------------- -void do_over(TRaster32P rout, const TRasterGR8P &rup, const TPixel32 &color) { +static void do_over(TRaster32P rout, const TRasterGR8P &rup, const TPixel32 &color) { assert(rout->getSize() == rup->getSize()); for (int y = rout->getLy(); --y >= 0;) { TPixel32 *out_pix = rout->pixels(y); diff --git a/toonz/sources/common/trop/tropcm.cpp b/toonz/sources/common/trop/tropcm.cpp index 1e1a803..fc7ac2d 100644 --- a/toonz/sources/common/trop/tropcm.cpp +++ b/toonz/sources/common/trop/tropcm.cpp @@ -212,8 +212,8 @@ paints[i] = TPixelFloat(paints2[i]); //----------------------------------------------------------------------------------------------- -void do_convert(const TTile &dst, const TTile &src, const TPaletteP palette, - bool transparencyCheck, bool applyFx) { +static void do_convert(const TTile &dst, const TTile &src, const TPaletteP palette, + bool transparencyCheck, bool applyFx) { // assert(palette); // assert(_rasOut && _rasIn); // assert(rasOut->getSize() == rasIn->getSize()); diff --git a/toonz/sources/common/tsound/tsound_sdl.cpp b/toonz/sources/common/tsound/tsound_sdl.cpp index 898c218..9756b3f 100644 --- a/toonz/sources/common/tsound/tsound_sdl.cpp +++ b/toonz/sources/common/tsound/tsound_sdl.cpp @@ -107,7 +107,7 @@ public: extern "C" { -void sdl_fill_audio(void *udata, Uint8 *stream, int len) { +static void sdl_fill_audio(void *udata, Uint8 *stream, int len) { TSoundOutputDeviceImp *_this = (TSoundOutputDeviceImp *)udata; MyData *myData = _this->m_data; diff --git a/toonz/sources/common/tunit/tunit.cpp b/toonz/sources/common/tunit/tunit.cpp index 22d8b99..2d38202 100644 --- a/toonz/sources/common/tunit/tunit.cpp +++ b/toonz/sources/common/tunit/tunit.cpp @@ -24,7 +24,7 @@ double VerticalCameraFldUnitConverter::m_factor = 1; namespace UnitParameters { -std::pair dummyCurrentDpiGetter() { +static std::pair dummyCurrentDpiGetter() { return std::make_pair(72, 72); } diff --git a/toonz/sources/common/tvectorimage/cornerdetector.cpp b/toonz/sources/common/tvectorimage/cornerdetector.cpp index a735bd8..6552369 100644 --- a/toonz/sources/common/tvectorimage/cornerdetector.cpp +++ b/toonz/sources/common/tvectorimage/cornerdetector.cpp @@ -1,6 +1,7 @@ #include "tgeometry.h" +#include "cornerdetector.h" //====================================================================== @@ -39,8 +40,8 @@ public: }; //! Definisce l'operatore meno tra due AlgorithmPointI -AlgorithmPointI operator-(const AlgorithmPointI &op1, - const AlgorithmPointI &op2) { +static AlgorithmPointI operator-(const AlgorithmPointI &op1, + const AlgorithmPointI &op2) { return AlgorithmPointI(op1.operator-(op2), 0); } @@ -75,7 +76,7 @@ point_container gPoints; \param points Vettore di T3DPoints */ -bool interpolate(const std::vector &points) { +static bool interpolate(const std::vector &points) { unsigned int curr, next; TPointI currStep, xStep, yStep, guideLine; @@ -193,7 +194,7 @@ inline bool isAdmissibleCorner(int currIndex, int precIndex, int nextIndex) { //---------------------------------------------------------------------- //! Trova i possibili angoli tra i punti di gPoints -void findCornerCandidates() { +static void findCornerCandidates() { unsigned int curr, prec, next; curr = gMaxDist; @@ -229,7 +230,7 @@ void findCornerCandidates() { //---------------------------------------------------------------------- //! Trova gli angoli tra i punti di gPoints -void findCorners(int neighborLimit, std::vector &cornerIndexes) { +static void findCorners(int neighborLimit, std::vector &cornerIndexes) { unsigned int curr, prec, next; curr = gMaxDist; diff --git a/toonz/sources/common/tvectorimage/cornerdetector.h b/toonz/sources/common/tvectorimage/cornerdetector.h new file mode 100644 index 0000000..6b23879 --- /dev/null +++ b/toonz/sources/common/tvectorimage/cornerdetector.h @@ -0,0 +1,10 @@ +#pragma once + +#ifndef CORNERDETECTOR_H +#define CORNERDETECTOR_H + +void detectCorners(const std::vector &inputPoints, int minSampleNum, + int minDist, int maxDist, double maxAngle, + std::vector &cornerIndexes); + +#endif // CORNERDETECTOR_H diff --git a/toonz/sources/common/tvectorimage/outlineApproximation.cpp b/toonz/sources/common/tvectorimage/outlineApproximation.cpp index ee85208..2915c41 100644 --- a/toonz/sources/common/tvectorimage/outlineApproximation.cpp +++ b/toonz/sources/common/tvectorimage/outlineApproximation.cpp @@ -537,8 +537,8 @@ void drawQuadratic(const TQuadratic &quad, double pixelSize) { //----------------------------------------------------------------------------- -void makeOutline(const TStroke *stroke, int startQuad, int endQuad, - outlineBoundary &ob, double error2) { +static void makeOutline(const TStroke *stroke, int startQuad, int endQuad, + outlineBoundary &ob, double error2) { // std::ofstream cout("c:\\temp\\outline.txt"); assert(stroke); @@ -628,7 +628,7 @@ void makeOutline(const TStroke *stroke, int startQuad, int endQuad, //----------------------------------------------------------------------------- -void drawOutline(const outlineBoundary &ob, double pixelSize) { +static void drawOutline(const outlineBoundary &ob, double pixelSize) { for (UINT i = 0; i < ob.size(); ++i) { drawQuadratic(*ob[i].first, pixelSize); drawQuadratic(*ob[i].second, pixelSize); diff --git a/toonz/sources/common/tvectorimage/tcomputeregions.cpp b/toonz/sources/common/tvectorimage/tcomputeregions.cpp index 39679d9..ceced07 100644 --- a/toonz/sources/common/tvectorimage/tcomputeregions.cpp +++ b/toonz/sources/common/tvectorimage/tcomputeregions.cpp @@ -14,6 +14,7 @@ #include "tdebugmessage.h" #include "tthreadmessage.h" #include "tl2lautocloser.h" +#include "tcomputeregions.h" #include #include "tcurveutil.h" @@ -46,7 +47,7 @@ inline TThickPoint myRound(const TThickPoint &p) { return TThickPoint(myRound(p.x), myRound(p.y), p.thick); } -void roundStroke(TStroke *s) { +static void roundStroke(TStroke *s) { int size = s->getControlPointCount(); for (int j = 0; j < (int)s->getControlPointCount(); j++) { @@ -411,13 +412,13 @@ void addIntersection(IntersectionData &intData, const vector &s, //----------------------------------------------------------------------------- -bool sortBBox(const TStroke *s1, const TStroke *s2) { +static bool sortBBox(const TStroke *s1, const TStroke *s2) { return s1->getBBox().x0 < s2->getBBox().x0; } //----------------------------------------------------------------------------- -void cleanIntersectionMarks(const VIList &interList) { +static void cleanIntersectionMarks(const VIList &interList) { Intersection *p; IntersectedStroke *q; for (p = interList.first(); p; p = p->next()) @@ -435,7 +436,7 @@ void cleanIntersectionMarks(const VIList &interList) { //----------------------------------------------------------------------------- -void cleanNextIntersection(const VIList &interList, TStroke *s) { +static void cleanNextIntersection(const VIList &interList, TStroke *s) { Intersection *p; IntersectedStroke *q; @@ -903,7 +904,7 @@ void TVectorImage::Imp::eraseIntersection(int index) { } //----------------------------------------------------------------------------- -void findNearestIntersection(VIList &interList) { +static void findNearestIntersection(VIList &interList) { Intersection *p1; IntersectedStroke *p2; @@ -1026,7 +1027,7 @@ void markDeadIntersections(VIList &intList, Intersection *p) { // se cross val era 0, cerco di spostarmi un po' su w per vedere come sono // orientate le tangenti agli stroke... -double nearCrossVal(TStroke *s0, double w0, TStroke *s1, double w1) { +static double nearCrossVal(TStroke *s0, double w0, TStroke *s1, double w1) { double ltot0 = s0->getLength(); double ltot1 = s1->getLength(); double dl = std::min(ltot1, ltot0) / 1000; @@ -1066,7 +1067,7 @@ inline void insertBranch(Intersection &in, IntersectedStroke &item, //----------------------------------------------------------------------------- -double getAngle(const TPointD &p0, const TPointD &p1) { +static double getAngle(const TPointD &p0, const TPointD &p1) { double angle1 = atan2(p0.x, p0.y) * M_180_PI; double angle2 = atan2(p1.x, p1.y) * M_180_PI; @@ -1079,8 +1080,8 @@ double getAngle(const TPointD &p0, const TPointD &p1) { //----------------------------------------------------------------------------- // nel caso l'angolo tra due stroke in un certo w sia nullo, // si va un po' avanti per vedere come sono orientate.... -double getNearAngle(const TStroke *s1, double w1, bool out1, const TStroke *s2, - double w2, bool out2) { +static double getNearAngle(const TStroke *s1, double w1, bool out1, const TStroke *s2, + double w2, bool out2) { bool verse1 = (out1 && w1 < 1) || (!out1 && w1 == 0); bool verse2 = (out2 && w2 < 1) || (!out2 && w2 == 0); double ltot1 = s1->getLength(); @@ -1105,10 +1106,10 @@ double getNearAngle(const TStroke *s1, double w1, bool out1, const TStroke *s2, //----------------------------------------------------------------------------- -bool makeEdgeIntersection(Intersection &interList, IntersectedStroke &item1, - IntersectedStroke &item2, const TPointD &p1a, - const TPointD &p1b, const TPointD &p2a, - const TPointD &p2b) { +static bool makeEdgeIntersection(Intersection &interList, IntersectedStroke &item1, + IntersectedStroke &item2, const TPointD &p1a, + const TPointD &p1b, const TPointD &p2a, + const TPointD &p2b) { double angle1 = getAngle(p1a, p1b); double angle2 = getAngle(p1a, p2a); double angle3 = getAngle(p1a, p2b); @@ -1215,9 +1216,9 @@ bool makeEdgeIntersection(Intersection &interList, IntersectedStroke &item1, //----------------------------------------------------------------------------- -bool makeIntersection(IntersectionData &intData, const vector &s, - int ii, int jj, DoublePair inter, int strokeSize, - Intersection &interList) { +static bool makeIntersection(IntersectionData &intData, const vector &s, + int ii, int jj, DoublePair inter, int strokeSize, + Intersection &interList) { IntersectedStroke item1, item2; interList.m_intersection = s[ii]->m_s->getPoint(inter.first); @@ -1336,9 +1337,9 @@ areAlmostEqual(q->getP2(), p->getP0(), 1e-2)) */ //----------------------------------------------------------------------------- -bool addAutocloseIntersection(IntersectionData &intData, vector &s, - int ii, int jj, double w0, double w1, - int strokeSize, bool isVectorized) { +static bool addAutocloseIntersection(IntersectionData &intData, vector &s, + int ii, int jj, double w0, double w1, + int strokeSize, bool isVectorized) { assert(s[ii]->m_groupId == s[jj]->m_groupId); Intersection *rp = intData.m_intList.last(); @@ -1418,8 +1419,8 @@ bool addAutocloseIntersection(IntersectionData &intData, vector &s, // double g_autocloseTolerance = c_newAutocloseTolerance; -bool isCloseEnoughP2P(double facMin, double facMax, TStroke *s1, double w0, - TStroke *s2, double w1) { +static bool isCloseEnoughP2P(double facMin, double facMax, TStroke *s1, double w0, + TStroke *s2, double w1) { double autoDistMin, autoDistMax; TThickPoint p0 = s1->getThickPoint(w0); @@ -1495,9 +1496,9 @@ return false; */ //----------------------------------------------------------------------------- -double getCurlW(TStroke *s, bool isBegin) // trova il punto di split su una - // stroke, in prossimita di un - // ricciolo; +static double getCurlW(TStroke *s, bool isBegin) // trova il punto di split su una + // stroke, in prossimita di un + // ricciolo; // un ricciolo c'e' se la curva ha un min o max relativo su x seguito da uno su // y, o viceversa. { @@ -1570,8 +1571,8 @@ return -1; #endif //----------------------------------------------------------------------------- -bool isCloseEnoughP2L(double facMin, double facMax, TStroke *s1, double w1, - TStroke *s2, double &w) { +static bool isCloseEnoughP2L(double facMin, double facMax, TStroke *s1, double w1, + TStroke *s2, double &w) { if (s1->isSelfLoop()) return false; TThickPoint p0 = s1->getThickPoint(w1); @@ -1880,10 +1881,10 @@ void getClosingPoints(const TRectD &rect, double fac, const TVectorImageP &vi, //------------------------------------------------------------------------------------------------------- -void autoclose(double factor, vector &s, int ii, int jj, - IntersectionData &IntData, int strokeSize, - TL2LAutocloser &l2lautocloser, vector *intersections, - bool isVectorized) { +static void autoclose(double factor, vector &s, int ii, int jj, + IntersectionData &IntData, int strokeSize, + TL2LAutocloser &l2lautocloser, vector *intersections, + bool isVectorized) { vector> segments; getClosingSegments(l2lautocloser, 0, factor, s[ii]->m_s, s[jj]->m_s, intersections, segments); @@ -1938,9 +1939,9 @@ TPointD inline getTangent(const IntersectedStroke &item) { //----------------------------------------------------------------------------- -void addBranch(IntersectionData &intData, VIList &strokeList, - const vector &s, int ii, double w, int strokeSize, - bool gettingOut) { +static void addBranch(IntersectionData &intData, VIList &strokeList, + const vector &s, int ii, double w, int strokeSize, + bool gettingOut) { IntersectedStroke *p1, *p2; TPointD tanRef, lastTan; @@ -2055,9 +2056,9 @@ return; //----------------------------------------------------------------------------- -void addBranches(IntersectionData &intData, Intersection &intersection, - const vector &s, int ii, int jj, - DoublePair intersectionPair, int strokeSize) { +static void addBranches(IntersectionData &intData, Intersection &intersection, + const vector &s, int ii, int jj, + DoublePair intersectionPair, int strokeSize) { bool foundS1 = false, foundS2 = false; IntersectedStroke *p; @@ -2127,9 +2128,9 @@ IntersectedStroke app; //----------------------------------------------------------------------------- -void addIntersections(IntersectionData &intData, const vector &s, - int ii, int jj, vector &intersections, - int strokeSize, bool isVectorized) { +static void addIntersections(IntersectionData &intData, const vector &s, + int ii, int jj, vector &intersections, + int strokeSize, bool isVectorized) { for (int k = 0; k < (int)intersections.size(); k++) { if (ii >= strokeSize && (areAlmostEqual(intersections[k].first, 0.0) || areAlmostEqual(intersections[k].first, 1.0))) @@ -2446,8 +2447,8 @@ if (tdistance2(p01, p11)< 2*0.06*0.06) //----------------------------------------------------------------------------- // Trova una possibile regione data una lista di punti di intersezione -TRegion *findRegion(VIList &intList, Intersection *p1, - IntersectedStroke *p2, bool minimizeEdges) { +static TRegion *findRegion(VIList &intList, Intersection *p1, + IntersectedStroke *p2, bool minimizeEdges) { TRegion *r = new TRegion(); int currStyle = 0; @@ -2662,7 +2663,7 @@ void computeRegionFeature(const TRegion &r, TRegionFeatureFormula &formula) { //---------------------------------------------------------------------------------- -bool isValidArea(const TRegion &r) { +static bool isValidArea(const TRegion &r) { TRegionClockWiseFormula formula; computeRegionFeature(r, formula); return formula.isClockwise(); @@ -2759,7 +2760,7 @@ void transferColors(const list &oldList, const list &newList, bool isStrokeChanged, bool isFlipped, bool overwriteColor); //----------------------------------------------------------------------------- -void printStrokes1(vector &v, int size) { +static void printStrokes1(vector &v, int size) { UINT i = 0; ofstream of("C:\\temp\\strokes.txt"); diff --git a/toonz/sources/common/tvectorimage/tcomputeregions.h b/toonz/sources/common/tvectorimage/tcomputeregions.h new file mode 100644 index 0000000..17100df --- /dev/null +++ b/toonz/sources/common/tvectorimage/tcomputeregions.h @@ -0,0 +1,9 @@ + +#pragma once + +#ifndef T_COMPUTEREGIONS_H +#define T_COMPUTEREGIONS_H + +void invalidateRegionPropAndBBox(TRegion *reg); + +#endif // T_COMPUTEREGIONS_H diff --git a/toonz/sources/common/tvectorimage/tregion.cpp b/toonz/sources/common/tvectorimage/tregion.cpp index 3adcf98..42592e5 100644 --- a/toonz/sources/common/tvectorimage/tregion.cpp +++ b/toonz/sources/common/tvectorimage/tregion.cpp @@ -34,7 +34,7 @@ void foo() //============================================================================= -bool compareEdge(const TEdge &a, const TEdge &b) { return a.m_s == b.m_s; } +static bool compareEdge(const TEdge &a, const TEdge &b) { return a.m_s == b.m_s; } //----------------------------------------------------------------------------- @@ -527,7 +527,7 @@ void TRegion::draw(const TVectorRenderData &rd) //----------------------------------------------------------------------------- -void checkPolyline(const std::vector &p) { +static void checkPolyline(const std::vector &p) { int ret; if (p.size() < 3) return; diff --git a/toonz/sources/common/tvectorimage/tstroke.cpp b/toonz/sources/common/tvectorimage/tstroke.cpp index 8f149d5..fb03365 100644 --- a/toonz/sources/common/tvectorimage/tstroke.cpp +++ b/toonz/sources/common/tvectorimage/tstroke.cpp @@ -8,6 +8,7 @@ #include "tbezier.h" #include "tzerofinder.h" #include "tcurveutil.h" +#include "cornerdetector.h" #include @@ -32,10 +33,6 @@ typedef std::vector QuadStrokeChunkArray; static int numSaved = 0; -void detectCorners(const std::vector &points, int minSampleNum, - int minDist, int maxDist, double maxAngle, - std::vector &corners); - namespace { //--------------------------------------------------------------------------- diff --git a/toonz/sources/common/tvectorimage/tsweepboundary.cpp b/toonz/sources/common/tvectorimage/tsweepboundary.cpp index 3589de9..315e0d8 100644 --- a/toonz/sources/common/tvectorimage/tsweepboundary.cpp +++ b/toonz/sources/common/tvectorimage/tsweepboundary.cpp @@ -174,10 +174,10 @@ typedef list QuadraticList; //--------------------------------------------------------------------------- -void splitCircularArcIntoQuadraticCurves(const TPointD &Center, - const TPointD &Pstart, - const TPointD &Pend, - vector &quadArray) { +static void splitCircularArcIntoQuadraticCurves(const TPointD &Center, + const TPointD &Pstart, + const TPointD &Pend, + vector &quadArray) { // It splits a circular anticlockwise arc into a sequence of quadratic bezier // curves // Every quadratic curve can approximate an arc no longer than 45 degrees (or @@ -365,7 +365,7 @@ inline void drawPointCross(const TPointD &point, double R, double G, double B) { //------------------------------------------------------------------- -TStroke *getOutStroke(LinkedQuadraticList &inputBoundaries) { +static TStroke *getOutStroke(LinkedQuadraticList &inputBoundaries) { vector aux; LinkedQuadraticList::iterator it = inputBoundaries.begin(); @@ -427,8 +427,8 @@ inline bool getOutputOutlines(LinkedQuadraticList &inputBoundaries, //------------------------------------------------------------------- -bool computeBoundaryStroke(const TStroke &_stroke, - vector &sweepStrokes) { +static bool computeBoundaryStroke(const TStroke &_stroke, + vector &sweepStrokes) { // if(!outlines.empty()) return false; TStroke *oriStroke = const_cast(&_stroke); diff --git a/toonz/sources/common/tvectorimage/tvectorimage.cpp b/toonz/sources/common/tvectorimage/tvectorimage.cpp index bc14fa1..d8a5877 100644 --- a/toonz/sources/common/tvectorimage/tvectorimage.cpp +++ b/toonz/sources/common/tvectorimage/tvectorimage.cpp @@ -14,6 +14,7 @@ #include "tpaletteutil.h" #include "tthreadmessage.h" #include "tsimplecolorstyles.h" +#include "tcomputeregions.h" #include @@ -246,7 +247,7 @@ TRectD TVectorImage::addStroke(const std::vector &points) //----------------------------------------------------------------------------- -bool isRegionWithStroke(TRegion *region, TStroke *s) { +static bool isRegionWithStroke(TRegion *region, TStroke *s) { for (UINT i = 0; i < region->getEdgeCount(); i++) if (region->getEdge(i)->m_s == s) return true; return false; @@ -254,7 +255,7 @@ bool isRegionWithStroke(TRegion *region, TStroke *s) { //----------------------------------------------------------------------------- -void deleteSubRegionWithStroke(TRegion *region, TStroke *s) { +static void deleteSubRegionWithStroke(TRegion *region, TStroke *s) { for (int i = 0; i < (int)region->getSubregionCount(); i++) { deleteSubRegionWithStroke(region->getSubregion(i), s); if (isRegionWithStroke(region->getSubregion(i), s)) { @@ -1044,7 +1045,6 @@ bool TVectorImage::Imp::areWholeGroups(const std::vector &indexes) const { //----------------------------------------------------------------------------- //------------------------------------------------------------------- -void invalidateRegionPropAndBBox(TRegion *reg); void TVectorImage::Imp::notifyChangedStrokes( const std::vector &strokeIndexArray, @@ -1938,9 +1938,9 @@ assert(m_strokes[strokeIndex-wSize+1]->m_edgeList.empty());*/ //----------------------------------------------------------------------------- -void computeEdgeList(TStroke *newS, const std::list &edgeList1, - bool join1AtBegin, const std::list &edgeList2, - bool join2AtBegin, std::list &edgeList) { +static void computeEdgeList(TStroke *newS, const std::list &edgeList1, + bool join1AtBegin, const std::list &edgeList2, + bool join2AtBegin, std::list &edgeList) { std::list::const_iterator it; if (!edgeList1.empty()) { diff --git a/toonz/sources/common/tvectorimage/tvectorimageP.h b/toonz/sources/common/tvectorimage/tvectorimageP.h index 19ce718..5a14c15 100644 --- a/toonz/sources/common/tvectorimage/tvectorimageP.h +++ b/toonz/sources/common/tvectorimage/tvectorimageP.h @@ -264,7 +264,14 @@ private: Imp &operator=(const Imp &); }; +// Functions + void addRegion(std::vector ®ionArray, TRegion *region); + +void transferColors(const std::list &oldList, + const std::list &newList, bool isStrokeChanged, + bool isFlipped, bool overwriteColor); + //============================================================================= #endif diff --git a/toonz/sources/common/tvrender/tcolorstyles.cpp b/toonz/sources/common/tvrender/tcolorstyles.cpp index 6c1813f..3b18ce5 100644 --- a/toonz/sources/common/tvrender/tcolorstyles.cpp +++ b/toonz/sources/common/tvrender/tcolorstyles.cpp @@ -451,8 +451,8 @@ void TColorStyle::declare(TColorStyle *style) { //=================================================================== -double computeAverageThickness(const TStroke *s, double &minThickness, - double &maxThickness) { +static double computeAverageThickness(const TStroke *s, double &minThickness, + double &maxThickness) { int count = s->getControlPointCount(); minThickness = 1000; diff --git a/toonz/sources/common/tvrender/tflash.cpp b/toonz/sources/common/tvrender/tflash.cpp index 009e09a..3205751 100644 --- a/toonz/sources/common/tvrender/tflash.cpp +++ b/toonz/sources/common/tvrender/tflash.cpp @@ -32,13 +32,13 @@ TNZ_LITTLE_ENDIAN undefined !! int Tw = 0; -bool areTwEqual(double x, double y) { +static bool areTwEqual(double x, double y) { assert(Tw != 0); return (int)(Tw * x) == (int)(Tw * y); } -bool areTwEqual(TPointD p0, TPointD p1) { +static bool areTwEqual(TPointD p0, TPointD p1) { assert(Tw != 0); return areTwEqual(p0.x, p1.x) && areTwEqual(p0.y, p1.y); @@ -184,7 +184,7 @@ public: TImageP m_img; }; -double computeAverageThickness(const TStroke *s) { +static double computeAverageThickness(const TStroke *s) { int count = s->getControlPointCount(); double resThick = 0; int i; @@ -198,8 +198,8 @@ double computeAverageThickness(const TStroke *s) { return resThick / (s->getControlPointCount() - 4); } -void putquads(const TStroke *s, double w0, double w1, - std::vector &quads) { +static void putquads(const TStroke *s, double w0, double w1, + std::vector &quads) { int chunkIndex0, chunkIndex1, i; double dummy; bool ret; @@ -216,9 +216,9 @@ void putquads(const TStroke *s, double w0, double w1, //------------------------------------------------------------------- -void computeOutlineBoundary(std::vector &outlines, - std::list &polylinesArray, - const TPixel &color) { +static void computeOutlineBoundary(std::vector &outlines, + std::list &polylinesArray, + const TPixel &color) { UINT size = polylinesArray.size(); std::vector> quads; @@ -273,7 +273,7 @@ bool PolyStyle::operator==(const PolyStyle &p) const { //------------------------------------------------------------------- -bool affineMinorThen(const TAffine &m0, const TAffine &m1) { +static bool affineMinorThen(const TAffine &m0, const TAffine &m1) { if (m0.a11 == m1.a11) { if (m0.a12 == m1.a12) { if (m0.a13 == m1.a13) { @@ -323,8 +323,8 @@ bool PolyStyle::operator<(const PolyStyle &p) const { //------------------------------------------------------------------- -void computeQuadChain(const TEdge &e, std::vector &quadArray, - std::vector &toBeDeleted) { +static void computeQuadChain(const TEdge &e, std::vector &quadArray, + std::vector &toBeDeleted) { int chunk_b, chunk_e, chunk = -1; double t_b, t_e, w0, w1; TThickQuadratic *q_b = 0, *q_e = 0; diff --git a/toonz/sources/common/tvrender/tglregions.cpp b/toonz/sources/common/tvrender/tglregions.cpp index 8bf6004..e489878 100644 --- a/toonz/sources/common/tvrender/tglregions.cpp +++ b/toonz/sources/common/tvrender/tglregions.cpp @@ -436,7 +436,7 @@ void tglDraw(const TVectorRenderData &rd, const TStroke *s, bool pushAttribs) { //------------------------------------------------------------------------------------ -void tglDoDraw(const TVectorRenderData &rd, TRegion *r) { +static void tglDoDraw(const TVectorRenderData &rd, TRegion *r) { bool visible = false; int colorCount = 0; if (!r) return; @@ -462,7 +462,7 @@ void tglDoDraw(const TVectorRenderData &rd, TRegion *r) { //------------------------------------------------------------------------------------ -void tglDoDraw(const TVectorRenderData &rd, const TStroke *s) { +static void tglDoDraw(const TVectorRenderData &rd, const TStroke *s) { bool visible = false; int colorCount = 0; diff --git a/toonz/sources/common/tvrender/tinbetween.cpp b/toonz/sources/common/tvrender/tinbetween.cpp index a8faa5b..68b8551 100644 --- a/toonz/sources/common/tvrender/tinbetween.cpp +++ b/toonz/sources/common/tvrender/tinbetween.cpp @@ -18,7 +18,7 @@ //#include "tdebugmessage.h" //-------------------------------------------------------------------------------------- -double average(std::vector &values, double range = 2.5) { +static double average(std::vector &values, double range = 2.5) { UINT size = values.size(); if (size == 0) return std::numeric_limits::signaling_NaN(); @@ -56,8 +56,8 @@ double average(std::vector &values, double range = 2.5) { //-------------------------------------------------------------------------------------- -double weightedAverage(std::vector &values, - std::vector &weights, double range = 2.5) { +static double weightedAverage(std::vector &values, + std::vector &weights, double range = 2.5) { UINT size = values.size(); if (size == 0) return std::numeric_limits::signaling_NaN(); @@ -162,8 +162,8 @@ n^r <= 2^(s-1) < (2^s)-1 //-------------------------------------------------------------------------------------- -void eraseSmallAngles(std::vector> &corners, - double angle) { +static void eraseSmallAngles(std::vector> &corners, + double angle) { std::vector>::iterator it = corners.begin(); while (it != corners.end()) { @@ -180,9 +180,9 @@ void eraseSmallAngles(std::vector> &corners, // of the corners) // max is tha maximum angle greater or equal to minDegree -void detectCorners(const TStroke *stroke, double minDegree, - std::vector> &corners, double &min, - double &max) { +static void detectCorners(const TStroke *stroke, double minDegree, + std::vector> &corners, double &min, + double &max) { const double minSin = fabs(sin(minDegree * M_PI_180)); double angle, vectorialProduct, metaCornerLen, partialLen; @@ -330,7 +330,7 @@ void detectCorners(const TStroke *stroke, double minDegree, //-------------------------------------------------------------------------------------- -double variance(std::vector &values) { +static double variance(std::vector &values) { UINT size = values.size(); if (size == 0) return std::numeric_limits::signaling_NaN(); @@ -352,13 +352,13 @@ double variance(std::vector &values) { //-------------------------------------------------------------------------------------- -void findBestSolution(const TStroke *stroke1, const TStroke *stroke2, - std::pair *partialAngles1, - UINT partialAngles1Size, - const std::vector> &angles2, - UINT r, - std::list> &partialSolution, - double &bestValue, std::vector &bestVector) { +static void findBestSolution(const TStroke *stroke1, const TStroke *stroke2, + std::pair *partialAngles1, + UINT partialAngles1Size, + const std::vector> &angles2, + UINT r, + std::list> &partialSolution, + double &bestValue, std::vector &bestVector) { //------------------------------------------------------------------- if (r == partialAngles1Size) { UINT j; @@ -499,10 +499,10 @@ TDebugMessage::flush(); //-------------------------------------------------------------------------------------- -void findBestSolution(const TStroke *stroke1, const TStroke *stroke2, - std::vector> &angles1, - const std::vector> &angles2, - double &bestValue, std::vector &bestVector) { +static void findBestSolution(const TStroke *stroke1, const TStroke *stroke2, + std::vector> &angles1, + const std::vector> &angles2, + double &bestValue, std::vector &bestVector) { assert(angles1.size() > angles2.size()); std::list> partialSolution; @@ -513,10 +513,10 @@ void findBestSolution(const TStroke *stroke1, const TStroke *stroke2, //-------------------------------------------------------------------------------------- -void trivialSolution(const TStroke *stroke1, const TStroke *stroke2, - const std::vector> &angles1, - const std::vector> &angles2, - std::vector &solution) { +static void trivialSolution(const TStroke *stroke1, const TStroke *stroke2, + const std::vector> &angles1, + const std::vector> &angles2, + std::vector &solution) { assert(angles1.size() > angles2.size()); UINT j; @@ -578,7 +578,7 @@ void trivialSolution(const TStroke *stroke1, const TStroke *stroke2, //-------------------------------------------------------------------------------------- -TStroke *extract(const TStroke *source, UINT firstQuad, UINT lastQuad) { +static TStroke *extract(const TStroke *source, UINT firstQuad, UINT lastQuad) { UINT quadCount = source->getChunkCount(); if (firstQuad >= quadCount) { assert(!"bad quadric index"); @@ -607,8 +607,8 @@ TStroke *extract(const TStroke *source, UINT firstQuad, UINT lastQuad) { //-------------------------------------------------------------------------------------- -void sample(const TStroke *stroke, int samplingSize, - std::vector &sampledPoint) { +static void sample(const TStroke *stroke, int samplingSize, + std::vector &sampledPoint) { double samplingFrequency = 1.0 / (double)samplingSize; sampledPoint.resize(samplingSize); diff --git a/toonz/sources/common/tvrender/tofflinegl.cpp b/toonz/sources/common/tvrender/tofflinegl.cpp index eaab4d9..000e6df 100644 --- a/toonz/sources/common/tvrender/tofflinegl.cpp +++ b/toonz/sources/common/tvrender/tofflinegl.cpp @@ -485,7 +485,7 @@ Bool ret = glXMakeCurrent(m_dpy, int getLy() const { return m_raster->getLy(); } }; -std::shared_ptr defaultOfflineGLGenerator( +static std::shared_ptr defaultOfflineGLGenerator( const TDimension &dim, std::shared_ptr shared) { return std::make_shared(dim, shared); } diff --git a/toonz/sources/common/tvrender/tsimplecolorstyles.cpp b/toonz/sources/common/tvrender/tsimplecolorstyles.cpp index 42b794c..bbff67c 100644 --- a/toonz/sources/common/tvrender/tsimplecolorstyles.cpp +++ b/toonz/sources/common/tvrender/tsimplecolorstyles.cpp @@ -40,7 +40,7 @@ TFilePath TVectorImagePatternStrokeStyle::m_rootDir = TFilePath(); //----------------------------------------------------------------------------- #ifndef NDEBUG -void checkGlError() { +static void checkGlError() { GLenum err = glGetError(); assert(err != GL_INVALID_ENUM); assert(err != GL_INVALID_VALUE); diff --git a/toonz/sources/common/tvrender/ttessellator.cpp b/toonz/sources/common/tvrender/ttessellator.cpp index eed5285..9dcafa7 100644 --- a/toonz/sources/common/tvrender/ttessellator.cpp +++ b/toonz/sources/common/tvrender/ttessellator.cpp @@ -53,20 +53,23 @@ TglTessellator::GLTess::~GLTess() { gluDeleteTess(m_tess); } namespace { -extern "C" void CALLBACK tessellateTexture(const GLdouble *tex) { +extern "C" { +static void CALLBACK tessellateTexture(const GLdouble *tex) { double u = tex[0] * 0.01; double v = tex[1] * 0.01; glTexCoord2d(u, v); glVertex2dv(tex); } +} //------------------------------------------------------------------- TThread::Mutex CombineDataGuard; -std::list Combine_data; +static std::list Combine_data; -extern "C" void CALLBACK myCombine(GLdouble coords[3], GLdouble *d[4], +extern "C" { +static void CALLBACK myCombine(GLdouble coords[3], GLdouble *d[4], GLfloat w[4], GLdouble **dataOut) { GLdouble *newCoords = new GLdouble[3]; @@ -76,6 +79,7 @@ extern "C" void CALLBACK myCombine(GLdouble coords[3], GLdouble *d[4], Combine_data.push_back(newCoords); *dataOut = newCoords; } +} //=================================================================== diff --git a/toonz/sources/image/pli/pli_io.cpp b/toonz/sources/image/pli/pli_io.cpp index d6f97f8..b8c37a3 100644 --- a/toonz/sources/image/pli/pli_io.cpp +++ b/toonz/sources/image/pli/pli_io.cpp @@ -67,7 +67,7 @@ inline double doubleFromUlong1(TUINT32 hi, TUINT32 lo) { /*=====================================================================*/ -TThickPoint operator*(const TAffine &aff, const TThickPoint &p) { +static TThickPoint operator*(const TAffine &aff, const TThickPoint &p) { TPointD p1(p.x, p.y); return TThickPoint(aff * p1, p.thick); } diff --git a/toonz/sources/image/pli/tiio_pli.cpp b/toonz/sources/image/pli/tiio_pli.cpp index f0f51c7..1650067 100644 --- a/toonz/sources/image/pli/tiio_pli.cpp +++ b/toonz/sources/image/pli/tiio_pli.cpp @@ -277,7 +277,7 @@ TImageP TImageReaderPli::load() { //=========================================================================== -void readRegionVersion4x(IntersectionDataTag *tag, TVectorImage *img) { +static void readRegionVersion4x(IntersectionDataTag *tag, TVectorImage *img) { #ifndef NEW_REGION_FILL img->setFillData(tag->m_branchArray, tag->m_branchCount); #endif @@ -316,7 +316,7 @@ void createStroke(ThickQuadraticChainTag *quadTag, TVectorImage *outVectImage, //----------------------------------------------------------------------------- -void createGroup(GroupTag *groupTag, TVectorImage *vi, CreateStrokeData &data) { +static void createGroup(GroupTag *groupTag, TVectorImage *vi, CreateStrokeData &data) { int count = vi->getStrokeCount(); for (int j = 0; j < groupTag->m_numObjects; j++) { if (groupTag->m_object[j]->m_type == PliTag::COLOR_NGOBJ) @@ -443,8 +443,8 @@ TImageWriterPli::TImageWriterPli(const TFilePath &f, const TFrameId &frameId, //----------------------------------------------------------------------------- -void putStroke(TStroke *stroke, int &currStyleId, - std::vector &tags) { +static void putStroke(TStroke *stroke, int &currStyleId, + std::vector &tags) { double maxThickness = 0; assert(stroke); diff --git a/toonz/sources/image/pli/tiio_pli.h b/toonz/sources/image/pli/tiio_pli.h index 2a35e62..418e791 100644 --- a/toonz/sources/image/pli/tiio_pli.h +++ b/toonz/sources/image/pli/tiio_pli.h @@ -7,6 +7,7 @@ #include "tlevel_io.h" +class GroupTag; class ParsedPli; class ImageTag; class TImageWriterPli; @@ -149,4 +150,9 @@ private: TLevelReaderPli *m_lrp; }; +// Functions + +TPalette *readPalette(GroupTag *paletteTag, int majorVersion, + int minorVersion); + #endif // TTIO_PLI_INCLUDED diff --git a/toonz/sources/image/png/tiio_png.cpp b/toonz/sources/image/png/tiio_png.cpp index f330f8c..f824d5d 100644 --- a/toonz/sources/image/png/tiio_png.cpp +++ b/toonz/sources/image/png/tiio_png.cpp @@ -20,9 +20,9 @@ using namespace std; extern "C" { -void tnz_abort(jmp_buf, int) {} +static void tnz_abort(jmp_buf, int) {} -void tnz_error_fun(png_structp pngPtr, png_const_charp error_message) { +static void tnz_error_fun(png_structp pngPtr, png_const_charp error_message) { *(int *)png_get_error_ptr(pngPtr) = 0; } } diff --git a/toonz/sources/image/sgi/filesgi.cpp b/toonz/sources/image/sgi/filesgi.cpp index 23e23b5..b045eb1 100644 --- a/toonz/sources/image/sgi/filesgi.cpp +++ b/toonz/sources/image/sgi/filesgi.cpp @@ -722,7 +722,7 @@ static TINT32 img_rle_compact(unsigned short *expbuf, int ibpp, /*-----------------------------------------------------------------------------*/ -void iclose(IMAGERGB *image) { +static void iclose(IMAGERGB *image) { TINT32 tablesize; iflush(image); diff --git a/toonz/sources/image/svg/tiio_svg.cpp b/toonz/sources/image/svg/tiio_svg.cpp index 496051d..21a344e 100644 --- a/toonz/sources/image/svg/tiio_svg.cpp +++ b/toonz/sources/image/svg/tiio_svg.cpp @@ -1809,7 +1809,7 @@ TLevelWriterSvg::TLevelWriterSvg(const TFilePath &path, TPropertyGroup *winfo) //----------------------------------------------------------------------------- -void writeRegion(TRegion *r, TPalette *plt, QTextStream &out, double ly) { +static void writeRegion(TRegion *r, TPalette *plt, QTextStream &out, double ly) { if (r->getEdgeCount() == 0) return; std::vector quadsOutline; @@ -1872,8 +1872,8 @@ void writeRegion(TRegion *r, TPalette *plt, QTextStream &out, double ly) { //-------------------------------------------------------------------------------------- -void writeOutlineStroke(TStroke *s, TPalette *plt, QTextStream &out, double ly, - double quality) { +static void writeOutlineStroke(TStroke *s, TPalette *plt, QTextStream &out, double ly, + double quality) { if (s->getChunkCount() == 0) return; if (s->getMaxThickness() == 0) return; @@ -1898,7 +1898,7 @@ void writeOutlineStroke(TStroke *s, TPalette *plt, QTextStream &out, double ly, //---------------------------------------------------------- -double computeAverageThickness(const TStroke *s) { +static double computeAverageThickness(const TStroke *s) { int count = s->getControlPointCount(); double resThick = 0; @@ -1914,8 +1914,8 @@ double computeAverageThickness(const TStroke *s) { //---------------------------------------------------------------- -void writeCenterlineStroke(TStroke *s, TPalette *plt, QTextStream &out, - double ly) { +static void writeCenterlineStroke(TStroke *s, TPalette *plt, QTextStream &out, + double ly) { if (s->getChunkCount() == 0) return; if (s->getMaxThickness() == 0) return; diff --git a/toonz/sources/image/tga/tiio_tga.cpp b/toonz/sources/image/tga/tiio_tga.cpp index d1f2647..371189e 100644 --- a/toonz/sources/image/tga/tiio_tga.cpp +++ b/toonz/sources/image/tga/tiio_tga.cpp @@ -70,7 +70,7 @@ struct TgaHeader { //============================================================ -void readTgaHeader(TgaHeader &header, FILE *chan) { +static void readTgaHeader(TgaHeader &header, FILE *chan) { header.IdentificationField = fgetc(chan); header.ColorMapType = fgetc(chan); header.ImageTypeCode = fgetc(chan); @@ -87,7 +87,7 @@ void readTgaHeader(TgaHeader &header, FILE *chan) { //------------------------------------------------------------ -void writeTgaHeader(TgaHeader &header, FILE *chan) { +static void writeTgaHeader(TgaHeader &header, FILE *chan) { fputc(header.IdentificationField, chan); fputc(header.ColorMapType, chan); fputc(header.ImageTypeCode, chan); diff --git a/toonz/sources/image/tzl/tiio_tzl.cpp b/toonz/sources/image/tzl/tiio_tzl.cpp index 76efb06..f64cfe5 100644 --- a/toonz/sources/image/tzl/tiio_tzl.cpp +++ b/toonz/sources/image/tzl/tiio_tzl.cpp @@ -42,15 +42,15 @@ char *reverse(char *buffer, int size) { } } -int tfwrite(const char *data, const unsigned int count, FILE *f) { +static int tfwrite(const char *data, const unsigned int count, FILE *f) { return fwrite(data, sizeof(char), count, f); } -int tfwrite(UCHAR *data, const unsigned int count, FILE *f) { +static int tfwrite(UCHAR *data, const unsigned int count, FILE *f) { return fwrite(data, sizeof(char), count, f); } -int tfwrite(TINT32 *data, const unsigned int count, FILE *f) { +static int tfwrite(TINT32 *data, const unsigned int count, FILE *f) { if (count == 1) { #if !TNZ_LITTLE_ENDIAN TUINT32 dataToWrite = swapTINT32(*data); @@ -63,7 +63,7 @@ int tfwrite(TINT32 *data, const unsigned int count, FILE *f) { return 0; } -int tfwrite(TUINT32 *data, const unsigned int count, FILE *f) { +static int tfwrite(TUINT32 *data, const unsigned int count, FILE *f) { if (count == 1) { #if !TNZ_LITTLE_ENDIAN TUINT32 dataToWrite = swapTINT32(*data); @@ -76,7 +76,7 @@ int tfwrite(TUINT32 *data, const unsigned int count, FILE *f) { return 0; } -int tfwrite(double *data, unsigned int count, FILE *f) { +static int tfwrite(double *data, unsigned int count, FILE *f) { if (count == 1) { double v = *data; char *ptr = (char *)&v; @@ -286,8 +286,8 @@ bool readHeaderAndOffsets(FILE *chan, TzlOffsetMap &frameOffsTable, } } -bool adjustIconAspectRatio(TDimension &outDimension, TDimension inDimension, - TDimension imageRes) { +static bool adjustIconAspectRatio(TDimension &outDimension, TDimension inDimension, + TDimension imageRes) { TINT32 iconLx = inDimension.lx, iconLy = inDimension.ly; assert(iconLx > 0 && iconLy > 0); assert(imageRes.lx > 0 && imageRes.ly > 0); @@ -305,7 +305,7 @@ bool adjustIconAspectRatio(TDimension &outDimension, TDimension inDimension, return true; } -void getThumbnail(TRasterP ras, int shrink, TRasterP &thumbnail) { +static void getThumbnail(TRasterP ras, int shrink, TRasterP &thumbnail) { int j = 0; int y = 0; TPixel32 *pix2 = (TPixel32 *)thumbnail->getRawData(); @@ -1995,8 +1995,8 @@ TImageP TImageReaderTzl::load13() { } // Restituisce la regione del raster shrinkata e la relativa savebox. -TRect applyShrinkAndRegion(TRasterP &ras, int shrink, TRect region, - TRect savebox) { +static TRect applyShrinkAndRegion(TRasterP &ras, int shrink, TRect region, + TRect savebox) { // estraggo la regione solo se essa ha coordinate valide. if (!region.isEmpty() && region != TRect() && region.getLx() > 0 && region.getLy() > 0) diff --git a/toonz/sources/image/tzp/tiio_plt.cpp b/toonz/sources/image/tzp/tiio_plt.cpp index 49e983e..db0cd36 100644 --- a/toonz/sources/image/tzp/tiio_plt.cpp +++ b/toonz/sources/image/tzp/tiio_plt.cpp @@ -76,8 +76,8 @@ PltReader::~PltReader() { delete m_stripBuffer; } //------------------------------------------------------------ -int decode_group_name(char group_name[], char **name, int *key, - int *sister_index) { +static int decode_group_name(char group_name[], char **name, int *key, + int *sister_index) { char *s, *t; *key = 0; *sister_index = -1; diff --git a/toonz/sources/include/tdoubleparam.h b/toonz/sources/include/tdoubleparam.h index 5fe50e5..f5412ca 100644 --- a/toonz/sources/include/tdoubleparam.h +++ b/toonz/sources/include/tdoubleparam.h @@ -156,6 +156,10 @@ public: std::string getValueAlias(double frame, int precision) override; }; +DV_IMPORT_API void splitSpeedInOutSegment(TDoubleKeyframe &k, + TDoubleKeyframe &k0, + TDoubleKeyframe &k1); + //--------------------------------------------------------- DEFINE_PARAM_SMARTPOINTER(TDoubleParam, double) diff --git a/toonz/sources/include/tspectrum.h b/toonz/sources/include/tspectrum.h index 65063d4..c41c445 100644 --- a/toonz/sources/include/tspectrum.h +++ b/toonz/sources/include/tspectrum.h @@ -172,6 +172,8 @@ updateTable(sampleCount); } }; +DVAPI TSpectrumT convert(const TSpectrumT &s); + #ifdef _WIN32 template class DVAPI TSpectrumT; template class DVAPI TSpectrumT; diff --git a/toonz/sources/sound/aiff/tsio_aiff.cpp b/toonz/sources/sound/aiff/tsio_aiff.cpp index 7122a9c..cdcccf2 100644 --- a/toonz/sources/sound/aiff/tsio_aiff.cpp +++ b/toonz/sources/sound/aiff/tsio_aiff.cpp @@ -5,7 +5,7 @@ #include "tsound_t.h" #include "tsystem.h" #include "tfilepath_io.h" -#include "tfilepath_io.h" +#include "tsioutils.h" #include #define DEFAULT_OFFSET 0 @@ -21,7 +21,6 @@ TNZ_LITTLE_ENDIAN undefined !! using namespace std; -void swapAndCopySamples(short *srcBuffer, short *dstBuffer, TINT32 sampleCount); TUINT32 convertToLong(UCHAR *buffer); void storeFloat(unsigned char *buffer, TUINT32 value); @@ -136,7 +135,7 @@ public: //-------------------------------------------------------------------- -ostream &operator<<(ostream &os, const TCOMMChunk &commChunk) { +static ostream &operator<<(ostream &os, const TCOMMChunk &commChunk) { commChunk.print(os); return os; } @@ -191,7 +190,7 @@ public: //-------------------------------------------------------------------- -ostream &operator<<(ostream &os, const TSSNDChunk &ssndChunk) { +static ostream &operator<<(ostream &os, const TSSNDChunk &ssndChunk) { os << "name = '" << ssndChunk.m_name << endl; os << "length = '" << ssndChunk.m_length << endl; os << "offset = '" << (unsigned int)ssndChunk.m_offset << endl; @@ -208,7 +207,7 @@ ostream &operator<<(ostream &os, const TSSNDChunk &ssndChunk) { //========================================================== -void flipLong(unsigned char *ptrc) { +static void flipLong(unsigned char *ptrc) { unsigned char val; val = *(ptrc); @@ -222,7 +221,7 @@ void flipLong(unsigned char *ptrc) { //-------------------------------------------------------------------- -TUINT32 fetchLong(TUINT32 *ptrl) { return (*ptrl); } +static TUINT32 fetchLong(TUINT32 *ptrl) { return (*ptrl); } //-------------------------------------------------------------------- @@ -249,7 +248,7 @@ TUINT32 convertToLong(UCHAR *buffer) { //-------------------------------------------------------------------- -void storeLong(TUINT32 val, TUINT32 *ptr) { *ptr = val; } +static void storeLong(TUINT32 val, TUINT32 *ptr) { *ptr = val; } //-------------------------------------------------------------------- diff --git a/toonz/sources/sound/tsioutils.cpp b/toonz/sources/sound/tsioutils.cpp index e54f9c3..b7c6b3d 100644 --- a/toonz/sources/sound/tsioutils.cpp +++ b/toonz/sources/sound/tsioutils.cpp @@ -2,6 +2,8 @@ #include "tcommon.h" +#include "tsioutils.h" + //------------------------------------------------------------------------------ void swapAndCopySamples(short *srcBuffer, short *dstBuffer, TINT32 sampleCount) { diff --git a/toonz/sources/sound/tsioutils.h b/toonz/sources/sound/tsioutils.h new file mode 100644 index 0000000..4d5cad1 --- /dev/null +++ b/toonz/sources/sound/tsioutils.h @@ -0,0 +1,9 @@ +#pragma once + +#ifndef TSIOUTILS_INCLUDED +#define TSIOUTILS_INCLUDED + +void swapAndCopySamples(short *srcBuffer, short *dstBuffer, + TINT32 sampleCount); + +#endif diff --git a/toonz/sources/stdfx/backlitfx.cpp b/toonz/sources/stdfx/backlitfx.cpp index 0d15575..cd0c4b7 100644 --- a/toonz/sources/stdfx/backlitfx.cpp +++ b/toonz/sources/stdfx/backlitfx.cpp @@ -11,8 +11,8 @@ //--------------------------------------------------------------------- -void backlit(TRaster32P lighted, TRaster32P light, TRaster32P out, double blur, - const TPixel &color, double fade, double scale) { +static void backlit(TRaster32P lighted, TRaster32P light, TRaster32P out, double blur, + const TPixel &color, double fade, double scale) { assert(light && lighted && out); assert(lighted->getSize() == light->getSize()); @@ -92,8 +92,8 @@ void backlit(TRaster32P lighted, TRaster32P light, TRaster32P out, double blur, //--------------------------------------------------------------------- -void backlit(TRaster64P lighted, TRaster64P light, TRaster64P out, double blur, - const TPixel &color32, double fade, double scale) { +static void backlit(TRaster64P lighted, TRaster64P light, TRaster64P out, double blur, + const TPixel &color32, double fade, double scale) { assert(light && lighted && out); assert(lighted->getSize() == light->getSize()); diff --git a/toonz/sources/stdfx/changecolorfx.cpp b/toonz/sources/stdfx/changecolorfx.cpp index c354f62..2f776b6 100644 --- a/toonz/sources/stdfx/changecolorfx.cpp +++ b/toonz/sources/stdfx/changecolorfx.cpp @@ -135,7 +135,7 @@ public: void doCompute(TTile &tile, double frame, const TRenderSettings &ri) override; }; -double normalize_h(double h) { +static double normalize_h(double h) { if (h < 0) h += 360; if (h > 360) h -= 360; return h; diff --git a/toonz/sources/stdfx/gradients.cpp b/toonz/sources/stdfx/gradients.cpp index f567728..6fea2e4 100644 --- a/toonz/sources/stdfx/gradients.cpp +++ b/toonz/sources/stdfx/gradients.cpp @@ -4,6 +4,9 @@ #include "traster.h" #include "tspectrumparam.h" + +#include "gradients.h" + //------------------------------------------------------------------ namespace { diff --git a/toonz/sources/stdfx/iwa_particlesengine.cpp b/toonz/sources/stdfx/iwa_particlesengine.cpp index a0d771b..0bb91ca 100644 --- a/toonz/sources/stdfx/iwa_particlesengine.cpp +++ b/toonz/sources/stdfx/iwa_particlesengine.cpp @@ -1347,7 +1347,7 @@ void Iwa_Particles_Engine::fill_single_region( まだ出発していない粒子情報を初期化 ----------------------------------------------------------------*/ -bool potentialLessThan(const ParticleOrigin &po1, const ParticleOrigin &po2) { +static bool potentialLessThan(const ParticleOrigin &po1, const ParticleOrigin &po2) { return po1.potential < po2.potential; } diff --git a/toonz/sources/stdfx/motionblurfx.cpp b/toonz/sources/stdfx/motionblurfx.cpp index 606d2df..2d564a0 100644 --- a/toonz/sources/stdfx/motionblurfx.cpp +++ b/toonz/sources/stdfx/motionblurfx.cpp @@ -326,7 +326,7 @@ void directionalBlur(TRasterPT rout, TRasterPT rin, const TPointD &blur, } // namespace -void enlargeDir(TRectD &r, TPointD p, bool bidirectional) { +static void enlargeDir(TRectD &r, TPointD p, bool bidirectional) { if (bidirectional) { r.x1 += fabs(p.x); r.x0 -= fabs(p.x); @@ -345,7 +345,7 @@ void enlargeDir(TRectD &r, TPointD p, bool bidirectional) { } } -void reduceDir(TRectD &r, TPointD p, bool bidirectional) { +static void reduceDir(TRectD &r, TPointD p, bool bidirectional) { if (bidirectional) { r.x1 -= fabs(p.x); r.x0 += fabs(p.x); diff --git a/toonz/sources/stdfx/particlesengine.cpp b/toonz/sources/stdfx/particlesengine.cpp index 79d3986..f13a74b 100644 --- a/toonz/sources/stdfx/particlesengine.cpp +++ b/toonz/sources/stdfx/particlesengine.cpp @@ -33,7 +33,7 @@ Particles_Engine::Particles_Engine(ParticlesFx *parent, double frame) : m_parent(parent), m_frame(frame) {} -void printTime(TStopWatch &sw, std::string name) { +static void printTime(TStopWatch &sw, std::string name) { std::ostrstream ss; ss << name << " : "; sw.print(ss); diff --git a/toonz/sources/stdfx/pins.cpp b/toonz/sources/stdfx/pins.cpp index 788e6d9..518974b 100644 --- a/toonz/sources/stdfx/pins.cpp +++ b/toonz/sources/stdfx/pins.cpp @@ -428,7 +428,7 @@ void subdivision(const TPointD &p00, const TPointD &p10, const TPointD &p11, // ------------------------------------------------------------------------ #define TINY 1.0e-20 -int splitMatrix(double **a, int n, int *index) { +static int splitMatrix(double **a, int n, int *index) { int i, imax = 0, j, k; double big, dum, sum, temp; double *vv, d; @@ -488,8 +488,8 @@ int splitMatrix(double **a, int n, int *index) { /*-----------------------------------------------------------------*/ -void buildMatrixes(const FourPoints &ss, const FourPoints &dd, double **a, - double *b) { +static void buildMatrixes(const FourPoints &ss, const FourPoints &dd, double **a, + double *b) { int i; TPointD s[4], d[4]; @@ -515,7 +515,7 @@ void buildMatrixes(const FourPoints &ss, const FourPoints &dd, double **a, /*-----------------------------------------------------------------*/ -void computeSolutions(double **a, int *index, double *b) { +static void computeSolutions(double **a, int *index, double *b) { int i, ii = 0, ip, j; double sum; @@ -538,7 +538,7 @@ void computeSolutions(double **a, int *index, double *b) { /*-----------------------------------------------------------------*/ -void solveSystems(double **a, double *bx) { +static void solveSystems(double **a, double *bx) { int index[255], i, count = 0, bad_line; double **atmp; int n = 8; @@ -568,8 +568,8 @@ void solveSystems(double **a, double *bx) { /*-----------------------------------------------------------------*/ -void computeTransformation(const FourPoints &s, const FourPoints &d, - TAffine &aff, TPointD &perspectDen) { +static void computeTransformation(const FourPoints &s, const FourPoints &d, + TAffine &aff, TPointD &perspectDen) { double **a, *b; int i; diff --git a/toonz/sources/stdfx/stdfx.cpp b/toonz/sources/stdfx/stdfx.cpp index 603b9ee..e78f0cc 100644 --- a/toonz/sources/stdfx/stdfx.cpp +++ b/toonz/sources/stdfx/stdfx.cpp @@ -687,4 +687,7 @@ return &info; */ +/* TODO, move to header */ +DV_EXPORT_API void initStdFx(); + DV_EXPORT_API void initStdFx() {} diff --git a/toonz/sources/stdfx/stdfx.h b/toonz/sources/stdfx/stdfx.h index 1518c22..bd0cb0a 100644 --- a/toonz/sources/stdfx/stdfx.h +++ b/toonz/sources/stdfx/stdfx.h @@ -61,4 +61,6 @@ public: bool isAlmostIsotropic(const TAffine &aff); +DV_EXPORT_API void initStdFx(); + #endif diff --git a/toonz/sources/tcleanupper/tcleanupper.cpp b/toonz/sources/tcleanupper/tcleanupper.cpp index 816d591..e133730 100644 --- a/toonz/sources/tcleanupper/tcleanupper.cpp +++ b/toonz/sources/tcleanupper/tcleanupper.cpp @@ -195,7 +195,7 @@ TFilePath setToonzFolder(const TFilePath &filename, std::string toonzVar) { //============================================================================================== -void prepareToCleanup(TXshSimpleLevel *xl, TPalette *cleanupPalette) { +static void prepareToCleanup(TXshSimpleLevel *xl, TPalette *cleanupPalette) { assert(xl->getScene()); if (xl->getProperties()->getSubsampling() != 1) { xl->getProperties()->setSubsampling(1); @@ -241,7 +241,7 @@ string TaskId; // //------------------------------------------------------------------------ -void searchLevelsToCleanup( +static void searchLevelsToCleanup( std::vector>> &levels, TXsheet *xsh, bool selectedOnly) { std::map levelTable; @@ -308,7 +308,7 @@ void searchLevelsToCleanup( //------------------------------------------------------------------------------ /*- CleanupDefaultパレットを追加する -*/ -void addCleanupDefaultPalette(TXshSimpleLevel *sl) { +static void addCleanupDefaultPalette(TXshSimpleLevel *sl) { /*- 元となるパレットはStudioPaletteフォルダに置く -*/ TFilePath palettePath = ToonzFolder::getStudioPaletteFolder() + "cleanup_default.tpl"; @@ -384,9 +384,9 @@ void addCleanupDefaultPalette(TXshSimpleLevel *sl) { // //------------------------------------------------------------------------ -void cleanupLevel(TXshSimpleLevel *xl, std::set fidsInXsheet, - ToonzScene *scene, bool overwrite, - TUserLogAppend &m_userLog) { +static void cleanupLevel(TXshSimpleLevel *xl, std::set fidsInXsheet, + ToonzScene *scene, bool overwrite, + TUserLogAppend &m_userLog) { prepareToCleanup(xl, scene->getProperties() ->getCleanupParameters() ->m_cleanupPalette.getPointer()); @@ -847,4 +847,4 @@ namespace { const char *toonzVersion = "Toonz 7.1"; } // namespace -string getToonzVersion() { return toonzVersion; } +static string getToonzVersion() { return toonzVersion; } diff --git a/toonz/sources/tcomposer/tcomposer.cpp b/toonz/sources/tcomposer/tcomposer.cpp index a3d06df..676857a 100644 --- a/toonz/sources/tcomposer/tcomposer.cpp +++ b/toonz/sources/tcomposer/tcomposer.cpp @@ -394,9 +394,9 @@ bool MyMultimediaRenderListener::onFrameFailed(int frame, int column, //================================================================================== -std::pair generateMovie(ToonzScene *scene, const TFilePath &fp, - int r0, int r1, int step, int shrink, - int threadCount, int maxTileSize) { +static std::pair generateMovie(ToonzScene *scene, const TFilePath &fp, + int r0, int r1, int step, int shrink, + int threadCount, int maxTileSize) { QWaitCondition renderCompleted; // riporto gli indici a base zero diff --git a/toonz/sources/tnzbase/tscanner/tscannerepson.cpp b/toonz/sources/tnzbase/tscanner/tscannerepson.cpp index 7b27402..2cc40ee 100644 --- a/toonz/sources/tnzbase/tscanner/tscannerepson.cpp +++ b/toonz/sources/tnzbase/tscanner/tscannerepson.cpp @@ -18,8 +18,8 @@ using namespace TScannerUtil; -void sense(bool) {} -int scsi_maxlen() { +static void sense(bool) {} +static int scsi_maxlen() { assert(0); return 0; } diff --git a/toonz/sources/tnzbase/tscanner/tscannertwain.cpp b/toonz/sources/tnzbase/tscanner/tscannertwain.cpp index 979d5e5..e907117 100644 --- a/toonz/sources/tnzbase/tscanner/tscannertwain.cpp +++ b/toonz/sources/tnzbase/tscanner/tscannertwain.cpp @@ -9,15 +9,17 @@ using namespace TScannerUtil; extern "C" { #include "../common/twain/ttwain_util.h" +#include "../common/twain/ttwain_global_def.h" /* forward declare functions */ } /* callback used to handle TTWAIN done/error status*/ -void throwIT(const char *msg) { throw TException(msg); } +static void throwIT(const char *msg) { throw TException(msg); } extern "C" void TTWAIN_ErrorBox(const char *msg) { throwIT(msg); } -extern "C" int onDoneCB(UCHAR *buffer, TTWAIN_PIXTYPE pixelType, int lx, int ly, +extern "C" { +static int onDoneCB(UCHAR *buffer, TTWAIN_PIXTYPE pixelType, int lx, int ly, int wrap, float xdpi, float ydpi, void *usrData) { TRasterP ras; switch (pixelType) { @@ -69,13 +71,16 @@ extern "C" int onDoneCB(UCHAR *buffer, TTWAIN_PIXTYPE pixelType, int lx, int ly, scannerDevice->decrementPaperLeftCount(); return scannerDevice->getPaperLeftCount(); } +} //----------------------------------------------------------------------------- -extern "C" void onErrorCB(void *usrData, void *alwaysZero) { +extern "C" { +static void onErrorCB(void *usrData, void *alwaysZero) { TScanner *scannerDevice = reinterpret_cast(usrData); scannerDevice->notifyError(); } +} //----------------------------------------------------------------------------- @@ -218,7 +223,7 @@ param.m_version = string(TTWAIN_GetVersion()); //----------------------------------------------------------------------------- -void setupParameters(const TScannerParameters ¶ms, bool isAreaSupported) { +static void setupParameters(const TScannerParameters ¶ms, bool isAreaSupported) { if (isAreaSupported) { TRectD scanArea = params.getScanArea(); float L = (float)(scanArea.getP00().x / 25.4); @@ -259,7 +264,7 @@ void setupParameters(const TScannerParameters ¶ms, bool isAreaSupported) { } //----------------------------------------------------------------------------- -void openAndSetupTwain() { +static void openAndSetupTwain() { int rc = TTWAIN_OpenDefaultSource(); if (rc) { TTWAIN_SetTwainUsage(TTWAIN_MODE_UNLEASHED); diff --git a/toonz/sources/tnzext/tlin/tlin_cblas_wrap.cpp b/toonz/sources/tnzext/tlin/tlin_cblas_wrap.cpp index 8e104f8..885d122 100644 --- a/toonz/sources/tnzext/tlin/tlin_cblas_wrap.cpp +++ b/toonz/sources/tnzext/tlin/tlin_cblas_wrap.cpp @@ -55,7 +55,7 @@ extern "C" { //======================================================================================== -void sum(int n, const double *x, double *&y) { +static void sum(int n, const double *x, double *&y) { /* void cblas_daxpy(blasint n, double a, double *x, blasint incx, double *y, blasint incy); diff --git a/toonz/sources/tnztools/brushtool.cpp b/toonz/sources/tnztools/brushtool.cpp index 6cf93b9..3272da2 100644 --- a/toonz/sources/tnztools/brushtool.cpp +++ b/toonz/sources/tnztools/brushtool.cpp @@ -89,8 +89,8 @@ TEnv::DoubleVar RasterBrushHardness("RasterBrushHardness", 100); // note: stroke is unchanged // -void split(TStroke *stroke, const std::vector ¶meterValues, - std::vector &strokes) { +static void split(TStroke *stroke, const std::vector ¶meterValues, + std::vector &strokes) { TThickPoint p2; std::vector points; TThickPoint lastPoint = stroke->getControlPoint(0); @@ -199,7 +199,7 @@ void split(TStroke *stroke, const std::vector ¶meterValues, // Note: if the curve is a single point (that's dp=0) or it is a straight // line (that's ddp=0) return 0 -double curvature(TPointD dp, TPointD ddp) { +static double curvature(TPointD dp, TPointD ddp) { if (dp == TPointD(0, 0)) return 0; else @@ -217,9 +217,9 @@ double curvature(TPointD dp, TPointD ddp) { // Output: // parameterValues = vector of max curvature parameter points -void findMaxCurvPoints(TStroke *stroke, const float &angoloLim, - const float &curvMaxLim, - std::vector ¶meterValues) { +static void findMaxCurvPoints(TStroke *stroke, const float &angoloLim, + const float &curvMaxLim, + std::vector ¶meterValues) { TPointD tg1, tg2; // Tangent vectors TPointD dp, ddp; // First and Second derivate. @@ -320,9 +320,9 @@ void findMaxCurvPoints(TStroke *stroke, const float &angoloLim, } } -void addStroke(TTool::Application *application, const TVectorImageP &vi, - TStroke *stroke, bool breakAngles, bool frameCreated, - bool levelCreated) { +static void addStroke(TTool::Application *application, const TVectorImageP &vi, + TStroke *stroke, bool breakAngles, bool frameCreated, + bool levelCreated) { QMutexLocker lock(vi->getMutex()); if (application->getCurrentObject()->isSpline()) { diff --git a/toonz/sources/tnztools/geometrictool.cpp b/toonz/sources/tnztools/geometrictool.cpp index bf6c80f..3014d02 100644 --- a/toonz/sources/tnztools/geometrictool.cpp +++ b/toonz/sources/tnztools/geometrictool.cpp @@ -65,7 +65,7 @@ TEnv::IntVar GeometricMiterValue("InknpaintGeometricMiterValue", 4); // Utility Functions //----------------------------------------------------------------------------- -TPointD rectify(const TPointD &oldPos, const TPointD &pos) { +static TPointD rectify(const TPointD &oldPos, const TPointD &pos) { const double h = sqrt(2.0) / 2.0; const TPointD directions[] = {TPointD(1, 0), TPointD(h, h), TPointD(0, 1), TPointD(-h, h), TPointD(-1, 0), TPointD(-h, -h), @@ -85,15 +85,15 @@ TPointD rectify(const TPointD &oldPos, const TPointD &pos) { //----------------------------------------------------------------------------- -TPointD computeSpeed(TPointD p0, TPointD p1, double factor) { +static TPointD computeSpeed(TPointD p0, TPointD p1, double factor) { TPointD d = p1 - p0; return (d == TPointD()) ? TPointD() : d * (factor / norm(d)); } //----------------------------------------------------------------------------- -TRect drawBluredBrush(const TRasterImageP &ri, TStroke *stroke, int thick, - double hardness, double opacity) { +static TRect drawBluredBrush(const TRasterImageP &ri, TStroke *stroke, int thick, + double hardness, double opacity) { TStroke *s = new TStroke(*stroke); TPointD riCenter = ri->getRaster()->getCenterD(); s->transform(TTranslation(riCenter)); @@ -135,8 +135,8 @@ TRect drawBluredBrush(const TRasterImageP &ri, TStroke *stroke, int thick, //----------------------------------------------------------------------------- -TRect drawBluredBrush(const TToonzImageP &ti, TStroke *stroke, int thick, - double hardness, bool selective) { +static TRect drawBluredBrush(const TToonzImageP &ti, TStroke *stroke, int thick, + double hardness, bool selective) { TStroke *s = new TStroke(*stroke); TPointD riCenter = ti->getRaster()->getCenterD(); s->transform(TTranslation(riCenter)); diff --git a/toonz/sources/tnztools/imagegrouping.cpp b/toonz/sources/tnztools/imagegrouping.cpp index 9176a2c..5020392 100644 --- a/toonz/sources/tnztools/imagegrouping.cpp +++ b/toonz/sources/tnztools/imagegrouping.cpp @@ -616,9 +616,9 @@ refStroke, count, refStroke+count)>commonDepth(vimg, refStroke, count, prev)) if(count==0) return; */ -int doMoveGroup(UCHAR moveType, TVectorImage *vimg, - const std::vector> &selectedGroups, - int index) { +static int doMoveGroup(UCHAR moveType, TVectorImage *vimg, + const std::vector> &selectedGroups, + int index) { int refStroke = vimg->getStrokeIndex(selectedGroups[index].first); int count = selectedGroups[index].second; diff --git a/toonz/sources/tnztools/plastictool.cpp b/toonz/sources/tnztools/plastictool.cpp index 3822f05..8bffbe0 100644 --- a/toonz/sources/tnztools/plastictool.cpp +++ b/toonz/sources/tnztools/plastictool.cpp @@ -1682,7 +1682,7 @@ void drawFullSquare(const TPointD &pos, double radius) { //------------------------------------------------------------------------ -void drawFilledSquare(const TPointD &pos, double radius) { +static void drawFilledSquare(const TPointD &pos, double radius) { glBegin(GL_QUADS); glVertex2d(pos.x - radius, pos.y - radius); glVertex2d(pos.x + radius, pos.y - radius); @@ -1693,7 +1693,7 @@ void drawFilledSquare(const TPointD &pos, double radius) { //------------------------------------------------------------------------ -void drawHandle(const TPointD &pos, double radius, const TPixel32 &color) { +static void drawHandle(const TPointD &pos, double radius, const TPixel32 &color) { glColor4ub(0, 0, 0, color.m); // Black border glLineWidth(4.0f); drawSquare(pos, radius); @@ -1705,8 +1705,8 @@ void drawHandle(const TPointD &pos, double radius, const TPixel32 &color) { //------------------------------------------------------------------------ -void drawFilledHandle(const TPointD &pos, double radius, double pixelSize, - const TPixel32 &color) { +static void drawFilledHandle(const TPointD &pos, double radius, double pixelSize, + const TPixel32 &color) { glColor4ub(0, 0, 0, color.m); drawFilledSquare(pos, radius + pixelSize); @@ -1716,7 +1716,7 @@ void drawFilledHandle(const TPointD &pos, double radius, double pixelSize, //------------------------------------------------------------------------ -void drawText(const TPointD &pos, const QString &text, double fontScale) { +static void drawText(const TPointD &pos, const QString &text, double fontScale) { // Get the world-to-window affine double matrix[16]; diff --git a/toonz/sources/tnztools/plastictool_meshedit.cpp b/toonz/sources/tnztools/plastictool_meshedit.cpp index f523131..52752cc 100644 --- a/toonz/sources/tnztools/plastictool_meshedit.cpp +++ b/toonz/sources/tnztools/plastictool_meshedit.cpp @@ -155,8 +155,8 @@ struct Closer { //============================================================================== -std::pair closestVertex(const TTextureMesh &mesh, - const TPointD &pos) { +static std::pair closestVertex(const TTextureMesh &mesh, + const TPointD &pos) { Closer closer = {mesh, pos}; int vIdx = int( std::min_element(mesh.vertices().begin(), mesh.vertices().end(), closer) @@ -167,8 +167,8 @@ std::pair closestVertex(const TTextureMesh &mesh, //------------------------------------------------------------------------ -std::pair closestEdge(const TTextureMesh &mesh, - const TPointD &pos) { +static std::pair closestEdge(const TTextureMesh &mesh, + const TPointD &pos) { Closer closer = {mesh, pos}; int eIdx = int(std::min_element(mesh.edges().begin(), mesh.edges().end(), closer) diff --git a/toonz/sources/tnztools/skeletontool.cpp b/toonz/sources/tnztools/skeletontool.cpp index 0ce0e13..6f3620c 100644 --- a/toonz/sources/tnztools/skeletontool.cpp +++ b/toonz/sources/tnztools/skeletontool.cpp @@ -80,7 +80,7 @@ inline std::string removeTrailingH(std::string handle) { // return true iff column ancestorIndex is column descentIndex or its parent or // the parent of the parent, etc. -bool isAncestorOf(int ancestorIndex, int descendentIndex) { +static bool isAncestorOf(int ancestorIndex, int descendentIndex) { TStageObjectId ancestorId = TStageObjectId::ColumnId(ancestorIndex); TStageObjectId descendentId = TStageObjectId::ColumnId(descendentIndex); TXsheet *xsh = TTool::getApplication()->getCurrentXsheet()->getXsheet(); @@ -91,8 +91,8 @@ bool isAncestorOf(int ancestorIndex, int descendentIndex) { //------------------------------------------------------------ -void getHooks(std::vector &hooks, TXsheet *xsh, int row, int col, - TPointD dpiScale) { +static void getHooks(std::vector &hooks, TXsheet *xsh, int row, int col, + TPointD dpiScale) { // nota. hook position is in the coordinate system of the parent object. // a inch is Stage::inch @@ -138,8 +138,8 @@ void getHooks(std::vector &hooks, TXsheet *xsh, int row, int col, //------------------------------------------------------------------- -void getConnectedColumns(std::set &connectedColumns, TXsheet *xsh, - int col) { +static void getConnectedColumns(std::set &connectedColumns, TXsheet *xsh, + int col) { TStageObjectId id; // insert col and all column ancestors id = TStageObjectId::ColumnId(col); @@ -165,7 +165,7 @@ void getConnectedColumns(std::set &connectedColumns, TXsheet *xsh, } } -bool canShowBone(Skeleton::Bone *bone, TXsheet *xsh, int row) { +static bool canShowBone(Skeleton::Bone *bone, TXsheet *xsh, int row) { TStageObjectId id = bone->getStageObject()->getId(); if (!xsh->getCell(row, id.getIndex()).isEmpty() && xsh->getColumn(id.getIndex())->isCamstandVisible()) diff --git a/toonz/sources/tnztools/toolhandle.cpp b/toonz/sources/tnztools/toolhandle.cpp index 15ae313..1143db9 100644 --- a/toonz/sources/tnztools/toolhandle.cpp +++ b/toonz/sources/tnztools/toolhandle.cpp @@ -103,7 +103,7 @@ void ToolHandle::setToolBusy(bool value) { QIcon currentIcon; -QIcon getCurrentIcon() { return currentIcon; } +static QIcon getCurrentIcon() { return currentIcon; } //----------------------------------------------------------------------------- diff --git a/toonz/sources/tnztools/trackertool.cpp b/toonz/sources/tnztools/trackertool.cpp index 7813b24..33d8202 100644 --- a/toonz/sources/tnztools/trackertool.cpp +++ b/toonz/sources/tnztools/trackertool.cpp @@ -849,7 +849,7 @@ void TrackerTool::onDeactivate() { //============================================================================= -TTool *getTrackerToolTool() { return &trackerTool; } +static TTool *getTrackerToolTool() { return &trackerTool; } //============================================================================= diff --git a/toonz/sources/tnztools/typetool.cpp b/toonz/sources/tnztools/typetool.cpp index 8aa6701..23229fa 100644 --- a/toonz/sources/tnztools/typetool.cpp +++ b/toonz/sources/tnztools/typetool.cpp @@ -1645,7 +1645,7 @@ void TypeTool::onImageChanged() { stopEditing(); } //========================================================= -TTool *getTypeTool() { return &typeTool; } +static TTool *getTypeTool() { return &typeTool; } /*void resetTypetTool(TTool*tool) { diff --git a/toonz/sources/toonzlib/doubleparamcmd.cpp b/toonz/sources/toonzlib/doubleparamcmd.cpp index 90016cc..2fa15db 100644 --- a/toonz/sources/toonzlib/doubleparamcmd.cpp +++ b/toonz/sources/toonzlib/doubleparamcmd.cpp @@ -9,10 +9,6 @@ #include #include -DV_IMPORT_API void splitSpeedInOutSegment(TDoubleKeyframe &k, - TDoubleKeyframe &k0, - TDoubleKeyframe &k1); - //============================================================================= // // Keyframes Undo diff --git a/toonz/sources/toonzlib/sandor_fxs/calligraph.cpp b/toonz/sources/toonzlib/sandor_fxs/calligraph.cpp index dd21f04..065b442 100644 --- a/toonz/sources/toonzlib/sandor_fxs/calligraph.cpp +++ b/toonz/sources/toonzlib/sandor_fxs/calligraph.cpp @@ -24,6 +24,7 @@ #include "SDef.h" #include "CallCircle.h" #include "CallParam.h" +#include "calligraph.h" //#include "tmsg.h" using namespace std; diff --git a/toonz/sources/toonzlib/tcolumnfx.cpp b/toonz/sources/toonzlib/tcolumnfx.cpp index f9597c8..e9a7452 100644 --- a/toonz/sources/toonzlib/tcolumnfx.cpp +++ b/toonz/sources/toonzlib/tcolumnfx.cpp @@ -38,6 +38,7 @@ #include "toonz/levelset.h" #include "toonz/txshchildlevel.h" #include "toonz/fxdag.h" +#include "toonz/tcolumnfx.h" #include "toonz/tcolumnfxset.h" #include "toonz/stage.h" #include "toonz/fill.h"