1 /*
2 * Copyright (c) 2000, 2005, Oracle and/or its affiliates. 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. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25
26 #include "AnyInt.h"
27 #include "IntBgr.h"
28 #include "AlphaMacros.h"
29
30 #include "IntArgb.h"
31 #include "IntArgbPre.h"
32 #include "IntArgbBm.h"
33 #include "IntRgb.h"
34 #include "ThreeByteBgr.h"
35 #include "ByteIndexed.h"
36 #include "Index8Gray.h"
37 #include "Index12Gray.h"
38
39 /*
40 * This file declares, registers, and defines the various graphics
41 * primitive loops to manipulate surfaces of type "IntBgr".
42 *
43 * See also LoopMacros.h
44 */
45
46 RegisterFunc RegisterIntBgr;
47
48 DECLARE_CONVERT_BLIT(IntBgr, IntArgb);
49 DECLARE_CONVERT_BLIT(IntArgb, IntBgr);
50 DECLARE_CONVERT_BLIT(ThreeByteBgr, IntBgr);
51 DECLARE_CONVERT_BLIT(ByteIndexed, IntBgr);
52 DECLARE_SCALE_BLIT(IntBgr, IntArgb);
53 DECLARE_SCALE_BLIT(IntArgb, IntBgr);
54 DECLARE_SCALE_BLIT(ThreeByteBgr, IntBgr);
55 DECLARE_SCALE_BLIT(ByteIndexed, IntBgr);
56 DECLARE_SCALE_BLIT(Index12Gray, IntArgb);
57 DECLARE_XPAR_CONVERT_BLIT(ByteIndexedBm, IntBgr);
58 DECLARE_XPAR_CONVERT_BLIT(IntArgbBm, IntBgr);
59 DECLARE_XPAR_SCALE_BLIT(IntArgbBm, IntBgr);
60 DECLARE_XPAR_SCALE_BLIT(ByteIndexedBm, IntBgr);
61 DECLARE_XPAR_BLITBG(ByteIndexedBm, IntBgr);
62 DECLARE_XPAR_BLITBG(IntArgbBm, IntBgr);
63
64 /* ByteGray and Index12Gray to IntRgb same as <>Gray to IntBgr... */
65 DECLARE_CONVERT_BLIT(ByteGray, IntRgb);
66 DECLARE_SCALE_BLIT(ByteGray, IntRgb);
67 DECLARE_CONVERT_BLIT(Index12Gray, IntArgb);
68
69 DECLARE_XOR_BLIT(IntArgb, IntBgr);
70 DECLARE_SRC_MASKFILL(IntBgr);
71 DECLARE_SRCOVER_MASKFILL(IntBgr);
72 DECLARE_ALPHA_MASKFILL(IntBgr);
73 DECLARE_SRCOVER_MASKBLIT(IntArgb, IntBgr);
74 DECLARE_ALPHA_MASKBLIT(IntArgb, IntBgr);
75 DECLARE_SRCOVER_MASKBLIT(IntArgbPre, IntBgr);
76 DECLARE_ALPHA_MASKBLIT(IntArgbPre, IntBgr);
77 DECLARE_ALPHA_MASKBLIT(IntRgb, IntBgr);
78 DECLARE_ALPHA_MASKBLIT(IntBgr, IntBgr);
79 DECLARE_SOLID_DRAWGLYPHLISTAA(IntBgr);
80 DECLARE_SOLID_DRAWGLYPHLISTLCD(IntBgr);
81
82 DECLARE_TRANSFORMHELPER_FUNCS(IntBgr);
83
84 NativePrimitive IntBgrPrimitives[] = {
85 REGISTER_ANYINT_ISOCOPY_BLIT(IntBgr),
86 REGISTER_ANYINT_ISOSCALE_BLIT(IntBgr),
87 REGISTER_ANYINT_ISOXOR_BLIT(IntBgr),
88 REGISTER_CONVERT_BLIT(IntBgr, IntArgb),
89 REGISTER_CONVERT_BLIT(IntArgb, IntBgr),
90 REGISTER_CONVERT_BLIT(ThreeByteBgr, IntBgr),
91 REGISTER_CONVERT_BLIT_EQUIV(IntRgb, IntBgr,
92 NAME_CONVERT_BLIT(IntArgb, IntBgr)),
93 REGISTER_CONVERT_BLIT_EQUIV(IntArgbBm, IntBgr,
94 NAME_CONVERT_BLIT(IntArgb, IntBgr)),
95 REGISTER_CONVERT_BLIT_EQUIV(IntBgr, IntRgb,
96 NAME_CONVERT_BLIT(IntArgb, IntBgr)),
97 REGISTER_CONVERT_BLIT(ByteIndexed, IntBgr),
98
99 REGISTER_SCALE_BLIT(IntBgr, IntArgb),
100 REGISTER_SCALE_BLIT(IntArgb, IntBgr),
101 REGISTER_SCALE_BLIT(ThreeByteBgr, IntBgr),
102 REGISTER_SCALE_BLIT_EQUIV(IntRgb, IntBgr,
103 NAME_SCALE_BLIT(IntArgb, IntBgr)),
104 REGISTER_SCALE_BLIT_EQUIV(IntArgbBm, IntBgr,
105 NAME_SCALE_BLIT(IntArgb, IntBgr)),
106 REGISTER_SCALE_BLIT_EQUIV(IntBgr, IntRgb,
107 NAME_SCALE_BLIT(IntArgb, IntBgr)),
108 REGISTER_SCALE_BLIT_EQUIV(Index8Gray, IntBgr,
109 NAME_SCALE_BLIT(ByteIndexed, IntArgb)),
110 REGISTER_SCALE_BLIT_EQUIV(Index12Gray, IntBgr,
111 NAME_SCALE_BLIT(Index12Gray, IntArgb)),
112 REGISTER_SCALE_BLIT(ByteIndexed, IntBgr),
113 REGISTER_XPAR_CONVERT_BLIT(ByteIndexedBm, IntBgr),
114 REGISTER_XPAR_CONVERT_BLIT(IntArgbBm, IntBgr),
115 REGISTER_XPAR_SCALE_BLIT(IntArgbBm, IntBgr),
116 REGISTER_XPAR_SCALE_BLIT(ByteIndexedBm, IntBgr),
117 REGISTER_XPAR_BLITBG(ByteIndexedBm, IntBgr),
118 REGISTER_XPAR_BLITBG(IntArgbBm, IntBgr),
119
120 REGISTER_CONVERT_BLIT_EQUIV(ByteGray, IntBgr,
121 NAME_CONVERT_BLIT(ByteGray, IntRgb)),
122 REGISTER_SCALE_BLIT_EQUIV(ByteGray, IntBgr,
123 NAME_SCALE_BLIT(ByteGray, IntRgb)),
124 REGISTER_CONVERT_BLIT_EQUIV(Index8Gray, IntBgr,
125 NAME_CONVERT_BLIT(ByteIndexed, IntArgb)),
126 REGISTER_CONVERT_BLIT_EQUIV(Index12Gray, IntBgr,
127 NAME_CONVERT_BLIT(Index12Gray, IntArgb)),
128
129 REGISTER_XOR_BLIT(IntArgb, IntBgr),
130 REGISTER_SRC_MASKFILL(IntBgr),
131 REGISTER_SRCOVER_MASKFILL(IntBgr),
132 REGISTER_ALPHA_MASKFILL(IntBgr),
133 REGISTER_SRCOVER_MASKBLIT(IntArgb, IntBgr),
134 REGISTER_ALPHA_MASKBLIT(IntArgb, IntBgr),
135 REGISTER_SRCOVER_MASKBLIT(IntArgbPre, IntBgr),
136 REGISTER_ALPHA_MASKBLIT(IntArgbPre, IntBgr),
137 REGISTER_ALPHA_MASKBLIT(IntRgb, IntBgr),
138 REGISTER_ALPHA_MASKBLIT(IntBgr, IntBgr),
139 REGISTER_SOLID_DRAWGLYPHLISTAA(IntBgr),
140 REGISTER_SOLID_DRAWGLYPHLISTLCD(IntBgr),
141
142 REGISTER_TRANSFORMHELPER_FUNCS(IntBgr),
143 };
144
RegisterIntBgr(JNIEnv * env)145 jboolean RegisterIntBgr(JNIEnv *env)
146 {
147 return RegisterPrimitives(env, IntBgrPrimitives,
148 ArraySize(IntBgrPrimitives));
149 }
150
PixelForIntBgr(SurfaceDataRasInfo * pRasInfo,jint rgb)151 jint PixelForIntBgr(SurfaceDataRasInfo *pRasInfo, jint rgb)
152 {
153 return SwapIntDcmComponentsX123ToX321(rgb);
154 }
155
156 DEFINE_CONVERT_BLIT(IntBgr, IntArgb, 1IntRgb)
157
158 DEFINE_CONVERT_BLIT(IntArgb, IntBgr, 1IntRgb)
159
160 DEFINE_CONVERT_BLIT(ThreeByteBgr, IntBgr, 3ByteRgb)
161
162 DEFINE_CONVERT_BLIT_LUT8(ByteIndexed, IntBgr, PreProcessLut)
163
164 DEFINE_SCALE_BLIT(IntBgr, IntArgb, 1IntRgb)
165
166 DEFINE_SCALE_BLIT(IntArgb, IntBgr, 1IntRgb)
167
168 DEFINE_SCALE_BLIT(ThreeByteBgr, IntBgr, 3ByteRgb)
169
170 DEFINE_SCALE_BLIT_LUT8(ByteIndexed, IntBgr, PreProcessLut)
171
172 DEFINE_XPAR_CONVERT_BLIT_LUT8(ByteIndexedBm, IntBgr, PreProcessLut)
173
174 DEFINE_XPAR_CONVERT_BLIT(IntArgbBm, IntBgr, 1IntRgb)
175
176 DEFINE_XPAR_SCALE_BLIT(IntArgbBm, IntBgr, 1IntRgb)
177
178 DEFINE_XPAR_SCALE_BLIT_LUT8(ByteIndexedBm, IntBgr, PreProcessLut)
179
180 DEFINE_XPAR_BLITBG_LUT8(ByteIndexedBm, IntBgr, PreProcessLut)
181
182 DEFINE_XPAR_BLITBG(IntArgbBm, IntBgr, 1IntRgb)
183
184 DEFINE_XOR_BLIT(IntArgb, IntBgr, AnyInt)
185
186 DEFINE_SRC_MASKFILL(IntBgr, 4ByteArgb)
187
188 DEFINE_SRCOVER_MASKFILL(IntBgr, 4ByteArgb)
189
190 DEFINE_ALPHA_MASKFILL(IntBgr, 4ByteArgb)
191
192 DEFINE_SRCOVER_MASKBLIT(IntArgb, IntBgr, 4ByteArgb)
193
194 DEFINE_ALPHA_MASKBLIT(IntArgb, IntBgr, 4ByteArgb)
195
196 DEFINE_SRCOVER_MASKBLIT(IntArgbPre, IntBgr, 4ByteArgb)
197
198 DEFINE_ALPHA_MASKBLIT(IntArgbPre, IntBgr, 4ByteArgb)
199
200 DEFINE_ALPHA_MASKBLIT(IntRgb, IntBgr, 4ByteArgb)
201
202 DEFINE_ALPHA_MASKBLIT(IntBgr, IntBgr, 4ByteArgb)
203
204 DEFINE_SOLID_DRAWGLYPHLISTAA(IntBgr, 3ByteRgb)
205
206 DEFINE_SOLID_DRAWGLYPHLISTLCD(IntBgr, 3ByteRgb)
207
208 DEFINE_TRANSFORMHELPERS(IntBgr)
209