Path: blob/master/src/java.desktop/share/native/libawt/java2d/loops/FourByteAbgr.c
41159 views
/*1* Copyright (c) 2000, 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#include "Any4Byte.h"26#include "FourByteAbgr.h"27#include "AlphaMacros.h"2829#include "IntArgb.h"30#include "IntArgbBm.h"31#include "IntArgbPre.h"32#include "IntRgb.h"33#include "ThreeByteBgr.h"34#include "ByteGray.h"35#include "ByteIndexed.h"3637/*38* This file declares, registers, and defines the various graphics39* primitive loops to manipulate surfaces of type "FourByteAbgr".40*41* See also LoopMacros.h42*/4344RegisterFunc RegisterFourByteAbgr;4546DECLARE_CONVERT_BLIT(FourByteAbgr, IntArgb);47DECLARE_CONVERT_BLIT(IntArgb, FourByteAbgr);48DECLARE_CONVERT_BLIT(IntRgb, FourByteAbgr);49DECLARE_CONVERT_BLIT(ThreeByteBgr, FourByteAbgr);50DECLARE_CONVERT_BLIT(ByteGray, FourByteAbgr);51DECLARE_CONVERT_BLIT(ByteIndexed, FourByteAbgr);52DECLARE_SCALE_BLIT(FourByteAbgr, IntArgb);53DECLARE_SCALE_BLIT(IntArgb, FourByteAbgr);54DECLARE_SCALE_BLIT(IntRgb, FourByteAbgr);55DECLARE_SCALE_BLIT(ThreeByteBgr, FourByteAbgr);56DECLARE_SCALE_BLIT(ByteGray, FourByteAbgr);57DECLARE_SCALE_BLIT(ByteIndexed, FourByteAbgr);58DECLARE_XPAR_CONVERT_BLIT(ByteIndexedBm, FourByteAbgr);59DECLARE_XPAR_SCALE_BLIT(ByteIndexedBm, FourByteAbgr);60DECLARE_XPAR_SCALE_BLIT(IntArgbBm, FourByteAbgr);61DECLARE_XPAR_BLITBG(ByteIndexedBm, FourByteAbgr);6263DECLARE_XOR_BLIT(IntArgb, FourByteAbgr);64DECLARE_SRC_MASKFILL(FourByteAbgr);65DECLARE_SRCOVER_MASKFILL(FourByteAbgr);66DECLARE_ALPHA_MASKFILL(FourByteAbgr);67DECLARE_SRCOVER_MASKBLIT(IntArgb, FourByteAbgr);68DECLARE_ALPHA_MASKBLIT(IntArgb, FourByteAbgr);69DECLARE_SRCOVER_MASKBLIT(IntArgbPre, FourByteAbgr);70DECLARE_ALPHA_MASKBLIT(IntArgbPre, FourByteAbgr);71DECLARE_ALPHA_MASKBLIT(IntRgb, FourByteAbgr);72DECLARE_SOLID_DRAWGLYPHLISTAA(FourByteAbgr);73DECLARE_SOLID_DRAWGLYPHLISTLCD(FourByteAbgr);7475DECLARE_TRANSFORMHELPER_FUNCS(FourByteAbgr);7677NativePrimitive FourByteAbgrPrimitives[] = {78REGISTER_ANY4BYTE_ISOCOPY_BLIT(FourByteAbgr),79REGISTER_ANY4BYTE_ISOSCALE_BLIT(FourByteAbgr),80REGISTER_CONVERT_BLIT(FourByteAbgr, IntArgb),81REGISTER_CONVERT_BLIT(IntArgb, FourByteAbgr),82REGISTER_CONVERT_BLIT(IntRgb, FourByteAbgr),83REGISTER_CONVERT_BLIT(ThreeByteBgr, FourByteAbgr),84REGISTER_CONVERT_BLIT(ByteGray, FourByteAbgr),85REGISTER_CONVERT_BLIT(ByteIndexed, FourByteAbgr),86REGISTER_SCALE_BLIT(FourByteAbgr, IntArgb),87REGISTER_SCALE_BLIT(IntArgb, FourByteAbgr),88REGISTER_SCALE_BLIT(IntRgb, FourByteAbgr),89REGISTER_SCALE_BLIT(ThreeByteBgr, FourByteAbgr),90REGISTER_SCALE_BLIT(ByteGray, FourByteAbgr),91REGISTER_SCALE_BLIT(ByteIndexed, FourByteAbgr),92REGISTER_XPAR_CONVERT_BLIT(ByteIndexedBm, FourByteAbgr),93REGISTER_XPAR_SCALE_BLIT(ByteIndexedBm, FourByteAbgr),94REGISTER_XPAR_SCALE_BLIT(IntArgbBm, FourByteAbgr),95REGISTER_XPAR_BLITBG(ByteIndexedBm, FourByteAbgr),9697REGISTER_XOR_BLIT(IntArgb, FourByteAbgr),98REGISTER_SRC_MASKFILL(FourByteAbgr),99REGISTER_SRCOVER_MASKFILL(FourByteAbgr),100REGISTER_ALPHA_MASKFILL(FourByteAbgr),101REGISTER_SRCOVER_MASKBLIT(IntArgb, FourByteAbgr),102REGISTER_ALPHA_MASKBLIT(IntArgb, FourByteAbgr),103REGISTER_SRCOVER_MASKBLIT(IntArgbPre, FourByteAbgr),104REGISTER_ALPHA_MASKBLIT(IntArgbPre, FourByteAbgr),105REGISTER_ALPHA_MASKBLIT(IntRgb, FourByteAbgr),106REGISTER_SOLID_DRAWGLYPHLISTAA(FourByteAbgr),107REGISTER_SOLID_DRAWGLYPHLISTLCD(FourByteAbgr),108109REGISTER_TRANSFORMHELPER_FUNCS(FourByteAbgr),110};111112jboolean RegisterFourByteAbgr(JNIEnv *env)113{114return RegisterPrimitives(env, FourByteAbgrPrimitives,115ArraySize(FourByteAbgrPrimitives));116}117118jint PixelForFourByteAbgr(SurfaceDataRasInfo *pRasInfo, jint rgb)119{120return ((rgb << 8) | (((juint) rgb) >> 24));121}122123DEFINE_CONVERT_BLIT(FourByteAbgr, IntArgb, 1IntArgb)124125DEFINE_CONVERT_BLIT(IntArgb, FourByteAbgr, 4ByteArgb)126127DEFINE_CONVERT_BLIT(IntRgb, FourByteAbgr, 3ByteRgb)128129DEFINE_CONVERT_BLIT(ThreeByteBgr, FourByteAbgr, 3ByteRgb)130131DEFINE_CONVERT_BLIT(ByteGray, FourByteAbgr, 3ByteRgb)132133DEFINE_CONVERT_BLIT_LUT8(ByteIndexed, FourByteAbgr, ConvertOnTheFly)134135DEFINE_SCALE_BLIT(FourByteAbgr, IntArgb, 1IntArgb)136137DEFINE_SCALE_BLIT(IntArgb, FourByteAbgr, 4ByteArgb)138139DEFINE_SCALE_BLIT(IntRgb, FourByteAbgr, 3ByteRgb)140141DEFINE_SCALE_BLIT(ThreeByteBgr, FourByteAbgr, 3ByteRgb)142143DEFINE_SCALE_BLIT(ByteGray, FourByteAbgr, 3ByteRgb)144145DEFINE_SCALE_BLIT_LUT8(ByteIndexed, FourByteAbgr, ConvertOnTheFly)146147DEFINE_XPAR_CONVERT_BLIT_LUT8(ByteIndexedBm, FourByteAbgr, ConvertOnTheFly)148149DEFINE_XPAR_SCALE_BLIT_LUT8(ByteIndexedBm, FourByteAbgr, ConvertOnTheFly)150151DEFINE_XPAR_SCALE_BLIT(IntArgbBm, FourByteAbgr, 1IntRgb)152153DEFINE_XPAR_BLITBG_LUT8(ByteIndexedBm, FourByteAbgr, ConvertOnTheFly)154155DEFINE_XOR_BLIT(IntArgb, FourByteAbgr, Any4Byte)156157DEFINE_SRC_MASKFILL(FourByteAbgr, 4ByteArgb)158159DEFINE_SRCOVER_MASKFILL(FourByteAbgr, 4ByteArgb)160161DEFINE_ALPHA_MASKFILL(FourByteAbgr, 4ByteArgb)162163DEFINE_SRCOVER_MASKBLIT(IntArgb, FourByteAbgr, 4ByteArgb)164165DEFINE_ALPHA_MASKBLIT(IntArgb, FourByteAbgr, 4ByteArgb)166167DEFINE_SRCOVER_MASKBLIT(IntArgbPre, FourByteAbgr, 4ByteArgb)168169DEFINE_ALPHA_MASKBLIT(IntArgbPre, FourByteAbgr, 4ByteArgb)170171DEFINE_ALPHA_MASKBLIT(IntRgb, FourByteAbgr, 4ByteArgb)172173DEFINE_SOLID_DRAWGLYPHLISTAA(FourByteAbgr, 4ByteArgb)174175DEFINE_SOLID_DRAWGLYPHLISTLCD(FourByteAbgr, 4ByteArgb)176177DEFINE_TRANSFORMHELPERS(FourByteAbgr)178179180