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