From 3bc16fd60dd573f8289552a0046b0735d1c7e02b Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 16 Aug 2012 12:32:48 +0000 Subject: compositor: replace C++ new/delete with guardedalloc. --- .../blender/compositor/operations/COM_AntiAliasOperation.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'source/blender/compositor/operations/COM_AntiAliasOperation.cpp') diff --git a/source/blender/compositor/operations/COM_AntiAliasOperation.cpp b/source/blender/compositor/operations/COM_AntiAliasOperation.cpp index 12bf651992e..c37830a9d92 100644 --- a/source/blender/compositor/operations/COM_AntiAliasOperation.cpp +++ b/source/blender/compositor/operations/COM_AntiAliasOperation.cpp @@ -23,6 +23,10 @@ #include "COM_AntiAliasOperation.h" #include "BLI_math.h" #include "BLI_utildefines.h" +#include "BKE_utildefines.h" + +#include "MEM_guardedalloc.h" + extern "C" { #include "RE_render_ext.h" } @@ -58,7 +62,7 @@ void AntiAliasOperation::deinitExecution() { this->m_valueReader = NULL; if (this->m_buffer) { - delete this->m_buffer; + MEM_freeN(this->m_buffer); } NodeOperation::deinitMutex(); } @@ -90,12 +94,10 @@ void *AntiAliasOperation::initializeTileData(rcti *rect) MemoryBuffer *tile = (MemoryBuffer *)this->m_valueReader->initializeTileData(rect); int size = tile->getHeight() * tile->getWidth(); float *input = tile->getBuffer(); - char *valuebuffer = new char[size]; + char *valuebuffer = (char *)MEM_mallocN(sizeof(char) * size, __func__); for (int i = 0; i < size; i++) { float in = input[i * COM_NUMBER_OF_CHANNELS]; - if (in < 0.0f) { in = 0.0f; } - if (in > 1.0f) {in = 1.0f; } - valuebuffer[i] = in * 255; + valuebuffer[i] = FTOCHAR(in); } antialias_tagbuf(tile->getWidth(), tile->getHeight(), valuebuffer); this->m_buffer = valuebuffer; -- cgit v1.2.3