Update of /cvsroot/ufraw/ufraw
In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv17345

Modified Files:
        ufraw.h ufraw_developer.c ufraw_preview.c ufraw_ufraw.c 
Log Message:
Initial changes toward possible future implementation of 100% zoom in preview.
Patch by Frank van Maarseveen.


Index: ufraw.h
===================================================================
RCS file: /cvsroot/ufraw/ufraw/ufraw.h,v
retrieving revision 1.118
retrieving revision 1.119
diff -u -d -r1.118 -r1.119
--- ufraw.h     1 Sep 2009 05:24:50 -0000       1.118
+++ ufraw.h     18 Sep 2009 18:39:18 -0000      1.119
@@ -93,7 +93,7 @@
     DeveloperMode mode;
     unsigned rgbMax, max, exposure, colors, useMatrix;
     int restoreDetails, clipHighlights;
-    int rgbWB[4], colorMatrix[3][4];
+    int doWB, rgbWB[4], colorMatrix[3][4];
     double gamma, linear;
     char profileFile[profile_types][max_path];
     void *profile[profile_types];

Index: ufraw_developer.c
===================================================================
RCS file: /cvsroot/ufraw/ufraw/ufraw_developer.c,v
retrieving revision 1.72
retrieving revision 1.73
diff -u -d -r1.72 -r1.73
--- ufraw_developer.c   3 Sep 2009 17:30:07 -0000       1.72
+++ ufraw_developer.c   18 Sep 2009 18:39:18 -0000      1.73
@@ -41,6 +41,7 @@
     int i;
     developer_data *d = g_new(developer_data,1);
     d->mode = -1;
+    d->doWB = 1;
     d->gamma = -1;
     d->linear = -1;
     d->saturation = -1;
@@ -739,8 +740,13 @@
     cmsCIELCh LCh;
     unsigned int c;
 
-    for (c = 0; c < d->colors; ++c)
-       tmp[c] = (guint64)raw[c] * d->rgbWB[c] / 0x10000;
+    for (c = 0; c < d->colors; ++c) {
+       tmp[c] = raw[c];
+       if (d->doWB) {
+           tmp[c] *= d->rgbWB[c];
+           tmp[c] /= 0x10000;
+       }
+    }
     cond_apply_matrix(d, tmp, tmp);
     for (c = 0; c < 3; ++c)
        rgbpixel[c] = tmp[c];
@@ -873,7 +879,11 @@
     gboolean clipped = FALSE;
     for (c=0; c<d->colors; c++) {
        /* Set WB, normalizing tmppix[c]<0x10000 */
-       tmppix[c] = (guint64)in[c] * d->rgbWB[c] / 0x10000;
+       tmppix[c] = in[c];
+       if (d->doWB) {
+           tmppix[c] *= d->rgbWB[c];
+           tmppix[c] /= 0x10000;
+       }
        if ( d->restoreDetails!=clip_details &&
            tmppix[c] > d->max ) {
            clipped = TRUE;

Index: ufraw_ufraw.c
===================================================================
RCS file: /cvsroot/ufraw/ufraw/ufraw_ufraw.c,v
retrieving revision 1.179
retrieving revision 1.180
diff -u -d -r1.179 -r1.180
--- ufraw_ufraw.c       1 Sep 2009 05:24:51 -0000       1.179
+++ ufraw_ufraw.c       18 Sep 2009 18:39:18 -0000      1.180
@@ -936,7 +936,7 @@
  * ufraw_convert_image_area() */
 int ufraw_convert_image_first_phase(ufraw_data *uf, gboolean lensfix)
 {
-    int status, c;
+    int status;
     dcraw_data *raw = uf->raw;
     // final->image memory will be realloc'd as needed
     dcraw_image_data final;
@@ -947,15 +947,14 @@
 
     if ( uf->ConvertShrink>1 || !uf->HaveFilters ) {
        dcraw_finalize_shrink(&final, raw, dark, uf->ConvertShrink);
+       uf->developer->doWB = 1;
     } else {
        if ( (status=dcraw_wavelet_denoise(raw,
                uf->conf->threshold))!=DCRAW_SUCCESS )
            return status;
        dcraw_finalize_interpolate(&final, raw, dark, uf->conf->interpolation,
                uf->conf->smoothing, uf->developer->rgbWB);
-       uf->developer->rgbMax = uf->developer->max;
-       for (c=0; c<4; c++)
-           uf->developer->rgbWB[c] = 0x10000;
+       uf->developer->doWB = 0;
     }
 
     dcraw_image_stretch(&final, raw->pixel_aspect);

Index: ufraw_preview.c
===================================================================
RCS file: /cvsroot/ufraw/ufraw/ufraw_preview.c,v
retrieving revision 1.265
retrieving revision 1.266
diff -u -d -r1.265 -r1.266
--- ufraw_preview.c     10 Sep 2009 23:07:25 -0000      1.265
+++ ufraw_preview.c     18 Sep 2009 18:39:18 -0000      1.266
@@ -873,9 +873,6 @@
            CFG->curve[CFG->curveIndex].m_anchors[0].x);
     gtk_label_set_text(GTK_LABEL(data->BlackLabel), text);
 
-    if ( Developer==NULL )
-            Developer = developer_init();
-
     if ( CFG->profileIndex[display_profile]==0 ) {
        guint8 *displayProfile;
        gint profileSize;
@@ -941,6 +938,8 @@
     }
     /* Prepare pen color, which is not effected by exposure.
      * Use a small value to avoid highlights and then normalize. */
+    /* we use the developer for our own purpose so enable WB */
+    data->UF->developer->doWB++;
     for (c=0; c<colors; c++) {
        for (cl=0; cl<colors; cl++) p16[cl] = 0;
        p16[c] = Developer->max * 0x08000 / Developer->rgbWB[c] *
@@ -972,6 +971,7 @@
                    (hisHeight-1) / MAXOUT;
        }
     }
+    data->UF->developer->doWB--;
     for (x=0; x<raw_his_size; x++) {
        /* draw the raw histogram */
        for (c=0, y0=0; c<colors; c++) {
@@ -1879,6 +1879,7 @@
        CFG->shrink = CFG->Scale;
     }
     preview_invalidate_layer (data, ufraw_denoise_phase);
+    ufraw_developer_prepare(data->UF, display_developer);
     ufraw_convert_image_init(data->UF);
     ufraw_convert_image_first_phase(data->UF, FALSE);
     ufraw_rotate_image_buffer(&data->UF->Images[ufraw_first_phase], 
data->UF->conf->rotationAngle);
@@ -4260,7 +4261,7 @@
 
     // Zoom percentage spin button:
     data->ZoomAdjustment = GTK_ADJUSTMENT(gtk_adjustment_new(
-               CFG->Zoom, 5, 50, 1, 1, 0));
+               CFG->Zoom, 100/max_scale, 100/min_scale, 1, 1, 0));
     g_object_set_data(G_OBJECT(data->ZoomAdjustment),
                "Adjustment-Accuracy", (gpointer)0);
     button = gtk_spin_button_new(data->ZoomAdjustment, 1, 0);
@@ -5152,7 +5153,7 @@
     max_preview_height = MIN(def_preview_height, screen.height-152);
     CFG->Scale = MAX((uf->rotatedWidth-1)/max_preview_width,
            (uf->rotatedHeight-1)/max_preview_height)+1;
-    CFG->Scale = MAX(2, CFG->Scale);
+    CFG->Scale = MAX(min_scale, CFG->Scale);
     CFG->Zoom = 100.0 / CFG->Scale;
     // Make preview size a tiny bit larger to prevent rounding errors
     // that will cause the scrollbars to appear.
@@ -5370,7 +5371,7 @@
 
     // Zoom percentage spin button:
     data->ZoomAdjustment = GTK_ADJUSTMENT(gtk_adjustment_new(
-               CFG->Zoom, 5, 50, 1, 1, 0));
+               CFG->Zoom, 100/min_scale, 100/max_scale, 1, 1, 0));
     g_object_set_data(G_OBJECT(data->ZoomAdjustment),
                "Adjustment-Accuracy", (gpointer)0);
     button = gtk_spin_button_new(data->ZoomAdjustment, 1, 0);


------------------------------------------------------------------------------
Come build with us! The BlackBerry&reg; 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&#45;12, 2009. Register now&#33;
http://p.sf.net/sfu/devconf
_______________________________________________
ufraw-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ufraw-cvs

Reply via email to