Path: blob/master/src/java.desktop/share/classes/sun/java2d/marlin/MarlinConst.java
41159 views
/*1* Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/2425package sun.java2d.marlin;2627/**28* Marlin constant holder using System properties29*/30interface MarlinConst {31// enable Logs (logger or stdout)32static final boolean ENABLE_LOGS = MarlinProperties.isLoggingEnabled();33// use Logger instead of stdout34static final boolean USE_LOGGER = ENABLE_LOGS && MarlinProperties.isUseLogger();3536// log new RendererContext37static final boolean LOG_CREATE_CONTEXT = ENABLE_LOGS38&& MarlinProperties.isLogCreateContext();39// log misc.Unsafe alloc/realloc/free40static final boolean LOG_UNSAFE_MALLOC = ENABLE_LOGS41&& MarlinProperties.isLogUnsafeMalloc();42// do check unsafe alignment:43static final boolean DO_CHECK_UNSAFE = false;4445// do statistics46static final boolean DO_STATS = ENABLE_LOGS && MarlinProperties.isDoStats();47// do monitors48// disabled to reduce byte-code size a bit...49static final boolean DO_MONITORS = false;50// static final boolean DO_MONITORS = ENABLE_LOGS && MarlinProperties.isDoMonitors();51// do checks52static final boolean DO_CHECKS = ENABLE_LOGS && MarlinProperties.isDoChecks();5354// do AA range checks: disable when algorithm / code is stable55static final boolean DO_AA_RANGE_CHECK = false;5657// enable logs58static final boolean DO_LOG_WIDEN_ARRAY = ENABLE_LOGS && false;59// enable oversize logs60static final boolean DO_LOG_OVERSIZE = ENABLE_LOGS && false;61// enable traces62static final boolean DO_TRACE = ENABLE_LOGS && false;6364// do flush stats65static final boolean DO_FLUSH_STATS = true;66// do flush monitors67static final boolean DO_FLUSH_MONITORS = true;68// use one polling thread to dump statistics/monitors69static final boolean USE_DUMP_THREAD = false;70// thread dump interval (ms)71static final long DUMP_INTERVAL = 5000L;7273// do clean dirty array74static final boolean DO_CLEAN_DIRTY = false;7576// flag to use collinear simplifier77static final boolean USE_SIMPLIFIER = MarlinProperties.isUseSimplifier();7879// flag to use path simplifier80static final boolean USE_PATH_SIMPLIFIER = MarlinProperties.isUsePathSimplifier();8182static final boolean DO_CLIP_SUBDIVIDER = MarlinProperties.isDoClipSubdivider();8384// flag to enable logs related to bounds checks85static final boolean DO_LOG_BOUNDS = ENABLE_LOGS && false;8687// flag to enable logs related to clip rect88static final boolean DO_LOG_CLIP = ENABLE_LOGS && false;8990// Initial Array sizing (initial context capacity) ~ 450K9192// 4096 pixels (width) for initial capacity93static final int INITIAL_PIXEL_WIDTH94= MarlinProperties.getInitialPixelWidth();95// 2176 pixels (height) for initial capacity96static final int INITIAL_PIXEL_HEIGHT97= MarlinProperties.getInitialPixelHeight();9899// typical array sizes: only odd numbers allowed below100static final int INITIAL_ARRAY = 256;101102// alpha row dimension103static final int INITIAL_AA_ARRAY = INITIAL_PIXEL_WIDTH;104105// 4096 edges for initial capacity106static final int INITIAL_EDGES_COUNT = MarlinProperties.getInitialEdges();107108// initial edges = edges count (4096)109// 6 ints per edges = 24 bytes110// edges capacity = 24 x initial edges = 24 * edges count (4096) = 96K111static final int INITIAL_EDGES_CAPACITY = INITIAL_EDGES_COUNT * 24;112113// zero value as byte114static final byte BYTE_0 = (byte) 0;115116// subpixels expressed as log2117public static final int SUBPIXEL_LG_POSITIONS_X118= MarlinProperties.getSubPixel_Log2_X();119public static final int SUBPIXEL_LG_POSITIONS_Y120= MarlinProperties.getSubPixel_Log2_Y();121122public static final int MIN_SUBPIXEL_LG_POSITIONS123= Math.min(SUBPIXEL_LG_POSITIONS_X, SUBPIXEL_LG_POSITIONS_Y);124125// number of subpixels126public static final int SUBPIXEL_POSITIONS_X = 1 << (SUBPIXEL_LG_POSITIONS_X);127public static final int SUBPIXEL_POSITIONS_Y = 1 << (SUBPIXEL_LG_POSITIONS_Y);128129public static final float MIN_SUBPIXELS = 1 << MIN_SUBPIXEL_LG_POSITIONS;130131public static final int MAX_AA_ALPHA132= (SUBPIXEL_POSITIONS_X * SUBPIXEL_POSITIONS_Y);133134public static final int TILE_H_LG = MarlinProperties.getTileSize_Log2();135public static final int TILE_H = 1 << TILE_H_LG; // 32 by default136137public static final int TILE_W_LG = MarlinProperties.getTileWidth_Log2();138public static final int TILE_W = 1 << TILE_W_LG; // 32 by default139140public static final int BLOCK_SIZE_LG = MarlinProperties.getBlockSize_Log2();141public static final int BLOCK_SIZE = 1 << BLOCK_SIZE_LG;142143// Constants144public static final int WIND_EVEN_ODD = 0;145public static final int WIND_NON_ZERO = 1;146147/**148* Constant value for join style.149*/150public static final int JOIN_MITER = 0;151152/**153* Constant value for join style.154*/155public static final int JOIN_ROUND = 1;156157/**158* Constant value for join style.159*/160public static final int JOIN_BEVEL = 2;161162/**163* Constant value for end cap style.164*/165public static final int CAP_BUTT = 0;166167/**168* Constant value for end cap style.169*/170public static final int CAP_ROUND = 1;171172/**173* Constant value for end cap style.174*/175public static final int CAP_SQUARE = 2;176177// Out codes178static final int OUTCODE_TOP = 1;179static final int OUTCODE_BOTTOM = 2;180static final int OUTCODE_LEFT = 4;181static final int OUTCODE_RIGHT = 8;182static final int OUTCODE_MASK_T_B = OUTCODE_TOP | OUTCODE_BOTTOM;183static final int OUTCODE_MASK_L_R = OUTCODE_LEFT | OUTCODE_RIGHT;184static final int OUTCODE_MASK_T_B_L_R = OUTCODE_MASK_T_B | OUTCODE_MASK_L_R;185}186187188