[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [49845] trunk/blender/source/blender/ compositor/operations/COM_InpaintOperation.cpp: avoid divide by zero for the inpaint node.
Campbell Barton
ideasman42 at gmail.com
Sun Aug 12 19:10:56 CEST 2012
Revision: 49845
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=49845
Author: campbellbarton
Date: 2012-08-12 17:10:56 +0000 (Sun, 12 Aug 2012)
Log Message:
-----------
avoid divide by zero for the inpaint node.
Modified Paths:
--------------
trunk/blender/source/blender/compositor/operations/COM_InpaintOperation.cpp
Modified: trunk/blender/source/blender/compositor/operations/COM_InpaintOperation.cpp
===================================================================
--- trunk/blender/source/blender/compositor/operations/COM_InpaintOperation.cpp 2012-08-12 16:51:51 UTC (rev 49844)
+++ trunk/blender/source/blender/compositor/operations/COM_InpaintOperation.cpp 2012-08-12 17:10:56 UTC (rev 49845)
@@ -176,11 +176,9 @@
void InpaintSimpleOperation::pix_step(int x, int y)
{
- int d = this->mdist(x, y);
-
- float n = 0;
-
+ const int d = this->mdist(x, y);
float pix[3] = {0.0f, 0.0f, 0.0f};
+ float pix_divider = 0.0f;
for (int dx = -1; dx <= 1; dx++) {
for (int dy = -1; dy <= 1; dy++) {
@@ -203,13 +201,16 @@
}
madd_v3_v3fl(pix, this->get_pixel(x_ofs, y_ofs), weight);
- n += weight;
+ pix_divider += weight;
}
}
}
}
- mul_v3_v3fl(this->get_pixel(x, y), pix, 1.0f / n);
+ float *output = this->get_pixel(x, y);
+ if (pix_divider != 0.0f) {
+ mul_v3_v3fl(output, pix, 1.0f / pix_divider);
+ }
}
void *InpaintSimpleOperation::initializeTileData(rcti *rect)
More information about the Bf-blender-cvs
mailing list