Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/openjdk-multiarch-jdk8u
Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/share/classes/sun/java2d/marlin/MarlinConst.java
38918 views
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 = MarlinProperties.isLoggingEnabled();
34
// use Logger instead of stdout
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
// do check unsafe alignment:
44
static final boolean doCheckUnsafe = false;
45
46
// do statistics
47
static final boolean doStats = enableLogs && MarlinProperties.isDoStats();
48
// do monitors
49
// disabled to reduce byte-code size a bit...
50
static final boolean doMonitors = false;
51
// static final boolean doMonitors = enableLogs && MarlinProperties.isDoMonitors();
52
// do checks
53
static final boolean doChecks = enableLogs && MarlinProperties.isDoChecks();
54
55
// do AA range checks: disable when algorithm / code is stable
56
static final boolean DO_AA_RANGE_CHECK = false;
57
58
// enable logs
59
static final boolean doLogWidenArray = enableLogs && false;
60
// enable oversize logs
61
static final boolean doLogOverSize = enableLogs && false;
62
// enable traces
63
static final boolean doTrace = enableLogs && false;
64
// do flush monitors
65
static final boolean doFlushMonitors = true;
66
// use one polling thread to dump statistics/monitors
67
static final boolean useDumpThread = false;
68
// thread dump interval (ms)
69
static final long statDump = 5000L;
70
71
// do clean dirty array
72
static final boolean doCleanDirty = false;
73
74
// flag to use line simplifier
75
static final boolean useSimplifier = MarlinProperties.isUseSimplifier();
76
77
// flag to enable logs related bounds checks
78
static final boolean doLogBounds = enableLogs && false;
79
80
// Initial Array sizing (initial context capacity) ~ 512K
81
82
// 2048 pixel (width x height) for initial capacity
83
static final int INITIAL_PIXEL_DIM
84
= MarlinProperties.getInitialImageSize();
85
86
// typical array sizes: only odd numbers allowed below
87
static final int INITIAL_ARRAY = 256;
88
static final int INITIAL_SMALL_ARRAY = 1024;
89
static final int INITIAL_MEDIUM_ARRAY = 4096;
90
static final int INITIAL_LARGE_ARRAY = 8192;
91
static final int INITIAL_ARRAY_16K = 16384;
92
static final int INITIAL_ARRAY_32K = 32768;
93
// alpha row dimension
94
static final int INITIAL_AA_ARRAY = INITIAL_PIXEL_DIM;
95
96
// initial edges (24 bytes) = 24K [ints] = 96K
97
static final int INITIAL_EDGES_CAPACITY = 4096 * 24; // 6 ints per edges
98
99
// zero value as byte
100
static final byte BYTE_0 = (byte) 0;
101
102
// subpixels expressed as log2
103
public static final int SUBPIXEL_LG_POSITIONS_X
104
= MarlinProperties.getSubPixel_Log2_X();
105
public static final int SUBPIXEL_LG_POSITIONS_Y
106
= MarlinProperties.getSubPixel_Log2_Y();
107
108
// number of subpixels
109
public static final int SUBPIXEL_POSITIONS_X = 1 << (SUBPIXEL_LG_POSITIONS_X);
110
public static final int SUBPIXEL_POSITIONS_Y = 1 << (SUBPIXEL_LG_POSITIONS_Y);
111
112
public static final float NORM_SUBPIXELS
113
= (float)Math.sqrt(( SUBPIXEL_POSITIONS_X * SUBPIXEL_POSITIONS_X
114
+ SUBPIXEL_POSITIONS_Y * SUBPIXEL_POSITIONS_Y)/2.0);
115
116
public static final int MAX_AA_ALPHA
117
= SUBPIXEL_POSITIONS_X * SUBPIXEL_POSITIONS_Y;
118
119
public static final int TILE_SIZE_LG = MarlinProperties.getTileSize_Log2();
120
public static final int TILE_SIZE = 1 << TILE_SIZE_LG; // 32 by default
121
122
public static final int BLOCK_SIZE_LG = MarlinProperties.getBlockSize_Log2();
123
public static final int BLOCK_SIZE = 1 << BLOCK_SIZE_LG;
124
}
125
126