34417
|
1 |
/*
|
|
2 |
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
|
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
|
4 |
*
|
|
5 |
* This code is free software; you can redistribute it and/or modify it
|
|
6 |
* under the terms of the GNU General Public License version 2 only, as
|
|
7 |
* published by the Free Software Foundation. Oracle designates this
|
|
8 |
* particular file as subject to the "Classpath" exception as provided
|
|
9 |
* by Oracle in the LICENSE file that accompanied this code.
|
|
10 |
*
|
|
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT
|
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
14 |
* version 2 for more details (a copy is included in the LICENSE file that
|
|
15 |
* accompanied this code).
|
|
16 |
*
|
|
17 |
* You should have received a copy of the GNU General Public License version
|
|
18 |
* 2 along with this work; if not, write to the Free Software Foundation,
|
|
19 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
20 |
*
|
|
21 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
|
22 |
* or visit www.oracle.com if you need additional information or have any
|
|
23 |
* questions.
|
|
24 |
*/
|
|
25 |
|
|
26 |
package sun.java2d.marlin;
|
|
27 |
|
|
28 |
/**
|
|
29 |
* Marlin constant holder using System properties
|
|
30 |
*/
|
|
31 |
interface MarlinConst {
|
|
32 |
// enable Logs (logger or stdout)
|
|
33 |
static final boolean enableLogs = false;
|
|
34 |
// enable Logger
|
|
35 |
static final boolean useLogger = enableLogs && MarlinProperties.isUseLogger();
|
|
36 |
|
|
37 |
// log new RendererContext
|
|
38 |
static final boolean logCreateContext = enableLogs
|
|
39 |
&& MarlinProperties.isLogCreateContext();
|
|
40 |
// log misc.Unsafe alloc/realloc/free
|
|
41 |
static final boolean logUnsafeMalloc = enableLogs
|
|
42 |
&& MarlinProperties.isLogUnsafeMalloc();
|
|
43 |
|
|
44 |
// do statistics
|
|
45 |
static final boolean doStats = enableLogs && MarlinProperties.isDoStats();
|
|
46 |
// do monitors
|
|
47 |
// disabled to reduce byte-code size a bit...
|
|
48 |
static final boolean doMonitors = enableLogs && false; // MarlinProperties.isDoMonitors();
|
|
49 |
// do checks
|
|
50 |
static final boolean doChecks = false; // MarlinProperties.isDoChecks();
|
|
51 |
|
|
52 |
// do AA range checks: disable when algorithm / code is stable
|
|
53 |
static final boolean DO_AA_RANGE_CHECK = false;
|
|
54 |
|
|
55 |
// enable logs
|
|
56 |
static final boolean doLogWidenArray = enableLogs && false;
|
|
57 |
// enable oversize logs
|
|
58 |
static final boolean doLogOverSize = enableLogs && false;
|
|
59 |
// enable traces
|
|
60 |
static final boolean doTrace = enableLogs && false;
|
|
61 |
// do flush monitors
|
|
62 |
static final boolean doFlushMonitors = true;
|
|
63 |
// use one polling thread to dump statistics/monitors
|
|
64 |
static final boolean useDumpThread = false;
|
|
65 |
// thread dump interval (ms)
|
|
66 |
static final long statDump = 5000L;
|
|
67 |
|
|
68 |
// do clean dirty array
|
|
69 |
static final boolean doCleanDirty = false;
|
|
70 |
|
|
71 |
// flag to use line simplifier
|
|
72 |
static final boolean useSimplifier = MarlinProperties.isUseSimplifier();
|
|
73 |
|
|
74 |
// flag to enable logs related bounds checks
|
|
75 |
static final boolean doLogBounds = enableLogs && false;
|
|
76 |
|
|
77 |
// Initial Array sizing (initial context capacity) ~ 512K
|
|
78 |
|
|
79 |
// 2048 pixel (width x height) for initial capacity
|
|
80 |
static final int INITIAL_PIXEL_DIM
|
|
81 |
= MarlinProperties.getInitialImageSize();
|
|
82 |
|
|
83 |
// typical array sizes: only odd numbers allowed below
|
|
84 |
static final int INITIAL_ARRAY = 256;
|
|
85 |
static final int INITIAL_SMALL_ARRAY = 1024;
|
|
86 |
static final int INITIAL_MEDIUM_ARRAY = 4096;
|
|
87 |
static final int INITIAL_LARGE_ARRAY = 8192;
|
|
88 |
static final int INITIAL_ARRAY_16K = 16384;
|
|
89 |
static final int INITIAL_ARRAY_32K = 32768;
|
|
90 |
// alpha row dimension
|
|
91 |
static final int INITIAL_AA_ARRAY = INITIAL_PIXEL_DIM;
|
|
92 |
|
|
93 |
// initial edges (24 bytes) = 24K [ints] = 96K
|
|
94 |
static final int INITIAL_EDGES_CAPACITY = 4096 * 24; // 6 ints per edges
|
|
95 |
|
|
96 |
// zero value as byte
|
|
97 |
static final byte BYTE_0 = (byte) 0;
|
|
98 |
|
|
99 |
// subpixels expressed as log2
|
|
100 |
public static final int SUBPIXEL_LG_POSITIONS_X
|
|
101 |
= MarlinProperties.getSubPixel_Log2_X();
|
|
102 |
public static final int SUBPIXEL_LG_POSITIONS_Y
|
|
103 |
= MarlinProperties.getSubPixel_Log2_Y();
|
|
104 |
|
|
105 |
// number of subpixels
|
|
106 |
public static final int SUBPIXEL_POSITIONS_X = 1 << (SUBPIXEL_LG_POSITIONS_X);
|
|
107 |
public static final int SUBPIXEL_POSITIONS_Y = 1 << (SUBPIXEL_LG_POSITIONS_Y);
|
|
108 |
|
|
109 |
public static final float NORM_SUBPIXELS
|
|
110 |
= (float)Math.sqrt(( SUBPIXEL_POSITIONS_X * SUBPIXEL_POSITIONS_X
|
|
111 |
+ SUBPIXEL_POSITIONS_Y * SUBPIXEL_POSITIONS_Y)/2.0);
|
|
112 |
|
|
113 |
public static final int MAX_AA_ALPHA
|
|
114 |
= SUBPIXEL_POSITIONS_X * SUBPIXEL_POSITIONS_Y;
|
|
115 |
|
|
116 |
public static final int TILE_SIZE_LG = MarlinProperties.getTileSize_Log2();
|
|
117 |
public static final int TILE_SIZE = 1 << TILE_SIZE_LG; // 32 by default
|
|
118 |
|
|
119 |
public static final int BLOCK_SIZE_LG = MarlinProperties.getBlockSize_Log2();
|
|
120 |
public static final int BLOCK_SIZE = 1 << BLOCK_SIZE_LG;
|
|
121 |
}
|