Reviewed by NOBODY (OOPS!).
authormjs <mjs@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 3 Jun 2005 23:25:27 +0000 (23:25 +0000)
committermjs <mjs@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 3 Jun 2005 23:25:27 +0000 (23:25 +0000)
- replace use of CGCompositeOperation SPI with NSCompositingOperation API

        * WebCoreSupport.subproj/WebImageData.h:
        * WebCoreSupport.subproj/WebImageData.m:
        (-[WebImageData _fillSolidColorInRect:compositeOperation:context:]):
        (-[WebImageData _PDFDrawFromRect:toRect:operation:alpha:flipped:context:]):
        * WebCoreSupport.subproj/WebImageRenderer.m:
        (-[WebImageRenderer drawImageInRect:fromRect:]):
        (-[WebImageRenderer drawImageInRect:fromRect:compositeOperator:context:]):
        * WebCoreSupport.subproj/WebImageRendererFactory.m:
        (-[WebImageRendererFactory CGCompositeOperationInContext:]):
        (-[WebImageRendererFactory setCGCompositeOperation:inContext:]):
        (-[WebImageRendererFactory setCGCompositeOperationFromString:inContext:]):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@9269 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebKit/ChangeLog
WebKit/WebCoreSupport.subproj/WebImageData.h
WebKit/WebCoreSupport.subproj/WebImageData.m
WebKit/WebCoreSupport.subproj/WebImageRenderer.m
WebKit/WebCoreSupport.subproj/WebImageRendererFactory.m

index 77a7bd4d4ecd360aa0fcf4ef8ed893b868aa8f98..dff65172216791e18206a56b45689171c14fd837 100644 (file)
@@ -1,3 +1,21 @@
+2005-06-03  Maciej Stachowiak  <mjs@apple.com>
+
+        Reviewed by NOBODY (OOPS!).
+
+       - replace use of CGCompositeOperation SPI with NSCompositingOperation API
+
+        * WebCoreSupport.subproj/WebImageData.h:
+        * WebCoreSupport.subproj/WebImageData.m:
+        (-[WebImageData _fillSolidColorInRect:compositeOperation:context:]):
+        (-[WebImageData _PDFDrawFromRect:toRect:operation:alpha:flipped:context:]):
+        * WebCoreSupport.subproj/WebImageRenderer.m:
+        (-[WebImageRenderer drawImageInRect:fromRect:]):
+        (-[WebImageRenderer drawImageInRect:fromRect:compositeOperator:context:]):
+        * WebCoreSupport.subproj/WebImageRendererFactory.m:
+        (-[WebImageRendererFactory CGCompositeOperationInContext:]):
+        (-[WebImageRendererFactory setCGCompositeOperation:inContext:]):
+        (-[WebImageRendererFactory setCGCompositeOperationFromString:inContext:]):
+
 2005-06-02  Maciej Stachowiak  <mjs@apple.com>
 
         Reviewed by Kevin.
index 671f59c9fd6b522733eb4aacf27291855c484010..e9a072b4d0060b3f9422d1b3c5d71894d3bbcd17 100644 (file)
@@ -5,9 +5,6 @@
 
 #import <Cocoa/Cocoa.h>
 
-// Needed for CGCompositeOperation
-#import <CoreGraphics/CGContextPrivate.h>
-
 @class WebImageRenderer;
 
 @interface WebImageData : NSObject <NSCopying>
@@ -46,8 +43,8 @@
 - (size_t)numberOfImages;
 - (CGImageRef)imageAtIndex:(size_t)index;
 - (BOOL)incrementalLoadWithBytes:(const void *)bytes length:(unsigned)length complete:(BOOL)isComplete callback:(id)c;
-- (void)drawImageAtIndex:(size_t)index inRect:(CGRect)ir fromRect:(CGRect)fr compositeOperation:(CGCompositeOperation)op context:(CGContextRef)aContext;
-- (void)drawImageAtIndex:(size_t)index inRect:(CGRect)ir fromRect:(CGRect)fr adjustedSize:(CGSize)size compositeOperation:(CGCompositeOperation)op context:(CGContextRef)aContext;
+- (void)drawImageAtIndex:(size_t)index inRect:(CGRect)ir fromRect:(CGRect)fr compositeOperation:(NSCompositingOperation)op context:(CGContextRef)aContext;
+- (void)drawImageAtIndex:(size_t)index inRect:(CGRect)ir fromRect:(CGRect)fr adjustedSize:(CGSize)size compositeOperation:(NSCompositingOperation)op context:(CGContextRef)aContext;
 - (void)tileInRect:(CGRect)rect fromPoint:(CGPoint)point context:(CGContextRef)aContext;
 - (BOOL)isNull;
 - (CGSize)size;
index ae62d0dab66574d701b9a318bb83b90bb3b7ddbf..a1124ab11fb7601954f1ecd605b9051d54ed7b77 100644 (file)
@@ -12,7 +12,6 @@
 
 #import <WebCore/WebCoreImageRenderer.h>
 
-#import <CoreGraphics/CGContextPrivate.h>
 #import <CoreGraphics/CGContextGState.h>
 #import <CoreGraphics/CGColorSpacePrivate.h>
 
@@ -32,7 +31,7 @@
 - (CFDictionaryRef)_imageSourceOptions;
 -(void)_createPDFWithData:(NSData *)data;
 - (CGPDFDocumentRef)_PDFDocumentRef;
-- (BOOL)_PDFDrawFromRect:(NSRect)srcRect toRect:(NSRect)dstRect operation:(CGCompositeOperation)op alpha:(float)alpha flipped:(BOOL)flipped context:(CGContextRef)context;
+- (BOOL)_PDFDrawFromRect:(NSRect)srcRect toRect:(NSRect)dstRect operation:(NSCompositingOperation)op alpha:(float)alpha flipped:(BOOL)flipped context:(CGContextRef)context;
 - (void)_cacheImages:(size_t)optionalIndex allImages:(BOOL)allImages;
 @end
 
     return YES;
 }
 
-- (void)_fillSolidColorInRect:(CGRect)rect compositeOperation:(CGCompositeOperation)op context:(CGContextRef)aContext
+- (void)_fillSolidColorInRect:(CGRect)rect compositeOperation:(NSCompositingOperation)op context:(CGContextRef)aContext
 {
     /*NSLog(@"WebImageData %p: filling with color %p, in {%.0f,%.0f, %.0f x %.0f}",
           self,solidColor,rect.origin.x,rect.origin.y,rect.size.width,rect.size.height);*/
     }
 }
 
-- (void)drawImageAtIndex:(size_t)index inRect:(CGRect)ir fromRect:(CGRect)fr adjustedSize:(CGSize)adjustedSize compositeOperation:(CGCompositeOperation)op context:(CGContextRef)aContext;
+- (void)drawImageAtIndex:(size_t)index inRect:(CGRect)ir fromRect:(CGRect)fr adjustedSize:(CGSize)adjustedSize compositeOperation:(NSCompositingOperation)op context:(CGContextRef)aContext;
 {
     if (isPDF) {
         [self _PDFDrawFromRect:NSMakeRect(fr.origin.x, fr.origin.y, fr.size.width, fr.size.height)
     }
 }
 
-- (void)drawImageAtIndex:(size_t)index inRect:(CGRect)ir fromRect:(CGRect)fr compositeOperation:(CGCompositeOperation)op context:(CGContextRef)aContext;
+- (void)drawImageAtIndex:(size_t)index inRect:(CGRect)ir fromRect:(CGRect)fr compositeOperation:(NSCompositingOperation)op context:(CGContextRef)aContext;
 {    
     [self drawImageAtIndex:index inRect:ir fromRect:fr adjustedSize:[self size] compositeOperation:op context:aContext];
 }
@@ -966,7 +965,7 @@ static NSMutableSet *activeAnimations;
     }
 }
 
-- (BOOL)_PDFDrawFromRect:(NSRect)srcRect toRect:(NSRect)dstRect operation:(CGCompositeOperation)op alpha:(float)alpha flipped:(BOOL)flipped context:(CGContextRef)context
+- (BOOL)_PDFDrawFromRect:(NSRect)srcRect toRect:(NSRect)dstRect operation:(NSCompositingOperation)op alpha:(float)alpha flipped:(BOOL)flipped context:(CGContextRef)context
 {
     float hScale, vScale;
 
index 44d20fcc1e61d7af445fef70570d1f3a94507bce..13e1f65f1ec69acf0fb478dad0409ee6f6d20df0 100644 (file)
@@ -14,8 +14,6 @@
 #import <WebCore/WebCoreImageRenderer.h>
 
 #import <CoreGraphics/CGContextPrivate.h>
-#import <CoreGraphics/CGContextGState.h>
-#import <CoreGraphics/CGColorSpacePrivate.h>
 
 
 #ifdef USE_CGIMAGEREF
 - (void)drawImageInRect:(NSRect)ir fromRect:(NSRect)fr
 {
     CGContextRef aContext = (CGContextRef)[[NSGraphicsContext currentContext] graphicsPort];
-    CGCompositeOperation op = kCGCompositeSover;
+    NSCompositingOperation op = NSCompositeSourceOver;
 
     [self drawImageInRect:ir fromRect:fr compositeOperator:op context:aContext];
 }
     if (aContext == 0)
         aContext = (CGContextRef)[[NSGraphicsContext currentContext] graphicsPort];
     
-    CGCompositeOperation op = (CGCompositeOperation)operator;
-    if (op == kCGCompositeUnknown)
-        op = kCGCompositeSover;
+    NSCompositingOperation op = (NSCompositingOperation)operator;
         
     if (isSizeAdjusted) {
         [imageData drawImageAtIndex:[imageData currentFrame] inRect:CGRectMake(ir.origin.x, ir.origin.y, ir.size.width, ir.size.height) 
index 5d5267c7beaea2c13c97d227fb70423016e339fb..f64a1f54ce947173fea73365f646f8a3bc10a574 100644 (file)
@@ -29,8 +29,6 @@
 #import <WebKit/WebAssertions.h>
 #import <Foundation/NSURLFileTypeMappings.h>
 
-#import <CoreGraphics/CGContextPrivate.h>
-
 @implementation WebImageRendererFactory
 
 + (void)createSharedFactory
 struct CompositeOperator
 {
     NSString *name;
-    CGCompositeOperation value;
+    NSCompositingOperation value;
 };
 
 #define NUM_COMPOSITE_OPERATORS 14
-struct CompositeOperator CGCompositeOperations[NUM_COMPOSITE_OPERATORS] = {
-    { @"clear", kCGCompositeClear },
-    { @"copy", kCGCompositeCopy },
-    { @"source-over", kCGCompositeSover },
-    { @"source-in", kCGCompositeSin },
-    { @"source-out", kCGCompositeSout },
-    { @"source-atop", kCGCompositeSatop },
-    { @"destination-over", kCGCompositeDover },
-    { @"destination-in", kCGCompositeDin },
-    { @"destination-out", kCGCompositeDout },
-    { @"destination-atop", kCGCompositeDatop },
-    { @"xor", kCGCompositeXor },
-    { @"darker", kCGCompositePlusd },
-    { @"highlight", kCGCompositePlusl },
-    { @"lighter", kCGCompositePlusl }    // Per AppKit
+struct CompositeOperator NSCompositingOperations[NUM_COMPOSITE_OPERATORS] = {
+    { @"clear", NSCompositeClear },
+    { @"copy", NSCompositeCopy },
+    { @"source-over", NSCompositeSourceOver },
+    { @"source-in", NSCompositeSourceIn },
+    { @"source-out", NSCompositeSourceOut },
+    { @"source-atop", NSCompositeSourceAtop },
+    { @"destination-over", NSCompositeDestinationOver },
+    { @"destination-in", NSCompositeDestinationIn },
+    { @"destination-out", NSCompositeDestinationOut },
+    { @"destination-atop", NSCompositeDestinationAtop },
+    { @"xor", NSCompositeXOR },
+    { @"darker", NSCompositePlusDarker },
+    { @"highlight", NSCompositeHighlight },
+    { @"lighter", NSCompositeHighlight }    // Per AppKit
 };
 
 - (int)CGCompositeOperationInContext:(CGContextRef)context
 {
-    CGCompositeOperation op = CGContextGetCompositeOperation (context);
-    return (int)op;
+       return [[NSGraphicsContext graphicsContextWithGraphicsPort:context flipped:NO] compositingOperation];
 }
 
 - (void)setCGCompositeOperation:(int)op inContext:(CGContextRef)context
 {
-    CGContextSetCompositeOperation(context, (CGCompositeOperation)op);
+       [[NSGraphicsContext graphicsContextWithGraphicsPort:context flipped:NO] setCompositingOperation:op];
 }
 
 - (void)setCGCompositeOperationFromString:(NSString *)operatorString inContext:(CGContextRef)context
 {
-    CGCompositeOperation op = kCGCompositeSover;
+    NSCompositingOperation op = NSCompositeSourceOver;
     
     if (operatorString) {
         int i;
         
         for (i = 0; i < NUM_COMPOSITE_OPERATORS; i++) {
-            if ([operatorString caseInsensitiveCompare:CGCompositeOperations[i].name] == NSOrderedSame) {
-                op = CGCompositeOperations[i].value;
+            if ([operatorString caseInsensitiveCompare:NSCompositingOperations[i].name] == NSOrderedSame) {
+                op = NSCompositingOperations[i].value;
                 break;
             }
         }
     }
     
-    CGContextSetCompositeOperation(context, op);
+       [[NSGraphicsContext graphicsContextWithGraphicsPort:context flipped:NO] setCompositingOperation:op];
 }