Replace raw arrays with std::array<>

This commit is contained in:
Flössie
2019-06-14 08:58:04 +02:00
parent 015cffc73a
commit 80f2b6a002
10 changed files with 46 additions and 42 deletions

View File

@@ -281,8 +281,8 @@ bool FilmNegative::button1Pressed(int modifierKey)
// User has selected 2 reference gray spots. Calculating new exponents
// from channel values and updating parameters.
float newExps[3];
if(fnp->getFilmNegativeExponents(refSpotCoords[0], refSpotCoords[1], newExps)) {
std::array<float, 3> newExps;
if (fnp->getFilmNegativeExponents(refSpotCoords[0], refSpotCoords[1], newExps)) {
disableListener();
redExp->setValue(newExps[0]);
greenExp->setValue(newExps[1]);
@@ -335,4 +335,4 @@ void FilmNegative::switchOffEditMode ()
refSpotCoords.clear();
unsubscribe();
spotbutton->set_active(false);
}
}

View File

@@ -16,23 +16,25 @@
* You should have received a copy of the GNU General Public License
* along with RawTherapee. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _NEG_H_
#define _NEG_H_
#pragma once
#include <array>
#include <gtkmm.h>
#include "toolpanel.h"
#include "adjuster.h"
#include "guiutils.h"
#include "wbprovider.h"
#include "editcallbacks.h"
#include "../rtengine/procparams.h"
#include "adjuster.h"
#include "editcallbacks.h"
#include "guiutils.h"
#include "toolpanel.h"
#include "wbprovider.h"
#include "../rtengine/procparams.h"
class FilmNegProvider
{
public:
virtual ~FilmNegProvider() = default;
virtual bool getFilmNegativeExponents(rtengine::Coord spotA, rtengine::Coord spotB, float* newExps) = 0;
virtual bool getFilmNegativeExponents(rtengine::Coord spotA, rtengine::Coord spotB, std::array<float, 3>& newExps) = 0;
};
class FilmNegative : public ToolParamBlock, public AdjusterListener, public FoldableToolPanel, public EditSubscriber
@@ -89,5 +91,3 @@ public:
bool pick1(bool picked) override;
};
#endif

View File

@@ -1023,7 +1023,7 @@ void ToolPanelCoordinator::setEditProvider (EditDataProvider *provider)
}
}
bool ToolPanelCoordinator::getFilmNegativeExponents(rtengine::Coord spotA, rtengine::Coord spotB, float* newExps)
bool ToolPanelCoordinator::getFilmNegativeExponents(rtengine::Coord spotA, rtengine::Coord spotB, std::array<float, 3>& newExps)
{
return ipc && ipc->getFilmNegativeExponents(spotA.x, spotA.y, spotB.x, spotB.y, newExps);
}

View File

@@ -292,7 +292,7 @@ public:
Glib::ustring GetCurrentImageFilePath() override;
// FilmNegProvider interface
bool getFilmNegativeExponents(rtengine::Coord spotA, rtengine::Coord spotB, float* newExps) override;
bool getFilmNegativeExponents(rtengine::Coord spotA, rtengine::Coord spotB, std::array<float, 3>& newExps) override;
// rotatelistener interface
void straightenRequested () override;