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