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 "AnyShort.h"
27 #include "Ushort555Rgb.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 "Ushort555Rgb".
41  *
42  * See also LoopMacros.h
43  */
44 
45 RegisterFunc RegisterUshort555Rgb;
46 
47 DECLARE_CONVERT_BLIT(Ushort555Rgb, IntArgb);
48 DECLARE_CONVERT_BLIT(IntArgb, Ushort555Rgb);
49 DECLARE_CONVERT_BLIT(ThreeByteBgr, Ushort555Rgb);
50 DECLARE_CONVERT_BLIT(ByteGray, Ushort555Rgb);
51 DECLARE_CONVERT_BLIT(ByteIndexed, Ushort555Rgb);
52 DECLARE_SCALE_BLIT(Ushort555Rgb, IntArgb);
53 DECLARE_SCALE_BLIT(IntArgb, Ushort555Rgb);
54 DECLARE_SCALE_BLIT(ThreeByteBgr, Ushort555Rgb);
55 DECLARE_SCALE_BLIT(ByteGray, Ushort555Rgb);
56 DECLARE_SCALE_BLIT(ByteIndexed, Ushort555Rgb);
57 DECLARE_XPAR_CONVERT_BLIT(ByteIndexedBm, Ushort555Rgb);
58 DECLARE_XPAR_SCALE_BLIT(ByteIndexedBm, Ushort555Rgb);
59 DECLARE_XPAR_SCALE_BLIT(IntArgbBm, Ushort555Rgb);
60 DECLARE_XPAR_BLITBG(ByteIndexedBm, Ushort555Rgb);
61 DECLARE_XPAR_CONVERT_BLIT(IntArgbBm, Ushort555Rgb);
62 DECLARE_XPAR_BLITBG(IntArgbBm, Ushort555Rgb);
63 
64 DECLARE_XOR_BLIT(IntArgb, Ushort555Rgb);
65 DECLARE_SRC_MASKFILL(Ushort555Rgb);
66 DECLARE_SRCOVER_MASKFILL(Ushort555Rgb);
67 DECLARE_ALPHA_MASKFILL(Ushort555Rgb);
68 DECLARE_SRCOVER_MASKBLIT(IntArgb, Ushort555Rgb);
69 DECLARE_ALPHA_MASKBLIT(IntArgb, Ushort555Rgb);
70 DECLARE_SRCOVER_MASKBLIT(IntArgbPre, Ushort555Rgb);
71 DECLARE_ALPHA_MASKBLIT(IntArgbPre, Ushort555Rgb);
72 DECLARE_ALPHA_MASKBLIT(IntRgb, Ushort555Rgb);
73 DECLARE_SOLID_DRAWGLYPHLISTAA(Ushort555Rgb);
74 DECLARE_SOLID_DRAWGLYPHLISTLCD(Ushort555Rgb);
75 
76 NativePrimitive Ushort555RgbPrimitives[] = {
77     REGISTER_ANYSHORT_ISOCOPY_BLIT(Ushort555Rgb),
78     REGISTER_ANYSHORT_ISOSCALE_BLIT(Ushort555Rgb),
79     REGISTER_ANYSHORT_ISOXOR_BLIT(Ushort555Rgb),
80     REGISTER_CONVERT_BLIT(Ushort555Rgb, IntArgb),
81     REGISTER_CONVERT_BLIT(IntArgb, Ushort555Rgb),
82     REGISTER_CONVERT_BLIT_EQUIV(IntRgb, Ushort555Rgb,
83                                 NAME_CONVERT_BLIT(IntArgb, Ushort555Rgb)),
84     REGISTER_CONVERT_BLIT_EQUIV(IntArgbBm, Ushort555Rgb,
85                                 NAME_CONVERT_BLIT(IntArgb, Ushort555Rgb)),
86     REGISTER_CONVERT_BLIT(ThreeByteBgr, Ushort555Rgb),
87     REGISTER_CONVERT_BLIT(ByteGray, Ushort555Rgb),
88     REGISTER_CONVERT_BLIT(ByteIndexed, Ushort555Rgb),
89     REGISTER_SCALE_BLIT(Ushort555Rgb, IntArgb),
90     REGISTER_SCALE_BLIT(IntArgb, Ushort555Rgb),
91     REGISTER_SCALE_BLIT_EQUIV(IntRgb, Ushort555Rgb,
92                               NAME_SCALE_BLIT(IntArgb, Ushort555Rgb)),
93     REGISTER_SCALE_BLIT_EQUIV(IntArgbBm, Ushort555Rgb,
94                               NAME_SCALE_BLIT(IntArgb, Ushort555Rgb)),
95     REGISTER_SCALE_BLIT(ThreeByteBgr, Ushort555Rgb),
96     REGISTER_SCALE_BLIT(ByteGray, Ushort555Rgb),
97     REGISTER_SCALE_BLIT(ByteIndexed, Ushort555Rgb),
98     REGISTER_XPAR_CONVERT_BLIT(ByteIndexedBm, Ushort555Rgb),
99     REGISTER_XPAR_SCALE_BLIT(ByteIndexedBm, Ushort555Rgb),
100     REGISTER_XPAR_SCALE_BLIT(IntArgbBm, Ushort555Rgb),
101     REGISTER_XPAR_BLITBG(ByteIndexedBm, Ushort555Rgb),
102     REGISTER_XPAR_CONVERT_BLIT(IntArgbBm, Ushort555Rgb),
103     REGISTER_XPAR_BLITBG(IntArgbBm, Ushort555Rgb),
104 
105     REGISTER_XOR_BLIT(IntArgb, Ushort555Rgb),
106     REGISTER_SRC_MASKFILL(Ushort555Rgb),
107     REGISTER_SRCOVER_MASKFILL(Ushort555Rgb),
108     REGISTER_ALPHA_MASKFILL(Ushort555Rgb),
109     REGISTER_SRCOVER_MASKBLIT(IntArgb, Ushort555Rgb),
110     REGISTER_ALPHA_MASKBLIT(IntArgb, Ushort555Rgb),
111     REGISTER_SRCOVER_MASKBLIT(IntArgbPre, Ushort555Rgb),
112     REGISTER_ALPHA_MASKBLIT(IntArgbPre, Ushort555Rgb),
113     REGISTER_ALPHA_MASKBLIT(IntRgb, Ushort555Rgb),
114     REGISTER_SOLID_DRAWGLYPHLISTAA(Ushort555Rgb),
115     REGISTER_SOLID_DRAWGLYPHLISTLCD(Ushort555Rgb),
116 };
117 
RegisterUshort555Rgb(JNIEnv * env)118 jboolean RegisterUshort555Rgb(JNIEnv *env)
119 {
120     return RegisterPrimitives(env, Ushort555RgbPrimitives,
121                               ArraySize(Ushort555RgbPrimitives));
122 }
123 
PixelForUshort555Rgb(SurfaceDataRasInfo * pRasInfo,jint rgb)124 jint PixelForUshort555Rgb(SurfaceDataRasInfo *pRasInfo, jint rgb)
125 {
126     return IntArgbToUshort555Rgb(rgb);
127 }
128 
129 DEFINE_CONVERT_BLIT(Ushort555Rgb, IntArgb, 3ByteRgb)
130 
131 DEFINE_CONVERT_BLIT(IntArgb, Ushort555Rgb, 1IntRgb)
132 
133 DEFINE_CONVERT_BLIT(ThreeByteBgr, Ushort555Rgb, 3ByteRgb)
134 
135 DEFINE_CONVERT_BLIT(ByteGray, Ushort555Rgb, 3ByteRgb)
136 
137 DEFINE_CONVERT_BLIT_LUT8(ByteIndexed, Ushort555Rgb, PreProcessLut)
138 
139 DEFINE_SCALE_BLIT(Ushort555Rgb, IntArgb, 3ByteRgb)
140 
141 DEFINE_SCALE_BLIT(IntArgb, Ushort555Rgb, 1IntRgb)
142 
143 DEFINE_SCALE_BLIT(ThreeByteBgr, Ushort555Rgb, 3ByteRgb)
144 
145 DEFINE_SCALE_BLIT(ByteGray, Ushort555Rgb, 3ByteRgb)
146 
147 DEFINE_SCALE_BLIT_LUT8(ByteIndexed, Ushort555Rgb, PreProcessLut)
148 
149 DEFINE_XPAR_CONVERT_BLIT_LUT8(ByteIndexedBm, Ushort555Rgb, PreProcessLut)
150 
151 DEFINE_XPAR_SCALE_BLIT_LUT8(ByteIndexedBm, Ushort555Rgb, PreProcessLut)
152 
153 DEFINE_XPAR_SCALE_BLIT(IntArgbBm, Ushort555Rgb, 1IntRgb)
154 
155 DEFINE_XPAR_BLITBG_LUT8(ByteIndexedBm, Ushort555Rgb, PreProcessLut)
156 
157 DEFINE_XPAR_CONVERT_BLIT(IntArgbBm, Ushort555Rgb, 1IntRgb)
158 
159 DEFINE_XPAR_BLITBG(IntArgbBm, Ushort555Rgb, 1IntRgb)
160 
161 DEFINE_XOR_BLIT(IntArgb, Ushort555Rgb, AnyShort)
162 
163 DEFINE_SRC_MASKFILL(Ushort555Rgb, 4ByteArgb)
164 
165 DEFINE_SRCOVER_MASKFILL(Ushort555Rgb, 4ByteArgb)
166 
167 DEFINE_ALPHA_MASKFILL(Ushort555Rgb, 4ByteArgb)
168 
169 DEFINE_SRCOVER_MASKBLIT(IntArgb, Ushort555Rgb, 4ByteArgb)
170 
171 DEFINE_ALPHA_MASKBLIT(IntArgb, Ushort555Rgb, 4ByteArgb)
172 
173 DEFINE_SRCOVER_MASKBLIT(IntArgbPre, Ushort555Rgb, 4ByteArgb)
174 
175 DEFINE_ALPHA_MASKBLIT(IntArgbPre, Ushort555Rgb, 4ByteArgb)
176 
177 DEFINE_ALPHA_MASKBLIT(IntRgb, Ushort555Rgb, 4ByteArgb)
178 
179 DEFINE_SOLID_DRAWGLYPHLISTAA(Ushort555Rgb, 3ByteRgb)
180 
181 DEFINE_SOLID_DRAWGLYPHLISTLCD(Ushort555Rgb, 3ByteRgb)
182