/*
* 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 AlphaMacros_h_Included
#define AlphaMacros_h_Included
#include "GraphicsPrimitiveMgr.h"
#include "AlphaMath.h"
#include "IntArgb.h" /* for "Extract...FromArgb" macros */
do { \
} while (0)
do { \
} while (0)
typedef struct {
typedef struct {
} AlphaFunc;
extern AlphaFunc AlphaRules[];
NativePrimitive *pPrim, \
{ \
\
SrcOp); \
DstOp); \
\
if (pMask) { \
} \
\
do { \
do { \
\
if (pMask) { \
if (!pathA) { \
continue; \
} \
} \
if (loadsrc) { \
} \
if (loaddst) { \
} \
} \
if (srcF) { \
if (!(SRC ## IsPremultiplied)) { \
} else { \
} \
if (srcF) { \
/* assert(loadsrc); */ \
} \
} else { \
continue; \
} \
} \
} else { \
continue; \
} \
resA = 0; \
} \
if (dstF) { \
if (!(DST ## IsPremultiplied)) { \
} \
if (dstF) { \
/* assert(loaddst); */ \
} \
} \
} \
{ \
} \
0, res); \
} while (--w > 0); \
if (pMask) { \
} \
} while (--height > 0); \
}
/* REMIND: This macro is as yet, untested */
NativePrimitive *pPrim, \
{ \
\
\
if (pMask) { \
do { \
do { \
\
if (pathA) { \
if (SRC ## IsPremultiplied) { \
} else { \
} \
if (pathA < 0xff) { \
DstPix, \
dst); \
if (!(DST ## IsPremultiplied)) { \
} \
dst); \
} \
{ \
} \
0, res);\
} \
} while (--w > 0); \
} while (--height > 0); \
} else /* pMask == 0 */ { \
do { \
do { \
\
if (SRC ## IsPremultiplied) { \
} else { \
} \
} \
{ \
} \
0, res); \
} while (--w > 0); \
} while (--height > 0); \
} \
}
NativePrimitive *pPrim, \
{ \
\
\
if (pMask) { \
do { \
do { \
\
if (pathA) { \
if (resA) { \
if (SRC ## IsPremultiplied) { \
} else { \
} \
res); \
resA) \
DstPix, \
dst); \
if (!(DST ## IsPremultiplied)) { \
} \
dst); \
} \
{ \
} \
DstWrite, \
0, res); \
} \
} \
} while (--w > 0); \
} while (--height > 0); \
} else /* pMask == 0 */ { \
do { \
do { \
\
if (resA) { \
if (SRC ## IsPremultiplied) { \
} else { \
} \
DstPix, \
dst); \
if (!(DST ## IsPremultiplied)) { \
} \
dst); \
} \
{ \
} \
0, res); \
} \
} while (--w > 0); \
} while (--height > 0); \
} \
}
void NAME_ALPHA_MASKFILL(TYPE) \
(void *rasBase, \
NativePrimitive *pPrim, \
{ \
\
} \
\
SrcOp); \
DstOp); \
\
\
if (pMask) { \
} \
\
do { \
do { \
\
if (pMask) { \
if (!pathA) { \
continue; \
} \
} \
if (loaddst) { \
} \
} \
if (srcF) { \
} else { \
} \
} else { \
continue; \
} \
resA = 0; \
} \
if (dstF) { \
if (TYPE ## IsPremultiplied) { \
} \
if (dstA) { \
/* assert(loaddst); */ \
} \
} \
} \
{ \
} \
0, res); \
} while (--w > 0); \
if (pMask) { \
} \
} while (--height > 0); \
}
void NAME_SRC_MASKFILL(TYPE) \
(void *rasBase, \
NativePrimitive *pPrim, \
{ \
\
if (srcA == 0) { \
} else { \
if (!(TYPE ## IsPremultiplied)) { \
} \
} \
if (TYPE ## IsPremultiplied) { \
} \
} \
\
\
if (pMask) { \
do { \
do { \
\
if (pathA > 0) { \
if (pathA == 0xff) { \
/* pathA ignored here, not promoted */ \
} else { \
DstPix, \
res); \
if (!(TYPE ## IsPremultiplied)) { \
} \
res); \
{ \
} \
DstWrite, \
0, res); \
} \
} \
} while (--w > 0); \
} while (--height > 0); \
} else /* pMask == 0 */ { \
do { \
do { \
} while (--w > 0); \
} while (--height > 0); \
} \
}
void NAME_SRCOVER_MASKFILL(TYPE) \
(void *rasBase, \
NativePrimitive *pPrim, \
{ \
\
if (srcA == 0) { \
return; \
} \
} \
\
\
if (pMask) { \
do { \
do { \
\
if (pathA > 0) { \
if (pathA != 0xff) { \
} else { \
/* pathA ignored here, not promoted */ \
} \
DstPix, \
dst); \
if (!(TYPE ## IsPremultiplied)) { \
} \
if (dstF) { \
DstPix, \
tmp); \
dstF, \
tmp); \
} \
} \
} \
{ \
} \
DstWrite, 0, \
res); \
} \
} while (--w > 0); \
} while (--height > 0); \
} else /* pMask == 0 */ { \
do { \
do { \
\
if (!(TYPE ## IsPremultiplied)) { \
} \
{ \
} \
0, res); \
} while (--w > 0); \
} while (--height > 0); \
} \
}
/*
* The macros defined above use the following macro definitions supplied
* for the various surface types to manipulate pixels and pixel data.
* The surface-specific macros are typically supplied by header files
* named after the SurfaceType name (eg. IntArgb.h, ByteGray.h, etc.).
*
* In the macro names in the following definitions, the string <stype>
* is used as a place holder for the SurfaceType name (eg. IntArgb). The
* string <strategy> is a place holder for the strategy name (eg. 4ByteArgb).
* The macros above access these type specific macros using the ANSI
* CPP token concatenation operator "##".
*
* Declare<stype>AlphaLoadData Declare the variables used when an alpha
* value is pre-fetched to see whether or
* not blending needs to occur
* Init<stype>AlphaLoadData Initialize the aforementioned variables
* LoadAlphaFrom<stype>For<strategy> Load the alpha value for the given pixel
* into a variable used later (the strategy
* type determines the bit depth of the
* alpha value)
* Postload<strategy>From<stype> Load the pixel components from the given
* surface type into the form required by
* the given strategy. Typically there will
* be a couple macros of this variety, one
* for 4ByteArgb, one for 1ByteGray, one
* for 1ShortGray, etc. Its code is only
* executed when blending needs to occur.
*
* <stype>IsPremultiplied Constant specifying whether the pixel
* components have been premultiplied with
* the alpha value
* Declare<stype>BlendFillVars Declare the variables used when alpha
* blending need not occur (mask and source
* pixel are opaque)
* Clear<stype>BlendFillVars Clear the variables used in a no-blend
* situation (may modify argb argument)
* Init<stype>BlendFillVarsNonPre Initialize the variables used for a
* no-blending situation (this macro is for
* surfaces that do not have premultiplied
* components) (may modify argb argument)
* Init<stype>BlendFillVarsPre Initialize the variables used for a
* no-blending situation (this macro is for
* surfaces that have premultiplied
* components) (may modify argb argument)
* Store<stype>BlendFill Simply store the pixel for the given
* surface (used when blending is
* unnecessary)
* Store<stype>From<strategy>Comps Store the pixel for the given surface
* type after converting it from a pixel of
* the given strategy
*/
#endif /* AlphaMacros_h_Included */