/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
#include "splashscreen_gfx_impl.h"
/* *INDENT-OFF* */
/* Bayer's order-4 dither array. Generated by the code given in
* Stephen Hawley's article "Ordered Dithering" in Graphics Gems I.
*/
{ 0,192, 48,240, 12,204, 60,252, 3,195, 51,243, 15,207, 63,255 },
{ 128, 64,176,112,140, 76,188,124,131, 67,179,115,143, 79,191,127 },
{ 32,224, 16,208, 44,236, 28,220, 35,227, 19,211, 47,239, 31,223 },
{ 160, 96,144, 80,172,108,156, 92,163, 99,147, 83,175,111,159, 95 },
{ 8,200, 56,248, 4,196, 52,244, 11,203, 59,251, 7,199, 55,247 },
{ 136, 72,184,120,132, 68,180,116,139, 75,187,123,135, 71,183,119 },
{ 40,232, 24,216, 36,228, 20,212, 43,235, 27,219, 39,231, 23,215 },
{ 168,104,152, 88,164,100,148, 84,171,107,155, 91,167,103,151, 87 },
{ 2,194, 50,242, 14,206, 62,254, 1,193, 49,241, 13,205, 61,253 },
{ 130, 66,178,114,142, 78,190,126,129, 65,177,113,141, 77,189,125 },
{ 34,226, 18,210, 46,238, 30,222, 33,225, 17,209, 45,237, 29,221 },
{ 162, 98,146, 82,174,110,158, 94,161, 97,145, 81,173,109,157, 93 },
{ 10,202, 58,250, 6,198, 54,246, 9,201, 57,249, 5,197, 53,245 },
{ 138, 74,186,122,134, 70,182,118,137, 73,185,121,133, 69,181,117 },
{ 42,234, 26,218, 38,230, 22,214, 41,233, 25,217, 37,229, 21,213 },
{ 170,106,154, 90,166,102,150, 86,169,105,153, 89,165,101,149, 85 }
};
/* *INDENT-ON* */
// FIXME: tinting on some colormaps (e.g. 1-2-1) means something is slightly wrong with
// colormap calculation... probably it's some rounding error
/* calculates the colorTable for mapping from 0..255 to 0..numColors-1
also calculates the dithering matrix, scaling baseDitherMatrix accordingly */
void
{
int i, j;
pDither->colorTable[i] =
(((i > MAX_COLOR_VALUE) ? MAX_COLOR_VALUE : i) *
}
for (i = 0; i < DITHER_SIZE; i++)
for (j = 0; j < DITHER_SIZE; j++)
}
/* scale a number on the range of 0..numColorsIn-1 to 0..numColorsOut-1
0 maps to 0 and numColorsIn-1 maps to numColorsOut-1
intermediate values are spread evenly between 0 and numColorsOut-1 */
INLINE int
{
/ (numColorsIn - 1);
}
/* build a colormap for a color cube and a dithering matrix. color cube is quantized
according to the provided maximum number of colors */
int
{
// static const int scale[3]={10000/11,10000/69,10000/30};
// FIXME: sort out the adaptive color cube subdivision... realistic 11:69:30 is good on photos,
// but would be bad on other pictures. A stupid approximation is used now.
// maxNumColors should be at least 2x2x2=8, or we lose some color components completely
while (1) {
/* bubble sort the three indexes according to scaled numColors values */
#define SORT(i,j) \
SORT(0, 1);
SORT(0, 1);
/* try increasing numColors for the first color */
} else {
break;
}
}
}
void
{
int r, g, b, n;
n = 0;
for (r = 0; r < numColors[2]; r++) {
for (g = 0; g < numColors[1]; g++)
for (b = 0; b < numColors[0]; b++) {
pColorMap[colorIndex[n++]] =
}
}
}
/*
the function below is a line conversion loop
incSrc and incDst are pSrc and pDst increment values for the loop, in bytes
mode defines how the pixels should be processed
mode==CVT_COPY means the pixels should be copied as is
mode==CVT_ALPHATEST means pixels should be skipped when source pixel alpha is above the threshold
mode==CVT_BLEND means alpha blending between source and destination should be performed, while
destination alpha should be retained. source alpha is used for blending.
*/
void
{
int i;
switch (doAlpha) {
case CVT_COPY:
for (i = 0; i < numSamples; ++i) {
}
break;
case CVT_ALPHATEST:
for (i = 0; i < numSamples; ++i) {
if (color >= ALPHA_THRESHOLD) { // test for alpha component >50%. that's an extra branch, and it's bad...
}
}
break;
case CVT_BLEND:
for (i = 0; i < numSamples; ++i) {
}
break;
}
}
/* initialize ImageRect structure according to function arguments */
void
{
}
/* copy image rectangle from source to destination, or from two sources with blending */
int
{
}
int
{
int j, row;
}
if (pSrcRect2) {
}
}
}
for (j = 0; j < numLines; j++) {
if (pSrcRect2) {
}
}
}
int
{
int j, row;
for (j = 0; j < numLines; j++) {
}
}
/* init the masks; all other parameters are initialized to default values */
void
int alphaMask)
{
format->premultiplied = 0;
for (i = 0; i < 4; i++) {
}
}
/* dump the visual format */
void
{
#ifdef _DEBUG
int i;
printf("byteorder=%d colormap=%08x depthBytes=%d fixedBits=%08x transparentColor=%u ",
for (i = 0; i < 4; i++) {
}
printf("\n");
#endif
}
/* optimize the format */
void
{
}
/* FIXME: some advanced optimizations are possible, especially for format pairs */
}
int
{
*(char *) &test = 0;
}