Buffer underrun in RGB denoise, Issue 2337. Could also fix 'Crash when creating detail window, Issue 2324' (Thanks to Hombre)

This commit is contained in:
Ingo 2014-04-09 23:59:26 +02:00
parent 51e80b8c03
commit 832c8b6c25
4 changed files with 11 additions and 3 deletions

View File

@ -298,8 +298,8 @@ namespace rtengine {
dstLo[(pitch*(i))] = 0.5*(srcbuffer[i] + srcbuffer[i+skip]);
dstHi[(pitch*(i))] = 0.5*(srcbuffer[i] - srcbuffer[i+skip]);
}
for(size_t i = (srclen-skip); i < (srclen); i++) {
// Start the loop at max(srclen-skip,skip) to avoid buffer underrun
for(size_t i = max(srclen-skip,skip); i < (srclen); i++) {
dstLo[(pitch*(i))] = 0.5*(srcbuffer[i] + srcbuffer[i-skip]);
dstHi[(pitch*(i))] = 0.5*(srcbuffer[i] - srcbuffer[i-skip]);
}

View File

@ -108,11 +108,14 @@ CropWindow::CropWindow (ImageArea* parent, rtengine::StagedImageProcessor* ipc_,
cropHandler.setCropHandlerListener (this);
cropHandler.newImage (ipc_);
cropHandler.setEnabled (true);
state = SNormal;
}
void CropWindow::enable() {
cropHandler.setEnabled (true);
}
void CropWindow::setPosition (int x, int y) {
if (y<0)

View File

@ -120,6 +120,7 @@ class CropWindow : public LWButtonListener, public CropHandlerListener, public E
void getPosition (int& x, int& y);
void setSize (int w, int h, bool norefresh=false);
void getSize (int& w, int& h);
void enable ();
void leaveNotify (GdkEventCrossing* event);
void flawnOver (bool isFlawnOver);

View File

@ -93,6 +93,7 @@ void ImageArea::on_resized (Gtk::Allocation& req) {
mainCropWindow->setPointerMotionHListener (pmhlistener);
mainCropWindow->setPosition (0, 0);
mainCropWindow->setSize (get_width(), get_height(), false); // this execute the refresh itself
mainCropWindow->enable(); // start processing !
}
else {
mainCropWindow->setSize (get_width(), get_height());
@ -386,6 +387,9 @@ void ImageArea::addCropWindow () {
cw->setPosition (lastClosedX, lastClosedY);
lastClosedX = -1;
}
cw->enable(); // start processing!
int x0,y0,w,h,wc,hc;
mainCropWindow->getCropRectangle(x0,y0,w,h );
cw->getCropSize(wc,hc);