Path: blob/master/src/java.desktop/share/native/libawt/java2d/loops/FourByteAbgrPre.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 "FourByteAbgrPre.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 "FourByteAbgrPre".40*41* See also LoopMacros.h42*/4344RegisterFunc RegisterFourByteAbgrPre;4546DECLARE_CONVERT_BLIT(FourByteAbgrPre, IntArgb);47DECLARE_CONVERT_BLIT(IntArgb, FourByteAbgrPre);48DECLARE_CONVERT_BLIT(IntRgb, FourByteAbgrPre);49DECLARE_CONVERT_BLIT(ThreeByteBgr, FourByteAbgrPre);50DECLARE_CONVERT_BLIT(ByteGray, FourByteAbgrPre);51DECLARE_CONVERT_BLIT(ByteIndexed, FourByteAbgrPre);52DECLARE_SCALE_BLIT(FourByteAbgrPre, IntArgb);53DECLARE_SCALE_BLIT(IntArgb, FourByteAbgrPre);54DECLARE_SCALE_BLIT(IntRgb, FourByteAbgrPre);55DECLARE_SCALE_BLIT(ThreeByteBgr, FourByteAbgrPre);56DECLARE_SCALE_BLIT(ByteGray, FourByteAbgrPre);57DECLARE_SCALE_BLIT(ByteIndexed, FourByteAbgrPre);58DECLARE_XPAR_CONVERT_BLIT(ByteIndexedBm, FourByteAbgrPre);59DECLARE_XPAR_SCALE_BLIT(ByteIndexedBm, FourByteAbgrPre);60DECLARE_XPAR_SCALE_BLIT(IntArgbBm, FourByteAbgrPre);61DECLARE_XPAR_BLITBG(ByteIndexedBm, FourByteAbgrPre);6263DECLARE_XOR_BLIT(IntArgb, FourByteAbgrPre);64DECLARE_SRC_MASKFILL(FourByteAbgrPre);65DECLARE_SRCOVER_MASKFILL(FourByteAbgrPre);66DECLARE_ALPHA_MASKFILL(FourByteAbgrPre);67DECLARE_SRCOVER_MASKBLIT(IntArgb, FourByteAbgrPre);68DECLARE_ALPHA_MASKBLIT(IntArgb, FourByteAbgrPre);69DECLARE_SRCOVER_MASKBLIT(IntArgbPre, FourByteAbgrPre);70DECLARE_ALPHA_MASKBLIT(IntArgbPre, FourByteAbgrPre);71DECLARE_ALPHA_MASKBLIT(IntRgb, FourByteAbgrPre);72DECLARE_SOLID_DRAWGLYPHLISTAA(FourByteAbgrPre);73DECLARE_SOLID_DRAWGLYPHLISTLCD(FourByteAbgrPre);7475DECLARE_TRANSFORMHELPER_FUNCS(FourByteAbgrPre);7677NativePrimitive FourByteAbgrPrePrimitives[] = {78REGISTER_ANY4BYTE_ISOCOPY_BLIT(FourByteAbgrPre),79REGISTER_ANY4BYTE_ISOSCALE_BLIT(FourByteAbgrPre),80REGISTER_CONVERT_BLIT(FourByteAbgrPre, IntArgb),81REGISTER_CONVERT_BLIT(IntArgb, FourByteAbgrPre),82REGISTER_CONVERT_BLIT(IntRgb, FourByteAbgrPre),83REGISTER_CONVERT_BLIT(ThreeByteBgr, FourByteAbgrPre),84REGISTER_CONVERT_BLIT(ByteGray, FourByteAbgrPre),85REGISTER_CONVERT_BLIT(ByteIndexed, FourByteAbgrPre),86REGISTER_SCALE_BLIT(FourByteAbgrPre, IntArgb),87REGISTER_SCALE_BLIT(IntArgb, FourByteAbgrPre),88REGISTER_SCALE_BLIT(IntRgb, FourByteAbgrPre),89REGISTER_SCALE_BLIT(ThreeByteBgr, FourByteAbgrPre),90REGISTER_SCALE_BLIT(ByteGray, FourByteAbgrPre),91REGISTER_SCALE_BLIT(ByteIndexed, FourByteAbgrPre),92REGISTER_XPAR_CONVERT_BLIT(ByteIndexedBm, FourByteAbgrPre),93REGISTER_XPAR_SCALE_BLIT(ByteIndexedBm, FourByteAbgrPre),94REGISTER_XPAR_SCALE_BLIT(IntArgbBm, FourByteAbgrPre),95REGISTER_XPAR_BLITBG(ByteIndexedBm, FourByteAbgrPre),9697REGISTER_XOR_BLIT(IntArgb, FourByteAbgrPre),98REGISTER_SRC_MASKFILL(FourByteAbgrPre),99REGISTER_SRCOVER_MASKFILL(FourByteAbgrPre),100REGISTER_ALPHA_MASKFILL(FourByteAbgrPre),101REGISTER_SRCOVER_MASKBLIT(IntArgb, FourByteAbgrPre),102REGISTER_ALPHA_MASKBLIT(IntArgb, FourByteAbgrPre),103REGISTER_SRCOVER_MASKBLIT(IntArgbPre, FourByteAbgrPre),104REGISTER_ALPHA_MASKBLIT(IntArgbPre, FourByteAbgrPre),105REGISTER_ALPHA_MASKBLIT(IntRgb, FourByteAbgrPre),106REGISTER_SOLID_DRAWGLYPHLISTAA(FourByteAbgrPre),107REGISTER_SOLID_DRAWGLYPHLISTLCD(FourByteAbgrPre),108109REGISTER_TRANSFORMHELPER_FUNCS(FourByteAbgrPre),110};111112jboolean RegisterFourByteAbgrPre(JNIEnv *env)113{114return RegisterPrimitives(env, FourByteAbgrPrePrimitives,115ArraySize(FourByteAbgrPrePrimitives));116}117118jint PixelForFourByteAbgrPre(SurfaceDataRasInfo *pRasInfo, jint rgb)119{120jint a, r, g, b;121if ((rgb >> 24) == -1) {122return ((rgb << 8) | (((juint) rgb) >> 24));123}124ExtractIntDcmComponents1234(rgb, a, r, g, b);125r = MUL8(a, r);126g = MUL8(a, g);127b = MUL8(a, b);128return ComposeIntDcmComponents1234(r, g, b, a);129}130131DEFINE_CONVERT_BLIT(FourByteAbgrPre, IntArgb, 1IntArgb)132133DEFINE_CONVERT_BLIT(IntArgb, FourByteAbgrPre, 4ByteArgb)134135DEFINE_CONVERT_BLIT(IntRgb, FourByteAbgrPre, 3ByteRgb)136137DEFINE_CONVERT_BLIT(ThreeByteBgr, FourByteAbgrPre, 3ByteRgb)138139DEFINE_CONVERT_BLIT(ByteGray, FourByteAbgrPre, 3ByteRgb)140141DEFINE_CONVERT_BLIT_LUT8(ByteIndexed, FourByteAbgrPre, ConvertOnTheFly)142143DEFINE_SCALE_BLIT(FourByteAbgrPre, IntArgb, 1IntArgb)144145DEFINE_SCALE_BLIT(IntArgb, FourByteAbgrPre, 4ByteArgb)146147DEFINE_SCALE_BLIT(IntRgb, FourByteAbgrPre, 3ByteRgb)148149DEFINE_SCALE_BLIT(ThreeByteBgr, FourByteAbgrPre, 3ByteRgb)150151DEFINE_SCALE_BLIT(ByteGray, FourByteAbgrPre, 3ByteRgb)152153DEFINE_SCALE_BLIT_LUT8(ByteIndexed, FourByteAbgrPre, ConvertOnTheFly)154155DEFINE_XPAR_CONVERT_BLIT_LUT8(ByteIndexedBm, FourByteAbgrPre,ConvertOnTheFly)156157DEFINE_XPAR_SCALE_BLIT_LUT8(ByteIndexedBm, FourByteAbgrPre,ConvertOnTheFly)158159DEFINE_XPAR_SCALE_BLIT(IntArgbBm, FourByteAbgrPre, 1IntRgb)160161DEFINE_XPAR_BLITBG_LUT8(ByteIndexedBm, FourByteAbgrPre, ConvertOnTheFly)162163DEFINE_XOR_BLIT(IntArgb, FourByteAbgrPre, Any4Byte)164165DEFINE_SRC_MASKFILL(FourByteAbgrPre, 4ByteArgb)166167DEFINE_SRCOVER_MASKFILL(FourByteAbgrPre, 4ByteArgb)168169DEFINE_ALPHA_MASKFILL(FourByteAbgrPre, 4ByteArgb)170171DEFINE_SRCOVER_MASKBLIT(IntArgb, FourByteAbgrPre, 4ByteArgb)172173DEFINE_ALPHA_MASKBLIT(IntArgb, FourByteAbgrPre, 4ByteArgb)174175DEFINE_SRCOVER_MASKBLIT(IntArgbPre, FourByteAbgrPre, 4ByteArgb)176177DEFINE_ALPHA_MASKBLIT(IntArgbPre, FourByteAbgrPre, 4ByteArgb)178179DEFINE_ALPHA_MASKBLIT(IntRgb, FourByteAbgrPre, 4ByteArgb)180181DEFINE_SOLID_DRAWGLYPHLISTAA(FourByteAbgrPre, 4ByteArgb)182183DEFINE_SOLID_DRAWGLYPHLISTLCD(FourByteAbgrPre, 4ByteArgb)184185DEFINE_TRANSFORMHELPERS(FourByteAbgrPre)186187188