Bug 103445

Summary: zoom / autofit mode results in garbled display of image
Product: [Applications] digikam Reporter: alfons.hoogervorst
Component: ImageEditor-CanvasAssignee: Digikam Developers <digikam-bugs-null>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In: 7.6.0

Description alfons.hoogervorst 2005-04-07 19:53:21 UTC
Version:           CVS (using KDE Devel)
Installed from:    Compiled sources
Compiler:          gcc 3.3.1 compiled from sources
OS:                Linux

Hi there again,
When switching to zoom mode, where an image is displayed in full detail, the image is displayed garbled.
I tracked down the problem to this patch:

cvs -z3 diff -u -r 1.46 -r 1.47 imlibinterface.cpp
Index: imlibinterface.cpp
===================================================================
RCS file: /home/kde/kdeextragear-3/digikam/utilities/imageeditor/imlibinterface.cpp,v
retrieving revision 1.46
retrieving revision 1.47
diff -u -r1.46 -r1.47
--- imlibinterface.cpp  5 Apr 2005 21:16:04 -0000       1.46
+++ imlibinterface.cpp  6 Apr 2005 01:56:36 -0000       1.47
@@ -256,7 +256,7 @@

 void ImlibInterface::exifRotate(const QString& filename)
 {
-   // Rotate image based on EXIF rotate tag
+    // Rotate image based on EXIF rotate tag
     KExifData exifData;

     if(!exifData.readFromFile(filename))
@@ -494,24 +494,8 @@

     imlib_context_set_color_modifier(d->cmod);

-    if (d->zoom == 1.0)
-    {
-        // this hack is needed because imlib2 renders image incorrectly
-        // if zoom == 1 and an unmodified colot modifier is applied
-        Imlib_Image tmp =
-            imlib_create_cropped_scaled_image(sx, sy, sw, sh, dw, dh);
-        if (tmp)
-        {
-            imlib_context_set_image(tmp);
-            imlib_render_image_on_drawable(dx, dy);
-            imlib_free_image();
-        }
-    }
-    else
-    {
-        imlib_render_image_part_on_drawable_at_size(sx, sy, sw, sh,
-                                                    dx, dy, dw, dh);
-    }
+    imlib_render_image_part_on_drawable_at_size(sx, sy, sw, sh,
+                                                dx, dy, dw, dh);

     imlib_context_pop();
 }
Comment 1 Renchi Raju 2005-04-07 21:17:35 UTC
CVS commit by pahlibar: 



reverting patch (bringing back hack). problem in imlib2 (see bug# 100894). 
remove when imlib2 is fixed.
BUGS: 103445


  M +16 -0     imlibinterface.cpp   1.48


--- kdeextragear-3/digikam/utilities/imageeditor/imlibinterface.cpp  #1.47:1.48
@@ -495,6 +495,22 @@ void ImlibInterface::paintOnDevice(QPain
     imlib_context_set_color_modifier(d->cmod);
 
+    if (d->zoom == 1.0)
+    {
+        // this hack is needed because imlib2 renders image incorrectly
+        // if zoom == 1 and an unmodified colot modifier is applied
+        Imlib_Image tmp =
+            imlib_create_cropped_scaled_image(sx, sy, sw, sh, dw, dh);
+        if (tmp)
+        {        
+            imlib_context_set_image(tmp);
+            imlib_render_image_on_drawable(dx, dy);
+            imlib_free_image();
+        }
+    }
+    else
+    {
     imlib_render_image_part_on_drawable_at_size(sx, sy, sw, sh,
                                                 dx, dy, dw, dh);
+    }
 
     imlib_context_pop();