From 74e2cb1469935a4fc572287727331a40a16fe42a Mon Sep 17 00:00:00 2001 From: shun_iwasawa Date: Apr 18 2016 13:33:55 +0000 Subject: Merge remote-tracking branch 'origin/master' into revert_room_feature --- diff --git a/toonz/sources/stdfx/motionblurfx.cpp b/toonz/sources/stdfx/motionblurfx.cpp index 5bebef2..7ee9da3 100644 --- a/toonz/sources/stdfx/motionblurfx.cpp +++ b/toonz/sources/stdfx/motionblurfx.cpp @@ -1,4 +1,4 @@ - +#include #include "tpixel.h" #include @@ -252,7 +252,6 @@ void doDirectionalBlur(TRasterPT r, double blur, bool bidirectional) { int i, lx, ly, brad; double coeff, coeffq, diff, globmatte; - T *row, *buffer; brad = tfloor(blur); /* number of pixels involved in the filtering. */ if (bidirectional) { @@ -268,24 +267,23 @@ void doDirectionalBlur(TRasterPT r, double blur, bool bidirectional) if ((lx == 0) || (ly == 0)) return; - row = new T[lx + 2 * brad + 2]; + std::unique_ptr row(new T[lx + 2 * brad + 2]); if (!row) return; - memset(row, 0, (lx + 2 * brad + 2) * sizeof(T)); + memset(row.get(), 0, (lx + 2 * brad + 2) * sizeof(T)); globmatte = 0.8; /* a little bit of transparency is also added */ r->lock(); for (i = 0; i < ly; i++) { - buffer = (T *)r->pixels(i); - takeRow(buffer, row + brad, lx, brad, bidirectional); + T *buffer = (T *)r->pixels(i); + takeRow(buffer, row.get() + brad, lx, brad, bidirectional); if (bidirectional) - blur_code(row + brad, buffer, lx, coeff, coeffq, brad, diff, globmatte); + blur_code(row.get() + brad, buffer, lx, coeff, coeffq, brad, diff, globmatte); else - do_filtering(row + brad, buffer, lx, coeff, brad, blur, globmatte); + do_filtering(row.get() + brad, buffer, lx, coeff, brad, blur, globmatte); } - free(row); r->unlock(); }