Merge branch 'master' into gtk3
This commit is contained in:
@@ -274,37 +274,37 @@ public:
|
||||
{
|
||||
return profile_data;
|
||||
}
|
||||
IMFILE *get_file()
|
||||
IMFILE *get_file() const
|
||||
{
|
||||
return ifp;
|
||||
}
|
||||
bool is_supportedThumb() const ;
|
||||
bool is_jpegThumb() const ;
|
||||
bool is_ppmThumb() const ;
|
||||
int get_thumbOffset()
|
||||
int get_thumbOffset() const
|
||||
{
|
||||
return int(thumb_offset);
|
||||
}
|
||||
int get_thumbWidth()
|
||||
int get_thumbWidth() const
|
||||
{
|
||||
return int(thumb_width);
|
||||
}
|
||||
int get_thumbHeight()
|
||||
int get_thumbHeight() const
|
||||
{
|
||||
return int(thumb_height);
|
||||
}
|
||||
int get_thumbBPS()
|
||||
int get_thumbBPS() const
|
||||
{
|
||||
return thumb_load_raw ? 16 : 8;
|
||||
}
|
||||
bool get_thumbSwap() const;
|
||||
unsigned get_thumbLength()
|
||||
unsigned get_thumbLength() const
|
||||
{
|
||||
return thumb_length;
|
||||
}
|
||||
bool zeroIsBad()
|
||||
bool zeroIsBad() const
|
||||
{
|
||||
return zero_is_bad == 1 ? true : false;
|
||||
return zero_is_bad == 1;
|
||||
}
|
||||
|
||||
public:
|
||||
|
@@ -41,6 +41,25 @@
|
||||
#include "StopWatch.h"
|
||||
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
bool checkRawImageThumb(const rtengine::RawImage& raw_image)
|
||||
{
|
||||
if (!raw_image.is_supportedThumb()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const std::size_t length =
|
||||
fdata(raw_image.get_thumbOffset(), raw_image.get_file())[1] != 0xD8 && raw_image.is_ppmThumb()
|
||||
? raw_image.get_thumbWidth() * raw_image.get_thumbHeight() * (raw_image.get_thumbBPS() / 8) * 3
|
||||
: raw_image.get_thumbLength();
|
||||
|
||||
return raw_image.get_thumbOffset() + length < raw_image.get_file()->size;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
extern Options options;
|
||||
|
||||
namespace rtengine
|
||||
@@ -175,8 +194,8 @@ Thumbnail* Thumbnail::loadQuickFromRaw (const Glib::ustring& fname, RawMetaDataL
|
||||
|
||||
int err = 1;
|
||||
|
||||
// see if it is something we support
|
||||
if ( ri->is_supportedThumb() && ri->get_thumbOffset() < ri->get_file()->size ) {
|
||||
// See if it is something we support
|
||||
if (checkRawImageThumb(*ri)) {
|
||||
const char* data((const char*)fdata(ri->get_thumbOffset(), ri->get_file()));
|
||||
|
||||
if ( (unsigned char)data[1] == 0xd8 ) {
|
||||
@@ -491,6 +510,17 @@ Thumbnail* Thumbnail::loadFromRaw (const Glib::ustring& fname, RawMetaDataLocati
|
||||
tmph = high;
|
||||
}
|
||||
|
||||
const bool rotate_90 =
|
||||
rotate
|
||||
&& (
|
||||
ri->get_rotateDegree() == 90
|
||||
|| ri->get_rotateDegree() == 270
|
||||
);
|
||||
|
||||
if (rotate_90) {
|
||||
std::swap(tmpw, tmph);
|
||||
}
|
||||
|
||||
if (fixwh == 1) { // fix height, scale width
|
||||
w = tmpw * h / tmph;
|
||||
} else {
|
||||
@@ -501,8 +531,11 @@ Thumbnail* Thumbnail::loadFromRaw (const Glib::ustring& fname, RawMetaDataLocati
|
||||
delete tpp->thumbImg;
|
||||
}
|
||||
|
||||
tpp->thumbImg = nullptr;
|
||||
tpp->thumbImg = resizeTo<Image16>(w, h, TI_Bilinear, tmpImg);
|
||||
if (rotate_90) {
|
||||
tpp->thumbImg = resizeTo<Image16>(h, w, TI_Bilinear, tmpImg);
|
||||
} else {
|
||||
tpp->thumbImg = resizeTo<Image16>(w, h, TI_Bilinear, tmpImg);
|
||||
}
|
||||
delete tmpImg;
|
||||
|
||||
|
||||
|
@@ -2110,9 +2110,14 @@ void CropWindow::updateHoveredPicker (rtengine::Coord *imgPos)
|
||||
}
|
||||
LockableColorPicker::Validity validity = checkValidity (hoveredPicker, cropPos);
|
||||
hoveredPicker->setValidity (validity);
|
||||
if (validity == LockableColorPicker::Validity::INSIDE) {
|
||||
cropHandler.colorPick(cropPos, r, g, b, rpreview, gpreview, bpreview, hoveredPicker->getSize());
|
||||
hoveredPicker->setRGB (r, g, b, rpreview, gpreview, bpreview);
|
||||
|
||||
{
|
||||
MyMutex::MyLock lock(cropHandler.cimg);
|
||||
|
||||
if (validity == LockableColorPicker::Validity::INSIDE) {
|
||||
cropHandler.colorPick(cropPos, r, g, b, rpreview, gpreview, bpreview, hoveredPicker->getSize());
|
||||
hoveredPicker->setRGB (r, g, b, rpreview, gpreview, bpreview);
|
||||
}
|
||||
}
|
||||
}
|
||||
void CropWindow::changeZoom (int zoom, bool notify, int centerx, int centery)
|
||||
@@ -2477,6 +2482,7 @@ void CropWindow::drawObservedFrame (Cairo::RefPtr<Cairo::Context> cr, int rw, in
|
||||
|
||||
void CropWindow::cropImageUpdated ()
|
||||
{
|
||||
MyMutex::MyLock lock(cropHandler.cimg);
|
||||
|
||||
for (auto colorPicker : colorPickers) {
|
||||
Coord imgPos, cropPos;
|
||||
|
Reference in New Issue
Block a user