Automatic high detail preview rendering when entering 100% views

See issue 838
This commit is contained in:
Oliver Duis
2011-07-14 13:57:32 +02:00
parent 4b4bf4b79e
commit 091cc56a01
11 changed files with 85 additions and 47 deletions

View File

@@ -21,6 +21,7 @@
#include <cstring>
#include <guiutils.h>
#include <refreshmap.h>
using namespace rtengine;
@@ -97,6 +98,9 @@ void CropHandler::setZoom (int z, int centerx, int centery) {
if (centery>=0)
y = centery;
// maybe demosaic etc. if we cross the border to >100%
bool needsFullRefresh = (z>=1000 && zoom<1000);
zoom = z;
if (zoom>=1000) {
cw = ww * 1000 / zoom;
@@ -110,9 +114,13 @@ void CropHandler::setZoom (int z, int centerx, int centery) {
cy = y - ch / 2;
compDim ();
if (enabled)
if (enabled) {
if (needsFullRefresh)
ipc->startProcessing(M_HIGHQUAL);
else
update ();
}
}
void CropHandler::setWSize (int w, int h) {

View File

@@ -790,6 +790,7 @@ void CropWindow::expose (Cairo::RefPtr<Cairo::Context> cr) {
// printf ("etime --> %d, %d\n", t2.etime (t1), t4.etime (t3));
}
// zoom* is called from the zoomPanel
void CropWindow::zoomIn () {
changeZoom (cropZoom+1);
@@ -867,10 +868,12 @@ void CropWindow::changeZoom (int zoom, bool notify, int centerx, int centery) {
zoom = 0;
else if (zoom>MAXZOOMSTEPS)
zoom = MAXZOOMSTEPS;
if (cropZoom == zoom)
if (cropZoom == zoom) {
// We are already at the start/end of the zoom range, so we do nothing
return;
else
}
cropZoom = zoom;
cropLabel = zoomSteps[cropZoom].label;

View File

@@ -1206,7 +1206,7 @@ void EditorPanel::historyBeforeLineChanged (const rtengine::procparams::ProcPara
if (beforeIpc) {
ProcParams* pparams = beforeIpc->getParamsForUpdate (rtengine::EvProfileChanged);
*pparams = params;
beforeIpc->paramsUpdateReady ();
beforeIpc->paramsUpdateReady (); // starts the IPC processinp
}
}

View File

@@ -23,6 +23,7 @@
#include <multilangmgr.h>
#include <iomanip>
#include <cropwindow.h>
#include <refreshmap.h>
ImageArea::ImageArea (ImageAreaPanel* p) : parent(p) {
@@ -47,6 +48,16 @@ ImageArea::ImageArea (ImageAreaPanel* p) : parent(p) {
ipc = NULL;
}
ImageArea::~ImageArea () {
for (std::list<CropWindow*>::iterator i=cropWins.begin(); i!=cropWins.end(); i++)
delete *i;
cropWins.clear ();
if (mainCropWindow)
delete mainCropWindow;
}
void ImageArea::on_realize()
{
Gtk::DrawingArea::on_realize();
@@ -100,17 +111,6 @@ void ImageArea::setPreviewHandler (PreviewHandler* ph) {
previewHandler = ph;
}
ImageArea::~ImageArea () {
for (std::list<CropWindow*>::iterator i=cropWins.begin(); i!=cropWins.end(); i++)
delete *i;
cropWins.clear ();
if (mainCropWindow)
delete mainCropWindow;
}
void ImageArea::styleChanged (const Glib::RefPtr<Gtk::Style>& style) {
// TODO: notify all crop windows that the style has been changed
@@ -151,6 +151,15 @@ CropWindow* ImageArea::getCropWindow (int x, int y) {
return cw;
}
void ImageArea::redraw () {
// dirty prevents multiple updates queued up
if (!dirty) {
dirty = true;
queue_draw ();
}
}
bool ImageArea::on_expose_event(GdkEventExpose* event) {
dirty = false;
@@ -252,6 +261,7 @@ void ImageArea::addCropWindow () {
cw->setPointerMotionListener (pmlistener);
cropWins.push_front (cw);
// Position the new crop window in a checkerboard, or used the last position
if (lastClosedX<0) {
int K = 2;
int hBorder = get_width()/K/8;
@@ -273,7 +283,10 @@ void ImageArea::addCropWindow () {
cw->getCropSize(wc,hc);
cw->setCropPosition(x0+w/2-wc/2,y0+h/2-hc/2);
mainCropWindow->setObservedCropWin (cropWins.front());
queue_draw ();
ipc->startProcessing(M_HIGHQUAL);
// queue_draw ();
}
@@ -314,14 +327,6 @@ void ImageArea::spotWBSelected (int x, int y) {
listener->spotWBselected (x, y);
}
void ImageArea::redraw () {
if (!dirty) {
dirty = true;
queue_draw ();
}
}
void ImageArea::getScrollImageSize (int& w, int& h) {
if (mainCropWindow && ipc) {
@@ -381,6 +386,7 @@ double ImageArea::getZoom () {
return 1.0;
}
// Called by imageAreaPanel before/after views
void ImageArea::setZoom (double zoom) {
if (mainCropWindow)

View File

@@ -161,12 +161,12 @@ void RawProcess::methodChanged ()
}else{
dcbOptions->hide();
}
Glib::ustring s="";
Glib::ustring methodName="";
if( curSelection>=0 && curSelection < procparams::RAWParams::numMethods)
s = procparams::RAWParams::methodstring[curSelection];
methodName = procparams::RAWParams::methodstring[curSelection];
if (listener)
listener->panelChanged (EvDemosaicMethod, s);
listener->panelChanged (EvDemosaicMethod, methodName);
}
void RawProcess::dcbEnhanceChanged ()

View File

@@ -271,7 +271,7 @@ void ToolPanelCoordinator::panelChanged (rtengine::ProcEvent event, const Glib::
resize->write (params);
}
ipc->paramsUpdateReady ();
ipc->paramsUpdateReady (); // starts the IPC processinp
hasChanged = true;
@@ -301,7 +301,7 @@ void ToolPanelCoordinator::profileChange (const ProcParams *nparams, rtengine::
for (unsigned int i=0; i<toolPanels.size(); i++)
toolPanels[i]->read (params);
ipc->paramsUpdateReady ();
ipc->paramsUpdateReady (); // starts the IPC processinp
hasChanged = event != rtengine::EvProfileChangeNotification;