Fix some cppcheck warnings

This commit is contained in:
Lawrence Lee
2020-08-09 16:59:27 -07:00
parent 6cd87ad975
commit 8b3af4c520
2 changed files with 11 additions and 6 deletions

View File

@@ -133,7 +133,9 @@ ImProcCoordinator::ImProcCoordinator() :
histLRETI(256),
vectorscopeScale(0),
vectorscope(VECTORSCOPE_SIZE, VECTORSCOPE_SIZE),
waveformScale(0),
waveformRed(0, 0),
waveformGreen(0, 0),
waveformBlue(0, 0),
@@ -1861,8 +1863,9 @@ void ImProcCoordinator::updateVectorscope()
memset((int*)vectorscope, 0, size * size * sizeof(vectorscope[0][0]));
const int lab_img_size = (hListener->vectorscopeType() == 1) ? (x2 - x1) * (y2 - y1) : 0;
float L[lab_img_size], a[lab_img_size], b[lab_img_size];
float a[lab_img_size], b[lab_img_size];
if (lab_img_size) {
float L[lab_img_size];
ipf.rgb2lab(*workimg, x1, y1, x2 - x1, y2 - y1, L, a, b, params->icm);
}
@@ -1874,11 +1877,11 @@ void ImProcCoordinator::updateVectorscope()
switch (hListener->vectorscopeType()) {
case 0: {
// HS
int r = 256 * workimg->data[ofs++];
int g = 256 * workimg->data[ofs++];
int b = 256 * workimg->data[ofs++];
int red = 256 * workimg->data[ofs++];
int green = 256 * workimg->data[ofs++];
int blue = 256 * workimg->data[ofs++];
float h, s, l;
Color::rgb2hsl(r, g, b, h, s, l);
Color::rgb2hsl(red, green, blue, h, s, l);
const int col = s * cos(2 * RT_PI * h) * (size / 2) + size / 2;
const int row = s * sin(2 * RT_PI * h) * (size / 2) + size / 2;
if (col >= 0 && col < size && row >= 0 && row < size) {

View File

@@ -886,8 +886,10 @@ void HistogramRGBAreaVert::get_preferred_width_for_height_vfunc (int height, int
//
// HistogramArea
HistogramArea::HistogramArea (DrawModeListener *fml) :
vectorscope_scale(0),
vect(0, 0),
vect_buffer_dirty(true), vect_buffer_size(0),
waveform_scale(0),
rwave(0, 0), gwave(0, 0),bwave(0, 0), lwave(0, 0),
wave_buffer_dirty(true),
valid(false), drawMode(options.histogramDrawMode), myDrawModeListener(fml),
@@ -1492,7 +1494,7 @@ void HistogramArea::drawWaveform(Cairo::RefPtr<Cairo::Context> &cr, int w, int h
const unsigned char g = needGreen ? min<float>(scale * g_row[col], 0xff) : 0;
const unsigned char b = needBlue ? min<float>(scale * b_row[col], 0xff) : 0;
const unsigned char value = (r > g && r > b) ? r : ((g > b) ? g : b);
if (value <= 0) {
if (value == 0) {
buffer_row[col] = 0;
} else {
// Speedup with one memory access instead of four.