OpenToonz - An open-source full-featured 2D animation creation software
C
fix bokeh fx (#1806)
shun-iwasawa0e4a7a9f0c52
diff --git a/toonz/sources/stdfx/iwa_bokehfx.cpp b/toonz/sources/stdfx/iwa_bokehfx.cppindex 0d4f088ba..603900344 100644--- a/toonz/sources/stdfx/iwa_bokehfx.cpp+++ b/toonz/sources/stdfx/iwa_bokehfx.cpp@@ -790,10 +790,8 @@ float Iwa_BokehFx::getBokehPixelAmount(const double frame,vect.x = m_bokehAmount->getValue(frame);vect.y = 0.0;/*--- Apply geometrical transformation ---*/- /* �ȉ��́A- N:/admin/toonzsrc/m-inoue/tnz6100sp1_ino0011/ghibli/toonz/main/sources/stdfx/motionblurfx.cpp- 586-592�s���Q�Ƃ��ď�����- */+ // For the following lines I referred to lines 586-592 of+ // sources/stdfx/motionblurfx.cppTAffine aff(affine);aff.a13 = aff.a23 = 0; /* ignore translation */vect = aff * vect;@@ -852,8 +850,8 @@ void Iwa_BokehFx::convertIris(const float irisSize,double irisSizeResampleRatio = irisSize / irisOrgSize.x;// Create the raster for resized iris- double2 resizedIrisSize = {abs(irisSizeResampleRatio) * irisOrgSize.x,- abs(irisSizeResampleRatio) * irisOrgSize.y};+ double2 resizedIrisSize = {std::abs(irisSizeResampleRatio) * irisOrgSize.x,+ std::abs(irisSizeResampleRatio) * irisOrgSize.y};int2 filterSize = {tceil(resizedIrisSize.x), tceil(resizedIrisSize.y)};TPointD resizeOffset((double)filterSize.x - resizedIrisSize.x,(double)filterSize.y - resizedIrisSize.y);diff --git a/toonz/sources/stdfx/iwa_bokehreffx.cpp b/toonz/sources/stdfx/iwa_bokehreffx.cppindex a823fb6ce..b11ab2736 100644--- a/toonz/sources/stdfx/iwa_bokehreffx.cpp+++ b/toonz/sources/stdfx/iwa_bokehreffx.cpp@@ -285,10 +285,10 @@ void Iwa_BokehRefFx::defineSegemntDepth(continue;}// error amount at the current registered layers- int tmpError = abs(h - histo[h].belongingSegmentValue);+ int tmpError = std::abs(h - histo[h].belongingSegmentValue);if (tmpError == 0) break;// new error amount- int newError = abs(h - segmentValues.values().at(seg));+ int newError = std::abs(h - segmentValues.values().at(seg));// compare the two and updateif (newError < tmpError)histo[h].belongingSegmentValue = segmentValues.values().at(seg);@@ -313,11 +313,11 @@ void Iwa_BokehRefFx::defineSegemntDepth(// compare the current segment value and h and take the nearest value// if h is near (from i), then accumulate the estimated error reduction// amount- if (abs(i - histo[i].belongingSegmentValue) >- abs(i - h)) // the current segment value has- // proirity, if the distance is the same+ if (std::abs(i - histo[i].belongingSegmentValue) >+ std::abs(i - h)) // the current segment value has+ // proirity, if the distance is the sameerrorModAmount +=- (abs(i - histo[i].belongingSegmentValue) - abs(i - h)) *+ (std::abs(i - histo[i].belongingSegmentValue) - std::abs(i - h)) *histo[i].pix_amount;}@@ -340,9 +340,9 @@ void Iwa_BokehRefFx::defineSegemntDepth(// compare the current segment value and h and take the nearest value// if tmpBestNewSegVal is near (from h), then update the// belongingSegmentValue- if (abs(h - histo[h].belongingSegmentValue) >- abs(h - tmpBestNewSegVal)) // the current segment value has- // proirity, if the distance is the same+ if (std::abs(h - histo[h].belongingSegmentValue) >+ std::abs(h - tmpBestNewSegVal)) // the current segment value has+ // proirity, if the distance is the samehisto[h].belongingSegmentValue = tmpBestNewSegVal;}}@@ -461,8 +461,8 @@ void Iwa_BokehRefFx::convertIris(const float irisSize, const TRectD& irisBBox,double irisSizeResampleRatio = irisSize / irisOrgSize.lx;// create the raster for resizing- TDimensionD resizedIrisSize(abs(irisSizeResampleRatio) * irisOrgSize.lx,- abs(irisSizeResampleRatio) * irisOrgSize.ly);+ TDimensionD resizedIrisSize(std::abs(irisSizeResampleRatio) * irisOrgSize.lx,+ std::abs(irisSizeResampleRatio) * irisOrgSize.ly);TDimensionI filterSize((int)std::ceil(resizedIrisSize.lx),(int)std::ceil(resizedIrisSize.ly));TPointD resizeOffset((double)filterSize.lx - resizedIrisSize.lx,