Auto distortion fix for portrait orientation on behalf of Guokai; see issue #582

This commit is contained in:
Michael Ezra
2011-03-14 23:10:02 -04:00
parent 67debe3a30
commit 5249a7cfad
4 changed files with 10 additions and 10 deletions

View File

@@ -692,11 +692,11 @@ double ImProcFunctions::getAutoDistor (const Glib::ustring &fname, int thumb_si
int w_raw=-1, h_raw=thumb_size; int w_raw=-1, h_raw=thumb_size;
int w_thumb=-1, h_thumb=thumb_size; int w_thumb=-1, h_thumb=thumb_size;
Thumbnail* thumb = rtengine::Thumbnail::loadQuickFromRaw (fname, ri, w_thumb, h_thumb, 1); Thumbnail* thumb = rtengine::Thumbnail::loadQuickFromRaw (fname, ri, w_thumb, h_thumb, 1, FALSE);
if (thumb == NULL) if (thumb == NULL)
return 0.0; return 0.0;
Thumbnail* raw = rtengine::Thumbnail::loadFromRaw (fname, ri, w_raw, h_raw, 1); Thumbnail* raw = rtengine::Thumbnail::loadFromRaw (fname, ri, w_raw, h_raw, 1, FALSE);
if (raw == NULL) { if (raw == NULL) {
delete thumb; delete thumb;
return 0.0; return 0.0;

View File

@@ -131,7 +131,7 @@ Thumbnail* Thumbnail::loadFromImage (const Glib::ustring& fname, int &w, int &h,
return tpp; return tpp;
} }
Thumbnail* Thumbnail::loadQuickFromRaw (const Glib::ustring& fname, RawMetaDataLocation& rml, int &w, int &h, int fixwh) Thumbnail* Thumbnail::loadQuickFromRaw (const Glib::ustring& fname, RawMetaDataLocation& rml, int &w, int &h, int fixwh, bool rotate)
{ {
RawImage *ri= new RawImage(fname); RawImage *ri= new RawImage(fname);
int r = ri->loadRaw(false,false); int r = ri->loadRaw(false,false);
@@ -210,7 +210,7 @@ Thumbnail* Thumbnail::loadQuickFromRaw (const Glib::ustring& fname, RawMetaDataL
tpp->autowbTemp=2700; tpp->autowbTemp=2700;
tpp->autowbGreen=1.0; tpp->autowbGreen=1.0;
if (ri->get_rotateDegree() > 0) { if (rotate && ri->get_rotateDegree() > 0) {
Image16* rot = tpp->thumbImg->rotate(ri->get_rotateDegree()); Image16* rot = tpp->thumbImg->rotate(ri->get_rotateDegree());
delete tpp->thumbImg; delete tpp->thumbImg;
tpp->thumbImg = rot; tpp->thumbImg = rot;
@@ -229,7 +229,7 @@ Thumbnail* Thumbnail::loadQuickFromRaw (const Glib::ustring& fname, RawMetaDataL
#define FISBLUE(filter,row,col) \ #define FISBLUE(filter,row,col) \
((filter >> ((((row) << 1 & 14) + ((col) & 1)) << 1) & 3)==2 || !filter) ((filter >> ((((row) << 1 & 14) + ((col) & 1)) << 1) & 3)==2 || !filter)
Thumbnail* Thumbnail::loadFromRaw (const Glib::ustring& fname, RawMetaDataLocation& rml, int &w, int &h, int fixwh) Thumbnail* Thumbnail::loadFromRaw (const Glib::ustring& fname, RawMetaDataLocation& rml, int &w, int &h, int fixwh, bool rotate)
{ {
RawImage *ri= new RawImage (fname); RawImage *ri= new RawImage (fname);
int r = ri->loadRaw(); int r = ri->loadRaw();
@@ -465,7 +465,7 @@ Thumbnail* Thumbnail::loadFromRaw (const Glib::ustring& fname, RawMetaDataLocati
ColorTemp::mul2temp(rm, gm, bm, tpp->autowbTemp, tpp->autowbGreen); ColorTemp::mul2temp(rm, gm, bm, tpp->autowbTemp, tpp->autowbGreen);
if (ri->get_rotateDegree() > 0) { if (rotate && ri->get_rotateDegree() > 0) {
Image16* rot = tpp->thumbImg->rotate(ri->get_rotateDegree()); Image16* rot = tpp->thumbImg->rotate(ri->get_rotateDegree());
delete tpp->thumbImg; delete tpp->thumbImg;
tpp->thumbImg = rot; tpp->thumbImg = rot;

View File

@@ -75,8 +75,8 @@ namespace rtengine {
int getImageWidth (const procparams::ProcParams& pparams, int rheight); int getImageWidth (const procparams::ProcParams& pparams, int rheight);
void getFinalSize (const rtengine::procparams::ProcParams& pparams, int& w, int& h); void getFinalSize (const rtengine::procparams::ProcParams& pparams, int& w, int& h);
static Thumbnail* loadQuickFromRaw (const Glib::ustring& fname, rtengine::RawMetaDataLocation& rml, int &w, int &h, int fixwh); static Thumbnail* loadQuickFromRaw (const Glib::ustring& fname, rtengine::RawMetaDataLocation& rml, int &w, int &h, int fixwh, bool rotate);
static Thumbnail* loadFromRaw (const Glib::ustring& fname, RawMetaDataLocation& rml, int &w, int &h, int fixwh); static Thumbnail* loadFromRaw (const Glib::ustring& fname, RawMetaDataLocation& rml, int &w, int &h, int fixwh, bool rotate);
static Thumbnail* loadFromImage (const Glib::ustring& fname, int &w, int &h, int fixwh); static Thumbnail* loadFromImage (const Glib::ustring& fname, int &w, int &h, int fixwh);
void getCamWB (double& temp, double& green); void getCamWB (double& temp, double& green);

View File

@@ -110,12 +110,12 @@ void Thumbnail::_generateThumbnailImage () {
if ( initial_ && options.internalThumbIfUntouched) if ( initial_ && options.internalThumbIfUntouched)
{ {
quick = true; quick = true;
tpp = rtengine::Thumbnail::loadQuickFromRaw (fname, ri, tw, th, 1); tpp = rtengine::Thumbnail::loadQuickFromRaw (fname, ri, tw, th, 1, TRUE);
} }
if ( tpp == 0 ) if ( tpp == 0 )
{ {
quick = false; quick = false;
tpp = rtengine::Thumbnail::loadFromRaw (fname, ri, tw, th, 1); tpp = rtengine::Thumbnail::loadFromRaw (fname, ri, tw, th, 1, TRUE);
} }
if (tpp) { if (tpp) {
cfs.format = FT_Raw; cfs.format = FT_Raw;