Changing zoom using the spin button will now recognize the magic
percentages which can be replaced by a shrink factor. The shrink
path is notivceable faster than the resize (as it should but I'm
not entirely sure why).
diff --git a/ufraw_preview.c b/ufraw_preview.c
index d8d175c..f3afce5 100644
--- a/ufraw_preview.c
+++ b/ufraw_preview.c
@@ -2109,6 +2109,19 @@ static void zoom_out_event(GtkWidget *widget, gpointer
user_data)
}
}
+static void init_scale(preview_data *data)
+{
+ int pct, mul;
+
+ /* Try to setup for shrink instead of resize because of speed */
+ pct = CFG->Zoom + 0.5; // note: C99 would allow lround()
+ mul = 100 / pct;
+ if (pct * mul >= 12 * 8 && pct * mul <= 100 && (pct + 1) * mul > 100)
+ CFG->Scale = mul;
+ else
+ CFG->Scale = 0;
+}
+
#ifdef HAVE_GTKIMAGEVIEW
static void zoom_fit_event(GtkWidget *widget, gpointer user_data)
{
@@ -2123,7 +2136,7 @@ static void zoom_fit_event(GtkWidget *widget, gpointer
user_data)
double wScale = (double)data->UF->rotatedWidth / previewWidth;
double hScale = (double)data->UF->rotatedHeight / previewHeight;
CFG->Zoom = 100.0/LIM(MAX(wScale, hScale), min_scale, max_scale);
- CFG->Scale = 0;
+ init_scale(data);
if (prev_zoom != CFG->Zoom) {
gtk_adjustment_set_value(data->ZoomAdjustment, CFG->Zoom);
preview_invalidate_layer(data, ufraw_first_phase);
@@ -2885,7 +2898,7 @@ static void adjustment_update(GtkAdjustment *adj, double
*valuep)
CFG->autoExposure = FALSE;
if (CFG->autoBlack==enabled_state) CFG->autoBlack = apply_state;
} else if (valuep==&CFG->Zoom) {
- CFG->Scale = 0;
+ init_scale(data);
preview_invalidate_layer(data, ufraw_first_phase);
} else if (valuep==&CFG->threshold) {
preview_invalidate_layer(data, ufraw_denoise_phase);
@@ -5579,7 +5592,7 @@ int ufraw_preview(ufraw_data *uf, conf_data *rc, int
plugin,
double wScale = (double)data->UF->rotatedWidth / scrollWidth;
double hScale = (double)data->UF->rotatedHeight / scrollHeight;
CFG->Zoom = 100/MAX(wScale, hScale);
- CFG->Scale = 0;
+ init_scale(data);
preview_width = uf->rotatedWidth * CFG->Zoom/100;
preview_height = uf->rotatedHeight * CFG->Zoom/100;
}
--
Frank
------------------------------------------------------------------------------
Come build with us! The BlackBerry® Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9-12, 2009. Register now!
http://p.sf.net/sfu/devconf
_______________________________________________
ufraw-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ufraw-devel