[KimDaBa] Patch for handling extreme shaped images

Robert L Krawitz rlk at alum.mit.edu
Sun Jan 16 12:29:53 CET 2005


I found that reloading the thumbnail view was consuming all of my
virtual memory.  It turned out that this was a problem in
ThumbNail::calcRect() in some cases with extreme image shapes.  In my
case, I was using a thumbnail size of 256, with an image shaped 1x511
(1 pixel wide, 511 pixels high).  The result was that the width was
being rounded down to zero.  This fix ensures that that particular
corner case won't happen.

*** thumbnail.cpp.~1.45.~	2005-01-12 16:37:36.000000000 -0500
--- thumbnail.cpp	2005-01-16 12:25:37.433608331 -0500
***************
*** 186,191 ****
--- 186,195 ----
          w = (int) (size * ( w*1.0 / h ));
          h = size;
      }
+     if ( w < 1 )
+         w = 1;
+     if ( h < 1 )
+         h = 1;
  
      QRect textRect(0,0,0,0);
      if ( Options::instance()->displayLabels() ) {



More information about the KimDaBa mailing list