Make compilation unit rtengine/labimage.cc -Wextra clean, #4155
This commit is contained in:
@@ -1,9 +1,29 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of RawTherapee.
|
||||||
|
*
|
||||||
|
* Copyright (c) 2004-2017 Gabor Horvath <hgabor@rawtherapee.com>
|
||||||
|
*
|
||||||
|
* RawTherapee is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* RawTherapee is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with RawTherapee. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
#include "labimage.h"
|
#include "labimage.h"
|
||||||
#include <memory.h>
|
#include <memory>
|
||||||
|
|
||||||
namespace rtengine
|
namespace rtengine
|
||||||
{
|
{
|
||||||
|
|
||||||
LabImage::LabImage (int w, int h) : fromImage(false), W(w), H(h)
|
LabImage::LabImage (int w, int h) : W(w), H(h)
|
||||||
{
|
{
|
||||||
allocLab(w, h);
|
allocLab(w, h);
|
||||||
}
|
}
|
||||||
@@ -42,4 +62,43 @@ void LabImage::getPipetteData (float &v1, float &v2, float &v3, int posX, int po
|
|||||||
v3 = n ? accumulator_b / float(n) : 0.f;
|
v3 = n ? accumulator_b / float(n) : 0.f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void LabImage::allocLab(int w, int h)
|
||||||
|
{
|
||||||
|
L = new float*[h];
|
||||||
|
a = new float*[h];
|
||||||
|
b = new float*[h];
|
||||||
|
|
||||||
|
data = new float [w * h * 3];
|
||||||
|
float * index = data;
|
||||||
|
|
||||||
|
for (int i = 0; i < h; i++) {
|
||||||
|
L[i] = index + i * w;
|
||||||
|
}
|
||||||
|
|
||||||
|
index += w * h;
|
||||||
|
|
||||||
|
for (int i = 0; i < h; i++) {
|
||||||
|
a[i] = index + i * w;
|
||||||
|
}
|
||||||
|
|
||||||
|
index += w * h;
|
||||||
|
|
||||||
|
for (int i = 0; i < h; i++) {
|
||||||
|
b[i] = index + i * w;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void LabImage::deleteLab()
|
||||||
|
{
|
||||||
|
delete [] L;
|
||||||
|
delete [] a;
|
||||||
|
delete [] b;
|
||||||
|
delete [] data;
|
||||||
|
}
|
||||||
|
|
||||||
|
void LabImage::reallocLab()
|
||||||
|
{
|
||||||
|
allocLab(W, H);
|
||||||
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -25,32 +25,8 @@ namespace rtengine
|
|||||||
class LabImage
|
class LabImage
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
bool fromImage;
|
void allocLab(int w, int h);
|
||||||
void allocLab(int w, int h)
|
|
||||||
{
|
|
||||||
L = new float*[H];
|
|
||||||
a = new float*[H];
|
|
||||||
b = new float*[H];
|
|
||||||
|
|
||||||
data = new float [W * H * 3];
|
|
||||||
float * index = data;
|
|
||||||
|
|
||||||
for (int i = 0; i < H; i++) {
|
|
||||||
L[i] = index + i * W;
|
|
||||||
}
|
|
||||||
|
|
||||||
index += W * H;
|
|
||||||
|
|
||||||
for (int i = 0; i < H; i++) {
|
|
||||||
a[i] = index + i * W;
|
|
||||||
}
|
|
||||||
|
|
||||||
index += W * H;
|
|
||||||
|
|
||||||
for (int i = 0; i < H; i++) {
|
|
||||||
b[i] = index + i * W;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
public:
|
public:
|
||||||
int W, H;
|
int W, H;
|
||||||
float * data;
|
float * data;
|
||||||
@@ -64,20 +40,8 @@ public:
|
|||||||
//Copies image data in Img into this instance.
|
//Copies image data in Img into this instance.
|
||||||
void CopyFrom(LabImage *Img);
|
void CopyFrom(LabImage *Img);
|
||||||
void getPipetteData (float &L, float &a, float &b, int posX, int posY, int squareSize);
|
void getPipetteData (float &L, float &a, float &b, int posX, int posY, int squareSize);
|
||||||
void deleteLab( )
|
void deleteLab();
|
||||||
{
|
void reallocLab();
|
||||||
if (!fromImage) {
|
|
||||||
delete [] L;
|
|
||||||
delete [] a;
|
|
||||||
delete [] b;
|
|
||||||
delete [] data;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
void reallocLab( )
|
|
||||||
{
|
|
||||||
allocLab(W, H);
|
|
||||||
};
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user