Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/solaris/native/sun/java2d/loops/vis_DrawLine.c
32288 views
/*1* Copyright (c) 2003, 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_proto.h>28#include "java2d_Mlib.h"2930/***************************************************************/3132#define SET_PIX(index, chan) \33pPix[chan] = pix##chan3435#define XOR_PIX(index, chan) \36pPix[chan] ^= pix##chan3738/***************************************************************/3940#define EXTRA_1(FUNC, ANYTYPE, NCHAN, DO_PIX)41#define EXTRA_3(FUNC, ANYTYPE, NCHAN, DO_PIX)42#define EXTRA_4(FUNC, ANYTYPE, NCHAN, DO_PIX) \43if ((((jint)pPix | scan) & 3) == 0) { \44mlib_s32 s_pixel = pixel, r_pixel; \45*(mlib_f32*)&r_pixel = vis_ldfa_ASI_PL(&s_pixel); \46ADD_SUFF(AnyInt##FUNC)(pRasInfo, x1, y1, r_pixel, steps, error, \47bumpmajormask, errmajor, bumpminormask, \48errminor, pPrim, pCompInfo); \49return; \50}5152/***************************************************************/5354#define GET_PIXEL(pix) \55mlib_s32 pix = pixel5657/***************************************************************/5859#define DEFINE_SET_LINE(FUNC, ANYTYPE, NCHAN, DO_PIX) \60void ADD_SUFF(ANYTYPE##FUNC)(SurfaceDataRasInfo * pRasInfo, \61jint x1, \62jint y1, \63jint pixel, \64jint steps, \65jint error, \66jint bumpmajormask, \67jint errmajor, \68jint bumpminormask, \69jint errminor, \70NativePrimitive * pPrim, \71CompositeInfo * pCompInfo) \72{ \73ANYTYPE##DataType *pPix = (void *)(pRasInfo->rasBase); \74mlib_s32 scan = pRasInfo->scanStride; \75mlib_s32 bumpmajor, bumpminor, mask; \76GET_PIXEL(pix); \77EXTRACT_CONST_##NCHAN(pix); \78\79EXTRA_##NCHAN(FUNC, AnyInt, NCHAN, DO_PIX); \80\81PTR_ADD(pPix, y1 * scan + x1 * ANYTYPE##PixelStride); \82\83errminor += errmajor; \84\85if (bumpmajormask & 0x1) bumpmajor = ANYTYPE##PixelStride; else \86if (bumpmajormask & 0x2) bumpmajor = -ANYTYPE##PixelStride; else \87if (bumpmajormask & 0x4) bumpmajor = scan; else \88bumpmajor = - scan; \89\90if (bumpminormask & 0x1) bumpminor = ANYTYPE##PixelStride; else \91if (bumpminormask & 0x2) bumpminor = -ANYTYPE##PixelStride; else \92if (bumpminormask & 0x4) bumpminor = scan; else \93if (bumpminormask & 0x8) bumpminor = -scan; else \94bumpminor = 0; \95\96if (errmajor == 0) { \97do { \98PROCESS_PIX_##NCHAN(DO_PIX); \99PTR_ADD(pPix, bumpmajor); \100} while (--steps > 0); \101return; \102} \103\104do { \105PROCESS_PIX_##NCHAN(DO_PIX); \106mask = error >> 31; \107PTR_ADD(pPix, bumpmajor + (bumpminor &~ mask)); \108error += errmajor - (errminor &~ mask); \109} while (--steps > 0); \110}111112DEFINE_SET_LINE(SetLine, AnyInt, 1, SET_PIX)113DEFINE_SET_LINE(SetLine, AnyShort, 1, SET_PIX)114DEFINE_SET_LINE(SetLine, AnyByte, 1, SET_PIX)115DEFINE_SET_LINE(SetLine, Any3Byte, 3, SET_PIX)116DEFINE_SET_LINE(SetLine, Any4Byte, 4, SET_PIX)117118/***************************************************************/119120#undef GET_PIXEL121#define GET_PIXEL(pix) \122mlib_s32 xorpixel = pCompInfo->details.xorPixel; \123mlib_s32 alphamask = pCompInfo->alphaMask; \124mlib_s32 pix = (pixel ^ xorpixel) &~ alphamask125126#undef EXTRA_4127#define EXTRA_4(FUNC, ANYTYPE, NCHAN, DO_PIX)128129DEFINE_SET_LINE(XorLine, AnyInt, 1, XOR_PIX)130DEFINE_SET_LINE(XorLine, AnyShort, 1, XOR_PIX)131DEFINE_SET_LINE(XorLine, AnyByte, 1, XOR_PIX)132DEFINE_SET_LINE(XorLine, Any3Byte, 3, XOR_PIX)133DEFINE_SET_LINE(XorLine, Any4Byte, 4, XOR_PIX)134135/***************************************************************/136137#endif138139140