diff --git a/toonz/sources/common/tcore/tstopwatch.cpp b/toonz/sources/common/tcore/tstopwatch.cpp index 5a993a8..1ba9560 100644 --- a/toonz/sources/common/tcore/tstopwatch.cpp +++ b/toonz/sources/common/tcore/tstopwatch.cpp @@ -369,7 +369,7 @@ void TStopWatch::printGlobals() { printGlobals(cout); } //----------------------------------------------------------- #ifdef _WIN32 -void dummyFunction() { +static void dummyFunction() { // It's used just to calculate the overhead return; } diff --git a/toonz/sources/common/tiio/compatibility/tfile_io.c b/toonz/sources/common/tiio/compatibility/tfile_io.c index 20ca6b8..8fabd3b 100644 --- a/toonz/sources/common/tiio/compatibility/tfile_io.c +++ b/toonz/sources/common/tiio/compatibility/tfile_io.c @@ -7,7 +7,7 @@ #include #include -LPSTR AtlW2AHelper(LPSTR lpa, LPCWSTR lpw, int nChars, UINT acp) { +static LPSTR AtlW2AHelper(LPSTR lpa, LPCWSTR lpw, int nChars, UINT acp) { assert(lpw != NULL); assert(lpa != NULL); /* diff --git a/toonz/sources/common/tmeshimage/tmeshimage.cpp b/toonz/sources/common/tmeshimage/tmeshimage.cpp index a5cd662..e82e830 100644 --- a/toonz/sources/common/tmeshimage/tmeshimage.cpp +++ b/toonz/sources/common/tmeshimage/tmeshimage.cpp @@ -15,12 +15,6 @@ // Explicit instantiations //****************************************************************************** -template class DV_EXPORT_API tcg::Vertex; -template class DV_EXPORT_API - tcg::Mesh>; -template class DV_EXPORT_API - tcg::TriMesh>; - typedef tcg::TriMesh> TriMesh_base; //****************************************************************************** diff --git a/toonz/sources/common/trop/trop_borders.cpp b/toonz/sources/common/trop/trop_borders.cpp index c98415a..ac39021 100644 --- a/toonz/sources/common/trop/trop_borders.cpp +++ b/toonz/sources/common/trop/trop_borders.cpp @@ -54,6 +54,25 @@ public: namespace TRop { namespace borders { +//-------------------------------------------------------------------------------- + +// Standard type instantiations + +template void DVAPI readMeshes( + const TRasterPT &raster, ImageMeshesReaderT &reader); +template void DVAPI readMeshes( + const TRasterPT &raster, ImageMeshesReaderT &reader); +template void DVAPI readMeshes( + const TRasterPT &raster, ImageMeshesReaderT &reader); +template void DVAPI readMeshes( + const TRasterPT &raster, + ImageMeshesReaderT &reader); +template void DVAPI readMeshes( + const TRasterPT &raster, + ImageMeshesReaderT &reader); + +//-------------------------------------------------------------------------------- + template void readBorders_simple(const TRasterPT &raster, BordersReader &reader, bool onlyCorners) { @@ -305,27 +324,5 @@ void readMeshes(const TRasterPT &raster, ImageMeshesReaderT &reader) { raster->unlock(); } -//-------------------------------------------------------------- - -// Standard type instantiations - -template DV_EXPORT_API class RasterEdgeIterator>; -template DV_EXPORT_API class RasterEdgeIterator>; -template DV_EXPORT_API class RasterEdgeIterator>; -template DV_EXPORT_API class RasterEdgeIterator>; -template DV_EXPORT_API class RasterEdgeIterator>; - -template DV_EXPORT_API void readMeshes( - const TRasterPT &raster, ImageMeshesReaderT &reader); -template DV_EXPORT_API void readMeshes( - const TRasterPT &raster, ImageMeshesReaderT &reader); -template DV_EXPORT_API void readMeshes( - const TRasterPT &raster, ImageMeshesReaderT &reader); -template DV_EXPORT_API void readMeshes( - const TRasterPT &raster, - ImageMeshesReaderT &reader); -template DV_EXPORT_API void readMeshes( - const TRasterPT &raster, - ImageMeshesReaderT &reader); } } // namespace TRop::borders diff --git a/toonz/sources/common/tsound/tsound_nt.cpp b/toonz/sources/common/tsound/tsound_nt.cpp index b36552c..94a18e3 100644 --- a/toonz/sources/common/tsound/tsound_nt.cpp +++ b/toonz/sources/common/tsound/tsound_nt.cpp @@ -62,11 +62,13 @@ private: }; #endif -int makeDWORD(const short lo, const short hi) { +/* +static int makeDWORD(const short lo, const short hi) { int dw = hi << 16; dw |= lo; return dw; } +*/ //============================================================================== class WavehdrQueue; @@ -136,7 +138,7 @@ private: //============================================================================== -WAVEHDR *prepareWaveHeader(HWAVEOUT wout, const TSoundTrackP &subTrack, +static WAVEHDR *prepareWaveHeader(HWAVEOUT wout, const TSoundTrackP &subTrack, ULONG &count) { WAVEHDR *whdr = new WAVEHDR; memset(whdr, 0, sizeof(WAVEHDR)); diff --git a/toonz/sources/common/tstream/tstream.cpp b/toonz/sources/common/tstream/tstream.cpp index 7540dad..c4d3bc2 100644 --- a/toonz/sources/common/tstream/tstream.cpp +++ b/toonz/sources/common/tstream/tstream.cpp @@ -15,7 +15,6 @@ #include #include -#include using namespace std; diff --git a/toonz/sources/common/tvectorimage/tstroke.cpp b/toonz/sources/common/tvectorimage/tstroke.cpp index 951f894..c53e36b 100644 --- a/toonz/sources/common/tvectorimage/tstroke.cpp +++ b/toonz/sources/common/tvectorimage/tstroke.cpp @@ -389,15 +389,14 @@ if (maxRow <=0 ) maxRow = MAX_ROW; typename T::const_iterator cit; cit = c.begin(); -ostrstream oss1; +stringstream oss1; oss1<<'['< defaultOfflineGLGenerator( +static std::shared_ptr defaultOfflineGLGenerator( const TDimension &dim, std::shared_ptr shared) { return std::make_shared(dim, shared); } @@ -710,13 +710,13 @@ TNZ_MACHINE_CHANNEL_ORDER_MRGB GLenum fmt = TGL_FMT; /* -#ifdef TNZ_MACHINE_CHANNEL_ORDER_BGRM +#if defined(TNZ_MACHINE_CHANNEL_ORDER_BGRM) GL_BGRA_EXT; -#elif TNZ_MACHINE_CHANNEL_ORDER_MBGR +#elif defined(TNZ_MACHINE_CHANNEL_ORDER_MBGR) GL_ABGR_EXT; -#elif TNZ_MACHINE_CHANNEL_ORDER_RGBM +#elif defined(TNZ_MACHINE_CHANNEL_ORDER_RGBM) GL_RGBA; -#elif TNZ_MACHINE_CHANNEL_ORDER_MRGB +#elif defined(TNZ_MACHINE_CHANNEL_ORDER_MRGB) #warning "to do" GL_ABGR_EXT; #else diff --git a/toonz/sources/common/twain/ttwain_state.c b/toonz/sources/common/twain/ttwain_state.c index a9c7984..5a8b907 100644 --- a/toonz/sources/common/twain/ttwain_state.c +++ b/toonz/sources/common/twain/ttwain_state.c @@ -676,9 +676,9 @@ static BOOL CALLBACK myHackEnumFunction2(HWND hwnd, LPARAM lParam) { /*---------------------------------------------------------------------------*/ -void bringToTop(HWND hwnd) { BringWindowToTop(hwnd); } +static void bringToTop(HWND hwnd) { BringWindowToTop(hwnd); } -void putToBottom(HWND hwnd) { +static void putToBottom(HWND hwnd) { const int unused = 0; BOOL rc = SetWindowPos(hwnd, // handle to window diff --git a/toonz/sources/common/twain/ttwain_win.c b/toonz/sources/common/twain/ttwain_win.c index 498a955..ec59606 100644 --- a/toonz/sources/common/twain/ttwain_win.c +++ b/toonz/sources/common/twain/ttwain_win.c @@ -13,9 +13,9 @@ int TTWAIN_EnableWindow(void *hwnd, int flag) { return TTWAIN_EnableWindowPD(hwnd, flag); } -void TTWAIN_EmptyMessageQueue(void) { TTWAIN_EmptyMessageQueuePD(); } +//static void TTWAIN_EmptyMessageQueue(void) { TTWAIN_EmptyMessageQueuePD(); } -void TTWAIN_ModalEventLoop(void) { TTWAIN_ModalEventLoopPD(); } +//static void TTWAIN_ModalEventLoop(void) { TTWAIN_ModalEventLoopPD(); } #ifdef __cplusplus } diff --git a/toonz/sources/image/compatibility/tfile_io.c b/toonz/sources/image/compatibility/tfile_io.c index 20ca6b8..8fabd3b 100644 --- a/toonz/sources/image/compatibility/tfile_io.c +++ b/toonz/sources/image/compatibility/tfile_io.c @@ -7,7 +7,7 @@ #include #include -LPSTR AtlW2AHelper(LPSTR lpa, LPCWSTR lpw, int nChars, UINT acp) { +static LPSTR AtlW2AHelper(LPSTR lpa, LPCWSTR lpw, int nChars, UINT acp) { assert(lpw != NULL); assert(lpa != NULL); /* diff --git a/toonz/sources/include/ext/plasticskeleton.h b/toonz/sources/include/ext/plasticskeleton.h index a7a339f..2e95de8 100644 --- a/toonz/sources/include/ext/plasticskeleton.h +++ b/toonz/sources/include/ext/plasticskeleton.h @@ -8,6 +8,8 @@ // TnzCore includes #include "tsmartpointer.h" #include "tpersist.h" +#include "tmeshimage.h" // add imported template + // instance tcg::Vertex (for Windows dll) // TnzExt includes #include "plastichandle.h" diff --git a/toonz/sources/include/tdoubleparam.h b/toonz/sources/include/tdoubleparam.h index f5412ca..70a637e 100644 --- a/toonz/sources/include/tdoubleparam.h +++ b/toonz/sources/include/tdoubleparam.h @@ -156,9 +156,9 @@ public: std::string getValueAlias(double frame, int precision) override; }; -DV_IMPORT_API void splitSpeedInOutSegment(TDoubleKeyframe &k, - TDoubleKeyframe &k0, - TDoubleKeyframe &k1); +DVAPI void splitSpeedInOutSegment(TDoubleKeyframe &k, + TDoubleKeyframe &k0, + TDoubleKeyframe &k1); //--------------------------------------------------------- diff --git a/toonz/sources/include/tfx.h b/toonz/sources/include/tfx.h index 02ea1f2..734613f 100644 --- a/toonz/sources/include/tfx.h +++ b/toonz/sources/include/tfx.h @@ -210,16 +210,16 @@ public: double m_end; }; -inline DVAPI TFxTimeRegion operator+(const TFxTimeRegion &tr1, - const TFxTimeRegion &tr2) { +inline TFxTimeRegion operator+(const TFxTimeRegion &tr1, + const TFxTimeRegion &tr2) { return TFxTimeRegion(tr1) += tr2; } -inline DVAPI TFxTimeRegion operator+(const TFxTimeRegion &tr1, double shift) { +inline TFxTimeRegion operator+(const TFxTimeRegion &tr1, double shift) { return TFxTimeRegion(tr1) += shift; } -inline DVAPI TFxTimeRegion operator-(const TFxTimeRegion &tr1, double shift) { +inline TFxTimeRegion operator-(const TFxTimeRegion &tr1, double shift) { return TFxTimeRegion(tr1) -= shift; } diff --git a/toonz/sources/include/tgl.h b/toonz/sources/include/tgl.h index fa2cdcb..6708e5b 100644 --- a/toonz/sources/include/tgl.h +++ b/toonz/sources/include/tgl.h @@ -151,9 +151,9 @@ inline void tglDrawSegment(double x0, double y0, double x1, double y1) { */ DVAPI void tglDrawRect(const TRectD &rect); -inline void DVAPI tglDrawRect(const TRect &rect) { tglDrawRect(convert(rect)); } +inline void tglDrawRect(const TRect &rect) { tglDrawRect(convert(rect)); } -inline void DVAPI tglDrawRect(double x0, double y0, double x1, double y1) { +inline void tglDrawRect(double x0, double y0, double x1, double y1) { tglDrawRect(TRectD(x0, y0, x1, y1)); } @@ -162,9 +162,9 @@ inline void DVAPI tglDrawRect(double x0, double y0, double x1, double y1) { */ DVAPI void tglFillRect(const TRectD &rect); -inline void DVAPI tglFillRect(const TRect &rect) { tglFillRect(convert(rect)); } +inline void tglFillRect(const TRect &rect) { tglFillRect(convert(rect)); } -inline void DVAPI tglFillRect(double x0, double y0, double x1, double y1) { +inline void tglFillRect(double x0, double y0, double x1, double y1) { tglFillRect(TRectD(x0, y0, x1, y1)); } diff --git a/toonz/sources/include/tmeshimage.h b/toonz/sources/include/tmeshimage.h index ff4775c..edba325 100644 --- a/toonz/sources/include/tmeshimage.h +++ b/toonz/sources/include/tmeshimage.h @@ -91,10 +91,6 @@ public: } }; -//----------------------------------------------------------------------------- - -typedef tcg::Vertex TTextureVertex; - //================================================================================= namespace tcg { @@ -111,6 +107,16 @@ struct point_traits { } // namespace tcg +//----------------------------------------------------------------------------- + +template class DVAPI tcg::Vertex; +template class DVAPI tcg::Vertex; + +typedef tcg::Vertex TTextureVertex; + +template class DVAPI tcg::Mesh>; +template class DVAPI tcg::TriMesh>; + //*********************************************************************************** // TTextureMesh (Textured Mesh Type) declaration //*********************************************************************************** diff --git a/toonz/sources/include/toonzqt/gutil.h b/toonz/sources/include/toonzqt/gutil.h index 85004b3..16d984d 100644 --- a/toonz/sources/include/toonzqt/gutil.h +++ b/toonz/sources/include/toonzqt/gutil.h @@ -93,10 +93,10 @@ QIcon DVAPI createQIconPNG(const char *iconPNGName); QIcon DVAPI createQIconOnOff(const char *iconSVGName, bool withOver = true); QIcon DVAPI createQIconOnOffPNG(const char *iconPNGName, bool withOver = true); -inline QSize DVAPI dimension2QSize(const TDimension &sz) { +inline QSize dimension2QSize(const TDimension &sz) { return QSize(sz.lx, sz.ly); } -inline TDimension DVAPI qsize2Dimension(const QSize &sz) { +inline TDimension qsize2Dimension(const QSize &sz) { return TDimension(sz.width(), sz.height()); } QString DVAPI toQString(const TFilePath &path); @@ -117,33 +117,33 @@ bool DVAPI isResourceOrFolder(const QUrl &url); bool DVAPI acceptResourceDrop(const QList &urls); bool DVAPI acceptResourceOrFolderDrop(const QList &urls); -inline QPointF DVAPI toQPointF(const TPointD &p) { return QPointF(p.x, p.y); } -inline QPointF DVAPI toQPointF(const TPoint &p) { return QPointF(p.x, p.y); } -inline QPoint DVAPI toQPoint(const TPoint &p) { return QPoint(p.x, p.y); } -inline TPointD DVAPI toTPointD(const QPointF &p) { +inline QPointF toQPointF(const TPointD &p) { return QPointF(p.x, p.y); } +inline QPointF toQPointF(const TPoint &p) { return QPointF(p.x, p.y); } +inline QPoint toQPoint(const TPoint &p) { return QPoint(p.x, p.y); } +inline TPointD toTPointD(const QPointF &p) { return TPointD(p.x(), p.y()); } -inline TPointD DVAPI toTPointD(const QPoint &p) { +inline TPointD toTPointD(const QPoint &p) { return TPointD(p.x(), p.y()); } -inline TPoint DVAPI toTPoint(const QPoint &p) { return TPoint(p.x(), p.y()); } +inline TPoint toTPoint(const QPoint &p) { return TPoint(p.x(), p.y()); } -inline QRect DVAPI toQRect(const TRect &r) { +inline QRect toQRect(const TRect &r) { return QRect(r.x0, r.y0, r.getLx(), r.getLy()); } -inline QRectF DVAPI toQRectF(const TRectD &r) { +inline QRectF toQRectF(const TRectD &r) { return QRectF(r.x0, r.y0, r.getLx(), r.getLy()); } -inline QRectF DVAPI toQRectF(const TRect &r) { +inline QRectF toQRectF(const TRect &r) { return QRectF(r.x0, r.y0, r.getLx(), r.getLy()); } -inline TRect DVAPI toTRect(const QRect &r) { +inline TRect toTRect(const QRect &r) { return TRect(r.left(), r.top(), r.right(), r.bottom()); } -inline TRectD DVAPI toTRectD(const QRectF &r) { +inline TRectD toTRectD(const QRectF &r) { return TRectD(r.left(), r.top(), r.right(), r.bottom()); } -inline TRectD DVAPI toTRectD(const QRect &r) { +inline TRectD toTRectD(const QRect &r) { return TRectD(r.left(), r.top(), r.right() + 1, r.bottom() + 1); } diff --git a/toonz/sources/include/tpixelutils.h b/toonz/sources/include/tpixelutils.h index 69eb988..b57036b 100644 --- a/toonz/sources/include/tpixelutils.h +++ b/toonz/sources/include/tpixelutils.h @@ -61,7 +61,7 @@ inline T antialias(const T &a, int num) { */ template -DVAPI inline T overPixT(const T &bot, const T &top) { +inline T overPixT(const T &bot, const T &top) { UINT max = T::maxChannelValue; if (top.m == max) return top; @@ -78,7 +78,7 @@ DVAPI inline T overPixT(const T &bot, const T &top) { //----------------------------------------------------------------------------- template -DVAPI inline T overPixGRT(const T &bot, const S &top) { +inline T overPixGRT(const T &bot, const S &top) { UINT max = T::maxChannelValue; if (top.value == max) return T(top.value, top.value, top.value, top.value); @@ -98,8 +98,7 @@ DVAPI inline T overPixGRT(const T &bot, const S &top) { // as the other, but without if's. it's quicker if you know for sure that top.m // is not 0 or 255. template - -DVAPI inline T quickOverPixT(const T &bot, const T &top) { +inline T quickOverPixT(const T &bot, const T &top) { UINT max = T::maxChannelValue; TUINT32 r = top.r + bot.r * (max - top.m) / max; @@ -113,8 +112,7 @@ DVAPI inline T quickOverPixT(const T &bot, const T &top) { //------------------------------------------------------------------------------------ template - -DVAPI inline T quickOverPixPremultT(const T &bot, const T &top) { +inline T quickOverPixPremultT(const T &bot, const T &top) { UINT max = T::maxChannelValue; TUINT32 r = (top.r * top.m + bot.r * (max - top.m)) / max; @@ -128,7 +126,7 @@ DVAPI inline T quickOverPixPremultT(const T &bot, const T &top) { /*-- Show raster images darken-blended on the viewer --*/ /* references from ino_blend_darken.cpp */ template -DVAPI inline T quickOverPixDarkenBlendedT(const T &bot, const T &top) { +inline T quickOverPixDarkenBlendedT(const T &bot, const T &top) { struct locals { static inline double comp(const double ch_a, const double ch_b, const double alpha) { @@ -176,7 +174,7 @@ DVAPI inline T quickOverPixDarkenBlendedT(const T &bot, const T &top) { //----------------------------------------------------------------------------- template -DVAPI inline T quickOverPixGRT(const T &bot, const S &top) { +inline T quickOverPixGRT(const T &bot, const S &top) { UINT max = T::maxChannelValue; double aux = (max - top.value) / max; @@ -190,70 +188,70 @@ DVAPI inline T quickOverPixGRT(const T &bot, const S &top) { //----------------------------------------------------------------------------- -DVAPI inline TPixel32 overPix(const TPixel32 &bot, const TPixelGR8 &top) { +inline TPixel32 overPix(const TPixel32 &bot, const TPixelGR8 &top) { return overPixGRT(bot, top); } //----------------------------------------------------------------------------- -DVAPI inline TPixel64 overPix(const TPixel64 &bot, const TPixelGR16 &top) { +inline TPixel64 overPix(const TPixel64 &bot, const TPixelGR16 &top) { return overPixGRT(bot, top); } //----------------------------------------------------------------------------- -DVAPI inline TPixel32 overPix(const TPixel32 &bot, const TPixel32 &top) { +inline TPixel32 overPix(const TPixel32 &bot, const TPixel32 &top) { return overPixT(bot, top); } //----------------------------------------------------------------------------- -DVAPI inline TPixel64 overPix(const TPixel64 &bot, const TPixel64 &top) { +inline TPixel64 overPix(const TPixel64 &bot, const TPixel64 &top) { return overPixT(bot, top); } //----------------------------------------------------------------------------- -DVAPI inline TPixel32 quickOverPix(const TPixel32 &bot, const TPixelGR8 &top) { +inline TPixel32 quickOverPix(const TPixel32 &bot, const TPixelGR8 &top) { return quickOverPixGRT(bot, top); } //----------------------------------------------------------------------------- -DVAPI inline TPixel64 quickOverPix(const TPixel64 &bot, const TPixelGR16 &top) { +inline TPixel64 quickOverPix(const TPixel64 &bot, const TPixelGR16 &top) { return quickOverPixGRT(bot, top); } //----------------------------------------------------------------------------- -DVAPI inline TPixel32 quickOverPix(const TPixel32 &bot, const TPixel32 &top) { +inline TPixel32 quickOverPix(const TPixel32 &bot, const TPixel32 &top) { return quickOverPixT(bot, top); } //----------------------------------------------------------------------------- -DVAPI inline TPixel32 quickOverPixPremult(const TPixel32 &bot, - const TPixel32 &top) { +inline TPixel32 quickOverPixPremult(const TPixel32 &bot, + const TPixel32 &top) { return quickOverPixPremultT(bot, top); } //----------------------------------------------------------------------------- -DVAPI inline TPixel64 quickOverPix(const TPixel64 &bot, const TPixel64 &top) { +inline TPixel64 quickOverPix(const TPixel64 &bot, const TPixel64 &top) { return quickOverPixT(bot, top); } //------------------------------------------------------------------------------------ -DVAPI inline TPixel32 quickOverPixDarkenBlended(const TPixel32 &bot, - const TPixel32 &top) { +inline TPixel32 quickOverPixDarkenBlended(const TPixel32 &bot, + const TPixel32 &top) { return quickOverPixDarkenBlendedT(bot, top); } //----------------------------------------------------------------------------- template -DVAPI inline void overPix(T &outPix, const T &bot, const T &top) { +inline void overPix(T &outPix, const T &bot, const T &top) { UINT max = T::maxChannelValue; if (top.m == max) @@ -272,7 +270,7 @@ DVAPI inline void overPix(T &outPix, const T &bot, const T &top) { //----------------------------------------------------------------------------- -DVAPI inline TPixel32 overPixOnWhite(const TPixel32 &top) { +inline TPixel32 overPixOnWhite(const TPixel32 &top) { UINT max = TPixel32::maxChannelValue; if (top.m == max) @@ -284,7 +282,7 @@ DVAPI inline TPixel32 overPixOnWhite(const TPixel32 &top) { top.b + max - top.m, max); } -DVAPI inline TPixel32 overPixOnBlack(const TPixel32 &top) { +inline TPixel32 overPixOnBlack(const TPixel32 &top) { UINT max = TPixel32::maxChannelValue; if (top.m == max) return top; @@ -299,7 +297,7 @@ DVAPI inline TPixel32 overPixOnBlack(const TPixel32 &top) { /*! this function combines two GR8 pixels returning the darker. */ -DVAPI inline TPixelGR8 over(const TPixelGR8 &bot, const TPixelGR8 &top) { +inline TPixelGR8 over(const TPixelGR8 &bot, const TPixelGR8 &top) { return TPixelGR8(std::min(bot.value, top.value)); } @@ -333,7 +331,7 @@ DVAPI inline TPixelGR8 over(const TPixelGR8 &bot, const TPixelGR8 &top) { //----------------------------------------------------------------------------- -DVAPI inline void premult(TPixel32 &pix) { +inline void premult(TPixel32 &pix) { const int MAGICFAC = (257U * 256U + 1U); UINT fac = MAGICFAC * pix.m; @@ -342,20 +340,20 @@ DVAPI inline void premult(TPixel32 &pix) { pix.b = (UINT)(pix.b * fac + (1U << 23)) >> 24; } -DVAPI inline void premult(TPixel64 &pix) { +inline void premult(TPixel64 &pix) { pix.r = pix.r * pix.m / 65535.0; pix.g = pix.g * pix.m / 65535.0; pix.b = pix.b * pix.m / 65535.0; } -DVAPI inline void depremult(TPixel32 &pix) { +inline void depremult(TPixel32 &pix) { float fac = 255.0f / pix.m; pix.r = std::min(pix.r * fac, 255.0f); pix.g = std::min(pix.g * fac, 255.0f); pix.b = std::min(pix.b * fac, 255.0f); } -DVAPI inline void depremult(TPixel64 &pix) { +inline void depremult(TPixel64 &pix) { double fac = 65535.0 / pix.m; pix.r = std::min(pix.r * fac, 65535.0); pix.g = std::min(pix.g * fac, 65535.0); @@ -372,7 +370,7 @@ const double *depremultiplyTable(); //----------------------------------------------------------------------------- -DVAPI inline TPixel32 premultiply(const TPixel32 &pix) { +inline TPixel32 premultiply(const TPixel32 &pix) { const int MAGICFAC = (257U * 256U + 1U); UINT fac = MAGICFAC * pix.m; @@ -381,17 +379,17 @@ DVAPI inline TPixel32 premultiply(const TPixel32 &pix) { ((UINT)(pix.b * fac + (1U << 23)) >> 24), pix.m); } -DVAPI inline TPixel64 premultiply(const TPixel64 &pix) { +inline TPixel64 premultiply(const TPixel64 &pix) { return TPixel64(pix.r * pix.m / 65535.0, pix.g * pix.m / 65535.0, pix.b * pix.m / 65535.0, pix.m); } -DVAPI inline TPixel32 depremultiply(const TPixel32 &pix) { +inline TPixel32 depremultiply(const TPixel32 &pix) { return TPixel32(pix.r * 255.0 / pix.m, pix.g * 255.0 / pix.m, pix.b * 255.0 / pix.m, pix.m); } -DVAPI inline TPixel64 depremultiply(const TPixel64 &pix) { +inline TPixel64 depremultiply(const TPixel64 &pix) { return TPixel64(pix.r * 65535.0 / pix.m, pix.g * 65535.0 / pix.m, pix.b * 65535.0 / pix.m, pix.m); } diff --git a/toonz/sources/include/traster.h b/toonz/sources/include/traster.h index b7ad6f5..13ce6b7 100644 --- a/toonz/sources/include/traster.h +++ b/toonz/sources/include/traster.h @@ -62,6 +62,17 @@ class TRasterPT; class TRaster; typedef TSmartPointerT TRasterP; + +//------------------------------------------------------------ + +// +// Smart Pointer a TRaster +// + +#ifdef _WIN32 +template class DVAPI TSmartPointerT; +#endif + //========================================================= /*!This class stores bitmap images. */ class DVAPI TRaster : public TSmartObject { @@ -205,16 +216,6 @@ private: //------------------------------------------------------------ -// -// Smart Pointer a TRaster -// - -#ifdef _WIN32 -template class DVAPI TSmartPointerT; -#endif - -//------------------------------------------------------------ - inline void detach(TRasterP &r) { if (!r || r->getRefCount() == 1) return; TRasterP tmp(r->clone()); diff --git a/toonz/sources/include/trop_borders.h b/toonz/sources/include/trop_borders.h index c420473..2d15eeb 100644 --- a/toonz/sources/include/trop_borders.h +++ b/toonz/sources/include/trop_borders.h @@ -48,6 +48,14 @@ namespace TRop { namespace borders { +// Standard type instantiations + +template class DVAPI RasterEdgeIterator>; +template class DVAPI RasterEdgeIterator>; +template class DVAPI RasterEdgeIterator>; +template class DVAPI RasterEdgeIterator>; +template class DVAPI RasterEdgeIterator>; + //********************************************************************** // Borders Extraction Reader (callbacks container) //********************************************************************** @@ -158,9 +166,16 @@ class ImageMesh final : public TSmartObject, //-------------------------------------------------------------------------------- +} +} // namespace TRop::borders + #ifdef _WIN32 -template class TSmartPointerT; +template class DVAPI TSmartPointerT; #endif + +namespace TRop { +namespace borders { + typedef TSmartPointerT ImageMeshP; //********************************************************************** @@ -250,6 +265,9 @@ public: template void readMeshes(const TRasterPT &raster, ImageMeshesReaderT &reader); + +//-------------------------------------------------------------------------------- + } } // namespace TRop::borders diff --git a/toonz/sources/include/tthread.h b/toonz/sources/include/tthread.h index 32ca580..8f9dff9 100644 --- a/toonz/sources/include/tthread.h +++ b/toonz/sources/include/tthread.h @@ -34,9 +34,12 @@ void DVAPI shutdown(); class ExecutorId; // Private class Runnable; -#if !(defined(MACOSX) || defined(LINUX)) -template class TSmartPointerT; +} // namespace TThread +#ifdef _WIN32 +template class DVAPI TSmartPointerT; #endif +namespace TThread { + typedef TSmartPointerT RunnableP; //------------------------------------------------------------------------------ diff --git a/toonz/sources/include/ttzpimagefx.h b/toonz/sources/include/ttzpimagefx.h index 76b87b2..5f0025a 100644 --- a/toonz/sources/include/ttzpimagefx.h +++ b/toonz/sources/include/ttzpimagefx.h @@ -10,9 +10,6 @@ // TnzBase includes #include "trasterfxrenderdata.h" -// TnzExt includes -#include "ext/plasticskeletondeformation.h" - // STD includes #include #include diff --git a/toonz/sources/stdfx/iwa_particlesengine.cpp b/toonz/sources/stdfx/iwa_particlesengine.cpp index 0e41d9f..d0a63c5 100644 --- a/toonz/sources/stdfx/iwa_particlesengine.cpp +++ b/toonz/sources/stdfx/iwa_particlesengine.cpp @@ -27,13 +27,13 @@ #include #include -#include +#include namespace { QMutex mutex; void printTime(TStopWatch &sw, std::string name) { - std::ostrstream ss; + std::stringstream ss; ss << name << " : "; sw.print(ss); ss << '\n' << '\0'; diff --git a/toonz/sources/stdfx/particlesengine.cpp b/toonz/sources/stdfx/particlesengine.cpp index f13a74b..1a480db 100644 --- a/toonz/sources/stdfx/particlesengine.cpp +++ b/toonz/sources/stdfx/particlesengine.cpp @@ -26,7 +26,7 @@ #include "trenderer.h" -#include +#include /*-----------------------------------------------------------------*/ @@ -34,7 +34,7 @@ Particles_Engine::Particles_Engine(ParticlesFx *parent, double frame) : m_parent(parent), m_frame(frame) {} static void printTime(TStopWatch &sw, std::string name) { - std::ostrstream ss; + std::stringstream ss; ss << name << " : "; sw.print(ss); ss << '\n' << '\0'; diff --git a/toonz/sources/tnzbase/tscanner/TScannerIO/TUSBScannerIO_M.cpp b/toonz/sources/tnzbase/tscanner/TScannerIO/TUSBScannerIO_M.cpp index 462523d..0ae71b5 100644 --- a/toonz/sources/tnzbase/tscanner/TScannerIO/TUSBScannerIO_M.cpp +++ b/toonz/sources/tnzbase/tscanner/TScannerIO/TUSBScannerIO_M.cpp @@ -3,7 +3,7 @@ #include "TUSBScannerIO.h" #include "tsystem.h" #include -#include +#include //#define HAS_LIBUSB @@ -46,7 +46,7 @@ TUSBScannerIOPD::TUSBScannerIOPD() namespace { void buf2printable(const unsigned char *buffer, const int size, - ostrstream &os) { + stringstream &os) { int i = 0; if ((size == 2) && (buffer[0] == 0x1b)) { os << "ESC "; @@ -155,8 +155,7 @@ int TUSBScannerIO::receive(unsigned char *buffer, int size) { 30 * 1000); if (m_data->m_trace) { - ostrstream os; - os.freeze(false); + stringstream os; os << "receive: size=" << size << " got = " << count << " buf="; buf2printable(buffer, count, os); os << '\n' << '\0'; @@ -184,8 +183,7 @@ int TUSBScannerIO::send(unsigned char *buffer, int size) { count = usb_bulk_write(m_data->m_handle, m_data->m_epW, (char *)buffer, size, 30 * 1000); if (m_data->m_trace) { - ostrstream os; - os.freeze(false); + stringstream os; os << "send: size=" << size << " wrote = " << count << " buf="; buf2printable(buffer, size, os); os << '\n' << '\0'; diff --git a/toonz/sources/tnzbase/tscanner/TScannerIO/TUSBScannerIO_W.cpp b/toonz/sources/tnzbase/tscanner/TScannerIO/TUSBScannerIO_W.cpp index e248b72..45e2b71 100644 --- a/toonz/sources/tnzbase/tscanner/TScannerIO/TUSBScannerIO_W.cpp +++ b/toonz/sources/tnzbase/tscanner/TScannerIO/TUSBScannerIO_W.cpp @@ -5,7 +5,7 @@ #include -#include +#include class TUSBScannerIOPD { public: @@ -17,7 +17,7 @@ public: //----------------------------------------------------------------------------- namespace { void buf2printable(const unsigned char *buffer, const int size, - std::ostrstream &os) { + std::stringstream &os) { int i = 0; if ((size == 2) && (buffer[0] == 0x1b)) { os << "ESC "; @@ -79,8 +79,7 @@ int TUSBScannerIO::receive(unsigned char *buffer, int size) { ReadFile(m_data->m_handle, ptr, bytesToRead, &count, &overlapped); DWORD waitRC = WaitForSingleObject(overlapped.hEvent, INFINITE); if (m_data->m_trace) { - std::ostrstream os; - os.freeze(false); + std::stringstream os; os << "receive: size=" << size << " got = " << count << " buf="; buf2printable(ptr, count, os); os << '\n' << '\0'; @@ -109,8 +108,7 @@ int TUSBScannerIO::send(unsigned char *buffer, int size) { WriteFile(m_data->m_handle, buffer, bytesToWrite, &count, 0); if (m_data->m_trace) { - std::ostrstream os; - os.freeze(false); + std::stringstream os; os << "send: size=" << size << " wrote = " << count << " buf="; buf2printable(buffer, size, os); os << '\n' << '\0'; diff --git a/toonz/sources/tnzbase/tscanner/tscannerepson.cpp b/toonz/sources/tnzbase/tscanner/tscannerepson.cpp index 2cc40ee..f3ac822 100644 --- a/toonz/sources/tnzbase/tscanner/tscannerepson.cpp +++ b/toonz/sources/tnzbase/tscanner/tscannerepson.cpp @@ -14,7 +14,7 @@ #include #include #include -#include +#include using namespace TScannerUtil; @@ -311,7 +311,7 @@ throw TException("Scan area too large, select a correct paper size"); bytes_to_read = lines * counter; if (stx != 0x02) { - std::ostrstream os; + std::stringstream os; os << "header corrupted (" << std::hex << stx << ")" << '\0'; throw TException(os.str()); } @@ -641,8 +641,7 @@ throw TException("Scanner error resetting"); #ifdef _DEBUG memcpy(&status, &(buffer2[1]), 1); - std::ostrstream os; - os.freeze(false); + std::stringstream os; os << "stx = " << stx << " status = " << status << " counter=" << counter << '\n' << '\0'; @@ -754,8 +753,7 @@ bool TScannerEpson::expectACK() { #ifdef _DEBUG if (ack != ACK) { - std::ostrstream os; - os.freeze(false); + std::stringstream os; os << "ack fails ret = 0x" << std::hex << (int)ack << '\n' << '\0'; TSystem::outputDebug(os.str()); } @@ -939,8 +937,7 @@ void TScannerEpson::ESCI_readLineData(unsigned char &stx, unsigned char &status, status = buffer[1]; #ifdef _DEBUG - std::ostrstream os; - os.freeze(false); + std::stringstream os; os << "fatal=" << fatalError; os << " notReady=" << notReady; @@ -973,8 +970,7 @@ void TScannerEpson::ESCI_readLineData2(unsigned char &stx, status = buffer[1]; #ifdef _DEBUG - std::ostrstream os; - os.freeze(false); + std::stringstream os; os << "fatal=" << fatalError; os << " notReady=" << notReady; diff --git a/toonz/sources/toonz/main.cpp b/toonz/sources/toonz/main.cpp index bfa8206..8fa8452 100644 --- a/toonz/sources/toonz/main.cpp +++ b/toonz/sources/toonz/main.cpp @@ -396,7 +396,9 @@ int main(int argc, char *argv[]) { fmt.setStencil(true); QGLFormat::setDefaultFormat(fmt); -#ifdef LINUX + // seems this function should be called at all systems + // pheraps in some GLUT-implementations initalization is mere formality +#if defined(LINUX) || (defined(_WIN32) && defined(__GNUC__)) glutInit(&argc, argv); #endif diff --git a/toonz/sources/toonz/pane.cpp b/toonz/sources/toonz/pane.cpp index 4e632f0..09ab776 100644 --- a/toonz/sources/toonz/pane.cpp +++ b/toonz/sources/toonz/pane.cpp @@ -457,25 +457,28 @@ void TPanelTitleBar::resizeEvent(QResizeEvent *e) { //----------------------------------------------------------------------------- TPanelFactory::TPanelFactory(QString panelType) : m_panelType(panelType) { - assert(m_table.count(panelType) == 0); - m_table[m_panelType] = this; + assert(tableInstance().count(panelType) == 0); + tableInstance()[m_panelType] = this; } //----------------------------------------------------------------------------- -TPanelFactory::~TPanelFactory() { m_table.remove(m_panelType); } +TPanelFactory::~TPanelFactory() { tableInstance().remove(m_panelType); } //----------------------------------------------------------------------------- -QMap TPanelFactory::m_table; +QMap& TPanelFactory::tableInstance() { + static QMap table; + return table; +} //----------------------------------------------------------------------------- TPanel *TPanelFactory::createPanel(QWidget *parent, QString panelType) { TPanel *panel = 0; - QMap::iterator it = m_table.find(panelType); - if (it == m_table.end()) { + QMap::iterator it = tableInstance().find(panelType); + if (it == tableInstance().end()) { TPanel *panel = new TPanel(parent); panel->setPanelType(panelType.toStdString()); return panel; diff --git a/toonz/sources/toonz/pane.h b/toonz/sources/toonz/pane.h index 3af30c3..2abc92d 100644 --- a/toonz/sources/toonz/pane.h +++ b/toonz/sources/toonz/pane.h @@ -258,7 +258,7 @@ signals: class TPanelFactory { QString m_panelType; - static QMap m_table; + static QMap& tableInstance(); public: TPanelFactory(QString panelType); diff --git a/toonz/sources/toonzfarm/tfarm/service.cpp b/toonz/sources/toonzfarm/tfarm/service.cpp index 631b8b8..9faa1c7 100644 --- a/toonz/sources/toonzfarm/tfarm/service.cpp +++ b/toonz/sources/toonzfarm/tfarm/service.cpp @@ -27,7 +27,7 @@ //------------------------------------------------------------------------------ -LPTSTR GetLastErrorText(LPTSTR lpszBuf, DWORD dwSize) { +static LPTSTR GetLastErrorText(LPTSTR lpszBuf, DWORD dwSize) { DWORD dwRet; LPTSTR lpszTemp = NULL; diff --git a/toonz/sources/toonzfarm/tfarm/tfarmcontroller_c.cpp b/toonz/sources/toonzfarm/tfarm/tfarmcontroller_c.cpp index 6490fe1..ad75077 100644 --- a/toonz/sources/toonzfarm/tfarm/tfarmcontroller_c.cpp +++ b/toonz/sources/toonzfarm/tfarm/tfarmcontroller_c.cpp @@ -8,7 +8,7 @@ #include "tfarmproxy.h" #include "tfilepath_io.h" -#include +#include namespace { @@ -494,7 +494,7 @@ void loadControllerData(const TFilePath &fp, ControllerData &data) { is.getline(line, 1024); if (line[0] != '#' && QString(line) != "") { - std::istrstream iss(line); + std::stringstream iss(line); char hostName[512]; char ipAddr[80]; diff --git a/toonz/sources/toonzfarm/tfarmcontroller/tfarmcontroller.cpp b/toonz/sources/toonzfarm/tfarmcontroller/tfarmcontroller.cpp index 024227a..7efb069 100644 --- a/toonz/sources/toonzfarm/tfarmcontroller/tfarmcontroller.cpp +++ b/toonz/sources/toonzfarm/tfarmcontroller/tfarmcontroller.cpp @@ -20,7 +20,7 @@ #include "tthread.h" -#include +#include #include using namespace std; @@ -691,7 +691,7 @@ void FarmController::loadServersData(const TFilePath &globalRoot) { is.getline(line, 80); if (line[0] != '#' && QString(line) != "") { - istrstream iss(line); + stringstream iss(line); char hostName[512]; char ipAddr[80]; diff --git a/toonz/sources/toonzfarm/tnzcore_stuff/tfilepath.cpp b/toonz/sources/toonzfarm/tnzcore_stuff/tfilepath.cpp index 7b17dc1..237c899 100644 --- a/toonz/sources/toonzfarm/tnzcore_stuff/tfilepath.cpp +++ b/toonz/sources/toonzfarm/tnzcore_stuff/tfilepath.cpp @@ -15,13 +15,12 @@ const char auxslash = '\\'; //============================================================================= // TFrameId::operator string() const -string TFrameId::expand(FrameFormat format) const { +std::string TFrameId::expand(FrameFormat format) const { if (m_frame == EMPTY_FRAME) return ""; else if (m_frame == NO_FRAME) return "-"; - char buffer[80]; - ostrstream o_buff(buffer, sizeof(buffer)); + std::stringstream o_buff; if (format == FOUR_ZEROS) { o_buff.fill('0'); o_buff.width(4); @@ -31,8 +30,7 @@ string TFrameId::expand(FrameFormat format) const { o_buff << m_frame; } if (m_letter != '\0') o_buff << m_letter; - int len = o_buff.pcount(); - return string(buffer, len); + return o_buff.str(); } //------------------------------------------------------------------- diff --git a/toonz/sources/toonzfarm/tnzcore_stuff/tsystem.cpp b/toonz/sources/toonzfarm/tnzcore_stuff/tsystem.cpp index e3bb197..88acca8 100644 --- a/toonz/sources/toonzfarm/tnzcore_stuff/tsystem.cpp +++ b/toonz/sources/toonzfarm/tnzcore_stuff/tsystem.cpp @@ -390,10 +390,9 @@ string TTime::getDate() const { return getFormattedString("%b %d %Y"); } //----------------------------------------------------------------------------------- string TTime::getTime() const { // hh:mm:ss - char buffer[10]; - ostrstream buff_s(buffer, sizeof(buffer)); + stringstream buff_s; buff_s << "." << m_msec << '\0'; - return getFormattedString("%X") + buffer; + return getFormattedString("%X") + buff_s.str(); } //----------------------------------------------------------------------------------- @@ -431,10 +430,9 @@ string TFileStatus::getGroup() const { struct group *grp = getgrgid(m_fStatus.st_gid); if (grp) return string(grp->gr_name); #endif - char buffer[1024]; - ostrstream buff(buffer, sizeof(buffer)); + stringstream buff; buff << m_fStatus.st_gid; - return string(buffer, buff.pcount()); + return buff.str(); } //----------------------------------------------------------------------------------- @@ -444,10 +442,9 @@ string TFileStatus::getUser() const { struct passwd *pw = getpwuid(m_fStatus.st_uid); if (pw) return string(pw->pw_name); #endif - char buffer[1024]; - ostrstream buff(buffer, sizeof(buffer)); + stringstream buff; buff << m_fStatus.st_uid; - return string(buffer, buff.pcount()); + return buff.str(); } //----------------------------------------------------------------------------------- diff --git a/toonz/sources/toonzlib/tcenterlinevectorizerOld.cpp b/toonz/sources/toonzlib/tcenterlinevectorizerOld.cpp index e991366..55640d1 100644 --- a/toonz/sources/toonzlib/tcenterlinevectorizerOld.cpp +++ b/toonz/sources/toonzlib/tcenterlinevectorizerOld.cpp @@ -2462,12 +2462,11 @@ void CenterLineVectorizer::vectorize() { #ifdef DEBUG void printTime(TStopWatch &sw, string name) { - ostrstream ss; + stringstream ss; ss << name << " : "; sw.print(ss); ss << '\n' << '\0'; string s = ss.str(); - ss.freeze(false); TSystem::outputDebug(s); } #endif