comparison src/macosx/native/sun/awt/ImageSurfaceData.m @ 5304:0fa8d5080fd8

7187834: [macosx] Usage of private API in macosx 2d implementation causes Apple Store rejection Reviewed-by: prr, igor, swingler
author skovatch
date Fri, 07 Sep 2012 08:22:15 -0700
parents 5cca2f1a37da
children
comparison
equal deleted inserted replaced
0:1bf7ca7f6a5d 1:ada5ba4247f6
50 // same value as defined in Sun's own code 50 // same value as defined in Sun's own code
51 #define XOR_ALPHA_CUTOFF 128 51 #define XOR_ALPHA_CUTOFF 128
52 52
53 // for vImage framework headers 53 // for vImage framework headers
54 #include <Accelerate/Accelerate.h> 54 #include <Accelerate/Accelerate.h>
55
56
57 // private Quartz routines needed here
58 CG_EXTERN void CGContextSetCTM(CGContextRef ref, CGAffineTransform tx);
59 55
60 static ContextInfo sDefaultContextInfo[sun_java2d_OSXOffScreenSurfaceData_TYPE_3BYTE_RGB+1] = 56 static ContextInfo sDefaultContextInfo[sun_java2d_OSXOffScreenSurfaceData_TYPE_3BYTE_RGB+1] =
61 { 57 {
62 {YES, YES, 8, 4, 0, kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Host, NULL}, // TYPE_CUSTOM // special case 58 {YES, YES, 8, 4, 0, kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Host, NULL}, // TYPE_CUSTOM // special case
63 {YES, YES, 8, 4, 0, kCGImageAlphaNoneSkipFirst | kCGBitmapByteOrder32Host, NULL}, // TYPE_INT_RGB 59 {YES, YES, 8, 4, 0, kCGImageAlphaNoneSkipFirst | kCGBitmapByteOrder32Host, NULL}, // TYPE_INT_RGB
940 } 936 }
941 937
942 // intitalize the context to match the Java coordinate system 938 // intitalize the context to match the Java coordinate system
943 939
944 // BG, since the context is created above, we can just concat 940 // BG, since the context is created above, we can just concat
945 //CGContextSetCTM(qsdo->cgRef, CGAffineTransformMake(1, 0, 0, -1, 0, isdo->height));
946 CGContextConcatCTM(qsdo->cgRef, CGAffineTransformMake(1, 0, 0, -1, 0, isdo->height)); 941 CGContextConcatCTM(qsdo->cgRef, CGAffineTransformMake(1, 0, 0, -1, 0, isdo->height));
947 942
948 CGContextSaveGState(qsdo->cgRef); // this will make sure we don't go pass device context settings 943 CGContextSaveGState(qsdo->cgRef); // this will make sure we don't go pass device context settings
949 CGContextSaveGState(qsdo->cgRef); // this will put user settings on top, used by LazyStateManagement code 944 CGContextSaveGState(qsdo->cgRef); // this will put user settings on top, used by LazyStateManagement code
950 qsdo->newContext = YES; 945 qsdo->newContext = YES;
1112 } 1107 }
1113 1108
1114 if (qsdo->cgRef != NULL) 1109 if (qsdo->cgRef != NULL)
1115 { 1110 {
1116 CGContextSaveGState(qsdo->cgRef); 1111 CGContextSaveGState(qsdo->cgRef);
1117 CGContextSetCTM(qsdo->cgRef, CGAffineTransformMake(1, 0, 0, 1, 0, 0)); 1112 CGAffineTransform currCTM = CGContextGetCTM(qsdo->cgRef);
1113 CGAffineTransform inverse = CGAffineTransformInvert(currCTM);
1114 CGContextConcatCTM(qsdo->cgRef, inverse);
1118 CGContextSetBlendMode(qsdo->cgRef, kCGBlendModeCopy); 1115 CGContextSetBlendMode(qsdo->cgRef, kCGBlendModeCopy);
1119 CGContextSetAlpha(qsdo->cgRef, 1.0f); 1116 CGContextSetAlpha(qsdo->cgRef, 1.0f);
1120 CGContextDrawImage(qsdo->cgRef, CGRectMake(0, 0, width, height), javaImg); 1117 CGContextDrawImage(qsdo->cgRef, CGRectMake(0, 0, width, height), javaImg);
1121 CGContextFlush(qsdo->cgRef); 1118 CGContextFlush(qsdo->cgRef);
1122 CGContextRestoreGState(qsdo->cgRef); 1119 CGContextRestoreGState(qsdo->cgRef);