[gs-cvs] rev 8057 - trunk/gs/src
tim at ghostscript.com
tim at ghostscript.com
Mon Jun 18 08:20:47 PDT 2007
Author: tim
Date: 2007-06-18 08:20:47 -0700 (Mon, 18 Jun 2007)
New Revision: 8057
Modified:
trunk/gs/src/gsdparam.c
Log:
Changing from using log10(x) / Log10(2) to iLog2(x) to compute the base 2 log.
DETAILS:
Making change to conform to gs style.
EXPECTED DIFFERENCES:
None:
Modified: trunk/gs/src/gsdparam.c
===================================================================
--- trunk/gs/src/gsdparam.c 2007-06-18 06:37:58 UTC (rev 8056)
+++ trunk/gs/src/gsdparam.c 2007-06-18 15:20:47 UTC (rev 8057)
@@ -21,7 +21,6 @@
#include "gsparam.h"
#include "gxdevice.h"
#include "gxfixed.h"
-#include "math.h" /* for log10 */
/* Define whether we accept PageSize as a synonym for MediaSize. */
/* This is for backward compatibility only. */
@@ -807,7 +806,7 @@
dev->color_info.anti_alias.text_bits =
param_normalize_anti_alias_bits(dev->color_info.max_gray, tab);
dev->color_info.anti_alias.graphics_bits =
- param_normalize_anti_alias_bits(dev->color_info.max_gray, gab);;
+ param_normalize_anti_alias_bits(dev->color_info.max_gray, gab);
dev->LockSafetyParams = locksafe;
gx_device_decache_colors(dev);
return 0;
@@ -827,12 +826,9 @@
private int
param_normalize_anti_alias_bits( uint max_gray, int bits )
{
- /* Use log2(x) = log10(x) / Log10(2) as log2 might not be available
- * with all compilers
- */
- double max_bits = log10((double)max_gray + 1.0) / 0.30102999;
+ int max_bits = ilog2( max_gray + 1.0);
- return (bits > max_bits ? (int)max_bits : bits);
+ return (bits > max_bits ? max_bits : bits);
}
/* Read TextAlphaBits or GraphicsAlphaBits. */
More information about the gs-cvs
mailing list