jdk/src/solaris/native/sun/java2d/loops/vis_IntArgbPre_Mask.c
author ohair
Wed, 06 Apr 2011 22:06:11 -0700
changeset 9035 1255eb81cc2f
parent 7745 ebd6382e93fd
permissions -rw-r--r--
7033660: Update copyright year to 2011 on any files changed in 2011 Reviewed-by: dholmes
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
9035
1255eb81cc2f 7033660: Update copyright year to 2011 on any files changed in 2011
ohair
parents: 7745
diff changeset
     2
 * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
2
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
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
2
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
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    23
 * questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
#if !defined(JAVA2D_NO_MLIB) || defined(MLIB_ADD_SUFF)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
#include "vis_AlphaMacros.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
/* ##############################################################
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
 * IntArgbPreAlphaMaskFill()
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
#undef  MASK_FILL
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
#define MASK_FILL(rr, pathA, dstA, dstARGB)               \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
{                                                         \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
    mlib_d64 t0, t1;                                      \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
    mlib_s32 srcF, dstF;                                  \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
                                                          \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
    srcF = ((dstA & ConstAnd) ^ ConstXor) + ConstAdd;     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
    srcF = MUL8_INT(srcF, pathA);                         \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
    dstF = mul8_cnstF[pathA] + (255 - pathA);             \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
                                                          \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
    t0 = MUL8_VIS(cnstARGB0, srcF);                       \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
    t1 = MUL8_VIS(dstARGB, dstF);                         \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
    rr = vis_fpadd16(t0, t1);                             \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
void IntArgbPreAlphaMaskFill_line(mlib_f32 *dst_ptr,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
                                  mlib_u8  *pMask,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
                                  mlib_s32 width,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
                                  mlib_f32 cnstARGB0,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
                                  mlib_s32 *log_val,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
                                  mlib_u8  *mul8_cnstF,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
                                  mlib_u8  *mul8_tbl);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
#pragma no_inline(IntArgbPreAlphaMaskFill_line)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
void IntArgbPreAlphaMaskFill_line(mlib_f32 *dst_ptr,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
                                  mlib_u8  *pMask,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
                                  mlib_s32 width,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
                                  mlib_f32 cnstARGB0,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
                                  mlib_s32 *log_val,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
                                  mlib_u8  *mul8_cnstF,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
                                  mlib_u8  *mul8_tbl)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
    mlib_s32 i, i0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
    mlib_s32 pathA0, pathA1, dstA0, dstA1, msk;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
    mlib_d64 res0, res1, dstARGB;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
    mlib_f32 dstARGB0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
    mlib_s32 ConstAnd, ConstXor, ConstAdd;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
    ConstAnd = log_val[0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
    ConstXor = log_val[1];
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
    ConstAdd = log_val[2];
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
    i = i0 = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
    if ((mlib_s32)dst_ptr & 7) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
        pathA0 = pMask[i];
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
        if (pathA0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
            dstA0 = *(mlib_u8*)(dst_ptr + i);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
            dstARGB0 = dst_ptr[i];
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
            MASK_FILL(res0, pathA0, dstA0, dstARGB0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
            dst_ptr[i] = vis_fpack16(res0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
        i0 = 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
#pragma pipeloop(0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
    for (i = i0; i <= width - 2; i += 2) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
        pathA0 = pMask[i];
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
        pathA1 = pMask[i + 1];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
        dstA0 = *(mlib_u8*)(dst_ptr + i);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
        dstA1 = *(mlib_u8*)(dst_ptr + i + 1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
        dstARGB = *(mlib_d64*)(dst_ptr + i);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
        MASK_FILL(res0, pathA0, dstA0, vis_read_hi(dstARGB));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
        MASK_FILL(res1, pathA1, dstA1, vis_read_lo(dstARGB));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
        res0 = vis_fpack16_pair(res0, res1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
        msk = (((-pathA0) & (1 << 11)) | ((-pathA1) & (1 << 10))) >> 10;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
        vis_pst_32(res0, dst_ptr + i, msk);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
    if (i < width) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
        pathA0 = pMask[i];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
        if (pathA0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
            dstA0 = *(mlib_u8*)(dst_ptr + i);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
            dstARGB0 = dst_ptr[i];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
            MASK_FILL(res0, pathA0, dstA0, dstARGB0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
            dst_ptr[i] = vis_fpack16(res0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
#undef  MASK_FILL
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
#define MASK_FILL(rr, cnstF, dstA, dstARGB)               \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
{                                                         \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
    mlib_d64 t0, t1;                                      \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
    mlib_s32 srcF, dstF;                                  \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
                                                          \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
    srcF = ((dstA & ConstAnd) ^ ConstXor) + ConstAdd;     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
    dstF = cnstF;                                         \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
                                                          \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
    t0 = MUL8_VIS(cnstARGB0, srcF);                       \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
    t1 = MUL8_VIS(dstARGB, dstF);                         \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
    rr = vis_fpadd16(t0, t1);                             \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
void IntArgPrebAlphaMaskFill_A1_line(mlib_f32 *dst_ptr,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
                                     mlib_s32 width,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
                                     mlib_f32 cnstARGB0,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
                                     mlib_s32 *log_val,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
                                     mlib_s32 cnstF);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
#pragma no_inline(IntArgPrebAlphaMaskFill_A1_line)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
void IntArgPrebAlphaMaskFill_A1_line(mlib_f32 *dst_ptr,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
                                     mlib_s32 width,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
                                     mlib_f32 cnstARGB0,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
                                     mlib_s32 *log_val,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
                                     mlib_s32 cnstF)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
    mlib_s32 i, i0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
    mlib_s32 dstA0, dstA1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
    mlib_d64 res0, res1, dstARGB;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
    mlib_f32 dstARGB0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
    mlib_s32 ConstAnd, ConstXor, ConstAdd;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
    ConstAnd = log_val[0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
    ConstXor = log_val[1];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
    ConstAdd = log_val[2];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
    i = i0 = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
    if ((mlib_s32)dst_ptr & 7) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
        {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
            dstA0 = *(mlib_u8*)(dst_ptr + i);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
            dstARGB0 = dst_ptr[i];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
            MASK_FILL(res0, cnstF, dstA0, dstARGB0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
            dst_ptr[i] = vis_fpack16(res0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
        i0 = 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
#pragma pipeloop(0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
    for (i = i0; i <= width - 2; i += 2) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
        dstA0 = *(mlib_u8*)(dst_ptr + i);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
        dstA1 = *(mlib_u8*)(dst_ptr + i + 1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
        dstARGB = *(mlib_d64*)(dst_ptr + i);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
        MASK_FILL(res0, cnstF, dstA0, vis_read_hi(dstARGB));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
        MASK_FILL(res1, cnstF, dstA1, vis_read_lo(dstARGB));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
        res0 = vis_fpack16_pair(res0, res1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
        *(mlib_d64*)(dst_ptr + i) = res0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
    if (i < width) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
        {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
            dstA0 = *(mlib_u8*)(dst_ptr + i);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
            dstARGB0 = dst_ptr[i];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
            MASK_FILL(res0, cnstF, dstA0, dstARGB0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
            dst_ptr[i] = vis_fpack16(res0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
void ADD_SUFF(IntArgbPreAlphaMaskFill)(void *rasBase,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
                                       jubyte *pMask,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
                                       jint maskOff,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
                                       jint maskScan,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
                                       jint width,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
                                       jint height,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
                                       jint fgColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
                                       SurfaceDataRasInfo *pRasInfo,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
                                       NativePrimitive *pPrim,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
                                       CompositeInfo *pCompInfo)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
    mlib_s32 cnstA, cnstR, cnstG, cnstB;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
    mlib_s32 rasScan = pRasInfo->scanStride;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
    mlib_f32 cnstARGB0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
    mlib_u8  *mul8_cnstF;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
    mlib_s32 SrcOpAnd, SrcOpXor, SrcOpAdd;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
    mlib_s32 DstOpAnd, DstOpXor, DstOpAdd;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
    mlib_s32 dstFbase;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
    mlib_s32 log_val[3];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
    mlib_s32 j;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
    cnstA = (fgColor >> 24) & 0xff;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
    cnstR = (fgColor >> 16) & 0xff;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
    cnstG = (fgColor >>  8) & 0xff;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
    cnstB = (fgColor      ) & 0xff;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
    if (cnstA != 0xff) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
        cnstR = mul8table[cnstA][cnstR];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
        cnstG = mul8table[cnstA][cnstG];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
        cnstB = mul8table[cnstA][cnstB];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
    cnstARGB0 = F32_FROM_U8x4(cnstA, cnstR, cnstG, cnstB);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
    SrcOpAnd = (AlphaRules[pCompInfo->rule].srcOps).andval;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
    SrcOpXor = (AlphaRules[pCompInfo->rule].srcOps).xorval;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
    SrcOpAdd = (AlphaRules[pCompInfo->rule].srcOps).addval;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
    SrcOpAdd -= SrcOpXor;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
    log_val[0] = SrcOpAnd;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
    log_val[1] = SrcOpXor;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
    log_val[2] = SrcOpAdd;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
    DstOpAnd = (AlphaRules[pCompInfo->rule].dstOps).andval;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
    DstOpXor = (AlphaRules[pCompInfo->rule].dstOps).xorval;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
    DstOpAdd = (AlphaRules[pCompInfo->rule].dstOps).addval;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
    DstOpAdd -= DstOpXor;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
    dstFbase = (((cnstA) & DstOpAnd) ^ DstOpXor) + DstOpAdd;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
    mul8_cnstF = mul8table[dstFbase];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   257
90ce3da70b43 Initial load
duke
parents:
diff changeset
   258
    vis_write_gsr(0 << 3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   259
90ce3da70b43 Initial load
duke
parents:
diff changeset
   260
    if (pMask != NULL) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   261
        pMask += maskOff;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   262
90ce3da70b43 Initial load
duke
parents:
diff changeset
   263
        if (rasScan == 4*width && maskScan == width) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   264
            width *= height;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   265
            height = 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   266
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   267
90ce3da70b43 Initial load
duke
parents:
diff changeset
   268
        for (j = 0; j < height; j++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   269
            IntArgbPreAlphaMaskFill_line(rasBase, pMask, width, cnstARGB0,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   270
                                         log_val, mul8_cnstF,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   271
                                         (void*)mul8table);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   272
90ce3da70b43 Initial load
duke
parents:
diff changeset
   273
            PTR_ADD(rasBase, rasScan);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   274
            PTR_ADD(pMask, maskScan);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   275
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   276
    } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   277
        if (rasScan == 4*width) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   278
            width *= height;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   279
            height = 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   280
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   281
90ce3da70b43 Initial load
duke
parents:
diff changeset
   282
        for (j = 0; j < height; j++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   283
            IntArgPrebAlphaMaskFill_A1_line(rasBase, width, cnstARGB0,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   284
                                            log_val, dstFbase);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   285
90ce3da70b43 Initial load
duke
parents:
diff changeset
   286
            PTR_ADD(rasBase, rasScan);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   287
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   288
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   289
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   290
90ce3da70b43 Initial load
duke
parents:
diff changeset
   291
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   292
90ce3da70b43 Initial load
duke
parents:
diff changeset
   293
void ADD_SUFF(FourByteAbgrPreAlphaMaskFill)(void *rasBase,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   294
                                            jubyte *pMask,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   295
                                            jint maskOff,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   296
                                            jint maskScan,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   297
                                            jint width,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   298
                                            jint height,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   299
                                            jint fgColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   300
                                            SurfaceDataRasInfo *pRasInfo,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   301
                                            NativePrimitive *pPrim,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   302
                                            CompositeInfo *pCompInfo)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   303
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   304
    mlib_d64 buff[BUFF_SIZE/2];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   305
    void     *pbuff = buff, *p_dst;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   306
    mlib_s32 cnstA, cnstR, cnstG, cnstB;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   307
    mlib_s32 rasScan = pRasInfo->scanStride;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   308
    mlib_f32 cnstARGB0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   309
    mlib_u8  *mul8_cnstF;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   310
    mlib_s32 SrcOpAnd, SrcOpXor, SrcOpAdd;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   311
    mlib_s32 DstOpAnd, DstOpXor, DstOpAdd;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   312
    mlib_s32 dstFbase;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   313
    mlib_s32 log_val[3];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   314
    mlib_s32 j;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   315
90ce3da70b43 Initial load
duke
parents:
diff changeset
   316
    if (width > BUFF_SIZE) pbuff = mlib_malloc(width*sizeof(mlib_s32));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   317
90ce3da70b43 Initial load
duke
parents:
diff changeset
   318
    cnstA = (fgColor >> 24) & 0xff;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   319
    cnstR = (fgColor >> 16) & 0xff;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   320
    cnstG = (fgColor >>  8) & 0xff;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   321
    cnstB = (fgColor      ) & 0xff;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   322
90ce3da70b43 Initial load
duke
parents:
diff changeset
   323
    if (cnstA != 0xff) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   324
        cnstR = mul8table[cnstA][cnstR];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   325
        cnstG = mul8table[cnstA][cnstG];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   326
        cnstB = mul8table[cnstA][cnstB];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   327
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   328
90ce3da70b43 Initial load
duke
parents:
diff changeset
   329
    cnstARGB0 = F32_FROM_U8x4(cnstA, cnstB, cnstG, cnstR);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   330
90ce3da70b43 Initial load
duke
parents:
diff changeset
   331
    SrcOpAnd = (AlphaRules[pCompInfo->rule].srcOps).andval;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   332
    SrcOpXor = (AlphaRules[pCompInfo->rule].srcOps).xorval;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   333
    SrcOpAdd = (AlphaRules[pCompInfo->rule].srcOps).addval;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   334
    SrcOpAdd -= SrcOpXor;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   335
90ce3da70b43 Initial load
duke
parents:
diff changeset
   336
    log_val[0] = SrcOpAnd;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   337
    log_val[1] = SrcOpXor;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   338
    log_val[2] = SrcOpAdd;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   339
90ce3da70b43 Initial load
duke
parents:
diff changeset
   340
    DstOpAnd = (AlphaRules[pCompInfo->rule].dstOps).andval;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   341
    DstOpXor = (AlphaRules[pCompInfo->rule].dstOps).xorval;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   342
    DstOpAdd = (AlphaRules[pCompInfo->rule].dstOps).addval;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   343
    DstOpAdd -= DstOpXor;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   344
90ce3da70b43 Initial load
duke
parents:
diff changeset
   345
    dstFbase = (((cnstA) & DstOpAnd) ^ DstOpXor) + DstOpAdd;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   346
90ce3da70b43 Initial load
duke
parents:
diff changeset
   347
    mul8_cnstF = mul8table[dstFbase];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   348
90ce3da70b43 Initial load
duke
parents:
diff changeset
   349
    vis_write_gsr(0 << 3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   350
90ce3da70b43 Initial load
duke
parents:
diff changeset
   351
    if (pMask != NULL) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   352
        pMask += maskOff;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   353
90ce3da70b43 Initial load
duke
parents:
diff changeset
   354
        for (j = 0; j < height; j++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   355
            if ((mlib_s32)rasBase & 3) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   356
                mlib_ImageCopy_na(rasBase, pbuff, width*sizeof(mlib_s32));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   357
                p_dst = pbuff;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   358
            } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   359
                p_dst = rasBase;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   360
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   361
90ce3da70b43 Initial load
duke
parents:
diff changeset
   362
            IntArgbPreAlphaMaskFill_line(p_dst, pMask, width, cnstARGB0,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   363
                                         log_val, mul8_cnstF,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   364
                                         (void*)mul8table);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   365
90ce3da70b43 Initial load
duke
parents:
diff changeset
   366
            if (p_dst != rasBase) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   367
                mlib_ImageCopy_na(p_dst, rasBase, width*sizeof(mlib_s32));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   368
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   369
90ce3da70b43 Initial load
duke
parents:
diff changeset
   370
            PTR_ADD(rasBase, rasScan);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   371
            PTR_ADD(pMask, maskScan);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   372
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   373
    } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   374
        for (j = 0; j < height; j++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   375
            if ((mlib_s32)rasBase & 3) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   376
                mlib_ImageCopy_na(rasBase, pbuff, width*sizeof(mlib_s32));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   377
                p_dst = pbuff;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   378
            } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   379
                p_dst = rasBase;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   380
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   381
90ce3da70b43 Initial load
duke
parents:
diff changeset
   382
            IntArgPrebAlphaMaskFill_A1_line(p_dst, width, cnstARGB0,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   383
                                            log_val, dstFbase);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   384
90ce3da70b43 Initial load
duke
parents:
diff changeset
   385
            if (p_dst != rasBase) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   386
                mlib_ImageCopy_na(p_dst, rasBase, width*sizeof(mlib_s32));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   387
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   388
90ce3da70b43 Initial load
duke
parents:
diff changeset
   389
            PTR_ADD(rasBase, rasScan);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   390
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   391
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   392
90ce3da70b43 Initial load
duke
parents:
diff changeset
   393
    if (pbuff != buff) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   394
        mlib_free(pbuff);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   395
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   396
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   397
90ce3da70b43 Initial load
duke
parents:
diff changeset
   398
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   399
90ce3da70b43 Initial load
duke
parents:
diff changeset
   400
/* ##############################################################
90ce3da70b43 Initial load
duke
parents:
diff changeset
   401
 * IntArgbPreSrcMaskFill()
90ce3da70b43 Initial load
duke
parents:
diff changeset
   402
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   403
90ce3da70b43 Initial load
duke
parents:
diff changeset
   404
#undef MASK_FILL
90ce3da70b43 Initial load
duke
parents:
diff changeset
   405
#define MASK_FILL(rr, pathA, dstARGB)           \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   406
{                                               \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   407
    mlib_d64 t0, t1;                            \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   408
                                                \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   409
    t0 = MUL8_VIS(cnstARGB0, pathA);            \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   410
    t1 = MUL8_VIS(dstARGB, (0xff - pathA));     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   411
    rr = vis_fpadd16(t0, t1);                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   412
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   413
90ce3da70b43 Initial load
duke
parents:
diff changeset
   414
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   415
90ce3da70b43 Initial load
duke
parents:
diff changeset
   416
void IntArgbPreSrcMaskFill_line(mlib_f32 *dst_ptr,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   417
                                mlib_u8  *pMask,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   418
                                mlib_s32 width,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   419
                                mlib_d64 fgARGB,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   420
                                mlib_f32 cnstARGB0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   421
90ce3da70b43 Initial load
duke
parents:
diff changeset
   422
#pragma no_inline(IntArgbPreSrcMaskFill_line)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   423
90ce3da70b43 Initial load
duke
parents:
diff changeset
   424
void IntArgbPreSrcMaskFill_line(mlib_f32 *dst_ptr,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   425
                                mlib_u8  *pMask,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   426
                                mlib_s32 width,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   427
                                mlib_d64 fgARGB,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   428
                                mlib_f32 cnstARGB0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   429
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   430
    mlib_s32 i, i0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   431
    mlib_s32 pathA0, pathA1, msk;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   432
    mlib_d64 res0, res1, dstARGB;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   433
    mlib_f32 dstARGB0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   434
90ce3da70b43 Initial load
duke
parents:
diff changeset
   435
    i = i0 = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   436
90ce3da70b43 Initial load
duke
parents:
diff changeset
   437
    if ((mlib_s32)dst_ptr & 7) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   438
        pathA0 = pMask[i];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   439
        if (pathA0 == 0xff) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   440
            dst_ptr[i] = vis_read_hi(fgARGB);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   441
        } else if (pathA0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   442
            dstARGB0 = dst_ptr[i];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   443
            MASK_FILL(res0, pathA0, dstARGB0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   444
            dst_ptr[i] = vis_fpack16(res0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   445
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   446
90ce3da70b43 Initial load
duke
parents:
diff changeset
   447
        i0 = 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   448
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   449
90ce3da70b43 Initial load
duke
parents:
diff changeset
   450
#pragma pipeloop(0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   451
    for (i = i0; i <= width - 2; i += 2) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   452
        pathA0 = pMask[i];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   453
        pathA1 = pMask[i + 1];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   454
90ce3da70b43 Initial load
duke
parents:
diff changeset
   455
        dstARGB = *(mlib_d64*)(dst_ptr + i);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   456
90ce3da70b43 Initial load
duke
parents:
diff changeset
   457
        msk = (((254 - pathA0) & (1 << 11)) |
90ce3da70b43 Initial load
duke
parents:
diff changeset
   458
               ((254 - pathA1) & (1 << 10))) >> 10;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   459
90ce3da70b43 Initial load
duke
parents:
diff changeset
   460
        MASK_FILL(res0, pathA0, vis_read_hi(dstARGB));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   461
        MASK_FILL(res1, pathA1, vis_read_lo(dstARGB));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   462
90ce3da70b43 Initial load
duke
parents:
diff changeset
   463
        res0 = vis_fpack16_pair(res0, res1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   464
90ce3da70b43 Initial load
duke
parents:
diff changeset
   465
        *(mlib_d64*)(dst_ptr + i) = res0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   466
90ce3da70b43 Initial load
duke
parents:
diff changeset
   467
        vis_pst_32(fgARGB, dst_ptr + i, msk);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   468
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   469
90ce3da70b43 Initial load
duke
parents:
diff changeset
   470
    if (i < width) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   471
        pathA0 = pMask[i];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   472
        if (pathA0 == 0xff) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   473
            dst_ptr[i] = vis_read_hi(fgARGB);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   474
        } else if (pathA0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   475
            dstARGB0 = dst_ptr[i];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   476
            MASK_FILL(res0, pathA0, dstARGB0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   477
            dst_ptr[i] = vis_fpack16(res0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   478
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   479
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   480
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   481
90ce3da70b43 Initial load
duke
parents:
diff changeset
   482
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   483
90ce3da70b43 Initial load
duke
parents:
diff changeset
   484
void ADD_SUFF(IntArgbPreSrcMaskFill)(void *rasBase,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   485
                                     jubyte *pMask,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   486
                                     jint maskOff,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   487
                                     jint maskScan,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   488
                                     jint width,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   489
                                     jint height,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   490
                                     jint fgColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   491
                                     SurfaceDataRasInfo *pRasInfo,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   492
                                     NativePrimitive *pPrim,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   493
                                     CompositeInfo *pCompInfo)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   494
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   495
    mlib_s32 cnstA, cnstR, cnstG, cnstB;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   496
    mlib_s32 rasScan = pRasInfo->scanStride;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   497
    mlib_f32 cnstARGB0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   498
    mlib_d64 fgARGB;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   499
    mlib_s32 j;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   500
90ce3da70b43 Initial load
duke
parents:
diff changeset
   501
    cnstA = (fgColor >> 24) & 0xff;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   502
    cnstR = (fgColor >> 16) & 0xff;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   503
    cnstG = (fgColor >>  8) & 0xff;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   504
    cnstB = (fgColor      ) & 0xff;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   505
90ce3da70b43 Initial load
duke
parents:
diff changeset
   506
    if (cnstA != 0xff) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   507
#ifdef LOOPS_OLD_VERSION
90ce3da70b43 Initial load
duke
parents:
diff changeset
   508
        if (cnstA == 0) return;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   509
#endif
90ce3da70b43 Initial load
duke
parents:
diff changeset
   510
        cnstR = mul8table[cnstA][cnstR];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   511
        cnstG = mul8table[cnstA][cnstG];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   512
        cnstB = mul8table[cnstA][cnstB];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   513
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   514
90ce3da70b43 Initial load
duke
parents:
diff changeset
   515
    if (pMask == NULL) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   516
#ifdef LOOPS_OLD_VERSION
90ce3da70b43 Initial load
duke
parents:
diff changeset
   517
        ADD_SUFF(AnyIntSetRect)(pRasInfo, 0, 0, width, height,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   518
                                fgColor, pPrim, pCompInfo);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   519
#else
7745
ebd6382e93fd 6766342: Improve performance of Ductus rasterizer
flar
parents: 5506
diff changeset
   520
        void *pBase = pRasInfo->rasBase;
ebd6382e93fd 6766342: Improve performance of Ductus rasterizer
flar
parents: 5506
diff changeset
   521
        pRasInfo->rasBase = rasBase;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   522
        if (cnstA != 0xff) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   523
            fgColor = (cnstA << 24) | (cnstR << 16) | (cnstG << 8) | cnstB;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   524
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   525
        ADD_SUFF(AnyIntSetRect)(pRasInfo,
7745
ebd6382e93fd 6766342: Improve performance of Ductus rasterizer
flar
parents: 5506
diff changeset
   526
                                0, 0, width, height,
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   527
                                fgColor, pPrim, pCompInfo);
7745
ebd6382e93fd 6766342: Improve performance of Ductus rasterizer
flar
parents: 5506
diff changeset
   528
        pRasInfo->rasBase = pBase;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   529
#endif
90ce3da70b43 Initial load
duke
parents:
diff changeset
   530
        return;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   531
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   532
90ce3da70b43 Initial load
duke
parents:
diff changeset
   533
    cnstARGB0 = F32_FROM_U8x4(cnstA, cnstR, cnstG, cnstB);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   534
90ce3da70b43 Initial load
duke
parents:
diff changeset
   535
    fgARGB = vis_to_double_dup(fgColor);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   536
90ce3da70b43 Initial load
duke
parents:
diff changeset
   537
    pMask += maskOff;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   538
90ce3da70b43 Initial load
duke
parents:
diff changeset
   539
    if (rasScan == 4*width && maskScan == width) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   540
        width *= height;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   541
        height = 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   542
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   543
90ce3da70b43 Initial load
duke
parents:
diff changeset
   544
    vis_write_gsr(0 << 3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   545
90ce3da70b43 Initial load
duke
parents:
diff changeset
   546
    for (j = 0; j < height; j++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   547
        IntArgbPreSrcMaskFill_line(rasBase, pMask, width, fgARGB, cnstARGB0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   548
90ce3da70b43 Initial load
duke
parents:
diff changeset
   549
        PTR_ADD(rasBase, rasScan);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   550
        PTR_ADD(pMask, maskScan);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   551
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   552
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   553
90ce3da70b43 Initial load
duke
parents:
diff changeset
   554
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   555
90ce3da70b43 Initial load
duke
parents:
diff changeset
   556
void ADD_SUFF(FourByteAbgrPreSrcMaskFill)(void *rasBase,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   557
                                          jubyte *pMask,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   558
                                          jint maskOff,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   559
                                          jint maskScan,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   560
                                          jint width,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   561
                                          jint height,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   562
                                          jint fgColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   563
                                          SurfaceDataRasInfo *pRasInfo,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   564
                                          NativePrimitive *pPrim,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   565
                                          CompositeInfo *pCompInfo)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   566
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   567
    mlib_d64 buff[BUFF_SIZE/2];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   568
    void     *pbuff = buff, *p_dst;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   569
    mlib_s32 cnstA, cnstR, cnstG, cnstB;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   570
    mlib_s32 rasScan = pRasInfo->scanStride;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   571
    mlib_f32 cnstARGB0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   572
    mlib_d64 fgARGB;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   573
    mlib_s32 j;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   574
90ce3da70b43 Initial load
duke
parents:
diff changeset
   575
    cnstA = (fgColor >> 24) & 0xff;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   576
    cnstR = (fgColor >> 16) & 0xff;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   577
    cnstG = (fgColor >>  8) & 0xff;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   578
    cnstB = (fgColor      ) & 0xff;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   579
90ce3da70b43 Initial load
duke
parents:
diff changeset
   580
    if (cnstA != 0xff) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   581
        cnstR = mul8table[cnstA][cnstR];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   582
        cnstG = mul8table[cnstA][cnstG];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   583
        cnstB = mul8table[cnstA][cnstB];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   584
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   585
90ce3da70b43 Initial load
duke
parents:
diff changeset
   586
    if (pMask == NULL) {
7745
ebd6382e93fd 6766342: Improve performance of Ductus rasterizer
flar
parents: 5506
diff changeset
   587
        void *pBase = pRasInfo->rasBase;
ebd6382e93fd 6766342: Improve performance of Ductus rasterizer
flar
parents: 5506
diff changeset
   588
        pRasInfo->rasBase = rasBase;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   589
        fgColor = (cnstR << 24) | (cnstG << 16) | (cnstB << 8) | cnstA;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   590
        ADD_SUFF(Any4ByteSetRect)(pRasInfo,
7745
ebd6382e93fd 6766342: Improve performance of Ductus rasterizer
flar
parents: 5506
diff changeset
   591
                                  0, 0, width, height,
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   592
                                  fgColor, pPrim, pCompInfo);
7745
ebd6382e93fd 6766342: Improve performance of Ductus rasterizer
flar
parents: 5506
diff changeset
   593
        pRasInfo->rasBase = pBase;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   594
        return;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   595
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   596
90ce3da70b43 Initial load
duke
parents:
diff changeset
   597
    fgColor = (cnstA << 24) | (cnstB << 16) | (cnstG << 8) | cnstR;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   598
    cnstARGB0 = F32_FROM_U8x4(cnstA, cnstB, cnstG, cnstR);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   599
90ce3da70b43 Initial load
duke
parents:
diff changeset
   600
    fgARGB = vis_to_double_dup(fgColor);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   601
90ce3da70b43 Initial load
duke
parents:
diff changeset
   602
    pMask += maskOff;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   603
90ce3da70b43 Initial load
duke
parents:
diff changeset
   604
    vis_write_gsr(0 << 3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   605
90ce3da70b43 Initial load
duke
parents:
diff changeset
   606
    if (width > BUFF_SIZE) pbuff = mlib_malloc(width*sizeof(mlib_s32));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   607
90ce3da70b43 Initial load
duke
parents:
diff changeset
   608
    for (j = 0; j < height; j++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   609
        if ((mlib_s32)rasBase & 3) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   610
            mlib_ImageCopy_na(rasBase, pbuff, width*sizeof(mlib_s32));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   611
            p_dst = pbuff;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   612
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   613
            p_dst = rasBase;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   614
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   615
90ce3da70b43 Initial load
duke
parents:
diff changeset
   616
        IntArgbPreSrcMaskFill_line(p_dst, pMask, width, fgARGB, cnstARGB0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   617
90ce3da70b43 Initial load
duke
parents:
diff changeset
   618
        if (p_dst != rasBase) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   619
            mlib_ImageCopy_na(p_dst, rasBase, width*sizeof(mlib_s32));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   620
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   621
90ce3da70b43 Initial load
duke
parents:
diff changeset
   622
        PTR_ADD(rasBase, rasScan);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   623
        PTR_ADD(pMask, maskScan);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   624
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   625
90ce3da70b43 Initial load
duke
parents:
diff changeset
   626
    if (pbuff != buff) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   627
        mlib_free(pbuff);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   628
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   629
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   630
90ce3da70b43 Initial load
duke
parents:
diff changeset
   631
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   632
90ce3da70b43 Initial load
duke
parents:
diff changeset
   633
/* ##############################################################
90ce3da70b43 Initial load
duke
parents:
diff changeset
   634
 * IntArgbPreSrcOverMaskFill()
90ce3da70b43 Initial load
duke
parents:
diff changeset
   635
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   636
90ce3da70b43 Initial load
duke
parents:
diff changeset
   637
#undef  MASK_FILL
90ce3da70b43 Initial load
duke
parents:
diff changeset
   638
#define MASK_FILL(rr, pathA, dstARGB)         \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   639
{                                             \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   640
    mlib_d64 t0, t1;                          \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   641
    mlib_s32 dstA;                            \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   642
                                              \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   643
    dstA = 0xff - mul8_cnstA[pathA];          \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   644
                                              \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   645
    t0 = MUL8_VIS(cnstARGB0, pathA);          \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   646
    t1 = MUL8_VIS(dstARGB, dstA);             \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   647
    rr = vis_fpadd16(t0, t1);                 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   648
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   649
90ce3da70b43 Initial load
duke
parents:
diff changeset
   650
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   651
90ce3da70b43 Initial load
duke
parents:
diff changeset
   652
static void IntArgbPreSrcOverMaskFill_line(mlib_f32 *dst_ptr,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   653
                                           mlib_u8  *pMask,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   654
                                           mlib_s32 width,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   655
                                           mlib_f32 cnstARGB0,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   656
                                           mlib_u8  *mul8_cnstA);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   657
90ce3da70b43 Initial load
duke
parents:
diff changeset
   658
#pragma no_inline(IntArgbPreSrcOverMaskFill_line)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   659
90ce3da70b43 Initial load
duke
parents:
diff changeset
   660
static void IntArgbPreSrcOverMaskFill_line(mlib_f32 *dst_ptr,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   661
                                           mlib_u8  *pMask,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   662
                                           mlib_s32 width,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   663
                                           mlib_f32 cnstARGB0,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   664
                                           mlib_u8  *mul8_cnstA)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   665
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   666
    mlib_s32 i, i0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   667
    mlib_s32 pathA0, pathA1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   668
    mlib_d64 res0, res1, dstARGB;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   669
    mlib_f32 dstARGB0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   670
90ce3da70b43 Initial load
duke
parents:
diff changeset
   671
    i = i0 = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   672
90ce3da70b43 Initial load
duke
parents:
diff changeset
   673
    if ((mlib_s32)dst_ptr & 7) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   674
        pathA0 = pMask[i];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   675
90ce3da70b43 Initial load
duke
parents:
diff changeset
   676
        if (pathA0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   677
            dstARGB0 = dst_ptr[i];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   678
            MASK_FILL(res0, pathA0, dstARGB0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   679
            dst_ptr[i] = vis_fpack16(res0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   680
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   681
90ce3da70b43 Initial load
duke
parents:
diff changeset
   682
        i0 = 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   683
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   684
90ce3da70b43 Initial load
duke
parents:
diff changeset
   685
#pragma pipeloop(0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   686
    for (i = i0; i <= width - 2; i += 2) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   687
        pathA0 = pMask[i];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   688
        pathA1 = pMask[i + 1];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   689
        dstARGB = *(mlib_d64*)(dst_ptr + i);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   690
90ce3da70b43 Initial load
duke
parents:
diff changeset
   691
        MASK_FILL(res0, pathA0, vis_read_hi(dstARGB));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   692
        MASK_FILL(res1, pathA1, vis_read_lo(dstARGB));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   693
90ce3da70b43 Initial load
duke
parents:
diff changeset
   694
        res0 = vis_fpack16_pair(res0, res1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   695
90ce3da70b43 Initial load
duke
parents:
diff changeset
   696
        *(mlib_d64 *)(dst_ptr + i) = res0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   697
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   698
90ce3da70b43 Initial load
duke
parents:
diff changeset
   699
    if (i < width) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   700
        pathA0 = pMask[i];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   701
90ce3da70b43 Initial load
duke
parents:
diff changeset
   702
        if (pathA0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   703
            dstARGB0 = dst_ptr[i];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   704
            MASK_FILL(res0, pathA0, dstARGB0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   705
            dst_ptr[i] = vis_fpack16(res0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   706
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   707
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   708
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   709
90ce3da70b43 Initial load
duke
parents:
diff changeset
   710
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   711
90ce3da70b43 Initial load
duke
parents:
diff changeset
   712
#undef  MASK_FILL
90ce3da70b43 Initial load
duke
parents:
diff changeset
   713
#define MASK_FILL(rr, dstARGB)          \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   714
{                                       \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   715
    rr = MUL8_VIS(dstARGB, cnstA);      \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   716
    rr = vis_fpadd16(rr, cnstARGB);     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   717
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   718
90ce3da70b43 Initial load
duke
parents:
diff changeset
   719
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   720
90ce3da70b43 Initial load
duke
parents:
diff changeset
   721
static void IntArgbPreSrcOverMaskFill_A1_line(mlib_f32 *dst_ptr,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   722
                                              mlib_s32 width,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   723
                                              mlib_d64 cnstARGB,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   724
                                              mlib_s32 cnstA);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   725
90ce3da70b43 Initial load
duke
parents:
diff changeset
   726
#pragma no_inline(IntArgbPreSrcOverMaskFill_A1_line)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   727
90ce3da70b43 Initial load
duke
parents:
diff changeset
   728
static void IntArgbPreSrcOverMaskFill_A1_line(mlib_f32 *dst_ptr,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   729
                                              mlib_s32 width,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   730
                                              mlib_d64 cnstARGB,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   731
                                              mlib_s32 cnstA)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   732
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   733
    mlib_s32 i, i0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   734
    mlib_d64 res0, res1, dstARGB;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   735
    mlib_f32 dstARGB0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   736
90ce3da70b43 Initial load
duke
parents:
diff changeset
   737
    cnstA = 0xff - cnstA;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   738
90ce3da70b43 Initial load
duke
parents:
diff changeset
   739
    i = i0 = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   740
90ce3da70b43 Initial load
duke
parents:
diff changeset
   741
    if ((mlib_s32)dst_ptr & 7) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   742
        dstARGB0 = dst_ptr[i];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   743
        MASK_FILL(res0, dstARGB0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   744
        dst_ptr[i] = vis_fpack16(res0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   745
        i0 = 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   746
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   747
90ce3da70b43 Initial load
duke
parents:
diff changeset
   748
#pragma pipeloop(0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   749
    for (i = i0; i <= width - 2; i += 2) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   750
        dstARGB = *(mlib_d64*)(dst_ptr + i);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   751
90ce3da70b43 Initial load
duke
parents:
diff changeset
   752
        MASK_FILL(res0, vis_read_hi(dstARGB));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   753
        MASK_FILL(res1, vis_read_lo(dstARGB));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   754
90ce3da70b43 Initial load
duke
parents:
diff changeset
   755
        res0 = vis_fpack16_pair(res0, res1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   756
90ce3da70b43 Initial load
duke
parents:
diff changeset
   757
        *(mlib_d64*)(dst_ptr + i) = res0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   758
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   759
90ce3da70b43 Initial load
duke
parents:
diff changeset
   760
    if (i < width) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   761
        dstARGB0 = dst_ptr[i];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   762
        MASK_FILL(res0, dstARGB0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   763
        dst_ptr[i] = vis_fpack16(res0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   764
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   765
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   766
90ce3da70b43 Initial load
duke
parents:
diff changeset
   767
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   768
90ce3da70b43 Initial load
duke
parents:
diff changeset
   769
void ADD_SUFF(IntArgbPreSrcOverMaskFill)(void *rasBase,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   770
                                         jubyte *pMask,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   771
                                         jint maskOff,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   772
                                         jint maskScan,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   773
                                         jint width,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   774
                                         jint height,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   775
                                         jint fgColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   776
                                         SurfaceDataRasInfo *pRasInfo,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   777
                                         NativePrimitive *pPrim,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   778
                                         CompositeInfo *pCompInfo)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   779
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   780
    mlib_s32 cnstA, cnstR, cnstG, cnstB;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   781
    mlib_s32 rasScan = pRasInfo->scanStride;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   782
    mlib_f32 cnstARGB0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   783
    mlib_d64 cnstARGB;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   784
    mlib_u8  *mul8_cnstA;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   785
    mlib_s32 j;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   786
90ce3da70b43 Initial load
duke
parents:
diff changeset
   787
    cnstA = (fgColor >> 24) & 0xff;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   788
    cnstR = (fgColor >> 16) & 0xff;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   789
    cnstG = (fgColor >>  8) & 0xff;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   790
    cnstB = (fgColor      ) & 0xff;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   791
90ce3da70b43 Initial load
duke
parents:
diff changeset
   792
    if (cnstA != 0xff) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   793
        if (cnstA == 0) return;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   794
90ce3da70b43 Initial load
duke
parents:
diff changeset
   795
        cnstR = mul8table[cnstA][cnstR];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   796
        cnstG = mul8table[cnstA][cnstG];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   797
        cnstB = mul8table[cnstA][cnstB];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   798
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   799
90ce3da70b43 Initial load
duke
parents:
diff changeset
   800
    vis_write_gsr(0 << 3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   801
90ce3da70b43 Initial load
duke
parents:
diff changeset
   802
    if (pMask != NULL) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   803
        pMask += maskOff;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   804
90ce3da70b43 Initial load
duke
parents:
diff changeset
   805
        if (rasScan == 4*width && maskScan == width) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   806
            width *= height;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   807
            height = 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   808
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   809
90ce3da70b43 Initial load
duke
parents:
diff changeset
   810
        mul8_cnstA = mul8table[cnstA];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   811
90ce3da70b43 Initial load
duke
parents:
diff changeset
   812
        cnstARGB0 = F32_FROM_U8x4(cnstA, cnstR, cnstG, cnstB);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   813
90ce3da70b43 Initial load
duke
parents:
diff changeset
   814
        for (j = 0; j < height; j++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   815
            IntArgbPreSrcOverMaskFill_line(rasBase, pMask, width, cnstARGB0,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   816
                                           mul8_cnstA);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   817
90ce3da70b43 Initial load
duke
parents:
diff changeset
   818
            PTR_ADD(rasBase, rasScan);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   819
            PTR_ADD(pMask, maskScan);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   820
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   821
    } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   822
        if (rasScan == 4*width) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   823
            width *= height;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   824
            height = 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   825
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   826
90ce3da70b43 Initial load
duke
parents:
diff changeset
   827
        cnstARGB = vis_to_double((cnstA << 23) | (cnstR << 7),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   828
                                 (cnstG << 23) | (cnstB << 7));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   829
90ce3da70b43 Initial load
duke
parents:
diff changeset
   830
        for (j = 0; j < height; j++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   831
            IntArgbPreSrcOverMaskFill_A1_line(rasBase, width, cnstARGB, cnstA);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   832
90ce3da70b43 Initial load
duke
parents:
diff changeset
   833
            PTR_ADD(rasBase, rasScan);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   834
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   835
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   836
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   837
90ce3da70b43 Initial load
duke
parents:
diff changeset
   838
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   839
90ce3da70b43 Initial load
duke
parents:
diff changeset
   840
void ADD_SUFF(FourByteAbgrPreSrcOverMaskFill)(void *rasBase,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   841
                                              jubyte *pMask,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   842
                                              jint maskOff,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   843
                                              jint maskScan,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   844
                                              jint width,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   845
                                              jint height,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   846
                                              jint fgColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   847
                                              SurfaceDataRasInfo *pRasInfo,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   848
                                              NativePrimitive *pPrim,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   849
                                              CompositeInfo *pCompInfo)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   850
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   851
    mlib_d64 buff[BUFF_SIZE/2];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   852
    void     *pbuff = buff, *p_dst;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   853
    mlib_s32 cnstA, cnstR, cnstG, cnstB;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   854
    mlib_s32 rasScan = pRasInfo->scanStride;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   855
    mlib_f32 cnstARGB0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   856
    mlib_d64 cnstARGB;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   857
    mlib_u8  *mul8_cnstA;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   858
    mlib_s32 j;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   859
90ce3da70b43 Initial load
duke
parents:
diff changeset
   860
    if (width > BUFF_SIZE) pbuff = mlib_malloc(width*sizeof(mlib_s32));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   861
90ce3da70b43 Initial load
duke
parents:
diff changeset
   862
    cnstA = (fgColor >> 24) & 0xff;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   863
    cnstR = (fgColor >> 16) & 0xff;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   864
    cnstG = (fgColor >>  8) & 0xff;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   865
    cnstB = (fgColor      ) & 0xff;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   866
90ce3da70b43 Initial load
duke
parents:
diff changeset
   867
    if (cnstA != 0xff) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   868
        if (cnstA == 0) return;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   869
90ce3da70b43 Initial load
duke
parents:
diff changeset
   870
        cnstR = mul8table[cnstA][cnstR];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   871
        cnstG = mul8table[cnstA][cnstG];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   872
        cnstB = mul8table[cnstA][cnstB];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   873
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   874
90ce3da70b43 Initial load
duke
parents:
diff changeset
   875
    vis_write_gsr(0 << 3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   876
90ce3da70b43 Initial load
duke
parents:
diff changeset
   877
    if (pMask != NULL) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   878
        pMask += maskOff;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   879
90ce3da70b43 Initial load
duke
parents:
diff changeset
   880
        mul8_cnstA = mul8table[cnstA];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   881
90ce3da70b43 Initial load
duke
parents:
diff changeset
   882
        cnstARGB0 = F32_FROM_U8x4(cnstA, cnstB, cnstG, cnstR);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   883
90ce3da70b43 Initial load
duke
parents:
diff changeset
   884
        for (j = 0; j < height; j++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   885
            if ((mlib_s32)rasBase & 3) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   886
                mlib_ImageCopy_na(rasBase, pbuff, width*sizeof(mlib_s32));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   887
                p_dst = pbuff;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   888
            } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   889
                p_dst = rasBase;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   890
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   891
90ce3da70b43 Initial load
duke
parents:
diff changeset
   892
            IntArgbPreSrcOverMaskFill_line(p_dst, pMask, width, cnstARGB0,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   893
                                           mul8_cnstA);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   894
90ce3da70b43 Initial load
duke
parents:
diff changeset
   895
            if (p_dst != rasBase) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   896
                mlib_ImageCopy_na(p_dst, rasBase, width*sizeof(mlib_s32));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   897
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   898
90ce3da70b43 Initial load
duke
parents:
diff changeset
   899
            PTR_ADD(rasBase, rasScan);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   900
            PTR_ADD(pMask, maskScan);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   901
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   902
    } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   903
        cnstARGB = vis_to_double((cnstA << 23) | (cnstB << 7),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   904
                                 (cnstG << 23) | (cnstR << 7));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   905
90ce3da70b43 Initial load
duke
parents:
diff changeset
   906
        for (j = 0; j < height; j++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   907
            if ((mlib_s32)rasBase & 3) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   908
                mlib_ImageCopy_na(rasBase, pbuff, width*sizeof(mlib_s32));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   909
                p_dst = pbuff;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   910
            } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   911
                p_dst = rasBase;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   912
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   913
90ce3da70b43 Initial load
duke
parents:
diff changeset
   914
            IntArgbPreSrcOverMaskFill_A1_line(p_dst, width, cnstARGB, cnstA);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   915
90ce3da70b43 Initial load
duke
parents:
diff changeset
   916
            if (p_dst != rasBase) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   917
                mlib_ImageCopy_na(p_dst, rasBase, width*sizeof(mlib_s32));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   918
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   919
90ce3da70b43 Initial load
duke
parents:
diff changeset
   920
            PTR_ADD(rasBase, rasScan);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   921
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   922
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   923
90ce3da70b43 Initial load
duke
parents:
diff changeset
   924
    if (pbuff != buff) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   925
        mlib_free(pbuff);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   926
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   927
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   928
90ce3da70b43 Initial load
duke
parents:
diff changeset
   929
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   930
90ce3da70b43 Initial load
duke
parents:
diff changeset
   931
/* ##############################################################
90ce3da70b43 Initial load
duke
parents:
diff changeset
   932
 * IntArgbToIntArgbPreSrcOverMaskBlit()
90ce3da70b43 Initial load
duke
parents:
diff changeset
   933
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   934
90ce3da70b43 Initial load
duke
parents:
diff changeset
   935
#undef  MASK_FILL
90ce3da70b43 Initial load
duke
parents:
diff changeset
   936
#define MASK_FILL(rr, pathA, dstARGB, srcA, srcARGB)         \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   937
{                                                            \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   938
    mlib_d64 t0, t1;                                         \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   939
    mlib_s32 dstF;                                           \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   940
                                                             \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   941
    srcA = MUL8_INT(mul8_extra[pathA], srcA);                \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   942
    dstF = 0xff - srcA;                                      \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   943
                                                             \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   944
    t0 = MUL8_VIS(srcARGB, srcA);                            \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   945
    t1 = MUL8_VIS(dstARGB, dstF);                            \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   946
    rr = vis_fpadd16(t0, t1);                                \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   947
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   948
90ce3da70b43 Initial load
duke
parents:
diff changeset
   949
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   950
90ce3da70b43 Initial load
duke
parents:
diff changeset
   951
static void IntArgbToIntArgbPreSrcOverMaskBlit_line(mlib_f32 *dst_ptr,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   952
                                                    mlib_f32 *src_ptr,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   953
                                                    mlib_u8  *pMask,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   954
                                                    mlib_s32 width,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   955
                                                    mlib_u8  *mul8_extra,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   956
                                                    mlib_u8  *mul8_tbl);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   957
90ce3da70b43 Initial load
duke
parents:
diff changeset
   958
#pragma no_inline(IntArgbToIntArgbPreSrcOverMaskBlit_line)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   959
90ce3da70b43 Initial load
duke
parents:
diff changeset
   960
static void IntArgbToIntArgbPreSrcOverMaskBlit_line(mlib_f32 *dst_ptr,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   961
                                                    mlib_f32 *src_ptr,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   962
                                                    mlib_u8  *pMask,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   963
                                                    mlib_s32 width,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   964
                                                    mlib_u8  *mul8_extra,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   965
                                                    mlib_u8  *mul8_tbl)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   966
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   967
    mlib_s32 i, i0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   968
    mlib_s32 pathA0, pathA1, srcA0, srcA1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   969
    mlib_d64 res0, res1, dstARGB, srcARGB;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   970
    mlib_f32 dstARGB0, srcARGB0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   971
    mlib_d64 or_alpha = vis_to_double_dup(0xff000000);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   972
90ce3da70b43 Initial load
duke
parents:
diff changeset
   973
    i = i0 = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   974
90ce3da70b43 Initial load
duke
parents:
diff changeset
   975
    if ((mlib_s32)dst_ptr & 7) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   976
        pathA0 = pMask[i];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   977
        srcA0 = *(mlib_u8*)(src_ptr + i);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   978
        dstARGB0 = dst_ptr[i];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   979
        srcARGB0 = src_ptr[i];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   980
        srcARGB0 = vis_fors(vis_read_hi(or_alpha), srcARGB0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   981
        MASK_FILL(res0, pathA0, dstARGB0, srcA0, srcARGB0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   982
        if (srcA0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   983
            dst_ptr[i] = vis_fpack16(res0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   984
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   985
90ce3da70b43 Initial load
duke
parents:
diff changeset
   986
        i0 = 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   987
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   988
90ce3da70b43 Initial load
duke
parents:
diff changeset
   989
#pragma pipeloop(0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   990
    for (i = i0; i <= width - 2; i += 2) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   991
        pathA0 = pMask[i];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   992
        pathA1 = pMask[i + 1];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   993
        dstARGB = *(mlib_d64*)(dst_ptr + i);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   994
        srcA0 = *(mlib_u8*)(src_ptr + i);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   995
        srcA1 = *(mlib_u8*)(src_ptr + i + 1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   996
        srcARGB = vis_freg_pair(src_ptr[i], src_ptr[i + 1]);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   997
        srcARGB = vis_for(or_alpha, srcARGB);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   998
90ce3da70b43 Initial load
duke
parents:
diff changeset
   999
        MASK_FILL(res0, pathA0, vis_read_hi(dstARGB),
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1000
                  srcA0, vis_read_hi(srcARGB));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1001
        MASK_FILL(res1, pathA1, vis_read_lo(dstARGB),
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1002
                  srcA1, vis_read_lo(srcARGB));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1003
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1004
        res0 = vis_fpack16_pair(res0, res1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1005
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1006
        *(mlib_d64*)(dst_ptr + i) = res0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1007
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1008
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1009
    if (i < width) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1010
        pathA0 = pMask[i];
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1011
        srcA0 = *(mlib_u8*)(src_ptr + i);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1012
        dstARGB0 = dst_ptr[i];
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1013
        srcARGB0 = src_ptr[i];
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1014
        srcARGB0 = vis_fors(vis_read_hi(or_alpha), srcARGB0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1015
        MASK_FILL(res0, pathA0, dstARGB0, srcA0, srcARGB0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1016
        if (srcA0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1017
            dst_ptr[i] = vis_fpack16(res0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1018
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1019
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1020
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1021
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1022
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1023
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1024
#undef  MASK_FILL
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1025
#define MASK_FILL(rr, dstARGB, srcA, srcARGB)         \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1026
{                                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1027
    mlib_d64 t0, t1;                                  \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1028
    mlib_s32 dstF;                                    \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1029
                                                      \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1030
    srcA = mul8_extra[srcA];                          \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1031
    dstF = 0xff - srcA;                               \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1032
                                                      \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1033
    t0 = MUL8_VIS(srcARGB, srcA);                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1034
    t1 = MUL8_VIS(dstARGB, dstF);                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1035
    rr = vis_fpadd16(t0, t1);                         \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1036
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1037
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1038
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1039
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1040
static void IntArgbToIntArgbPreSrcOverMaskBlit_A1_line(mlib_f32 *dst_ptr,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1041
                                                       mlib_f32 *src_ptr,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1042
                                                       mlib_s32 width,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1043
                                                       mlib_u8  *mul8_extra);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1044
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1045
#pragma no_inline(IntArgbToIntArgbPreSrcOverMaskBlit_A1_line)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1046
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1047
static void IntArgbToIntArgbPreSrcOverMaskBlit_A1_line(mlib_f32 *dst_ptr,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1048
                                                       mlib_f32 *src_ptr,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1049
                                                       mlib_s32 width,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1050
                                                       mlib_u8  *mul8_extra)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1051
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1052
    mlib_s32 i, i0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1053
    mlib_s32 srcA0, srcA1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1054
    mlib_d64 res0, res1, dstARGB, srcARGB;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1055
    mlib_f32 dstARGB0, srcARGB0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1056
    mlib_d64 or_alpha = vis_to_double_dup(0xff000000);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1057
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1058
    i = i0 = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1059
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1060
    if ((mlib_s32)dst_ptr & 7) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1061
        srcA0 = *(mlib_u8*)(src_ptr + i);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1062
        dstARGB0 = dst_ptr[i];
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1063
        srcARGB0 = src_ptr[i];
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1064
        srcARGB0 = vis_fors(vis_read_hi(or_alpha), srcARGB0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1065
        MASK_FILL(res0, dstARGB0, srcA0, srcARGB0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1066
        if (srcA0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1067
            dst_ptr[i] = vis_fpack16(res0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1068
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1069
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1070
        i0 = 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1071
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1072
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1073
#pragma pipeloop(0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1074
    for (i = i0; i <= width - 2; i += 2) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1075
        dstARGB = *(mlib_d64*)(dst_ptr + i);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1076
        srcA0 = *(mlib_u8*)(src_ptr + i);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1077
        srcA1 = *(mlib_u8*)(src_ptr + i + 1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1078
        srcARGB = vis_freg_pair(src_ptr[i], src_ptr[i + 1]);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1079
        srcARGB = vis_for(or_alpha, srcARGB);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1080
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1081
        MASK_FILL(res0, vis_read_hi(dstARGB), srcA0, vis_read_hi(srcARGB));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1082
        MASK_FILL(res1, vis_read_lo(dstARGB), srcA1, vis_read_lo(srcARGB));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1083
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1084
        res0 = vis_fpack16_pair(res0, res1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1085
        *(mlib_d64*)(dst_ptr + i) = res0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1086
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1087
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1088
    if (i < width) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1089
        srcA0 = *(mlib_u8*)(src_ptr + i);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1090
        dstARGB0 = dst_ptr[i];
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1091
        srcARGB0 = src_ptr[i];
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1092
        srcARGB0 = vis_fors(vis_read_hi(or_alpha), srcARGB0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1093
        MASK_FILL(res0, dstARGB0, srcA0, srcARGB0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1094
        if (srcA0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1095
            dst_ptr[i] = vis_fpack16(res0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1096
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1097
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1098
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1099
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1100
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1101
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1102
void ADD_SUFF(IntArgbToIntArgbPreSrcOverMaskBlit)(MASKBLIT_PARAMS)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1103
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1104
    mlib_s32 extraA;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1105
    mlib_s32 dstScan = pDstInfo->scanStride;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1106
    mlib_s32 srcScan = pSrcInfo->scanStride;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1107
    mlib_u8  *mul8_extra;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1108
    mlib_s32 j;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1109
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1110
    extraA = (mlib_s32)(pCompInfo->details.extraAlpha * 255.0 + 0.5);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1111
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1112
    mul8_extra = mul8table[extraA];
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1113
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1114
    vis_write_gsr(0 << 3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1115
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1116
    if (pMask != NULL) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1117
        pMask += maskOff;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1118
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1119
        if (dstScan == 4*width && srcScan == dstScan && maskScan == width) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1120
            width *= height;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1121
            height = 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1122
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1123
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1124
        for (j = 0; j < height; j++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1125
            IntArgbToIntArgbPreSrcOverMaskBlit_line(dstBase, srcBase, pMask,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1126
                                                    width, mul8_extra,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1127
                                                    (void*)mul8table);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1128
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1129
            PTR_ADD(dstBase, dstScan);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1130
            PTR_ADD(srcBase, srcScan);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1131
            PTR_ADD(pMask, maskScan);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1132
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1133
    } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1134
        if (dstScan == 4*width && srcScan == dstScan) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1135
            width *= height;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1136
            height = 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1137
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1138
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1139
        for (j = 0; j < height; j++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1140
            IntArgbToIntArgbPreSrcOverMaskBlit_A1_line(dstBase, srcBase, width,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1141
                                                       mul8_extra);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1142
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1143
            PTR_ADD(dstBase, dstScan);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1144
            PTR_ADD(srcBase, srcScan);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1145
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1146
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1147
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1148
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1149
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1150
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1151
void ADD_SUFF(IntArgbToFourByteAbgrPreSrcOverMaskBlit)(MASKBLIT_PARAMS)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1152
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1153
    mlib_d64 buff[BUFF_SIZE/2];
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1154
    void     *pbuff = buff;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1155
    mlib_s32 extraA;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1156
    mlib_s32 dstScan = pDstInfo->scanStride;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1157
    mlib_s32 srcScan = pSrcInfo->scanStride;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1158
    mlib_u8  *mul8_extra;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1159
    mlib_s32 j;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1160
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1161
    if (width > BUFF_SIZE) pbuff = mlib_malloc(width*sizeof(mlib_s32));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1162
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1163
    extraA = (mlib_s32)(pCompInfo->details.extraAlpha * 255.0 + 0.5);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1164
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1165
    mul8_extra = mul8table[extraA];
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1166
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1167
    vis_write_gsr(0 << 3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1168
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1169
    if (pMask != NULL) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1170
        pMask += maskOff;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1171
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1172
        for (j = 0; j < height; j++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1173
            ADD_SUFF(FourByteAbgrToIntArgbConvert)(dstBase, pbuff, width, 1,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1174
                                                   pSrcInfo, pDstInfo,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1175
                                                   pPrim, pCompInfo);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1176
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1177
            IntArgbToIntArgbPreSrcOverMaskBlit_line(pbuff, srcBase, pMask,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1178
                                                    width, mul8_extra,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1179
                                                    (void*)mul8table);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1180
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1181
            ADD_SUFF(IntArgbToFourByteAbgrConvert)(pbuff, dstBase, width, 1,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1182
                                                   pSrcInfo, pDstInfo,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1183
                                                   pPrim, pCompInfo);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1184
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1185
            PTR_ADD(dstBase, dstScan);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1186
            PTR_ADD(srcBase, srcScan);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1187
            PTR_ADD(pMask, maskScan);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1188
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1189
    } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1190
        for (j = 0; j < height; j++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1191
            ADD_SUFF(FourByteAbgrToIntArgbConvert)(dstBase, pbuff, width, 1,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1192
                                                   pSrcInfo, pDstInfo,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1193
                                                   pPrim, pCompInfo);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1194
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1195
            IntArgbToIntArgbPreSrcOverMaskBlit_A1_line(pbuff, srcBase, width,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1196
                                                       mul8_extra);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1197
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1198
            ADD_SUFF(IntArgbToFourByteAbgrConvert)(pbuff, dstBase, width, 1,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1199
                                                   pSrcInfo, pDstInfo,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1200
                                                   pPrim, pCompInfo);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1201
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1202
            PTR_ADD(dstBase, dstScan);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1203
            PTR_ADD(srcBase, srcScan);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1204
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1205
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1206
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1207
    if (pbuff != buff) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1208
        mlib_free(pbuff);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1209
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1210
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1211
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1212
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1213
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1214
/* ##############################################################
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1215
 * IntArgbToIntArgbPreAlphaMaskBlit()
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1216
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1217
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1218
#undef  MASK_FILL
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1219
#define MASK_FILL(rr, pathA, dstA, dstARGB, srcA, srcARGB)         \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1220
{                                                                  \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1221
    mlib_d64 t0, t1;                                               \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1222
    mlib_s32 srcF, dstF;                                           \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1223
                                                                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1224
    srcA = mul8_extra[srcA];                                       \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1225
                                                                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1226
    srcF = ((dstA & SrcOpAnd) ^ SrcOpXor) + SrcOpAdd;              \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1227
    dstF = ((srcA & DstOpAnd) ^ DstOpXor) + DstOpAdd;              \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1228
                                                                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1229
    srcF = MUL8_INT(pathA, srcF);                                  \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1230
    dstF = MUL8_INT(pathA, dstF) + (0xff - pathA);                 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1231
                                                                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1232
    srcA = MUL8_INT(srcF, srcA);                                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1233
                                                                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1234
    t0 = MUL8_VIS(srcARGB, srcA);                                  \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1235
    t1 = MUL8_VIS(dstARGB, dstF);                                  \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1236
    rr = vis_fpadd16(t0, t1);                                      \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1237
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1238
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1239
/**************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1240
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1241
static void IntArgbToIntArgbPreAlphaMaskBlit_line(mlib_f32 *dst_ptr,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1242
                                                  mlib_f32 *src_ptr,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1243
                                                  mlib_u8  *pMask,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1244
                                                  mlib_s32 width,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1245
                                                  mlib_s32 *log_val,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1246
                                                  mlib_u8  *mul8_extra,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1247
                                                  mlib_u8  *mul8_tbl);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1248
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1249
#pragma no_inline(IntArgbToIntArgbPreAlphaMaskBlit_line)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1250
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1251
static void IntArgbToIntArgbPreAlphaMaskBlit_line(mlib_f32 *dst_ptr,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1252
                                                  mlib_f32 *src_ptr,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1253
                                                  mlib_u8  *pMask,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1254
                                                  mlib_s32 width,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1255
                                                  mlib_s32 *log_val,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1256
                                                  mlib_u8  *mul8_extra,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1257
                                                  mlib_u8  *mul8_tbl)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1258
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1259
    mlib_s32 i;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1260
    mlib_s32 pathA0, dstA0, srcA0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1261
    mlib_d64 res0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1262
    mlib_f32 dstARGB0, srcARGB0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1263
    mlib_s32 SrcOpAnd = log_val[0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1264
    mlib_s32 SrcOpXor = log_val[1];
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1265
    mlib_s32 SrcOpAdd = log_val[2];
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1266
    mlib_s32 DstOpAnd = log_val[3];
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1267
    mlib_s32 DstOpXor = log_val[4];
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1268
    mlib_s32 DstOpAdd = log_val[5];
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1269
    mlib_f32 or_alpha = vis_to_float(0xff000000);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1270
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1271
#pragma pipeloop(0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1272
    for (i = 0; i < width; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1273
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1274
        pathA0 = pMask[i];
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1275
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1276
        dstA0 = *(mlib_u8*)dst_ptr;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1277
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1278
        dstARGB0 = *dst_ptr;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1279
        srcA0 = *(mlib_u8*)src_ptr;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1280
        srcARGB0 = *src_ptr;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1281
        srcARGB0 = vis_fors(or_alpha, srcARGB0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1282
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1283
        MASK_FILL(res0, pathA0, dstA0, dstARGB0, srcA0, srcARGB0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1284
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1285
        *dst_ptr = vis_fpack16(res0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1286
        dst_ptr++;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1287
        src_ptr++;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1288
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1289
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1290
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1291
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1292
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1293
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1294
#undef  MASK_FILL
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1295
#define MASK_FILL(rr, dstA, dstARGB, srcA, srcARGB)         \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1296
{                                                           \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1297
    mlib_d64 t0, t1;                                        \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1298
    mlib_s32 srcF, dstF;                                    \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1299
                                                            \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1300
    srcA = mul8_extra[srcA];                                \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1301
                                                            \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1302
    srcF = ((dstA & SrcOpAnd) ^ SrcOpXor) + SrcOpAdd;       \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1303
    dstF = ((srcA & DstOpAnd) ^ DstOpXor) + DstOpAdd;       \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1304
                                                            \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1305
    srcA = MUL8_INT(srcF, srcA);                            \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1306
                                                            \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1307
    t0 = MUL8_VIS(srcARGB, srcA);                           \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1308
    t1 = MUL8_VIS(dstARGB, dstF);                           \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1309
    rr = vis_fpadd16(t0, t1);                               \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1310
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1311
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1312
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1313
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1314
static void IntArgbToIntArgbPreAlphaMaskBlit_A1_line(mlib_f32 *dst_ptr,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1315
                                                     mlib_f32 *src_ptr,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1316
                                                     mlib_s32 width,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1317
                                                     mlib_s32 *log_val,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1318
                                                     mlib_u8  *mul8_extra,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1319
                                                     mlib_u8  *mul8_tbl);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1320
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1321
#pragma no_inline(IntArgbToIntArgbPreAlphaMaskBlit_A1_line)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1322
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1323
static void IntArgbToIntArgbPreAlphaMaskBlit_A1_line(mlib_f32 *dst_ptr,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1324
                                                     mlib_f32 *src_ptr,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1325
                                                     mlib_s32 width,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1326
                                                     mlib_s32 *log_val,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1327
                                                     mlib_u8  *mul8_extra,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1328
                                                     mlib_u8  *mul8_tbl)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1329
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1330
    mlib_s32 i;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1331
    mlib_s32 dstA0, srcA0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1332
    mlib_d64 res0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1333
    mlib_f32 dstARGB0, srcARGB0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1334
    mlib_s32 SrcOpAnd = log_val[0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1335
    mlib_s32 SrcOpXor = log_val[1];
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1336
    mlib_s32 SrcOpAdd = log_val[2];
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1337
    mlib_s32 DstOpAnd = log_val[3];
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1338
    mlib_s32 DstOpXor = log_val[4];
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1339
    mlib_s32 DstOpAdd = log_val[5];
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1340
    mlib_f32 or_alpha = vis_to_float(0xff000000);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1341
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1342
#pragma pipeloop(0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1343
    for (i = 0; i < width; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1344
        dstA0 = *(mlib_u8*)(dst_ptr + i);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1345
        srcA0 = *(mlib_u8*)(src_ptr + i);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1346
        dstARGB0 = dst_ptr[i];
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1347
        srcARGB0 = src_ptr[i];
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1348
        srcARGB0 = vis_fors(or_alpha, srcARGB0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1349
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1350
        MASK_FILL(res0, dstA0, dstARGB0, srcA0, srcARGB0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1351
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1352
        dst_ptr[i] = vis_fpack16(res0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1353
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1354
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1355
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1356
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1357
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1358
void ADD_SUFF(IntArgbToIntArgbPreAlphaMaskBlit)(MASKBLIT_PARAMS)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1359
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1360
    mlib_s32 extraA;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1361
    mlib_s32 dstScan = pDstInfo->scanStride;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1362
    mlib_s32 srcScan = pSrcInfo->scanStride;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1363
    mlib_s32 log_val[6];
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1364
    mlib_s32 j;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1365
    mlib_s32 SrcOpAnd;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1366
    mlib_s32 SrcOpXor;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1367
    mlib_s32 SrcOpAdd;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1368
    mlib_s32 DstOpAnd;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1369
    mlib_s32 DstOpXor;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1370
    mlib_s32 DstOpAdd;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1371
    mlib_u8  *mul8_extra;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1372
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1373
    extraA = (mlib_s32)(pCompInfo->details.extraAlpha * 255.0 + 0.5);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1374
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1375
    mul8_extra = mul8table[extraA];
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1376
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1377
    SrcOpAnd = (AlphaRules[pCompInfo->rule].srcOps).andval;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1378
    SrcOpXor = (AlphaRules[pCompInfo->rule].srcOps).xorval;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1379
    SrcOpAdd = (AlphaRules[pCompInfo->rule].srcOps).addval;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1380
    SrcOpAdd -= SrcOpXor;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1381
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1382
    DstOpAnd = (AlphaRules[pCompInfo->rule].dstOps).andval;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1383
    DstOpXor = (AlphaRules[pCompInfo->rule].dstOps).xorval;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1384
    DstOpAdd = (AlphaRules[pCompInfo->rule].dstOps).addval;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1385
    DstOpAdd -= DstOpXor;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1386
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1387
    log_val[0] = SrcOpAnd;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1388
    log_val[1] = SrcOpXor;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1389
    log_val[2] = SrcOpAdd;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1390
    log_val[3] = DstOpAnd;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1391
    log_val[4] = DstOpXor;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1392
    log_val[5] = DstOpAdd;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1393
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1394
    vis_write_gsr(0 << 3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1395
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1396
    if (pMask != NULL) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1397
        pMask += maskOff;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1398
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1399
        if (dstScan == 4*width && srcScan == dstScan && maskScan == width) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1400
            width *= height;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1401
            height = 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1402
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1403
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1404
        for (j = 0; j < height; j++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1405
            IntArgbToIntArgbPreAlphaMaskBlit_line(dstBase, srcBase, pMask,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1406
                                                  width, log_val, mul8_extra,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1407
                                                  (void*)mul8table);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1408
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1409
            PTR_ADD(dstBase, dstScan);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1410
            PTR_ADD(srcBase, srcScan);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1411
            PTR_ADD(pMask, maskScan);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1412
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1413
    } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1414
        if (dstScan == 4*width && srcScan == dstScan) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1415
            width *= height;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1416
            height = 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1417
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1418
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1419
        for (j = 0; j < height; j++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1420
            IntArgbToIntArgbPreAlphaMaskBlit_A1_line(dstBase, srcBase,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1421
                                                     width, log_val, mul8_extra,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1422
                                                     (void*)mul8table);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1423
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1424
            PTR_ADD(dstBase, dstScan);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1425
            PTR_ADD(srcBase, srcScan);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1426
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1427
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1428
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1429
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1430
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1431
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1432
void ADD_SUFF(IntArgbToFourByteAbgrPreAlphaMaskBlit)(MASKBLIT_PARAMS)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1433
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1434
    mlib_d64 buff[BUFF_SIZE/2];
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1435
    void     *pbuff = buff;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1436
    mlib_s32 extraA;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1437
    mlib_s32 dstScan = pDstInfo->scanStride;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1438
    mlib_s32 srcScan = pSrcInfo->scanStride;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1439
    mlib_s32 log_val[6];
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1440
    mlib_s32 j;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1441
    mlib_s32 SrcOpAnd;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1442
    mlib_s32 SrcOpXor;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1443
    mlib_s32 SrcOpAdd;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1444
    mlib_s32 DstOpAnd;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1445
    mlib_s32 DstOpXor;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1446
    mlib_s32 DstOpAdd;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1447
    mlib_u8  *mul8_extra;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1448
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1449
    if (width > BUFF_SIZE) pbuff = mlib_malloc(width*sizeof(mlib_s32));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1450
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1451
    extraA = (mlib_s32)(pCompInfo->details.extraAlpha * 255.0 + 0.5);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1452
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1453
    mul8_extra = mul8table[extraA];
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1454
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1455
    SrcOpAnd = (AlphaRules[pCompInfo->rule].srcOps).andval;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1456
    SrcOpXor = (AlphaRules[pCompInfo->rule].srcOps).xorval;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1457
    SrcOpAdd = (AlphaRules[pCompInfo->rule].srcOps).addval;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1458
    SrcOpAdd -= SrcOpXor;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1459
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1460
    DstOpAnd = (AlphaRules[pCompInfo->rule].dstOps).andval;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1461
    DstOpXor = (AlphaRules[pCompInfo->rule].dstOps).xorval;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1462
    DstOpAdd = (AlphaRules[pCompInfo->rule].dstOps).addval;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1463
    DstOpAdd -= DstOpXor;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1464
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1465
    log_val[0] = SrcOpAnd;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1466
    log_val[1] = SrcOpXor;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1467
    log_val[2] = SrcOpAdd;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1468
    log_val[3] = DstOpAnd;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1469
    log_val[4] = DstOpXor;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1470
    log_val[5] = DstOpAdd;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1471
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1472
    vis_write_gsr(0 << 3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1473
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1474
    if (pMask != NULL) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1475
        pMask += maskOff;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1476
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1477
        for (j = 0; j < height; j++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1478
            ADD_SUFF(FourByteAbgrToIntArgbConvert)(dstBase, pbuff, width, 1,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1479
                                                   pSrcInfo, pDstInfo,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1480
                                                   pPrim, pCompInfo);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1481
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1482
            IntArgbToIntArgbPreAlphaMaskBlit_line(pbuff, srcBase, pMask,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1483
                                                  width, log_val, mul8_extra,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1484
                                                  (void*)mul8table);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1485
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1486
            ADD_SUFF(IntArgbToFourByteAbgrConvert)(pbuff, dstBase, width, 1,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1487
                                                   pSrcInfo, pDstInfo,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1488
                                                   pPrim, pCompInfo);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1489
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1490
            PTR_ADD(dstBase, dstScan);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1491
            PTR_ADD(srcBase, srcScan);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1492
            PTR_ADD(pMask, maskScan);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1493
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1494
    } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1495
        for (j = 0; j < height; j++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1496
            ADD_SUFF(FourByteAbgrToIntArgbConvert)(dstBase, pbuff, width, 1,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1497
                                                   pSrcInfo, pDstInfo,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1498
                                                   pPrim, pCompInfo);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1499
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1500
            IntArgbToIntArgbPreAlphaMaskBlit_A1_line(pbuff, srcBase,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1501
                                                     width, log_val, mul8_extra,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1502
                                                     (void*)mul8table);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1503
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1504
            ADD_SUFF(IntArgbToFourByteAbgrConvert)(pbuff, dstBase, width, 1,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1505
                                                   pSrcInfo, pDstInfo,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1506
                                                   pPrim, pCompInfo);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1507
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1508
            PTR_ADD(dstBase, dstScan);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1509
            PTR_ADD(srcBase, srcScan);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1510
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1511
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1512
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1513
    if (pbuff != buff) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1514
        mlib_free(pbuff);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1515
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1516
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1517
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1518
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1519
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1520
/* ##############################################################
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1521
 * IntRgbToIntArgbPreAlphaMaskBlit()
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1522
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1523
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1524
#undef  MASK_FILL
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1525
#define MASK_FILL(rr, pathA, dstA, dstARGB, srcA, srcARGB)         \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1526
{                                                                  \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1527
    mlib_d64 t0, t1;                                               \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1528
    mlib_s32 srcF, dstF;                                           \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1529
                                                                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1530
    srcF = ((dstA & SrcOpAnd) ^ SrcOpXor) + SrcOpAdd;              \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1531
                                                                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1532
    srcF = MUL8_INT(pathA, srcF);                                  \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1533
    dstF = mul8_tbl[pathA + dstF_0] + (0xff - pathA);              \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1534
                                                                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1535
    srcF = mul8_tbl[srcF + srcA];                                  \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1536
                                                                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1537
    t0 = MUL8_VIS(srcARGB, srcF);                                  \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1538
    t1 = MUL8_VIS(dstARGB, dstF);                                  \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1539
    rr = vis_fpadd16(t0, t1);                                      \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1540
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1541
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1542
/**************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1543
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1544
static void IntRgbToIntArgbPreAlphaMaskBlit_line(mlib_f32 *dst_ptr,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1545
                                                 mlib_f32 *src_ptr,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1546
                                                 mlib_u8  *pMask,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1547
                                                 mlib_s32 width,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1548
                                                 mlib_s32 *log_val,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1549
                                                 mlib_s32 extraA,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1550
                                                 mlib_s32 dstF_0,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1551
                                                 mlib_u8  *mul8_tbl);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1552
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1553
#pragma no_inline(IntRgbToIntArgbPreAlphaMaskBlit_line)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1554
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1555
static void IntRgbToIntArgbPreAlphaMaskBlit_line(mlib_f32 *dst_ptr,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1556
                                                 mlib_f32 *src_ptr,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1557
                                                 mlib_u8  *pMask,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1558
                                                 mlib_s32 width,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1559
                                                 mlib_s32 *log_val,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1560
                                                 mlib_s32 extraA,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1561
                                                 mlib_s32 dstF_0,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1562
                                                 mlib_u8  *mul8_tbl)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1563
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1564
    mlib_s32 i;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1565
    mlib_s32 pathA0, dstA0, srcA0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1566
    mlib_d64 res0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1567
    mlib_f32 dstARGB0, srcARGB0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1568
    mlib_s32 SrcOpAnd = log_val[0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1569
    mlib_s32 SrcOpXor = log_val[1];
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1570
    mlib_s32 SrcOpAdd = log_val[2];
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1571
    mlib_f32 or_alpha = vis_to_float(0xff000000);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1572
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1573
    srcA0 = extraA*256;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1574
    dstF_0 *= 256;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1575
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1576
#pragma pipeloop(0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1577
    for (i = 0; i < width; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1578
        pathA0 = pMask[i];
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1579
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1580
        dstA0 = *(mlib_u8*)dst_ptr;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1581
        dstARGB0 = *dst_ptr;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1582
        srcARGB0 = *src_ptr;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1583
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1584
        srcARGB0 = vis_fors(or_alpha, srcARGB0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1585
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1586
        MASK_FILL(res0, pathA0, dstA0, dstARGB0, srcA0, srcARGB0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1587
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1588
        *dst_ptr = vis_fpack16(res0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1589
        dst_ptr++;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1590
        src_ptr++;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1591
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1592
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1593
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1594
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1595
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1596
#undef  MASK_FILL
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1597
#define MASK_FILL(rr, dstA, dstARGB, srcA, srcARGB)         \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1598
{                                                           \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1599
    mlib_d64 t0, t1;                                        \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1600
    mlib_s32 srcF;                                          \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1601
                                                            \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1602
    srcF = ((dstA & SrcOpAnd) ^ SrcOpXor) + SrcOpAdd;       \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1603
                                                            \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1604
    srcF = mul8_tbl[srcF + srcA];                           \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1605
                                                            \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1606
    t0 = MUL8_VIS(srcARGB, srcF);                           \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1607
    t1 = MUL8_VIS(dstARGB, dstF_0);                         \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1608
    rr = vis_fpadd16(t0, t1);                               \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1609
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1610
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1611
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1612
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1613
static void IntRgbToIntArgbPreAlphaMaskBlit_A1_line(mlib_f32 *dst_ptr,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1614
                                                    mlib_f32 *src_ptr,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1615
                                                    mlib_s32 width,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1616
                                                    mlib_s32 *log_val,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1617
                                                    mlib_s32 extraA,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1618
                                                    mlib_s32 dstF_0,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1619
                                                    mlib_u8  *mul8_tbl);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1620
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1621
#pragma no_inline(IntRgbToIntArgbPreAlphaMaskBlit_A1_line)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1622
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1623
static void IntRgbToIntArgbPreAlphaMaskBlit_A1_line(mlib_f32 *dst_ptr,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1624
                                                    mlib_f32 *src_ptr,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1625
                                                    mlib_s32 width,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1626
                                                    mlib_s32 *log_val,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1627
                                                    mlib_s32 extraA,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1628
                                                    mlib_s32 dstF_0,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1629
                                                    mlib_u8  *mul8_tbl)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1630
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1631
    mlib_s32 i;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1632
    mlib_s32 dstA0, srcA0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1633
    mlib_d64 res0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1634
    mlib_f32 dstARGB0, srcARGB0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1635
    mlib_s32 SrcOpAnd = log_val[0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1636
    mlib_s32 SrcOpXor = log_val[1];
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1637
    mlib_s32 SrcOpAdd = log_val[2];
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1638
    mlib_f32 or_alpha = vis_to_float(0xff000000);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1639
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1640
    srcA0 = extraA*256;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1641
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1642
#pragma pipeloop(0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1643
    for (i = 0; i < width; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1644
        dstA0 = *(mlib_u8*)dst_ptr;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1645
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1646
        dstARGB0 = *dst_ptr;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1647
        srcARGB0 = *src_ptr;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1648
        srcARGB0 = vis_fors(or_alpha, srcARGB0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1649
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1650
        MASK_FILL(res0, dstA0, dstARGB0, srcA0, srcARGB0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1651
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1652
        *dst_ptr = vis_fpack16(res0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1653
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1654
        dst_ptr++;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1655
        src_ptr++;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1656
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1657
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1658
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1659
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1660
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1661
void ADD_SUFF(IntRgbToIntArgbPreAlphaMaskBlit)(MASKBLIT_PARAMS)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1662
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1663
    mlib_s32 extraA;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1664
    mlib_s32 dstScan = pDstInfo->scanStride;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1665
    mlib_s32 srcScan = pSrcInfo->scanStride;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1666
    mlib_s32 log_val[3];
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1667
    mlib_s32 j;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1668
    mlib_s32 SrcOpAnd;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1669
    mlib_s32 SrcOpXor;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1670
    mlib_s32 SrcOpAdd;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1671
    mlib_s32 DstOpAnd;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1672
    mlib_s32 DstOpXor;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1673
    mlib_s32 DstOpAdd;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1674
    mlib_s32 dstF_0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1675
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1676
    extraA = (mlib_s32)(pCompInfo->details.extraAlpha * 255.0 + 0.5);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1677
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1678
    SrcOpAnd = (AlphaRules[pCompInfo->rule].srcOps).andval;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1679
    SrcOpXor = (AlphaRules[pCompInfo->rule].srcOps).xorval;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1680
    SrcOpAdd = (AlphaRules[pCompInfo->rule].srcOps).addval;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1681
    SrcOpAdd -= SrcOpXor;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1682
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1683
    DstOpAnd = (AlphaRules[pCompInfo->rule].dstOps).andval;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1684
    DstOpXor = (AlphaRules[pCompInfo->rule].dstOps).xorval;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1685
    DstOpAdd = (AlphaRules[pCompInfo->rule].dstOps).addval;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1686
    DstOpAdd -= DstOpXor;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1687
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1688
    log_val[0] = SrcOpAnd;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1689
    log_val[1] = SrcOpXor;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1690
    log_val[2] = SrcOpAdd;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1691
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1692
    vis_write_gsr(0 << 3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1693
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1694
    dstF_0 = ((extraA & DstOpAnd) ^ DstOpXor) + DstOpAdd;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1695
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1696
    if (pMask != NULL) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1697
        pMask += maskOff;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1698
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1699
        if (dstScan == 4*width && srcScan == dstScan && maskScan == width) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1700
            width *= height;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1701
            height = 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1702
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1703
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1704
        for (j = 0; j < height; j++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1705
            IntRgbToIntArgbPreAlphaMaskBlit_line(dstBase, srcBase, pMask,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1706
                                                 width, log_val, extraA, dstF_0,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1707
                                                 (void*)mul8table);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1708
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1709
            PTR_ADD(dstBase, dstScan);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1710
            PTR_ADD(srcBase, srcScan);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1711
            PTR_ADD(pMask, maskScan);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1712
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1713
    } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1714
        if (dstScan == 4*width && srcScan == dstScan) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1715
            width *= height;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1716
            height = 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1717
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1718
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1719
        for (j = 0; j < height; j++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1720
            IntRgbToIntArgbPreAlphaMaskBlit_A1_line(dstBase, srcBase, width,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1721
                                                    log_val, extraA, dstF_0,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1722
                                                    (void*)mul8table);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1723
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1724
            PTR_ADD(dstBase, dstScan);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1725
            PTR_ADD(srcBase, srcScan);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1726
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1727
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1728
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1729
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1730
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1731
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1732
void ADD_SUFF(IntRgbToFourByteAbgrPreAlphaMaskBlit)(MASKBLIT_PARAMS)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1733
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1734
    mlib_d64 buff[BUFF_SIZE/2];
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1735
    void     *pbuff = buff;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1736
    mlib_s32 extraA;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1737
    mlib_s32 dstScan = pDstInfo->scanStride;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1738
    mlib_s32 srcScan = pSrcInfo->scanStride;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1739
    mlib_s32 log_val[3];
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1740
    mlib_s32 j;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1741
    mlib_s32 SrcOpAnd;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1742
    mlib_s32 SrcOpXor;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1743
    mlib_s32 SrcOpAdd;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1744
    mlib_s32 DstOpAnd;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1745
    mlib_s32 DstOpXor;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1746
    mlib_s32 DstOpAdd;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1747
    mlib_s32 dstF_0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1748
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1749
    if (width > BUFF_SIZE) pbuff = mlib_malloc(width*sizeof(mlib_s32));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1750
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1751
    extraA = (mlib_s32)(pCompInfo->details.extraAlpha * 255.0 + 0.5);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1752
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1753
    SrcOpAnd = (AlphaRules[pCompInfo->rule].srcOps).andval;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1754
    SrcOpXor = (AlphaRules[pCompInfo->rule].srcOps).xorval;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1755
    SrcOpAdd = (AlphaRules[pCompInfo->rule].srcOps).addval;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1756
    SrcOpAdd -= SrcOpXor;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1757
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1758
    DstOpAnd = (AlphaRules[pCompInfo->rule].dstOps).andval;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1759
    DstOpXor = (AlphaRules[pCompInfo->rule].dstOps).xorval;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1760
    DstOpAdd = (AlphaRules[pCompInfo->rule].dstOps).addval;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1761
    DstOpAdd -= DstOpXor;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1762
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1763
    log_val[0] = SrcOpAnd;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1764
    log_val[1] = SrcOpXor;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1765
    log_val[2] = SrcOpAdd;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1766
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1767
    vis_write_gsr(0 << 3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1768
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1769
    dstF_0 = ((extraA & DstOpAnd) ^ DstOpXor) + DstOpAdd;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1770
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1771
    if (pMask != NULL) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1772
        pMask += maskOff;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1773
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1774
        for (j = 0; j < height; j++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1775
            ADD_SUFF(FourByteAbgrToIntArgbConvert)(dstBase, pbuff, width, 1,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1776
                                                   pSrcInfo, pDstInfo,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1777
                                                   pPrim, pCompInfo);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1778
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1779
            IntRgbToIntArgbPreAlphaMaskBlit_line(pbuff, srcBase, pMask, width,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1780
                                                 log_val, extraA, dstF_0,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1781
                                                 (void*)mul8table);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1782
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1783
            ADD_SUFF(IntArgbToFourByteAbgrConvert)(pbuff, dstBase, width, 1,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1784
                                                   pSrcInfo, pDstInfo,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1785
                                                   pPrim, pCompInfo);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1786
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1787
            PTR_ADD(dstBase, dstScan);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1788
            PTR_ADD(srcBase, srcScan);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1789
            PTR_ADD(pMask, maskScan);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1790
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1791
    } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1792
        for (j = 0; j < height; j++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1793
            ADD_SUFF(FourByteAbgrToIntArgbConvert)(dstBase, pbuff, width, 1,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1794
                                                   pSrcInfo, pDstInfo,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1795
                                                   pPrim, pCompInfo);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1796
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1797
            IntRgbToIntArgbPreAlphaMaskBlit_A1_line(pbuff, srcBase, width,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1798
                                                    log_val, extraA, dstF_0,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1799
                                                    (void*)mul8table);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1800
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1801
            ADD_SUFF(IntArgbToFourByteAbgrConvert)(pbuff, dstBase, width, 1,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1802
                                                   pSrcInfo, pDstInfo,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1803
                                                   pPrim, pCompInfo);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1804
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1805
            PTR_ADD(dstBase, dstScan);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1806
            PTR_ADD(srcBase, srcScan);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1807
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1808
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1809
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1810
    if (pbuff != buff) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1811
        mlib_free(pbuff);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1812
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1813
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1814
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1815
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1816
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1817
#endif /* JAVA2D_NO_MLIB */