Merge remote-tracking branch 'origin/master' into revert_room_feature
This commit is contained in:
commit
74e2cb1469
1 changed files with 7 additions and 9 deletions
|
@ -1,4 +1,4 @@
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
#include "tpixel.h"
|
#include "tpixel.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
@ -252,7 +252,6 @@ void doDirectionalBlur(TRasterPT<T> r, double blur, bool bidirectional)
|
||||||
{
|
{
|
||||||
int i, lx, ly, brad;
|
int i, lx, ly, brad;
|
||||||
double coeff, coeffq, diff, globmatte;
|
double coeff, coeffq, diff, globmatte;
|
||||||
T *row, *buffer;
|
|
||||||
|
|
||||||
brad = tfloor(blur); /* number of pixels involved in the filtering. */
|
brad = tfloor(blur); /* number of pixels involved in the filtering. */
|
||||||
if (bidirectional) {
|
if (bidirectional) {
|
||||||
|
@ -268,24 +267,23 @@ void doDirectionalBlur(TRasterPT<T> r, double blur, bool bidirectional)
|
||||||
if ((lx == 0) || (ly == 0))
|
if ((lx == 0) || (ly == 0))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
row = new T[lx + 2 * brad + 2];
|
std::unique_ptr<T[]> row(new T[lx + 2 * brad + 2]);
|
||||||
if (!row)
|
if (!row)
|
||||||
return;
|
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 */
|
globmatte = 0.8; /* a little bit of transparency is also added */
|
||||||
|
|
||||||
r->lock();
|
r->lock();
|
||||||
for (i = 0; i < ly; i++) {
|
for (i = 0; i < ly; i++) {
|
||||||
buffer = (T *)r->pixels(i);
|
T *buffer = (T *)r->pixels(i);
|
||||||
takeRow(buffer, row + brad, lx, brad, bidirectional);
|
takeRow(buffer, row.get() + brad, lx, brad, bidirectional);
|
||||||
if (bidirectional)
|
if (bidirectional)
|
||||||
blur_code<T>(row + brad, buffer, lx, coeff, coeffq, brad, diff, globmatte);
|
blur_code<T>(row.get() + brad, buffer, lx, coeff, coeffq, brad, diff, globmatte);
|
||||||
else
|
else
|
||||||
do_filtering<T>(row + brad, buffer, lx, coeff, brad, blur, globmatte);
|
do_filtering<T>(row.get() + brad, buffer, lx, coeff, brad, blur, globmatte);
|
||||||
}
|
}
|
||||||
|
|
||||||
free(row);
|
|
||||||
r->unlock();
|
r->unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue