/*
* 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.
*/
/*
* This file contains macro definitions for the Alpha category of the
* macros used by the generic scaleloop function.
*
* This implementation of the Alpha macros will perform an ordered
* dither of the 8-bit alpha values collected from the input pixel
* data to construct a 1-bit deep image mask used to control the
* pixel coverage of the color pixels in the output. This is a
* minimal quality implementation of Alpha that has the advantage
* that it is easy to support on a wide variety of platforms and
* graphics systems.
*
* This file can be used to provide the default implementation of the
* Alpha macros, handling all transparency cases.
*/
/*
* The macro IfAlpha is used by the varous pixel conversion macros
* to conditionally compile code that is only needed if alpha values
* are going to be used.
*/
#ifdef DEBUG
#define DeclareAlphaDebugVars \
#else /* DEBUG */
#define DeclareAlphaDebugVars
do {} while (0)
#endif /* DEBUG */
#define DeclareAlphaVars \
int laststore; \
do { \
laststore = 1; \
if (mask) { \
+ MaskOffset(dstX1)); \
maskcurbit = 1; \
} else { \
maskcurbit = 0; \
} \
} while (0)
do { \
if (maskcurbit) { \
} \
} while (0)
do { \
if (((maskcurbit) >>= 1) == 0) { \
} else { \
laststore = 0; \
} \
maskcurbit = MaskInit(0); \
} \
} while (0)
do { \
if (!maskcurbit) { \
if (!mask) { \
return SCALEFAILURE; \
} \
+ MaskOffset(dstX)); \
} \
IncrementMaskBit(dstX); \
} while (0)
do { \
if (maskcurbit) { \
IncrementMaskBit(dstX); \
} \
} while (0)
do { \
} else { \
} \
} while (0)
#define EndMaskLine() \
do { \
if (maskcurbit) { \
if (laststore) { \
} \
mask += maskadjust; \
} \
} while (0)