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 "IntArgbPre.h" |
28 | #include "AlphaMacros.h" |
29 | |
30 | #include "IntArgb.h" |
31 | #include "IntRgb.h" |
32 | #include "ThreeByteBgr.h" |
33 | #include "ByteGray.h" |
34 | #include "ByteIndexed.h" |
35 | |
36 | /* |
37 | * This file declares, registers, and defines the various graphics |
38 | * primitive loops to manipulate surfaces of type "IntArgbPre". |
39 | * |
40 | * See also LoopMacros.h |
41 | */ |
42 | |
43 | RegisterFunc RegisterIntArgbPre; |
44 | |
45 | DECLARE_CONVERT_BLIT(IntArgbPre, IntArgb); |
46 | DECLARE_CONVERT_BLIT(IntArgb, IntArgbPre); |
47 | DECLARE_CONVERT_BLIT(IntRgb, IntArgbPre); |
48 | DECLARE_CONVERT_BLIT(ThreeByteBgr, IntArgbPre); |
49 | DECLARE_CONVERT_BLIT(ByteGray, IntArgbPre); |
50 | DECLARE_CONVERT_BLIT(ByteIndexed, IntArgbPre); |
51 | DECLARE_SCALE_BLIT(IntArgbPre, IntArgb); |
52 | DECLARE_SCALE_BLIT(IntArgb, IntArgbPre); |
53 | DECLARE_SCALE_BLIT(IntRgb, IntArgbPre); |
54 | DECLARE_SCALE_BLIT(ThreeByteBgr, IntArgbPre); |
55 | DECLARE_SCALE_BLIT(ByteGray, IntArgbPre); |
56 | DECLARE_SCALE_BLIT(ByteIndexed, IntArgbPre); |
57 | DECLARE_XPAR_CONVERT_BLIT(ByteIndexedBm, IntArgbPre); |
58 | DECLARE_XPAR_SCALE_BLIT(ByteIndexedBm, IntArgbPre); |
59 | DECLARE_XPAR_BLITBG(ByteIndexedBm, IntArgbPre); |
60 | |
61 | DECLARE_XOR_BLIT(IntArgb, IntArgbPre); |
62 | DECLARE_SRC_MASKFILL(IntArgbPre); |
63 | DECLARE_SRCOVER_MASKFILL(IntArgbPre); |
64 | DECLARE_ALPHA_MASKFILL(IntArgbPre); |
65 | DECLARE_SRCOVER_MASKBLIT(IntArgb, IntArgbPre); |
66 | DECLARE_ALPHA_MASKBLIT(IntArgb, IntArgbPre); |
67 | DECLARE_SRCOVER_MASKBLIT(IntArgbPre, IntArgbPre); |
68 | DECLARE_ALPHA_MASKBLIT(IntArgbPre, IntArgbPre); |
69 | DECLARE_ALPHA_MASKBLIT(IntRgb, IntArgbPre); |
70 | DECLARE_SOLID_DRAWGLYPHLISTAA(IntArgbPre); |
71 | DECLARE_SOLID_DRAWGLYPHLISTLCD(IntArgbPre); |
72 | |
73 | DECLARE_TRANSFORMHELPER_FUNCS(IntArgbPre); |
74 | |
75 | NativePrimitive IntArgbPrePrimitives[] = { |
76 | REGISTER_ANYINT_ISOCOPY_BLIT(IntArgbPre), |
77 | REGISTER_ANYINT_ISOSCALE_BLIT(IntArgbPre), |
78 | REGISTER_CONVERT_BLIT(IntArgbPre, IntArgb), |
79 | REGISTER_CONVERT_BLIT(IntArgb, IntArgbPre), |
80 | REGISTER_CONVERT_BLIT(IntRgb, IntArgbPre), |
81 | REGISTER_CONVERT_BLIT(ThreeByteBgr, IntArgbPre), |
82 | REGISTER_CONVERT_BLIT(ByteGray, IntArgbPre), |
83 | REGISTER_CONVERT_BLIT(ByteIndexed, IntArgbPre), |
84 | REGISTER_SCALE_BLIT(IntArgbPre, IntArgb), |
85 | REGISTER_SCALE_BLIT(IntArgb, IntArgbPre), |
86 | REGISTER_SCALE_BLIT(IntRgb, IntArgbPre), |
87 | REGISTER_SCALE_BLIT(ThreeByteBgr, IntArgbPre), |
88 | REGISTER_SCALE_BLIT(ByteGray, IntArgbPre), |
89 | REGISTER_SCALE_BLIT(ByteIndexed, IntArgbPre), |
90 | REGISTER_XPAR_CONVERT_BLIT(ByteIndexedBm, IntArgbPre), |
91 | REGISTER_XPAR_SCALE_BLIT(ByteIndexedBm, IntArgbPre), |
92 | REGISTER_XPAR_BLITBG(ByteIndexedBm, IntArgbPre), |
93 | |
94 | REGISTER_XOR_BLIT(IntArgb, IntArgbPre), |
95 | REGISTER_SRC_MASKFILL(IntArgbPre), |
96 | REGISTER_SRCOVER_MASKFILL(IntArgbPre), |
97 | REGISTER_ALPHA_MASKFILL(IntArgbPre), |
98 | REGISTER_SRCOVER_MASKBLIT(IntArgb, IntArgbPre), |
99 | REGISTER_ALPHA_MASKBLIT(IntArgb, IntArgbPre), |
100 | REGISTER_SRCOVER_MASKBLIT(IntArgbPre, IntArgbPre), |
101 | REGISTER_ALPHA_MASKBLIT(IntArgbPre, IntArgbPre), |
102 | REGISTER_ALPHA_MASKBLIT(IntRgb, IntArgbPre), |
103 | REGISTER_SOLID_DRAWGLYPHLISTAA(IntArgbPre), |
104 | REGISTER_SOLID_DRAWGLYPHLISTLCD(IntArgbPre), |
105 | |
106 | REGISTER_TRANSFORMHELPER_FUNCS(IntArgbPre), |
107 | }; |
108 | |
109 | jboolean RegisterIntArgbPre(JNIEnv *env) |
110 | { |
111 | return RegisterPrimitives(env, IntArgbPrePrimitives, |
112 | ArraySize(IntArgbPrePrimitives)); |
113 | } |
114 | |
115 | jint PixelForIntArgbPre(SurfaceDataRasInfo *pRasInfo, jint rgb) |
116 | { |
117 | jint a, r, g, b; |
118 | if (((rgb >> 24) + 1) == 0) { |
119 | return rgb; |
120 | } |
121 | ExtractIntDcmComponents1234(rgb, a, r, g, b); |
122 | r = MUL8(a, r); |
123 | g = MUL8(a, g); |
124 | b = MUL8(a, b); |
125 | return ComposeIntDcmComponents1234(a, r, g, b); |
126 | } |
127 | |
128 | DEFINE_CONVERT_BLIT(IntArgbPre, IntArgb, 1IntArgb) |
129 | |
130 | DEFINE_CONVERT_BLIT(IntArgb, IntArgbPre, 1IntArgb) |
131 | |
132 | DEFINE_CONVERT_BLIT(IntRgb, IntArgbPre, 1IntArgb) |
133 | |
134 | DEFINE_CONVERT_BLIT(ThreeByteBgr, IntArgbPre, 1IntArgb) |
135 | |
136 | DEFINE_CONVERT_BLIT(ByteGray, IntArgbPre, 1IntArgb) |
137 | |
138 | DEFINE_CONVERT_BLIT_LUT8(ByteIndexed, IntArgbPre, ConvertOnTheFly) |
139 | |
140 | DEFINE_SCALE_BLIT(IntArgbPre, IntArgb, 1IntArgb) |
141 | |
142 | DEFINE_SCALE_BLIT(IntArgb, IntArgbPre, 1IntArgb) |
143 | |
144 | DEFINE_SCALE_BLIT(IntRgb, IntArgbPre, 1IntArgb) |
145 | |
146 | DEFINE_SCALE_BLIT(ThreeByteBgr, IntArgbPre, 1IntArgb) |
147 | |
148 | DEFINE_SCALE_BLIT(ByteGray, IntArgbPre, 1IntArgb) |
149 | |
150 | DEFINE_SCALE_BLIT_LUT8(ByteIndexed, IntArgbPre, ConvertOnTheFly) |
151 | |
152 | DEFINE_XPAR_CONVERT_BLIT_LUT8(ByteIndexedBm, IntArgbPre, ConvertOnTheFly) |
153 | |
154 | DEFINE_XPAR_SCALE_BLIT_LUT8(ByteIndexedBm, IntArgbPre, ConvertOnTheFly) |
155 | |
156 | DEFINE_XPAR_BLITBG_LUT8(ByteIndexedBm, IntArgbPre, ConvertOnTheFly) |
157 | |
158 | DEFINE_XOR_BLIT(IntArgb, IntArgbPre, AnyInt) |
159 | |
160 | DEFINE_SRC_MASKFILL(IntArgbPre, 4ByteArgb) |
161 | |
162 | DEFINE_SRCOVER_MASKFILL(IntArgbPre, 4ByteArgb) |
163 | |
164 | DEFINE_ALPHA_MASKFILL(IntArgbPre, 4ByteArgb) |
165 | |
166 | DEFINE_SRCOVER_MASKBLIT(IntArgb, IntArgbPre, 4ByteArgb) |
167 | |
168 | DEFINE_ALPHA_MASKBLIT(IntArgb, IntArgbPre, 4ByteArgb) |
169 | |
170 | DEFINE_SRCOVER_MASKBLIT(IntArgbPre, IntArgbPre, 4ByteArgb) |
171 | |
172 | DEFINE_ALPHA_MASKBLIT(IntArgbPre, IntArgbPre, 4ByteArgb) |
173 | |
174 | DEFINE_ALPHA_MASKBLIT(IntRgb, IntArgbPre, 4ByteArgb) |
175 | |
176 | DEFINE_SOLID_DRAWGLYPHLISTAA(IntArgbPre, 4ByteArgb) |
177 | |
178 | DEFINE_SOLID_DRAWGLYPHLISTLCD(IntArgbPre, 4ByteArgb) |
179 | |
180 | DEFINE_TRANSFORMHELPERS(IntArgbPre) |
181 | |