blob: c315a5a75c8903701eca3fbb5128e006ffb6d7e4 [file] [log] [blame]
J. Duke319a3b92007-12-01 00:00:00 +00001/*
2 * Copyright 2000-2005 Sun Microsystems, Inc. All Rights Reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Sun designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Sun in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
22 * CA 95054 USA or visit www.sun.com if you need additional information or
23 * have any questions.
24 */
25
26#include "Any4Byte.h"
27#include "FourByteAbgrPre.h"
28#include "AlphaMacros.h"
29
30#include "IntArgb.h"
31#include "IntArgbBm.h"
32#include "IntArgbPre.h"
33#include "IntRgb.h"
34#include "ThreeByteBgr.h"
35#include "ByteGray.h"
36#include "ByteIndexed.h"
37
38/*
39 * This file declares, registers, and defines the various graphics
40 * primitive loops to manipulate surfaces of type "FourByteAbgrPre".
41 *
42 * See also LoopMacros.h
43 */
44
45RegisterFunc RegisterFourByteAbgrPre;
46
47DECLARE_CONVERT_BLIT(FourByteAbgrPre, IntArgb);
48DECLARE_CONVERT_BLIT(IntArgb, FourByteAbgrPre);
49DECLARE_CONVERT_BLIT(IntRgb, FourByteAbgrPre);
50DECLARE_CONVERT_BLIT(ThreeByteBgr, FourByteAbgrPre);
51DECLARE_CONVERT_BLIT(ByteGray, FourByteAbgrPre);
52DECLARE_CONVERT_BLIT(ByteIndexed, FourByteAbgrPre);
53DECLARE_SCALE_BLIT(FourByteAbgrPre, IntArgb);
54DECLARE_SCALE_BLIT(IntArgb, FourByteAbgrPre);
55DECLARE_SCALE_BLIT(IntRgb, FourByteAbgrPre);
56DECLARE_SCALE_BLIT(ThreeByteBgr, FourByteAbgrPre);
57DECLARE_SCALE_BLIT(ByteGray, FourByteAbgrPre);
58DECLARE_SCALE_BLIT(ByteIndexed, FourByteAbgrPre);
59DECLARE_XPAR_CONVERT_BLIT(ByteIndexedBm, FourByteAbgrPre);
60DECLARE_XPAR_SCALE_BLIT(ByteIndexedBm, FourByteAbgrPre);
61DECLARE_XPAR_SCALE_BLIT(IntArgbBm, FourByteAbgrPre);
62DECLARE_XPAR_BLITBG(ByteIndexedBm, FourByteAbgrPre);
63
64DECLARE_XOR_BLIT(IntArgb, FourByteAbgrPre);
65DECLARE_SRC_MASKFILL(FourByteAbgrPre);
66DECLARE_SRCOVER_MASKFILL(FourByteAbgrPre);
67DECLARE_ALPHA_MASKFILL(FourByteAbgrPre);
68DECLARE_SRCOVER_MASKBLIT(IntArgb, FourByteAbgrPre);
69DECLARE_ALPHA_MASKBLIT(IntArgb, FourByteAbgrPre);
70DECLARE_SRCOVER_MASKBLIT(IntArgbPre, FourByteAbgrPre);
71DECLARE_ALPHA_MASKBLIT(IntArgbPre, FourByteAbgrPre);
72DECLARE_ALPHA_MASKBLIT(IntRgb, FourByteAbgrPre);
73DECLARE_SOLID_DRAWGLYPHLISTAA(FourByteAbgrPre);
74DECLARE_SOLID_DRAWGLYPHLISTLCD(FourByteAbgrPre);
75
76DECLARE_TRANSFORMHELPER_FUNCS(FourByteAbgrPre);
77
78NativePrimitive FourByteAbgrPrePrimitives[] = {
79 REGISTER_ANY4BYTE_ISOCOPY_BLIT(FourByteAbgrPre),
80 REGISTER_ANY4BYTE_ISOSCALE_BLIT(FourByteAbgrPre),
81 REGISTER_CONVERT_BLIT(FourByteAbgrPre, IntArgb),
82 REGISTER_CONVERT_BLIT(IntArgb, FourByteAbgrPre),
83 REGISTER_CONVERT_BLIT(IntRgb, FourByteAbgrPre),
84 REGISTER_CONVERT_BLIT(ThreeByteBgr, FourByteAbgrPre),
85 REGISTER_CONVERT_BLIT(ByteGray, FourByteAbgrPre),
86 REGISTER_CONVERT_BLIT(ByteIndexed, FourByteAbgrPre),
87 REGISTER_SCALE_BLIT(FourByteAbgrPre, IntArgb),
88 REGISTER_SCALE_BLIT(IntArgb, FourByteAbgrPre),
89 REGISTER_SCALE_BLIT(IntRgb, FourByteAbgrPre),
90 REGISTER_SCALE_BLIT(ThreeByteBgr, FourByteAbgrPre),
91 REGISTER_SCALE_BLIT(ByteGray, FourByteAbgrPre),
92 REGISTER_SCALE_BLIT(ByteIndexed, FourByteAbgrPre),
93 REGISTER_XPAR_CONVERT_BLIT(ByteIndexedBm, FourByteAbgrPre),
94 REGISTER_XPAR_SCALE_BLIT(ByteIndexedBm, FourByteAbgrPre),
95 REGISTER_XPAR_SCALE_BLIT(IntArgbBm, FourByteAbgrPre),
96 REGISTER_XPAR_BLITBG(ByteIndexedBm, FourByteAbgrPre),
97
98 REGISTER_XOR_BLIT(IntArgb, FourByteAbgrPre),
99 REGISTER_SRC_MASKFILL(FourByteAbgrPre),
100 REGISTER_SRCOVER_MASKFILL(FourByteAbgrPre),
101 REGISTER_ALPHA_MASKFILL(FourByteAbgrPre),
102 REGISTER_SRCOVER_MASKBLIT(IntArgb, FourByteAbgrPre),
103 REGISTER_ALPHA_MASKBLIT(IntArgb, FourByteAbgrPre),
104 REGISTER_SRCOVER_MASKBLIT(IntArgbPre, FourByteAbgrPre),
105 REGISTER_ALPHA_MASKBLIT(IntArgbPre, FourByteAbgrPre),
106 REGISTER_ALPHA_MASKBLIT(IntRgb, FourByteAbgrPre),
107 REGISTER_SOLID_DRAWGLYPHLISTAA(FourByteAbgrPre),
108 REGISTER_SOLID_DRAWGLYPHLISTLCD(FourByteAbgrPre),
109
110 REGISTER_TRANSFORMHELPER_FUNCS(FourByteAbgrPre),
111};
112
113jboolean RegisterFourByteAbgrPre(JNIEnv *env)
114{
115 return RegisterPrimitives(env, FourByteAbgrPrePrimitives,
116 ArraySize(FourByteAbgrPrePrimitives));
117}
118
119jint PixelForFourByteAbgrPre(SurfaceDataRasInfo *pRasInfo, jint rgb)
120{
121 jint a, r, g, b;
122 if ((rgb >> 24) == -1) {
123 return ((rgb << 8) | (((juint) rgb) >> 24));
124 }
125 ExtractIntDcmComponents1234(rgb, a, r, g, b);
126 r = MUL8(a, r);
127 g = MUL8(a, g);
128 b = MUL8(a, b);
129 return ComposeIntDcmComponents1234(r, g, b, a);
130}
131
132DEFINE_CONVERT_BLIT(FourByteAbgrPre, IntArgb, 1IntArgb)
133
134DEFINE_CONVERT_BLIT(IntArgb, FourByteAbgrPre, 4ByteArgb)
135
136DEFINE_CONVERT_BLIT(IntRgb, FourByteAbgrPre, 3ByteRgb)
137
138DEFINE_CONVERT_BLIT(ThreeByteBgr, FourByteAbgrPre, 3ByteRgb)
139
140DEFINE_CONVERT_BLIT(ByteGray, FourByteAbgrPre, 3ByteRgb)
141
142DEFINE_CONVERT_BLIT_LUT8(ByteIndexed, FourByteAbgrPre, ConvertOnTheFly)
143
144DEFINE_SCALE_BLIT(FourByteAbgrPre, IntArgb, 1IntArgb)
145
146DEFINE_SCALE_BLIT(IntArgb, FourByteAbgrPre, 4ByteArgb)
147
148DEFINE_SCALE_BLIT(IntRgb, FourByteAbgrPre, 3ByteRgb)
149
150DEFINE_SCALE_BLIT(ThreeByteBgr, FourByteAbgrPre, 3ByteRgb)
151
152DEFINE_SCALE_BLIT(ByteGray, FourByteAbgrPre, 3ByteRgb)
153
154DEFINE_SCALE_BLIT_LUT8(ByteIndexed, FourByteAbgrPre, ConvertOnTheFly)
155
156DEFINE_XPAR_CONVERT_BLIT_LUT8(ByteIndexedBm, FourByteAbgrPre,ConvertOnTheFly)
157
158DEFINE_XPAR_SCALE_BLIT_LUT8(ByteIndexedBm, FourByteAbgrPre,ConvertOnTheFly)
159
160DEFINE_XPAR_SCALE_BLIT(IntArgbBm, FourByteAbgrPre, 1IntRgb)
161
162DEFINE_XPAR_BLITBG_LUT8(ByteIndexedBm, FourByteAbgrPre, ConvertOnTheFly)
163
164DEFINE_XOR_BLIT(IntArgb, FourByteAbgrPre, Any4Byte)
165
166DEFINE_SRC_MASKFILL(FourByteAbgrPre, 4ByteArgb)
167
168DEFINE_SRCOVER_MASKFILL(FourByteAbgrPre, 4ByteArgb)
169
170DEFINE_ALPHA_MASKFILL(FourByteAbgrPre, 4ByteArgb)
171
172DEFINE_SRCOVER_MASKBLIT(IntArgb, FourByteAbgrPre, 4ByteArgb)
173
174DEFINE_ALPHA_MASKBLIT(IntArgb, FourByteAbgrPre, 4ByteArgb)
175
176DEFINE_SRCOVER_MASKBLIT(IntArgbPre, FourByteAbgrPre, 4ByteArgb)
177
178DEFINE_ALPHA_MASKBLIT(IntArgbPre, FourByteAbgrPre, 4ByteArgb)
179
180DEFINE_ALPHA_MASKBLIT(IntRgb, FourByteAbgrPre, 4ByteArgb)
181
182DEFINE_SOLID_DRAWGLYPHLISTAA(FourByteAbgrPre, 4ByteArgb)
183
184DEFINE_SOLID_DRAWGLYPHLISTLCD(FourByteAbgrPre, 4ByteArgb)
185
186DEFINE_TRANSFORMHELPERS(FourByteAbgrPre)