diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-08-16 16:32:48 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-08-16 16:32:48 +0400 |
commit | 3bc16fd60dd573f8289552a0046b0735d1c7e02b (patch) | |
tree | 3936a357fd922e96b622f29f04804b20cb11f234 /source/blender/compositor/operations/COM_GaussianBokehBlurOperation.cpp | |
parent | 883e9df1ccdaaa847c86e2d1457fd88333b87c84 (diff) |
compositor: replace C++ new/delete with guardedalloc.
Diffstat (limited to 'source/blender/compositor/operations/COM_GaussianBokehBlurOperation.cpp')
-rw-r--r-- | source/blender/compositor/operations/COM_GaussianBokehBlurOperation.cpp | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.cpp b/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.cpp index d97d2f15ded..a9bcb2dd752 100644 --- a/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.cpp +++ b/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.cpp @@ -88,7 +88,7 @@ void GaussianBokehBlurOperation::updateGauss() n = (2 * this->m_radx + 1) * (2 * this->m_rady + 1); /* create a full filter image */ - ddgauss = new float[n]; + ddgauss = (float *)MEM_mallocN(sizeof(float) * n, __func__); dgauss = ddgauss; val = 0.0f; for (j = -this->m_rady; j <= this->m_rady; j++) { @@ -103,8 +103,9 @@ void GaussianBokehBlurOperation::updateGauss() } if (val != 0.0f) { val = 1.0f / val; - for (j = n - 1; j >= 0; j--) + for (j = n - 1; j >= 0; j--) { ddgauss[j] *= val; + } } else ddgauss[4] = 1.0f; @@ -158,7 +159,7 @@ void GaussianBokehBlurOperation::executePixel(float output[4], int x, int y, voi void GaussianBokehBlurOperation::deinitExecution() { BlurBaseOperation::deinitExecution(); - delete [] this->m_gausstab; + MEM_freeN(this->m_gausstab); this->m_gausstab = NULL; deinitMutex(); @@ -258,8 +259,9 @@ void GaussianBlurReferenceOperation::updateGauss() int i; int x = MAX2(m_radx, m_rady); this->m_maintabs = (float **)MEM_mallocN(x * sizeof(float *), "gauss array"); - for (i = 0; i < x; i++) + for (i = 0; i < x; i++) { m_maintabs[i] = make_gausstab(i + 1); + } } void GaussianBlurReferenceOperation::executePixel(float output[4], int x, int y, void *data) @@ -326,8 +328,9 @@ void GaussianBlurReferenceOperation::deinitExecution() { int x, i; x = MAX2(m_radx, m_rady); - for (i = 0; i < x; i++) - delete []m_maintabs[i]; + for (i = 0; i < x; i++) { + MEM_freeN(m_maintabs[i]); + } MEM_freeN(m_maintabs); BlurBaseOperation::deinitExecution(); } |