jdk/src/share/native/sun/java2d/loops/LoopMacros.h
author prr
Mon, 28 Apr 2008 15:57:46 -0700
changeset 549 4273b1234967
parent 2 90ce3da70b43
child 715 f16baef3a20e
permissions -rw-r--r--
6679308: Poor text rendering on translucent image. Reviewed-by: flar, campbell
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
     2
 * Copyright 2000-2006 Sun Microsystems, Inc.  All Rights Reserved.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
90ce3da70b43 Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.  Sun designates this
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
90ce3da70b43 Initial load
duke
parents:
diff changeset
     9
 * by Sun in the LICENSE file that accompanied this code.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    21
 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    22
 * CA 95054 USA or visit www.sun.com if you need additional information or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    23
 * have any questions.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
#ifndef LoopMacros_h_Included
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
#define LoopMacros_h_Included
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
#include "j2d_md.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
#include "LineUtils.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
 * This file contains macros to aid in defining native graphics
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
 * primitive functions.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
 * A number of useful building block macros are defined, but the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
 * vast majority of primitives are defined completely by a single
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
 * macro expansion which uses macro names in the argument list to
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
 * choose not only from a small number of strategies but also to
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
 * choose macro packages specific to the source and destination
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
 * pixel formats - greatly simplifying all aspects of creating
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
 * a new loop.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
 * See the following macros which define entire functions with
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
 * just one or two surface names and sometimes a strategy name:
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
 *     DEFINE_ISOCOPY_BLIT(ANYTYPE)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
 *     DEFINE_ISOXOR_BLIT(ANYTYPE)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
 *     DEFINE_CONVERT_BLIT(SRC, DST, CONV_METHOD)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
 *     DEFINE_CONVERT_BLIT_LUT(SRC, DST, LUT_STRATEGY)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
 *     DEFINE_XPAR_CONVERT_BLIT_LUT(SRC, DST, LUT_STRATEGY)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
 *     DEFINE_XPAR_BLITBG_LUT(SRC, DST, LUT_STRATEGY)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
 *     DEFINE_SOLID_FILLRECT(DST)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
 *     DEFINE_SOLID_FILLSPANS(DST)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
 *     DEFINE_SOLID_DRAWLINE(DST)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
 * Many of these loop macros take the name of a SurfaceType as
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
 * an argument and use the ANSI CPP token concatenation operator
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
 * "##" to reference macro and type definitions that are specific
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
 * to that type of surface.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
 * A description of the various surface specific macro utilities
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
 * that are used by these loop macros appears at the end of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
 * file.  The definitions of these surface-specific macros will
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
 * usually appear in a header file named after the SurfaceType
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
 * name (i.e. IntArgb.h, ByteGray.h, etc.).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
 * This loop is the standard "while (--height > 0)" loop used by
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
 * some of the blits below.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
#define BlitLoopHeight(SRCTYPE, SRCPTR, SRCBASE, SRCINFO, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
                       DSTTYPE, DSTPTR, DSTBASE, DSTINFO, DSTPREFIX, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
                       HEIGHT, BODY) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
    do { \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
        SRCTYPE ## DataType *SRCPTR = (SRCTYPE ## DataType *) (SRCBASE); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
        DSTTYPE ## DataType *DSTPTR = (DSTTYPE ## DataType *) (DSTBASE); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
        jint srcScan = (SRCINFO)->scanStride; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
        jint dstScan = (DSTINFO)->scanStride; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
        Init ## DSTTYPE ## StoreVarsY(DSTPREFIX, DSTINFO); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
        do { \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
            BODY; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
            SRCPTR = PtrAddBytes(SRCPTR, srcScan); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
            DSTPTR = PtrAddBytes(DSTPTR, dstScan); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
            Next ## DSTTYPE ## StoreVarsY(DSTPREFIX); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
        } while (--HEIGHT > 0); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
    } while (0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
 * This loop is the standard nested "while (--width/height > 0)" loop
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
 * used by most of the basic blits below.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
#define BlitLoopWidthHeight(SRCTYPE, SRCPTR, SRCBASE, SRCINFO, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
                            DSTTYPE, DSTPTR, DSTBASE, DSTINFO, DSTPREFIX, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
                            WIDTH, HEIGHT, BODY) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
    do { \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
        SRCTYPE ## DataType *SRCPTR = (SRCTYPE ## DataType *) (SRCBASE); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
        DSTTYPE ## DataType *DSTPTR = (DSTTYPE ## DataType *) (DSTBASE); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
        jint srcScan = (SRCINFO)->scanStride; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
        jint dstScan = (DSTINFO)->scanStride; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
        Init ## DSTTYPE ## StoreVarsY(DSTPREFIX, DSTINFO); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
        srcScan -= (WIDTH) * SRCTYPE ## PixelStride; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
        dstScan -= (WIDTH) * DSTTYPE ## PixelStride; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
        do { \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
            juint w = WIDTH; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
            Init ## DSTTYPE ## StoreVarsX(DSTPREFIX, DSTINFO); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
            do { \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
                BODY; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
                SRCPTR = PtrAddBytes(SRCPTR, SRCTYPE ## PixelStride); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
                DSTPTR = PtrAddBytes(DSTPTR, DSTTYPE ## PixelStride); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
                Next ## DSTTYPE ## StoreVarsX(DSTPREFIX); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
            } while (--w > 0); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
            SRCPTR = PtrAddBytes(SRCPTR, srcScan); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
            DSTPTR = PtrAddBytes(DSTPTR, dstScan); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
            Next ## DSTTYPE ## StoreVarsY(DSTPREFIX); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
        } while (--HEIGHT > 0); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
    } while (0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
 * This loop is the standard nested "while (--width/height > 0)" loop
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
 * used by most of the scaled blits below.  It calculates the proper
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
 * X source variable
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
#define BlitLoopScaleWidthHeight(SRCTYPE, SRCPTR, SRCBASE, SRCINFO, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
                                 DSTTYPE, DSTPTR, DSTBASE, DSTINFO, DSTPREFIX, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
                                 XVAR, WIDTH, HEIGHT, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
                                 SXLOC, SYLOC, SXINC, SYINC, SHIFT, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
                                 BODY) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
    do { \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
        SRCTYPE ## DataType *SRCPTR; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
        DSTTYPE ## DataType *DSTPTR = (DSTTYPE ## DataType *) (DSTBASE); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
        jint srcScan = (SRCINFO)->scanStride; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
        jint dstScan = (DSTINFO)->scanStride; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
        Init ## DSTTYPE ## StoreVarsY(DSTPREFIX, DSTINFO); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
        dstScan -= (WIDTH) * DSTTYPE ## PixelStride; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
        do { \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
            juint w = WIDTH; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
            jint tmpsxloc = SXLOC; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
            SRCPTR = PtrAddBytes(SRCBASE, ((SYLOC >> SHIFT) * srcScan)); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
            Init ## DSTTYPE ## StoreVarsX(DSTPREFIX, DSTINFO); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
            do { \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
                jint XVAR = (tmpsxloc >> SHIFT); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
                BODY; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
                DSTPTR = PtrAddBytes(DSTPTR, DSTTYPE ## PixelStride); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
                Next ## DSTTYPE ## StoreVarsX(DSTPREFIX); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
                tmpsxloc += SXINC; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
            } while (--w > 0); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
            DSTPTR = PtrAddBytes(DSTPTR, dstScan); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
            Next ## DSTTYPE ## StoreVarsY(DSTPREFIX); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
            SYLOC += SYINC; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
        } while (--HEIGHT > 0); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
    } while (0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
 * This loop is a standard horizontal loop iterating with a "relative"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
 * X coordinate (0 <= X < WIDTH) used primarily by the LUT conversion
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
 * preprocessing loops below.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
#define BlitLoopXRel(DSTTYPE, DSTINFO, DSTPREFIX, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
                     XVAR, WIDTH, BODY) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
    do { \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
        juint XVAR = 0; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
        Init ## DSTTYPE ## StoreVarsX(DSTPREFIX, DSTINFO); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
        do { \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
            BODY; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
            Next ## DSTTYPE ## StoreVarsX(DSTPREFIX); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
        } while (++XVAR < WIDTH); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
    } while (0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
 * This is a "conversion strategy" for use with the DEFINE_CONVERT_BLIT
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
 * macros.  It converts from the source pixel format to the destination
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
 * via an intermediate "jint rgb" format.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
#define ConvertVia1IntRgb(SRCPTR, SRCTYPE, SRCPREFIX, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
                          DSTPTR, DSTTYPE, DSTPREFIX, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
                          SXVAR, DXVAR) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
    do { \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
        int rgb; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
        Load ## SRCTYPE ## To1IntRgb(SRCPTR, SRCPREFIX, SXVAR, rgb); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
        Store ## DSTTYPE ## From1IntRgb(DSTPTR, DSTPREFIX, DXVAR, rgb); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
    } while (0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
 * This is a "conversion strategy" for use with the DEFINE_CONVERT_BLIT
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
 * macros.  It converts from the source pixel format to the destination
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
 * via an intermediate "jint argb" format.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
#define ConvertVia1IntArgb(SRCPTR, SRCTYPE, SRCPREFIX, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
                           DSTPTR, DSTTYPE, DSTPREFIX, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
                           SXVAR, DXVAR) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
    do { \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
        int argb; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
        Load ## SRCTYPE ## To1IntArgb(SRCPTR, SRCPREFIX, SXVAR, argb); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
        Store ## DSTTYPE ## From1IntArgb(DSTPTR, DSTPREFIX, DXVAR, argb); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
    } while (0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
 * This is a "conversion strategy" for use with the DEFINE_CONVERT_BLIT
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
 * macros.  It converts from the source pixel format to the destination
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
 * via an intermediate set of 3 component variables "jint r, g, b".
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
#define ConvertVia3ByteRgb(SRCPTR, SRCTYPE, SRCPREFIX, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
                           DSTPTR, DSTTYPE, DSTPREFIX, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
                           SXVAR, DXVAR) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
    do { \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
        jint r, g, b; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
        Load ## SRCTYPE ## To3ByteRgb(SRCPTR, SRCPREFIX, SXVAR, r, g, b); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
        Store ## DSTTYPE ## From3ByteRgb(DSTPTR, DSTPREFIX, DXVAR, r, g, b); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
    } while (0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
 * This is a "conversion strategy" for use with the DEFINE_CONVERT_BLIT
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
 * macros.  It converts from the source pixel format to the destination
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
 * via an intermediate set of 4 component variables "jint a, r, g, b".
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
#define ConvertVia4ByteArgb(SRCPTR, SRCTYPE, SRCPREFIX, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
                            DSTPTR, DSTTYPE, DSTPREFIX, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
                            SXVAR, DXVAR) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
    do { \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
        jint a, r, g, b; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
        Load ## SRCTYPE ## To4ByteArgb(SRCPTR, SRCPREFIX, SXVAR, a, r, g, b); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
        Store ## DSTTYPE ## From4ByteArgb(DSTPTR, DSTPREFIX, DXVAR, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
                                          a, r, g, b); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
    } while (0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
 * This is a "conversion strategy" for use with the DEFINE_CONVERT_BLIT
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
 * macros.  It converts from the source pixel format to the destination
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
 * via an intermediate "jint gray" format.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
#define ConvertVia1ByteGray(SRCPTR, SRCTYPE, SRCPREFIX, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
                            DSTPTR, DSTTYPE, DSTPREFIX, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
                            SXVAR, DXVAR) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
    do { \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
        jint gray; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
        Load ## SRCTYPE ## To1ByteGray(SRCPTR, SRCPREFIX, SXVAR, gray); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
        Store ## DSTTYPE ## From1ByteGray(DSTPTR, DSTPREFIX, DXVAR, gray); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
    } while (0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
 * This is a "conversion strategy" for use with the DEFINE_XPAR_CONVERT_BLIT
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
 * macros.  It converts from the source pixel format to the destination
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
 * via the specified intermediate format while testing for transparent pixels.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
#define ConvertXparVia1IntRgb(SRCPTR, SRCTYPE, SRCPREFIX, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
                              DSTPTR, DSTTYPE, DSTPREFIX, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
                              SXVAR, DXVAR) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
    do { \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
        Declare ## SRCTYPE ## Data(XparLoad); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
        Load ## SRCTYPE ## Data(SRCPTR, SRCPREFIX, SXVAR, XparLoad); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
        if (! (Is ## SRCTYPE ## DataTransparent(XparLoad))) { \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
            int rgb; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
            Convert ## SRCTYPE ## DataTo1IntRgb(XparLoad, rgb); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
            Store ## DSTTYPE ## From1IntRgb(DSTPTR, DSTPREFIX, DXVAR, rgb); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   257
        } \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   258
    } while (0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   259
90ce3da70b43 Initial load
duke
parents:
diff changeset
   260
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   261
 * This is a "conversion strategy" for use with the DEFINE_XPAR_BLITBG
90ce3da70b43 Initial load
duke
parents:
diff changeset
   262
 * macros.  It converts from the source pixel format to the destination
90ce3da70b43 Initial load
duke
parents:
diff changeset
   263
 * via the specified intermediate format while substituting the specified
90ce3da70b43 Initial load
duke
parents:
diff changeset
   264
 * bgcolor for transparent pixels.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   265
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   266
#define BgCopyXparVia1IntRgb(SRCPTR, SRCTYPE, SRCPREFIX, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   267
                             DSTPTR, DSTTYPE, DSTPREFIX, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   268
                             SXVAR, DXVAR, BGPIXEL, BGPREFIX) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   269
    do { \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   270
        Declare ## SRCTYPE ## Data(XparLoad); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   271
        Load ## SRCTYPE ## Data(SRCPTR, SRCPREFIX, SXVAR, XparLoad); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   272
        if (Is ## SRCTYPE ## DataTransparent(XparLoad)) { \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   273
            Store ## DSTTYPE ## PixelData(DSTPTR, DXVAR, BGPIXEL, BGPREFIX); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   274
        } else { \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   275
            int rgb; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   276
            Convert ## SRCTYPE ## DataTo1IntRgb(XparLoad, rgb); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   277
            Store ## DSTTYPE ## From1IntRgb(DSTPTR, DSTPREFIX, DXVAR, rgb); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   278
        } \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   279
    } while (0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   280
90ce3da70b43 Initial load
duke
parents:
diff changeset
   281
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   282
 * This macro determines whether or not the given pixel is considered
90ce3da70b43 Initial load
duke
parents:
diff changeset
   283
 * "transparent" for XOR purposes.  The ARGB pixel is considered
90ce3da70b43 Initial load
duke
parents:
diff changeset
   284
 * "transparent" if the alpha value is < 0.5.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   285
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   286
#define IsArgbTransparent(pixel) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   287
    (((jint) pixel) >= 0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   288
90ce3da70b43 Initial load
duke
parents:
diff changeset
   289
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   290
 * This is a "conversion strategy" for use with the DEFINE_XOR_BLIT macro.  It
90ce3da70b43 Initial load
duke
parents:
diff changeset
   291
 * converts the source pixel to an intermediate ARGB value and then converts
90ce3da70b43 Initial load
duke
parents:
diff changeset
   292
 * the ARGB value to the pixel representation for the destination surface.  It
90ce3da70b43 Initial load
duke
parents:
diff changeset
   293
 * then XORs the srcpixel, xorpixel, and destination pixel together and stores
90ce3da70b43 Initial load
duke
parents:
diff changeset
   294
 * the result in the destination surface.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   295
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   296
#define XorVia1IntArgb(SRCPTR, SRCTYPE, SRCPREFIX, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   297
                       DSTPTR, DSTTYPE, DSTANYTYPE, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   298
                       XVAR, XORPIXEL, XORPREFIX, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   299
                       MASK, MASKPREFIX, DSTINFOPTR) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   300
    do { \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   301
        jint srcpixel; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   302
        Declare ## DSTANYTYPE ## PixelData(pix) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   303
        Load ## SRCTYPE ## To1IntArgb(SRCPTR, SRCPREFIX, XVAR, srcpixel); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   304
 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   305
        if (IsArgbTransparent(srcpixel)) { \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   306
            break; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   307
        } \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   308
 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   309
        DSTTYPE ## PixelFromArgb(srcpixel, srcpixel, DSTINFOPTR); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   310
 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   311
        Extract ## DSTANYTYPE ## PixelData(srcpixel, pix); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   312
        Xor ## DSTANYTYPE ## PixelData(srcpixel, pix, DSTPTR, XVAR, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   313
                                       XORPIXEL, XORPREFIX, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   314
                                       MASK, MASKPREFIX); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   315
    } while (0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   316
90ce3da70b43 Initial load
duke
parents:
diff changeset
   317
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   318
 * "LUT_STRATEGY" macro sets.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   319
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   320
 * There are 2 major strategies for dealing with luts and 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   321
 * implementations of those strategies.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   322
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   323
 * The 2 strategies are "PreProcessLut" and "ConvertOnTheFly".
90ce3da70b43 Initial load
duke
parents:
diff changeset
   324
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   325
 * For the "PreProcessLut" strategy, the raw ARGB lut supplied
90ce3da70b43 Initial load
duke
parents:
diff changeset
   326
 * by the SD_LOCK_LUT flag is converted at the beginning into a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   327
 * form that is more suited for storing into the destination
90ce3da70b43 Initial load
duke
parents:
diff changeset
   328
 * pixel format.  The inner loop consists of a series of table
90ce3da70b43 Initial load
duke
parents:
diff changeset
   329
 * lookups with very little conversion from that intermediate
90ce3da70b43 Initial load
duke
parents:
diff changeset
   330
 * pixel format.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   331
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   332
 * For the "ConvertOnTheFly" strategy, the raw ARGB values are
90ce3da70b43 Initial load
duke
parents:
diff changeset
   333
 * converted on a pixel by pixel basis in the inner loop itself.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   334
 * This strategy is most useful for formats which tend to use
90ce3da70b43 Initial load
duke
parents:
diff changeset
   335
 * the ARGB color format as their pixel format also.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   336
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   337
 * Each of these strategies has 3 implementations which are needed
90ce3da70b43 Initial load
duke
parents:
diff changeset
   338
 * for the special cases:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   339
 * - straight conversion (invoked from DEFINE_CONVERT_BLIT_LUT)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   340
 * - straight conversion with transparency handling (invoked from
90ce3da70b43 Initial load
duke
parents:
diff changeset
   341
 *   DEFINE_XPAR_CONVERT_BLIT_LUT)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   342
 * - straight conversion with a bgcolor for the transparent pixels
90ce3da70b43 Initial load
duke
parents:
diff changeset
   343
 *   (invoked from DEFINE_XPAR_BLITBG_LUT)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   344
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   345
90ce3da70b43 Initial load
duke
parents:
diff changeset
   346
/***
90ce3da70b43 Initial load
duke
parents:
diff changeset
   347
 * Start of PreProcessLut strategy macros, CONVERT_BLIT implementation.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   348
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   349
#define LutSize(TYPE) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   350
    (1 << TYPE ## BitsPerPixel)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   351
90ce3da70b43 Initial load
duke
parents:
diff changeset
   352
#define DeclarePreProcessLutLut(SRC, DST, PIXLUT) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   353
    DST ## PixelType PIXLUT[LutSize(SRC)];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   354
90ce3da70b43 Initial load
duke
parents:
diff changeset
   355
#define SetupPreProcessLutLut(SRC, DST, PIXLUT, SRCINFO, DSTINFO) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   356
    do { \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   357
        jint *srcLut = (SRCINFO)->lutBase; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   358
        juint lutSize = (SRCINFO)->lutSize; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   359
        Declare ## DST ## StoreVars(PreLut) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   360
        Init ## DST ## StoreVarsY(PreLut, DSTINFO); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   361
        if (lutSize >= LutSize(SRC)) { \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   362
            lutSize = LutSize(SRC); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   363
        } else { \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   364
            DST ## PixelType *pPIXLUT = &PIXLUT[lutSize]; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   365
            do { \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   366
                Store ## DST ## From1IntArgb(pPIXLUT, PreLut, 0, 0); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   367
            } while (++pPIXLUT < &PIXLUT[LutSize(SRC)]); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   368
        } \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   369
        BlitLoopXRel(DST, DSTINFO, PreLut, x, lutSize, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   370
                     do { \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   371
                         jint argb = srcLut[x]; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   372
                         Store ## DST ## From1IntArgb(PIXLUT, PreLut, x, argb); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   373
                     } while (0)); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   374
    } while (0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   375
90ce3da70b43 Initial load
duke
parents:
diff changeset
   376
#define BodyPreProcessLutLut(SRCPTR, SRCTYPE, PIXLUT, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   377
                             DSTPTR, DSTTYPE, DSTPREFIX, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   378
                             SXVAR, DXVAR) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   379
    DSTPTR[DXVAR] = PIXLUT[SRCPTR[SXVAR]]
90ce3da70b43 Initial load
duke
parents:
diff changeset
   380
90ce3da70b43 Initial load
duke
parents:
diff changeset
   381
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   382
 * End of PreProcessLut/CONVERT_BLIT macros.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   383
 ***/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   384
90ce3da70b43 Initial load
duke
parents:
diff changeset
   385
/***
90ce3da70b43 Initial load
duke
parents:
diff changeset
   386
 * Start of ConvertOnTheFly strategy macros, CONVERT_BLIT implementation.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   387
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   388
#define DeclareConvertOnTheFlyLut(SRC, DST, PIXLUT) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   389
    Declare ## SRC ## LoadVars(PIXLUT)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   390
90ce3da70b43 Initial load
duke
parents:
diff changeset
   391
#define SetupConvertOnTheFlyLut(SRC, DST, PIXLUT, SRCINFO, DSTINFO) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   392
    Init ## SRC ## LoadVars(PIXLUT, SRCINFO)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   393
90ce3da70b43 Initial load
duke
parents:
diff changeset
   394
#define BodyConvertOnTheFlyLut(SRCPTR, SRCTYPE, PIXLUT, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   395
                               DSTPTR, DSTTYPE, DSTPREFIX, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   396
                               SXVAR, DXVAR) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   397
    ConvertVia1IntArgb(SRCPTR, SRCTYPE, PIXLUT, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   398
                       DSTPTR, DSTTYPE, DSTPREFIX, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   399
                       SXVAR, DXVAR)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   400
90ce3da70b43 Initial load
duke
parents:
diff changeset
   401
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   402
 * End of ConvertOnTheFly/CONVERT_BLIT macros.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   403
 ***/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   404
90ce3da70b43 Initial load
duke
parents:
diff changeset
   405
/***
90ce3da70b43 Initial load
duke
parents:
diff changeset
   406
 * Start of PreProcessLut strategy macros, XPAR_CONVERT_BLIT implementation.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   407
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   408
#define DeclarePreProcessLutXparLut(SRC, DST, PIXLUT) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   409
    jint PIXLUT[LutSize(SRC)];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   410
90ce3da70b43 Initial load
duke
parents:
diff changeset
   411
#define SetupPreProcessLutXparLut(SRC, DST, PIXLUT, SRCINFO, DSTINFO) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   412
    do { \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   413
        jint *srcLut = (SRCINFO)->lutBase; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   414
        juint lutSize = (SRCINFO)->lutSize; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   415
        Declare ## DST ## StoreVars(PreLut) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   416
        Init ## DST ## StoreVarsY(PreLut, DSTINFO); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   417
        if (lutSize >= LutSize(SRC)) { \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   418
            lutSize = LutSize(SRC); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   419
        } else { \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   420
            jint *pPIXLUT = &PIXLUT[lutSize]; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   421
            do { \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   422
                pPIXLUT[0] = DST ## XparLutEntry; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   423
            } while (++pPIXLUT < &PIXLUT[LutSize(SRC)]); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   424
        } \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   425
        BlitLoopXRel(DST, DSTINFO, PreLut, x, lutSize, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   426
                     do { \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   427
                         jint argb = srcLut[x]; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   428
                         if (argb < 0) { \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   429
                             Store ## DST ## NonXparFromArgb \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   430
                                 (PIXLUT, PreLut, x, argb); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   431
                         } else { \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   432
                             PIXLUT[x] = DST ## XparLutEntry; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   433
                         } \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   434
                     } while (0)); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   435
    } while (0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   436
90ce3da70b43 Initial load
duke
parents:
diff changeset
   437
#define BodyPreProcessLutXparLut(SRCPTR, SRCTYPE, PIXLUT, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   438
                                 DSTPTR, DSTTYPE, DSTPREFIX, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   439
                                 SXVAR, DXVAR) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   440
    do { \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   441
        jint pix = PIXLUT[SRCPTR[SXVAR]]; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   442
        if (! DSTTYPE ## IsXparLutEntry(pix)) { \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   443
            DSTPTR[DXVAR] = (DSTTYPE ## PixelType) pix; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   444
        } \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   445
    } while (0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   446
90ce3da70b43 Initial load
duke
parents:
diff changeset
   447
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   448
 * End of PreProcessLut/XPAR_CONVERT_BLIT macros.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   449
 ***/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   450
90ce3da70b43 Initial load
duke
parents:
diff changeset
   451
/***
90ce3da70b43 Initial load
duke
parents:
diff changeset
   452
 * Start of ConvertOnTheFly strategy macros, CONVERT_BLIT implementation.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   453
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   454
#define DeclareConvertOnTheFlyXparLut(SRC, DST, PIXLUT) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   455
    Declare ## SRC ## LoadVars(PIXLUT)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   456
90ce3da70b43 Initial load
duke
parents:
diff changeset
   457
#define SetupConvertOnTheFlyXparLut(SRC, DST, PIXLUT, SRCINFO, DSTINFO) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   458
    Init ## SRC ## LoadVars(PIXLUT, SRCINFO)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   459
90ce3da70b43 Initial load
duke
parents:
diff changeset
   460
#define BodyConvertOnTheFlyXparLut(SRCPTR, SRCTYPE, PIXLUT, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   461
                                   DSTPTR, DSTTYPE, DSTPREFIX, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   462
                                   SXVAR, DXVAR) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   463
    do { \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   464
        jint argb; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   465
        Load ## SRCTYPE ## To1IntArgb(SRCPTR, PIXLUT, SXVAR, argb); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   466
        if (argb < 0) { \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   467
            Store ## DSTTYPE ## From1IntArgb(DSTPTR, DSTPREFIX, DXVAR, argb); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   468
        } \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   469
    } while (0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   470
90ce3da70b43 Initial load
duke
parents:
diff changeset
   471
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   472
 * End of ConvertOnTheFly/CONVERT_BLIT macros.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   473
 ***/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   474
90ce3da70b43 Initial load
duke
parents:
diff changeset
   475
/***
90ce3da70b43 Initial load
duke
parents:
diff changeset
   476
 * Start of PreProcessLut strategy macros, BLITBG implementation.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   477
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   478
#define DeclarePreProcessLutBgLut(SRC, DST, PIXLUT) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   479
    jint PIXLUT[LutSize(SRC)];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   480
90ce3da70b43 Initial load
duke
parents:
diff changeset
   481
#define SetupPreProcessLutBgLut(SRC, DST, PIXLUT, SRCINFO, DSTINFO, BGPIXEL) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   482
    do { \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   483
        jint *srcLut = (SRCINFO)->lutBase; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   484
        juint lutSize = (SRCINFO)->lutSize; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   485
        Declare ## DST ## StoreVars(PreLut) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   486
        Init ## DST ## StoreVarsY(PreLut, DSTINFO); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   487
        if (lutSize >= LutSize(SRC)) { \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   488
            lutSize = LutSize(SRC); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   489
        } else { \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   490
            jint *pPIXLUT = &PIXLUT[lutSize]; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   491
            do { \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   492
                pPIXLUT[0] = BGPIXEL; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   493
            } while (++pPIXLUT < &PIXLUT[LutSize(SRC)]); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   494
        } \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   495
        BlitLoopXRel(DST, DSTINFO, PreLut, x, lutSize, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   496
                     do { \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   497
                         jint argb = srcLut[x]; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   498
                         if (argb < 0) { \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   499
                             Store ## DST ## From1IntArgb(PIXLUT, PreLut, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   500
                                                          x, argb); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   501
                         } else { \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   502
                             PIXLUT[x] = BGPIXEL; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   503
                         } \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   504
                     } while (0)); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   505
    } while (0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   506
90ce3da70b43 Initial load
duke
parents:
diff changeset
   507
#define BodyPreProcessLutBgLut(SRCPTR, SRCTYPE, PIXLUT, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   508
                               DSTPTR, DSTTYPE, DSTPREFIX, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   509
                               SXVAR, DXVAR, BGPIXEL) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   510
    do { \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   511
        jint pix = PIXLUT[SRCPTR[SXVAR]]; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   512
        Store ## DSTTYPE ## Pixel(DSTPTR, DXVAR, pix); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   513
    } while (0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   514
90ce3da70b43 Initial load
duke
parents:
diff changeset
   515
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   516
 * End of PreProcessLut/BLITBG implementation.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   517
 ***/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   518
90ce3da70b43 Initial load
duke
parents:
diff changeset
   519
/***
90ce3da70b43 Initial load
duke
parents:
diff changeset
   520
 * Start of ConvertOnTheFly strategy macros, BLITBG implementation.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   521
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   522
#define DeclareConvertOnTheFlyBgLut(SRC, DST, PIXLUT) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   523
    Declare ## SRC ## LoadVars(PIXLUT) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   524
    Declare ## DST ## PixelData(bgpix);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   525
90ce3da70b43 Initial load
duke
parents:
diff changeset
   526
#define SetupConvertOnTheFlyBgLut(SRC, DST, PIXLUT, SRCINFO, DSTINFO, BGPIXEL) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   527
    do { \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   528
        Init ## SRC ## LoadVars(PIXLUT, SRCINFO); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   529
        Extract ## DST ## PixelData(BGPIXEL, bgpix); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   530
    } while (0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   531
90ce3da70b43 Initial load
duke
parents:
diff changeset
   532
#define BodyConvertOnTheFlyBgLut(SRCPTR, SRCTYPE, PIXLUT, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   533
                                 DSTPTR, DSTTYPE, DSTPREFIX, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   534
                                 SXVAR, DXVAR, BGPIXEL) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   535
    do { \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   536
        jint argb; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   537
        Load ## SRCTYPE ## To1IntArgb(SRCPTR, PIXLUT, SXVAR, argb); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   538
        if (argb < 0) { \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   539
            Store ## DSTTYPE ## From1IntArgb(DSTPTR, DSTPREFIX, DXVAR, argb); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   540
        } else { \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   541
            Store ## DSTTYPE ## PixelData(DSTPTR, DXVAR, BGPIXEL, bgpix); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   542
        } \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   543
    } while (0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   544
90ce3da70b43 Initial load
duke
parents:
diff changeset
   545
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   546
 * End of ConvertOnTheFly/BLITBG macros.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   547
 ***/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   548
90ce3da70b43 Initial load
duke
parents:
diff changeset
   549
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   550
 * These macros provide consistent naming conventions for the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   551
 * various types of native primitive inner loop functions.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   552
 * The names are mechanically constructed from the SurfaceType names.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   553
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   554
#define NAME_CONVERT_BLIT(SRC, DST)      SRC ## To ## DST ## Convert
90ce3da70b43 Initial load
duke
parents:
diff changeset
   555
90ce3da70b43 Initial load
duke
parents:
diff changeset
   556
#define NAME_SCALE_BLIT(SRC, DST)        SRC ## To ## DST ## ScaleConvert
90ce3da70b43 Initial load
duke
parents:
diff changeset
   557
90ce3da70b43 Initial load
duke
parents:
diff changeset
   558
#define NAME_XPAR_CONVERT_BLIT(SRC, DST) SRC ## To ## DST ## XparOver
90ce3da70b43 Initial load
duke
parents:
diff changeset
   559
90ce3da70b43 Initial load
duke
parents:
diff changeset
   560
#define NAME_XPAR_SCALE_BLIT(SRC, DST)   SRC ## To ## DST ## ScaleXparOver
90ce3da70b43 Initial load
duke
parents:
diff changeset
   561
90ce3da70b43 Initial load
duke
parents:
diff changeset
   562
#define NAME_XPAR_BLITBG(SRC, DST)       SRC ## To ## DST ## XparBgCopy
90ce3da70b43 Initial load
duke
parents:
diff changeset
   563
90ce3da70b43 Initial load
duke
parents:
diff changeset
   564
#define NAME_XOR_BLIT(SRC, DST)          SRC ## To ## DST ## XorBlit
90ce3da70b43 Initial load
duke
parents:
diff changeset
   565
90ce3da70b43 Initial load
duke
parents:
diff changeset
   566
#define NAME_ISOCOPY_BLIT(ANYTYPE)       ANYTYPE ## IsomorphicCopy
90ce3da70b43 Initial load
duke
parents:
diff changeset
   567
90ce3da70b43 Initial load
duke
parents:
diff changeset
   568
#define NAME_ISOSCALE_BLIT(ANYTYPE)      ANYTYPE ## IsomorphicScaleCopy
90ce3da70b43 Initial load
duke
parents:
diff changeset
   569
90ce3da70b43 Initial load
duke
parents:
diff changeset
   570
#define NAME_ISOXOR_BLIT(ANYTYPE)        ANYTYPE ## IsomorphicXorCopy
90ce3da70b43 Initial load
duke
parents:
diff changeset
   571
90ce3da70b43 Initial load
duke
parents:
diff changeset
   572
#define NAME_SOLID_FILLRECT(TYPE)        TYPE ## SetRect
90ce3da70b43 Initial load
duke
parents:
diff changeset
   573
90ce3da70b43 Initial load
duke
parents:
diff changeset
   574
#define NAME_SOLID_FILLSPANS(TYPE)       TYPE ## SetSpans
90ce3da70b43 Initial load
duke
parents:
diff changeset
   575
90ce3da70b43 Initial load
duke
parents:
diff changeset
   576
#define NAME_SOLID_DRAWLINE(TYPE)        TYPE ## SetLine
90ce3da70b43 Initial load
duke
parents:
diff changeset
   577
90ce3da70b43 Initial load
duke
parents:
diff changeset
   578
#define NAME_XOR_FILLRECT(TYPE)          TYPE ## XorRect
90ce3da70b43 Initial load
duke
parents:
diff changeset
   579
90ce3da70b43 Initial load
duke
parents:
diff changeset
   580
#define NAME_XOR_FILLSPANS(TYPE)         TYPE ## XorSpans
90ce3da70b43 Initial load
duke
parents:
diff changeset
   581
90ce3da70b43 Initial load
duke
parents:
diff changeset
   582
#define NAME_XOR_DRAWLINE(TYPE)          TYPE ## XorLine
90ce3da70b43 Initial load
duke
parents:
diff changeset
   583
90ce3da70b43 Initial load
duke
parents:
diff changeset
   584
#define NAME_SRC_MASKFILL(TYPE)          TYPE ## SrcMaskFill
90ce3da70b43 Initial load
duke
parents:
diff changeset
   585
90ce3da70b43 Initial load
duke
parents:
diff changeset
   586
#define NAME_SRCOVER_MASKFILL(TYPE)      TYPE ## SrcOverMaskFill
90ce3da70b43 Initial load
duke
parents:
diff changeset
   587
90ce3da70b43 Initial load
duke
parents:
diff changeset
   588
#define NAME_ALPHA_MASKFILL(TYPE)        TYPE ## AlphaMaskFill
90ce3da70b43 Initial load
duke
parents:
diff changeset
   589
90ce3da70b43 Initial load
duke
parents:
diff changeset
   590
#define NAME_SRCOVER_MASKBLIT(SRC, DST)  SRC ## To ## DST ## SrcOverMaskBlit
90ce3da70b43 Initial load
duke
parents:
diff changeset
   591
90ce3da70b43 Initial load
duke
parents:
diff changeset
   592
#define NAME_ALPHA_MASKBLIT(SRC, DST)    SRC ## To ## DST ## AlphaMaskBlit
90ce3da70b43 Initial load
duke
parents:
diff changeset
   593
90ce3da70b43 Initial load
duke
parents:
diff changeset
   594
#define NAME_SOLID_DRAWGLYPHLIST(TYPE)   TYPE ## DrawGlyphList
90ce3da70b43 Initial load
duke
parents:
diff changeset
   595
90ce3da70b43 Initial load
duke
parents:
diff changeset
   596
#define NAME_SOLID_DRAWGLYPHLISTAA(TYPE) TYPE ## DrawGlyphListAA
90ce3da70b43 Initial load
duke
parents:
diff changeset
   597
90ce3da70b43 Initial load
duke
parents:
diff changeset
   598
#define NAME_SOLID_DRAWGLYPHLISTLCD(TYPE) TYPE ## DrawGlyphListLCD
90ce3da70b43 Initial load
duke
parents:
diff changeset
   599
90ce3da70b43 Initial load
duke
parents:
diff changeset
   600
#define NAME_XOR_DRAWGLYPHLIST(TYPE)     TYPE ## DrawGlyphListXor
90ce3da70b43 Initial load
duke
parents:
diff changeset
   601
90ce3da70b43 Initial load
duke
parents:
diff changeset
   602
#define NAME_TRANSFORMHELPER(TYPE, MODE) TYPE ## MODE ## TransformHelper
90ce3da70b43 Initial load
duke
parents:
diff changeset
   603
90ce3da70b43 Initial load
duke
parents:
diff changeset
   604
#define NAME_TRANSFORMHELPER_NN(TYPE)    NAME_TRANSFORMHELPER(TYPE, NrstNbr)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   605
#define NAME_TRANSFORMHELPER_BL(TYPE)    NAME_TRANSFORMHELPER(TYPE, Bilinear)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   606
#define NAME_TRANSFORMHELPER_BC(TYPE)    NAME_TRANSFORMHELPER(TYPE, Bicubic)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   607
90ce3da70b43 Initial load
duke
parents:
diff changeset
   608
#define NAME_TRANSFORMHELPER_FUNCS(TYPE) TYPE ## TransformHelperFuncs
90ce3da70b43 Initial load
duke
parents:
diff changeset
   609
90ce3da70b43 Initial load
duke
parents:
diff changeset
   610
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   611
 * These macros conveniently name and declare the indicated native
90ce3da70b43 Initial load
duke
parents:
diff changeset
   612
 * primitive loop function for forward referencing.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   613
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   614
#define DECLARE_CONVERT_BLIT(SRC, DST) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   615
    BlitFunc NAME_CONVERT_BLIT(SRC, DST)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   616
90ce3da70b43 Initial load
duke
parents:
diff changeset
   617
#define DECLARE_SCALE_BLIT(SRC, DST) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   618
    ScaleBlitFunc NAME_SCALE_BLIT(SRC, DST)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   619
90ce3da70b43 Initial load
duke
parents:
diff changeset
   620
#define DECLARE_XPAR_CONVERT_BLIT(SRC, DST) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   621
    BlitFunc NAME_XPAR_CONVERT_BLIT(SRC, DST)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   622
90ce3da70b43 Initial load
duke
parents:
diff changeset
   623
#define DECLARE_XPAR_SCALE_BLIT(SRC, DST) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   624
    ScaleBlitFunc NAME_XPAR_SCALE_BLIT(SRC, DST)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   625
90ce3da70b43 Initial load
duke
parents:
diff changeset
   626
#define DECLARE_XPAR_BLITBG(SRC, DST) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   627
    BlitBgFunc NAME_XPAR_BLITBG(SRC, DST)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   628
90ce3da70b43 Initial load
duke
parents:
diff changeset
   629
#define DECLARE_XOR_BLIT(SRC, DST) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   630
    BlitFunc NAME_XOR_BLIT(SRC, DST)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   631
90ce3da70b43 Initial load
duke
parents:
diff changeset
   632
#define DECLARE_ISOCOPY_BLIT(ANYTYPE) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   633
    BlitFunc NAME_ISOCOPY_BLIT(ANYTYPE)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   634
90ce3da70b43 Initial load
duke
parents:
diff changeset
   635
#define DECLARE_ISOSCALE_BLIT(ANYTYPE) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   636
    ScaleBlitFunc NAME_ISOSCALE_BLIT(ANYTYPE)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   637
90ce3da70b43 Initial load
duke
parents:
diff changeset
   638
#define DECLARE_ISOXOR_BLIT(ANYTYPE) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   639
    BlitFunc NAME_ISOXOR_BLIT(ANYTYPE)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   640
90ce3da70b43 Initial load
duke
parents:
diff changeset
   641
#define DECLARE_SOLID_FILLRECT(TYPE) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   642
    FillRectFunc NAME_SOLID_FILLRECT(TYPE)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   643
90ce3da70b43 Initial load
duke
parents:
diff changeset
   644
#define DECLARE_SOLID_FILLSPANS(TYPE) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   645
    FillSpansFunc NAME_SOLID_FILLSPANS(TYPE)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   646
90ce3da70b43 Initial load
duke
parents:
diff changeset
   647
#define DECLARE_SOLID_DRAWLINE(TYPE) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   648
    DrawLineFunc NAME_SOLID_DRAWLINE(TYPE)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   649
90ce3da70b43 Initial load
duke
parents:
diff changeset
   650
#define DECLARE_XOR_FILLRECT(TYPE) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   651
    FillRectFunc NAME_XOR_FILLRECT(TYPE)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   652
90ce3da70b43 Initial load
duke
parents:
diff changeset
   653
#define DECLARE_XOR_FILLSPANS(TYPE) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   654
    FillSpansFunc NAME_XOR_FILLSPANS(TYPE)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   655
90ce3da70b43 Initial load
duke
parents:
diff changeset
   656
#define DECLARE_XOR_DRAWLINE(TYPE) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   657
    DrawLineFunc NAME_XOR_DRAWLINE(TYPE)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   658
90ce3da70b43 Initial load
duke
parents:
diff changeset
   659
#define DECLARE_ALPHA_MASKFILL(TYPE) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   660
    MaskFillFunc NAME_ALPHA_MASKFILL(TYPE)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   661
90ce3da70b43 Initial load
duke
parents:
diff changeset
   662
#define DECLARE_SRC_MASKFILL(TYPE) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   663
    MaskFillFunc NAME_SRC_MASKFILL(TYPE)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   664
90ce3da70b43 Initial load
duke
parents:
diff changeset
   665
#define DECLARE_SRCOVER_MASKFILL(TYPE) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   666
    MaskFillFunc NAME_SRCOVER_MASKFILL(TYPE)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   667
90ce3da70b43 Initial load
duke
parents:
diff changeset
   668
#define DECLARE_SRCOVER_MASKBLIT(SRC, DST) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   669
    MaskBlitFunc NAME_SRCOVER_MASKBLIT(SRC, DST)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   670
90ce3da70b43 Initial load
duke
parents:
diff changeset
   671
#define DECLARE_ALPHA_MASKBLIT(SRC, DST) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   672
    MaskBlitFunc NAME_ALPHA_MASKBLIT(SRC, DST)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   673
90ce3da70b43 Initial load
duke
parents:
diff changeset
   674
#define DECLARE_SOLID_DRAWGLYPHLIST(TYPE) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   675
    DrawGlyphListFunc NAME_SOLID_DRAWGLYPHLIST(TYPE)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   676
90ce3da70b43 Initial load
duke
parents:
diff changeset
   677
#define DECLARE_SOLID_DRAWGLYPHLISTAA(TYPE) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   678
    DrawGlyphListAAFunc NAME_SOLID_DRAWGLYPHLISTAA(TYPE)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   679
90ce3da70b43 Initial load
duke
parents:
diff changeset
   680
#define DECLARE_SOLID_DRAWGLYPHLISTLCD(TYPE) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   681
    DrawGlyphListLCDFunc NAME_SOLID_DRAWGLYPHLISTLCD(TYPE)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   682
90ce3da70b43 Initial load
duke
parents:
diff changeset
   683
#define DECLARE_XOR_DRAWGLYPHLIST(TYPE) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   684
    DrawGlyphListFunc NAME_XOR_DRAWGLYPHLIST(TYPE)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   685
90ce3da70b43 Initial load
duke
parents:
diff changeset
   686
#define DECLARE_TRANSFORMHELPER_FUNCS(TYPE) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   687
    TransformHelperFunc NAME_TRANSFORMHELPER_NN(TYPE); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   688
    TransformHelperFunc NAME_TRANSFORMHELPER_BL(TYPE); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   689
    TransformHelperFunc NAME_TRANSFORMHELPER_BC(TYPE); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   690
    TransformHelperFuncs NAME_TRANSFORMHELPER_FUNCS(TYPE)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   691
90ce3da70b43 Initial load
duke
parents:
diff changeset
   692
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   693
 * These macros construct the necessary NativePrimitive structure
90ce3da70b43 Initial load
duke
parents:
diff changeset
   694
 * for the indicated native primitive loop function which will be
90ce3da70b43 Initial load
duke
parents:
diff changeset
   695
 * declared somewhere prior and defined elsewhere (usually after).
90ce3da70b43 Initial load
duke
parents:
diff changeset
   696
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   697
#define REGISTER_CONVERT_BLIT(SRC, DST) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   698
    REGISTER_BLIT(SRC, SrcNoEa, DST, NAME_CONVERT_BLIT(SRC, DST))
90ce3da70b43 Initial load
duke
parents:
diff changeset
   699
90ce3da70b43 Initial load
duke
parents:
diff changeset
   700
#define REGISTER_CONVERT_BLIT_FLAGS(SRC, DST, SFLAGS, DFLAGS) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   701
    REGISTER_BLIT_FLAGS(SRC, SrcNoEa, DST, NAME_CONVERT_BLIT(SRC, DST), \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   702
                        SFLAGS, DFLAGS)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   703
90ce3da70b43 Initial load
duke
parents:
diff changeset
   704
#define REGISTER_CONVERT_BLIT_EQUIV(SRC, DST, FUNC) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   705
    REGISTER_BLIT(SRC, SrcNoEa, DST, FUNC)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   706
90ce3da70b43 Initial load
duke
parents:
diff changeset
   707
#define REGISTER_SCALE_BLIT(SRC, DST) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   708
    REGISTER_SCALEBLIT(SRC, SrcNoEa, DST, NAME_SCALE_BLIT(SRC, DST))
90ce3da70b43 Initial load
duke
parents:
diff changeset
   709
90ce3da70b43 Initial load
duke
parents:
diff changeset
   710
#define REGISTER_SCALE_BLIT_FLAGS(SRC, DST, SFLAGS, DFLAGS) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   711
    REGISTER_SCALEBLIT_FLAGS(SRC, SrcNoEa, DST, NAME_SCALE_BLIT(SRC, DST), \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   712
                             SFLAGS, DFLAGS)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   713
90ce3da70b43 Initial load
duke
parents:
diff changeset
   714
#define REGISTER_SCALE_BLIT_EQUIV(SRC, DST, FUNC) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   715
    REGISTER_SCALEBLIT(SRC, SrcNoEa, DST, FUNC)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   716
90ce3da70b43 Initial load
duke
parents:
diff changeset
   717
#define REGISTER_XPAR_CONVERT_BLIT(SRC, DST) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   718
    REGISTER_BLIT(SRC, SrcOverBmNoEa, DST, NAME_XPAR_CONVERT_BLIT(SRC, DST))
90ce3da70b43 Initial load
duke
parents:
diff changeset
   719
90ce3da70b43 Initial load
duke
parents:
diff changeset
   720
#define REGISTER_XPAR_CONVERT_BLIT_EQUIV(SRC, DST, FUNC) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   721
    REGISTER_BLIT(SRC, SrcOverBmNoEa, DST, FUNC)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   722
90ce3da70b43 Initial load
duke
parents:
diff changeset
   723
#define REGISTER_XPAR_SCALE_BLIT(SRC, DST) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   724
    REGISTER_SCALEBLIT(SRC, SrcOverBmNoEa, DST, NAME_XPAR_SCALE_BLIT(SRC, DST))
90ce3da70b43 Initial load
duke
parents:
diff changeset
   725
90ce3da70b43 Initial load
duke
parents:
diff changeset
   726
#define REGISTER_XPAR_SCALE_BLIT_EQUIV(SRC, DST, FUNC) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   727
    REGISTER_SCALEBLIT(SRC, SrcOverBmNoEa, DST, FUNC)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   728
90ce3da70b43 Initial load
duke
parents:
diff changeset
   729
#define REGISTER_XPAR_BLITBG(SRC, DST) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   730
    REGISTER_BLITBG(SRC, SrcNoEa, DST, NAME_XPAR_BLITBG(SRC, DST))
90ce3da70b43 Initial load
duke
parents:
diff changeset
   731
90ce3da70b43 Initial load
duke
parents:
diff changeset
   732
#define REGISTER_XPAR_BLITBG_EQUIV(SRC, DST, FUNC) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   733
    REGISTER_BLITBG(SRC, SrcNoEa, DST, FUNC)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   734
90ce3da70b43 Initial load
duke
parents:
diff changeset
   735
#define REGISTER_XOR_BLIT(SRC, DST) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   736
    REGISTER_BLIT(SRC, Xor, DST, NAME_XOR_BLIT(SRC, DST))
90ce3da70b43 Initial load
duke
parents:
diff changeset
   737
90ce3da70b43 Initial load
duke
parents:
diff changeset
   738
#define REGISTER_ISOCOPY_BLIT(THISTYPE, ANYTYPE) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   739
    REGISTER_BLIT(THISTYPE, SrcNoEa, THISTYPE, NAME_ISOCOPY_BLIT(ANYTYPE))
90ce3da70b43 Initial load
duke
parents:
diff changeset
   740
90ce3da70b43 Initial load
duke
parents:
diff changeset
   741
#define REGISTER_ISOSCALE_BLIT(THISTYPE, ANYTYPE) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   742
    REGISTER_SCALEBLIT(THISTYPE, SrcNoEa, THISTYPE, NAME_ISOSCALE_BLIT(ANYTYPE))
90ce3da70b43 Initial load
duke
parents:
diff changeset
   743
90ce3da70b43 Initial load
duke
parents:
diff changeset
   744
#define REGISTER_ISOXOR_BLIT(THISTYPE, ANYTYPE) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   745
    REGISTER_BLIT(THISTYPE, Xor, THISTYPE, NAME_ISOXOR_BLIT(ANYTYPE))
90ce3da70b43 Initial load
duke
parents:
diff changeset
   746
90ce3da70b43 Initial load
duke
parents:
diff changeset
   747
#define REGISTER_SOLID_FILLRECT(TYPE) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   748
    REGISTER_FILLRECT(AnyColor, SrcNoEa, TYPE, NAME_SOLID_FILLRECT(TYPE))
90ce3da70b43 Initial load
duke
parents:
diff changeset
   749
90ce3da70b43 Initial load
duke
parents:
diff changeset
   750
#define REGISTER_SOLID_FILLSPANS(TYPE) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   751
    REGISTER_FILLSPANS(AnyColor, SrcNoEa, TYPE, NAME_SOLID_FILLSPANS(TYPE))
90ce3da70b43 Initial load
duke
parents:
diff changeset
   752
90ce3da70b43 Initial load
duke
parents:
diff changeset
   753
#define REGISTER_SOLID_LINE_PRIMITIVES(TYPE) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   754
    REGISTER_LINE_PRIMITIVES(AnyColor, SrcNoEa, TYPE, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   755
                             NAME_SOLID_DRAWLINE(TYPE))
90ce3da70b43 Initial load
duke
parents:
diff changeset
   756
90ce3da70b43 Initial load
duke
parents:
diff changeset
   757
#define REGISTER_XOR_FILLRECT(TYPE) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   758
    REGISTER_FILLRECT(AnyColor, Xor, TYPE, NAME_XOR_FILLRECT(TYPE))
90ce3da70b43 Initial load
duke
parents:
diff changeset
   759
90ce3da70b43 Initial load
duke
parents:
diff changeset
   760
#define REGISTER_XOR_FILLSPANS(TYPE) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   761
    REGISTER_FILLSPANS(AnyColor, Xor, TYPE, NAME_XOR_FILLSPANS(TYPE))
90ce3da70b43 Initial load
duke
parents:
diff changeset
   762
90ce3da70b43 Initial load
duke
parents:
diff changeset
   763
#define REGISTER_XOR_LINE_PRIMITIVES(TYPE) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   764
    REGISTER_LINE_PRIMITIVES(AnyColor, Xor, TYPE, NAME_XOR_DRAWLINE(TYPE))
90ce3da70b43 Initial load
duke
parents:
diff changeset
   765
90ce3da70b43 Initial load
duke
parents:
diff changeset
   766
#define REGISTER_ALPHA_MASKFILL(TYPE) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   767
    REGISTER_MASKFILL(AnyColor, AnyAlpha, TYPE, NAME_ALPHA_MASKFILL(TYPE))
90ce3da70b43 Initial load
duke
parents:
diff changeset
   768
90ce3da70b43 Initial load
duke
parents:
diff changeset
   769
#define REGISTER_SRC_MASKFILL(TYPE) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   770
    REGISTER_MASKFILL(AnyColor, Src, TYPE, NAME_SRC_MASKFILL(TYPE))
90ce3da70b43 Initial load
duke
parents:
diff changeset
   771
90ce3da70b43 Initial load
duke
parents:
diff changeset
   772
#define REGISTER_SRCOVER_MASKFILL(TYPE) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   773
    REGISTER_MASKFILL(AnyColor, SrcOver, TYPE, NAME_SRCOVER_MASKFILL(TYPE))
90ce3da70b43 Initial load
duke
parents:
diff changeset
   774
90ce3da70b43 Initial load
duke
parents:
diff changeset
   775
#define REGISTER_SRCOVER_MASKBLIT(SRC, DST) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   776
    REGISTER_MASKBLIT(SRC, SrcOver, DST, NAME_SRCOVER_MASKBLIT(SRC, DST))
90ce3da70b43 Initial load
duke
parents:
diff changeset
   777
90ce3da70b43 Initial load
duke
parents:
diff changeset
   778
#define REGISTER_ALPHA_MASKBLIT(SRC, DST) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   779
    REGISTER_MASKBLIT(SRC, AnyAlpha, DST, NAME_ALPHA_MASKBLIT(SRC, DST))
90ce3da70b43 Initial load
duke
parents:
diff changeset
   780
90ce3da70b43 Initial load
duke
parents:
diff changeset
   781
#define REGISTER_SOLID_DRAWGLYPHLIST(TYPE) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   782
    REGISTER_DRAWGLYPHLIST(AnyColor, SrcNoEa, TYPE, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   783
                           NAME_SOLID_DRAWGLYPHLIST(TYPE))
90ce3da70b43 Initial load
duke
parents:
diff changeset
   784
90ce3da70b43 Initial load
duke
parents:
diff changeset
   785
#define REGISTER_SOLID_DRAWGLYPHLISTAA(TYPE) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   786
    REGISTER_DRAWGLYPHLISTAA(AnyColor, SrcNoEa, TYPE, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   787
                             NAME_SOLID_DRAWGLYPHLISTAA(TYPE))
90ce3da70b43 Initial load
duke
parents:
diff changeset
   788
90ce3da70b43 Initial load
duke
parents:
diff changeset
   789
#define REGISTER_SOLID_DRAWGLYPHLISTLCD(TYPE) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   790
    REGISTER_DRAWGLYPHLISTLCD(AnyColor, SrcNoEa, TYPE, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   791
                             NAME_SOLID_DRAWGLYPHLISTLCD(TYPE))
90ce3da70b43 Initial load
duke
parents:
diff changeset
   792
90ce3da70b43 Initial load
duke
parents:
diff changeset
   793
#define REGISTER_XOR_DRAWGLYPHLIST(TYPE) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   794
    REGISTER_DRAWGLYPHLIST(AnyColor, Xor, TYPE, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   795
                           NAME_XOR_DRAWGLYPHLIST(TYPE)), \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   796
    REGISTER_DRAWGLYPHLISTAA(AnyColor, Xor, TYPE, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   797
                             NAME_XOR_DRAWGLYPHLIST(TYPE))
90ce3da70b43 Initial load
duke
parents:
diff changeset
   798
90ce3da70b43 Initial load
duke
parents:
diff changeset
   799
#define REGISTER_TRANSFORMHELPER_FUNCS(TYPE) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   800
    REGISTER_PRIMITIVE(TransformHelper, TYPE, SrcNoEa, IntArgbPre, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   801
                       (AnyFunc *) &NAME_TRANSFORMHELPER_FUNCS(TYPE))
90ce3da70b43 Initial load
duke
parents:
diff changeset
   802
90ce3da70b43 Initial load
duke
parents:
diff changeset
   803
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   804
 * This macro defines an entire function to implement a Blit inner loop
90ce3da70b43 Initial load
duke
parents:
diff changeset
   805
 * for copying pixels of a common type from one buffer to another.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   806
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   807
#define DEFINE_ISOCOPY_BLIT(ANYTYPE) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   808
void NAME_ISOCOPY_BLIT(ANYTYPE)(void *srcBase, void *dstBase, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   809
                                juint width, juint height, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   810
                                SurfaceDataRasInfo *pSrcInfo, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   811
                                SurfaceDataRasInfo *pDstInfo, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   812
                                NativePrimitive *pPrim, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   813
                                CompositeInfo *pCompInfo) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   814
{ \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   815
    Declare ## ANYTYPE ## StoreVars(DstWrite) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   816
    BlitLoopHeight(ANYTYPE, pSrc, srcBase, pSrcInfo, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   817
                   ANYTYPE, pDst, dstBase, pDstInfo, DstWrite, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   818
                   height, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   819
                   memcpy(pDst, pSrc, width * ANYTYPE ## PixelStride)); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   820
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   821
90ce3da70b43 Initial load
duke
parents:
diff changeset
   822
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   823
 * This macro defines an entire function to implement a ScaleBlit inner loop
90ce3da70b43 Initial load
duke
parents:
diff changeset
   824
 * for scaling pixels of a common type from one buffer to another.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   825
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   826
#define DEFINE_ISOSCALE_BLIT(ANYTYPE) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   827
void NAME_ISOSCALE_BLIT(ANYTYPE)(void *srcBase, void *dstBase, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   828
                                 juint width, juint height, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   829
                                 jint sxloc, jint syloc, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   830
                                 jint sxinc, jint syinc, jint shift, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   831
                                 SurfaceDataRasInfo *pSrcInfo, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   832
                                 SurfaceDataRasInfo *pDstInfo, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   833
                                 NativePrimitive *pPrim, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   834
                                 CompositeInfo *pCompInfo) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   835
{ \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   836
    Declare ## ANYTYPE ## StoreVars(DstWrite) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   837
    BlitLoopScaleWidthHeight(ANYTYPE, pSrc, srcBase, pSrcInfo, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   838
                             ANYTYPE, pDst, dstBase, pDstInfo, DstWrite, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   839
                             x, width, height, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   840
                             sxloc, syloc, sxinc, syinc, shift, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   841
                             Copy ## ANYTYPE ## PixelData(pSrc, x, pDst, 0)); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   842
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   843
90ce3da70b43 Initial load
duke
parents:
diff changeset
   844
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   845
 * This macro defines an entire function to implement a Blit inner loop
90ce3da70b43 Initial load
duke
parents:
diff changeset
   846
 * for XORing pixels of a common type from one buffer into another.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   847
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   848
#define DEFINE_ISOXOR_BLIT(ANYTYPE) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   849
void NAME_ISOXOR_BLIT(ANYTYPE)(void *srcBase, void *dstBase, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   850
                               juint width, juint height, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   851
                               SurfaceDataRasInfo *pSrcInfo, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   852
                               SurfaceDataRasInfo *pDstInfo, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   853
                               NativePrimitive *pPrim, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   854
                               CompositeInfo *pCompInfo) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   855
{ \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   856
    jint xorpixel = pCompInfo->details.xorPixel; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   857
    Declare ## ANYTYPE ## PixelData(xor) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   858
    Declare ## ANYTYPE ## StoreVars(DstWrite) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   859
 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   860
    Extract ## ANYTYPE ## PixelData(xorpixel, xor); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   861
 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   862
    BlitLoopWidthHeight(ANYTYPE, pSrc, srcBase, pSrcInfo, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   863
                        ANYTYPE, pDst, dstBase, pDstInfo, DstWrite, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   864
                        width, height, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   865
                        XorCopy ## ANYTYPE ## PixelData(pSrc, pDst, 0, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   866
                                                        xorpixel, xor)); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   867
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   868
90ce3da70b43 Initial load
duke
parents:
diff changeset
   869
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   870
 * This macro defines an entire function to implement a Blit inner loop
90ce3da70b43 Initial load
duke
parents:
diff changeset
   871
 * for converting pixels from a buffer of one type into a buffer of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   872
 * another type.  No blending is done of the pixels.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   873
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   874
#define DEFINE_CONVERT_BLIT(SRC, DST, STRATEGY) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   875
void NAME_CONVERT_BLIT(SRC, DST)(void *srcBase, void *dstBase, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   876
                                 juint width, juint height, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   877
                                 SurfaceDataRasInfo *pSrcInfo, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   878
                                 SurfaceDataRasInfo *pDstInfo, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   879
                                 NativePrimitive *pPrim, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   880
                                 CompositeInfo *pCompInfo) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   881
{ \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   882
    Declare ## SRC ## LoadVars(SrcRead) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   883
    Declare ## DST ## StoreVars(DstWrite) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   884
 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   885
    Init ## SRC ## LoadVars(SrcRead, pSrcInfo); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   886
    BlitLoopWidthHeight(SRC, pSrc, srcBase, pSrcInfo, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   887
                        DST, pDst, dstBase, pDstInfo, DstWrite, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   888
                        width, height, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   889
                        ConvertVia ## STRATEGY(pSrc, SRC, SrcRead, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   890
                                               pDst, DST, DstWrite, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   891
                                               0, 0)); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   892
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   893
90ce3da70b43 Initial load
duke
parents:
diff changeset
   894
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   895
 * This macro defines an entire function to implement a Blit inner loop
90ce3da70b43 Initial load
duke
parents:
diff changeset
   896
 * for converting pixels from a buffer of byte pixels with a lookup
90ce3da70b43 Initial load
duke
parents:
diff changeset
   897
 * table into a buffer of another type.  No blending is done of the pixels.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   898
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   899
#define DEFINE_CONVERT_BLIT_LUT(SRC, DST, LUT_STRATEGY) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   900
void NAME_CONVERT_BLIT(SRC, DST)(void *srcBase, void *dstBase, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   901
                                 juint width, juint height, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   902
                                 SurfaceDataRasInfo *pSrcInfo, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   903
                                 SurfaceDataRasInfo *pDstInfo, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   904
                                 NativePrimitive *pPrim, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   905
                                 CompositeInfo *pCompInfo) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   906
{ \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   907
    Declare ## DST ## StoreVars(DstWrite) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   908
    Declare ## LUT_STRATEGY ## Lut(SRC, DST, pixLut) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   909
 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   910
    Setup ## LUT_STRATEGY ## Lut(SRC, DST, pixLut,\
90ce3da70b43 Initial load
duke
parents:
diff changeset
   911
                                 pSrcInfo, pDstInfo); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   912
    BlitLoopWidthHeight(SRC, pSrc, srcBase, pSrcInfo, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   913
                        DST, pDst, dstBase, pDstInfo, DstWrite, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   914
                        width, height, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   915
                        Body ## LUT_STRATEGY ## Lut(pSrc, SRC, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   916
                                                    pixLut, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   917
                                                    pDst, DST, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   918
                                                    DstWrite, 0, 0));\
90ce3da70b43 Initial load
duke
parents:
diff changeset
   919
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   920
#define DEFINE_CONVERT_BLIT_LUT8(SRC, DST, LUT_STRATEGY) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   921
    DEFINE_CONVERT_BLIT_LUT(SRC, DST, LUT_STRATEGY)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   922
90ce3da70b43 Initial load
duke
parents:
diff changeset
   923
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   924
 * This macro defines an entire function to implement a ScaleBlit inner
90ce3da70b43 Initial load
duke
parents:
diff changeset
   925
 * loop for scaling and converting pixels from a buffer of one type into
90ce3da70b43 Initial load
duke
parents:
diff changeset
   926
 * a buffer of another type.  No blending is done of the pixels.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   927
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   928
#define DEFINE_SCALE_BLIT(SRC, DST, STRATEGY) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   929
void NAME_SCALE_BLIT(SRC, DST)(void *srcBase, void *dstBase, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   930
                               juint width, juint height, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   931
                               jint sxloc, jint syloc, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   932
                               jint sxinc, jint syinc, jint shift, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   933
                               SurfaceDataRasInfo *pSrcInfo, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   934
                               SurfaceDataRasInfo *pDstInfo, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   935
                               NativePrimitive *pPrim, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   936
                               CompositeInfo *pCompInfo) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   937
{ \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   938
    Declare ## SRC ## LoadVars(SrcRead) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   939
    Declare ## DST ## StoreVars(DstWrite) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   940
 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   941
    Init ## SRC ## LoadVars(SrcRead, pSrcInfo); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   942
    BlitLoopScaleWidthHeight(SRC, pSrc, srcBase, pSrcInfo, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   943
                             DST, pDst, dstBase, pDstInfo, DstWrite, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   944
                             x, width, height, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   945
                             sxloc, syloc, sxinc, syinc, shift, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   946
                             ConvertVia ## STRATEGY(pSrc, SRC, SrcRead, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   947
                                                    pDst, DST, DstWrite, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   948
                                                    x, 0)); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   949
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   950
90ce3da70b43 Initial load
duke
parents:
diff changeset
   951
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   952
 * This macro defines an entire function to implement a ScaleBlit inner
90ce3da70b43 Initial load
duke
parents:
diff changeset
   953
 * loop for scaling and converting pixels from a buffer of byte pixels
90ce3da70b43 Initial load
duke
parents:
diff changeset
   954
 * with a lookup table into a buffer of another type.  No blending is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   955
 * done of the pixels.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   956
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   957
#define DEFINE_SCALE_BLIT_LUT(SRC, DST, LUT_STRATEGY) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   958
void NAME_SCALE_BLIT(SRC, DST)(void *srcBase, void *dstBase, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   959
                               juint width, juint height, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   960
                               jint sxloc, jint syloc, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   961
                               jint sxinc, jint syinc, jint shift, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   962
                               SurfaceDataRasInfo *pSrcInfo, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   963
                               SurfaceDataRasInfo *pDstInfo, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   964
                               NativePrimitive *pPrim, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   965
                               CompositeInfo *pCompInfo) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   966
{ \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   967
    Declare ## DST ## StoreVars(DstWrite) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   968
    Declare ## LUT_STRATEGY ## Lut(SRC, DST, pixLut) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   969
 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   970
    Setup ## LUT_STRATEGY ## Lut(SRC, DST, pixLut, pSrcInfo, pDstInfo); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   971
    BlitLoopScaleWidthHeight(SRC, pSrc, srcBase, pSrcInfo, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   972
                             DST, pDst, dstBase, pDstInfo, DstWrite, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   973
                             x, width, height, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   974
                             sxloc, syloc, sxinc, syinc, shift, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   975
                             Body ## LUT_STRATEGY ## Lut(pSrc, SRC, pixLut, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   976
                                                         pDst, DST, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   977
                                                         DstWrite, x, 0));\
90ce3da70b43 Initial load
duke
parents:
diff changeset
   978
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   979
#define DEFINE_SCALE_BLIT_LUT8(SRC, DST, LUT_STRATEGY) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   980
    DEFINE_SCALE_BLIT_LUT(SRC, DST, LUT_STRATEGY)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   981
90ce3da70b43 Initial load
duke
parents:
diff changeset
   982
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   983
 * This macro defines an entire function to implement a Blit inner loop
90ce3da70b43 Initial load
duke
parents:
diff changeset
   984
 * for drawing opaque pixels from a buffer of one type onto a buffer of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   985
 * another type, ignoring the transparent pixels in the source buffer.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   986
 * No blending is done of the pixels - the converted pixel value is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   987
 * either copied or the destination is left untouched.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   988
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   989
#define DEFINE_XPAR_CONVERT_BLIT(SRC, DST, STRATEGY) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   990
void NAME_XPAR_CONVERT_BLIT(SRC, DST)(void *srcBase, void *dstBase, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   991
                                      juint width, juint height, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   992
                                      SurfaceDataRasInfo *pSrcInfo, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   993
                                      SurfaceDataRasInfo *pDstInfo, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   994
                                      NativePrimitive *pPrim, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   995
                                      CompositeInfo *pCompInfo) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   996
{ \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   997
    Declare ## SRC ## LoadVars(SrcRead) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   998
    Declare ## DST ## StoreVars(DstWrite) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   999
 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1000
    Init ## SRC ## LoadVars(SrcRead, pSrcInfo); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1001
    BlitLoopWidthHeight(SRC, pSrc, srcBase, pSrcInfo, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1002
                        DST, pDst, dstBase, pDstInfo, DstWrite, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1003
                        width, height, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1004
                        ConvertXparVia ## STRATEGY(pSrc, SRC, SrcRead, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1005
                                                   pDst, DST, DstWrite, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1006
                                                   0, 0)); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1007
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1008
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1009
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1010
 * This macro defines an entire function to implement a Blit inner loop
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1011
 * for converting pixels from a buffer of byte pixels with a lookup
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1012
 * table containing transparent pixels into a buffer of another type.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1013
 * No blending is done of the pixels - the converted pixel value is
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1014
 * either copied or the destination is left untouched.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1015
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1016
#define DEFINE_XPAR_CONVERT_BLIT_LUT(SRC, DST, LUT_STRATEGY) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1017
void NAME_XPAR_CONVERT_BLIT(SRC, DST)(void *srcBase, void *dstBase, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1018
                                      juint width, juint height, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1019
                                      SurfaceDataRasInfo *pSrcInfo, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1020
                                      SurfaceDataRasInfo *pDstInfo, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1021
                                      NativePrimitive *pPrim, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1022
                                      CompositeInfo *pCompInfo) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1023
{ \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1024
    Declare ## DST ## StoreVars(DstWrite) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1025
    Declare ## LUT_STRATEGY ## XparLut(SRC, DST, pixLut) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1026
 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1027
    Setup ## LUT_STRATEGY ## XparLut(SRC, DST, pixLut, pSrcInfo, pDstInfo); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1028
    BlitLoopWidthHeight(SRC, pSrc, srcBase, pSrcInfo, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1029
                        DST, pDst, dstBase, pDstInfo, DstWrite, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1030
                        width, height, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1031
                        Body ## LUT_STRATEGY ## XparLut(pSrc, SRC, pixLut, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1032
                                                        pDst, DST, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1033
                                                        DstWrite, 0, 0)); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1034
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1035
#define DEFINE_XPAR_CONVERT_BLIT_LUT8(SRC, DST, LUT_STRATEGY) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1036
    DEFINE_XPAR_CONVERT_BLIT_LUT(SRC, DST, LUT_STRATEGY)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1037
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1038
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1039
 * This macro defines an entire function to implement a ScaleBlit inner
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1040
 * loop for scaling and converting pixels from a buffer of byte pixels
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1041
 * with a lookup table containing transparent pixels into a buffer of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1042
 * another type.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1043
 * No blending is done of the pixels - the converted pixel value is
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1044
 * either copied or the destination is left untouched.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1045
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1046
#define DEFINE_XPAR_SCALE_BLIT_LUT(SRC, DST, LUT_STRATEGY) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1047
void NAME_XPAR_SCALE_BLIT(SRC, DST)(void *srcBase, void *dstBase, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1048
                                    juint width, juint height, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1049
                                    jint sxloc, jint syloc, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1050
                                    jint sxinc, jint syinc, jint shift, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1051
                                    SurfaceDataRasInfo *pSrcInfo, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1052
                                    SurfaceDataRasInfo *pDstInfo, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1053
                                    NativePrimitive *pPrim, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1054
                                    CompositeInfo *pCompInfo) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1055
{ \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1056
    Declare ## DST ## StoreVars(DstWrite) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1057
    Declare ## LUT_STRATEGY ## XparLut(SRC, DST, pixLut) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1058
 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1059
    Setup ## LUT_STRATEGY ## XparLut(SRC, DST, pixLut, pSrcInfo, pDstInfo); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1060
    BlitLoopScaleWidthHeight(SRC, pSrc, srcBase, pSrcInfo, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1061
                             DST, pDst, dstBase, pDstInfo, DstWrite, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1062
                             x, width, height, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1063
                             sxloc, syloc, sxinc, syinc, shift, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1064
                             Body ## LUT_STRATEGY ## XparLut(pSrc, SRC, pixLut, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1065
                                                             pDst, DST, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1066
                                                             DstWrite, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1067
                                                             x, 0)); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1068
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1069
#define DEFINE_XPAR_SCALE_BLIT_LUT8(SRC, DST, LUT_STRATEGY) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1070
    DEFINE_XPAR_SCALE_BLIT_LUT(SRC, DST, LUT_STRATEGY)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1071
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1072
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1073
 * This macro defines an entire function to implement a ScaleBlit inner
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1074
 * loop for scaling and converting pixels from a buffer of one type
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1075
 * containing transparent pixels into a buffer of another type.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1076
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1077
 * No blending is done of the pixels - the converted pixel value is
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1078
 * either copied or the destination is left untouched.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1079
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1080
#define DEFINE_XPAR_SCALE_BLIT(SRC, DST, STRATEGY) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1081
void NAME_XPAR_SCALE_BLIT(SRC, DST)(void *srcBase, void *dstBase, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1082
                               juint width, juint height, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1083
                               jint sxloc, jint syloc, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1084
                               jint sxinc, jint syinc, jint shift, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1085
                               SurfaceDataRasInfo *pSrcInfo, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1086
                               SurfaceDataRasInfo *pDstInfo, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1087
                               NativePrimitive *pPrim, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1088
                               CompositeInfo *pCompInfo) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1089
{ \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1090
    Declare ## SRC ## LoadVars(SrcRead) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1091
    Declare ## DST ## StoreVars(DstWrite) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1092
 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1093
    Init ## SRC ## LoadVars(SrcRead, pSrcInfo); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1094
    BlitLoopScaleWidthHeight(SRC, pSrc, srcBase, pSrcInfo, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1095
                             DST, pDst, dstBase, pDstInfo, DstWrite, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1096
                             x, width, height, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1097
                             sxloc, syloc, sxinc, syinc, shift, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1098
                             ConvertXparVia ## STRATEGY(pSrc, SRC, SrcRead, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1099
                                                        pDst, DST, DstWrite, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1100
                                                        x, 0)); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1101
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1102
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1103
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1104
 * This macro defines an entire function to implement a BlitBg inner loop
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1105
 * for converting pixels from a buffer of one type containing transparent
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1106
 * pixels into a buffer of another type with a specified bgcolor for the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1107
 * transparent pixels.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1108
 * No blending is done of the pixels other than to substitute the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1109
 * bgcolor for any transparent pixels.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1110
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1111
#define DEFINE_XPAR_BLITBG(SRC, DST, STRATEGY) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1112
void NAME_XPAR_BLITBG(SRC, DST)(void *srcBase, void *dstBase, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1113
                                juint width, juint height, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1114
                                jint bgpixel, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1115
                                SurfaceDataRasInfo *pSrcInfo, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1116
                                SurfaceDataRasInfo *pDstInfo, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1117
                                NativePrimitive *pPrim, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1118
                                CompositeInfo *pCompInfo) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1119
{ \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1120
    Declare ## SRC ## LoadVars(SrcRead) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1121
    Declare ## DST ## StoreVars(DstWrite) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1122
    Declare ## DST ## PixelData(bgdata) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1123
 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1124
    Extract ## DST ## PixelData(bgpixel, bgdata); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1125
    BlitLoopWidthHeight(SRC, pSrc, srcBase, pSrcInfo, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1126
                        DST, pDst, dstBase, pDstInfo, DstWrite, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1127
                        width, height, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1128
                        BgCopyXparVia ## STRATEGY(pSrc, SRC, SrcRead, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1129
                                                  pDst, DST, DstWrite, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1130
                                                  0, 0, bgpixel, bgdata)); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1131
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1132
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1133
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1134
 * This macro defines an entire function to implement a BlitBg inner loop
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1135
 * for converting pixels from a buffer of byte pixels with a lookup
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1136
 * table containing transparent pixels into a buffer of another type
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1137
 * with a specified bgcolor for the transparent pixels.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1138
 * No blending is done of the pixels other than to substitute the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1139
 * bgcolor for any transparent pixels.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1140
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1141
#define DEFINE_XPAR_BLITBG_LUT(SRC, DST, LUT_STRATEGY) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1142
void NAME_XPAR_BLITBG(SRC, DST)(void *srcBase, void *dstBase, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1143
                                juint width, juint height, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1144
                                jint bgpixel, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1145
                                SurfaceDataRasInfo *pSrcInfo, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1146
                                SurfaceDataRasInfo *pDstInfo, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1147
                                NativePrimitive *pPrim, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1148
                                CompositeInfo *pCompInfo) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1149
{ \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1150
    Declare ## DST ## StoreVars(DstWrite) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1151
    Declare ## LUT_STRATEGY ## BgLut(SRC, DST, pixLut) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1152
 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1153
    Setup ## LUT_STRATEGY ## BgLut(SRC, DST, pixLut, pSrcInfo, pDstInfo, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1154
                                   bgpixel); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1155
    BlitLoopWidthHeight(SRC, pSrc, srcBase, pSrcInfo, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1156
                        DST, pDst, dstBase, pDstInfo, DstWrite, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1157
                        width, height, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1158
                        Body ## LUT_STRATEGY ## BgLut(pSrc, SRC, pixLut, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1159
                                                      pDst, DST, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1160
                                                      DstWrite, 0, 0, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1161
                                                      bgpixel)); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1162
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1163
#define DEFINE_XPAR_BLITBG_LUT8(SRC, DST, LUT_STRATEGY) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1164
    DEFINE_XPAR_BLITBG_LUT(SRC, DST, LUT_STRATEGY)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1165
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1166
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1167
 * This macro defines an entire function to implement a Blit inner loop
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1168
 * for converting pixels from a buffer of one type into a buffer of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1169
 * another type.  Each source pixel is XORed with the current XOR color value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1170
 * That result is then XORed with the destination pixel and the final
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1171
 * result is stored in the destination surface.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1172
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1173
#define DEFINE_XOR_BLIT(SRC, DST, DSTANYTYPE) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1174
void NAME_XOR_BLIT(SRC, DST)(void *srcBase, void *dstBase, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1175
                             juint width, juint height, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1176
                             SurfaceDataRasInfo *pSrcInfo, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1177
                             SurfaceDataRasInfo *pDstInfo, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1178
                             NativePrimitive *pPrim, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1179
                             CompositeInfo *pCompInfo) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1180
{ \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1181
    jint xorpixel = pCompInfo->details.xorPixel; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1182
    juint alphamask = pCompInfo->alphaMask; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1183
    Declare ## DSTANYTYPE ## PixelData(xor) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1184
    Declare ## DSTANYTYPE ## PixelData(mask) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1185
    Declare ## SRC ## LoadVars(SrcRead) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1186
    Declare ## DST ## StoreVars(DstWrite) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1187
 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1188
    Extract ## DSTANYTYPE ## PixelData(xorpixel, xor); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1189
    Extract ## DSTANYTYPE ## PixelData(alphamask, mask); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1190
 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1191
    Init ## SRC ## LoadVars(SrcRead, pSrcInfo); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1192
    BlitLoopWidthHeight(SRC, pSrc, srcBase, pSrcInfo, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1193
                        DST, pDst, dstBase, pDstInfo, DstWrite, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1194
                        width, height, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1195
                        XorVia1IntArgb(pSrc, SRC, SrcRead, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1196
                                       pDst, DST, DSTANYTYPE, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1197
                                       0, xorpixel, xor, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1198
                                       alphamask, mask, pDstInfo)); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1199
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1200
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1201
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1202
 * This macro defines an entire function to implement a FillRect inner loop
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1203
 * for setting a rectangular region of pixels to a specific pixel value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1204
 * No blending of the fill color is done with the pixels.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1205
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1206
#define DEFINE_SOLID_FILLRECT(DST) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1207
void NAME_SOLID_FILLRECT(DST)(SurfaceDataRasInfo *pRasInfo, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1208
                              jint lox, jint loy, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1209
                              jint hix, jint hiy, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1210
                              jint pixel, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1211
                              NativePrimitive *pPrim, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1212
                              CompositeInfo *pCompInfo) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1213
{ \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1214
    Declare ## DST ## PixelData(pix) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1215
    DST ## DataType *pPix; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1216
    jint scan = pRasInfo->scanStride; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1217
    juint height = hiy - loy; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1218
    juint width = hix - lox; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1219
 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1220
    pPix = PtrCoord(pRasInfo->rasBase, lox, DST ## PixelStride, loy, scan); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1221
    Extract ## DST ## PixelData(pixel, pix); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1222
    do { \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1223
        juint x = 0; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1224
        do { \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1225
            Store ## DST ## PixelData(pPix, x, pixel, pix); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1226
        } while (++x < width); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1227
        pPix = PtrAddBytes(pPix, scan); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1228
    } while (--height > 0); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1229
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1230
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1231
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1232
 * This macro defines an entire function to implement a FillSpans inner loop
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1233
 * for iterating through a list of spans and setting those regions of pixels
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1234
 * to a specific pixel value.  No blending of the fill color is done with
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1235
 * the pixels.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1236
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1237
#define DEFINE_SOLID_FILLSPANS(DST) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1238
void NAME_SOLID_FILLSPANS(DST)(SurfaceDataRasInfo *pRasInfo, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1239
                               SpanIteratorFuncs *pSpanFuncs, void *siData, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1240
                               jint pixel, NativePrimitive *pPrim, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1241
                               CompositeInfo *pCompInfo) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1242
{ \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1243
    void *pBase = pRasInfo->rasBase; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1244
    Declare ## DST ## PixelData(pix) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1245
    jint scan = pRasInfo->scanStride; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1246
    jint bbox[4]; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1247
 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1248
    Extract ## DST ## PixelData(pixel, pix); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1249
    while ((*pSpanFuncs->nextSpan)(siData, bbox)) { \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1250
        jint x = bbox[0]; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1251
        jint y = bbox[1]; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1252
        juint w = bbox[2] - x; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1253
        juint h = bbox[3] - y; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1254
        DST ## DataType *pPix = PtrCoord(pBase, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1255
                                         x, DST ## PixelStride, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1256
                                         y, scan); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1257
        do { \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1258
            juint relx; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1259
            for (relx = 0; relx < w; relx++) { \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1260
                Store ## DST ## PixelData(pPix, relx, pixel, pix); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1261
            } \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1262
            pPix = PtrAddBytes(pPix, scan); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1263
        } while (--h > 0); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1264
    } \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1265
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1266
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1267
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1268
 * This macro declares the bumpmajor and bumpminor variables used for the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1269
 * DrawLine functions.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1270
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1271
#define DeclareBumps(BUMPMAJOR, BUMPMINOR) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1272
    jint BUMPMAJOR, BUMPMINOR;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1273
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1274
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1275
 * This macro extracts "instructions" from the bumpmajor and bumpminor masks
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1276
 * that determine the initial bumpmajor and bumpminor values.  The bumpmajor
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1277
 * and bumpminor masks are laid out in the following format:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1278
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1279
 * bumpmajormask:                      bumpminormask:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1280
 * bit0: bumpmajor = pixelStride       bit0: bumpminor = pixelStride
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1281
 * bit1: bumpmajor = -pixelStride      bit1: bumpminor = -pixelStride
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1282
 * bit2: bumpmajor = scanStride        bit2: bumpminor = scanStride
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1283
 * bit3: bumpmajor = -scanStride       bit3: bumpminor = -scanStride
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1284
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1285
#define InitBumps(BUMPMAJOR, BUMPMINOR, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1286
                  BUMPMAJORMASK, BUMPMINORMASK, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1287
                  PIXELSTRIDE, SCANSTRIDE) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1288
    BUMPMAJOR = (BUMPMAJORMASK & BUMP_POS_PIXEL) ? PIXELSTRIDE : \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1289
                    (BUMPMAJORMASK & BUMP_NEG_PIXEL) ? -PIXELSTRIDE : \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1290
                        (BUMPMAJORMASK & BUMP_POS_SCAN) ? SCANSTRIDE : \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1291
                                                          -SCANSTRIDE; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1292
    BUMPMINOR = (BUMPMINORMASK & BUMP_POS_PIXEL) ? PIXELSTRIDE : \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1293
                    (BUMPMINORMASK & BUMP_NEG_PIXEL) ? -PIXELSTRIDE : \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1294
                        (BUMPMINORMASK & BUMP_POS_SCAN) ? SCANSTRIDE : \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1295
                            (BUMPMINORMASK & BUMP_NEG_SCAN) ? -SCANSTRIDE : \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1296
                                                              0; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1297
    BUMPMINOR += BUMPMAJOR;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1298
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1299
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1300
 * This macro defines an entire function to implement a DrawLine inner loop
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1301
 * for iterating along a horizontal or vertical line and setting the pixels
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1302
 * on that line to a specific pixel value.  No blending of the fill color
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1303
 * is done with the pixels.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1304
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1305
#define DEFINE_SOLID_DRAWLINE(DST) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1306
void NAME_SOLID_DRAWLINE(DST)(SurfaceDataRasInfo *pRasInfo, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1307
                              jint x1, jint y1, jint pixel, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1308
                              jint steps, jint error, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1309
                              jint bumpmajormask, jint errmajor, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1310
                              jint bumpminormask, jint errminor, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1311
                              NativePrimitive *pPrim, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1312
                              CompositeInfo *pCompInfo) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1313
{ \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1314
    Declare ## DST ## PixelData(pix) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1315
    jint scan = pRasInfo->scanStride; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1316
    DST ## DataType *pPix = PtrCoord(pRasInfo->rasBase, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1317
                                     x1, DST ## PixelStride, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1318
                                     y1, scan); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1319
    DeclareBumps(bumpmajor, bumpminor) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1320
 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1321
    InitBumps(bumpmajor, bumpminor, bumpmajormask, bumpminormask, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1322
              DST ## PixelStride, scan); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1323
    Extract ## DST ## PixelData(pixel, pix); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1324
    if (errmajor == 0) { \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1325
        do { \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1326
            Store ## DST ## PixelData(pPix, 0, pixel, pix); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1327
            pPix = PtrAddBytes(pPix, bumpmajor); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1328
        } while (--steps > 0); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1329
    } else { \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1330
        do { \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1331
            Store ## DST ## PixelData(pPix, 0, pixel, pix); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1332
            if (error < 0) { \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1333
                pPix = PtrAddBytes(pPix, bumpmajor); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1334
                error += errmajor; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1335
            } else { \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1336
                pPix = PtrAddBytes(pPix, bumpminor); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1337
                error -= errminor; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1338
            } \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1339
        } while (--steps > 0); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1340
    } \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1341
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1342
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1343
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1344
 * This macro defines an entire function to implement a FillRect inner loop
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1345
 * for setting a rectangular region of pixels to a specific pixel value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1346
 * Each destination pixel is XORed with the current XOR mode color as well as
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1347
 * the current fill color.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1348
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1349
#define DEFINE_XOR_FILLRECT(DST) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1350
void NAME_XOR_FILLRECT(DST)(SurfaceDataRasInfo *pRasInfo, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1351
                            jint lox, jint loy, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1352
                            jint hix, jint hiy, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1353
                            jint pixel, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1354
                            NativePrimitive *pPrim, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1355
                            CompositeInfo *pCompInfo) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1356
{ \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1357
    jint xorpixel = pCompInfo->details.xorPixel; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1358
    juint alphamask = pCompInfo->alphaMask; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1359
    Declare ## DST ## PixelData(xor) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1360
    Declare ## DST ## PixelData(pix) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1361
    Declare ## DST ## PixelData(mask) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1362
    DST ## DataType *pPix; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1363
    jint scan = pRasInfo->scanStride; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1364
    juint height = hiy - loy; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1365
    juint width = hix - lox; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1366
 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1367
    pPix = PtrCoord(pRasInfo->rasBase, lox, DST ## PixelStride, loy, scan); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1368
    Extract ## DST ## PixelData(xorpixel, xor); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1369
    Extract ## DST ## PixelData(pixel, pix); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1370
    Extract ## DST ## PixelData(alphamask, mask); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1371
 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1372
    do { \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1373
        juint x = 0; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1374
        do { \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1375
            Xor ## DST ## PixelData(pixel, pix, pPix, x, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1376
                                    xorpixel, xor, alphamask, mask); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1377
        } while (++x < width); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1378
        pPix = PtrAddBytes(pPix, scan); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1379
    } while (--height > 0); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1380
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1381
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1382
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1383
 * This macro defines an entire function to implement a FillSpans inner loop
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1384
 * for iterating through a list of spans and setting those regions of pixels
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1385
 * to a specific pixel value.  Each destination pixel is XORed with the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1386
 * current XOR mode color as well as the current fill color.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1387
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1388
#define DEFINE_XOR_FILLSPANS(DST) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1389
void NAME_XOR_FILLSPANS(DST)(SurfaceDataRasInfo *pRasInfo, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1390
                             SpanIteratorFuncs *pSpanFuncs, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1391
                             void *siData, jint pixel, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1392
                             NativePrimitive *pPrim, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1393
                             CompositeInfo *pCompInfo) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1394
{ \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1395
    void *pBase = pRasInfo->rasBase; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1396
    jint xorpixel = pCompInfo->details.xorPixel; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1397
    juint alphamask = pCompInfo->alphaMask; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1398
    Declare ## DST ## PixelData(xor) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1399
    Declare ## DST ## PixelData(pix) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1400
    Declare ## DST ## PixelData(mask) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1401
    jint scan = pRasInfo->scanStride; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1402
    jint bbox[4]; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1403
 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1404
    Extract ## DST ## PixelData(xorpixel, xor); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1405
    Extract ## DST ## PixelData(pixel, pix); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1406
    Extract ## DST ## PixelData(alphamask, mask); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1407
 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1408
    while ((*pSpanFuncs->nextSpan)(siData, bbox)) { \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1409
        jint x = bbox[0]; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1410
        jint y = bbox[1]; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1411
        juint w = bbox[2] - x; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1412
        juint h = bbox[3] - y; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1413
        DST ## DataType *pPix = PtrCoord(pBase, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1414
                                         x, DST ## PixelStride, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1415
                                         y, scan); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1416
        do { \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1417
            juint relx; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1418
            for (relx = 0; relx < w; relx++) { \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1419
                Xor ## DST ## PixelData(pixel, pix, pPix, relx, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1420
                                        xorpixel, xor, alphamask, mask); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1421
            } \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1422
            pPix = PtrAddBytes(pPix, scan); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1423
        } while (--h > 0); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1424
    } \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1425
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1426
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1427
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1428
 * This macro defines an entire function to implement a DrawLine inner loop
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1429
 * for iterating along a horizontal or vertical line and setting the pixels
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1430
 * on that line to a specific pixel value.  Each destination pixel is XORed
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1431
 * with the current XOR mode color as well as the current draw color.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1432
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1433
#define DEFINE_XOR_DRAWLINE(DST) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1434
void NAME_XOR_DRAWLINE(DST)(SurfaceDataRasInfo *pRasInfo, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1435
                            jint x1, jint y1, jint pixel, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1436
                            jint steps, jint error, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1437
                            jint bumpmajormask, jint errmajor, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1438
                            jint bumpminormask, jint errminor, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1439
                            NativePrimitive *pPrim, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1440
                            CompositeInfo *pCompInfo) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1441
{ \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1442
    jint xorpixel = pCompInfo->details.xorPixel; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1443
    juint alphamask = pCompInfo->alphaMask; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1444
    Declare ## DST ## PixelData(xor) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1445
    Declare ## DST ## PixelData(pix) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1446
    Declare ## DST ## PixelData(mask) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1447
    jint scan = pRasInfo->scanStride; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1448
    DST ## DataType *pPix = PtrCoord(pRasInfo->rasBase, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1449
                                     x1, DST ## PixelStride, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1450
                                     y1, scan); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1451
    DeclareBumps(bumpmajor, bumpminor) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1452
 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1453
    InitBumps(bumpmajor, bumpminor, bumpmajormask, bumpminormask, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1454
              DST ## PixelStride, scan); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1455
    Extract ## DST ## PixelData(xorpixel, xor); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1456
    Extract ## DST ## PixelData(pixel, pix); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1457
    Extract ## DST ## PixelData(alphamask, mask); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1458
 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1459
    if (errmajor == 0) { \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1460
        do { \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1461
            Xor ## DST ## PixelData(pixel, pix, pPix, 0, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1462
                                    xorpixel, xor, alphamask, mask); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1463
            pPix = PtrAddBytes(pPix, bumpmajor); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1464
        } while (--steps > 0); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1465
    } else { \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1466
        do { \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1467
            Xor ## DST ## PixelData(pixel, pix, pPix, 0, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1468
                                    xorpixel, xor, alphamask, mask); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1469
            if (error < 0) { \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1470
                pPix = PtrAddBytes(pPix, bumpmajor); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1471
                error += errmajor; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1472
            } else { \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1473
                pPix = PtrAddBytes(pPix, bumpminor); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1474
                error -= errminor; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1475
            } \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1476
        } while (--steps > 0); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1477
    } \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1478
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1479
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1480
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1481
 * This macro is used to declare the variables needed by the glyph clipping
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1482
 * macro.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1483
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1484
#define DeclareDrawGlyphListClipVars(PIXELS, ROWBYTES, WIDTH, HEIGHT, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1485
                                     LEFT, TOP, RIGHT, BOTTOM) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1486
    const jubyte * PIXELS; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1487
    int ROWBYTES; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1488
    int LEFT, TOP; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1489
    int WIDTH, HEIGHT; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1490
    int RIGHT, BOTTOM;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1491
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1492
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1493
 * This macro represents the glyph clipping code used in the various
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1494
 * DRAWGLYPHLIST macros.  This macro is typically used within a loop.  Note
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1495
 * that the body of this macro is NOT wrapped in a do..while block due to
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1496
 * the use of continue statements within the block (those continue statements
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1497
 * are intended skip the outer loop, not the do..while loop).  To combat this
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1498
 * problem, pass in the code (typically a continue statement) that should be
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1499
 * executed when a null glyph is encountered.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1500
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1501
#define ClipDrawGlyphList(DST, PIXELS, BYTESPERPIXEL, ROWBYTES, WIDTH, HEIGHT,\
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1502
                          LEFT, TOP, RIGHT, BOTTOM, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1503
                          CLIPLEFT, CLIPTOP, CLIPRIGHT, CLIPBOTTOM, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1504
                          GLYPHS, GLYPHCOUNTER, NULLGLYPHCODE) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1505
    PIXELS = (const jubyte *)GLYPHS[GLYPHCOUNTER].pixels; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1506
    if (!PIXELS) { \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1507
        NULLGLYPHCODE; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1508
    } \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1509
    ROWBYTES = GLYPHS[GLYPHCOUNTER].rowBytes; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1510
    LEFT     = GLYPHS[GLYPHCOUNTER].x; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1511
    TOP      = GLYPHS[GLYPHCOUNTER].y; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1512
    WIDTH    = GLYPHS[GLYPHCOUNTER].width; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1513
    HEIGHT   = GLYPHS[GLYPHCOUNTER].height; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1514
\
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1515
    /* if any clipping required, modify parameters now */ \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1516
    RIGHT  = LEFT + WIDTH; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1517
    BOTTOM = TOP + HEIGHT; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1518
    if (LEFT < CLIPLEFT) { \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1519
    /* Multiply needed for LCD text as PIXELS is really BYTES */ \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1520
        PIXELS += (CLIPLEFT - LEFT) * BYTESPERPIXEL ; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1521
        LEFT = CLIPLEFT; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1522
    } \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1523
    if (TOP < CLIPTOP) { \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1524
        PIXELS += (CLIPTOP - TOP) * ROWBYTES; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1525
        TOP = CLIPTOP; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1526
    } \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1527
    if (RIGHT > CLIPRIGHT) { \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1528
        RIGHT = CLIPRIGHT; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1529
    } \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1530
    if (BOTTOM > CLIPBOTTOM) { \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1531
        BOTTOM = CLIPBOTTOM; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1532
    } \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1533
    if (RIGHT <= LEFT || BOTTOM <= TOP) { \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1534
        NULLGLYPHCODE; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1535
    } \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1536
    WIDTH = RIGHT - LEFT; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1537
    HEIGHT = BOTTOM - TOP;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1538
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1539
#define DEFINE_SOLID_DRAWGLYPHLIST(DST) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1540
void NAME_SOLID_DRAWGLYPHLIST(DST)(SurfaceDataRasInfo *pRasInfo, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1541
                                   ImageRef *glyphs, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1542
                                   jint totalGlyphs, jint fgpixel, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1543
                                   jint argbcolor, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1544
                                   jint clipLeft, jint clipTop, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1545
                                   jint clipRight, jint clipBottom, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1546
                                   NativePrimitive *pPrim, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1547
                                   CompositeInfo *pCompInfo) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1548
{ \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1549
    jint glyphCounter; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1550
    jint scan = pRasInfo->scanStride; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1551
    Declare ## DST ## PixelData(pix) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1552
    DST ## DataType *pPix; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1553
\
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1554
    Extract ## DST ## PixelData(fgpixel, pix); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1555
    for (glyphCounter = 0; glyphCounter < totalGlyphs; glyphCounter++) { \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1556
        DeclareDrawGlyphListClipVars(pixels, rowBytes, width, height, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1557
                                     left, top, right, bottom) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1558
        ClipDrawGlyphList(DST, pixels, 1, rowBytes, width, height, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1559
                          left, top, right, bottom, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1560
                          clipLeft, clipTop, clipRight, clipBottom, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1561
                          glyphs, glyphCounter, continue) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1562
        pPix = PtrCoord(pRasInfo->rasBase,left,DST ## PixelStride,top,scan); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1563
\
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1564
        do { \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1565
            int x = 0; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1566
            do { \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1567
                if (pixels[x]) { \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1568
                    Store ## DST ## PixelData(pPix, x, fgpixel, pix); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1569
                } \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1570
            } while (++x < width); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1571
            pPix = PtrAddBytes(pPix, scan); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1572
            pixels += rowBytes; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1573
        } while (--height > 0); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1574
    } \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1575
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1576
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1577
#define GlyphListAABlend3ByteRgb(DST, GLYPH_PIXELS, PIXEL_INDEX, DST_PTR, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1578
                                 FG_PIXEL, PREFIX, SRC_PREFIX) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1579
   do { \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1580
        DeclareCompVarsFor3ByteRgb(dst) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1581
        jint mixValSrc = GLYPH_PIXELS[PIXEL_INDEX]; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1582
        if (mixValSrc) { \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1583
            if (mixValSrc < 255) { \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1584
                jint mixValDst = 255 - mixValSrc; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1585
                Load ## DST ## To3ByteRgb(DST_PTR, pix, PIXEL_INDEX, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1586
                                          dstR, dstG, dstB); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1587
                MultMultAddAndStore3ByteRgbComps(dst, mixValDst, dst, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1588
                                                 mixValSrc, SRC_PREFIX); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1589
                Store ## DST ## From3ByteRgb(DST_PTR, pix, PIXEL_INDEX, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1590
                                             dstR, dstG, dstB); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1591
            } else { \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1592
                Store ## DST ## PixelData(DST_PTR, PIXEL_INDEX, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1593
                                          FG_PIXEL, PREFIX); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1594
            } \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1595
        } \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1596
    } while (0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1597
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1598
#define GlyphListAABlend4ByteArgb(DST, GLYPH_PIXELS, PIXEL_INDEX, DST_PTR, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1599
                                  FG_PIXEL, PREFIX, SRC_PREFIX) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1600
   do { \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1601
        DeclareAlphaVarFor4ByteArgb(dstA) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1602
        DeclareCompVarsFor4ByteArgb(dst) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1603
        jint mixValSrc = GLYPH_PIXELS[PIXEL_INDEX]; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1604
        if (mixValSrc) { \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1605
            if (mixValSrc < 255) { \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1606
                jint mixValDst = 255 - mixValSrc; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1607
                Load ## DST ## To4ByteArgb(DST_PTR, pix, PIXEL_INDEX, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1608
                                           dstA, dstR, dstG, dstB); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1609
                dstA = MUL8(dstA, mixValDst) + \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1610
                       MUL8(SRC_PREFIX ## A, mixValSrc); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1611
                MultMultAddAndStore4ByteArgbComps(dst, mixValDst, dst, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1612
                                                  mixValSrc, SRC_PREFIX); \
549
4273b1234967 6679308: Poor text rendering on translucent image.
prr
parents: 2
diff changeset
  1613
                if (!(DST ## IsOpaque) && \
4273b1234967 6679308: Poor text rendering on translucent image.
prr
parents: 2
diff changeset
  1614
                    !(DST ## IsPremultiplied) && dstA && dstA < 255) { \
4273b1234967 6679308: Poor text rendering on translucent image.
prr
parents: 2
diff changeset
  1615
                    DivideAndStore4ByteArgbComps(dst, dst, dstA); \
4273b1234967 6679308: Poor text rendering on translucent image.
prr
parents: 2
diff changeset
  1616
                } \
4273b1234967 6679308: Poor text rendering on translucent image.
prr
parents: 2
diff changeset
  1617
                Store ## DST ## From4ByteArgbComps(DST_PTR, pix, \
4273b1234967 6679308: Poor text rendering on translucent image.
prr
parents: 2
diff changeset
  1618
                                                   PIXEL_INDEX, dst); \
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1619
            } else { \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1620
                Store ## DST ## PixelData(DST_PTR, PIXEL_INDEX, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1621
                                          FG_PIXEL, PREFIX); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1622
            } \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1623
        } \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1624
    } while (0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1625
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1626
#define GlyphListAABlend1ByteGray(DST, GLYPH_PIXELS, PIXEL_INDEX, DST_PTR, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1627
                                  FG_PIXEL, PREFIX, SRC_PREFIX) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1628
   do { \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1629
        DeclareCompVarsFor1ByteGray(dst) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1630
        jint mixValSrc = GLYPH_PIXELS[PIXEL_INDEX]; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1631
        if (mixValSrc) { \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1632
            if (mixValSrc < 255) { \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1633
                jint mixValDst = 255 - mixValSrc; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1634
                Load ## DST ## To1ByteGray(DST_PTR, pix, PIXEL_INDEX, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1635
                                           dstG); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1636
                MultMultAddAndStore1ByteGrayComps(dst, mixValDst, dst, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1637
                                                  mixValSrc, SRC_PREFIX); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1638
                Store ## DST ## From1ByteGray(DST_PTR, pix, PIXEL_INDEX, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1639
                                              dstG); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1640
            } else { \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1641
                Store ## DST ## PixelData(DST_PTR, PIXEL_INDEX, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1642
                                          FG_PIXEL, PREFIX); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1643
            } \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1644
        } \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1645
    } while (0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1646
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1647
#define GlyphListAABlend1ShortGray(DST, GLYPH_PIXELS, PIXEL_INDEX, DST_PTR, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1648
                                   FG_PIXEL, PREFIX, SRC_PREFIX) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1649
   do { \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1650
        DeclareCompVarsFor1ShortGray(dst) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1651
        juint mixValSrc = GLYPH_PIXELS[PIXEL_INDEX]; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1652
        if (mixValSrc) { \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1653
            if (mixValSrc < 255) { \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1654
                juint mixValDst; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1655
                PromoteByteAlphaFor1ShortGray(mixValSrc); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1656
                mixValDst = 0xffff - mixValSrc; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1657
                Load ## DST ## To1ShortGray(DST_PTR, pix, PIXEL_INDEX, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1658
                                            dstG); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1659
                MultMultAddAndStore1ShortGrayComps(dst, mixValDst, dst, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1660
                                                   mixValSrc, SRC_PREFIX); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1661
                Store ## DST ## From1ShortGray(DST_PTR, pix, PIXEL_INDEX, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1662
                                               dstG); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1663
            } else { \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1664
                Store ## DST ## PixelData(DST_PTR, PIXEL_INDEX, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1665
                                          FG_PIXEL, PREFIX); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1666
            } \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1667
        } \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1668
    } while (0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1669
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1670
#define DEFINE_SOLID_DRAWGLYPHLISTAA(DST, STRATEGY) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1671
void NAME_SOLID_DRAWGLYPHLISTAA(DST)(SurfaceDataRasInfo *pRasInfo, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1672
                                     ImageRef *glyphs, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1673
                                     jint totalGlyphs, jint fgpixel, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1674
                                     jint argbcolor, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1675
                                     jint clipLeft, jint clipTop, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1676
                                     jint clipRight, jint clipBottom, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1677
                                     NativePrimitive *pPrim, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1678
                                     CompositeInfo *pCompInfo) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1679
{ \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1680
    jint glyphCounter; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1681
    jint scan = pRasInfo->scanStride; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1682
    DST ## DataType *pPix; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1683
    Declare ## DST ## PixelData(solidpix) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1684
    DeclareAlphaVarFor ## STRATEGY(srcA) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1685
    DeclareCompVarsFor ## STRATEGY(src) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1686
\
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1687
    Declare ## DST ## LoadVars(pix) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1688
    Declare ## DST ## StoreVars(pix) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1689
\
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1690
    Init ## DST ## LoadVars(pix, pRasInfo); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1691
    Init ## DST ## StoreVarsY(pix, pRasInfo); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1692
    Init ## DST ## StoreVarsX(pix, pRasInfo); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1693
    Extract ## STRATEGY ## CompsAndAlphaFromArgb(argbcolor, src); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1694
    Extract ## DST ## PixelData(fgpixel, solidpix); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1695
\
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1696
    for (glyphCounter = 0; glyphCounter < totalGlyphs; glyphCounter++) { \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1697
        DeclareDrawGlyphListClipVars(pixels, rowBytes, width, height, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1698
                                     left, top, right, bottom) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1699
        ClipDrawGlyphList(DST, pixels, 1, rowBytes, width, height, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1700
                          left, top, right, bottom, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1701
                          clipLeft, clipTop, clipRight, clipBottom, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1702
                          glyphs, glyphCounter, continue) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1703
        pPix = PtrCoord(pRasInfo->rasBase,left,DST ## PixelStride,top,scan); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1704
\
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1705
        Set ## DST ## StoreVarsYPos(pix, pRasInfo, top); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1706
        do { \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1707
            int x = 0; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1708
            Set ## DST ## StoreVarsXPos(pix, pRasInfo, left); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1709
            do { \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1710
                GlyphListAABlend ## STRATEGY(DST, pixels, x, pPix, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1711
                                             fgpixel, solidpix, src); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1712
                Next ## DST ## StoreVarsX(pix); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1713
            } while (++x < width); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1714
            pPix = PtrAddBytes(pPix, scan); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1715
            pixels += rowBytes; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1716
            Next ## DST ## StoreVarsY(pix); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1717
        } while (--height > 0); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1718
    } \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1719
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1720
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1721
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1722
#define GlyphListLCDBlend3ByteRgb(DST, GLYPH_PIXELS, PIXEL_INDEX, DST_PTR, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1723
                                  FG_PIXEL, PREFIX, SRC_PREFIX) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1724
   do { \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1725
        DeclareCompVarsFor3ByteRgb(dst) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1726
        jint mixValSrcG = GLYPH_PIXELS[PIXEL_INDEX*3+1]; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1727
        jint mixValSrcR, mixValSrcB; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1728
        if (rgbOrder) { \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1729
            mixValSrcR = GLYPH_PIXELS[PIXEL_INDEX*3]; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1730
            mixValSrcB = GLYPH_PIXELS[PIXEL_INDEX*3+2]; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1731
        } else { \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1732
            mixValSrcR = GLYPH_PIXELS[PIXEL_INDEX*3+2]; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1733
            mixValSrcB = GLYPH_PIXELS[PIXEL_INDEX*3]; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1734
        } \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1735
        if ((mixValSrcR | mixValSrcG | mixValSrcB) != 0) { \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1736
            if ((mixValSrcR & mixValSrcG & mixValSrcB) < 255) { \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1737
                jint mixValDstR = 255 - mixValSrcR; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1738
                jint mixValDstG = 255 - mixValSrcG; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1739
                jint mixValDstB = 255 - mixValSrcB; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1740
                Load ## DST ## To3ByteRgb(DST_PTR, pix, PIXEL_INDEX, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1741
                                          dstR, dstG, dstB); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1742
                dstR = invGammaLut[dstR]; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1743
                dstG = invGammaLut[dstG]; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1744
                dstB = invGammaLut[dstB]; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1745
                MultMultAddAndStoreLCD3ByteRgbComps(dst, mixValDst, dst, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1746
                                                    mixValSrc, SRC_PREFIX); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1747
                dstR = gammaLut[dstR]; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1748
                dstG = gammaLut[dstG]; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1749
                dstB = gammaLut[dstB]; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1750
                Store ## DST ## From3ByteRgb(DST_PTR, pix, PIXEL_INDEX, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1751
                                             dstR, dstG, dstB); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1752
            } else { \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1753
                Store ## DST ## PixelData(DST_PTR, PIXEL_INDEX, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1754
                                          FG_PIXEL, PREFIX); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1755
            } \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1756
        } \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1757
    } while (0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1758
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1759
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1760
/* There is no alpha channel in the glyph data with which to interpolate
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1761
 * between the src and dst alphas, but a reasonable approximation is to
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1762
 * sum the coverage alphas of the colour channels and divide by 3.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1763
 * We can approximate division by 3 using mult and shift. See
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1764
 * sun/font/scalerMethods.c for a detailed explanation of why "21931"
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1765
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1766
#define GlyphListLCDBlend4ByteArgb(DST, GLYPH_PIXELS, PIXEL_INDEX, DST_PTR, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1767
                                  FG_PIXEL, PREFIX, SRC_PREFIX) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1768
   do { \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1769
        DeclareAlphaVarFor4ByteArgb(dstA) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1770
        DeclareCompVarsFor4ByteArgb(dst) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1771
        jint mixValSrcG = GLYPH_PIXELS[PIXEL_INDEX*3+1]; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1772
        jint mixValSrcR, mixValSrcB; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1773
        if (rgbOrder) { \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1774
            mixValSrcR = GLYPH_PIXELS[PIXEL_INDEX*3]; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1775
            mixValSrcB = GLYPH_PIXELS[PIXEL_INDEX*3+2]; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1776
        } else { \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1777
            mixValSrcR = GLYPH_PIXELS[PIXEL_INDEX*3+2]; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1778
            mixValSrcB = GLYPH_PIXELS[PIXEL_INDEX*3]; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1779
        } \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1780
        if ((mixValSrcR | mixValSrcG | mixValSrcB) != 0) { \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1781
            if ((mixValSrcR & mixValSrcG & mixValSrcB) < 255) { \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1782
                jint mixValDstR = 255 - mixValSrcR; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1783
                jint mixValDstG = 255 - mixValSrcG; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1784
                jint mixValDstB = 255 - mixValSrcB; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1785
                jint mixValSrcA = ((mixValSrcR + mixValSrcG + mixValSrcB) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1786
                                    * 21931) >> 16;\
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1787
                jint mixValDstA = 255 - mixValSrcA; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1788
                Load ## DST ## To4ByteArgb(DST_PTR, pix, PIXEL_INDEX, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1789
                                           dstA, dstR, dstG, dstB); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1790
                dstR = invGammaLut[dstR]; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1791
                dstG = invGammaLut[dstG]; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1792
                dstB = invGammaLut[dstB]; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1793
                dstA = MUL8(dstA, mixValDstA) + \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1794
                       MUL8(SRC_PREFIX ## A, mixValSrcA); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1795
                MultMultAddAndStoreLCD4ByteArgbComps(dst, mixValDst, dst, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1796
                                                  mixValSrc, SRC_PREFIX); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1797
                dstR = gammaLut[dstR]; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1798
                dstG = gammaLut[dstG]; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1799
                dstB = gammaLut[dstB]; \
549
4273b1234967 6679308: Poor text rendering on translucent image.
prr
parents: 2
diff changeset
  1800
                if (!(DST ## IsOpaque) && \
4273b1234967 6679308: Poor text rendering on translucent image.
prr
parents: 2
diff changeset
  1801
                    !(DST ## IsPremultiplied) && dstA && dstA < 255) { \
4273b1234967 6679308: Poor text rendering on translucent image.
prr
parents: 2
diff changeset
  1802
                    DivideAndStore4ByteArgbComps(dst, dst, dstA); \
4273b1234967 6679308: Poor text rendering on translucent image.
prr
parents: 2
diff changeset
  1803
                } \
4273b1234967 6679308: Poor text rendering on translucent image.
prr
parents: 2
diff changeset
  1804
                Store ## DST ## From4ByteArgbComps(DST_PTR, pix, \
4273b1234967 6679308: Poor text rendering on translucent image.
prr
parents: 2
diff changeset
  1805
                                                   PIXEL_INDEX, dst); \
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1806
            } else { \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1807
                Store ## DST ## PixelData(DST_PTR, PIXEL_INDEX, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1808
                                          FG_PIXEL, PREFIX); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1809
            } \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1810
        } \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1811
    } while (0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1812
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1813
#define DEFINE_SOLID_DRAWGLYPHLISTLCD(DST, STRATEGY) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1814
void NAME_SOLID_DRAWGLYPHLISTLCD(DST)(SurfaceDataRasInfo *pRasInfo, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1815
                                     ImageRef *glyphs, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1816
                                     jint totalGlyphs, jint fgpixel, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1817
                                     jint argbcolor, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1818
                                     jint clipLeft, jint clipTop, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1819
                                     jint clipRight, jint clipBottom, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1820
                                     jint rgbOrder, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1821
                                     unsigned char *gammaLut, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1822
                                     unsigned char * invGammaLut, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1823
                                     NativePrimitive *pPrim, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1824
                                     CompositeInfo *pCompInfo) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1825
{ \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1826
    jint glyphCounter, bpp; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1827
    jint scan = pRasInfo->scanStride; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1828
    DST ## DataType *pPix; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1829
    Declare ## DST ## PixelData(solidpix) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1830
    DeclareAlphaVarFor ## STRATEGY(srcA) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1831
    DeclareCompVarsFor ## STRATEGY(src) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1832
\
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1833
    Declare ## DST ## LoadVars(pix) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1834
    Declare ## DST ## StoreVars(pix) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1835
\
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1836
    Init ## DST ## LoadVars(pix, pRasInfo); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1837
    Init ## DST ## StoreVarsY(pix, pRasInfo); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1838
    Init ## DST ## StoreVarsX(pix, pRasInfo); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1839
    Extract ## STRATEGY ## CompsAndAlphaFromArgb(argbcolor, src); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1840
    Extract ## DST ## PixelData(fgpixel, solidpix); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1841
    srcR = invGammaLut[srcR]; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1842
    srcG = invGammaLut[srcG]; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1843
    srcB = invGammaLut[srcB]; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1844
\
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1845
    for (glyphCounter = 0; glyphCounter < totalGlyphs; glyphCounter++) { \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1846
        DeclareDrawGlyphListClipVars(pixels, rowBytes, width, height, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1847
                                     left, top, right, bottom) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1848
        bpp = \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1849
        (glyphs[glyphCounter].rowBytes == glyphs[glyphCounter].width) ? 1 : 3;\
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1850
        ClipDrawGlyphList(DST, pixels, bpp, rowBytes, width, height, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1851
                          left, top, right, bottom, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1852
                          clipLeft, clipTop, clipRight, clipBottom, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1853
                          glyphs, glyphCounter, continue) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1854
        pPix = PtrCoord(pRasInfo->rasBase,left,DST ## PixelStride,top,scan); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1855
\
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1856
        Set ## DST ## StoreVarsYPos(pix, pRasInfo, top); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1857
        if (bpp!=1) { \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1858
           /* subpixel positioning adjustment */ \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1859
            pixels += glyphs[glyphCounter].rowBytesOffset; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1860
        } \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1861
        do { \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1862
            int x = 0; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1863
            Set ## DST ## StoreVarsXPos(pix, pRasInfo, left); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1864
            if (bpp==1) { \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1865
                do { \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1866
                    if (pixels[x]) { \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1867
                        Store ## DST ## PixelData(pPix, x, fgpixel, solidpix);\
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1868
                    } \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1869
                } while (++x < width); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1870
            } else { \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1871
                do { \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1872
                    GlyphListLCDBlend ## STRATEGY(DST, pixels, x, pPix, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1873
                                                   fgpixel, solidpix, src); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1874
                    Next ## DST ## StoreVarsX(pix); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1875
                } while (++x < width); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1876
            } \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1877
            pPix = PtrAddBytes(pPix, scan); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1878
            pixels += rowBytes; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1879
            Next ## DST ## StoreVarsY(pix); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1880
        } while (--height > 0); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1881
    } \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1882
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1883
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1884
#define DEFINE_XOR_DRAWGLYPHLIST(DST) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1885
void NAME_XOR_DRAWGLYPHLIST(DST)(SurfaceDataRasInfo *pRasInfo, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1886
                                 ImageRef *glyphs, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1887
                                 jint totalGlyphs, jint fgpixel, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1888
                                 jint argbcolor, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1889
                                 jint clipLeft, jint clipTop, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1890
                                 jint clipRight, jint clipBottom, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1891
                                 NativePrimitive *pPrim, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1892
                                 CompositeInfo *pCompInfo) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1893
{ \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1894
    jint glyphCounter; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1895
    jint scan = pRasInfo->scanStride; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1896
    jint xorpixel = pCompInfo->details.xorPixel; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1897
    juint alphamask = pCompInfo->alphaMask; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1898
    Declare ## DST ## PixelData(xor) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1899
    Declare ## DST ## PixelData(pix) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1900
    Declare ## DST ## PixelData(mask) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1901
    DST ## DataType *pPix; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1902
 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1903
    Extract ## DST ## PixelData(xorpixel, xor); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1904
    Extract ## DST ## PixelData(fgpixel, pix); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1905
    Extract ## DST ## PixelData(alphamask, mask); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1906
    for (glyphCounter = 0; glyphCounter < totalGlyphs; glyphCounter++) { \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1907
        DeclareDrawGlyphListClipVars(pixels, rowBytes, width, height, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1908
                                     left, top, right, bottom) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1909
        ClipDrawGlyphList(DST, pixels, 1, rowBytes, width, height, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1910
                          left, top, right, bottom, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1911
                          clipLeft, clipTop, clipRight, clipBottom, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1912
                          glyphs, glyphCounter, continue) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1913
        pPix = PtrCoord(pRasInfo->rasBase,left,DST ## PixelStride,top,scan); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1914
 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1915
        do { \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1916
            int x = 0; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1917
            do { \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1918
                if (pixels[x]) { \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1919
                    Xor ## DST ## PixelData(fgpixel, pix, pPix, x, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1920
                                            xorpixel, xor, alphamask, mask); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1921
                } \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1922
            } while (++x < width); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1923
            pPix = PtrAddBytes(pPix, scan); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1924
            pixels += rowBytes; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1925
        } while (--height > 0); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1926
    } \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1927
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1928
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1929
#define DEFINE_TRANSFORMHELPER_NN(SRC) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1930
void NAME_TRANSFORMHELPER_NN(SRC)(SurfaceDataRasInfo *pSrcInfo, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1931
                                  jint *pRGB, jint numpix, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1932
                                  jlong xlong, jlong dxlong, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1933
                                  jlong ylong, jlong dylong) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1934
{ \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1935
    Declare ## SRC ## LoadVars(SrcRead) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1936
    SRC ## DataType *pBase = pSrcInfo->rasBase; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1937
    jint scan = pSrcInfo->scanStride; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1938
    jint *pEnd = pRGB + numpix; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1939
 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1940
    xlong += IntToLong(pSrcInfo->bounds.x1); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1941
    ylong += IntToLong(pSrcInfo->bounds.y1); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1942
 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1943
    Init ## SRC ## LoadVars(SrcRead, pSrcInfo); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1944
    while (pRGB < pEnd) { \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1945
        SRC ## DataType *pRow = PtrAddBytes(pBase, WholeOfLong(ylong) * scan); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1946
        Copy ## SRC ## ToIntArgbPre(pRGB, 0, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1947
                                    SrcRead, pRow, WholeOfLong(xlong)); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1948
        pRGB++; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1949
        xlong += dxlong; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1950
        ylong += dylong; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1951
    } \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1952
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1953
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1954
#define DEFINE_TRANSFORMHELPER_BL(SRC) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1955
void NAME_TRANSFORMHELPER_BL(SRC)(SurfaceDataRasInfo *pSrcInfo, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1956
                                  jint *pRGB, jint numpix, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1957
                                  jlong xlong, jlong dxlong, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1958
                                  jlong ylong, jlong dylong) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1959
{ \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1960
    Declare ## SRC ## LoadVars(SrcRead) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1961
    jint scan = pSrcInfo->scanStride; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1962
    jint cx, cy, cw, ch; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1963
    jint *pEnd = pRGB + numpix*4; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1964
 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1965
    cx = pSrcInfo->bounds.x1; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1966
    cw = pSrcInfo->bounds.x2-cx; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1967
 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1968
    cy = pSrcInfo->bounds.y1; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1969
    ch = pSrcInfo->bounds.y2-cy; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1970
 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1971
    xlong -= LongOneHalf; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1972
    ylong -= LongOneHalf; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1973
 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1974
    Init ## SRC ## LoadVars(SrcRead, pSrcInfo); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1975
    while (pRGB < pEnd) { \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1976
        jint xwhole = WholeOfLong(xlong); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1977
        jint ywhole = WholeOfLong(ylong); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1978
        jint xdelta, ydelta, isneg; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1979
        SRC ## DataType *pRow; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1980
 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1981
        xdelta = ((juint) (xwhole + 1 - cw)) >> 31; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1982
        isneg = xwhole >> 31; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1983
        xwhole -= isneg; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1984
        xdelta += isneg; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1985
 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1986
        ydelta = ((ywhole + 1 - ch) >> 31); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1987
        isneg = ywhole >> 31; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1988
        ywhole -= isneg; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1989
        ydelta -= isneg; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1990
        ydelta &= scan; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1991
 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1992
        xwhole += cx; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1993
        pRow = PtrAddBytes(pSrcInfo->rasBase, (ywhole + cy) * scan); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1994
        Copy ## SRC ## ToIntArgbPre(pRGB, 0, SrcRead, pRow, xwhole); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1995
        Copy ## SRC ## ToIntArgbPre(pRGB, 1, SrcRead, pRow, xwhole+xdelta); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1996
        pRow = PtrAddBytes(pRow, ydelta); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1997
        Copy ## SRC ## ToIntArgbPre(pRGB, 2, SrcRead, pRow, xwhole); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1998
        Copy ## SRC ## ToIntArgbPre(pRGB, 3, SrcRead, pRow, xwhole+xdelta); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1999
 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2000
        pRGB += 4; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2001
        xlong += dxlong; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2002
        ylong += dylong; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2003
    } \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2004
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2005
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2006
#define DEFINE_TRANSFORMHELPER_BC(SRC) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2007
void NAME_TRANSFORMHELPER_BC(SRC)(SurfaceDataRasInfo *pSrcInfo, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2008
                                  jint *pRGB, jint numpix, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2009
                                  jlong xlong, jlong dxlong, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2010
                                  jlong ylong, jlong dylong) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2011
{ \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2012
    Declare ## SRC ## LoadVars(SrcRead) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2013
    jint scan = pSrcInfo->scanStride; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2014
    jint cx, cy, cw, ch; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2015
    jint *pEnd = pRGB + numpix*16; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2016
 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2017
    cx = pSrcInfo->bounds.x1; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2018
    cw = pSrcInfo->bounds.x2-cx; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2019
 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2020
    cy = pSrcInfo->bounds.y1; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2021
    ch = pSrcInfo->bounds.y2-cy; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2022
 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2023
    xlong -= LongOneHalf; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2024
    ylong -= LongOneHalf; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2025
 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2026
    Init ## SRC ## LoadVars(SrcRead, pSrcInfo); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2027
    while (pRGB < pEnd) { \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2028
        jint xwhole = WholeOfLong(xlong); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2029
        jint ywhole = WholeOfLong(ylong); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2030
        jint xdelta0, xdelta1, xdelta2; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2031
        jint ydelta0, ydelta1, ydelta2; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2032
        jint isneg; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2033
        SRC ## DataType *pRow; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2034
 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2035
        xdelta0 = (-xwhole) >> 31; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2036
        xdelta1 = ((juint) (xwhole + 1 - cw)) >> 31; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2037
        xdelta2 = ((juint) (xwhole + 2 - cw)) >> 31; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2038
        isneg = xwhole >> 31; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2039
        xwhole -= isneg; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2040
        xdelta1 += isneg; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2041
        xdelta2 += xdelta1; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2042
 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2043
        ydelta0 = ((-ywhole) >> 31) & (-scan); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2044
        ydelta1 = ((ywhole + 1 - ch) >> 31) & scan; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2045
        ydelta2 = ((ywhole + 2 - ch) >> 31) & scan; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2046
        isneg = ywhole >> 31; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2047
        ywhole -= isneg; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2048
        ydelta1 += (isneg & -scan); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2049
 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2050
        xwhole += cx; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2051
        pRow = PtrAddBytes(pSrcInfo->rasBase, (ywhole + cy) * scan); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2052
        pRow = PtrAddBytes(pRow, ydelta0); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2053
        Copy ## SRC ## ToIntArgbPre(pRGB,  0, SrcRead, pRow, xwhole+xdelta0); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2054
        Copy ## SRC ## ToIntArgbPre(pRGB,  1, SrcRead, pRow, xwhole        ); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2055
        Copy ## SRC ## ToIntArgbPre(pRGB,  2, SrcRead, pRow, xwhole+xdelta1); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2056
        Copy ## SRC ## ToIntArgbPre(pRGB,  3, SrcRead, pRow, xwhole+xdelta2); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2057
        pRow = PtrAddBytes(pRow, -ydelta0); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2058
        Copy ## SRC ## ToIntArgbPre(pRGB,  4, SrcRead, pRow, xwhole+xdelta0); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2059
        Copy ## SRC ## ToIntArgbPre(pRGB,  5, SrcRead, pRow, xwhole        ); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2060
        Copy ## SRC ## ToIntArgbPre(pRGB,  6, SrcRead, pRow, xwhole+xdelta1); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2061
        Copy ## SRC ## ToIntArgbPre(pRGB,  7, SrcRead, pRow, xwhole+xdelta2); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2062
        pRow = PtrAddBytes(pRow, ydelta1); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2063
        Copy ## SRC ## ToIntArgbPre(pRGB,  8, SrcRead, pRow, xwhole+xdelta0); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2064
        Copy ## SRC ## ToIntArgbPre(pRGB,  9, SrcRead, pRow, xwhole        ); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2065
        Copy ## SRC ## ToIntArgbPre(pRGB, 10, SrcRead, pRow, xwhole+xdelta1); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2066
        Copy ## SRC ## ToIntArgbPre(pRGB, 11, SrcRead, pRow, xwhole+xdelta2); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2067
        pRow = PtrAddBytes(pRow, ydelta2); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2068
        Copy ## SRC ## ToIntArgbPre(pRGB, 12, SrcRead, pRow, xwhole+xdelta0); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2069
        Copy ## SRC ## ToIntArgbPre(pRGB, 13, SrcRead, pRow, xwhole        ); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2070
        Copy ## SRC ## ToIntArgbPre(pRGB, 14, SrcRead, pRow, xwhole+xdelta1); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2071
        Copy ## SRC ## ToIntArgbPre(pRGB, 15, SrcRead, pRow, xwhole+xdelta2); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2072
 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2073
        pRGB += 16; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2074
        xlong += dxlong; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2075
        ylong += dylong; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2076
    } \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2077
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2078
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2079
#define DEFINE_TRANSFORMHELPER_FUNCS(SRC) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2080
    TransformHelperFuncs NAME_TRANSFORMHELPER_FUNCS(SRC) = { \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2081
        NAME_TRANSFORMHELPER_NN(SRC), \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2082
        NAME_TRANSFORMHELPER_BL(SRC), \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2083
        NAME_TRANSFORMHELPER_BC(SRC), \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2084
    };
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2085
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2086
#define DEFINE_TRANSFORMHELPERS(SRC) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2087
    DEFINE_TRANSFORMHELPER_NN(SRC) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2088
    DEFINE_TRANSFORMHELPER_BL(SRC) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2089
    DEFINE_TRANSFORMHELPER_BC(SRC) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2090
    DEFINE_TRANSFORMHELPER_FUNCS(SRC)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2091
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2092
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2093
 * The macros defined above use the following macro definitions supplied
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2094
 * for the various surface types to manipulate pixels and pixel data.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2095
 * The surface-specific macros are typically supplied by header files
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2096
 * named after the SurfaceType name (i.e. IntArgb.h, ByteGray.h, etc.).
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2097
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2098
 * In the macro names in the following definitions, the string <stype>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2099
 * is used as a place holder for the SurfaceType name (i.e. IntArgb).
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2100
 * The macros above access these type specific macros using the ANSI
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2101
 * CPP token concatenation operator "##".
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2102
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2103
 * <stype>DataType               A typedef for the type of the pointer
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2104
 *                               that is used to access the raster data
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2105
 *                               for the given surface type.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2106
 * <stype>PixelStride            Pixel stride for the surface type.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2107
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2108
 * Declare<stype>LoadVars        Declare the variables needed to control
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2109
 *                               loading color information from an stype
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2110
 *                               raster (i.e. lookup tables).
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2111
 * Init<stype>LoadVars           Init the lookup table variables.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2112
 * Declare<stype>StoreVars       Declare the storage variables needed to
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2113
 *                               control storing pixel data based on the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2114
 *                               pixel coordinate (i.e. dithering variables).
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2115
 * Init<stype>StoreVarsY         Init the dither variables for starting Y.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2116
 * Next<stype>StoreVarsY         Increment the dither variables for next Y.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2117
 * Init<stype>StoreVarsX         Init the dither variables for starting X.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2118
 * Next<stype>StoreVarsX         Increment the dither variables for next X.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2119
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2120
 * Load<stype>To1IntRgb          Load a pixel and form an INT_RGB integer.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2121
 * Store<stype>From1IntRgb       Store a pixel from an INT_RGB integer.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2122
 * Load<stype>To1IntArgb         Load a pixel and form an INT_ARGB integer.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2123
 * Store<stype>From1IntArgb      Store a pixel from an INT_ARGB integer.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2124
 * Load<stype>To3ByteRgb         Load a pixel into R, G, and B components.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2125
 * Store<stype>From3ByteRgb      Store a pixel from R, G, and B components.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2126
 * Load<stype>To4ByteArgb        Load a pixel into A, R, G, and B components.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2127
 * Store<stype>From4ByteArgb     Store a pixel from A, R, G, and B components.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2128
 * Load<stype>To1ByteGray        Load a pixel and form a BYTE_GRAY byte.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2129
 * Store<stype>From1ByteGray     Store a pixel from a BYTE_GRAY byte.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2130
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2131
 * <stype>PixelType              Typedef for a "single quantity pixel" (SQP)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2132
 *                               that can hold the data for one stype pixel.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2133
 * <stype>XparLutEntry           An SQP that can be used to represent a
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2134
 *                               transparent pixel for stype.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2135
 * Store<stype>NonXparFromArgb   Store an SQP from an INT_ARGB integer in
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2136
 *                               such a way that it would not be confused
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2137
 *                               with the XparLutEntry value for stype.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2138
 * <stype>IsXparLutEntry         Test an SQP for the XparLutEntry value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2139
 * Store<stype>Pixel             Store the pixel data from an SQP.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2140
 * <stype>PixelFromArgb          Converts an INT_ARGB value into the specific
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2141
 *                               pixel representation for the surface type.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2142
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2143
 * Declare<stype>PixelData       Declare the pixel data variables (PDV) needed
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2144
 *                               to hold the elements of pixel data ready to
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2145
 *                               store into an stype raster (may be empty for
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2146
 *                               stypes whose SQP format is their data format).
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2147
 * Extract<stype>PixelData       Extract an SQP value into the PDVs.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2148
 * Store<stype>PixelData         Store the PDVs into an stype raster.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2149
 * XorCopy<stype>PixelData       Xor the PDVs into an stype raster.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2150
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2151
#endif /* LoopMacros_h_Included */