/*
* 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.
*/
#ifndef SPLASHSCREEN_GFX_IMPL_H
#define SPLASHSCREEN_GFX_IMPL_H
#include "splashscreen_gfx.h"
/* here come some very simple macros */
/* advance a pointer p by sizeof(type)*n bytes */
/* advance a pointer by sizeof(type) */
/* store a typed value to pointed location */
/* load a typed value from pointed location */
/* same as cond<0?-1:0 */
enum
{
};
/* same as cond<0?n1:n2 */
/* value shifted left by n bits, negative n is allowed */
/* value shifted right by n bits, negative n is allowed */
/* converts a single i'th component to the specific format defined by format->shift[i] and format->mask[i] */
/* extracts the component defined by format->shift[i] and format->mask[i] from a specific-format value */
/* dithers the color using the dither matrices and colormap from format
indices to dither matrices are passed as arguments */
INLINE unsigned
{
}
/* blend (lerp between) two rgb quads
src and dst alpha is ignored
the algorithm: src*alpha+dst*(1-alpha)=(src-dst)*alpha+dst, rb and g are done separately
*/
{
return MAKE_QUAD(
0);
}
/* scales rgb quad by alpha. basically similar to what's above. src alpha is retained.
used for premultiplying alpha
btw: braindead MSVC6 generates _three_ mul instructions for this function */
{
alpha += 1;
srb >>= 8;
sg >>= 8;
}
/* The functions below are inherently ineffective, but the performance seems to be
more or less adequate for the case of splash screens. They can be optimized later
if needed. The idea of optimization is to provide inlineable form of putRGBADither and
getRGBA at least for certain most frequently used visuals. Something like this is
done in Java 2D ("loops"). This would be possible with C++ templates, but making it
clean for C would require ugly preprocessor tricks. Leaving it out for later.
*/
/* convert a single pixel color value from rgbquad according to visual format
and place it to pointed location
ordered dithering used when necessary */
INLINE void
{
if (format->premultiplied) {
}
}
else {
}
case BYTE_ORDER_LSBFIRST:
case 4:
value >>= 8;
case 3:
value >>= 8;
case 2:
value >>= 8;
case 1:
}
break;
case BYTE_ORDER_MSBFIRST:
case 4:
case 3:
case 2:
case 1:
}
break;
case BYTE_ORDER_NATIVE:
switch (format->depthBytes) {
case 4:
break;
case 3: /* not supported, LSB or MSB should always be specified */
*(int *) 0 = 0; /* crash */
break;
case 2:
break;
case 1:
break;
}
}
}
/* load a single pixel color value and un-convert it to rgbquad according to visual format */
{
/*
FIXME: color is not un-alpha-premultiplied on get
this is not required by current code, but it makes the implementation inconsistent
i.e. put(get) will not work right for alpha-premultiplied images */
/* get the value basing on depth and byte order */
case BYTE_ORDER_LSBFIRST:
switch (format->depthBytes) {
case 4:
value <<= 8;
case 3:
value <<= 8;
case 2:
value <<= 8;
case 1:
}
break;
case BYTE_ORDER_MSBFIRST:
case 4:
case 3:
case 2:
case 1:
}
break;
case BYTE_ORDER_NATIVE:
switch (format->depthBytes) {
case 4:
break;
case 3: /* not supported, LSB or MSB should always be specified */
*(int *) 0 = 0;
break;
case 2:
break;
case 1:
break;
}
break;
}
/* now un-convert the value */
return 0;
else
}
else {
}
}
/* fill the line with the specified color according to visual format */
INLINE void
{
int i;
for (i = 0; i < n; ++i) {
}
}
/* find the shift for specified mask, also verify the mask is valid */
INLINE int
{
/* check the mask is not empty */
if (!mask)
return 0;
/* calculate the shift */
while ((mask & 1) == 0) {
++shift;
mask >>= 1;
}
/* check the mask is contigious */
return 0;
/* calculate the number of bits */
do {
++numBits;
mask >>= 1;
} while ((mask & 1) != 0);
return 1;
}
#endif