/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
#ifndef GraphicsPrimitiveMgr_h_Included
#define GraphicsPrimitiveMgr_h_Included
#ifdef __cplusplus
extern "C" {
#endif
#include "java_awt_AlphaComposite.h"
#include "SurfaceData.h"
#include "SpanIterator.h"
#include "j2d_md.h"
#include "AlphaMath.h"
#include "GlyphImageRef.h"
/*
* This structure contains all of the information about a particular
* type of GraphicsPrimitive, such as a FillRect, a MaskFill, or a Blit.
*
* A global collection of these structures is declared and initialized
* to contain the necessary Java (JNI) information so that appropriate
* Java GraphicsPrimitive objects can be quickly constructed for a set
* of native loops simply by referencing the necessary entry from that
* collection for the type of primitive being registered.
*
* See PrimitiveTypes.{Blit,BlitBg,FillRect,...} below.
*/
typedef struct _PrimitiveType {
char *ClassName;
/* The integer constants to identify the compositing rule being defined. */
/*
* This structure holds the information retrieved from a Java
* Composite object for easy transfer to various C functions
* that implement the inner loop for a native primitive.
*
* Currently only AlphaComposite and XORComposite are supported.
*/
typedef struct _CompositeInfo {
union {
} details;
/*
* This structure is the common header for the two native structures
* that hold information about a particular SurfaceType or CompositeType.
*
* A global collection of these structures is declared and initialized
* to contain the necessary Java (JNI) information so that appropriate
* Java GraphicsPrimitive objects can be quickly constructed for a set
* of native loops simply by referencing the necessary entry from that
* collection for the type of composite or surface being implemented.
*
* See SurfaceTypes.{OpaqueColor,IntArgb,ByteGray,...} below.
* See CompositeTypes.{Xor,AnyAlpha,...} below.
*/
typedef struct _SurfCompHdr {
char *Name;
} SurfCompHdr;
/*
* The definitions for the SurfaceType structure described above.
*/
/*
* The signature for a function that returns the specific integer
* format pixel for a given ARGB color value for a particular
* SurfaceType implementation.
* This function is valid only after GetRasInfo call for the
* associated surface.
*/
/*
* The additional information needed to manipulate a surface:
* - The pixelFor function for translating ARGB values.
* Valid only after GetRasInfo call for this surface.
* - The additional flags needed when reading from this surface.
* - The additional flags needed when writing to this surface.
*/
typedef struct _SurfaceType {
} SurfaceType;
/*
* The definitions for the CompositeType structure described above.
*/
/*
* The signature for a function that fills in a CompositeInfo
* structure from the information present in a given Java Composite
* object.
*/
/*
* The additional information needed to implement a primitive that
* performs a particular composite operation:
* - The getCompInfo function for filling in a CompositeInfo structure.
* - The additional flags needed for locking the destination surface.
*/
typedef struct _CompositeType {
/*
* The signature of the native functions that register a set of
* related native GraphicsPrimitive functions.
*/
struct _NativePrimitive; /* forward reference for function typedefs */
/*
* This empty function signature represents an "old pre-ANSI style"
* function declaration which makes no claims about the argument list
* other than that the types of the arguments will undergo argument
* promotion in the calling conventions.
* (See section A7.3.2 in K&R 2nd edition.)
*
* When trying to statically initialize the function pointer field of
* a NativePrimitive structure, which is a union of all possible
* inner loop function signatures, the initializer constant must be
* compatible with the first field in the union. This generic function
* type allows us to assign any function pointer to that union as long
* as it meets the requirements specified above (i.e. all arguments
* are compatible with their promoted values according to the old
* style argument promotion calling semantics).
*
* Note: This means that you cannot define an argument to any of
* these native functions which is a byte or a short as that value
* would not be passed in the same way for an ANSI-style full prototype
* calling convention and an old-style argument promotion calling
* convention.
*/
typedef void (AnyFunc)();
/*
* The signature of the inner loop function for a "Blit".
*/
struct _NativePrimitive *pPrim,
/*
* The signature of the inner loop function for a "BlitBg".
*/
struct _NativePrimitive *pPrim,
/*
* The signature of the inner loop function for a "ScaleBlit".
*/
struct _NativePrimitive *pPrim,
/*
* The signature of the inner loop function for a "FillRect".
*/
/*
* The signature of the inner loop function for a "FillSpans".
*/
/*
* The signature of the inner loop function for a "DrawLine".
* Note that this same inner loop is used for native DrawRect
* and DrawPolygons primitives.
*/
struct _NativePrimitive *pPrim,
/*
* The signature of the inner loop function for a "MaskFill".
*/
struct _NativePrimitive *pPrim,
/*
* The signature of the inner loop function for a "MaskBlit".
*/
struct _NativePrimitive *pPrim,
/*
* The signature of the inner loop function for a "DrawGlyphList".
*/
struct _NativePrimitive *pPrim,
/*
* The signature of the inner loop function for a "DrawGlyphListAA".
*/
struct _NativePrimitive *pPrim,
/*
* The signature of the inner loop function for a "DrawGlyphListLCD".
* rgbOrder is a jint rather than a jboolean so that this typedef matches
* AnyFunc which is the first element in a union in NativePrimitive's
* initialiser. See the comments alongside declaration of the AnyFunc type for
* a full explanation.
*/
unsigned char *gammaLut,
unsigned char *invGammaLut,
struct _NativePrimitive *pPrim,
/*
* The signature of the inner loop functions for a "TransformHelper".
*/
typedef struct {
/*
* The signature of the inner loop function for a "FillParallelogram"
* Note that this same inner loop is used for native DrawParallelogram
* primitives.
* Note that these functions are paired with equivalent DrawLine
* inner loop functions to facilitate nicer looking and faster thin
* transformed drawrect calls.
*/
typedef struct {
/*
* This structure contains all information for defining a single
* native GraphicsPrimitive, including:
* - The information about the type of the GraphicsPrimitive subclass.
* - The information about the type of the source surface.
* - The information about the type of the compositing operation.
* - The information about the type of the destination surface.
* - A pointer to the function that performs the actual inner loop work.
* - Extra flags needed for locking the source and destination surfaces
* above and beyond the flags specified in the Primitive, Composite
* and SurfaceType structures. (For most native primitives these
* flags can be calculated automatically from information stored in
* the PrimitiveType, SurfaceType, and CompositeType structures.)
*/
typedef struct _NativePrimitive {
/* See declaration of AnyFunc type above for comments explaining why
* only AnyFunc is used by the initializers for these union fields
* and consequent type restrictions.
*/
union {
/*
* This function should be defined to return a pointer to
* an accelerated version of a primitive function 'func_c'
* if it exists and to return a copy of the input parameter
* otherwise.
*/
/*
* The global collection of all primitive types. Specific NativePrimitive
* structures can be statically initialized by pointing to these structures.
*/
extern struct _PrimitiveTypes {
/*
* The global collection of all surface types. Specific NativePrimitive
* structures can be statically initialized by pointing to these structures.
*/
extern struct _SurfaceTypes {
} SurfaceTypes;
/*
* The global collection of all composite types. Specific NativePrimitive
* structures can be statically initialized by pointing to these structures.
*/
extern struct _CompositeTypes {
#define ArraySize(A) (sizeof(A) / sizeof(A[0]))
/*
* The function to call with an array of NativePrimitive structures
* to register them with the Java GraphicsPrimitiveMgr.
*/
/*
* The utility function to retrieve the NativePrimitive structure
* from a given Java GraphicsPrimitive object.
*/
/*
* Utility functions to get values from a Java SunGraphics2D or Color object.
*/
/*
* Data structure and functions to retrieve and use
* AffineTransform objects from the native level.
*/
typedef struct {
extern jfieldID path2DTypesID;
extern jfieldID path2DNumTypesID;
extern jfieldID path2DWindingRuleID;
extern jfieldID path2DFloatCoordsID;
extern jfieldID sg2dStrokeHintID;
extern jint sunHints_INTVAL_STROKE_PURE;
/*
* Macros for using jlong variables as 32bits.32bits fractional values
*/
/*
* Macros to help in defining arrays of NativePrimitive structures.
*
* These macros are the very base macros. More specific macros are
* defined in LoopMacros.h.
*
* Note that the DrawLine, DrawRect, and DrawPolygons primitives are
* all registered together from a single shared native function pointer.
*/
{ \
& PrimitiveTypes.TYPE, \
& SurfaceTypes.SRC, \
& CompositeTypes.COMP, \
& SurfaceTypes.DST, \
{FUNC}, \
{FUNC}, \
0, \
0 \
}
{ \
& PrimitiveTypes.TYPE, \
& SurfaceTypes.SRC, \
& CompositeTypes.COMP, \
& SurfaceTypes.DST, \
{FUNC}, \
{FUNC}, \
SFLAGS, \
DFLAGS, \
}
#ifdef __cplusplus
};
#endif
#endif /* GraphicsPrimitiveMgr_h_Included */