< prev index next >

src/java.desktop/macosx/native/libawt_lwawt/awt/QuartzSurfaceData.h

Print this page




  27 #import "BufImgSurfaceData.h"
  28 #import "AWTFont.h"
  29 #import <Cocoa/Cocoa.h>
  30 
  31 // these flags are not defined on Tiger on PPC, so we need to make them a no-op
  32 #if !defined(kCGBitmapByteOrder32Host)
  33 #define kCGBitmapByteOrder32Host 0
  34 #endif
  35 #if !defined(kCGBitmapByteOrder16Host)
  36 #define kCGBitmapByteOrder16Host 0
  37 #endif
  38 
  39 // NOTE : Modify the printSurfaceDataDiagnostics API if you change this enum
  40 enum SDRenderType
  41 {
  42     SD_Nothing,
  43     SD_Stroke,
  44     SD_Fill,
  45     SD_EOFill,
  46     SD_Shade,

  47     SD_Pattern,
  48     SD_Image,
  49     SD_Text,
  50     SD_CopyArea,
  51     SD_Queue,
  52     SD_External
  53 };
  54 typedef enum SDRenderType SDRenderType;
  55 
  56 struct _stateShadingInfo
  57 {
  58     CGPoint    start;
  59     CGPoint    end;
  60     CGFloat    colors[8];
  61     BOOL    cyclic;
  62     CGFloat    length; // of the total segment (used by the cyclic gradient)
  63     CGFloat    period; // of the cycle (used by the cyclic gradient)
  64     CGFloat    offset; // of the cycle from the start (used by the cyclic gradient)
  65 };
  66 typedef struct _stateShadingInfo StateShadingInfo;
  67 










  68 struct _statePatternInfo
  69 {
  70     CGFloat    tx;
  71     CGFloat    ty;
  72     CGFloat    sx;
  73     CGFloat    sy;
  74     jint    width;
  75     jint    height;
  76     jobject    sdata;
  77 };
  78 typedef struct _statePatternInfo StatePatternInfo;
  79 
  80 struct _stateGraphicsInfo
  81 {
  82     BOOL                adjustedLineWidth;
  83     BOOL                adjustedAntialias;
  84     BOOL                antialiased;
  85     jint                interpolation;
  86     BOOL                simpleColor;
  87     BOOL                simpleStroke;


 105     BOOL                    newContext;
 106     CGContextRef            cgRef;
 107 
 108     jint*                    javaGraphicsStates;
 109     jobject                    javaGraphicsStatesObjects;
 110 
 111     SDRenderType            renderType;
 112 
 113     // rdar://problem/5214320
 114     // Gradient/Texture fills of Java GeneralPath don't respect the even odd winding rule (quartz pipeline).
 115     BOOL                    isEvenOddFill;        // Tracks whether the original render type passed into
 116                                                 // SetUpCGContext(...) is SD_EOFILL.
 117                                                 // The reason for this field is because SetUpCGContext(...) can
 118                                                 // change the render type after calling SetUpPaint(...), and right
 119                                                 // after that, the possibly new render type is then assigned into
 120                                                 // qsdo->renderType.  Sigh!!!
 121                                                 // This field is potentially used within CompleteCGContext(...) or
 122                                                 // its callees.
 123 
 124     StateShadingInfo*        shadingInfo;        // tracks shading and its parameters

 125     StatePatternInfo*        patternInfo;        // tracks pattern and its parameters
 126     StateGraphicsInfo        graphicsStateInfo;    // tracks other graphics state
 127 
 128     BOOL  syncContentsToLayer;    // should changed pixels be synced to a CALayer
 129     CGRect updateRect;     // used by the layer synchronization code to track update rects.
 130 };
 131 
 132 void SetUpCGContext(JNIEnv *env, QuartzSDOps *qsdo, SDRenderType renderType);
 133 SDRenderType DoShapeUsingCG(CGContextRef cgRef, jint *types, jfloat *coords, jint numtypes, BOOL fill, CGFloat offsetX, CGFloat offsetY);
 134 SDRenderType SetUpPaint(JNIEnv *env, QuartzSDOps *qsdo, SDRenderType renderType);
 135 void CompleteCGContext(JNIEnv *env, QuartzSDOps *qsdo);
 136 
 137 NSColor* ByteParametersToNSColor(JNIEnv* env, jint *javaGraphicsStates, NSColor* defColor);
 138 
 139 #define JNF_COCOA_RENDERER_EXIT(env) \
 140 } @catch(NSException *localException) { \
 141     qsdo->FinishSurface(env, qsdo); \
 142     [JNFException throwToJava:env exception:localException]; \
 143 } \
 144         if (_token) JNFNativeMethodExit(_token); \


  27 #import "BufImgSurfaceData.h"
  28 #import "AWTFont.h"
  29 #import <Cocoa/Cocoa.h>
  30 
  31 // these flags are not defined on Tiger on PPC, so we need to make them a no-op
  32 #if !defined(kCGBitmapByteOrder32Host)
  33 #define kCGBitmapByteOrder32Host 0
  34 #endif
  35 #if !defined(kCGBitmapByteOrder16Host)
  36 #define kCGBitmapByteOrder16Host 0
  37 #endif
  38 
  39 // NOTE : Modify the printSurfaceDataDiagnostics API if you change this enum
  40 enum SDRenderType
  41 {
  42     SD_Nothing,
  43     SD_Stroke,
  44     SD_Fill,
  45     SD_EOFill,
  46     SD_Shade,
  47     SD_Gradient,
  48     SD_Pattern,
  49     SD_Image,
  50     SD_Text,
  51     SD_CopyArea,
  52     SD_Queue,
  53     SD_External
  54 };
  55 typedef enum SDRenderType SDRenderType;
  56 
  57 struct _stateShadingInfo
  58 {
  59     CGPoint    start;
  60     CGPoint    end;
  61     CGFloat    colors[8];
  62     BOOL    cyclic;
  63     CGFloat    length; // of the total segment (used by the cyclic gradient)
  64     CGFloat    period; // of the cycle (used by the cyclic gradient)
  65     CGFloat    offset; // of the cycle from the start (used by the cyclic gradient)
  66 };
  67 typedef struct _stateShadingInfo StateShadingInfo;
  68 
  69 struct _stateGradientInfo
  70 {
  71     CGPoint    start;
  72     CGPoint    end;
  73     CGFloat* colordata;
  74     CGFloat* fractionsdata;
  75     jint     fractionsLength;
  76 };
  77 typedef struct _stateGradientInfo StateGradientInfo;
  78 
  79 struct _statePatternInfo
  80 {
  81     CGFloat    tx;
  82     CGFloat    ty;
  83     CGFloat    sx;
  84     CGFloat    sy;
  85     jint    width;
  86     jint    height;
  87     jobject    sdata;
  88 };
  89 typedef struct _statePatternInfo StatePatternInfo;
  90 
  91 struct _stateGraphicsInfo
  92 {
  93     BOOL                adjustedLineWidth;
  94     BOOL                adjustedAntialias;
  95     BOOL                antialiased;
  96     jint                interpolation;
  97     BOOL                simpleColor;
  98     BOOL                simpleStroke;


 116     BOOL                    newContext;
 117     CGContextRef            cgRef;
 118 
 119     jint*                    javaGraphicsStates;
 120     jobject                    javaGraphicsStatesObjects;
 121 
 122     SDRenderType            renderType;
 123 
 124     // rdar://problem/5214320
 125     // Gradient/Texture fills of Java GeneralPath don't respect the even odd winding rule (quartz pipeline).
 126     BOOL                    isEvenOddFill;        // Tracks whether the original render type passed into
 127                                                 // SetUpCGContext(...) is SD_EOFILL.
 128                                                 // The reason for this field is because SetUpCGContext(...) can
 129                                                 // change the render type after calling SetUpPaint(...), and right
 130                                                 // after that, the possibly new render type is then assigned into
 131                                                 // qsdo->renderType.  Sigh!!!
 132                                                 // This field is potentially used within CompleteCGContext(...) or
 133                                                 // its callees.
 134 
 135     StateShadingInfo*        shadingInfo;        // tracks shading and its parameters
 136     StateGradientInfo*       gradientInfo;       // tracks gradient and its parameters
 137     StatePatternInfo*        patternInfo;        // tracks pattern and its parameters
 138     StateGraphicsInfo        graphicsStateInfo;    // tracks other graphics state
 139 
 140     BOOL  syncContentsToLayer;    // should changed pixels be synced to a CALayer
 141     CGRect updateRect;     // used by the layer synchronization code to track update rects.
 142 };
 143 
 144 void SetUpCGContext(JNIEnv *env, QuartzSDOps *qsdo, SDRenderType renderType);
 145 SDRenderType DoShapeUsingCG(CGContextRef cgRef, jint *types, jfloat *coords, jint numtypes, BOOL fill, CGFloat offsetX, CGFloat offsetY);
 146 SDRenderType SetUpPaint(JNIEnv *env, QuartzSDOps *qsdo, SDRenderType renderType);
 147 void CompleteCGContext(JNIEnv *env, QuartzSDOps *qsdo);
 148 
 149 NSColor* ByteParametersToNSColor(JNIEnv* env, jint *javaGraphicsStates, NSColor* defColor);
 150 
 151 #define JNF_COCOA_RENDERER_EXIT(env) \
 152 } @catch(NSException *localException) { \
 153     qsdo->FinishSurface(env, qsdo); \
 154     [JNFException throwToJava:env exception:localException]; \
 155 } \
 156         if (_token) JNFNativeMethodExit(_token); \
< prev index next >