< prev index next >

src/java.desktop/macosx/native/libawt_lwawt/font/AWTStrike.m

Print this page
rev 52923 : 8226346: Build better binary builders
Reviewed-by: andrew


  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  *
  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.
  24  */
  25 
  26 #import <JavaNativeFoundation/JavaNativeFoundation.h>
  27 #import "java_awt_geom_PathIterator.h"
  28 #import "sun_font_CStrike.h"
  29 #import "sun_font_CStrikeDisposer.h"
  30 #import "CGGlyphImages.h"
  31 #import "CGGlyphOutlines.h"
  32 #import "CoreTextSupport.h"
  33 #include "fontscalerdefs.h"
  34 
  35 /* Use THIS_FILE when it is available. */
  36 #ifndef THIS_FILE
  37     #define THIS_FILE __FILE__
  38 #endif
  39 
  40 @implementation AWTStrike
  41 
  42 static CGAffineTransform sInverseTX = { 1, 0, 0, -1, 0, 0 };
  43 
  44 - (id) initWithFont:(AWTFont *)awtFont
  45                  tx:(CGAffineTransform)tx
  46            invDevTx:(CGAffineTransform)invDevTx
  47               style:(JRSFontRenderingStyle)style
  48             aaStyle:(jint)aaStyle {
  49 
  50     self = [super init];
  51     if (self) {
  52         fAWTFont = [awtFont retain];
  53         fStyle = style;
  54         fAAStyle = aaStyle;
  55 
  56         fTx = tx; // composited glyph and device transform
  57 
  58         fAltTx = tx;
  59         fAltTx.b *= -1;


  90 }
  91 
  92 @end
  93 
  94 
  95 #define AWT_FONT_CLEANUP_SETUP \
  96     BOOL _fontThrowJavaException = NO;
  97 
  98 #define AWT_FONT_CLEANUP_CHECK(a)                                       \
  99     if ((a) == NULL) {                                                  \
 100         _fontThrowJavaException = YES;                                  \
 101         goto cleanup;                                                   \
 102     }                                                                   \
 103     if ((*env)->ExceptionCheck(env) == JNI_TRUE) {                      \
 104         goto cleanup;                                                   \
 105     }
 106 
 107 #define AWT_FONT_CLEANUP_FINISH                                         \
 108     if (_fontThrowJavaException == YES) {                               \
 109         char s[512];                                                    \
 110         sprintf(s, "%s-%s:%d", THIS_FILE, __FUNCTION__, __LINE__);       \
 111         [JNFException raise:env as:kRuntimeException reason:s];         \
 112     }
 113 
 114 
 115 /*
 116  * Creates an affine transform from the corresponding doubles sent
 117  * from CStrike.getGlyphTx().
 118  */
 119 static inline CGAffineTransform
 120 GetTxFromDoubles(JNIEnv *env, jdoubleArray txArray)
 121 {
 122     if (txArray == NULL) {
 123         return CGAffineTransformIdentity;
 124     }
 125 
 126     jdouble *txPtr = (*env)->GetPrimitiveArrayCritical(env, txArray, NULL);
 127     if (txPtr == NULL) {
 128         return CGAffineTransformIdentity;
 129     }
 130 




  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  *
  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.
  24  */
  25 
  26 #import <JavaNativeFoundation/JavaNativeFoundation.h>
  27 #import "java_awt_geom_PathIterator.h"
  28 #import "sun_font_CStrike.h"
  29 #import "sun_font_CStrikeDisposer.h"
  30 #import "CGGlyphImages.h"
  31 #import "CGGlyphOutlines.h"
  32 #import "CoreTextSupport.h"
  33 #include "fontscalerdefs.h"
  34 





  35 @implementation AWTStrike
  36 
  37 static CGAffineTransform sInverseTX = { 1, 0, 0, -1, 0, 0 };
  38 
  39 - (id) initWithFont:(AWTFont *)awtFont
  40                  tx:(CGAffineTransform)tx
  41            invDevTx:(CGAffineTransform)invDevTx
  42               style:(JRSFontRenderingStyle)style
  43             aaStyle:(jint)aaStyle {
  44 
  45     self = [super init];
  46     if (self) {
  47         fAWTFont = [awtFont retain];
  48         fStyle = style;
  49         fAAStyle = aaStyle;
  50 
  51         fTx = tx; // composited glyph and device transform
  52 
  53         fAltTx = tx;
  54         fAltTx.b *= -1;


  85 }
  86 
  87 @end
  88 
  89 
  90 #define AWT_FONT_CLEANUP_SETUP \
  91     BOOL _fontThrowJavaException = NO;
  92 
  93 #define AWT_FONT_CLEANUP_CHECK(a)                                       \
  94     if ((a) == NULL) {                                                  \
  95         _fontThrowJavaException = YES;                                  \
  96         goto cleanup;                                                   \
  97     }                                                                   \
  98     if ((*env)->ExceptionCheck(env) == JNI_TRUE) {                      \
  99         goto cleanup;                                                   \
 100     }
 101 
 102 #define AWT_FONT_CLEANUP_FINISH                                         \
 103     if (_fontThrowJavaException == YES) {                               \
 104         char s[512];                                                    \
 105         sprintf(s, "%s-%s:%d", __FILE__, __FUNCTION__, __LINE__);       \
 106         [JNFException raise:env as:kRuntimeException reason:s];         \
 107     }
 108 
 109 
 110 /*
 111  * Creates an affine transform from the corresponding doubles sent
 112  * from CStrike.getGlyphTx().
 113  */
 114 static inline CGAffineTransform
 115 GetTxFromDoubles(JNIEnv *env, jdoubleArray txArray)
 116 {
 117     if (txArray == NULL) {
 118         return CGAffineTransformIdentity;
 119     }
 120 
 121     jdouble *txPtr = (*env)->GetPrimitiveArrayCritical(env, txArray, NULL);
 122     if (txPtr == NULL) {
 123         return CGAffineTransformIdentity;
 124     }
 125 


< prev index next >