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 JNIEXPORT jfieldID path2DTypesID;
73 JNIEXPORT jfieldID path2DNumTypesID;
74 JNIEXPORT jfieldID path2DWindingRuleID;
75 JNIEXPORT jfieldID path2DFloatCoordsID;
76 JNIEXPORT jfieldID sg2dStrokeHintID;
77 JNIEXPORT 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) {
131 CHECK_NULL(m02ID = (*env)->GetFieldID(env, AT, "m02", "D"));
132 CHECK_NULL(m10ID = (*env)->GetFieldID(env, AT, "m10", "D"));
133 CHECK_NULL(m11ID = (*env)->GetFieldID(env, AT, "m11", "D"));
134 CHECK_NULL(m12ID = (*env)->GetFieldID(env, AT, "m12", "D"));
135
136 CHECK_NULL(path2DTypesID =
137 (*env)->GetFieldID(env, Path2D, "pointTypes", "[B"));
138 CHECK_NULL(path2DNumTypesID =
139 (*env)->GetFieldID(env, Path2D, "numTypes", "I"));
140 CHECK_NULL(path2DWindingRuleID =
141 (*env)->GetFieldID(env, Path2D, "windingRule", "I"));
142 CHECK_NULL(path2DFloatCoordsID =
143 (*env)->GetFieldID(env, Path2DFloat, "floatCoords", "[F"));
144 CHECK_NULL(sg2dStrokeHintID =
145 (*env)->GetFieldID(env, SG2D, "strokeHint", "I"));
146 CHECK_NULL(fid =
147 (*env)->GetStaticFieldID(env, SHints, "INTVAL_STROKE_PURE", "I"));
148 sunHints_INTVAL_STROKE_PURE = (*env)->GetStaticIntField(env, SHints, fid);
149 }
150
151 void GrPrim_RefineBounds(SurfaceDataBounds *bounds, jint transX, jint transY,
152 jfloat *coords, jint maxCoords)
153 {
154 jint xmin, ymin, xmax, ymax;
155 if (maxCoords > 1) {
156 xmin = xmax = transX + (jint)(*coords++ + 0.5);
157 ymin = ymax = transY + (jint)(*coords++ + 0.5);
158 for (;maxCoords > 1; maxCoords -= 2) {
159 jint x = transX + (jint)(*coords++ + 0.5);
160 jint y = transY + (jint)(*coords++ + 0.5);
161 if (xmin > x) xmin = x;
162 if (ymin > y) ymin = y;
163 if (xmax < x) xmax = x;
164 if (ymax < y) ymax = y;
165 }
166 if (++xmax < xmin) xmax--;
167 if (++ymax < ymin) ymax--;
168 if (bounds->x1 < xmin) bounds->x1 = xmin;
169 if (bounds->y1 < ymin) bounds->y1 = ymin;
170 if (bounds->x2 > xmax) bounds->x2 = xmax;
|
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 JNIEXPORT jfieldID path2DTypesID;
73 JNIEXPORT jfieldID path2DNumTypesID;
74 JNIEXPORT jfieldID path2DWindingRuleID;
75 JNIEXPORT jfieldID path2DFloatCoordsID;
76 JNIEXPORT jfieldID sg2dStrokeHintID;
77 JNIEXPORT jint sunHints_INTVAL_STROKE_PURE;
78 JNIEXPORT jint graphicsPrimitive_traceflags = 0;
79
80 /*
81 * Class: sun_java2d_loops_GraphicsPrimitiveMgr
82 * Method: initIDs
83 * Signature: (Ljava/lang/Class;Ljava/lang/Class;Ljava/lang/Class;Ljava/lang/Class;Ljava/lang/Class;Ljava/lang/Class;Ljava/lang/Class;)V
84 */
85 JNIEXPORT void JNICALL
86 Java_sun_java2d_loops_GraphicsPrimitiveMgr_initIDs
87 (JNIEnv *env, jclass GPMgr,
88 jclass GP, jclass ST, jclass CT,
89 jclass SG2D, jclass Color, jclass AT,
90 jclass XORComp, jclass AlphaComp,
91 jclass Path2D, jclass Path2DFloat,
92 jclass SHints)
93 {
94 jfieldID fid;
95 initAlphaTables();
96 GraphicsPrimitiveMgr = (*env)->NewGlobalRef(env, GPMgr);
97 GraphicsPrimitive = (*env)->NewGlobalRef(env, GP);
98 if (GraphicsPrimitiveMgr == NULL || GraphicsPrimitive == NULL) {
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 JNIEXPORT void JNICALL
153 Java_sun_java2d_loops_GraphicsPrimitiveMgr_setTraceFlags
154 (JNIEnv *env, jclass GPMgr, jint traceflags)
155 {
156 graphicsPrimitive_traceflags = traceflags;
157 }
158
159 void GrPrim_RefineBounds(SurfaceDataBounds *bounds, jint transX, jint transY,
160 jfloat *coords, jint maxCoords)
161 {
162 jint xmin, ymin, xmax, ymax;
163 if (maxCoords > 1) {
164 xmin = xmax = transX + (jint)(*coords++ + 0.5);
165 ymin = ymax = transY + (jint)(*coords++ + 0.5);
166 for (;maxCoords > 1; maxCoords -= 2) {
167 jint x = transX + (jint)(*coords++ + 0.5);
168 jint y = transY + (jint)(*coords++ + 0.5);
169 if (xmin > x) xmin = x;
170 if (ymin > y) ymin = y;
171 if (xmax < x) xmax = x;
172 if (ymax < y) ymax = y;
173 }
174 if (++xmax < xmin) xmax--;
175 if (++ymax < ymin) ymax--;
176 if (bounds->x1 < xmin) bounds->x1 = xmin;
177 if (bounds->y1 < ymin) bounds->y1 = ymin;
178 if (bounds->x2 > xmax) bounds->x2 = xmax;
|