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
46RegisterFunc RegisterIntBgr;
47
48DECLARE_CONVERT_BLIT(IntBgr, IntArgb);
49DECLARE_CONVERT_BLIT(IntArgb, IntBgr);
50DECLARE_CONVERT_BLIT(ThreeByteBgr, IntBgr);
51DECLARE_CONVERT_BLIT(ByteIndexed, IntBgr);
52DECLARE_SCALE_BLIT(IntBgr, IntArgb);
53DECLARE_SCALE_BLIT(IntArgb, IntBgr);
54DECLARE_SCALE_BLIT(ThreeByteBgr, IntBgr);
55DECLARE_SCALE_BLIT(ByteIndexed, IntBgr);
56DECLARE_SCALE_BLIT(Index12Gray, IntArgb);
57DECLARE_XPAR_CONVERT_BLIT(ByteIndexedBm, IntBgr);
58DECLARE_XPAR_CONVERT_BLIT(IntArgbBm, IntBgr);
59DECLARE_XPAR_SCALE_BLIT(IntArgbBm, IntBgr);
60DECLARE_XPAR_SCALE_BLIT(ByteIndexedBm, IntBgr);
61DECLARE_XPAR_BLITBG(ByteIndexedBm, IntBgr);
62DECLARE_XPAR_BLITBG(IntArgbBm, IntBgr);
63
64/* ByteGray and Index12Gray to IntRgb same as <>Gray to IntBgr... */
65DECLARE_CONVERT_BLIT(ByteGray, IntRgb);
66DECLARE_SCALE_BLIT(ByteGray, IntRgb);
67DECLARE_CONVERT_BLIT(Index12Gray, IntArgb);
68
69DECLARE_XOR_BLIT(IntArgb, IntBgr);
70DECLARE_SRC_MASKFILL(IntBgr);
71DECLARE_SRCOVER_MASKFILL(IntBgr);
72DECLARE_ALPHA_MASKFILL(IntBgr);
73DECLARE_SRCOVER_MASKBLIT(IntArgb, IntBgr);
74DECLARE_ALPHA_MASKBLIT(IntArgb, IntBgr);
75DECLARE_SRCOVER_MASKBLIT(IntArgbPre, IntBgr);
76DECLARE_ALPHA_MASKBLIT(IntArgbPre, IntBgr);
77DECLARE_ALPHA_MASKBLIT(IntRgb, IntBgr);
78DECLARE_ALPHA_MASKBLIT(IntBgr, IntBgr);
79DECLARE_SOLID_DRAWGLYPHLISTAA(IntBgr);
80DECLARE_SOLID_DRAWGLYPHLISTLCD(IntBgr);
81
82DECLARE_TRANSFORMHELPER_FUNCS(IntBgr);
83
84NativePrimitive 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
145jboolean RegisterIntBgr(JNIEnv *env)
146{
147 return RegisterPrimitives(env, IntBgrPrimitives,
148 ArraySize(IntBgrPrimitives));
149}
150
151jint PixelForIntBgr(SurfaceDataRasInfo *pRasInfo, jint rgb)
152{
153 return SwapIntDcmComponentsX123ToX321(rgb);
154}
155
156DEFINE_CONVERT_BLIT(IntBgr, IntArgb, 1IntRgb)
157
158DEFINE_CONVERT_BLIT(IntArgb, IntBgr, 1IntRgb)
159
160DEFINE_CONVERT_BLIT(ThreeByteBgr, IntBgr, 3ByteRgb)
161
162DEFINE_CONVERT_BLIT_LUT8(ByteIndexed, IntBgr, PreProcessLut)
163
164DEFINE_SCALE_BLIT(IntBgr, IntArgb, 1IntRgb)
165
166DEFINE_SCALE_BLIT(IntArgb, IntBgr, 1IntRgb)
167
168DEFINE_SCALE_BLIT(ThreeByteBgr, IntBgr, 3ByteRgb)
169
170DEFINE_SCALE_BLIT_LUT8(ByteIndexed, IntBgr, PreProcessLut)
171
172DEFINE_XPAR_CONVERT_BLIT_LUT8(ByteIndexedBm, IntBgr, PreProcessLut)
173
174DEFINE_XPAR_CONVERT_BLIT(IntArgbBm, IntBgr, 1IntRgb)
175
176DEFINE_XPAR_SCALE_BLIT(IntArgbBm, IntBgr, 1IntRgb)
177
178DEFINE_XPAR_SCALE_BLIT_LUT8(ByteIndexedBm, IntBgr, PreProcessLut)
179
180DEFINE_XPAR_BLITBG_LUT8(ByteIndexedBm, IntBgr, PreProcessLut)
181
182DEFINE_XPAR_BLITBG(IntArgbBm, IntBgr, 1IntRgb)
183
184DEFINE_XOR_BLIT(IntArgb, IntBgr, AnyInt)
185
186DEFINE_SRC_MASKFILL(IntBgr, 4ByteArgb)
187
188DEFINE_SRCOVER_MASKFILL(IntBgr, 4ByteArgb)
189
190DEFINE_ALPHA_MASKFILL(IntBgr, 4ByteArgb)
191
192DEFINE_SRCOVER_MASKBLIT(IntArgb, IntBgr, 4ByteArgb)
193
194DEFINE_ALPHA_MASKBLIT(IntArgb, IntBgr, 4ByteArgb)
195
196DEFINE_SRCOVER_MASKBLIT(IntArgbPre, IntBgr, 4ByteArgb)
197
198DEFINE_ALPHA_MASKBLIT(IntArgbPre, IntBgr, 4ByteArgb)
199
200DEFINE_ALPHA_MASKBLIT(IntRgb, IntBgr, 4ByteArgb)
201
202DEFINE_ALPHA_MASKBLIT(IntBgr, IntBgr, 4ByteArgb)
203
204DEFINE_SOLID_DRAWGLYPHLISTAA(IntBgr, 3ByteRgb)
205
206DEFINE_SOLID_DRAWGLYPHLISTLCD(IntBgr, 3ByteRgb)
207
208DEFINE_TRANSFORMHELPERS(IntBgr)
209