Print this page
Added gradle and cmake project
Split |
Close |
Expand all |
Collapse all |
--- old/src/java.desktop/share/native/libawt/java2d/loops/GraphicsPrimitiveMgr.h
+++ new/src/java.desktop/share/native/libawt/java2d/loops/GraphicsPrimitiveMgr.h
1 1 /*
2 2 * Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
3 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 4 *
5 5 * This code is free software; you can redistribute it and/or modify it
6 6 * under the terms of the GNU General Public License version 2 only, as
7 7 * published by the Free Software Foundation. Oracle designates this
8 8 * particular file as subject to the "Classpath" exception as provided
9 9 * by Oracle in the LICENSE file that accompanied this code.
10 10 *
11 11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 14 * version 2 for more details (a copy is included in the LICENSE file that
15 15 * accompanied this code).
16 16 *
17 17 * You should have received a copy of the GNU General Public License version
18 18 * 2 along with this work; if not, write to the Free Software Foundation,
19 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 20 *
21 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 22 * or visit www.oracle.com if you need additional information or have any
23 23 * questions.
24 24 */
25 25
26 26 #ifndef GraphicsPrimitiveMgr_h_Included
27 27 #define GraphicsPrimitiveMgr_h_Included
28 28
29 29 #ifdef __cplusplus
30 30 extern "C" {
31 31 #endif
32 32
33 33 #include <stddef.h>
34 34 #include "jni.h"
35 35
36 36 #include "java_awt_AlphaComposite.h"
37 37
38 38 #include "SurfaceData.h"
39 39 #include "SpanIterator.h"
40 40
41 41 #include "j2d_md.h"
42 42
43 43 #include "AlphaMath.h"
44 44 #include "GlyphImageRef.h"
45 45
46 46 /*
47 47 * This structure contains all of the information about a particular
48 48 * type of GraphicsPrimitive, such as a FillRect, a MaskFill, or a Blit.
49 49 *
50 50 * A global collection of these structures is declared and initialized
51 51 * to contain the necessary Java (JNI) information so that appropriate
52 52 * Java GraphicsPrimitive objects can be quickly constructed for a set
53 53 * of native loops simply by referencing the necessary entry from that
54 54 * collection for the type of primitive being registered.
55 55 *
56 56 * See PrimitiveTypes.{Blit,BlitBg,FillRect,...} below.
57 57 */
58 58 typedef struct _PrimitiveType {
59 59 char *ClassName;
60 60 jint srcflags;
61 61 jint dstflags;
62 62 jclass ClassObject;
63 63 jmethodID Constructor;
64 64 } PrimitiveType;
65 65
66 66 /* The integer constants to identify the compositing rule being defined. */
67 67 #define RULE_Xor (java_awt_AlphaComposite_MIN_RULE - 1)
68 68 #define RULE_Clear java_awt_AlphaComposite_CLEAR
69 69 #define RULE_Src java_awt_AlphaComposite_SRC
70 70 #define RULE_SrcOver java_awt_AlphaComposite_SRC_OVER
71 71 #define RULE_DstOver java_awt_AlphaComposite_DST_OVER
72 72 #define RULE_SrcIn java_awt_AlphaComposite_SRC_IN
73 73 #define RULE_DstIn java_awt_AlphaComposite_DST_IN
74 74 #define RULE_SrcOut java_awt_AlphaComposite_SRC_OUT
75 75 #define RULE_DstOut java_awt_AlphaComposite_DST_OUT
76 76
77 77 /*
78 78 * This structure holds the information retrieved from a Java
79 79 * Composite object for easy transfer to various C functions
80 80 * that implement the inner loop for a native primitive.
81 81 *
82 82 * Currently only AlphaComposite and XORComposite are supported.
83 83 */
84 84 typedef struct _CompositeInfo {
85 85 jint rule; /* See RULE_* constants above */
86 86 union {
87 87 jfloat extraAlpha; /* from AlphaComposite */
88 88 jint xorPixel; /* from XORComposite */
89 89 } details;
90 90 juint alphaMask; /* from XORComposite */
91 91 } CompositeInfo;
92 92
93 93 /*
94 94 * This structure is the common header for the two native structures
95 95 * that hold information about a particular SurfaceType or CompositeType.
96 96 *
97 97 * A global collection of these structures is declared and initialized
98 98 * to contain the necessary Java (JNI) information so that appropriate
99 99 * Java GraphicsPrimitive objects can be quickly constructed for a set
100 100 * of native loops simply by referencing the necessary entry from that
101 101 * collection for the type of composite or surface being implemented.
102 102 *
103 103 * See SurfaceTypes.{OpaqueColor,IntArgb,ByteGray,...} below.
104 104 * See CompositeTypes.{Xor,AnyAlpha,...} below.
105 105 */
106 106 typedef struct _SurfCompHdr {
107 107 char *Name;
108 108 jobject Object;
109 109 } SurfCompHdr;
110 110
111 111 /*
112 112 * The definitions for the SurfaceType structure described above.
113 113 */
114 114
115 115 /*
116 116 * The signature for a function that returns the specific integer
117 117 * format pixel for a given ARGB color value for a particular
118 118 * SurfaceType implementation.
119 119 * This function is valid only after GetRasInfo call for the
120 120 * associated surface.
121 121 */
122 122 typedef jint (PixelForFunc)(SurfaceDataRasInfo *pRasInfo, jint rgb);
123 123
124 124 /*
125 125 * The additional information needed to manipulate a surface:
126 126 * - The pixelFor function for translating ARGB values.
127 127 * Valid only after GetRasInfo call for this surface.
128 128 * - The additional flags needed when reading from this surface.
129 129 * - The additional flags needed when writing to this surface.
130 130 */
131 131 typedef struct _SurfaceType {
132 132 SurfCompHdr hdr;
133 133 PixelForFunc *pixelFor;
134 134 jint readflags;
135 135 jint writeflags;
136 136 } SurfaceType;
137 137
138 138 /*
139 139 * The definitions for the CompositeType structure described above.
140 140 */
141 141
142 142 /*
143 143 * The signature for a function that fills in a CompositeInfo
144 144 * structure from the information present in a given Java Composite
145 145 * object.
146 146 */
147 147 typedef void (JNICALL CompInfoFunc)(JNIEnv *env,
148 148 CompositeInfo *pCompInfo,
149 149 jobject Composite);
150 150
151 151 /*
152 152 * The additional information needed to implement a primitive that
153 153 * performs a particular composite operation:
154 154 * - The getCompInfo function for filling in a CompositeInfo structure.
155 155 * - The additional flags needed for locking the destination surface.
156 156 */
157 157 typedef struct _CompositeType {
158 158 SurfCompHdr hdr;
159 159 CompInfoFunc *getCompInfo;
160 160 jint dstflags;
161 161 } CompositeType;
162 162
163 163 /*
164 164 * The signature of the native functions that register a set of
165 165 * related native GraphicsPrimitive functions.
166 166 */
167 167 typedef jboolean (RegisterFunc)(JNIEnv *env);
168 168
169 169 struct _NativePrimitive; /* forward reference for function typedefs */
170 170
171 171 /*
172 172 * This empty function signature represents an "old pre-ANSI style"
173 173 * function declaration which makes no claims about the argument list
174 174 * other than that the types of the arguments will undergo argument
175 175 * promotion in the calling conventions.
176 176 * (See section A7.3.2 in K&R 2nd edition.)
177 177 *
178 178 * When trying to statically initialize the function pointer field of
179 179 * a NativePrimitive structure, which is a union of all possible
180 180 * inner loop function signatures, the initializer constant must be
181 181 * compatible with the first field in the union. This generic function
182 182 * type allows us to assign any function pointer to that union as long
183 183 * as it meets the requirements specified above (i.e. all arguments
184 184 * are compatible with their promoted values according to the old
185 185 * style argument promotion calling semantics).
186 186 *
187 187 * Note: This means that you cannot define an argument to any of
188 188 * these native functions which is a byte or a short as that value
189 189 * would not be passed in the same way for an ANSI-style full prototype
190 190 * calling convention and an old-style argument promotion calling
191 191 * convention.
192 192 */
193 193 typedef void (AnyFunc)();
194 194
195 195 /*
196 196 * The signature of the inner loop function for a "Blit".
197 197 */
198 198 typedef void (BlitFunc)(void *pSrc, void *pDst,
199 199 juint width, juint height,
200 200 SurfaceDataRasInfo *pSrcInfo,
201 201 SurfaceDataRasInfo *pDstInfo,
202 202 struct _NativePrimitive *pPrim,
203 203 CompositeInfo *pCompInfo);
204 204
205 205 /*
206 206 * The signature of the inner loop function for a "BlitBg".
207 207 */
208 208 typedef void (BlitBgFunc)(void *pSrc, void *pDst,
209 209 juint width, juint height, jint bgpixel,
210 210 SurfaceDataRasInfo *pSrcInfo,
211 211 SurfaceDataRasInfo *pDstInfo,
212 212 struct _NativePrimitive *pPrim,
213 213 CompositeInfo *pCompInfo);
214 214
215 215 /*
216 216 * The signature of the inner loop function for a "ScaleBlit".
217 217 */
218 218 typedef void (ScaleBlitFunc)(void *pSrc, void *pDst,
219 219 juint dstwidth, juint dstheight,
220 220 jint sxloc, jint syloc,
221 221 jint sxinc, jint syinc, jint scale,
222 222 SurfaceDataRasInfo *pSrcInfo,
223 223 SurfaceDataRasInfo *pDstInfo,
224 224 struct _NativePrimitive *pPrim,
225 225 CompositeInfo *pCompInfo);
226 226
227 227 /*
228 228 * The signature of the inner loop function for a "FillRect".
229 229 */
230 230 typedef void (FillRectFunc)(SurfaceDataRasInfo *pRasInfo,
231 231 jint lox, jint loy,
232 232 jint hix, jint hiy,
233 233 jint pixel, struct _NativePrimitive *pPrim,
234 234 CompositeInfo *pCompInfo);
235 235
236 236 /*
237 237 * The signature of the inner loop function for a "FillSpans".
238 238 */
239 239 typedef void (FillSpansFunc)(SurfaceDataRasInfo *pRasInfo,
240 240 SpanIteratorFuncs *pSpanFuncs, void *siData,
241 241 jint pixel, struct _NativePrimitive *pPrim,
242 242 CompositeInfo *pCompInfo);
243 243
244 244 /*
245 245 * The signature of the inner loop function for a "DrawLine".
246 246 * Note that this same inner loop is used for native DrawRect
247 247 * and DrawPolygons primitives.
248 248 */
249 249 typedef void (DrawLineFunc)(SurfaceDataRasInfo *pRasInfo,
250 250 jint x1, jint y1, jint pixel,
251 251 jint steps, jint error,
252 252 jint bumpmajormask, jint errmajor,
253 253 jint bumpminormask, jint errminor,
254 254 struct _NativePrimitive *pPrim,
255 255 CompositeInfo *pCompInfo);
256 256
257 257 /*
258 258 * The signature of the inner loop function for a "MaskFill".
259 259 */
260 260 typedef void (MaskFillFunc)(void *pRas,
261 261 unsigned char *pMask, jint maskOff, jint maskScan,
262 262 jint width, jint height,
263 263 jint fgColor,
264 264 SurfaceDataRasInfo *pRasInfo,
265 265 struct _NativePrimitive *pPrim,
266 266 CompositeInfo *pCompInfo);
267 267
268 268 /*
269 269 * The signature of the inner loop function for a "MaskBlit".
270 270 */
271 271 typedef void (MaskBlitFunc)(void *pDst, void *pSrc,
272 272 unsigned char *pMask, jint maskOff, jint maskScan,
273 273 jint width, jint height,
274 274 SurfaceDataRasInfo *pDstInfo,
275 275 SurfaceDataRasInfo *pSrcInfo,
276 276 struct _NativePrimitive *pPrim,
277 277 CompositeInfo *pCompInfo);
278 278 /*
279 279 * The signature of the inner loop function for a "DrawGlyphList".
280 280 */
281 281 typedef void (DrawGlyphListFunc)(SurfaceDataRasInfo *pRasInfo,
282 282 ImageRef *glyphs,
283 283 jint totalGlyphs,
284 284 jint fgpixel, jint fgcolor,
285 285 jint cx1, jint cy1,
286 286 jint cx2, jint cy2,
287 287 struct _NativePrimitive *pPrim,
288 288 CompositeInfo *pCompInfo);
289 289
290 290 /*
291 291 * The signature of the inner loop function for a "DrawGlyphListAA".
292 292 */
293 293 typedef void (DrawGlyphListAAFunc)(SurfaceDataRasInfo *pRasInfo,
294 294 ImageRef *glyphs,
295 295 jint totalGlyphs,
296 296 jint fgpixel, jint fgcolor,
297 297 jint cx1, jint cy1,
298 298 jint cx2, jint cy2,
299 299 struct _NativePrimitive *pPrim,
300 300 CompositeInfo *pCompInfo);
301 301
302 302 /*
303 303 * The signature of the inner loop function for a "DrawGlyphListLCD".
304 304 * rgbOrder is a jint rather than a jboolean so that this typedef matches
305 305 * AnyFunc which is the first element in a union in NativePrimitive's
306 306 * initialiser. See the comments alongside declaration of the AnyFunc type for
307 307 * a full explanation.
308 308 */
309 309 typedef void (DrawGlyphListLCDFunc)(SurfaceDataRasInfo *pRasInfo,
310 310 ImageRef *glyphs,
311 311 jint totalGlyphs,
312 312 jint fgpixel, jint fgcolor,
313 313 jint cx1, jint cy1,
314 314 jint cx2, jint cy2,
315 315 jint rgbOrder,
316 316 unsigned char *gammaLut,
317 317 unsigned char *invGammaLut,
318 318 struct _NativePrimitive *pPrim,
319 319 CompositeInfo *pCompInfo);
320 320
321 321 /*
322 322 * The signature of the inner loop functions for a "TransformHelper".
323 323 */
324 324 typedef void (TransformHelperFunc)(SurfaceDataRasInfo *pSrcInfo,
325 325 jint *pRGB, jint numpix,
326 326 jlong xlong, jlong dxlong,
327 327 jlong ylong, jlong dylong);
328 328
329 329 typedef struct {
330 330 TransformHelperFunc *nnHelper;
331 331 TransformHelperFunc *blHelper;
332 332 TransformHelperFunc *bcHelper;
333 333 } TransformHelperFuncs;
334 334
335 335 typedef void (TransformInterpFunc)(jint *pRGBbase, jint numpix,
336 336 jint xfract, jint dxfract,
337 337 jint yfract, jint dyfract);
338 338
339 339 /*
340 340 * The signature of the inner loop function for a "FillParallelogram"
341 341 * Note that this same inner loop is used for native DrawParallelogram
342 342 * primitives.
343 343 * Note that these functions are paired with equivalent DrawLine
344 344 * inner loop functions to facilitate nicer looking and faster thin
345 345 * transformed drawrect calls.
346 346 */
347 347 typedef void (FillParallelogramFunc)(SurfaceDataRasInfo *pRasInfo,
348 348 jint lox, jint loy, jint hix, jint hiy,
349 349 jlong leftx, jlong dleftx,
350 350 jlong rightx, jlong drightx,
351 351 jint pixel, struct _NativePrimitive *pPrim,
352 352 CompositeInfo *pCompInfo);
353 353
354 354 typedef struct {
355 355 FillParallelogramFunc *fillpgram;
356 356 DrawLineFunc *drawline;
357 357 } DrawParallelogramFuncs;
358 358
359 359 /*
360 360 * This structure contains all information for defining a single
361 361 * native GraphicsPrimitive, including:
362 362 * - The information about the type of the GraphicsPrimitive subclass.
363 363 * - The information about the type of the source surface.
364 364 * - The information about the type of the compositing operation.
365 365 * - The information about the type of the destination surface.
366 366 * - A pointer to the function that performs the actual inner loop work.
367 367 * - Extra flags needed for locking the source and destination surfaces
368 368 * above and beyond the flags specified in the Primitive, Composite
369 369 * and SurfaceType structures. (For most native primitives these
370 370 * flags can be calculated automatically from information stored in
371 371 * the PrimitiveType, SurfaceType, and CompositeType structures.)
372 372 */
373 373 typedef struct _NativePrimitive {
374 374 PrimitiveType *pPrimType;
375 375 SurfaceType *pSrcType;
376 376 CompositeType *pCompType;
377 377 SurfaceType *pDstType;
378 378 /* See declaration of AnyFunc type above for comments explaining why
379 379 * only AnyFunc is used by the initializers for these union fields
380 380 * and consequent type restrictions.
381 381 */
382 382 union {
383 383 AnyFunc *initializer;
384 384 BlitFunc *blit;
385 385 BlitBgFunc *blitbg;
386 386 ScaleBlitFunc *scaledblit;
387 387 FillRectFunc *fillrect;
388 388 FillSpansFunc *fillspans;
389 389 FillParallelogramFunc *fillparallelogram;
390 390 DrawParallelogramFuncs *drawparallelogram;
391 391 DrawLineFunc *drawline;
392 392 MaskFillFunc *maskfill;
393 393 MaskBlitFunc *maskblit;
394 394 DrawGlyphListFunc *drawglyphlist;
395 395 DrawGlyphListFunc *drawglyphlistaa;
396 396 DrawGlyphListLCDFunc *drawglyphlistlcd;
397 397 TransformHelperFuncs *transformhelpers;
398 398 } funcs, funcs_c;
399 399 jint srcflags;
400 400 jint dstflags;
401 401 } NativePrimitive;
402 402
403 403 /*
404 404 * This function should be defined to return a pointer to
405 405 * an accelerated version of a primitive function 'func_c'
406 406 * if it exists and to return a copy of the input parameter
407 407 * otherwise.
408 408 */
409 409 extern AnyFunc* MapAccelFunction(AnyFunc *func_c);
410 410
411 411 /*
412 412 * The global collection of all primitive types. Specific NativePrimitive
413 413 * structures can be statically initialized by pointing to these structures.
414 414 */
415 415 extern struct _PrimitiveTypes {
416 416 PrimitiveType Blit;
417 417 PrimitiveType BlitBg;
418 418 PrimitiveType ScaledBlit;
419 419 PrimitiveType FillRect;
420 420 PrimitiveType FillSpans;
421 421 PrimitiveType FillParallelogram;
422 422 PrimitiveType DrawParallelogram;
423 423 PrimitiveType DrawLine;
424 424 PrimitiveType DrawRect;
425 425 PrimitiveType DrawPolygons;
426 426 PrimitiveType DrawPath;
427 427 PrimitiveType FillPath;
428 428 PrimitiveType MaskBlit;
429 429 PrimitiveType MaskFill;
430 430 PrimitiveType DrawGlyphList;
431 431 PrimitiveType DrawGlyphListAA;
432 432 PrimitiveType DrawGlyphListLCD;
433 433 PrimitiveType TransformHelper;
434 434 } PrimitiveTypes;
435 435
436 436 /*
437 437 * The global collection of all surface types. Specific NativePrimitive
438 438 * structures can be statically initialized by pointing to these structures.
439 439 */
440 440 extern struct _SurfaceTypes {
441 441 SurfaceType OpaqueColor;
442 442 SurfaceType AnyColor;
443 443 SurfaceType AnyByte;
444 444 SurfaceType ByteBinary1Bit;
445 445 SurfaceType ByteBinary2Bit;
446 446 SurfaceType ByteBinary4Bit;
447 447 SurfaceType ByteIndexed;
448 448 SurfaceType ByteIndexedBm;
449 449 SurfaceType ByteGray;
450 450 SurfaceType Index8Gray;
451 451 SurfaceType Index12Gray;
452 452 SurfaceType AnyShort;
453 453 SurfaceType Ushort555Rgb;
454 454 SurfaceType Ushort555Rgbx;
455 455 SurfaceType Ushort565Rgb;
456 456 SurfaceType Ushort4444Argb;
457 457 SurfaceType UshortGray;
458 458 SurfaceType UshortIndexed;
459 459 SurfaceType Any3Byte;
460 460 SurfaceType ThreeByteBgr;
461 461 SurfaceType AnyInt;
462 462 SurfaceType IntArgb;
463 463 SurfaceType IntArgbPre;
464 464 SurfaceType IntArgbBm;
465 465 SurfaceType IntRgb;
466 466 SurfaceType IntBgr;
467 467 SurfaceType IntRgbx;
468 468 SurfaceType Any4Byte;
469 469 SurfaceType FourByteAbgr;
470 470 SurfaceType FourByteAbgrPre;
471 471 } SurfaceTypes;
472 472
473 473 /*
474 474 * The global collection of all composite types. Specific NativePrimitive
475 475 * structures can be statically initialized by pointing to these structures.
476 476 */
477 477 extern struct _CompositeTypes {
478 478 CompositeType SrcNoEa;
479 479 CompositeType SrcOverNoEa;
480 480 CompositeType SrcOverBmNoEa;
481 481 CompositeType Src;
482 482 CompositeType SrcOver;
483 483 CompositeType Xor;
484 484 CompositeType AnyAlpha;
485 485 } CompositeTypes;
486 486
487 487 #define ArraySize(A) (sizeof(A) / sizeof(A[0]))
488 488
489 489 #define PtrAddBytes(p, b) ((void *) (((intptr_t) (p)) + (b)))
490 490 #define PtrCoord(p, x, xinc, y, yinc) PtrAddBytes(p, \
491 491 ((ptrdiff_t)(y))*(yinc) + \
492 492 ((ptrdiff_t)(x))*(xinc))
493 493
494 494 /*
495 495 * The function to call with an array of NativePrimitive structures
496 496 * to register them with the Java GraphicsPrimitiveMgr.
497 497 */
498 498 extern jboolean RegisterPrimitives(JNIEnv *env,
499 499 NativePrimitive *pPrim,
500 500 jint NumPrimitives);
501 501
502 502 /*
503 503 * The utility function to retrieve the NativePrimitive structure
504 504 * from a given Java GraphicsPrimitive object.
505 505 */
506 506 extern JNIEXPORT NativePrimitive * JNICALL
507 507 GetNativePrim(JNIEnv *env, jobject gp);
508 508
509 509 /*
510 510 * Utility functions to get values from a Java SunGraphics2D or Color object.
511 511 */
512 512 extern JNIEXPORT void JNICALL
513 513 GrPrim_Sg2dGetCompInfo(JNIEnv *env, jobject sg2d,
514 514 NativePrimitive *pPrim,
515 515 CompositeInfo *pCompInfo);
516 516 extern JNIEXPORT jint JNICALL
517 517 GrPrim_CompGetXorColor(JNIEnv *env, jobject comp);
518 518 extern JNIEXPORT void JNICALL
519 519 GrPrim_CompGetXorInfo(JNIEnv *env, CompositeInfo *pCompInfo, jobject comp);
520 520 extern JNIEXPORT void JNICALL
521 521 GrPrim_CompGetAlphaInfo(JNIEnv *env, CompositeInfo *pCompInfo, jobject comp);
522 522
523 523 extern JNIEXPORT void JNICALL
524 524 GrPrim_Sg2dGetClip(JNIEnv *env, jobject sg2d,
525 525 SurfaceDataBounds *bounds);
526 526
527 527 extern JNIEXPORT jint JNICALL
528 528 GrPrim_Sg2dGetPixel(JNIEnv *env, jobject sg2d);
529 529 extern JNIEXPORT jint JNICALL
530 530 GrPrim_Sg2dGetEaRGB(JNIEnv *env, jobject sg2d);
531 531 extern JNIEXPORT jint JNICALL
532 532 GrPrim_Sg2dGetLCDTextContrast(JNIEnv *env, jobject sg2d);
533 533
534 534 /*
535 535 * Data structure and functions to retrieve and use
536 536 * AffineTransform objects from the native level.
537 537 */
538 538 typedef struct {
539 539 jdouble dxdx; /* dx in dest space for each dx in src space */
540 540 jdouble dxdy; /* dx in dest space for each dy in src space */
541 541 jdouble tx;
542 542 jdouble dydx; /* dy in dest space for each dx in src space */
543 543 jdouble dydy; /* dy in dest space for each dy in src space */
544 544 jdouble ty;
545 545 } TransformInfo;
546 546
547 547 extern JNIEXPORT void JNICALL
548 548 Transform_GetInfo(JNIEnv *env, jobject txform, TransformInfo *pTxInfo);
549 549 extern JNIEXPORT void JNICALL
550 550 Transform_transform(TransformInfo *pTxInfo, jdouble *pX, jdouble *pY);
↓ open down ↓ |
550 lines elided |
↑ open up ↑ |
551 551
552 552 void GrPrim_RefineBounds(SurfaceDataBounds *bounds, jint transX, jint transY,
553 553 jfloat *coords, jint maxCoords);
554 554
555 555 JNIEXPORT extern jfieldID path2DTypesID;
556 556 JNIEXPORT extern jfieldID path2DNumTypesID;
557 557 JNIEXPORT extern jfieldID path2DWindingRuleID;
558 558 JNIEXPORT extern jfieldID path2DFloatCoordsID;
559 559 JNIEXPORT extern jfieldID sg2dStrokeHintID;
560 560 JNIEXPORT extern jint sunHints_INTVAL_STROKE_PURE;
561 +JNIEXPORT extern jint graphicsPrimitive_traceflags;
561 562
562 563 /*
563 564 * Macros for using jlong variables as 32bits.32bits fractional values
564 565 */
565 566 #define LongOneHalf (((jlong) 1) << 31)
566 567 #define IntToLong(i) (((jlong) (i)) << 32)
567 568 #define DblToLong(d) ((jlong) ((d) * IntToLong(1)))
568 569 #define LongToDbl(l) (((jdouble) l) / IntToLong(1))
569 570 #define WholeOfLong(l) ((jint) ((l) >> 32))
570 571 #define FractOfLong(l) ((jint) (l))
571 572 #define URShift(i, n) (((juint) (i)) >> (n))
572 573
573 574 /*
574 575 * Macros to help in defining arrays of NativePrimitive structures.
575 576 *
576 577 * These macros are the very base macros. More specific macros are
577 578 * defined in LoopMacros.h.
578 579 *
579 580 * Note that the DrawLine, DrawRect, and DrawPolygons primitives are
580 581 * all registered together from a single shared native function pointer.
581 582 */
582 583
583 584 #define REGISTER_PRIMITIVE(TYPE, SRC, COMP, DST, FUNC) \
584 585 { \
585 586 & PrimitiveTypes.TYPE, \
586 587 & SurfaceTypes.SRC, \
587 588 & CompositeTypes.COMP, \
588 589 & SurfaceTypes.DST, \
589 590 {FUNC}, \
590 591 {FUNC}, \
591 592 0, \
592 593 0 \
593 594 }
594 595
595 596 #define REGISTER_PRIMITIVE_FLAGS(TYPE, SRC, COMP, DST, FUNC, SFLAGS, DFLAGS) \
596 597 { \
597 598 & PrimitiveTypes.TYPE, \
598 599 & SurfaceTypes.SRC, \
599 600 & CompositeTypes.COMP, \
600 601 & SurfaceTypes.DST, \
601 602 {FUNC}, \
602 603 {FUNC}, \
603 604 SFLAGS, \
604 605 DFLAGS, \
605 606 }
606 607
607 608 #define REGISTER_BLIT(SRC, COMP, DST, FUNC) \
608 609 REGISTER_PRIMITIVE(Blit, SRC, COMP, DST, FUNC)
609 610
610 611 #define REGISTER_BLIT_FLAGS(SRC, COMP, DST, FUNC, SFLAGS, DFLAGS) \
611 612 REGISTER_PRIMITIVE_FLAGS(Blit, SRC, COMP, DST, FUNC, SFLAGS, DFLAGS)
612 613
613 614 #define REGISTER_SCALEBLIT(SRC, COMP, DST, FUNC) \
614 615 REGISTER_PRIMITIVE(ScaledBlit, SRC, COMP, DST, FUNC)
615 616
616 617 #define REGISTER_SCALEBLIT_FLAGS(SRC, COMP, DST, FUNC, SFLAGS, DFLAGS) \
617 618 REGISTER_PRIMITIVE_FLAGS(ScaledBlit, SRC, COMP, DST, FUNC, SFLAGS, DFLAGS)
618 619
619 620 #define REGISTER_BLITBG(SRC, COMP, DST, FUNC) \
620 621 REGISTER_PRIMITIVE(BlitBg, SRC, COMP, DST, FUNC)
621 622
622 623 #define REGISTER_FILLRECT(SRC, COMP, DST, FUNC) \
623 624 REGISTER_PRIMITIVE(FillRect, SRC, COMP, DST, FUNC)
624 625
625 626 #define REGISTER_FILLSPANS(SRC, COMP, DST, FUNC) \
626 627 REGISTER_PRIMITIVE(FillSpans, SRC, COMP, DST, FUNC)
627 628
628 629 #define REGISTER_FILLPGRAM(SRC, COMP, DST, FUNC) \
629 630 REGISTER_PRIMITIVE(FillParallelogram, SRC, COMP, DST, FUNC), \
630 631 REGISTER_PRIMITIVE(DrawParallelogram, SRC, COMP, DST, FUNC)
631 632
632 633 #define REGISTER_LINE_PRIMITIVES(SRC, COMP, DST, FUNC) \
633 634 REGISTER_PRIMITIVE(DrawLine, SRC, COMP, DST, FUNC), \
634 635 REGISTER_PRIMITIVE(DrawRect, SRC, COMP, DST, FUNC), \
635 636 REGISTER_PRIMITIVE(DrawPolygons, SRC, COMP, DST, FUNC), \
636 637 REGISTER_PRIMITIVE(DrawPath, SRC, COMP, DST, FUNC), \
637 638 REGISTER_PRIMITIVE(FillPath, SRC, COMP, DST, FUNC)
638 639
639 640 #define REGISTER_MASKBLIT(SRC, COMP, DST, FUNC) \
640 641 REGISTER_PRIMITIVE(MaskBlit, SRC, COMP, DST, FUNC)
641 642
642 643 #define REGISTER_MASKFILL(SRC, COMP, DST, FUNC) \
643 644 REGISTER_PRIMITIVE(MaskFill, SRC, COMP, DST, FUNC)
644 645
645 646 #define REGISTER_DRAWGLYPHLIST(SRC, COMP, DST, FUNC) \
646 647 REGISTER_PRIMITIVE(DrawGlyphList, SRC, COMP, DST, FUNC)
647 648
648 649 #define REGISTER_DRAWGLYPHLISTAA(SRC, COMP, DST, FUNC) \
649 650 REGISTER_PRIMITIVE(DrawGlyphListAA, SRC, COMP, DST, FUNC)
650 651
651 652 #define REGISTER_DRAWGLYPHLISTLCD(SRC, COMP, DST, FUNC) \
652 653 REGISTER_PRIMITIVE(DrawGlyphListLCD, SRC, COMP, DST, FUNC)
653 654
654 655 #ifdef __cplusplus
655 656 };
656 657 #endif
657 658
658 659 #endif /* GraphicsPrimitiveMgr_h_Included */
↓ open down ↓ |
88 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX