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 "Ushort555Rgbx.h"
28 
29 #include "IntArgb.h"
30 #include "IntArgbBm.h"
31 #include "ThreeByteBgr.h"
32 #include "ByteGray.h"
33 #include "ByteIndexed.h"
34 
35 /*
36  * This file declares, registers, and defines the various graphics
37  * primitive loops to manipulate surfaces of type "Ushort555Rgbx".
38  *
39  * See also LoopMacros.h
40  */
41 
42 RegisterFunc RegisterUshort555Rgbx;
43 
44 DECLARE_CONVERT_BLIT(Ushort555Rgbx, IntArgb);
45 DECLARE_CONVERT_BLIT(IntArgb, Ushort555Rgbx);
46 DECLARE_CONVERT_BLIT(ThreeByteBgr, Ushort555Rgbx);
47 DECLARE_CONVERT_BLIT(ByteGray, Ushort555Rgbx);
48 DECLARE_CONVERT_BLIT(ByteIndexed, Ushort555Rgbx);
49 DECLARE_SCALE_BLIT(Ushort555Rgbx, IntArgb);
50 DECLARE_SCALE_BLIT(IntArgb, Ushort555Rgbx);
51 DECLARE_SCALE_BLIT(ThreeByteBgr, Ushort555Rgbx);
52 DECLARE_SCALE_BLIT(ByteGray, Ushort555Rgbx);
53 DECLARE_SCALE_BLIT(ByteIndexed, Ushort555Rgbx);
54 DECLARE_XPAR_CONVERT_BLIT(ByteIndexedBm, Ushort555Rgbx);
55 DECLARE_XPAR_SCALE_BLIT(ByteIndexedBm, Ushort555Rgbx);
56 DECLARE_XPAR_SCALE_BLIT(IntArgbBm, Ushort555Rgbx);
57 DECLARE_XPAR_BLITBG(ByteIndexedBm, Ushort555Rgbx);
58 DECLARE_XOR_BLIT(IntArgb, Ushort555Rgbx);
59 DECLARE_SOLID_DRAWGLYPHLISTAA(Ushort555Rgbx);
60 DECLARE_SOLID_DRAWGLYPHLISTLCD(Ushort555Rgbx);
61 
62 NativePrimitive Ushort555RgbxPrimitives[] = {
63     REGISTER_ANYSHORT_ISOCOPY_BLIT(Ushort555Rgbx),
64     REGISTER_ANYSHORT_ISOSCALE_BLIT(Ushort555Rgbx),
65     REGISTER_ANYSHORT_ISOXOR_BLIT(Ushort555Rgbx),
66     REGISTER_CONVERT_BLIT(Ushort555Rgbx, IntArgb),
67     REGISTER_CONVERT_BLIT(IntArgb, Ushort555Rgbx),
68     REGISTER_CONVERT_BLIT_EQUIV(IntRgb, Ushort555Rgbx,
69                                 NAME_CONVERT_BLIT(IntArgb, Ushort555Rgbx)),
70     REGISTER_CONVERT_BLIT(ThreeByteBgr, Ushort555Rgbx),
71     REGISTER_CONVERT_BLIT(ByteGray, Ushort555Rgbx),
72     REGISTER_CONVERT_BLIT(ByteIndexed, Ushort555Rgbx),
73     REGISTER_SCALE_BLIT(Ushort555Rgbx, IntArgb),
74     REGISTER_SCALE_BLIT(IntArgb, Ushort555Rgbx),
75     REGISTER_SCALE_BLIT_EQUIV(IntRgb, Ushort555Rgbx,
76                               NAME_SCALE_BLIT(IntArgb, Ushort555Rgbx)),
77     REGISTER_SCALE_BLIT(ThreeByteBgr, Ushort555Rgbx),
78     REGISTER_SCALE_BLIT(ByteGray, Ushort555Rgbx),
79     REGISTER_SCALE_BLIT(ByteIndexed, Ushort555Rgbx),
80     REGISTER_XPAR_CONVERT_BLIT(ByteIndexedBm, Ushort555Rgbx),
81     REGISTER_XPAR_SCALE_BLIT(ByteIndexedBm, Ushort555Rgbx),
82     REGISTER_XPAR_SCALE_BLIT(IntArgbBm, Ushort555Rgbx),
83     REGISTER_XPAR_BLITBG(ByteIndexedBm, Ushort555Rgbx),
84     REGISTER_XOR_BLIT(IntArgb, Ushort555Rgbx),
85     REGISTER_SOLID_DRAWGLYPHLISTAA(Ushort555Rgbx),
86     REGISTER_SOLID_DRAWGLYPHLISTLCD(Ushort555Rgbx),
87 };
88 
RegisterUshort555Rgbx(JNIEnv * env)89 jboolean RegisterUshort555Rgbx(JNIEnv *env)
90 {
91     return RegisterPrimitives(env, Ushort555RgbxPrimitives,
92                               ArraySize(Ushort555RgbxPrimitives));
93 }
94 
PixelForUshort555Rgbx(SurfaceDataRasInfo * pRasInfo,jint rgb)95 jint PixelForUshort555Rgbx(SurfaceDataRasInfo *pRasInfo, jint rgb)
96 {
97     return IntArgbToUshort555Rgbx(rgb);
98 }
99 
100 DEFINE_CONVERT_BLIT(Ushort555Rgbx, IntArgb, 3ByteRgb)
101 
102 DEFINE_CONVERT_BLIT(IntArgb, Ushort555Rgbx, 1IntRgb)
103 
104 DEFINE_CONVERT_BLIT(ThreeByteBgr, Ushort555Rgbx, 3ByteRgb)
105 
106 DEFINE_CONVERT_BLIT(ByteGray, Ushort555Rgbx, 3ByteRgb)
107 
108 DEFINE_CONVERT_BLIT_LUT8(ByteIndexed, Ushort555Rgbx, PreProcessLut)
109 
110 DEFINE_SCALE_BLIT(Ushort555Rgbx, IntArgb, 3ByteRgb)
111 
112 DEFINE_SCALE_BLIT(IntArgb, Ushort555Rgbx, 1IntRgb)
113 
114 DEFINE_SCALE_BLIT(ThreeByteBgr, Ushort555Rgbx, 3ByteRgb)
115 
116 DEFINE_SCALE_BLIT(ByteGray, Ushort555Rgbx, 3ByteRgb)
117 
118 DEFINE_SCALE_BLIT_LUT8(ByteIndexed, Ushort555Rgbx, PreProcessLut)
119 
120 DEFINE_XPAR_CONVERT_BLIT_LUT8(ByteIndexedBm, Ushort555Rgbx, PreProcessLut)
121 
122 DEFINE_XPAR_SCALE_BLIT_LUT8(ByteIndexedBm, Ushort555Rgbx, PreProcessLut)
123 
124 DEFINE_XPAR_SCALE_BLIT(IntArgbBm, Ushort555Rgbx, 1IntRgb)
125 
126 DEFINE_XPAR_BLITBG_LUT8(ByteIndexedBm, Ushort555Rgbx, PreProcessLut)
127 
128 DEFINE_XOR_BLIT(IntArgb, Ushort555Rgbx, AnyShort)
129 
130 DEFINE_SOLID_DRAWGLYPHLISTAA(Ushort555Rgbx, 3ByteRgb)
131 
132 DEFINE_SOLID_DRAWGLYPHLISTLCD(Ushort555Rgbx, 3ByteRgb)
133