Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/openjdk-multiarch-jdk8u
Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/solaris/native/sun/java2d/loops/java2d_Mlib.h
32288 views
1
/*
2
* Copyright (c) 2003, 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
#ifndef Java2d_Mlib_h_Included
27
#define Java2d_Mlib_h_Included
28
29
#include <mlib_image.h>
30
#include "mlib_ImageCopy.h"
31
32
#include "AnyByte.h"
33
#include "Any3Byte.h"
34
#include "Any4Byte.h"
35
#include "AnyShort.h"
36
#include "AnyInt.h"
37
#include "IntArgb.h"
38
#include "IntArgbBm.h"
39
#include "IntRgb.h"
40
#include "ByteGray.h"
41
#include "ByteIndexed.h"
42
#include "Index8Gray.h"
43
#include "Index12Gray.h"
44
45
/***************************************************************/
46
47
#ifdef MLIB_ADD_SUFF
48
#define ADD_SUFF(x) x##_F
49
#else
50
#define ADD_SUFF(x) x
51
#endif
52
53
/***************************************************************/
54
55
#define MLIB_AnyByte MLIB_BYTE
56
#define MLIB_Any3Byte MLIB_BYTE
57
#define MLIB_Any4Byte MLIB_BYTE
58
#define MLIB_AnyShort MLIB_SHORT
59
#define MLIB_AnyInt MLIB_INT
60
61
/***************************************************************/
62
63
#define NCHAN_AnyByte 1
64
#define NCHAN_Any3Byte 3
65
#define NCHAN_Any4Byte 4
66
#define NCHAN_AnyShort 1
67
#define NCHAN_AnyInt 1
68
69
/***************************************************************/
70
71
#define BLIT_PARAMS \
72
void *srcBase, void *dstBase, \
73
juint width, juint height, \
74
SurfaceDataRasInfo *pSrcInfo, \
75
SurfaceDataRasInfo *pDstInfo, \
76
NativePrimitive *pPrim, \
77
CompositeInfo *pCompInfo
78
79
#define BLIT_CALL_PARAMS \
80
srcBase, dstBase, width, height, \
81
pSrcInfo, pDstInfo, pPrim, pCompInfo
82
83
/***************************************************************/
84
85
#define SCALE_PARAMS \
86
void *srcBase, void *dstBase, \
87
juint width, juint height, \
88
jint sxloc, jint syloc, \
89
jint sxinc, jint syinc, jint shift, \
90
SurfaceDataRasInfo * pSrcInfo, \
91
SurfaceDataRasInfo * pDstInfo, \
92
NativePrimitive * pPrim, \
93
CompositeInfo * pCompInfo
94
95
#define SCALE_CALL_PARAMS \
96
srcBase, dstBase, width, height, \
97
sxloc, syloc, sxinc, syinc, shift, \
98
pSrcInfo, pDstInfo, pPrim, pCompInfo
99
100
/***************************************************************/
101
102
#define BCOPY_PARAMS \
103
void *srcBase, void *dstBase, \
104
juint width, juint height, \
105
jint bgpixel, \
106
SurfaceDataRasInfo * pSrcInfo, \
107
SurfaceDataRasInfo * pDstInfo, \
108
NativePrimitive * pPrim, \
109
CompositeInfo * pCompInfo
110
111
#define BCOPY_CALL_PARAMS \
112
srcBase, dstBase, width, height, \
113
bgpixel, \
114
pSrcInfo, pDstInfo, pPrim, pCompInfo
115
116
/***************************************************************/
117
118
#define MASKBLIT_PARAMS \
119
void *dstBase, \
120
void *srcBase, \
121
jubyte *pMask, \
122
jint maskOff, \
123
jint maskScan, \
124
jint width, \
125
jint height, \
126
SurfaceDataRasInfo *pDstInfo, \
127
SurfaceDataRasInfo *pSrcInfo, \
128
NativePrimitive *pPrim, \
129
CompositeInfo *pCompInfo
130
131
#define MASKBLIT_CALL_PARAMS \
132
dstBase, srcBase, pMask, \
133
maskOff, maskScan, width, height, \
134
pSrcInfo, pDstInfo, pPrim, pCompInfo
135
136
/***************************************************************/
137
138
#define GLYPH_LIST_PARAMS \
139
SurfaceDataRasInfo * pRasInfo, \
140
ImageRef *glyphs, \
141
jint totalGlyphs, \
142
jint fgpixel, jint argbcolor, \
143
jint clipLeft, jint clipTop, \
144
jint clipRight, jint clipBottom, \
145
NativePrimitive * pPrim, \
146
CompositeInfo * pCompInfo
147
148
/***************************************************************/
149
150
#define MLIB_IMAGE_SET(image, data_type, nchan, w, h, scan, data_ptr) \
151
image->type = data_type; \
152
image->channels = nchan; \
153
image->width = w; \
154
image->height = h; \
155
image->stride = scan; \
156
image->data = (void*)(data_ptr)
157
158
/***************************************************************/
159
160
#define PTR_ADD(ptr, scan) \
161
ptr = (void*)((mlib_u8*)(ptr) + (scan))
162
163
/***************************************************************/
164
165
#define EXTRACT_CONST_1(pixel) \
166
mlib_s32 pixel##0 = pixel
167
168
#define EXTRACT_CONST_3(pixel) \
169
mlib_s32 pixel##0 = pixel; \
170
mlib_s32 pixel##1 = pixel >> 8; \
171
mlib_s32 pixel##2 = pixel >> 16
172
173
#define EXTRACT_CONST_4(pixel) \
174
mlib_s32 pixel##0 = pixel; \
175
mlib_s32 pixel##1 = pixel >> 8; \
176
mlib_s32 pixel##2 = pixel >> 16; \
177
mlib_s32 pixel##3 = pixel >> 24
178
179
/***************************************************************/
180
181
#define STORE_CONST_1(ptr, pixel) \
182
ptr[0] = pixel
183
184
#define STORE_CONST_3(ptr, pixel) \
185
ptr[0] = pixel; \
186
ptr[1] = pixel >> 8; \
187
ptr[2] = pixel >> 16
188
189
#define STORE_CONST_4(ptr, pixel) \
190
ptr[0] = pixel; \
191
ptr[1] = pixel >> 8; \
192
ptr[2] = pixel >> 16; \
193
ptr[3] = pixel >> 24
194
195
/***************************************************************/
196
197
#define PROCESS_PIX_1(BODY) \
198
BODY(i, 0)
199
200
#define PROCESS_PIX_3(BODY) \
201
BODY(3*i, 0); \
202
BODY(3*i + 1, 1); \
203
BODY(3*i + 2, 2)
204
205
#define PROCESS_PIX_4(BODY) \
206
BODY(4*i, 0); \
207
BODY(4*i + 1, 1); \
208
BODY(4*i + 2, 2); \
209
BODY(4*i + 3, 3)
210
211
/***************************************************************/
212
213
#define LOOP_DST(TYPE, NCHAN, dstBase, dstScan, BODY) \
214
{ \
215
TYPE##DataType *dst_ptr = (void*)(dstBase); \
216
mlib_s32 i, j; \
217
j = 0; \
218
do { \
219
i = 0; \
220
do { \
221
PROCESS_PIX_##NCHAN(BODY); \
222
i++; \
223
} while (i < width); \
224
PTR_ADD(dst_ptr, dstScan); \
225
j++; \
226
} while (j < height); \
227
}
228
229
#define LOOP_DST_SRC(TYPE, NCHAN, dstBase, dstScan, \
230
srcBase, srcScan, BODY) \
231
{ \
232
TYPE##DataType *dst_ptr = (void*)(dstBase); \
233
TYPE##DataType *src_ptr = (void*)(srcBase); \
234
mlib_s32 i, j; \
235
for (j = 0; j < height; j++) { \
236
for (i = 0; i < width; i++) { \
237
PROCESS_PIX_##NCHAN(BODY); \
238
} \
239
PTR_ADD(dst_ptr, dstScan); \
240
PTR_ADD(src_ptr, srcScan); \
241
} \
242
}
243
244
/***************************************************************/
245
246
#define LOAD_2F32(ptr, ind0, ind1) \
247
vis_freg_pair(((mlib_f32*)(ptr))[ind0], ((mlib_f32*)(ptr))[ind1])
248
249
/***************************************************************/
250
251
#define LOAD_NEXT_U8(dd, ptr) \
252
dd = vis_faligndata(vis_ld_u8(ptr), dd)
253
254
/***************************************************************/
255
256
#define LOAD_NEXT_U16(dd, ptr) \
257
dd = vis_faligndata(vis_ld_u16(ptr), dd)
258
259
/***************************************************************/
260
261
jboolean checkSameLut(jint * SrcReadLut,
262
jint * DstReadLut,
263
SurfaceDataRasInfo * pSrcInfo,
264
SurfaceDataRasInfo * pDstInfo);
265
266
void ADD_SUFF(AnyByteIsomorphicCopy)(BLIT_PARAMS);
267
268
void ADD_SUFF(AnyByteIsomorphicScaleCopy)(SCALE_PARAMS);
269
270
void ADD_SUFF(AnyByteSetRect)(SurfaceDataRasInfo * pRasInfo,
271
jint lox, jint loy, jint hix,
272
jint hiy, jint pixel,
273
NativePrimitive * pPrim,
274
CompositeInfo * pCompInfo);
275
276
void ADD_SUFF(Any4ByteSetRect)(SurfaceDataRasInfo * pRasInfo,
277
jint lox, jint loy, jint hix,
278
jint hiy, jint pixel,
279
NativePrimitive * pPrim,
280
CompositeInfo * pCompInfo);
281
282
void ADD_SUFF(Any3ByteSetRect)(SurfaceDataRasInfo * pRasInfo,
283
jint lox, jint loy, jint hix,
284
jint hiy, jint pixel,
285
NativePrimitive * pPrim,
286
CompositeInfo * pCompInfo);
287
288
void ADD_SUFF(AnyIntSetRect)(SurfaceDataRasInfo * pRasInfo,
289
jint lox, jint loy, jint hix,
290
jint hiy, jint pixel,
291
NativePrimitive * pPrim,
292
CompositeInfo * pCompInfo);
293
294
void AnyByteSetRect(SurfaceDataRasInfo * pRasInfo,
295
jint lox, jint loy, jint hix,
296
jint hiy, jint pixel,
297
NativePrimitive * pPrim,
298
CompositeInfo * pCompInfo);
299
300
void AnyIntSetRect(SurfaceDataRasInfo * pRasInfo,
301
jint lox, jint loy, jint hix,
302
jint hiy, jint pixel,
303
NativePrimitive * pPrim,
304
CompositeInfo * pCompInfo);
305
306
void ADD_SUFF(IntArgbToByteGrayConvert)(BLIT_PARAMS);
307
void ADD_SUFF(ByteGrayToIntArgbConvert)(BLIT_PARAMS);
308
void ADD_SUFF(FourByteAbgrToIntArgbConvert)(BLIT_PARAMS);
309
void ADD_SUFF(IntArgbToFourByteAbgrConvert)(BLIT_PARAMS);
310
void ADD_SUFF(ThreeByteBgrToIntArgbConvert)(BLIT_PARAMS);
311
void ADD_SUFF(TreeByteBgrToIntArgbConvert)(BLIT_PARAMS);
312
void ADD_SUFF(IntArgbPreToIntArgbConvert)(BLIT_PARAMS);
313
void ADD_SUFF(FourByteAbgrToIntArgbScaleConvert)(SCALE_PARAMS);
314
void ADD_SUFF(ByteGrayToIntArgbPreConvert)(BLIT_PARAMS);
315
void ADD_SUFF(IntArgbToIntArgbPreConvert)(BLIT_PARAMS);
316
void ADD_SUFF(IntRgbToIntArgbPreConvert)(BLIT_PARAMS);
317
void ADD_SUFF(ThreeByteBgrToIntArgbPreConvert)(BLIT_PARAMS);
318
void ADD_SUFF(ByteGrayToIntArgbPreScaleConvert)(SCALE_PARAMS);
319
void ADD_SUFF(IntArgbToIntArgbPreScaleConvert)(SCALE_PARAMS);
320
void ADD_SUFF(IntRgbToIntArgbPreScaleConvert)(SCALE_PARAMS);
321
void ADD_SUFF(ThreeByteBgrToIntArgbPreScaleConvert)(SCALE_PARAMS);
322
void ADD_SUFF(ByteIndexedToFourByteAbgrConvert)(BLIT_PARAMS);
323
void ADD_SUFF(ByteIndexedBmToFourByteAbgrXparOver)(BLIT_PARAMS);
324
void ADD_SUFF(ByteIndexedBmToFourByteAbgrScaleXparOver)(SCALE_PARAMS);
325
void ADD_SUFF(ByteIndexedToFourByteAbgrScaleConvert)(SCALE_PARAMS);
326
void ADD_SUFF(IntArgbToThreeByteBgrConvert)(BLIT_PARAMS);
327
void ADD_SUFF(IntArgbToUshortGrayConvert)(BLIT_PARAMS);
328
void ADD_SUFF(ByteIndexedBmToFourByteAbgrXparBgCopy)(BCOPY_PARAMS);
329
330
void IntArgbToThreeByteBgrConvert(BLIT_PARAMS);
331
332
/***************************************************************/
333
334
#endif /* Java2d_Mlib_h_Included */
335
336