merge with dev

This commit is contained in:
Desmis 2019-07-09 18:26:41 +02:00
commit e3962ff8dc
13 changed files with 137 additions and 122 deletions

View File

@ -563,7 +563,7 @@ public:
} }
} }
// compress a LUT<uint32_t> with size y into a LUT<uint32_t> with size x (y>x) by using the passTrough LUT to calculate indexes // compress a LUT<uint32_t> with size y into a LUT<uint32_t> with size x (y>x) by using the passThrough LUT to calculate indexes
template<typename U = T, typename = typename std::enable_if<std::is_same<U, std::uint32_t>::value>::type> template<typename U = T, typename = typename std::enable_if<std::is_same<U, std::uint32_t>::value>::type>
void compressTo(LUT<T> &dest, unsigned int numVals, const LUT<float> &passThrough) const void compressTo(LUT<T> &dest, unsigned int numVals, const LUT<float> &passThrough) const
{ {

View File

@ -2461,7 +2461,7 @@ Camera constants:
"raw_crop": [ 0, 0, -8, 0 ] // 8 rightmost columns are garbage "raw_crop": [ 0, 0, -8, 0 ] // 8 rightmost columns are garbage
}, },
{ // Quality C { // Quality B
"make_model": [ "Sony DSC-R1" ], "make_model": [ "Sony DSC-R1" ],
"raw_crop": [ 0, 0, 3924, 2608 ], "raw_crop": [ 0, 0, 3924, 2608 ],
"ranges": { "white": 16368 } "ranges": { "white": 16368 }

View File

@ -1569,8 +1569,8 @@ public:
static const float C9 = 8.f, C8 = 15.f, C7 = 12.f, C4 = 7.f, C3 = 5.f, C2 = 5.f, C1 = 5.f; static const float C9 = 8.f, C8 = 15.f, C7 = 12.f, C4 = 7.f, C3 = 5.f, C2 = 5.f, C1 = 5.f;
static const float H9 = 0.05f, H8 = 0.25f, H7 = 0.1f, H4 = 0.02f, H3 = 0.02f, H2 = 0.1f, H1 = 0.1f, H10 = -0.2f, H11 = -0.2f; static const float H9 = 0.05f, H8 = 0.25f, H7 = 0.1f, H4 = 0.02f, H3 = 0.02f, H2 = 0.1f, H1 = 0.1f, H10 = -0.2f, H11 = -0.2f;
// "real" skin color : take into account a slightly usage of contrast and saturation in RT if option "skin" = 1, uses imolicit factor 1.0 // "real" skin color : take into account a slight usage of contrast and saturation in RT if option "skin" = 1, uses implicit factor 1.0
// wide area skin color, useful if not accurate colorimetry or if the user has changed hue and saturation, uses explicit facor 0.6 // wide area skin color, useful if not accurate colorimetry or if the user has changed hue and saturation, uses explicit factor 0.6
// wide area for transition, uses explicit factor 0.4 // wide area for transition, uses explicit factor 0.4
if (lum >= 85.0f) { if (lum >= 85.0f) {
@ -1648,8 +1648,8 @@ public:
static const float C9 = 8.f, C8 = 15.f, C7 = 12.f, C4 = 7.f, C3 = 5.f, C2 = 5.f, C1 = 5.f; static const float C9 = 8.f, C8 = 15.f, C7 = 12.f, C4 = 7.f, C3 = 5.f, C2 = 5.f, C1 = 5.f;
static const float H9 = 0.05f, H8 = 0.25f, H7 = 0.1f, H4 = 0.02f, H3 = 0.02f, H2 = 0.1f, H1 = 0.1f, H10 = -0.2f, H11 = -0.2f; static const float H9 = 0.05f, H8 = 0.25f, H7 = 0.1f, H4 = 0.02f, H3 = 0.02f, H2 = 0.1f, H1 = 0.1f, H10 = -0.2f, H11 = -0.2f;
// "real" skin color : take into account a slightly usage of contrast and saturation in RT if option "skin" = 1, uses imolicit factor 1.0 // "real" skin color : take into account a slight usage of contrast and saturation in RT if option "skin" = 1, uses implicit factor 1.0
// wide area skin color, useful if not accurate colorimetry or if the user has changed hue and saturation, uses explicit facor 0.6 // wide area skin color, useful if not accurate colorimetry or if the user has changed hue and saturation, uses explicit factor 0.6
// wide area for transition, uses explicit factor 0.4 // wide area for transition, uses explicit factor 0.4
if ((b_l > -0.3f && b_r < 2.f) || basc == 0) { //range maxi skin if ((b_l > -0.3f && b_r < 2.f) || basc == 0) { //range maxi skin
if (lum >= 85.0f) { if (lum >= 85.0f) {
@ -1764,8 +1764,8 @@ public:
hue = HH; hue = HH;
// "real" skin color : take into account a slightly usage of contrast and saturation in RT if option "skin" = 1, uses imolicit factor 1.0 // "real" skin color : take into account a slight usage of contrast and saturation in RT if option "skin" = 1, uses implicit factor 1.0
// wide area skin color, useful if not accurate colorimetry or if the user has changed hue and saturation, uses explicit facor 0.6 // wide area skin color, useful if not accurate colorimetry or if the user has changed hue and saturation, uses explicit factor 0.6
// wide area for transition, uses explicit factor 0.4 // wide area for transition, uses explicit factor 0.4
if (lum >= 85.0f) { if (lum >= 85.0f) {

View File

@ -257,7 +257,7 @@ void dfInfo::updateBadPixelList( RawImage *df )
} }
if( df->data[row][3 * col] > m[0]*threshold || df->data[row][3 * col + 1] > m[1]*threshold || df->data[row][3 * col + 2] > m[2]*threshold) { if( df->data[row][3 * col] > m[0]*threshold || df->data[row][3 * col + 1] > m[1]*threshold || df->data[row][3 * col + 2] > m[2]*threshold) {
badPixels.push_back( badPix(col, row) ); badPixels.emplace_back(col, row);
} }
} }
} }
@ -571,7 +571,7 @@ int DFManager::scanBadPixelsFile( Glib::ustring filename )
while( fgets(line, sizeof(line), file ) ) { while( fgets(line, sizeof(line), file ) ) {
if( sscanf(line, "%d %d", &x, &y) == 2 ) { if( sscanf(line, "%d %d", &x, &y) == 2 ) {
bp.push_back( badPix(x + offset, y + offset) ); bp.emplace_back(x + offset, y + offset);
} }
} }
} }
@ -592,7 +592,7 @@ std::vector<badPix> *DFManager::getBadPixels ( const std::string &mak, const std
bool found = false; bool found = false;
if( !serial.empty() ) { if( !serial.empty() ) {
// search with sreial number first // search with serial number first
std::ostringstream s; std::ostringstream s;
s << mak << " " << mod << " " << serial; s << mak << " " << mod << " " << serial;
iter = bpList.find( s.str() ); iter = bpList.find( s.str() );

View File

@ -18,9 +18,11 @@
*/ */
#include "pipettebuffer.h" #include "pipettebuffer.h"
#include "../rtgui/editcallbacks.h"
#include "imagefloat.h" #include "imagefloat.h"
#include "../rtgui/editcallbacks.h"
namespace rtengine namespace rtengine
{ {

View File

@ -16,13 +16,16 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with RawTherapee. If not, see <http://www.gnu.org/licenses/>. * along with RawTherapee. If not, see <http://www.gnu.org/licenses/>.
*/ */
#ifndef _PIPETTEBUFFER_H_ #pragma once
#define _PIPETTEBUFFER_H_
#include "../rtgui/editbuffer.h"
#include "array2D.h" #include "array2D.h"
#include "iimage.h"
#include "coord.h" #include "coord.h"
#include "iimage.h"
class EditDataProvider;
class EditSubscriber;
enum EditUniqueID : int;
namespace rtengine namespace rtengine
{ {
@ -90,9 +93,7 @@ public:
bool bufferCreated(); bool bufferCreated();
// get the pipette values // get the pipette values
void getPipetteData(int x, int y, const int squareSize); void getPipetteData(int x, int y, int squareSize);
}; };
} }
#endif

View File

@ -21,7 +21,7 @@
/// @brief List of pipette editing operation /// @brief List of pipette editing operation
enum EditUniqueID { enum EditUniqueID : int {
EUID_None, /// special value (default) EUID_None, /// special value (default)
EUID_ToneCurve1, EUID_ToneCurve1,

View File

@ -16,12 +16,16 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with RawTherapee. If not, see <http://www.gnu.org/licenses/>. * along with RawTherapee. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "mydiagonalcurve.h"
#include "../rtengine/curves.h"
#include "editcallbacks.h"
#include <cstring> #include <cstring>
#include <gdkmm/types.h> #include <gdkmm/types.h>
#include "mydiagonalcurve.h"
#include "editcallbacks.h"
#include "../rtengine/curves.h"
MyDiagonalCurve::MyDiagonalCurve () : MyDiagonalCurve::MyDiagonalCurve () :
MyCurve(), MyCurve(),
closest_point(0), closest_point(0),

View File

@ -16,12 +16,16 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with RawTherapee. If not, see <http://www.gnu.org/licenses/>. * along with RawTherapee. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "myflatcurve.h"
#include "../rtengine/curves.h"
#include "editcallbacks.h"
#include <cstring> #include <cstring>
#include <gdkmm/types.h> #include <gdkmm/types.h>
#include "myflatcurve.h"
#include "editcallbacks.h"
#include "../rtengine/curves.h"
MyFlatCurve::MyFlatCurve () : MyFlatCurve::MyFlatCurve () :
MyCurve(), MyCurve(),
clampedX(0.0), clampedX(0.0),

View File

@ -19,66 +19,110 @@
#include <iostream> #include <iostream>
#include "options.h"
#include "rtsurface.h" #include "rtsurface.h"
#include "options.h"
namespace namespace
{ {
std::map<std::string, Cairo::RefPtr<Cairo::ImageSurface>> surfaceCache; using SurfaceCache = std::map<std::string, Cairo::RefPtr<Cairo::ImageSurface>>;
SurfaceCache surfaceCache;
} }
double RTSurface::dpiBack = 0.; RTSurface::RTSurface() :
int RTSurface::scaleBack = 0; surface(new Cairo::ImageSurface(nullptr, false))
RTSurface::RTSurface () : RTScalable()
{ {
Cairo::RefPtr<Cairo::ImageSurface> imgSurf(new Cairo::ImageSurface(nullptr, false));
surface = imgSurf;
} }
RTSurface::RTSurface(const RTSurface& other) : RTScalable() RTSurface::RTSurface(const Glib::ustring& fileName, const Glib::ustring& rtlFileName) :
RTSurface()
{ {
surface = other.surface; setImage(fileName, rtlFileName);
} }
RTSurface::RTSurface (Glib::ustring fileName, Glib::ustring rtlFileName) : RTScalable() void RTSurface::setImage(const Glib::ustring& fileName, const Glib::ustring& rtlFileName)
{ {
Cairo::RefPtr<Cairo::ImageSurface> imgSurf(new Cairo::ImageSurface(nullptr, false)); const Glib::ustring& imageName =
surface = imgSurf; !rtlFileName.empty() && getDirection() == Gtk::TEXT_DIR_RTL
setImage (fileName, rtlFileName); ? rtlFileName
} : fileName;
void RTSurface::setImage (Glib::ustring fileName, Glib::ustring rtlFileName)
{
Glib::ustring imageName;
if (!rtlFileName.empty() && getDirection() == Gtk::TEXT_DIR_RTL) {
imageName = rtlFileName;
} else {
imageName = fileName;
}
changeImage (imageName); changeImage (imageName);
} }
void RTSurface::setDPInScale (const double newDPI, const int newScale) int RTSurface::getWidth() const
{
return
surface
? surface->get_width()
: -1;
}
int RTSurface::getHeight() const
{
return
surface
? surface->get_height()
: -1;
}
bool RTSurface::hasSurface() const
{
return static_cast<bool>(surface);
}
Cairo::RefPtr<const Cairo::ImageSurface> RTSurface::get() const
{
return surface;
}
const Cairo::RefPtr<Cairo::ImageSurface>& RTSurface::get()
{
return surface;
}
void RTSurface::init()
{ {
if (getScale() != newScale || (getScale() == 1 && getDPI() != newDPI)) {
RTScalable::setDPInScale(newDPI, newScale);
dpiBack = getDPI(); dpiBack = getDPI();
scaleBack = getScale(); scaleBack = getScale();
//printf("RTSurface::setDPInScale : New scale = %d & new DPI = %.3f (%.3f asked) -> Reloading all RTSurface\n", scaleBack, dpiBack, newDPI); }
void RTSurface::updateImages()
{
const double tweakedDpi = getTweakedDPI();
for (auto& entry : surfaceCache) {
entry.second = loadImage(entry.first, tweakedDpi);
}
}
void RTSurface::setDPInScale(const double newDPI, const int newScale)
{
if (
getScale() != newScale
|| (
getScale() == 1
&& getDPI() != newDPI
)
) {
setDPInScale(newDPI, newScale);
dpiBack = getDPI();
scaleBack = getScale();
updateImages(); updateImages();
} }
} }
void RTSurface::changeImage (Glib::ustring imageName) void RTSurface::changeImage(const Glib::ustring& imageName)
{ {
auto iterator = surfaceCache.find (imageName); const SurfaceCache::const_iterator iterator = surfaceCache.find(imageName);
if (iterator == surfaceCache.end ()) { if (iterator != surfaceCache.end()) {
surface = iterator->second;
} else {
surface = loadImage(imageName, getTweakedDPI()); surface = loadImage(imageName, getTweakedDPI());
// HOMBRE: As of now, GDK_SCALE is forced to 1, so setting the Cairo::ImageSurface scale is not required // HOMBRE: As of now, GDK_SCALE is forced to 1, so setting the Cairo::ImageSurface scale is not required
@ -92,48 +136,10 @@ void RTSurface::changeImage (Glib::ustring imageName)
} }
*/ */
iterator = surfaceCache.emplace (imageName, surface).first; surfaceCache.emplace(imageName, surface);
}
surface = iterator->second;
}
int RTSurface::getWidth() const
{
return surface ? surface->get_width() : -1;
}
int RTSurface::getHeight() const
{
return surface ? surface->get_height() : -1;
}
void RTSurface::init()
{
dpiBack = RTScalable::getDPI();
scaleBack = RTScalable::getScale();
}
void RTSurface::updateImages()
{
double res = getTweakedDPI();
for (auto entry : surfaceCache) {
entry.second = loadImage(entry.first, res);
//printf("RTSurface::updateImages : %s\n", entry.first.c_str());
} }
} }
void RTSurface::from(Glib::RefPtr<RTSurface> other) double RTSurface::dpiBack = 0.;
{
surface = other->surface;
}
bool RTSurface::hasSurface() const int RTSurface::scaleBack = 0;
{
return surface ? true : false;
}
const Cairo::RefPtr<Cairo::ImageSurface>& RTSurface::get() const
{
return surface;
}

View File

@ -19,38 +19,36 @@
#pragma once #pragma once
#include <gtkmm/image.h> #include <gtkmm/image.h>
#include "rtscalable.h" #include "rtscalable.h"
/** /**
* @brief A derived class of Gtk::Image in order to handle theme-related icon sets. * @brief A derived class of Gtk::Image in order to handle theme-related icon sets.
*/ */
class RTSurface : public RTScalable class RTSurface :
public RTScalable
{ {
private:
static double dpiBack; // used to keep track of master dpi change
static int scaleBack; // used to keep track of master scale change
Cairo::RefPtr<Cairo::ImageSurface> surface;
void changeImage (Glib::ustring imageName);
public: public:
RTSurface();
RTSurface(const Glib::ustring& fileName, const Glib::ustring& rtlFileName = {});
RTSurface (); void setImage(const Glib::ustring& fileName, const Glib::ustring& rtlFileName = {});
RTSurface (const RTSurface& other);
RTSurface (Glib::ustring fileName, Glib::ustring rtlFileName = Glib::ustring());
void setImage (Glib::ustring fileName, Glib::ustring rtlFileName = Glib::ustring());
int getWidth() const; int getWidth() const;
int getHeight() const; int getHeight() const;
bool hasSurface() const; bool hasSurface() const;
const Cairo::RefPtr<Cairo::ImageSurface>& get() const; Cairo::RefPtr<const Cairo::ImageSurface> get() const;
const Cairo::RefPtr<Cairo::ImageSurface>& get();
static void init(); static void init();
static void updateImages (); static void updateImages();
static void setDPInScale (const double newDPI, const int newScale); static void setDPInScale(double newDPI, int newScale);
static void setScale (const int newScale);
void from(Glib::RefPtr<RTSurface> other); private:
void changeImage(const Glib::ustring& imageName);
static double dpiBack; // used to keep track of master dpi change
static int scaleBack; // used to keep track of master scale change
Cairo::RefPtr<Cairo::ImageSurface> surface;
}; };