Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/solaris/native/sun/java2d/loops/vis_AlphaMaskFill.c
32288 views
/*1* Copyright (c) 2003, 2005, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/2425#if !defined(JAVA2D_NO_MLIB) || defined(MLIB_ADD_SUFF)2627#include "vis_AlphaMacros.h"2829/***************************************************************/3031/* ##############################################################32* IntArgbAlphaMaskFill()33* FourByteAbgrAlphaMaskFill()34*/3536#define MASK_FILL(rr, pathA, dstA, dstARGB) \37{ \38mlib_d64 t0, t1; \39mlib_s32 srcF, dstF, srcA; \40\41srcF = ((dstA & SrcOpAnd) ^ SrcOpXor) + SrcOpAdd; \42\43srcF = MUL8_INT(srcF, pathA); \44dstF = mul8_dstF[pathA] + (0xff - pathA); \45\46srcA = mul8_cnstA[srcF]; \47dstA = MUL8_INT(dstF, dstA); \48\49t0 = MUL8_VIS(cnstARGB0, srcF); \50t1 = MUL8_VIS(dstARGB, dstA); \51rr = vis_fpadd16(t0, t1); \52\53dstA += srcA; \54DIV_ALPHA(rr, dstA); \55}5657/***************************************************************/5859static void IntArgbAlphaMaskFill_line(mlib_f32 *dst_ptr,60mlib_u8 *pMask,61mlib_s32 width,62mlib_f32 cnstARGB0,63mlib_s32 *log_val,64mlib_u8 *mul8_cnstA,65mlib_u8 *mul8_dstF,66mlib_u8 *mul8_tbl)67{68mlib_s32 i, i0;69mlib_s32 pathA0, pathA1, dstA0, dstA1, msk;70mlib_d64 res0, res1, dstARGB;71mlib_f32 dstARGB0;72mlib_s32 SrcOpAnd, SrcOpXor, SrcOpAdd;7374SrcOpAnd = log_val[0];75SrcOpXor = log_val[1];76SrcOpAdd = log_val[2];7778i = i0 = 0;7980if ((mlib_s32)dst_ptr & 7) {81pathA0 = pMask[i];8283if (pathA0) {84dstA0 = *(mlib_u8*)(dst_ptr + i);85dstARGB0 = dst_ptr[i];86MASK_FILL(res0, pathA0, dstA0, dstARGB0);87dst_ptr[i] = vis_fpack16(res0);88*(mlib_u8*)(dst_ptr + i) = dstA0;89}9091i0 = 1;92}9394#pragma pipeloop(0)95for (i = i0; i <= width - 2; i += 2) {96pathA0 = pMask[i];97pathA1 = pMask[i + 1];98dstA0 = *(mlib_u8*)(dst_ptr + i);99dstA1 = *(mlib_u8*)(dst_ptr + i + 1);100dstARGB = *(mlib_d64*)(dst_ptr + i);101102MASK_FILL(res0, pathA0, dstA0, vis_read_hi(dstARGB));103MASK_FILL(res1, pathA1, dstA1, vis_read_lo(dstARGB));104105res0 = vis_fpack16_pair(res0, res1);106107msk = (((-pathA0) & (1 << 11)) | ((-pathA1) & (1 << 10))) >> 10;108vis_pst_32(res0, dst_ptr + i, msk);109110*(mlib_u8*)(dst_ptr + i ) = dstA0;111*(mlib_u8*)(dst_ptr + i + 1) = dstA1;112}113114if (i < width) {115pathA0 = pMask[i];116117if (pathA0) {118dstA0 = *(mlib_u8*)(dst_ptr + i);119dstARGB0 = dst_ptr[i];120MASK_FILL(res0, pathA0, dstA0, dstARGB0);121dst_ptr[i] = vis_fpack16(res0);122*(mlib_u8*)(dst_ptr + i) = dstA0;123}124}125}126127/***************************************************************/128129#undef MASK_FILL130#define MASK_FILL(rr, pathA, dstA, dstARGB) \131{ \132mlib_d64 t0, t1; \133mlib_s32 srcA, alp1; \134\135srcA = ((dstA & SrcOpAnd) ^ SrcOpXor) + SrcOpAdd; \136alp1 = mul8_dstF[dstA]; \137dstA = mul8_cnstA[srcA] + alp1; \138\139t0 = MUL8_VIS(cnstARGB0, srcA); \140t1 = MUL8_VIS(dstARGB, alp1); \141rr = vis_fpadd16(t0, t1); \142\143DIV_ALPHA(rr, dstA); \144}145146/***************************************************************/147148static void IntArgbAlphaMaskFill_A1_line(mlib_f32 *dst_ptr,149mlib_u8 *pMask,150mlib_s32 width,151mlib_f32 cnstARGB0,152mlib_s32 *log_val,153mlib_u8 *mul8_cnstA,154mlib_u8 *mul8_dstF,155mlib_u8 *mul8_tbl)156{157mlib_s32 i;158mlib_s32 dstA0;159mlib_d64 res0;160mlib_f32 dstARGB0;161mlib_s32 SrcOpAnd, SrcOpXor, SrcOpAdd;162163SrcOpAnd = log_val[0];164SrcOpXor = log_val[1];165SrcOpAdd = log_val[2];166167#pragma pipeloop(0)168for (i = 0; i < width; i++) {169dstA0 = *(mlib_u8*)(dst_ptr + i);170dstARGB0 = dst_ptr[i];171MASK_FILL(res0, pathA0, dstA0, dstARGB0);172dst_ptr[i] = vis_fpack16(res0);173*(mlib_u8*)(dst_ptr + i) = dstA0;174}175}176177/***************************************************************/178179void ADD_SUFF(IntArgbAlphaMaskFill)(void *rasBase,180jubyte *pMask,181jint maskOff,182jint maskScan,183jint width,184jint height,185jint fgColor,186SurfaceDataRasInfo *pRasInfo,187NativePrimitive *pPrim,188CompositeInfo *pCompInfo)189{190mlib_s32 cnstA, cnstR, cnstG, cnstB;191mlib_s32 rasScan = pRasInfo->scanStride;192mlib_f32 cnstARGB0;193mlib_u8 *mul8_cnstA, *mul8_dstF;194mlib_s32 SrcOpAnd, SrcOpXor, SrcOpAdd;195mlib_s32 DstOpAnd, DstOpXor, DstOpAdd;196mlib_s32 dstF;197mlib_s32 log_val[3];198mlib_s32 j;199200cnstA = (fgColor >> 24) & 0xff;201cnstR = (fgColor >> 16) & 0xff;202cnstG = (fgColor >> 8) & 0xff;203cnstB = (fgColor ) & 0xff;204205if (cnstA != 0xff) {206cnstR = mul8table[cnstA][cnstR];207cnstG = mul8table[cnstA][cnstG];208cnstB = mul8table[cnstA][cnstB];209}210211cnstARGB0 = F32_FROM_U8x4(cnstA, cnstR, cnstG, cnstB);212213SrcOpAnd = (AlphaRules[pCompInfo->rule].srcOps).andval;214SrcOpXor = (AlphaRules[pCompInfo->rule].srcOps).xorval;215SrcOpAdd = (AlphaRules[pCompInfo->rule].srcOps).addval;216SrcOpAdd -= SrcOpXor;217218log_val[0] = SrcOpAnd;219log_val[1] = SrcOpXor;220log_val[2] = SrcOpAdd;221222DstOpAnd = (AlphaRules[pCompInfo->rule].dstOps).andval;223DstOpXor = (AlphaRules[pCompInfo->rule].dstOps).xorval;224DstOpAdd = (AlphaRules[pCompInfo->rule].dstOps).addval;225DstOpAdd -= DstOpXor;226227dstF = (((cnstA) & DstOpAnd) ^ DstOpXor) + DstOpAdd;228229mul8_cnstA = mul8table[cnstA];230mul8_dstF = mul8table[dstF];231232vis_write_gsr(7 << 3);233234if (pMask != NULL) {235pMask += maskOff;236237if (rasScan == 4*width && maskScan == width) {238width *= height;239height = 1;240}241242for (j = 0; j < height; j++) {243IntArgbAlphaMaskFill_line(rasBase, pMask, width, cnstARGB0,244log_val, mul8_cnstA, mul8_dstF,245(void*)mul8table);246247PTR_ADD(rasBase, rasScan);248PTR_ADD(pMask, maskScan);249}250} else {251if (rasScan == 4*width) {252width *= height;253height = 1;254}255256for (j = 0; j < height; j++) {257IntArgbAlphaMaskFill_A1_line(rasBase, pMask, width, cnstARGB0,258log_val, mul8_cnstA, mul8_dstF,259(void*)mul8table);260261PTR_ADD(rasBase, rasScan);262}263}264}265266/***************************************************************/267268void ADD_SUFF(FourByteAbgrAlphaMaskFill)(void *rasBase,269jubyte *pMask,270jint maskOff,271jint maskScan,272jint width,273jint height,274jint fgColor,275SurfaceDataRasInfo *pRasInfo,276NativePrimitive *pPrim,277CompositeInfo *pCompInfo)278{279mlib_d64 buff[BUFF_SIZE/2];280void *pbuff = buff;281mlib_s32 cnstA, cnstR, cnstG, cnstB;282mlib_s32 rasScan = pRasInfo->scanStride;283mlib_f32 cnstARGB0;284mlib_u8 *mul8_cnstA, *mul8_dstF;285mlib_s32 SrcOpAnd, SrcOpXor, SrcOpAdd;286mlib_s32 DstOpAnd, DstOpXor, DstOpAdd;287mlib_s32 dstF;288mlib_s32 log_val[3];289mlib_s32 j;290291cnstA = (mlib_u32)fgColor >> 24;292cnstR = (fgColor >> 16) & 0xff;293cnstG = (fgColor >> 8) & 0xff;294cnstB = (fgColor ) & 0xff;295296if (cnstA != 0xff) {297cnstR = mul8table[cnstA][cnstR];298cnstG = mul8table[cnstA][cnstG];299cnstB = mul8table[cnstA][cnstB];300}301302cnstARGB0 = F32_FROM_U8x4(cnstA, cnstB, cnstG, cnstR);303304SrcOpAnd = (AlphaRules[pCompInfo->rule].srcOps).andval;305SrcOpXor = (AlphaRules[pCompInfo->rule].srcOps).xorval;306SrcOpAdd = (AlphaRules[pCompInfo->rule].srcOps).addval;307SrcOpAdd -= SrcOpXor;308309log_val[0] = SrcOpAnd;310log_val[1] = SrcOpXor;311log_val[2] = SrcOpAdd;312313DstOpAnd = (AlphaRules[pCompInfo->rule].dstOps).andval;314DstOpXor = (AlphaRules[pCompInfo->rule].dstOps).xorval;315DstOpAdd = (AlphaRules[pCompInfo->rule].dstOps).addval;316DstOpAdd -= DstOpXor;317318dstF = (((cnstA) & DstOpAnd) ^ DstOpXor) + DstOpAdd;319320mul8_cnstA = mul8table[cnstA];321mul8_dstF = mul8table[dstF];322323vis_write_gsr(7 << 3);324325if (pMask != NULL) {326pMask += maskOff;327328if (((mlib_s32)rasBase | rasScan) & 3) {329if (width > BUFF_SIZE) pbuff = mlib_malloc(width*sizeof(mlib_s32));330} else {331if (rasScan == 4*width && maskScan == width) {332width *= height;333height = 1;334}335}336337for (j = 0; j < height; j++) {338if (!((mlib_s32)rasBase & 3)) {339IntArgbAlphaMaskFill_line(rasBase, pMask, width, cnstARGB0,340log_val, mul8_cnstA, mul8_dstF,341(void*)mul8table);342} else {343mlib_ImageCopy_na(rasBase, pbuff, width*sizeof(mlib_s32));344IntArgbAlphaMaskFill_line(pbuff, pMask, width, cnstARGB0,345log_val, mul8_cnstA, mul8_dstF,346(void*)mul8table);347mlib_ImageCopy_na(pbuff, rasBase, width*sizeof(mlib_s32));348}349350PTR_ADD(rasBase, rasScan);351PTR_ADD(pMask, maskScan);352}353} else {354if (((mlib_s32)rasBase | rasScan) & 3) {355if (width > BUFF_SIZE) pbuff = mlib_malloc(width*sizeof(mlib_s32));356} else {357if (rasScan == 4*width) {358width *= height;359height = 1;360}361}362363for (j = 0; j < height; j++) {364if (!((mlib_s32)rasBase & 3)) {365IntArgbAlphaMaskFill_A1_line(rasBase, pMask, width, cnstARGB0,366log_val, mul8_cnstA, mul8_dstF,367(void*)mul8table);368} else {369mlib_ImageCopy_na(rasBase, pbuff, width*sizeof(mlib_s32));370IntArgbAlphaMaskFill_A1_line(pbuff, pMask, width, cnstARGB0,371log_val, mul8_cnstA, mul8_dstF,372(void*)mul8table);373mlib_ImageCopy_na(pbuff, rasBase, width*sizeof(mlib_s32));374}375376PTR_ADD(rasBase, rasScan);377}378}379380if (pbuff != buff) {381mlib_free(pbuff);382}383}384385/***************************************************************/386387/* ##############################################################388* IntRgbAlphaMaskFill()389* IntBgrAlphaMaskFill()390*/391392#undef MASK_FILL393#define MASK_FILL(rr, pathA, dstA, dstARGB) \394{ \395mlib_d64 t0, t1; \396mlib_s32 srcF, srcA; \397\398srcF = mul8_srcF[pathA]; \399srcA = mul8_cnstA[srcF]; \400dstA = mul8_dstF[pathA] + (0xff - pathA); \401\402t0 = MUL8_VIS(cnstARGB0, srcF); \403t1 = MUL8_VIS(dstARGB, dstA); \404rr = vis_fpadd16(t0, t1); \405\406dstA += srcA; \407DIV_ALPHA_RGB(rr, dstA); \408\409pathA = dstA - 0xff - srcF; \410/* (pathA == 0) if (dstA == 0xFF && srcF == 0) */ \411}412413/***************************************************************/414415static void IntRgbAlphaMaskFill_line(mlib_f32 *dst_ptr,416mlib_u8 *pMask,417mlib_s32 width,418mlib_f32 cnstARGB0,419mlib_u8 *mul8_cnstA,420mlib_u8 *mul8_dstF,421mlib_u8 *mul8_srcF,422mlib_u8 *mul8_tbl)423{424mlib_s32 i, i0;425mlib_s32 pathA0, pathA1, dstA0, dstA1, msk;426mlib_d64 res0, res1, dstARGB;427mlib_f32 dstARGB0;428429i = i0 = 0;430431if ((mlib_s32)dst_ptr & 7) {432pathA0 = pMask[i];433434dstARGB0 = dst_ptr[i];435MASK_FILL(res0, pathA0, dstA0, dstARGB0);436if (pathA0) {437dst_ptr[i] = vis_fpack16(res0);438}439440i0 = 1;441}442443#pragma pipeloop(0)444for (i = i0; i <= width - 2; i += 2) {445pathA0 = pMask[i];446pathA1 = pMask[i + 1];447dstARGB = *(mlib_d64*)(dst_ptr + i);448449MASK_FILL(res0, pathA0, dstA0, vis_read_hi(dstARGB));450MASK_FILL(res1, pathA1, dstA1, vis_read_lo(dstARGB));451452res0 = vis_fpack16_pair(res0, res1);453454msk = (((pathA0) & (1 << 11)) | ((pathA1) & (1 << 10))) >> 10;455vis_pst_32(res0, dst_ptr + i, msk);456}457458if (i < width) {459pathA0 = pMask[i];460461dstARGB0 = dst_ptr[i];462MASK_FILL(res0, pathA0, dstA0, dstARGB0);463if (pathA0) {464dst_ptr[i] = vis_fpack16(res0);465}466}467}468469/***************************************************************/470471#undef MASK_FILL472#define MASK_FILL(rr, pathA, _dstA_, dstARGB) \473{ \474rr = MUL8_VIS(dstARGB, dstF); \475rr = vis_fpadd16(rr, cnstARGB); \476\477DIV_ALPHA_RGB(rr, dstA); \478}479480/***************************************************************/481482static void IntRgbAlphaMaskFill_A1_line(mlib_f32 *dst_ptr,483mlib_u8 *pMask,484mlib_s32 width,485mlib_d64 cnstARGB,486mlib_s32 dstF,487mlib_s32 dstA)488{489mlib_s32 i;490mlib_d64 res0;491mlib_f32 dstARGB0;492493#pragma pipeloop(0)494for (i = 0; i < width; i++) {495dstARGB0 = dst_ptr[i];496MASK_FILL(res0, pathA0, dstA0, dstARGB0);497dst_ptr[i] = vis_fpack16(res0);498}499}500501/***************************************************************/502503void ADD_SUFF(IntRgbAlphaMaskFill)(void *rasBase,504jubyte *pMask,505jint maskOff,506jint maskScan,507jint width,508jint height,509jint fgColor,510SurfaceDataRasInfo *pRasInfo,511NativePrimitive *pPrim,512CompositeInfo *pCompInfo)513{514mlib_s32 cnstA, cnstR, cnstG, cnstB;515mlib_s32 rasScan = pRasInfo->scanStride;516mlib_f32 cnstARGB0;517mlib_u8 *mul8_cnstA, *mul8_dstF, *mul8_srcF;518mlib_s32 SrcOpAnd, SrcOpXor, SrcOpAdd;519mlib_s32 DstOpAnd, DstOpXor, DstOpAdd;520mlib_s32 srcF, dstF;521mlib_s32 log_val[3];522mlib_s32 j;523524cnstA = (fgColor >> 24) & 0xff;525cnstR = (fgColor >> 16) & 0xff;526cnstG = (fgColor >> 8) & 0xff;527cnstB = (fgColor ) & 0xff;528529if (cnstA != 0xff) {530cnstR = mul8table[cnstA][cnstR];531cnstG = mul8table[cnstA][cnstG];532cnstB = mul8table[cnstA][cnstB];533}534535cnstARGB0 = F32_FROM_U8x4(cnstA, cnstR, cnstG, cnstB);536537SrcOpAnd = (AlphaRules[pCompInfo->rule].srcOps).andval;538SrcOpXor = (AlphaRules[pCompInfo->rule].srcOps).xorval;539SrcOpAdd = (AlphaRules[pCompInfo->rule].srcOps).addval;540SrcOpAdd -= SrcOpXor;541542log_val[0] = SrcOpAnd;543log_val[1] = SrcOpXor;544log_val[2] = SrcOpAdd;545546DstOpAnd = (AlphaRules[pCompInfo->rule].dstOps).andval;547DstOpXor = (AlphaRules[pCompInfo->rule].dstOps).xorval;548DstOpAdd = (AlphaRules[pCompInfo->rule].dstOps).addval;549DstOpAdd -= DstOpXor;550551dstF = (((cnstA) & DstOpAnd) ^ DstOpXor) + DstOpAdd;552srcF = ((( 255) & SrcOpAnd) ^ SrcOpXor) + SrcOpAdd;553554vis_write_gsr(7 << 3);555556mul8_cnstA = mul8table[cnstA];557558if (pMask != NULL) {559pMask += maskOff;560561mul8_dstF = mul8table[dstF];562mul8_srcF = mul8table[srcF];563564if (rasScan == 4*width && maskScan == width) {565width *= height;566height = 1;567}568569for (j = 0; j < height; j++) {570IntRgbAlphaMaskFill_line(rasBase, pMask, width, cnstARGB0,571mul8_cnstA, mul8_dstF, mul8_srcF,572(void*)mul8table);573574PTR_ADD(rasBase, rasScan);575PTR_ADD(pMask, maskScan);576}577} else {578mlib_s32 dstA;579mlib_d64 cnstARGB;580581if (dstF == 0xFF && srcF == 0) return;582583cnstARGB = MUL8_VIS(cnstARGB0, srcF);584dstA = dstF + mul8_cnstA[srcF];585586if (rasScan == 4*width) {587width *= height;588height = 1;589}590591for (j = 0; j < height; j++) {592IntRgbAlphaMaskFill_A1_line(rasBase, pMask, width, cnstARGB,593dstF, dstA);594595PTR_ADD(rasBase, rasScan);596}597}598}599600/***************************************************************/601602void ADD_SUFF(IntBgrAlphaMaskFill)(void *rasBase,603jubyte *pMask,604jint maskOff,605jint maskScan,606jint width,607jint height,608jint fgColor,609SurfaceDataRasInfo *pRasInfo,610NativePrimitive *pPrim,611CompositeInfo *pCompInfo)612{613mlib_s32 cnstA, cnstR, cnstG, cnstB;614mlib_s32 rasScan = pRasInfo->scanStride;615mlib_f32 cnstARGB0;616mlib_u8 *mul8_cnstA, *mul8_dstF, *mul8_srcF;617mlib_s32 SrcOpAnd, SrcOpXor, SrcOpAdd;618mlib_s32 DstOpAnd, DstOpXor, DstOpAdd;619mlib_s32 srcF, dstF;620mlib_s32 log_val[3];621mlib_s32 j;622623cnstA = (fgColor >> 24) & 0xff;624cnstR = (fgColor >> 16) & 0xff;625cnstG = (fgColor >> 8) & 0xff;626cnstB = (fgColor ) & 0xff;627628if (cnstA != 0xff) {629cnstR = mul8table[cnstA][cnstR];630cnstG = mul8table[cnstA][cnstG];631cnstB = mul8table[cnstA][cnstB];632}633634cnstARGB0 = F32_FROM_U8x4(cnstA, cnstB, cnstG, cnstR);635636SrcOpAnd = (AlphaRules[pCompInfo->rule].srcOps).andval;637SrcOpXor = (AlphaRules[pCompInfo->rule].srcOps).xorval;638SrcOpAdd = (AlphaRules[pCompInfo->rule].srcOps).addval;639SrcOpAdd -= SrcOpXor;640641log_val[0] = SrcOpAnd;642log_val[1] = SrcOpXor;643log_val[2] = SrcOpAdd;644645DstOpAnd = (AlphaRules[pCompInfo->rule].dstOps).andval;646DstOpXor = (AlphaRules[pCompInfo->rule].dstOps).xorval;647DstOpAdd = (AlphaRules[pCompInfo->rule].dstOps).addval;648DstOpAdd -= DstOpXor;649650dstF = (((cnstA) & DstOpAnd) ^ DstOpXor) + DstOpAdd;651srcF = ((( 255) & SrcOpAnd) ^ SrcOpXor) + SrcOpAdd;652653vis_write_gsr(7 << 3);654655mul8_cnstA = mul8table[cnstA];656657if (pMask != NULL) {658pMask += maskOff;659660mul8_dstF = mul8table[dstF];661mul8_srcF = mul8table[srcF];662663if (rasScan == 4*width && maskScan == width) {664width *= height;665height = 1;666}667668for (j = 0; j < height; j++) {669IntRgbAlphaMaskFill_line(rasBase, pMask, width, cnstARGB0,670mul8_cnstA, mul8_dstF, mul8_srcF,671(void*)mul8table);672673PTR_ADD(rasBase, rasScan);674PTR_ADD(pMask, maskScan);675}676} else {677mlib_s32 dstA;678mlib_d64 cnstARGB;679680if (dstF == 0xFF && srcF == 0) return;681682cnstARGB = MUL8_VIS(cnstARGB0, srcF);683dstA = dstF + mul8_cnstA[srcF];684685if (rasScan == 4*width) {686width *= height;687height = 1;688}689690for (j = 0; j < height; j++) {691IntRgbAlphaMaskFill_A1_line(rasBase, pMask, width, cnstARGB,692dstF, dstA);693694PTR_ADD(rasBase, rasScan);695}696}697}698699/***************************************************************/700701void ADD_SUFF(ThreeByteBgrAlphaMaskFill)(void *rasBase,702jubyte *pMask,703jint maskOff,704jint maskScan,705jint width,706jint height,707jint fgColor,708SurfaceDataRasInfo *pRasInfo,709NativePrimitive *pPrim,710CompositeInfo *pCompInfo)711{712mlib_d64 buff[BUFF_SIZE/2];713void *pbuff = buff;714mlib_s32 cnstA, cnstR, cnstG, cnstB;715mlib_s32 rasScan = pRasInfo->scanStride;716mlib_f32 cnstARGB0;717mlib_u8 *mul8_cnstA, *mul8_dstF, *mul8_srcF;718mlib_s32 SrcOpAnd, SrcOpXor, SrcOpAdd;719mlib_s32 DstOpAnd, DstOpXor, DstOpAdd;720mlib_s32 srcF, dstF;721mlib_s32 log_val[3];722mlib_s32 j;723724if (width > BUFF_SIZE) pbuff = mlib_malloc(width*sizeof(mlib_s32));725726cnstA = (fgColor >> 24) & 0xff;727cnstR = (fgColor >> 16) & 0xff;728cnstG = (fgColor >> 8) & 0xff;729cnstB = (fgColor ) & 0xff;730731if (cnstA != 0xff) {732cnstR = mul8table[cnstA][cnstR];733cnstG = mul8table[cnstA][cnstG];734cnstB = mul8table[cnstA][cnstB];735}736737cnstARGB0 = F32_FROM_U8x4(cnstA, cnstR, cnstG, cnstB);738739SrcOpAnd = (AlphaRules[pCompInfo->rule].srcOps).andval;740SrcOpXor = (AlphaRules[pCompInfo->rule].srcOps).xorval;741SrcOpAdd = (AlphaRules[pCompInfo->rule].srcOps).addval;742SrcOpAdd -= SrcOpXor;743744log_val[0] = SrcOpAnd;745log_val[1] = SrcOpXor;746log_val[2] = SrcOpAdd;747748DstOpAnd = (AlphaRules[pCompInfo->rule].dstOps).andval;749DstOpXor = (AlphaRules[pCompInfo->rule].dstOps).xorval;750DstOpAdd = (AlphaRules[pCompInfo->rule].dstOps).addval;751DstOpAdd -= DstOpXor;752753dstF = (((cnstA) & DstOpAnd) ^ DstOpXor) + DstOpAdd;754srcF = ((( 255) & SrcOpAnd) ^ SrcOpXor) + SrcOpAdd;755756vis_write_gsr(7 << 3);757758mul8_cnstA = mul8table[cnstA];759760if (pMask != NULL) {761pMask += maskOff;762763mul8_dstF = mul8table[dstF];764mul8_srcF = mul8table[srcF];765766for (j = 0; j < height; j++) {767ADD_SUFF(ThreeByteBgrToIntArgbConvert)(rasBase, pbuff, width, 1,768pRasInfo, pRasInfo,769pPrim, pCompInfo);770771IntRgbAlphaMaskFill_line(pbuff, pMask, width, cnstARGB0,772mul8_cnstA, mul8_dstF, mul8_srcF,773(void*)mul8table);774775IntArgbToThreeByteBgrConvert(pbuff, rasBase, width, 1,776pRasInfo, pRasInfo, pPrim, pCompInfo);777778PTR_ADD(rasBase, rasScan);779PTR_ADD(pMask, maskScan);780}781} else {782mlib_s32 dstA;783mlib_d64 cnstARGB;784785if (dstF == 0xFF && srcF == 0) return;786787cnstARGB = MUL8_VIS(cnstARGB0, srcF);788dstA = dstF + mul8_cnstA[srcF];789790for (j = 0; j < height; j++) {791ADD_SUFF(ThreeByteBgrToIntArgbConvert)(rasBase, pbuff, width, 1,792pRasInfo, pRasInfo,793pPrim, pCompInfo);794795IntRgbAlphaMaskFill_A1_line(pbuff, pMask, width, cnstARGB,796dstF, dstA);797798IntArgbToThreeByteBgrConvert(pbuff, rasBase, width, 1,799pRasInfo, pRasInfo, pPrim, pCompInfo);800801PTR_ADD(rasBase, rasScan);802}803}804805if (pbuff != buff) {806mlib_free(pbuff);807}808}809810/***************************************************************/811812#endif /* JAVA2D_NO_MLIB */813814815