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

Modified Files:
        ufraw-gimp.c ufraw.h ufraw_writer.c 
Log Message:
Change ufraw-gimp to use the same image writing code as all other image formats.
This fixes the rotation issue in the plugin.


Index: ufraw.h
===================================================================
RCS file: /cvsroot/ufraw/ufraw/ufraw.h,v
retrieving revision 1.116
retrieving revision 1.117
diff -u -d -r1.116 -r1.117
--- ufraw.h     7 Aug 2009 05:00:13 -0000       1.116
+++ ufraw.h     28 Aug 2009 22:41:20 -0000      1.117
@@ -411,6 +411,11 @@
 
 /* prototype for functions in ufraw_writer.c */
 int ufraw_write_image(ufraw_data *uf);
+void ufraw_write_image_data(
+    ufraw_data *uf,
+    void * volatile out,
+    int width, int height, int left, int top, int bitDepth, int grayscaleMode,
+    int (*row_writer) (ufraw_data *, void * volatile, void *, int, int, int));
 
 /* prototype for functions in ufraw_delete.c */
 long ufraw_delete(void *widget, ufraw_data *uf);

Index: ufraw_writer.c
===================================================================
RCS file: /cvsroot/ufraw/ufraw/ufraw_writer.c,v
retrieving revision 1.58
retrieving revision 1.59
diff -u -d -r1.58 -r1.59
--- ufraw_writer.c      10 Jul 2009 13:25:45 -0000      1.58
+++ ufraw_writer.c      28 Aug 2009 22:41:20 -0000      1.59
@@ -215,7 +215,7 @@
 }
 #endif /*HAVE_LIBPNG*/
 
-void write_image_data(
+void ufraw_write_image_data(
     ufraw_data *uf,
     void * volatile out,
     int width, int height, int left, int top, int bitDepth, int grayscaleMode,
@@ -403,12 +403,12 @@
     if ( uf->conf->type==ppm_type && BitDepth==8 ) {
        fprintf(out, "P%c\n%d %d\n%d\n",
                grayscaleMode ? '5' : '6', width, height, 0xFF);
-       write_image_data(uf, out, width, height, left, top,
+       ufraw_write_image_data(uf, out, width, height, left, top,
                         BitDepth, grayscaleMode, ppm8_row_writer);
     } else if ( uf->conf->type==ppm_type && BitDepth==16 ) {
        fprintf(out, "P%c\n%d %d\n%d\n",
                grayscaleMode ? '5' : '6', width, height, 0xFFFF);
-       write_image_data(uf, out, width, height, left, top,
+       ufraw_write_image_data(uf, out, width, height, left, top,
                         BitDepth, grayscaleMode, ppm16_row_writer);
 #ifdef HAVE_LIBTIFF
     } else if ( uf->conf->type==tiff_type ) {
@@ -462,7 +462,7 @@
        }
        TIFFSetField(out, TIFFTAG_ROWSPERSTRIP, TIFFDefaultStripSize(out, 0));
 
-       write_image_data(uf, out, width, height, left, top,
+       ufraw_write_image_data(uf, out, width, height, left, top,
                         BitDepth, grayscaleMode, tiff_row_writer);
 
 #endif /*HAVE_LIBTIFF*/
@@ -548,7 +548,7 @@
            }
        }
 
-       write_image_data(uf, &cinfo, width, height, left, top,
+       ufraw_write_image_data(uf, &cinfo, width, height, left, top,
                         8, grayscaleMode, jpeg_row_writer);
 
        if ( ufraw_is_error(uf) ) {
@@ -640,7 +640,7 @@
            if (BitDepth != 8 && G_BYTE_ORDER==G_LITTLE_ENDIAN )
                png_set_swap(png); // Swap byte order to big-endian
 
-           write_image_data(uf, png, width, height, left, top,
+           ufraw_write_image_data(uf, png, width, height, left, top,
                             BitDepth, grayscaleMode, png_row_writer);
 
            png_write_end(png, NULL);

Index: ufraw-gimp.c
===================================================================
RCS file: /cvsroot/ufraw/ufraw/ufraw-gimp.c,v
retrieving revision 1.52
retrieving revision 1.53
diff -u -d -r1.52 -r1.53
--- ufraw-gimp.c        10 Dec 2008 04:22:33 -0000      1.52
+++ ufraw-gimp.c        28 Aug 2009 22:41:20 -0000      1.53
@@ -297,15 +297,27 @@
     }
 }
 
+int gimp_row_writer(
+    ufraw_data *uf,
+    void * volatile out,
+    void * pixbuf,
+    int row, int width, int grayscale)
+{
+    (void)uf;
+    (void)grayscale;
+
+    gimp_pixel_rgn_set_rect(out, pixbuf, 0, row, width, 1);
+
+    return UFRAW_SUCCESS;
+}
+
 long ufraw_save_gimp_image(ufraw_data *uf, GtkWidget *widget)
 {
     GimpDrawable *drawable;
     GimpPixelRgn pixel_region;
     gint32 layer;
-    guint8 *pixbuf;
-    guint16 *pixtmp;
-    int height, width, top, left, depth, tile_height, row, nrows, rowStride, y;
-    image_type *rawImage;
+    int height, width, top, left, depth, tile_height, row, nrows;
+    (void)widget;
 
     uf->gimpImage = -1;
 
@@ -363,25 +375,9 @@
                    uf->thumb.buffer+3*row*width, 0, row, width, nrows);
        }
     } else {
-       pixbuf = g_new(guint8, tile_height * width * depth);
-       pixtmp = g_new(guint16, tile_height * width * 3);
-       rowStride = uf->image.width;
-       rawImage = uf->image.image;
-       for (row = 0; row < height; row += tile_height) {
-           if ( sendToGimpMode )
-               gimp_progress_update(0.5 + 0.5*row/height);
-           else
-               preview_progress(widget, _("Loading image"),
-                       0.5 + 0.5*row/height);
-           nrows = MIN(height-row, tile_height);
-           for (y=0 ; y<nrows; y++)
-               develope(&pixbuf[y*width*depth], 
rawImage[(top+row+y)*rowStride+left],
-                       uf->developer, depth==3 ? 8 : 16, pixtmp, width);
-           gimp_pixel_rgn_set_rect(&pixel_region, pixbuf, 0, row,
-                   width, nrows);
-       }
-       g_free(pixbuf);
-       g_free(pixtmp);
+       ufraw_write_image_data(uf, &pixel_region, width, height, left, top,
+               depth==3 ? 8 : 16, uf->conf->grayscaleMode != grayscale_none,
+               gimp_row_writer);
     }
     gimp_drawable_flush(drawable);
     gimp_drawable_detach(drawable);


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
ufraw-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ufraw-cvs

Reply via email to