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