Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/openjdk-multiarch-jdk8u
Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/share/native/sun/java2d/loops/GraphicsPrimitiveMgr.c
38918 views
1
/*
2
* Copyright (c) 2000, 2013, 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 "jni_util.h"
27
#include "jlong.h"
28
29
#include "sun_java2d_loops_GraphicsPrimitiveMgr.h"
30
31
#include "Region.h"
32
#include "GraphicsPrimitiveMgr.h"
33
#include "AlphaMacros.h"
34
35
static char *InitName = "<init>";
36
static char *InitSig = ("(JLsun/java2d/loops/SurfaceType;"
37
"Lsun/java2d/loops/CompositeType;"
38
"Lsun/java2d/loops/SurfaceType;)V");
39
40
static char *RegisterName = "register";
41
static char *RegisterSig = "([Lsun/java2d/loops/GraphicsPrimitive;)V";
42
43
static jclass GraphicsPrimitiveMgr;
44
static jclass GraphicsPrimitive;
45
46
static jmethodID RegisterID;
47
static jfieldID pNativePrimID;
48
static jfieldID pixelID;
49
static jfieldID eargbID;
50
static jfieldID clipRegionID;
51
static jfieldID compositeID;
52
static jfieldID lcdTextContrastID;
53
static jfieldID xorPixelID;
54
static jfieldID xorColorID;
55
static jfieldID alphaMaskID;
56
static jfieldID ruleID;
57
static jfieldID extraAlphaID;
58
59
static jfieldID m00ID;
60
static jfieldID m01ID;
61
static jfieldID m02ID;
62
static jfieldID m10ID;
63
static jfieldID m11ID;
64
static jfieldID m12ID;
65
66
static jmethodID getRgbID;
67
68
static jboolean InitPrimTypes(JNIEnv *env);
69
static jboolean InitSurfaceTypes(JNIEnv *env, jclass SurfaceType);
70
static jboolean InitCompositeTypes(JNIEnv *env, jclass CompositeType);
71
72
jfieldID path2DTypesID;
73
jfieldID path2DNumTypesID;
74
jfieldID path2DWindingRuleID;
75
jfieldID path2DFloatCoordsID;
76
jfieldID sg2dStrokeHintID;
77
jint sunHints_INTVAL_STROKE_PURE;
78
79
/*
80
* Class: sun_java2d_loops_GraphicsPrimitiveMgr
81
* Method: initIDs
82
* Signature: (Ljava/lang/Class;Ljava/lang/Class;Ljava/lang/Class;Ljava/lang/Class;Ljava/lang/Class;Ljava/lang/Class;Ljava/lang/Class;)V
83
*/
84
JNIEXPORT void JNICALL
85
Java_sun_java2d_loops_GraphicsPrimitiveMgr_initIDs
86
(JNIEnv *env, jclass GPMgr,
87
jclass GP, jclass ST, jclass CT,
88
jclass SG2D, jclass Color, jclass AT,
89
jclass XORComp, jclass AlphaComp,
90
jclass Path2D, jclass Path2DFloat,
91
jclass SHints)
92
{
93
jfieldID fid;
94
initAlphaTables();
95
GraphicsPrimitiveMgr = (*env)->NewGlobalRef(env, GPMgr);
96
GraphicsPrimitive = (*env)->NewGlobalRef(env, GP);
97
if (GraphicsPrimitiveMgr == NULL || GraphicsPrimitive == NULL) {
98
JNU_ThrowOutOfMemoryError(env, "creating global refs");
99
return;
100
}
101
if (!InitPrimTypes(env) ||
102
!InitSurfaceTypes(env, ST) ||
103
!InitCompositeTypes(env, CT))
104
{
105
return;
106
}
107
108
CHECK_NULL(RegisterID =
109
(*env)->GetStaticMethodID(env, GPMgr, RegisterName, RegisterSig));
110
CHECK_NULL(pNativePrimID = (*env)->GetFieldID(env, GP, "pNativePrim", "J"));
111
CHECK_NULL(pixelID = (*env)->GetFieldID(env, SG2D, "pixel", "I"));
112
CHECK_NULL(eargbID = (*env)->GetFieldID(env, SG2D, "eargb", "I"));
113
CHECK_NULL(clipRegionID =
114
(*env)->GetFieldID(env, SG2D, "clipRegion", "Lsun/java2d/pipe/Region;"));
115
CHECK_NULL(compositeID =
116
(*env)->GetFieldID(env, SG2D, "composite", "Ljava/awt/Composite;"));
117
CHECK_NULL(lcdTextContrastID =
118
(*env)->GetFieldID(env, SG2D, "lcdTextContrast", "I"));
119
CHECK_NULL(getRgbID = (*env)->GetMethodID(env, Color, "getRGB", "()I"));
120
CHECK_NULL(xorPixelID = (*env)->GetFieldID(env, XORComp, "xorPixel", "I"));
121
CHECK_NULL(xorColorID =
122
(*env)->GetFieldID(env, XORComp, "xorColor", "Ljava/awt/Color;"));
123
CHECK_NULL(alphaMaskID =
124
(*env)->GetFieldID(env, XORComp, "alphaMask", "I"));
125
CHECK_NULL(ruleID = (*env)->GetFieldID(env, AlphaComp, "rule", "I"));
126
CHECK_NULL(extraAlphaID =
127
(*env)->GetFieldID(env, AlphaComp, "extraAlpha", "F"));
128
129
130
CHECK_NULL(m00ID = (*env)->GetFieldID(env, AT, "m00", "D"));
131
CHECK_NULL(m01ID = (*env)->GetFieldID(env, AT, "m01", "D"));
132
CHECK_NULL(m02ID = (*env)->GetFieldID(env, AT, "m02", "D"));
133
CHECK_NULL(m10ID = (*env)->GetFieldID(env, AT, "m10", "D"));
134
CHECK_NULL(m11ID = (*env)->GetFieldID(env, AT, "m11", "D"));
135
CHECK_NULL(m12ID = (*env)->GetFieldID(env, AT, "m12", "D"));
136
137
CHECK_NULL(path2DTypesID =
138
(*env)->GetFieldID(env, Path2D, "pointTypes", "[B"));
139
CHECK_NULL(path2DNumTypesID =
140
(*env)->GetFieldID(env, Path2D, "numTypes", "I"));
141
CHECK_NULL(path2DWindingRuleID =
142
(*env)->GetFieldID(env, Path2D, "windingRule", "I"));
143
CHECK_NULL(path2DFloatCoordsID =
144
(*env)->GetFieldID(env, Path2DFloat, "floatCoords", "[F"));
145
CHECK_NULL(sg2dStrokeHintID =
146
(*env)->GetFieldID(env, SG2D, "strokeHint", "I"));
147
CHECK_NULL(fid =
148
(*env)->GetStaticFieldID(env, SHints, "INTVAL_STROKE_PURE", "I"));
149
sunHints_INTVAL_STROKE_PURE = (*env)->GetStaticIntField(env, SHints, fid);
150
}
151
152
void GrPrim_RefineBounds(SurfaceDataBounds *bounds, jint transX, jint transY,
153
jfloat *coords, jint maxCoords)
154
{
155
jint xmin, ymin, xmax, ymax;
156
if (maxCoords > 1) {
157
xmin = xmax = transX + (jint)(*coords++ + 0.5);
158
ymin = ymax = transY + (jint)(*coords++ + 0.5);
159
for (;maxCoords > 1; maxCoords -= 2) {
160
jint x = transX + (jint)(*coords++ + 0.5);
161
jint y = transY + (jint)(*coords++ + 0.5);
162
if (xmin > x) xmin = x;
163
if (ymin > y) ymin = y;
164
if (xmax < x) xmax = x;
165
if (ymax < y) ymax = y;
166
}
167
if (++xmax < xmin) xmax--;
168
if (++ymax < ymin) ymax--;
169
if (bounds->x1 < xmin) bounds->x1 = xmin;
170
if (bounds->y1 < ymin) bounds->y1 = ymin;
171
if (bounds->x2 > xmax) bounds->x2 = xmax;
172
if (bounds->y2 > ymax) bounds->y2 = ymax;
173
} else {
174
bounds->x2 = bounds->x1;
175
bounds->y2 = bounds->y1;
176
}
177
}
178
179
/*
180
* Class: sun_java2d_loops_GraphicsPrimitiveMgr
181
* Method: registerNativeLoops
182
* Signature: ()V
183
*/
184
JNIEXPORT void JNICALL
185
Java_sun_java2d_loops_GraphicsPrimitiveMgr_registerNativeLoops
186
(JNIEnv *env, jclass GPMgr)
187
{
188
RegisterFunc RegisterAnyByte;
189
RegisterFunc RegisterByteBinary1Bit;
190
RegisterFunc RegisterByteBinary2Bit;
191
RegisterFunc RegisterByteBinary4Bit;
192
RegisterFunc RegisterByteIndexed;
193
RegisterFunc RegisterByteGray;
194
RegisterFunc RegisterIndex8Gray;
195
RegisterFunc RegisterIndex12Gray;
196
RegisterFunc RegisterAnyShort;
197
RegisterFunc RegisterUshort555Rgb;
198
RegisterFunc RegisterUshort565Rgb;
199
RegisterFunc RegisterUshort4444Argb;
200
RegisterFunc RegisterUshort555Rgbx;
201
RegisterFunc RegisterUshortGray;
202
RegisterFunc RegisterUshortIndexed;
203
RegisterFunc RegisterAny3Byte;
204
RegisterFunc RegisterThreeByteBgr;
205
RegisterFunc RegisterAnyInt;
206
RegisterFunc RegisterIntArgb;
207
RegisterFunc RegisterIntArgbPre;
208
RegisterFunc RegisterIntArgbBm;
209
RegisterFunc RegisterIntRgb;
210
RegisterFunc RegisterIntBgr;
211
RegisterFunc RegisterIntRgbx;
212
RegisterFunc RegisterAny4Byte;
213
RegisterFunc RegisterFourByteAbgr;
214
RegisterFunc RegisterFourByteAbgrPre;
215
216
if (!RegisterAnyByte(env) ||
217
!RegisterByteBinary1Bit(env) ||
218
!RegisterByteBinary2Bit(env) ||
219
!RegisterByteBinary4Bit(env) ||
220
!RegisterByteIndexed(env) ||
221
!RegisterByteGray(env) ||
222
!RegisterIndex8Gray(env) ||
223
!RegisterIndex12Gray(env) ||
224
!RegisterAnyShort(env) ||
225
!RegisterUshort555Rgb(env) ||
226
!RegisterUshort565Rgb(env) ||
227
!RegisterUshort4444Argb(env) ||
228
!RegisterUshort555Rgbx(env) ||
229
!RegisterUshortGray(env) ||
230
!RegisterUshortIndexed(env) ||
231
!RegisterAny3Byte(env) ||
232
!RegisterThreeByteBgr(env) ||
233
!RegisterAnyInt(env) ||
234
!RegisterIntArgb(env) ||
235
!RegisterIntArgbPre(env) ||
236
!RegisterIntArgbBm(env) ||
237
!RegisterIntRgb(env) ||
238
!RegisterIntBgr(env) ||
239
!RegisterIntRgbx(env) ||
240
!RegisterAny4Byte(env) ||
241
!RegisterFourByteAbgr(env) ||
242
!RegisterFourByteAbgrPre(env))
243
{
244
return;
245
}
246
}
247
248
#define _StartOf(T) ((T *) (&T##s))
249
#define _NumberOf(T) (sizeof(T##s) / sizeof(T))
250
#define _EndOf(T) (_StartOf(T) + _NumberOf(T))
251
252
#define PrimTypeStart _StartOf(PrimitiveType)
253
#define PrimTypeEnd _EndOf(PrimitiveType)
254
255
#define SurfTypeStart _StartOf(SurfaceType)
256
#define SurfTypeEnd _EndOf(SurfaceType)
257
258
#define CompTypeStart _StartOf(CompositeType)
259
#define CompTypeEnd _EndOf(CompositeType)
260
261
/*
262
* This function initializes the global collection of PrimitiveType
263
* structures by retrieving the necessary Java Class object and the
264
* associated methodID of the necessary constructor.
265
*
266
* See PrimitiveTypes.* below.
267
*/
268
static jboolean InitPrimTypes(JNIEnv *env)
269
{
270
jboolean ok = JNI_TRUE;
271
PrimitiveType *pPrimType;
272
jclass cl;
273
274
for (pPrimType = PrimTypeStart; pPrimType < PrimTypeEnd; pPrimType++) {
275
cl = (*env)->FindClass(env, pPrimType->ClassName);
276
if (cl == NULL) {
277
ok = JNI_FALSE;
278
break;
279
}
280
pPrimType->ClassObject = (*env)->NewGlobalRef(env, cl);
281
pPrimType->Constructor =
282
(*env)->GetMethodID(env, cl, InitName, InitSig);
283
284
(*env)->DeleteLocalRef(env, cl);
285
if (pPrimType->ClassObject == NULL ||
286
pPrimType->Constructor == NULL)
287
{
288
ok = JNI_FALSE;
289
break;
290
}
291
}
292
293
if (!ok) {
294
for (pPrimType = PrimTypeStart; pPrimType < PrimTypeEnd; pPrimType++) {
295
if (pPrimType->ClassObject != NULL) {
296
(*env)->DeleteGlobalRef(env, pPrimType->ClassObject);
297
pPrimType->ClassObject = NULL;
298
}
299
pPrimType->Constructor = NULL;
300
}
301
}
302
303
return ok;
304
}
305
306
/*
307
* This function initializes the global collection of SurfaceType
308
* or CompositeType structures by retrieving the corresponding Java
309
* object stored as a static field on the Java Class.
310
*
311
* See SurfaceTypes.* below.
312
* See CompositeeTypes.* below.
313
*/
314
static jboolean InitSimpleTypes
315
(JNIEnv *env, jclass SimpleClass, char *SimpleSig,
316
SurfCompHdr *pStart, SurfCompHdr *pEnd, jsize size)
317
{
318
jboolean ok = JNI_TRUE;
319
SurfCompHdr *pHdr;
320
jfieldID field;
321
jobject obj;
322
323
for (pHdr = pStart; pHdr < pEnd; pHdr = PtrAddBytes(pHdr, size)) {
324
field = (*env)->GetStaticFieldID(env,
325
SimpleClass,
326
pHdr->Name,
327
SimpleSig);
328
if (field == NULL) {
329
ok = JNI_FALSE;
330
break;
331
}
332
obj = (*env)->GetStaticObjectField(env, SimpleClass, field);
333
if (obj == NULL) {
334
ok = JNI_FALSE;
335
break;
336
}
337
pHdr->Object = (*env)->NewGlobalRef(env, obj);
338
(*env)->DeleteLocalRef(env, obj);
339
340
if (pHdr->Object == NULL) {
341
ok = JNI_FALSE;
342
break;
343
}
344
}
345
346
if (!ok) {
347
for (pHdr = pStart; pHdr < pEnd; pHdr = PtrAddBytes(pHdr, size)) {
348
if (pHdr->Object != NULL) {
349
(*env)->DeleteGlobalRef(env, pHdr->Object);
350
pHdr->Object = NULL;
351
}
352
}
353
}
354
355
return ok;
356
}
357
358
static jboolean InitSurfaceTypes(JNIEnv *env, jclass ST)
359
{
360
return InitSimpleTypes(env, ST, "Lsun/java2d/loops/SurfaceType;",
361
(SurfCompHdr *) SurfTypeStart,
362
(SurfCompHdr *) SurfTypeEnd,
363
sizeof(SurfaceType));
364
}
365
366
static jboolean InitCompositeTypes(JNIEnv *env, jclass CT)
367
{
368
return InitSimpleTypes(env, CT, "Lsun/java2d/loops/CompositeType;",
369
(SurfCompHdr *) CompTypeStart,
370
(SurfCompHdr *) CompTypeEnd,
371
sizeof(CompositeType));
372
}
373
374
/*
375
* This function registers a set of Java GraphicsPrimitive objects
376
* based on information stored in an array of NativePrimitive structures.
377
*/
378
jboolean RegisterPrimitives(JNIEnv *env,
379
NativePrimitive *pPrim,
380
jint NumPrimitives)
381
{
382
jarray primitives;
383
int i;
384
385
primitives = (*env)->NewObjectArray(env, NumPrimitives,
386
GraphicsPrimitive, NULL);
387
if (primitives == NULL) {
388
return JNI_FALSE;
389
}
390
391
for (i = 0; i < NumPrimitives; i++, pPrim++) {
392
jint srcflags, dstflags;
393
jobject prim;
394
PrimitiveType *pType = pPrim->pPrimType;
395
SurfaceType *pSrc = pPrim->pSrcType;
396
CompositeType *pComp = pPrim->pCompType;
397
SurfaceType *pDst = pPrim->pDstType;
398
399
pPrim->funcs.initializer = MapAccelFunction(pPrim->funcs_c.initializer);
400
401
/*
402
* Calculate the necessary SurfaceData lock flags for the
403
* source and destination surfaces based on the information
404
* stored in the PrimitiveType, SurfaceType, and CompositeType
405
* structures. The starting point is the values that are
406
* already stored in the NativePrimitive structure. These
407
* flags are usually left as 0, but can be filled in by
408
* native primitive loops that have special needs that are
409
* not deducible from their declared attributes.
410
*/
411
srcflags = pPrim->srcflags;
412
dstflags = pPrim->dstflags;
413
srcflags |= pType->srcflags;
414
dstflags |= pType->dstflags;
415
dstflags |= pComp->dstflags;
416
if (srcflags & SD_LOCK_READ) srcflags |= pSrc->readflags;
417
/* if (srcflags & SD_LOCK_WRITE) srcflags |= pSrc->writeflags; */
418
if (dstflags & SD_LOCK_READ) dstflags |= pDst->readflags;
419
if (dstflags & SD_LOCK_WRITE) dstflags |= pDst->writeflags;
420
pPrim->srcflags = srcflags;
421
pPrim->dstflags = dstflags;
422
423
prim = (*env)->NewObject(env,
424
pType->ClassObject,
425
pType->Constructor,
426
ptr_to_jlong(pPrim),
427
pSrc->hdr.Object,
428
pComp->hdr.Object,
429
pDst->hdr.Object);
430
if (prim == NULL) {
431
break;
432
}
433
(*env)->SetObjectArrayElement(env, primitives, i, prim);
434
(*env)->DeleteLocalRef(env, prim);
435
if ((*env)->ExceptionCheck(env)) {
436
break;
437
}
438
}
439
440
if (i >= NumPrimitives) {
441
/* No error - upcall to GraphicsPrimitiveMgr to register the
442
* new primitives... */
443
(*env)->CallStaticVoidMethod(env, GraphicsPrimitiveMgr, RegisterID,
444
primitives);
445
}
446
(*env)->DeleteLocalRef(env, primitives);
447
448
return !((*env)->ExceptionCheck(env));
449
}
450
451
JNIEXPORT NativePrimitive * JNICALL
452
GetNativePrim(JNIEnv *env, jobject gp)
453
{
454
NativePrimitive *pPrim;
455
456
pPrim = (NativePrimitive *) JNU_GetLongFieldAsPtr(env, gp, pNativePrimID);
457
if (pPrim == NULL) {
458
JNU_ThrowInternalError(env, "Non-native Primitive invoked natively");
459
}
460
461
return pPrim;
462
}
463
464
JNIEXPORT void JNICALL
465
GrPrim_Sg2dGetCompInfo(JNIEnv *env, jobject sg2d,
466
NativePrimitive *pPrim, CompositeInfo *pCompInfo)
467
{
468
jobject comp;
469
470
comp = (*env)->GetObjectField(env, sg2d, compositeID);
471
(*pPrim->pCompType->getCompInfo)(env, pCompInfo, comp);
472
(*env)->DeleteLocalRef(env, comp);
473
}
474
475
JNIEXPORT jint JNICALL
476
GrPrim_CompGetXorColor(JNIEnv *env, jobject comp)
477
{
478
jobject color;
479
jint rgb;
480
481
color = (*env)->GetObjectField(env, comp, xorColorID);
482
rgb = (*env)->CallIntMethod(env, color, getRgbID);
483
(*env)->DeleteLocalRef(env, color);
484
485
return rgb;
486
}
487
488
JNIEXPORT void JNICALL
489
GrPrim_Sg2dGetClip(JNIEnv *env, jobject sg2d, SurfaceDataBounds *bounds)
490
{
491
jobject clip = (*env)->GetObjectField(env, sg2d, clipRegionID);
492
Region_GetBounds(env, clip, bounds);
493
}
494
495
JNIEXPORT jint JNICALL
496
GrPrim_Sg2dGetPixel(JNIEnv *env, jobject sg2d)
497
{
498
return (*env)->GetIntField(env, sg2d, pixelID);
499
}
500
501
JNIEXPORT jint JNICALL
502
GrPrim_Sg2dGetEaRGB(JNIEnv *env, jobject sg2d)
503
{
504
return (*env)->GetIntField(env, sg2d, eargbID);
505
}
506
507
JNIEXPORT jint JNICALL
508
GrPrim_Sg2dGetLCDTextContrast(JNIEnv *env, jobject sg2d)
509
{
510
return (*env)->GetIntField(env, sg2d, lcdTextContrastID);
511
}
512
513
/*
514
* Helper function for CompositeTypes.Xor
515
*/
516
JNIEXPORT void JNICALL
517
GrPrim_CompGetXorInfo(JNIEnv *env, CompositeInfo *pCompInfo, jobject comp)
518
{
519
pCompInfo->rule = RULE_Xor;
520
pCompInfo->details.xorPixel = (*env)->GetIntField(env, comp, xorPixelID);
521
pCompInfo->alphaMask = (*env)->GetIntField(env, comp, alphaMaskID);
522
}
523
524
/*
525
* Helper function for CompositeTypes.AnyAlpha
526
*/
527
JNIEXPORT void JNICALL
528
GrPrim_CompGetAlphaInfo(JNIEnv *env, CompositeInfo *pCompInfo, jobject comp)
529
{
530
pCompInfo->rule =
531
(*env)->GetIntField(env, comp, ruleID);
532
pCompInfo->details.extraAlpha =
533
(*env)->GetFloatField(env, comp, extraAlphaID);
534
}
535
536
JNIEXPORT void JNICALL
537
Transform_GetInfo(JNIEnv *env, jobject txform, TransformInfo *pTxInfo)
538
{
539
pTxInfo->dxdx = (*env)->GetDoubleField(env, txform, m00ID);
540
pTxInfo->dxdy = (*env)->GetDoubleField(env, txform, m01ID);
541
pTxInfo->tx = (*env)->GetDoubleField(env, txform, m02ID);
542
pTxInfo->dydx = (*env)->GetDoubleField(env, txform, m10ID);
543
pTxInfo->dydy = (*env)->GetDoubleField(env, txform, m11ID);
544
pTxInfo->ty = (*env)->GetDoubleField(env, txform, m12ID);
545
}
546
547
JNIEXPORT void JNICALL
548
Transform_transform(TransformInfo *pTxInfo, jdouble *pX, jdouble *pY)
549
{
550
jdouble x = *pX;
551
jdouble y = *pY;
552
553
*pX = pTxInfo->dxdx * x + pTxInfo->dxdy * y + pTxInfo->tx;
554
*pY = pTxInfo->dydx * x + pTxInfo->dydy * y + pTxInfo->ty;
555
}
556
557
/*
558
* External declarations for the pixelFor helper methods for the various
559
* named surface types. These functions are defined in the various
560
* files that contain the loop functions for their type.
561
*/
562
extern PixelForFunc PixelForByteBinary;
563
extern PixelForFunc PixelForByteIndexed;
564
extern PixelForFunc PixelForByteGray;
565
extern PixelForFunc PixelForIndex8Gray;
566
extern PixelForFunc PixelForIndex12Gray;
567
extern PixelForFunc PixelForUshort555Rgb;
568
extern PixelForFunc PixelForUshort555Rgbx;
569
extern PixelForFunc PixelForUshort565Rgb;
570
extern PixelForFunc PixelForUshort4444Argb;
571
extern PixelForFunc PixelForUshortGray;
572
extern PixelForFunc PixelForUshortIndexed;
573
extern PixelForFunc PixelForIntArgbPre;
574
extern PixelForFunc PixelForIntArgbBm;
575
extern PixelForFunc PixelForIntBgr;
576
extern PixelForFunc PixelForIntRgbx;
577
extern PixelForFunc PixelForFourByteAbgr;
578
extern PixelForFunc PixelForFourByteAbgrPre;
579
580
/*
581
* Definition and initialization of the globally accessible PrimitiveTypes.
582
*/
583
struct _PrimitiveTypes PrimitiveTypes = {
584
{ "sun/java2d/loops/Blit", SD_LOCK_READ, SD_LOCK_WRITE, NULL, NULL},
585
{ "sun/java2d/loops/BlitBg", SD_LOCK_READ, SD_LOCK_WRITE, NULL, NULL},
586
{ "sun/java2d/loops/ScaledBlit", SD_LOCK_READ, SD_LOCK_WRITE, NULL, NULL},
587
{ "sun/java2d/loops/FillRect", 0, SD_LOCK_WRITE, NULL, NULL},
588
{ "sun/java2d/loops/FillSpans", 0, SD_LOCK_PARTIAL_WRITE, NULL, NULL},
589
{ "sun/java2d/loops/FillParallelogram", 0, SD_LOCK_PARTIAL_WRITE, NULL, NULL},
590
{ "sun/java2d/loops/DrawParallelogram", 0, SD_LOCK_PARTIAL_WRITE, NULL, NULL},
591
{ "sun/java2d/loops/DrawLine", 0, SD_LOCK_PARTIAL_WRITE, NULL, NULL},
592
{ "sun/java2d/loops/DrawRect", 0, SD_LOCK_PARTIAL_WRITE, NULL, NULL},
593
{ "sun/java2d/loops/DrawPolygons", 0, SD_LOCK_PARTIAL_WRITE, NULL, NULL},
594
{ "sun/java2d/loops/DrawPath", 0, SD_LOCK_PARTIAL_WRITE, NULL, NULL},
595
{ "sun/java2d/loops/FillPath", 0, SD_LOCK_PARTIAL_WRITE, NULL, NULL},
596
{ "sun/java2d/loops/MaskBlit", SD_LOCK_READ, SD_LOCK_RD_WR, NULL, NULL},
597
{ "sun/java2d/loops/MaskFill", 0, SD_LOCK_RD_WR, NULL, NULL},
598
{ "sun/java2d/loops/DrawGlyphList", 0, SD_LOCK_PARTIAL_WRITE |
599
SD_LOCK_FASTEST, NULL, NULL},
600
{ "sun/java2d/loops/DrawGlyphListAA", 0, SD_LOCK_RD_WR | SD_LOCK_FASTEST, NULL, NULL},
601
{ "sun/java2d/loops/DrawGlyphListLCD", 0, SD_LOCK_RD_WR | SD_LOCK_FASTEST, NULL, NULL},
602
{ "sun/java2d/loops/TransformHelper", SD_LOCK_READ, 0, NULL, NULL}
603
};
604
605
/*
606
* Definition and initialization of the globally accessible SurfaceTypes.
607
*/
608
struct _SurfaceTypes SurfaceTypes = {
609
{ { "OpaqueColor", NULL}, NULL, 0, 0 },
610
{ { "AnyColor", NULL}, NULL, 0, 0 },
611
{ { "AnyByte", NULL}, NULL, 0, 0 },
612
{ { "ByteBinary1Bit", NULL},
613
PixelForByteBinary, SD_LOCK_LUT, SD_LOCK_INVCOLOR },
614
{ { "ByteBinary2Bit", NULL},
615
PixelForByteBinary, SD_LOCK_LUT, SD_LOCK_INVCOLOR },
616
{ { "ByteBinary4Bit", NULL},
617
PixelForByteBinary, SD_LOCK_LUT, SD_LOCK_INVCOLOR },
618
{ { "ByteIndexed", NULL},
619
PixelForByteIndexed, SD_LOCK_LUT, SD_LOCK_INVCOLOR },
620
{ { "ByteIndexedBm", NULL},
621
PixelForByteIndexed, SD_LOCK_LUT, SD_LOCK_INVCOLOR },
622
{ { "ByteGray", NULL}, PixelForByteGray, 0, 0},
623
{ { "Index8Gray", NULL},
624
PixelForIndex8Gray, SD_LOCK_LUT, SD_LOCK_INVGRAY },
625
{ { "Index12Gray", NULL},
626
PixelForIndex12Gray, SD_LOCK_LUT, SD_LOCK_INVGRAY },
627
{ { "AnyShort", NULL}, NULL, 0, 0 },
628
{ { "Ushort555Rgb", NULL}, PixelForUshort555Rgb, 0, 0},
629
{ { "Ushort555Rgbx", NULL}, PixelForUshort555Rgbx, 0, 0},
630
{ { "Ushort565Rgb", NULL}, PixelForUshort565Rgb, 0, 0 },
631
{ { "Ushort4444Argb", NULL}, PixelForUshort4444Argb, 0, 0 },
632
{ { "UshortGray", NULL}, PixelForUshortGray, 0, 0},
633
{ { "UshortIndexed", NULL},
634
PixelForUshortIndexed, SD_LOCK_LUT, SD_LOCK_INVCOLOR },
635
{ { "Any3Byte", NULL}, NULL, 0, 0 },
636
{ { "ThreeByteBgr", NULL}, NULL, 0, 0 },
637
{ { "AnyInt", NULL}, NULL, 0, 0 },
638
{ { "IntArgb", NULL}, NULL, 0, 0 },
639
{ { "IntArgbPre", NULL}, PixelForIntArgbPre, 0, 0},
640
{ { "IntArgbBm", NULL}, PixelForIntArgbBm, 0, 0},
641
{ { "IntRgb", NULL}, NULL, 0, 0 },
642
{ { "IntBgr", NULL}, PixelForIntBgr, 0, 0},
643
{ { "IntRgbx", NULL}, PixelForIntRgbx, 0, 0},
644
{ { "Any4Byte", NULL}, NULL, 0, 0 },
645
{ { "FourByteAbgr", NULL}, PixelForFourByteAbgr, 0, 0},
646
{ { "FourByteAbgrPre", NULL}, PixelForFourByteAbgrPre, 0, 0},
647
};
648
649
/*
650
* Definition and initialization of the globally accessible CompositeTypes.
651
*/
652
struct _CompositeTypes CompositeTypes = {
653
{ { "SrcNoEa", NULL}, NULL, 0},
654
{ { "SrcOverNoEa", NULL}, NULL, SD_LOCK_RD_WR },
655
{ { "SrcOverNoEa", NULL}, NULL, SD_LOCK_PARTIAL_WRITE }, /* SrcOverBmNoEa */
656
{ { "Src", NULL}, GrPrim_CompGetAlphaInfo, 0},
657
{ { "SrcOver", NULL}, GrPrim_CompGetAlphaInfo, SD_LOCK_RD_WR },
658
{ { "Xor", NULL}, GrPrim_CompGetXorInfo, SD_LOCK_RD_WR },
659
{ { "AnyAlpha", NULL}, GrPrim_CompGetAlphaInfo, SD_LOCK_RD_WR },
660
};
661
662