< prev index next >

src/java.desktop/share/classes/sun/java2d/marlin/MarlinProperties.java

Print this page




  51         return align(
  52             getInteger("sun.java2d.renderer.edges", 4096, 64, 64 * 1024),
  53             64);
  54     }
  55 
  56     /**
  57      * Return the initial pixel size used to define initial arrays
  58      * (tile AA chunk, alpha line, buckets)
  59      *
  60      * @return 64 < initial pixel size < 32768 (2048 by default)
  61      */
  62     public static int getInitialImageSize() {
  63         return align(
  64             getInteger("sun.java2d.renderer.pixelsize", 2048, 64, 32 * 1024),
  65             64);
  66     }
  67 
  68     /**
  69      * Return the log(2) corresponding to subpixel on x-axis (
  70      *
  71      * @return 1 (2 subpixels) < initial pixel size < 4 (256 subpixels)
  72      * (3 by default ie 8 subpixels)
  73      */
  74     public static int getSubPixel_Log2_X() {
  75         return getInteger("sun.java2d.renderer.subPixel_log2_X", 3, 1, 8);
  76     }
  77 
  78     /**
  79      * Return the log(2) corresponding to subpixel on y-axis (
  80      *
  81      * @return 1 (2 subpixels) < initial pixel size < 8 (256 subpixels)
  82      * (3 by default ie 8 subpixels)
  83      */
  84     public static int getSubPixel_Log2_Y() {
  85         return getInteger("sun.java2d.renderer.subPixel_log2_Y", 3, 1, 8);
  86     }
  87 
  88     /**
  89      * Return the log(2) corresponding to the square tile size in pixels
  90      *
  91      * @return 3 (8x8 pixels) < tile size < 8 (256x256 pixels)
  92      * (5 by default ie 32x32 pixels)
  93      */
  94     public static int getTileSize_Log2() {
  95         return getInteger("sun.java2d.renderer.tileSize_log2", 5, 3, 8);
  96     }
  97 




  98     /**
  99      * Return the log(2) corresponding to the block size in pixels
 100      *
 101      * @return 3 (8 pixels) < block size < 8 (256 pixels)
 102      * (5 by default ie 32 pixels)
 103      */
 104     public static int getBlockSize_Log2() {
 105         return getInteger("sun.java2d.renderer.blockSize_log2", 5, 3, 8);
 106     }
 107 
 108     // RLE / blockFlags settings
 109 
 110     public static boolean isForceRLE() {
 111         return getBoolean("sun.java2d.renderer.forceRLE", "false");
 112     }
 113 
 114     public static boolean isForceNoRLE() {
 115         return getBoolean("sun.java2d.renderer.forceNoRLE", "false");
 116     }
 117 


 149     }
 150 
 151     // logging parameters
 152 
 153     public static boolean isLoggingEnabled() {
 154         return getBoolean("sun.java2d.renderer.log", "false");
 155     }
 156 
 157     public static boolean isUseLogger() {
 158         return getBoolean("sun.java2d.renderer.useLogger", "false");
 159     }
 160 
 161     public static boolean isLogCreateContext() {
 162         return getBoolean("sun.java2d.renderer.logCreateContext", "false");
 163     }
 164 
 165     public static boolean isLogUnsafeMalloc() {
 166         return getBoolean("sun.java2d.renderer.logUnsafeMalloc", "false");
 167     }
 168 














 169     // system property utilities
 170     static boolean getBoolean(final String key, final String def) {
 171         return Boolean.valueOf(AccessController.doPrivileged(
 172                   new GetPropertyAction(key, def)));
 173     }
 174 
 175     static int getInteger(final String key, final int def,
 176                                  final int min, final int max)
 177     {
 178         final String property = AccessController.doPrivileged(
 179                                     new GetPropertyAction(key));
 180 
 181         int value = def;
 182         if (property != null) {
 183             try {
 184                 value = Integer.decode(property);
 185             } catch (NumberFormatException e) {
 186                 logInfo("Invalid integer value for " + key + " = " + property);
 187             }
 188         }
 189 
 190         // check for invalid values
 191         if ((value < min) || (value > max)) {
 192             logInfo("Invalid value for " + key + " = " + value
 193                     + "; expected value in range[" + min + ", " + max + "] !");
 194             value = def;
 195         }
 196         return value;
 197     }
 198 
 199     static int align(final int val, final int norm) {
 200         final int ceil = FloatMath.ceil_int( ((float)val) / norm);
 201         return ceil * norm;





























 202     }
 203 }


  51         return align(
  52             getInteger("sun.java2d.renderer.edges", 4096, 64, 64 * 1024),
  53             64);
  54     }
  55 
  56     /**
  57      * Return the initial pixel size used to define initial arrays
  58      * (tile AA chunk, alpha line, buckets)
  59      *
  60      * @return 64 < initial pixel size < 32768 (2048 by default)
  61      */
  62     public static int getInitialImageSize() {
  63         return align(
  64             getInteger("sun.java2d.renderer.pixelsize", 2048, 64, 32 * 1024),
  65             64);
  66     }
  67 
  68     /**
  69      * Return the log(2) corresponding to subpixel on x-axis (
  70      *
  71      * @return 0 (1 subpixels) < initial pixel size < 4 (256 subpixels)
  72      * (3 by default ie 8 subpixels)
  73      */
  74     public static int getSubPixel_Log2_X() {
  75         return getInteger("sun.java2d.renderer.subPixel_log2_X", 3, 0, 8);
  76     }
  77 
  78     /**
  79      * Return the log(2) corresponding to subpixel on y-axis (
  80      *
  81      * @return 0 (1 subpixels) < initial pixel size < 8 (256 subpixels)
  82      * (3 by default ie 8 subpixels)
  83      */
  84     public static int getSubPixel_Log2_Y() {
  85         return getInteger("sun.java2d.renderer.subPixel_log2_Y", 3, 0, 8);
  86     }
  87 
  88     /**
  89      * Return the log(2) corresponding to the square tile size in pixels
  90      *
  91      * @return 3 (8x8 pixels) < tile size < 8 (256x256 pixels)
  92      * (5 by default ie 32x32 pixels)
  93      */
  94     public static int getTileSize_Log2() {
  95         return getInteger("sun.java2d.renderer.tileSize_log2", 5, 3, 8);
  96     }
  97 
  98     public static int getTileWidth_Log2() {
  99         return getInteger("sun.java2d.renderer.tileWidth_log2", 5, 3, 10);
 100     }
 101 
 102     /**
 103      * Return the log(2) corresponding to the block size in pixels
 104      *
 105      * @return 3 (8 pixels) < block size < 8 (256 pixels)
 106      * (5 by default ie 32 pixels)
 107      */
 108     public static int getBlockSize_Log2() {
 109         return getInteger("sun.java2d.renderer.blockSize_log2", 5, 3, 8);
 110     }
 111 
 112     // RLE / blockFlags settings
 113 
 114     public static boolean isForceRLE() {
 115         return getBoolean("sun.java2d.renderer.forceRLE", "false");
 116     }
 117 
 118     public static boolean isForceNoRLE() {
 119         return getBoolean("sun.java2d.renderer.forceNoRLE", "false");
 120     }
 121 


 153     }
 154 
 155     // logging parameters
 156 
 157     public static boolean isLoggingEnabled() {
 158         return getBoolean("sun.java2d.renderer.log", "false");
 159     }
 160 
 161     public static boolean isUseLogger() {
 162         return getBoolean("sun.java2d.renderer.useLogger", "false");
 163     }
 164 
 165     public static boolean isLogCreateContext() {
 166         return getBoolean("sun.java2d.renderer.logCreateContext", "false");
 167     }
 168 
 169     public static boolean isLogUnsafeMalloc() {
 170         return getBoolean("sun.java2d.renderer.logUnsafeMalloc", "false");
 171     }
 172 
 173     // quality settings
 174 
 175     public static float getCubicDecD2() {
 176         return getFloat("sun.java2d.renderer.cubic_dec_d2", 1.0, 0.01, 4.0);
 177     }
 178 
 179     public static float getCubicIncD1() {
 180         return getFloat("sun.java2d.renderer.cubic_inc_d1", 0.4, 0.01, 2.0);
 181     }
 182 
 183     public static float getQuadDecD2() {
 184         return getFloat("sun.java2d.renderer.quad_dec_d2", 0.5, 0.01, 4.0);
 185     }
 186 
 187     // system property utilities
 188     static boolean getBoolean(final String key, final String def) {
 189         return Boolean.valueOf(AccessController.doPrivileged(
 190                   new GetPropertyAction(key, def)));
 191     }
 192 
 193     static int getInteger(final String key, final int def,
 194                                  final int min, final int max)
 195     {
 196         final String property = AccessController.doPrivileged(
 197                                     new GetPropertyAction(key));
 198 
 199         int value = def;
 200         if (property != null) {
 201             try {
 202                 value = Integer.decode(property);
 203             } catch (NumberFormatException e) {
 204                 logInfo("Invalid integer value for " + key + " = " + property);
 205             }
 206         }
 207 
 208         // check for invalid values
 209         if ((value < min) || (value > max)) {
 210             logInfo("Invalid value for " + key + " = " + value
 211                     + "; expected value in range[" + min + ", " + max + "] !");
 212             value = def;
 213         }
 214         return value;
 215     }
 216 
 217     static int align(final int val, final int norm) {
 218         final int ceil = FloatMath.ceil_int( ((float)val) / norm);
 219         return ceil * norm;
 220     }
 221 
 222     public static double getDouble(final String key, final double def,
 223                                    final double min, final double max)
 224     {
 225         double value = def;
 226         final String property = AccessController.doPrivileged(
 227                                     new GetPropertyAction(key));
 228 
 229         if (property != null) {
 230             try {
 231                 value = Double.parseDouble(property);
 232             } catch (NumberFormatException nfe) {
 233                 logInfo("Invalid value for " + key + " = " + property + " !");
 234             }
 235         }
 236         // check for invalid values
 237         if (value < min || value > max) {
 238             logInfo("Invalid value for " + key + " = " + value
 239                     + "; expect value in range[" + min + ", " + max + "] !");
 240             value = def;
 241         }
 242         return value;
 243     }
 244 
 245     public static float getFloat(final String key, final double def,
 246                                  final double min, final double max)
 247     {
 248         return (float)getDouble(key, def, min, max);
 249     }
 250 }
< prev index next >