Path: blob/master/src/java.desktop/share/native/libawt/java2d/loops/Any3Byte.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 "Any3Byte".31*/3233typedef jubyte Any3ByteDataType;3435#define Any3BytePixelStride 33637#define DeclareAny3ByteLoadVars(PREFIX)38#define DeclareAny3ByteStoreVars(PREFIX)39#define InitAny3ByteLoadVars(PREFIX, pRasInfo)40#define InitAny3ByteStoreVarsY(PREFIX, pRasInfo)41#define InitAny3ByteStoreVarsX(PREFIX, pRasInfo)42#define NextAny3ByteStoreVarsX(PREFIX)43#define NextAny3ByteStoreVarsY(PREFIX)4445#define DeclareAny3BytePixelData(PREFIX) \46jubyte PREFIX ## 0, PREFIX ## 1, PREFIX ## 2;4748#define ExtractAny3BytePixelData(PIXEL, PREFIX) \49do { \50PREFIX ## 0 = (jubyte) (PIXEL); \51PREFIX ## 1 = (jubyte) (PIXEL >> 8); \52PREFIX ## 2 = (jubyte) (PIXEL >> 16); \53} while (0)5455#define StoreAny3BytePixelData(pPix, x, pixel, PREFIX) \56do { \57(pPix)[3*x+0] = PREFIX ## 0; \58(pPix)[3*x+1] = PREFIX ## 1; \59(pPix)[3*x+2] = PREFIX ## 2; \60} while (0)6162#define CopyAny3BytePixelData(pSrc, sx, pDst, dx) \63do { \64(pDst)[3*dx+0] = (pSrc)[3*sx+0]; \65(pDst)[3*dx+1] = (pSrc)[3*sx+1]; \66(pDst)[3*dx+2] = (pSrc)[3*sx+2]; \67} while (0)6869#define XorCopyAny3BytePixelData(pSrc, pDst, x, xorpixel, XORPREFIX) \70do { \71(pDst)[3*x+0] ^= (pSrc)[3*x+0] ^ XORPREFIX ## 0; \72(pDst)[3*x+1] ^= (pSrc)[3*x+1] ^ XORPREFIX ## 1; \73(pDst)[3*x+2] ^= (pSrc)[3*x+2] ^ XORPREFIX ## 2; \74} while (0)7576#define XorAny3BytePixelData(srcpixel, SRCPREFIX, pDst, x, \77xorpixel, XORPREFIX, mask, MASKPREFIX) \78do { \79(pDst)[3*x+0] ^= ((SRCPREFIX ## 0 ^ XORPREFIX ## 0) & \80~MASKPREFIX ## 0); \81(pDst)[3*x+1] ^= ((SRCPREFIX ## 1 ^ XORPREFIX ## 1) & \82~MASKPREFIX ## 1); \83(pDst)[3*x+2] ^= ((SRCPREFIX ## 2 ^ XORPREFIX ## 2) & \84~MASKPREFIX ## 2); \85} while (0)8687DECLARE_ISOCOPY_BLIT(Any3Byte);88DECLARE_ISOSCALE_BLIT(Any3Byte);89DECLARE_ISOXOR_BLIT(Any3Byte);9091#define REGISTER_ANY3BYTE_ISOCOPY_BLIT(THREEBYTETYPE) \92REGISTER_ISOCOPY_BLIT(THREEBYTETYPE, Any3Byte)9394#define REGISTER_ANY3BYTE_ISOSCALE_BLIT(THREEBYTETYPE) \95REGISTER_ISOSCALE_BLIT(THREEBYTETYPE, Any3Byte)9697#define REGISTER_ANY3BYTE_ISOXOR_BLIT(THREEBYTETYPE) \98REGISTER_ISOXOR_BLIT(THREEBYTETYPE, Any3Byte)99100101