Path: blob/master/src/java.desktop/share/native/libawt/java2d/loops/Any4Byte.h
41159 views
/*1* Copyright (c) 2000, 2001, 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#include "GraphicsPrimitiveMgr.h"26#include "LoopMacros.h"2728/*29* This file contains macro and type definitions used by the macros in30* LoopMacros.h to manipulate a surface of type "Any4Byte".31*/3233typedef jubyte Any4ByteDataType;3435#define Any4BytePixelStride 43637#define DeclareAny4ByteLoadVars(PREFIX)38#define DeclareAny4ByteStoreVars(PREFIX)39#define InitAny4ByteLoadVars(PREFIX, pRasInfo)40#define InitAny4ByteStoreVarsY(PREFIX, pRasInfo)41#define InitAny4ByteStoreVarsX(PREFIX, pRasInfo)42#define NextAny4ByteStoreVarsX(PREFIX)43#define NextAny4ByteStoreVarsY(PREFIX)4445#define DeclareAny4BytePixelData(PREFIX) \46jubyte PREFIX ## 0, PREFIX ## 1, PREFIX ## 2, PREFIX ## 3;4748#define ExtractAny4BytePixelData(PIXEL, PREFIX) \49do { \50PREFIX ## 0 = (jubyte) (PIXEL); \51PREFIX ## 1 = (jubyte) (PIXEL >> 8); \52PREFIX ## 2 = (jubyte) (PIXEL >> 16); \53PREFIX ## 3 = (jubyte) (PIXEL >> 24); \54} while (0)5556#define StoreAny4BytePixelData(pPix, x, pixel, PREFIX) \57do { \58(pPix)[4*x+0] = PREFIX ## 0; \59(pPix)[4*x+1] = PREFIX ## 1; \60(pPix)[4*x+2] = PREFIX ## 2; \61(pPix)[4*x+3] = PREFIX ## 3; \62} while (0)6364#define CopyAny4BytePixelData(pSrc, sx, pDst, dx) \65do { \66(pDst)[4*dx+0] = (pSrc)[4*sx+0]; \67(pDst)[4*dx+1] = (pSrc)[4*sx+1]; \68(pDst)[4*dx+2] = (pSrc)[4*sx+2]; \69(pDst)[4*dx+3] = (pSrc)[4*sx+3]; \70} while (0)7172#define XorCopyAny4BytePixelData(pSrc, pDst, x, xorpixel, XORPREFIX) \73do { \74(pDst)[4*x+0] ^= (pSrc)[4*x+0] ^ XORPREFIX ## 0; \75(pDst)[4*x+1] ^= (pSrc)[4*x+1] ^ XORPREFIX ## 1; \76(pDst)[4*x+2] ^= (pSrc)[4*x+2] ^ XORPREFIX ## 2; \77(pDst)[4*x+3] ^= (pSrc)[4*x+3] ^ XORPREFIX ## 3; \78} while (0)7980#define XorAny4BytePixelData(srcpixel, SRCPREFIX, pDst, x, \81xorpixel, XORPREFIX, mask, MASKPREFIX) \82do { \83(pDst)[4*x+0] ^= ((SRCPREFIX ## 0 ^ XORPREFIX ## 0) & \84~MASKPREFIX ## 0); \85(pDst)[4*x+1] ^= ((SRCPREFIX ## 1 ^ XORPREFIX ## 1) & \86~MASKPREFIX ## 1); \87(pDst)[4*x+2] ^= ((SRCPREFIX ## 2 ^ XORPREFIX ## 2) & \88~MASKPREFIX ## 2); \89(pDst)[4*x+3] ^= ((SRCPREFIX ## 3 ^ XORPREFIX ## 3) & \90~MASKPREFIX ## 3); \91} while (0)9293DECLARE_ISOCOPY_BLIT(Any4Byte);94DECLARE_ISOSCALE_BLIT(Any4Byte);95DECLARE_ISOXOR_BLIT(Any4Byte);9697#define REGISTER_ANY4BYTE_ISOCOPY_BLIT(FOURBYTETYPE) \98REGISTER_ISOCOPY_BLIT(FOURBYTETYPE, Any4Byte)99100#define REGISTER_ANY4BYTE_ISOSCALE_BLIT(FOURBYTETYPE) \101REGISTER_ISOSCALE_BLIT(FOURBYTETYPE, Any4Byte)102103#define REGISTER_ANY4BYTE_ISOXOR_BLIT(FOURBYTETYPE) \104REGISTER_ISOXOR_BLIT(FOURBYTETYPE, Any4Byte)105106107