Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/solaris/native/sun/java2d/loops/java2d_Mlib.h
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#ifndef Java2d_Mlib_h_Included26#define Java2d_Mlib_h_Included2728#include <mlib_image.h>29#include "mlib_ImageCopy.h"3031#include "AnyByte.h"32#include "Any3Byte.h"33#include "Any4Byte.h"34#include "AnyShort.h"35#include "AnyInt.h"36#include "IntArgb.h"37#include "IntArgbBm.h"38#include "IntRgb.h"39#include "ByteGray.h"40#include "ByteIndexed.h"41#include "Index8Gray.h"42#include "Index12Gray.h"4344/***************************************************************/4546#ifdef MLIB_ADD_SUFF47#define ADD_SUFF(x) x##_F48#else49#define ADD_SUFF(x) x50#endif5152/***************************************************************/5354#define MLIB_AnyByte MLIB_BYTE55#define MLIB_Any3Byte MLIB_BYTE56#define MLIB_Any4Byte MLIB_BYTE57#define MLIB_AnyShort MLIB_SHORT58#define MLIB_AnyInt MLIB_INT5960/***************************************************************/6162#define NCHAN_AnyByte 163#define NCHAN_Any3Byte 364#define NCHAN_Any4Byte 465#define NCHAN_AnyShort 166#define NCHAN_AnyInt 16768/***************************************************************/6970#define BLIT_PARAMS \71void *srcBase, void *dstBase, \72juint width, juint height, \73SurfaceDataRasInfo *pSrcInfo, \74SurfaceDataRasInfo *pDstInfo, \75NativePrimitive *pPrim, \76CompositeInfo *pCompInfo7778#define BLIT_CALL_PARAMS \79srcBase, dstBase, width, height, \80pSrcInfo, pDstInfo, pPrim, pCompInfo8182/***************************************************************/8384#define SCALE_PARAMS \85void *srcBase, void *dstBase, \86juint width, juint height, \87jint sxloc, jint syloc, \88jint sxinc, jint syinc, jint shift, \89SurfaceDataRasInfo * pSrcInfo, \90SurfaceDataRasInfo * pDstInfo, \91NativePrimitive * pPrim, \92CompositeInfo * pCompInfo9394#define SCALE_CALL_PARAMS \95srcBase, dstBase, width, height, \96sxloc, syloc, sxinc, syinc, shift, \97pSrcInfo, pDstInfo, pPrim, pCompInfo9899/***************************************************************/100101#define BCOPY_PARAMS \102void *srcBase, void *dstBase, \103juint width, juint height, \104jint bgpixel, \105SurfaceDataRasInfo * pSrcInfo, \106SurfaceDataRasInfo * pDstInfo, \107NativePrimitive * pPrim, \108CompositeInfo * pCompInfo109110#define BCOPY_CALL_PARAMS \111srcBase, dstBase, width, height, \112bgpixel, \113pSrcInfo, pDstInfo, pPrim, pCompInfo114115/***************************************************************/116117#define MASKBLIT_PARAMS \118void *dstBase, \119void *srcBase, \120jubyte *pMask, \121jint maskOff, \122jint maskScan, \123jint width, \124jint height, \125SurfaceDataRasInfo *pDstInfo, \126SurfaceDataRasInfo *pSrcInfo, \127NativePrimitive *pPrim, \128CompositeInfo *pCompInfo129130#define MASKBLIT_CALL_PARAMS \131dstBase, srcBase, pMask, \132maskOff, maskScan, width, height, \133pSrcInfo, pDstInfo, pPrim, pCompInfo134135/***************************************************************/136137#define GLYPH_LIST_PARAMS \138SurfaceDataRasInfo * pRasInfo, \139ImageRef *glyphs, \140jint totalGlyphs, \141jint fgpixel, jint argbcolor, \142jint clipLeft, jint clipTop, \143jint clipRight, jint clipBottom, \144NativePrimitive * pPrim, \145CompositeInfo * pCompInfo146147/***************************************************************/148149#define MLIB_IMAGE_SET(image, data_type, nchan, w, h, scan, data_ptr) \150image->type = data_type; \151image->channels = nchan; \152image->width = w; \153image->height = h; \154image->stride = scan; \155image->data = (void*)(data_ptr)156157/***************************************************************/158159#define PTR_ADD(ptr, scan) \160ptr = (void*)((mlib_u8*)(ptr) + (scan))161162/***************************************************************/163164#define EXTRACT_CONST_1(pixel) \165mlib_s32 pixel##0 = pixel166167#define EXTRACT_CONST_3(pixel) \168mlib_s32 pixel##0 = pixel; \169mlib_s32 pixel##1 = pixel >> 8; \170mlib_s32 pixel##2 = pixel >> 16171172#define EXTRACT_CONST_4(pixel) \173mlib_s32 pixel##0 = pixel; \174mlib_s32 pixel##1 = pixel >> 8; \175mlib_s32 pixel##2 = pixel >> 16; \176mlib_s32 pixel##3 = pixel >> 24177178/***************************************************************/179180#define STORE_CONST_1(ptr, pixel) \181ptr[0] = pixel182183#define STORE_CONST_3(ptr, pixel) \184ptr[0] = pixel; \185ptr[1] = pixel >> 8; \186ptr[2] = pixel >> 16187188#define STORE_CONST_4(ptr, pixel) \189ptr[0] = pixel; \190ptr[1] = pixel >> 8; \191ptr[2] = pixel >> 16; \192ptr[3] = pixel >> 24193194/***************************************************************/195196#define PROCESS_PIX_1(BODY) \197BODY(i, 0)198199#define PROCESS_PIX_3(BODY) \200BODY(3*i, 0); \201BODY(3*i + 1, 1); \202BODY(3*i + 2, 2)203204#define PROCESS_PIX_4(BODY) \205BODY(4*i, 0); \206BODY(4*i + 1, 1); \207BODY(4*i + 2, 2); \208BODY(4*i + 3, 3)209210/***************************************************************/211212#define LOOP_DST(TYPE, NCHAN, dstBase, dstScan, BODY) \213{ \214TYPE##DataType *dst_ptr = (void*)(dstBase); \215mlib_s32 i, j; \216j = 0; \217do { \218i = 0; \219do { \220PROCESS_PIX_##NCHAN(BODY); \221i++; \222} while (i < width); \223PTR_ADD(dst_ptr, dstScan); \224j++; \225} while (j < height); \226}227228#define LOOP_DST_SRC(TYPE, NCHAN, dstBase, dstScan, \229srcBase, srcScan, BODY) \230{ \231TYPE##DataType *dst_ptr = (void*)(dstBase); \232TYPE##DataType *src_ptr = (void*)(srcBase); \233mlib_s32 i, j; \234for (j = 0; j < height; j++) { \235for (i = 0; i < width; i++) { \236PROCESS_PIX_##NCHAN(BODY); \237} \238PTR_ADD(dst_ptr, dstScan); \239PTR_ADD(src_ptr, srcScan); \240} \241}242243/***************************************************************/244245#define LOAD_2F32(ptr, ind0, ind1) \246vis_freg_pair(((mlib_f32*)(ptr))[ind0], ((mlib_f32*)(ptr))[ind1])247248/***************************************************************/249250#define LOAD_NEXT_U8(dd, ptr) \251dd = vis_faligndata(vis_ld_u8(ptr), dd)252253/***************************************************************/254255#define LOAD_NEXT_U16(dd, ptr) \256dd = vis_faligndata(vis_ld_u16(ptr), dd)257258/***************************************************************/259260jboolean checkSameLut(jint * SrcReadLut,261jint * DstReadLut,262SurfaceDataRasInfo * pSrcInfo,263SurfaceDataRasInfo * pDstInfo);264265void ADD_SUFF(AnyByteIsomorphicCopy)(BLIT_PARAMS);266267void ADD_SUFF(AnyByteIsomorphicScaleCopy)(SCALE_PARAMS);268269void ADD_SUFF(AnyByteSetRect)(SurfaceDataRasInfo * pRasInfo,270jint lox, jint loy, jint hix,271jint hiy, jint pixel,272NativePrimitive * pPrim,273CompositeInfo * pCompInfo);274275void ADD_SUFF(Any4ByteSetRect)(SurfaceDataRasInfo * pRasInfo,276jint lox, jint loy, jint hix,277jint hiy, jint pixel,278NativePrimitive * pPrim,279CompositeInfo * pCompInfo);280281void ADD_SUFF(Any3ByteSetRect)(SurfaceDataRasInfo * pRasInfo,282jint lox, jint loy, jint hix,283jint hiy, jint pixel,284NativePrimitive * pPrim,285CompositeInfo * pCompInfo);286287void ADD_SUFF(AnyIntSetRect)(SurfaceDataRasInfo * pRasInfo,288jint lox, jint loy, jint hix,289jint hiy, jint pixel,290NativePrimitive * pPrim,291CompositeInfo * pCompInfo);292293void AnyByteSetRect(SurfaceDataRasInfo * pRasInfo,294jint lox, jint loy, jint hix,295jint hiy, jint pixel,296NativePrimitive * pPrim,297CompositeInfo * pCompInfo);298299void AnyIntSetRect(SurfaceDataRasInfo * pRasInfo,300jint lox, jint loy, jint hix,301jint hiy, jint pixel,302NativePrimitive * pPrim,303CompositeInfo * pCompInfo);304305void ADD_SUFF(IntArgbToByteGrayConvert)(BLIT_PARAMS);306void ADD_SUFF(ByteGrayToIntArgbConvert)(BLIT_PARAMS);307void ADD_SUFF(FourByteAbgrToIntArgbConvert)(BLIT_PARAMS);308void ADD_SUFF(IntArgbToFourByteAbgrConvert)(BLIT_PARAMS);309void ADD_SUFF(ThreeByteBgrToIntArgbConvert)(BLIT_PARAMS);310void ADD_SUFF(TreeByteBgrToIntArgbConvert)(BLIT_PARAMS);311void ADD_SUFF(IntArgbPreToIntArgbConvert)(BLIT_PARAMS);312void ADD_SUFF(FourByteAbgrToIntArgbScaleConvert)(SCALE_PARAMS);313void ADD_SUFF(ByteGrayToIntArgbPreConvert)(BLIT_PARAMS);314void ADD_SUFF(IntArgbToIntArgbPreConvert)(BLIT_PARAMS);315void ADD_SUFF(IntRgbToIntArgbPreConvert)(BLIT_PARAMS);316void ADD_SUFF(ThreeByteBgrToIntArgbPreConvert)(BLIT_PARAMS);317void ADD_SUFF(ByteGrayToIntArgbPreScaleConvert)(SCALE_PARAMS);318void ADD_SUFF(IntArgbToIntArgbPreScaleConvert)(SCALE_PARAMS);319void ADD_SUFF(IntRgbToIntArgbPreScaleConvert)(SCALE_PARAMS);320void ADD_SUFF(ThreeByteBgrToIntArgbPreScaleConvert)(SCALE_PARAMS);321void ADD_SUFF(ByteIndexedToFourByteAbgrConvert)(BLIT_PARAMS);322void ADD_SUFF(ByteIndexedBmToFourByteAbgrXparOver)(BLIT_PARAMS);323void ADD_SUFF(ByteIndexedBmToFourByteAbgrScaleXparOver)(SCALE_PARAMS);324void ADD_SUFF(ByteIndexedToFourByteAbgrScaleConvert)(SCALE_PARAMS);325void ADD_SUFF(IntArgbToThreeByteBgrConvert)(BLIT_PARAMS);326void ADD_SUFF(IntArgbToUshortGrayConvert)(BLIT_PARAMS);327void ADD_SUFF(ByteIndexedBmToFourByteAbgrXparBgCopy)(BCOPY_PARAMS);328329void IntArgbToThreeByteBgrConvert(BLIT_PARAMS);330331/***************************************************************/332333#endif /* Java2d_Mlib_h_Included */334335336