< prev index next >
src/java.desktop/share/classes/sun/java2d/marlin/MarlinCache.java
Print this page
*** 1,7 ****
/*
! * Copyright (c) 2007, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
--- 1,7 ----
/*
! * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
*** 41,53 ****
= Math.max(BLOCK_SIZE, MarlinProperties.getRLEMinWidth());
// maximum width for RLE encoding:
// values are stored as int [x|alpha] where alpha is 8 bits
static final int RLE_MAX_WIDTH = 1 << (24 - 1);
! // 2048 (pixelSize) alpha values (width) x 32 rows (tile) = 64K bytes
// x1 instead of 4 bytes (RLE) ie 1/4 capacity or average good RLE compression
! static final long INITIAL_CHUNK_ARRAY = TILE_H * INITIAL_PIXEL_DIM; // 64K
// The alpha map used by this object (taken out of our map cache) to convert
// pixel coverage counts gotten from MarlinCache (which are in the range
// [0, maxalpha]) into alpha values, which are in [0,256).
static final byte[] ALPHA_MAP;
--- 41,53 ----
= Math.max(BLOCK_SIZE, MarlinProperties.getRLEMinWidth());
// maximum width for RLE encoding:
// values are stored as int [x|alpha] where alpha is 8 bits
static final int RLE_MAX_WIDTH = 1 << (24 - 1);
! // 4096 (pixels) alpha values (width) x 64 rows / 4 (tile) = 64K bytes
// x1 instead of 4 bytes (RLE) ie 1/4 capacity or average good RLE compression
! static final long INITIAL_CHUNK_ARRAY = TILE_H * INITIAL_PIXEL_WIDTH >> 2; // 64K
// The alpha map used by this object (taken out of our map cache) to convert
// pixel coverage counts gotten from MarlinCache (which are in the range
// [0, maxalpha]) into alpha values, which are in [0,256).
static final byte[] ALPHA_MAP;
*** 290,304 ****
val += alphaRow[x]; // [from; to[
// ensure values are in [0; MAX_AA_ALPHA] range
if (DO_AA_RANGE_CHECK) {
if (val < 0) {
! System.out.println("Invalid coverage = " + val);
val = 0;
}
if (val > MAX_AA_ALPHA) {
! System.out.println("Invalid coverage = " + val);
val = MAX_AA_ALPHA;
}
}
// store alpha sum (as byte):
--- 290,304 ----
val += alphaRow[x]; // [from; to[
// ensure values are in [0; MAX_AA_ALPHA] range
if (DO_AA_RANGE_CHECK) {
if (val < 0) {
! MarlinUtils.logInfo("Invalid coverage = " + val);
val = 0;
}
if (val > MAX_AA_ALPHA) {
! MarlinUtils.logInfo("Invalid coverage = " + val);
val = MAX_AA_ALPHA;
}
}
// store alpha sum (as byte):
*** 458,472 ****
val += delta;
// ensure values are in [0; MAX_AA_ALPHA] range
if (DO_AA_RANGE_CHECK) {
if (val < 0) {
! System.out.println("Invalid coverage = " + val);
val = 0;
}
if (val > MAX_AA_ALPHA) {
! System.out.println("Invalid coverage = " + val);
val = MAX_AA_ALPHA;
}
}
}
}
--- 458,472 ----
val += delta;
// ensure values are in [0; MAX_AA_ALPHA] range
if (DO_AA_RANGE_CHECK) {
if (val < 0) {
! MarlinUtils.logInfo("Invalid coverage = " + val);
val = 0;
}
if (val > MAX_AA_ALPHA) {
! MarlinUtils.logInfo("Invalid coverage = " + val);
val = MAX_AA_ALPHA;
}
}
}
}
*** 628,638 ****
// double size !
final byte[] alMap = new byte[maxalpha << 1];
final int halfmaxalpha = maxalpha >> 2;
for (int i = 0; i <= maxalpha; i++) {
alMap[i] = (byte) ((i * 255 + halfmaxalpha) / maxalpha);
- // System.out.println("alphaMap[" + i + "] = "
- // + Byte.toUnsignedInt(alMap[i]));
}
return alMap;
}
}
--- 628,636 ----
< prev index next >