/me agrees
looks good
just make the default to 0 if the SMART_RESIZE is unset
> +     int resampleMode = 0;

KaKaRoTo

On Thu, Dec 13, 2007 at 11:18:33PM +0000, Tom Hennigan wrote:
> I propose this diff to make resizing larger images faster, and making  
> resizing smaller images result in a better quality thumb. Please let  
> me know your thoughts, I will commit the patch (if there are no  
> comments, or suggestions) when I get libjpeg and libpng built as  
> universal binaries so they can be distributed with the aMSN bundle (on  
> OS X).
> 
> Index: utils/TkCximage/src/TkCximage.h
> ===================================================================
> --- utils/TkCximage/src/TkCximage.h   (revision 9115)
> +++ utils/TkCximage/src/TkCximage.h   (working copy)
> @@ -55,6 +55,9 @@
> 
> #define ENABLE_LOGS 0
> #define ANIMATE_GIFS 1
> +#ifndef SMART_RESIZE
> +     #define SMART_RESIZE 1
> +#endif
> 
> 
> 
> Index: utils/TkCximage/src/procs.cpp
> ===================================================================
> --- utils/TkCximage/src/procs.cpp     (revision 9115)
> +++ utils/TkCximage/src/procs.cpp     (working copy)
> @@ -219,7 +219,24 @@
>      if(alpha == 0 )
>        image.AlphaDelete();
> 
> -    if(!image.Resample(width, height, 2)) {
> +     /* Modes:
> +             0 - Bilinear (Slow[er])
> +             1 - Nearest Pixel (Fast[er])
> +             2 - Bicubic Spline (Accurate) */
> +     int resampleMode = 2;
> +     #if SMART_RESIZE == 1
> +     if(width <= 800 && height <= 800) {
> +             // Use a higher quality resample for small/medium images.
> +             resampleMode = 0;
> +     } else if(width >= 1024 && height >= 1024) {
> +             // Fastest mode for "huge" images.
> +             resampleMode = 1;
> +     } else {
> +             // Fast but accurate for large images.
> +             resampleMode = 2;
> +     }
> +     #endif
> +    if(!image.Resample(width, height, resampleMode)) {
>        Tcl_AppendResult(interp, image.GetLastError(), NULL);
>        return TCL_ERROR;
>      }
> 
> 
> 
> -------------------------------------------------------------------------
> SF.Net email is sponsored by:
> Check out the new SourceForge.net Marketplace.
> It's the best place to buy or sell services
> for just about anything Open Source.
> http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
> _______________________________________________
> Amsn-devel mailing list
> Amsn-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/amsn-devel

-------------------------------------------------------------------------
SF.Net email is sponsored by:
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services
for just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
Amsn-devel mailing list
Amsn-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/amsn-devel

Reply via email to