jdk/src/solaris/native/sun/java2d/loops/vis_IntArgbPre.c
author xdono
Wed, 02 Jul 2008 12:55:45 -0700
changeset 715 f16baef3a20e
parent 549 4273b1234967
child 5506 202f599c92aa
permissions -rw-r--r--
6719955: Update copyright year Summary: Update copyright year for files that have been modified in 2008 Reviewed-by: ohair, tbell
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
715
f16baef3a20e 6719955: Update copyright year
xdono
parents: 549
diff changeset
     2
 * Copyright 2003-2008 Sun Microsystems, Inc.  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
90ce3da70b43 Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.  Sun designates this
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
90ce3da70b43 Initial load
duke
parents:
diff changeset
     9
 * by Sun in the LICENSE file that accompanied this code.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    21
 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    22
 * CA 95054 USA or visit www.sun.com if you need additional information or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    23
 * have any questions.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
#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
#define GET_ARGBPRE(i)         \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
    0xFF000000 | (src[3*i + 2] << 16) | (src[3*i + 1] << 8) | src[3*i]
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
#define CONVERT_PRE(rr, dstA, dstARGB)         \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
    rr = vis_fmul8x16(dstARGB, ((mlib_d64*)vis_div8pre_tbl)[dstA])
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
void ADD_SUFF(IntArgbPreToIntArgbConvert)(BLIT_PARAMS)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
    mlib_s32 dstScan = pDstInfo->scanStride;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
    mlib_s32 srcScan = pSrcInfo->scanStride;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
    mlib_s32 dstA0, dstA1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
    mlib_d64 res0, res1, dstARGB;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
    mlib_f32 dstARGB0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
    mlib_s32 i, i0, j;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
    vis_write_gsr(7 << 3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
    if (dstScan == 4*width && srcScan == 4*width) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
        width *= height;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
        height = 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
    for (j = 0; j < height; j++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
        mlib_f32 *src = srcBase;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
        mlib_f32 *dst = dstBase;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
        i = i0 = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
        if ((mlib_s32)dst & 7) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
            dstA0 = *(mlib_u8*)(src + i);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
            dstARGB0 = src[i];
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
            CONVERT_PRE(res0, dstA0, dstARGB0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
            dst[i] = vis_fpack16(res0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
            i0 = 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
#pragma pipeloop(0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
        for (i = i0; i <= (mlib_s32)width - 2; i += 2) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
            dstA0 = *(mlib_u8*)(src + i);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
            dstA1 = *(mlib_u8*)(src + i + 1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
            dstARGB = vis_freg_pair(src[i], src[i + 1]);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
            CONVERT_PRE(res0, dstA0, vis_read_hi(dstARGB));
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
            CONVERT_PRE(res1, dstA1, vis_read_lo(dstARGB));
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
            res0 = vis_fpack16_pair(res0, res1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
            *(mlib_d64*)(dst + i) = res0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
        if (i < width) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
            dstA0 = *(mlib_u8*)(src + i);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
            dstARGB0 = src[i];
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
            CONVERT_PRE(res0, dstA0, dstARGB0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
            dst[i] = vis_fpack16(res0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
        PTR_ADD(dstBase, dstScan);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
        PTR_ADD(srcBase, srcScan);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
void ADD_SUFF(IntArgbPreToIntArgbScaleConvert)(SCALE_PARAMS)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
    mlib_s32 dstScan = pDstInfo->scanStride;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
    mlib_s32 srcScan = pSrcInfo->scanStride;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
    mlib_s32 dstA0, dstA1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
    mlib_d64 res0, res1, dstARGB;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
    mlib_f32 dstARGB0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
    mlib_s32 i, i0, j, ind0, ind1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
    if (width < 16) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
        for (j = 0; j < height; j++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
            mlib_s32 *src = srcBase;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
            mlib_u8  *dst = dstBase;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
            mlib_s32 tmpsxloc = sxloc;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
            PTR_ADD(src, (syloc >> shift) * srcScan);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
            for (i = 0; i < width; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
                mlib_u32 argb = src[tmpsxloc >> shift];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
                mlib_u32 a, r, g, b;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
                b = argb & 0xff;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
                g = (argb >> 8) & 0xff;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
                r = (argb >> 16) & 0xff;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
                a = argb >> 24;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
                dst[4*i] = a;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
                if (a == 0) a = 255; /* a |= (a - 1) >> 24; */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
                dst[4*i + 1] = div8table[a][r];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
                dst[4*i + 2] = div8table[a][g];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
                dst[4*i + 3] = div8table[a][b];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
                tmpsxloc += sxinc;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
            PTR_ADD(dstBase, dstScan);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
            syloc += syinc;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
        return;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
    vis_write_gsr(7 << 3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
    for (j = 0; j < height; j++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
        mlib_f32 *src = srcBase;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
        mlib_f32 *dst = dstBase;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
        mlib_s32 tmpsxloc = sxloc;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
        PTR_ADD(src, (syloc >> shift) * srcScan);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
        i = i0 = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
        if ((mlib_s32)dst & 7) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
            ind0 = tmpsxloc >> shift;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
            tmpsxloc += sxinc;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
            dstA0 = *(mlib_u8*)(src + ind0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
            dstARGB0 = src[ind0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
            CONVERT_PRE(res0, dstA0, dstARGB0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
            dst[i] = vis_fpack16(res0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
            i0 = 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
#pragma pipeloop(0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
        for (i = i0; i <= (mlib_s32)width - 2; i += 2) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
            ind0 = tmpsxloc >> shift;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
            tmpsxloc += sxinc;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
            ind1 = tmpsxloc >> shift;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
            tmpsxloc += sxinc;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
            dstA0 = *(mlib_u8*)(src + ind0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
            dstA1 = *(mlib_u8*)(src + ind1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
            dstARGB = vis_freg_pair(src[ind0], src[ind1]);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
            CONVERT_PRE(res0, dstA0, vis_read_hi(dstARGB));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
            CONVERT_PRE(res1, dstA1, vis_read_lo(dstARGB));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
            res0 = vis_fpack16_pair(res0, res1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
            *(mlib_d64*)(dst + i) = res0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
        if (i < width) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
            ind0 = tmpsxloc >> shift;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
            tmpsxloc += sxinc;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
            dstA0 = *(mlib_u8*)(src + ind0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
            dstARGB0 = src[ind0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
            CONVERT_PRE(res0, dstA0, dstARGB0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
            dst[i] = vis_fpack16(res0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
        PTR_ADD(dstBase, dstScan);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
        syloc += syinc;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
#undef  CONVERT_PRE
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
#define CONVERT_PRE(rr, dstA, dstARGB)         \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
    rr = MUL8_VIS(dstARGB, dstA)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
void ADD_SUFF(IntArgbToIntArgbPreConvert)(BLIT_PARAMS)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
    mlib_s32 dstScan = pDstInfo->scanStride;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
    mlib_s32 srcScan = pSrcInfo->scanStride;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
    mlib_s32 dstA0, dstA1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
    mlib_d64 res0, res1, dstARGB;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
    mlib_f32 dstARGB0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
    mlib_s32 i, i0, j;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
    vis_write_gsr(0 << 3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
    if (dstScan == 4*width && srcScan == 4*width) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
        width *= height;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
        height = 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
    for (j = 0; j < height; j++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
        mlib_f32 *src = srcBase;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
        mlib_f32 *dst = dstBase;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
        i = i0 = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
        if ((mlib_s32)dst & 7) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
            dstA0 = *(mlib_u8*)(src + i);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
            dstARGB0 = src[i];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
            CONVERT_PRE(res0, dstA0, dstARGB0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
            dst[i] = vis_fpack16(res0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
            *(mlib_u8*)(dst + i) = dstA0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
            i0 = 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
#pragma pipeloop(0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
        for (i = i0; i <= (mlib_s32)width - 2; i += 2) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
            dstA0 = *(mlib_u8*)(src + i);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
            dstA1 = *(mlib_u8*)(src + i + 1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
            dstARGB = vis_freg_pair(src[i], src[i + 1]);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
            CONVERT_PRE(res0, dstA0, vis_read_hi(dstARGB));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
            CONVERT_PRE(res1, dstA1, vis_read_lo(dstARGB));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
            res0 = vis_fpack16_pair(res0, res1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
            *(mlib_d64*)(dst + i) = res0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
            vis_pst_8(dstARGB, dst + i, 0x88);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
        if (i < width) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
            dstA0 = *(mlib_u8*)(src + i);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
            dstARGB0 = src[i];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
            CONVERT_PRE(res0, dstA0, dstARGB0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
            dst[i] = vis_fpack16(res0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
            *(mlib_u8*)(dst + i) = dstA0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
        PTR_ADD(dstBase, dstScan);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
        PTR_ADD(srcBase, srcScan);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   257
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   258
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   259
90ce3da70b43 Initial load
duke
parents:
diff changeset
   260
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   261
90ce3da70b43 Initial load
duke
parents:
diff changeset
   262
void ADD_SUFF(IntArgbToIntArgbPreScaleConvert)(SCALE_PARAMS)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   263
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   264
    mlib_s32 dstScan = pDstInfo->scanStride;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   265
    mlib_s32 srcScan = pSrcInfo->scanStride;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   266
    mlib_s32 dstA0, dstA1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   267
    mlib_d64 res0, res1, dstARGB;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   268
    mlib_f32 dstARGB0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   269
    mlib_s32 i, i0, j, ind0, ind1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   270
90ce3da70b43 Initial load
duke
parents:
diff changeset
   271
    if (width < 16) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   272
        for (j = 0; j < height; j++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   273
            mlib_s32 *src = srcBase;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   274
            mlib_u8  *dst = dstBase;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   275
            mlib_s32 tmpsxloc = sxloc;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   276
90ce3da70b43 Initial load
duke
parents:
diff changeset
   277
            PTR_ADD(src, (syloc >> shift) * srcScan);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   278
90ce3da70b43 Initial load
duke
parents:
diff changeset
   279
            for (i = 0; i < width; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   280
                mlib_u32 argb = src[tmpsxloc >> shift];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   281
                mlib_u32 a, r, g, b;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   282
                b = argb & 0xff;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   283
                g = (argb >> 8) & 0xff;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   284
                r = (argb >> 16) & 0xff;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   285
                a = argb >> 24;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   286
                dst[4*i] = a;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   287
                dst[4*i + 1] = mul8table[a][r];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   288
                dst[4*i + 2] = mul8table[a][g];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   289
                dst[4*i + 3] = mul8table[a][b];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   290
                tmpsxloc += sxinc;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   291
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   292
90ce3da70b43 Initial load
duke
parents:
diff changeset
   293
            PTR_ADD(dstBase, dstScan);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   294
            syloc += syinc;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   295
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   296
        return;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   297
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   298
90ce3da70b43 Initial load
duke
parents:
diff changeset
   299
    vis_write_gsr(0 << 3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   300
90ce3da70b43 Initial load
duke
parents:
diff changeset
   301
    for (j = 0; j < height; j++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   302
        mlib_f32 *src = srcBase;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   303
        mlib_f32 *dst = dstBase;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   304
        mlib_s32 tmpsxloc = sxloc;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   305
90ce3da70b43 Initial load
duke
parents:
diff changeset
   306
        PTR_ADD(src, (syloc >> shift) * srcScan);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   307
90ce3da70b43 Initial load
duke
parents:
diff changeset
   308
        i = i0 = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   309
90ce3da70b43 Initial load
duke
parents:
diff changeset
   310
        if ((mlib_s32)dst & 7) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   311
            ind0 = tmpsxloc >> shift;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   312
            tmpsxloc += sxinc;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   313
            dstA0 = *(mlib_u8*)(src + ind0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   314
            dstARGB0 = src[ind0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   315
            CONVERT_PRE(res0, dstA0, dstARGB0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   316
            dst[i] = vis_fpack16(res0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   317
            *(mlib_u8*)(dst + i) = dstA0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   318
90ce3da70b43 Initial load
duke
parents:
diff changeset
   319
            i0 = 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   320
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   321
90ce3da70b43 Initial load
duke
parents:
diff changeset
   322
#pragma pipeloop(0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   323
        for (i = i0; i <= (mlib_s32)width - 2; i += 2) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   324
            ind0 = tmpsxloc >> shift;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   325
            tmpsxloc += sxinc;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   326
            ind1 = tmpsxloc >> shift;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   327
            tmpsxloc += sxinc;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   328
            dstA0 = *(mlib_u8*)(src + ind0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   329
            dstA1 = *(mlib_u8*)(src + ind1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   330
90ce3da70b43 Initial load
duke
parents:
diff changeset
   331
            dstARGB = vis_freg_pair(src[ind0], src[ind1]);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   332
90ce3da70b43 Initial load
duke
parents:
diff changeset
   333
            CONVERT_PRE(res0, dstA0, vis_read_hi(dstARGB));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   334
            CONVERT_PRE(res1, dstA1, vis_read_lo(dstARGB));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   335
90ce3da70b43 Initial load
duke
parents:
diff changeset
   336
            res0 = vis_fpack16_pair(res0, res1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   337
90ce3da70b43 Initial load
duke
parents:
diff changeset
   338
            *(mlib_d64*)(dst + i) = res0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   339
            vis_pst_8(dstARGB, dst + i, 0x88);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   340
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   341
90ce3da70b43 Initial load
duke
parents:
diff changeset
   342
        if (i < width) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   343
            ind0 = tmpsxloc >> shift;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   344
            tmpsxloc += sxinc;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   345
            dstA0 = *(mlib_u8*)(src + ind0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   346
            dstARGB0 = src[ind0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   347
            CONVERT_PRE(res0, dstA0, dstARGB0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   348
            dst[i] = vis_fpack16(res0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   349
            *(mlib_u8*)(dst + i) = dstA0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   350
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   351
90ce3da70b43 Initial load
duke
parents:
diff changeset
   352
        PTR_ADD(dstBase, dstScan);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   353
        syloc += syinc;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   354
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   355
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   356
90ce3da70b43 Initial load
duke
parents:
diff changeset
   357
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   358
90ce3da70b43 Initial load
duke
parents:
diff changeset
   359
void ADD_SUFF(IntArgbToIntArgbPreXorBlit)(BLIT_PARAMS)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   360
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   361
    mlib_s32 dstScan = pDstInfo->scanStride;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   362
    mlib_s32 srcScan = pSrcInfo->scanStride;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   363
    mlib_s32 xorpixel = pCompInfo->details.xorPixel;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   364
    mlib_s32 alphamask = pCompInfo->alphaMask;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   365
    mlib_s32 dstA0, dstA1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   366
    mlib_d64 res0, res1, dstARGB, dd, d_xorpixel, d_alphamask, maskRGB;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   367
    mlib_d64 d_round;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   368
    mlib_f32 dstARGB0, ff;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   369
    mlib_s32 i, i0, j;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   370
90ce3da70b43 Initial load
duke
parents:
diff changeset
   371
    vis_write_gsr(0 << 3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   372
90ce3da70b43 Initial load
duke
parents:
diff changeset
   373
    if (dstScan == 4*width && srcScan == 4*width) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   374
        width *= height;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   375
        height = 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   376
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   377
90ce3da70b43 Initial load
duke
parents:
diff changeset
   378
    d_xorpixel = vis_to_double_dup(xorpixel);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   379
    d_alphamask = vis_to_double_dup(alphamask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   380
    maskRGB = vis_to_double_dup(0xFFFFFF);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   381
    d_round = vis_to_double_dup(((1 << 16) | 1) << 6);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   382
90ce3da70b43 Initial load
duke
parents:
diff changeset
   383
    xorpixel >>= 24;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   384
    alphamask >>= 24;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   385
90ce3da70b43 Initial load
duke
parents:
diff changeset
   386
    for (j = 0; j < height; j++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   387
        mlib_f32 *src = srcBase;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   388
        mlib_f32 *dst = dstBase;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   389
90ce3da70b43 Initial load
duke
parents:
diff changeset
   390
        i = i0 = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   391
90ce3da70b43 Initial load
duke
parents:
diff changeset
   392
        if ((mlib_s32)dst & 7) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   393
            dstA0 = *(mlib_u8*)(src + i);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   394
            dstARGB0 = src[i];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   395
            if (dstA0 & 0x80) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   396
                CONVERT_PRE(res0, dstA0, dstARGB0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   397
                res0 = vis_fpadd16(res0, d_round);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   398
                ff = vis_fpack16(res0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   399
                ff = vis_fxors(ff, vis_read_hi(d_xorpixel));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   400
                ff = vis_fandnots(vis_read_hi(d_alphamask), ff);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   401
                ff = vis_fxors(ff, dst[i]);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   402
                dstA0 = *(mlib_u8*)(dst + i) ^
90ce3da70b43 Initial load
duke
parents:
diff changeset
   403
                        ((dstA0 ^ xorpixel) &~ alphamask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   404
                dst[i] = ff;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   405
                *(mlib_u8*)(dst + i) = dstA0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   406
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   407
90ce3da70b43 Initial load
duke
parents:
diff changeset
   408
            i0 = 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   409
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   410
90ce3da70b43 Initial load
duke
parents:
diff changeset
   411
#pragma pipeloop(0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   412
        for (i = i0; i <= (mlib_s32)width - 2; i += 2) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   413
            dstA0 = *(mlib_u8*)(src + i);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   414
            dstA1 = *(mlib_u8*)(src + i + 1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   415
            dstARGB = vis_freg_pair(src[i], src[i + 1]);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   416
90ce3da70b43 Initial load
duke
parents:
diff changeset
   417
            CONVERT_PRE(res0, dstA0, vis_read_hi(dstARGB));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   418
            CONVERT_PRE(res1, dstA1, vis_read_lo(dstARGB));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   419
            res0 = vis_fpadd16(res0, d_round);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   420
            res1 = vis_fpadd16(res1, d_round);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   421
            dd = vis_fpack16_pair(res0, res1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   422
90ce3da70b43 Initial load
duke
parents:
diff changeset
   423
            dd = vis_for(vis_fand(maskRGB, dd), vis_fandnot(maskRGB, dstARGB));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   424
90ce3da70b43 Initial load
duke
parents:
diff changeset
   425
            dd = vis_fxor(dd, d_xorpixel);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   426
            dd = vis_fandnot(d_alphamask, dd);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   427
            dd = vis_fxor(dd, *(mlib_d64*)(dst + i));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   428
90ce3da70b43 Initial load
duke
parents:
diff changeset
   429
            vis_pst_32(dd, dst + i, ((dstA0 >> 6) & 2) | (dstA1 >> 7));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   430
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   431
90ce3da70b43 Initial load
duke
parents:
diff changeset
   432
        if (i < width) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   433
            dstA0 = *(mlib_u8*)(src + i);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   434
            dstARGB0 = src[i];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   435
            if (dstA0 & 0x80) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   436
                CONVERT_PRE(res0, dstA0, dstARGB0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   437
                res0 = vis_fpadd16(res0, d_round);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   438
                ff = vis_fpack16(res0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   439
                ff = vis_fxors(ff, vis_read_hi(d_xorpixel));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   440
                ff = vis_fandnots(vis_read_hi(d_alphamask), ff);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   441
                ff = vis_fxors(ff, dst[i]);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   442
                dstA0 = *(mlib_u8*)(dst + i) ^
90ce3da70b43 Initial load
duke
parents:
diff changeset
   443
                        ((dstA0 ^ xorpixel) &~ alphamask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   444
                dst[i] = ff;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   445
                *(mlib_u8*)(dst + i) = dstA0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   446
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   447
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   448
90ce3da70b43 Initial load
duke
parents:
diff changeset
   449
        PTR_ADD(dstBase, dstScan);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   450
        PTR_ADD(srcBase, srcScan);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   451
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   452
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   453
90ce3da70b43 Initial load
duke
parents:
diff changeset
   454
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   455
90ce3da70b43 Initial load
duke
parents:
diff changeset
   456
void ADD_SUFF(IntRgbToIntArgbPreConvert)(BLIT_PARAMS)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   457
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   458
    mlib_s32 dstScan = pDstInfo->scanStride;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   459
    mlib_s32 srcScan = pSrcInfo->scanStride;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   460
    mlib_d64 dd, mask;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   461
    mlib_s32 i, i0, j;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   462
90ce3da70b43 Initial load
duke
parents:
diff changeset
   463
    if (dstScan == 4*width && srcScan == 4*width) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   464
        width *= height;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   465
        height = 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   466
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   467
90ce3da70b43 Initial load
duke
parents:
diff changeset
   468
    mask = vis_to_double_dup(0xFF000000);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   469
90ce3da70b43 Initial load
duke
parents:
diff changeset
   470
    for (j = 0; j < height; j++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   471
        mlib_f32 *src = srcBase;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   472
        mlib_f32 *dst = dstBase;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   473
90ce3da70b43 Initial load
duke
parents:
diff changeset
   474
        i = i0 = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   475
90ce3da70b43 Initial load
duke
parents:
diff changeset
   476
        if ((mlib_s32)dst & 7) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   477
            dst[i] = vis_fors(src[i], vis_read_hi(mask));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   478
            i0 = 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   479
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   480
90ce3da70b43 Initial load
duke
parents:
diff changeset
   481
#pragma pipeloop(0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   482
        for (i = i0; i <= (mlib_s32)width - 2; i += 2) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   483
            dd = vis_freg_pair(src[i], src[i + 1]);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   484
90ce3da70b43 Initial load
duke
parents:
diff changeset
   485
            *(mlib_d64*)(dst + i) = vis_for(dd, mask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   486
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   487
90ce3da70b43 Initial load
duke
parents:
diff changeset
   488
        if (i < width) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   489
            dst[i] = vis_fors(src[i], vis_read_hi(mask));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   490
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   491
90ce3da70b43 Initial load
duke
parents:
diff changeset
   492
        PTR_ADD(dstBase, dstScan);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   493
        PTR_ADD(srcBase, srcScan);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   494
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   495
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   496
90ce3da70b43 Initial load
duke
parents:
diff changeset
   497
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   498
90ce3da70b43 Initial load
duke
parents:
diff changeset
   499
void ADD_SUFF(IntRgbToIntArgbPreScaleConvert)(SCALE_PARAMS)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   500
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   501
    mlib_s32 dstScan = pDstInfo->scanStride;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   502
    mlib_s32 srcScan = pSrcInfo->scanStride;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   503
    mlib_d64 dd, mask;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   504
    mlib_s32 j;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   505
90ce3da70b43 Initial load
duke
parents:
diff changeset
   506
    mask = vis_to_double_dup(0xFF000000);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   507
90ce3da70b43 Initial load
duke
parents:
diff changeset
   508
    for (j = 0; j < height; j++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   509
        mlib_f32 *src = srcBase;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   510
        mlib_f32 *dst = dstBase;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   511
        mlib_f32 *dst_end = dst + width;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   512
        mlib_s32 tmpsxloc = sxloc;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   513
90ce3da70b43 Initial load
duke
parents:
diff changeset
   514
        PTR_ADD(src, (syloc >> shift) * srcScan);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   515
90ce3da70b43 Initial load
duke
parents:
diff changeset
   516
        if ((mlib_s32)dst & 7) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   517
            *dst++ = vis_fors(src[tmpsxloc >> shift], vis_read_hi(mask));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   518
            tmpsxloc += sxinc;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   519
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   520
90ce3da70b43 Initial load
duke
parents:
diff changeset
   521
#pragma pipeloop(0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   522
        for (; dst <= dst_end - 2; dst += 2) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   523
            dd = vis_freg_pair(src[tmpsxloc >> shift],
90ce3da70b43 Initial load
duke
parents:
diff changeset
   524
                               src[(tmpsxloc + sxinc) >> shift]);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   525
            *(mlib_d64*)dst = vis_for(dd, mask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   526
            tmpsxloc += 2*sxinc;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   527
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   528
90ce3da70b43 Initial load
duke
parents:
diff changeset
   529
        if (dst < dst_end) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   530
            *dst = vis_fors(src[tmpsxloc >> shift], vis_read_hi(mask));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   531
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   532
90ce3da70b43 Initial load
duke
parents:
diff changeset
   533
        PTR_ADD(dstBase, dstScan);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   534
        syloc += syinc;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   535
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   536
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   537
90ce3da70b43 Initial load
duke
parents:
diff changeset
   538
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   539
90ce3da70b43 Initial load
duke
parents:
diff changeset
   540
#define BGR_TO_ARGB {                                          \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   541
    mlib_d64 sda, sdb, sdc, sdd, sde, sdf;                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   542
    mlib_d64 s_1, s_2, s_3, a13, b13, a02, b02;                \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   543
                                                               \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   544
    sda = vis_fpmerge(vis_read_hi(sd0), vis_read_lo(sd1));     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   545
    sdb = vis_fpmerge(vis_read_lo(sd0), vis_read_hi(sd2));     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   546
    sdc = vis_fpmerge(vis_read_hi(sd1), vis_read_lo(sd2));     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   547
                                                               \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   548
    sdd = vis_fpmerge(vis_read_hi(sda), vis_read_lo(sdb));     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   549
    sde = vis_fpmerge(vis_read_lo(sda), vis_read_hi(sdc));     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   550
    sdf = vis_fpmerge(vis_read_hi(sdb), vis_read_lo(sdc));     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   551
                                                               \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   552
    s_3 = vis_fpmerge(vis_read_hi(sdd), vis_read_lo(sde));     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   553
    s_2 = vis_fpmerge(vis_read_lo(sdd), vis_read_hi(sdf));     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   554
    s_1 = vis_fpmerge(vis_read_hi(sde), vis_read_lo(sdf));     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   555
                                                               \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   556
    a13 = vis_fpmerge(vis_read_hi(s_1), vis_read_hi(s_3));     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   557
    b13 = vis_fpmerge(vis_read_lo(s_1), vis_read_lo(s_3));     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   558
    a02 = vis_fpmerge(vis_read_hi(s_0), vis_read_hi(s_2));     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   559
    b02 = vis_fpmerge(vis_read_lo(s_0), vis_read_lo(s_2));     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   560
                                                               \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   561
    dd0 = vis_fpmerge(vis_read_hi(a02), vis_read_hi(a13));     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   562
    dd1 = vis_fpmerge(vis_read_lo(a02), vis_read_lo(a13));     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   563
    dd2 = vis_fpmerge(vis_read_hi(b02), vis_read_hi(b13));     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   564
    dd3 = vis_fpmerge(vis_read_lo(b02), vis_read_lo(b13));     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   565
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   566
90ce3da70b43 Initial load
duke
parents:
diff changeset
   567
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   568
90ce3da70b43 Initial load
duke
parents:
diff changeset
   569
void ADD_SUFF(ThreeByteBgrToIntArgbPreConvert)(BLIT_PARAMS)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   570
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   571
    mlib_s32 dstScan = pDstInfo->scanStride;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   572
    mlib_s32 srcScan = pSrcInfo->scanStride;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   573
    mlib_d64 *sp;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   574
    mlib_d64 s_0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   575
    mlib_d64 s0, s1, s2, s3, sd0, sd1, sd2, dd0, dd1, dd2, dd3;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   576
    mlib_s32 i, i0, j;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   577
90ce3da70b43 Initial load
duke
parents:
diff changeset
   578
    if (srcScan == 3*width && dstScan == 4*width) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   579
        width *= height;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   580
        height = 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   581
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   582
90ce3da70b43 Initial load
duke
parents:
diff changeset
   583
    s_0 = vis_fone();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   584
90ce3da70b43 Initial load
duke
parents:
diff changeset
   585
    for (j = 0; j < height; j++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   586
        mlib_u8  *src = srcBase;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   587
        mlib_f32 *dst = dstBase;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   588
90ce3da70b43 Initial load
duke
parents:
diff changeset
   589
        i = i0 = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   590
90ce3da70b43 Initial load
duke
parents:
diff changeset
   591
        if ((mlib_s32)dst & 7) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   592
            ((mlib_s32*)dst)[i] = GET_ARGBPRE(i);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   593
            i0 = 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   594
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   595
90ce3da70b43 Initial load
duke
parents:
diff changeset
   596
        sp = vis_alignaddr(src, 3*i0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   597
        s3 = *sp++;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   598
90ce3da70b43 Initial load
duke
parents:
diff changeset
   599
#pragma pipeloop(0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   600
        for (i = i0; i <= (mlib_s32)width - 8; i += 8) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   601
            s0 = s3;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   602
            s1 = *sp++;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   603
            s2 = *sp++;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   604
            s3 = *sp++;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   605
            sd0 = vis_faligndata(s0, s1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   606
            sd1 = vis_faligndata(s1, s2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   607
            sd2 = vis_faligndata(s2, s3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   608
90ce3da70b43 Initial load
duke
parents:
diff changeset
   609
            BGR_TO_ARGB
90ce3da70b43 Initial load
duke
parents:
diff changeset
   610
90ce3da70b43 Initial load
duke
parents:
diff changeset
   611
            *(mlib_d64*)(dst + i    ) = dd0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   612
            *(mlib_d64*)(dst + i + 2) = dd1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   613
            *(mlib_d64*)(dst + i + 4) = dd2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   614
            *(mlib_d64*)(dst + i + 6) = dd3;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   615
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   616
90ce3da70b43 Initial load
duke
parents:
diff changeset
   617
        for (; i < width; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   618
            ((mlib_s32*)dst)[i] = GET_ARGBPRE(i);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   619
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   620
90ce3da70b43 Initial load
duke
parents:
diff changeset
   621
        PTR_ADD(dstBase, dstScan);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   622
        PTR_ADD(srcBase, srcScan);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   623
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   624
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   625
90ce3da70b43 Initial load
duke
parents:
diff changeset
   626
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   627
90ce3da70b43 Initial load
duke
parents:
diff changeset
   628
void ADD_SUFF(ThreeByteBgrToIntArgbPreScaleConvert)(SCALE_PARAMS)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   629
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   630
    mlib_s32 dstScan = pDstInfo->scanStride;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   631
    mlib_s32 srcScan = pSrcInfo->scanStride;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   632
    mlib_d64 dd, maskFF;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   633
    mlib_s32 i, i0, i1, j;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   634
90ce3da70b43 Initial load
duke
parents:
diff changeset
   635
    maskFF = vis_fone();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   636
90ce3da70b43 Initial load
duke
parents:
diff changeset
   637
    vis_alignaddr(NULL, 7);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   638
90ce3da70b43 Initial load
duke
parents:
diff changeset
   639
    for (j = 0; j < height; j++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   640
        mlib_u8  *src = srcBase;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   641
        mlib_f32 *dst = dstBase;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   642
        mlib_f32 *dst_end = dst + width;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   643
        mlib_s32 tmpsxloc = sxloc;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   644
90ce3da70b43 Initial load
duke
parents:
diff changeset
   645
        PTR_ADD(src, (syloc >> shift) * srcScan);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   646
90ce3da70b43 Initial load
duke
parents:
diff changeset
   647
        if ((mlib_s32)dst & 7) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   648
            i = tmpsxloc >> shift;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   649
            tmpsxloc += sxinc;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   650
            *(mlib_s32*)dst = GET_ARGBPRE(i);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   651
            dst++;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   652
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   653
90ce3da70b43 Initial load
duke
parents:
diff changeset
   654
#pragma pipeloop(0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   655
        for (; dst <= dst_end - 2; dst += 2) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   656
            i0 = tmpsxloc >> shift;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   657
            i1 = (tmpsxloc + sxinc) >> shift;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   658
            tmpsxloc += 2*sxinc;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   659
90ce3da70b43 Initial load
duke
parents:
diff changeset
   660
            dd = vis_faligndata(vis_ld_u8(src + 3*i1    ), dd);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   661
            dd = vis_faligndata(vis_ld_u8(src + 3*i1 + 1), dd);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   662
            dd = vis_faligndata(vis_ld_u8(src + 3*i1 + 2), dd);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   663
            dd = vis_faligndata(maskFF, dd);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   664
            dd = vis_faligndata(vis_ld_u8(src + 3*i0    ), dd);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   665
            dd = vis_faligndata(vis_ld_u8(src + 3*i0 + 1), dd);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   666
            dd = vis_faligndata(vis_ld_u8(src + 3*i0 + 2), dd);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   667
            dd = vis_faligndata(maskFF, dd);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   668
90ce3da70b43 Initial load
duke
parents:
diff changeset
   669
            *(mlib_d64*)dst = dd;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   670
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   671
90ce3da70b43 Initial load
duke
parents:
diff changeset
   672
        for (; dst < dst_end; dst++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   673
            i = tmpsxloc >> shift;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   674
            tmpsxloc += sxinc;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   675
            *(mlib_s32*)dst = GET_ARGBPRE(i);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   676
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   677
90ce3da70b43 Initial load
duke
parents:
diff changeset
   678
        PTR_ADD(dstBase, dstScan);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   679
        syloc += syinc;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   680
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   681
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   682
90ce3da70b43 Initial load
duke
parents:
diff changeset
   683
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   684
90ce3da70b43 Initial load
duke
parents:
diff changeset
   685
void ADD_SUFF(ByteIndexedToIntArgbPreConvert)(BLIT_PARAMS)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   686
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   687
    jint *pixLut = pSrcInfo->lutBase;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   688
    mlib_s32 buff[256];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   689
    mlib_s32 dstScan = pDstInfo->scanStride;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   690
    mlib_s32 srcScan = pSrcInfo->scanStride;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   691
    mlib_s32 i, i0, j;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   692
90ce3da70b43 Initial load
duke
parents:
diff changeset
   693
    if (width < 16) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   694
        for (j = 0; j < height; j++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   695
            mlib_u8  *src = srcBase;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   696
            mlib_s32 *dst = dstBase;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   697
90ce3da70b43 Initial load
duke
parents:
diff changeset
   698
            for (i = 0; i < width; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   699
                mlib_s32 a, r, g, b;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   700
                mlib_u32 x = pixLut[src[i]];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   701
                b = x & 0xff;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   702
                g = (x >> 8) & 0xff;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   703
                r = (x >> 16) & 0xff;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   704
                a = x >> 24;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   705
                r = mul8table[a][r];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   706
                g = mul8table[a][g];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   707
                b = mul8table[a][b];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   708
                dst[i] = (a << 24) | (r << 16) | (g << 8) | b;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   709
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   710
90ce3da70b43 Initial load
duke
parents:
diff changeset
   711
            PTR_ADD(dstBase, dstScan);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   712
            PTR_ADD(srcBase, srcScan);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   713
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   714
        return;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   715
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   716
90ce3da70b43 Initial load
duke
parents:
diff changeset
   717
    if (srcScan == width && dstScan == 4*width) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   718
        width *= height;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   719
        height = 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   720
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   721
90ce3da70b43 Initial load
duke
parents:
diff changeset
   722
    ADD_SUFF(IntArgbToIntArgbPreConvert)(pixLut, buff, 256, 1,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   723
                                         pSrcInfo, pDstInfo, pPrim, pCompInfo);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   724
90ce3da70b43 Initial load
duke
parents:
diff changeset
   725
    for (j = 0; j < height; j++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   726
        mlib_u8  *src = srcBase;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   727
        mlib_s32 *dst = dstBase;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   728
90ce3da70b43 Initial load
duke
parents:
diff changeset
   729
        i = i0 = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   730
90ce3da70b43 Initial load
duke
parents:
diff changeset
   731
        if ((mlib_s32)dst & 7) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   732
            dst[i] = buff[src[i]];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   733
            i0 = 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   734
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   735
90ce3da70b43 Initial load
duke
parents:
diff changeset
   736
#pragma pipeloop(0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   737
        for (i = i0; i <= (mlib_s32)width - 2; i += 2) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   738
            *(mlib_d64*)(dst + i) = LOAD_2F32(buff, src[i], src[i + 1]);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   739
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   740
90ce3da70b43 Initial load
duke
parents:
diff changeset
   741
        for (; i < width; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   742
            dst[i] = buff[src[i]];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   743
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   744
90ce3da70b43 Initial load
duke
parents:
diff changeset
   745
        PTR_ADD(dstBase, dstScan);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   746
        PTR_ADD(srcBase, srcScan);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   747
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   748
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   749
90ce3da70b43 Initial load
duke
parents:
diff changeset
   750
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   751
90ce3da70b43 Initial load
duke
parents:
diff changeset
   752
void ADD_SUFF(ByteIndexedToIntArgbPreScaleConvert)(SCALE_PARAMS)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   753
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   754
    jint *pixLut = pSrcInfo->lutBase;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   755
    mlib_s32 buff[256];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   756
    mlib_s32 dstScan = pDstInfo->scanStride;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   757
    mlib_s32 srcScan = pSrcInfo->scanStride;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   758
    mlib_s32 i, j;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   759
90ce3da70b43 Initial load
duke
parents:
diff changeset
   760
    if (width < 16) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   761
        for (j = 0; j < height; j++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   762
            mlib_u8  *src = srcBase;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   763
            mlib_s32 *dst = dstBase;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   764
            mlib_s32 tmpsxloc = sxloc;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   765
90ce3da70b43 Initial load
duke
parents:
diff changeset
   766
            PTR_ADD(src, (syloc >> shift) * srcScan);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   767
90ce3da70b43 Initial load
duke
parents:
diff changeset
   768
            for (i = 0; i < width; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   769
                mlib_s32 a, r, g, b;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   770
                mlib_u32 x = pixLut[src[tmpsxloc >> shift]];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   771
                tmpsxloc += sxinc;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   772
                b = x & 0xff;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   773
                g = (x >> 8) & 0xff;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   774
                r = (x >> 16) & 0xff;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   775
                a = x >> 24;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   776
                r = mul8table[a][r];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   777
                g = mul8table[a][g];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   778
                b = mul8table[a][b];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   779
                dst[i] = (a << 24) | (r << 16) | (g << 8) | b;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   780
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   781
90ce3da70b43 Initial load
duke
parents:
diff changeset
   782
            PTR_ADD(dstBase, dstScan);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   783
            syloc += syinc;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   784
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   785
        return;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   786
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   787
90ce3da70b43 Initial load
duke
parents:
diff changeset
   788
    ADD_SUFF(IntArgbToIntArgbPreConvert)(pixLut, buff, 256, 1,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   789
                                         pSrcInfo, pDstInfo, pPrim, pCompInfo);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   790
90ce3da70b43 Initial load
duke
parents:
diff changeset
   791
    for (j = 0; j < height; j++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   792
        mlib_u8  *src = srcBase;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   793
        mlib_s32 *dst = dstBase;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   794
        mlib_s32 *dst_end = dst + width;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   795
        mlib_s32 tmpsxloc = sxloc;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   796
90ce3da70b43 Initial load
duke
parents:
diff changeset
   797
        PTR_ADD(src, (syloc >> shift) * srcScan);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   798
90ce3da70b43 Initial load
duke
parents:
diff changeset
   799
        if ((mlib_s32)dst & 7) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   800
            *dst++ = buff[src[tmpsxloc >> shift]];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   801
            tmpsxloc += sxinc;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   802
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   803
90ce3da70b43 Initial load
duke
parents:
diff changeset
   804
#pragma pipeloop(0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   805
        for (; dst <= dst_end - 2; dst += 2) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   806
            *(mlib_d64*)dst = LOAD_2F32(buff, src[tmpsxloc >> shift],
90ce3da70b43 Initial load
duke
parents:
diff changeset
   807
                                              src[(tmpsxloc + sxinc) >> shift]);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   808
            tmpsxloc += 2*sxinc;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   809
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   810
90ce3da70b43 Initial load
duke
parents:
diff changeset
   811
        for (; dst < dst_end; dst++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   812
            *dst = buff[src[tmpsxloc >> shift]];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   813
            tmpsxloc += sxinc;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   814
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   815
90ce3da70b43 Initial load
duke
parents:
diff changeset
   816
        PTR_ADD(dstBase, dstScan);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   817
        syloc += syinc;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   818
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   819
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   820
90ce3da70b43 Initial load
duke
parents:
diff changeset
   821
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   822
90ce3da70b43 Initial load
duke
parents:
diff changeset
   823
void ADD_SUFF(ByteIndexedBmToIntArgbPreXparOver)(BLIT_PARAMS)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   824
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   825
    jint *pixLut = pSrcInfo->lutBase;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   826
    mlib_s32 buff[256];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   827
    mlib_s32 dstScan = pDstInfo->scanStride;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   828
    mlib_s32 srcScan = pSrcInfo->scanStride;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   829
    mlib_d64 dd, dzero;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   830
    mlib_s32 i, i0, j, x, mask;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   831
90ce3da70b43 Initial load
duke
parents:
diff changeset
   832
    if (width < 16) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   833
        for (j = 0; j < height; j++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   834
            mlib_u8  *src = srcBase;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   835
            mlib_s32 *dst = dstBase;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   836
90ce3da70b43 Initial load
duke
parents:
diff changeset
   837
            for (i = 0; i < width; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   838
                mlib_s32 a, r, g, b;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   839
                mlib_s32 x = pixLut[src[i]];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   840
                if (x < 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   841
                    b = x & 0xff;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   842
                    g = (x >> 8) & 0xff;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   843
                    r = (x >> 16) & 0xff;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   844
                    a = (mlib_u32)x >> 24;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   845
                    r = mul8table[a][r];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   846
                    g = mul8table[a][g];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   847
                    b = mul8table[a][b];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   848
                    dst[i] = (a << 24) | (r << 16) | (g << 8) | b;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   849
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   850
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   851
90ce3da70b43 Initial load
duke
parents:
diff changeset
   852
            PTR_ADD(dstBase, dstScan);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   853
            PTR_ADD(srcBase, srcScan);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   854
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   855
        return;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   856
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   857
90ce3da70b43 Initial load
duke
parents:
diff changeset
   858
    if (srcScan == width && dstScan == 4*width) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   859
        width *= height;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   860
        height = 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   861
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   862
90ce3da70b43 Initial load
duke
parents:
diff changeset
   863
    ADD_SUFF(IntArgbToIntArgbPreConvert)(pixLut, buff, 256, 1,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   864
                                         pSrcInfo, pDstInfo, pPrim, pCompInfo);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   865
90ce3da70b43 Initial load
duke
parents:
diff changeset
   866
    dzero = vis_fzero();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   867
90ce3da70b43 Initial load
duke
parents:
diff changeset
   868
    for (j = 0; j < height; j++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   869
        mlib_u8  *src = srcBase;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   870
        mlib_s32 *dst = dstBase;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   871
90ce3da70b43 Initial load
duke
parents:
diff changeset
   872
        i = i0 = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   873
90ce3da70b43 Initial load
duke
parents:
diff changeset
   874
        if ((mlib_s32)dst & 7) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   875
            x = buff[src[i]];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   876
            if (x < 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   877
                dst[i] = x;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   878
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   879
            i0 = 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   880
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   881
90ce3da70b43 Initial load
duke
parents:
diff changeset
   882
#pragma pipeloop(0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   883
        for (i = i0; i <= (mlib_s32)width - 2; i += 2) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   884
            dd = vis_freg_pair(((mlib_f32*)buff)[src[i]],
90ce3da70b43 Initial load
duke
parents:
diff changeset
   885
                               ((mlib_f32*)buff)[src[i + 1]]);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   886
            mask = vis_fcmplt32(dd, dzero);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   887
            vis_pst_32(dd, dst + i, mask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   888
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   889
90ce3da70b43 Initial load
duke
parents:
diff changeset
   890
        for (; i < width; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   891
            x = buff[src[i]];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   892
            if (x < 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   893
                dst[i] = x;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   894
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   895
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   896
90ce3da70b43 Initial load
duke
parents:
diff changeset
   897
        PTR_ADD(dstBase, dstScan);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   898
        PTR_ADD(srcBase, srcScan);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   899
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   900
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   901
90ce3da70b43 Initial load
duke
parents:
diff changeset
   902
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   903
90ce3da70b43 Initial load
duke
parents:
diff changeset
   904
void ADD_SUFF(ByteIndexedBmToIntArgbPreScaleXparOver)(SCALE_PARAMS)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   905
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   906
    jint *pixLut = pSrcInfo->lutBase;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   907
    mlib_s32 buff[256];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   908
    mlib_s32 dstScan = pDstInfo->scanStride;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   909
    mlib_s32 srcScan = pSrcInfo->scanStride;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   910
    mlib_d64 dd, dzero;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   911
    mlib_s32 i, j, x, mask;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   912
90ce3da70b43 Initial load
duke
parents:
diff changeset
   913
    if (width < 16) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   914
        for (j = 0; j < height; j++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   915
            mlib_u8  *src = srcBase;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   916
            mlib_s32 *dst = dstBase;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   917
            mlib_s32 tmpsxloc = sxloc;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   918
90ce3da70b43 Initial load
duke
parents:
diff changeset
   919
            PTR_ADD(src, (syloc >> shift) * srcScan);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   920
90ce3da70b43 Initial load
duke
parents:
diff changeset
   921
            for (i = 0; i < width; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   922
                mlib_s32 a, r, g, b;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   923
                mlib_s32 x = pixLut[src[tmpsxloc >> shift]];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   924
                tmpsxloc += sxinc;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   925
                if (x < 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   926
                    b = x & 0xff;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   927
                    g = (x >> 8) & 0xff;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   928
                    r = (x >> 16) & 0xff;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   929
                    a = (mlib_u32)x >> 24;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   930
                    r = mul8table[a][r];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   931
                    g = mul8table[a][g];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   932
                    b = mul8table[a][b];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   933
                    dst[i] = (a << 24) | (r << 16) | (g << 8) | b;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   934
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   935
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   936
90ce3da70b43 Initial load
duke
parents:
diff changeset
   937
            PTR_ADD(dstBase, dstScan);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   938
            syloc += syinc;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   939
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   940
        return;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   941
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   942
90ce3da70b43 Initial load
duke
parents:
diff changeset
   943
    ADD_SUFF(IntArgbToIntArgbPreConvert)(pixLut, buff, 256, 1,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   944
                                         pSrcInfo, pDstInfo, pPrim, pCompInfo);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   945
90ce3da70b43 Initial load
duke
parents:
diff changeset
   946
    dzero = vis_fzero();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   947
90ce3da70b43 Initial load
duke
parents:
diff changeset
   948
    for (j = 0; j < height; j++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   949
        mlib_u8  *src = srcBase;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   950
        mlib_s32 *dst = dstBase;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   951
        mlib_s32 *dst_end = dst + width;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   952
        mlib_s32 tmpsxloc = sxloc;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   953
90ce3da70b43 Initial load
duke
parents:
diff changeset
   954
        PTR_ADD(src, (syloc >> shift) * srcScan);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   955
90ce3da70b43 Initial load
duke
parents:
diff changeset
   956
        if ((mlib_s32)dst & 7) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   957
            x = buff[src[tmpsxloc >> shift]];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   958
            tmpsxloc += sxinc;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   959
            if (x < 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   960
                *dst = x;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   961
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   962
            dst++;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   963
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   964
90ce3da70b43 Initial load
duke
parents:
diff changeset
   965
#pragma pipeloop(0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   966
        for (; dst <= dst_end - 2; dst += 2) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   967
            dd = LOAD_2F32(buff, src[tmpsxloc >> shift],
90ce3da70b43 Initial load
duke
parents:
diff changeset
   968
                                 src[(tmpsxloc + sxinc) >> shift]);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   969
            tmpsxloc += 2*sxinc;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   970
            mask = vis_fcmplt32(dd, dzero);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   971
            vis_pst_32(dd, dst, mask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   972
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   973
90ce3da70b43 Initial load
duke
parents:
diff changeset
   974
        for (; dst < dst_end; dst++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   975
            x = buff[src[tmpsxloc >> shift]];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   976
            tmpsxloc += sxinc;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   977
            if (x < 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   978
                *dst = x;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   979
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   980
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   981
90ce3da70b43 Initial load
duke
parents:
diff changeset
   982
        PTR_ADD(dstBase, dstScan);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   983
        syloc += syinc;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   984
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   985
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   986
90ce3da70b43 Initial load
duke
parents:
diff changeset
   987
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   988
90ce3da70b43 Initial load
duke
parents:
diff changeset
   989
void ADD_SUFF(ByteIndexedBmToIntArgbPreXparBgCopy)(BCOPY_PARAMS)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   990
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   991
    jint *pixLut = pSrcInfo->lutBase;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   992
    mlib_s32 buff[256];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   993
    mlib_s32 dstScan = pDstInfo->scanStride;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   994
    mlib_s32 srcScan = pSrcInfo->scanStride;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   995
    mlib_d64 dd, dzero, d_bgpixel;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   996
    mlib_s32 i, j, x, mask;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   997
90ce3da70b43 Initial load
duke
parents:
diff changeset
   998
    if (width < 16) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   999
        for (j = 0; j < height; j++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1000
            mlib_u8  *src = srcBase;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1001
            mlib_s32 *dst = dstBase;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1002
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1003
            for (i = 0; i < width; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1004
                x = pixLut[src[i]];
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1005
                if (x < 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1006
                    mlib_s32 a, r, g, b;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1007
                    b = x & 0xff;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1008
                    g = (x >> 8) & 0xff;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1009
                    r = (x >> 16) & 0xff;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1010
                    a = (mlib_u32)x >> 24;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1011
                    r = mul8table[a][r];
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1012
                    g = mul8table[a][g];
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1013
                    b = mul8table[a][b];
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1014
                    dst[i] = (a << 24) | (r << 16) | (g << 8) | b;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1015
                } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1016
                    dst[i] = bgpixel;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1017
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1018
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1019
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1020
            PTR_ADD(dstBase, dstScan);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1021
            PTR_ADD(srcBase, srcScan);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1022
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1023
        return;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1024
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1025
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1026
    ADD_SUFF(IntArgbToIntArgbPreConvert)(pixLut, buff, 256, 1,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1027
                                         pSrcInfo, pDstInfo, pPrim, pCompInfo);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1028
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1029
    if (srcScan == width && dstScan == 4*width) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1030
        width *= height;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1031
        height = 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1032
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1033
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1034
    dzero = vis_fzero();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1035
    d_bgpixel = vis_to_double_dup(bgpixel);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1036
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1037
    for (j = 0; j < height; j++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1038
        mlib_u8  *src = srcBase;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1039
        mlib_s32 *dst = dstBase;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1040
        mlib_s32 *dst_end;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1041
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1042
        dst_end = dst + width;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1043
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1044
        if ((mlib_s32)dst & 7) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1045
            x = buff[*src++];
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1046
            if (x < 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1047
                *dst = x;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1048
            } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1049
                *dst = bgpixel;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1050
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1051
            dst++;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1052
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1053
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1054
#pragma pipeloop(0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1055
        for (; dst <= (dst_end - 2); dst += 2) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1056
            dd = vis_freg_pair(((mlib_f32*)buff)[src[0]],
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1057
                               ((mlib_f32*)buff)[src[1]]);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1058
            mask = vis_fcmplt32(dd, dzero);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1059
            *(mlib_d64*)dst = d_bgpixel;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1060
            vis_pst_32(dd, dst, mask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1061
            src += 2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1062
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1063
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1064
        while (dst < dst_end) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1065
            x = buff[*src++];
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1066
            if (x < 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1067
                *dst = x;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1068
            } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1069
                *dst = bgpixel;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1070
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1071
            dst++;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1072
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1073
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1074
        PTR_ADD(dstBase, dstScan);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1075
        PTR_ADD(srcBase, srcScan);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1076
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1077
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1078
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1079
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1080
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1081
void ADD_SUFF(IntArgbPreDrawGlyphListAA)(SurfaceDataRasInfo * pRasInfo,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1082
                                         ImageRef *glyphs,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1083
                                         jint totalGlyphs,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1084
                                         jint fgpixel, jint argbcolor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1085
                                         jint clipLeft, jint clipTop,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1086
                                         jint clipRight, jint clipBottom,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1087
                                         NativePrimitive * pPrim,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1088
                                         CompositeInfo * pCompInfo)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1089
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1090
    mlib_s32 glyphCounter;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1091
    mlib_s32 scan = pRasInfo->scanStride;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1092
    mlib_u8  *dstBase, *dstBase0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1093
    mlib_s32 i, j;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1094
    mlib_d64 dmix0, dmix1, dd, d0, d1, e0, e1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1095
    mlib_d64 done, d_half;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1096
    mlib_s32 pix;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1097
    mlib_f32 srcG_f;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1098
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1099
    done = vis_to_double_dup(0x7fff7fff);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1100
    d_half = vis_to_double_dup((1 << (16 + 6)) | (1 << 6));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1101
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1102
    srcG_f = vis_to_float(argbcolor);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1103
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1104
    for (glyphCounter = 0; glyphCounter < totalGlyphs; glyphCounter++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1105
        const jubyte *pixels, *pixels0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1106
        unsigned int rowBytes;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1107
        int left, top;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1108
        int width, height;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1109
        int right, bottom;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1110
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1111
        pixels = (const jubyte *) glyphs[glyphCounter].pixels;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1112
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1113
        if (!pixels) continue;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1114
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1115
        left = glyphs[glyphCounter].x;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1116
        top = glyphs[glyphCounter].y;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1117
        width = glyphs[glyphCounter].width;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1118
        height = glyphs[glyphCounter].height;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1119
        rowBytes = width;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1120
        right = left + width;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1121
        bottom = top + height;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1122
        if (left < clipLeft) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1123
            pixels += clipLeft - left;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1124
            left = clipLeft;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1125
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1126
        if (top < clipTop) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1127
            pixels += (clipTop - top) * rowBytes;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1128
            top = clipTop;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1129
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1130
        if (right > clipRight) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1131
            right = clipRight;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1132
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1133
        if (bottom > clipBottom) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1134
            bottom = clipBottom;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1135
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1136
        if (right <= left || bottom <= top) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1137
            continue;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1138
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1139
        width = right - left;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1140
        height = bottom - top;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1141
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1142
        dstBase = pRasInfo->rasBase;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1143
        PTR_ADD(dstBase, top*scan + 4*left);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1144
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1145
        pixels0 = pixels;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1146
        dstBase0 = dstBase;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1147
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1148
        for (j = 0; j < height; j++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1149
            mlib_u8  *src = (void*)pixels;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1150
            mlib_s32 *dst, *dst_end;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1151
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1152
            dst = (void*)dstBase;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1153
            dst_end = dst + width;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1154
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1155
            ADD_SUFF(IntArgbPreToIntArgbConvert)(dstBase, dstBase, width, 1,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1156
                                                 pRasInfo, pRasInfo,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1157
                                                 pPrim, pCompInfo);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1158
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1159
            vis_write_gsr(0 << 3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1160
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1161
            if ((mlib_s32)dst & 7) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1162
                pix = *src++;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1163
                dd = vis_fpadd16(MUL8_VIS(srcG_f, pix), d_half);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1164
                dd = vis_fpadd16(MUL8_VIS(*(mlib_f32*)dst, 255 - pix), dd);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1165
                *(mlib_f32*)dst = vis_fpack16(dd);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1166
                dst++;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1167
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1168
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1169
#pragma pipeloop(0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1170
            for (; dst <= (dst_end - 2); dst += 2) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1171
                dmix0 = vis_freg_pair(((mlib_f32 *)vis_mul8s_tbl)[src[0]],
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1172
                                      ((mlib_f32 *)vis_mul8s_tbl)[src[1]]);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1173
                dmix1 = vis_fpsub16(done, dmix0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1174
                src += 2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1175
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1176
                dd = *(mlib_d64*)dst;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1177
                d0 = vis_fmul8x16al(srcG_f, vis_read_hi(dmix0));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1178
                d1 = vis_fmul8x16al(srcG_f, vis_read_lo(dmix0));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1179
                e0 = vis_fmul8x16al(vis_read_hi(dd), vis_read_hi(dmix1));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1180
                e1 = vis_fmul8x16al(vis_read_lo(dd), vis_read_lo(dmix1));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1181
                d0 = vis_fpadd16(vis_fpadd16(d0, d_half), e0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1182
                d1 = vis_fpadd16(vis_fpadd16(d1, d_half), e1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1183
                dd = vis_fpack16_pair(d0, d1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1184
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1185
                *(mlib_d64*)dst = dd;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1186
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1187
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1188
            while (dst < dst_end) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1189
                pix = *src++;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1190
                dd = vis_fpadd16(MUL8_VIS(srcG_f, pix), d_half);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1191
                dd = vis_fpadd16(MUL8_VIS(*(mlib_f32*)dst, 255 - pix), dd);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1192
                *(mlib_f32*)dst = vis_fpack16(dd);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1193
                dst++;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1194
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1195
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1196
            PTR_ADD(dstBase, scan);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1197
            pixels += rowBytes;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1198
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1199
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1200
        pixels = pixels0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1201
        dstBase = dstBase0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1202
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1203
        for (j = 0; j < height; j++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1204
            mlib_u8  *src = (void*)pixels;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1205
            mlib_s32 *dst = (void*)dstBase;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1206
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1207
            for (i = 0; i < width; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1208
                if (src[i] == 255) dst[i] = fgpixel;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1209
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1210
            PTR_ADD(dstBase, scan);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1211
            pixels += rowBytes;
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
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1216
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1217
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1218
#endif /* JAVA2D_NO_MLIB */