Permalink
Browse files

CA fixes

  • Loading branch information...
1 parent b12bdab commit 8822fa8362060af2a16bc93853d7dbadef38d812 @cjwl cjwl committed Jan 10, 2011
View
@@ -12,7 +12,6 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
@class NSEvent,NSColor, NSPasteboard,NSDraggingManager,NSPrintInfo, NSView, NSSavePanel, NSOpenPanel, CGWindow;
@interface NSDisplay : NSObject {
- unsigned _eventMask;
NSMutableArray *_eventQueue;
}
View
@@ -29,7 +29,6 @@ +(NSDisplay *)currentDisplay {
}
-init {
- _eventMask=0;
_eventQueue=[NSMutableArray new];
return self;
}
@@ -95,8 +94,6 @@ -(void)setCursor:(id)cursor {
-(NSEvent *)nextEventMatchingMask:(unsigned)mask untilDate:(NSDate *)untilDate inMode:(NSString *)mode dequeue:(BOOL)dequeue {
NSEvent *result=nil;
- _eventMask=mask;
-
if([_eventQueue count])
untilDate=[NSDate date];
@@ -7,7 +7,6 @@ The above copyright notice and this permission notice shall be included in all c
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#import <CoreGraphics/CGWindow.h>
-#import <AppKit/NSDragging.h>
#import <OpenGL/OpenGL.h>
#import <Onyx2D/O2Geometry.h>
@@ -98,6 +98,34 @@
remoteGlobalIDString = FE01A5970C5D9B6900AEA51A;
remoteInfo = "Foundation-Windows-i386";
};
+ FE2A2D0612D2C7760028C06D /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = FE2A2D0012D2C7760028C06D /* OpenGL.xcodeproj */;
+ proxyType = 2;
+ remoteGlobalIDString = 8DC2EF5B0486A6940098B216 /* OpenGL.framework */;
+ remoteInfo = "OpenGL-Windows-i386";
+ };
+ FE2A2D0812D2C7760028C06D /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = FE2A2D0012D2C7760028C06D /* OpenGL.xcodeproj */;
+ proxyType = 2;
+ remoteGlobalIDString = C8E0BE8A0F0E544700677729 /* OpenGL.framework */;
+ remoteInfo = "OpenGL-Darwin-i386";
+ };
+ FE2A2D0A12D2C7760028C06D /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = FE2A2D0012D2C7760028C06D /* OpenGL.xcodeproj */;
+ proxyType = 2;
+ remoteGlobalIDString = FE5A876310C6F244005E348A /* OpenGL.framework */;
+ remoteInfo = "OpenGL-FreeBSD-i386";
+ };
+ FE2A2D0C12D2C77C0028C06D /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = FE2A2D0012D2C7760028C06D /* OpenGL.xcodeproj */;
+ proxyType = 1;
+ remoteGlobalIDString = 8DC2EF4F0486A6940098B216 /* OpenGL-Windows-i386 */;
+ remoteInfo = "OpenGL-Windows-i386";
+ };
/* End PBXContainerItemProxy section */
/* Begin PBXFileReference section */
@@ -106,6 +134,7 @@
50ACFD3D1275F6F3008BEDDD /* Foundation.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = Foundation.xcodeproj; path = ../Foundation/Foundation.xcodeproj; sourceTree = SOURCE_ROOT; };
8DC2EF5A0486A6940098B216 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
8DC2EF5B0486A6940098B216 /* CoreVideo.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = CoreVideo.framework; sourceTree = BUILT_PRODUCTS_DIR; };
+ FE2A2D0012D2C7760028C06D /* OpenGL.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = OpenGL.xcodeproj; path = ../OpenGL/OpenGL.xcodeproj; sourceTree = SOURCE_ROOT; };
FE43015A11E2531F00EBDD56 /* CVDisplayLink.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CVDisplayLink.h; sourceTree = "<group>"; };
FE43015B11E2531F00EBDD56 /* CVDisplayLink.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CVDisplayLink.m; sourceTree = "<group>"; };
FE43017B11E253E900EBDD56 /* CoreVideo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CoreVideo.h; sourceTree = "<group>"; };
@@ -136,6 +165,7 @@
0867D691FE84028FC02AAC07 /* CoreVideo */ = {
isa = PBXGroup;
children = (
+ FE2A2D0012D2C7760028C06D /* OpenGL.xcodeproj */,
50ACFD3D1275F6F3008BEDDD /* Foundation.xcodeproj */,
FE43045A11E2779700EBDD56 /* CVReturn.h */,
FE43045811E2769E00EBDD56 /* CVBase.h */,
@@ -206,6 +236,16 @@
name = Products;
sourceTree = "<group>";
};
+ FE2A2D0112D2C7760028C06D /* Products */ = {
+ isa = PBXGroup;
+ children = (
+ FE2A2D0712D2C7760028C06D /* OpenGL.framework */,
+ FE2A2D0912D2C7760028C06D /* OpenGL.framework */,
+ FE2A2D0B12D2C7760028C06D /* OpenGL.framework */,
+ );
+ name = Products;
+ sourceTree = "<group>";
+ };
/* End PBXGroup section */
/* Begin PBXHeadersBuildPhase section */
@@ -237,6 +277,7 @@
);
dependencies = (
50ACFD5D1275F6F8008BEDDD /* PBXTargetDependency */,
+ FE2A2D0D12D2C77C0028C06D /* PBXTargetDependency */,
);
name = "CoreVideo-Windows-i386";
productInstallPath = "$(HOME)/Library/Frameworks";
@@ -267,6 +308,10 @@
ProductGroup = 50ACFD3E1275F6F3008BEDDD /* Products */;
ProjectRef = 50ACFD3D1275F6F3008BEDDD /* Foundation.xcodeproj */;
},
+ {
+ ProductGroup = FE2A2D0112D2C7760028C06D /* Products */;
+ ProjectRef = FE2A2D0012D2C7760028C06D /* OpenGL.xcodeproj */;
+ },
);
projectRoot = "";
targets = (
@@ -339,6 +384,27 @@
remoteRef = 50ACFD5A1275F6F3008BEDDD /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
+ FE2A2D0712D2C7760028C06D /* OpenGL.framework */ = {
+ isa = PBXReferenceProxy;
+ fileType = wrapper.framework;
+ path = OpenGL.framework;
+ remoteRef = FE2A2D0612D2C7760028C06D /* PBXContainerItemProxy */;
+ sourceTree = BUILT_PRODUCTS_DIR;
+ };
+ FE2A2D0912D2C7760028C06D /* OpenGL.framework */ = {
+ isa = PBXReferenceProxy;
+ fileType = wrapper.framework;
+ path = OpenGL.framework;
+ remoteRef = FE2A2D0812D2C7760028C06D /* PBXContainerItemProxy */;
+ sourceTree = BUILT_PRODUCTS_DIR;
+ };
+ FE2A2D0B12D2C7760028C06D /* OpenGL.framework */ = {
+ isa = PBXReferenceProxy;
+ fileType = wrapper.framework;
+ path = OpenGL.framework;
+ remoteRef = FE2A2D0A12D2C7760028C06D /* PBXContainerItemProxy */;
+ sourceTree = BUILT_PRODUCTS_DIR;
+ };
/* End PBXReferenceProxy section */
/* Begin PBXResourcesBuildPhase section */
@@ -369,6 +435,11 @@
name = "Foundation-Windows-i386";
targetProxy = 50ACFD5C1275F6F8008BEDDD /* PBXContainerItemProxy */;
};
+ FE2A2D0D12D2C77C0028C06D /* PBXTargetDependency */ = {
+ isa = PBXTargetDependency;
+ name = "OpenGL-Windows-i386";
+ targetProxy = FE2A2D0C12D2C77C0028C06D /* PBXContainerItemProxy */;
+ };
/* End PBXTargetDependency section */
/* Begin PBXVariantGroup section */
View
@@ -19,6 +19,8 @@ typedef void (*O2BitmapContextReleaseDataCallback)(void *userInfo,void *data);
O2Surface *_surface;
}
+-(Class)surfaceClass;
+
-initWithSurface:(O2Surface *)surface flipped:(BOOL)flipped;
-(O2Surface *)surface;
View
@@ -25,8 +25,12 @@ @implementation O2BitmapContext
return self;
}
+-(Class)surfaceClass {
+ return [O2Surface class];
+}
+
-initWithBytes:(void *)bytes width:(size_t)width height:(size_t)height bitsPerComponent:(size_t)bitsPerComponent bytesPerRow:(size_t)bytesPerRow colorSpace:(O2ColorSpaceRef)colorSpace bitmapInfo:(O2BitmapInfo)bitmapInfo releaseCallback:(O2BitmapContextReleaseDataCallback)releaseCallback releaseInfo:(void *)releaseInfo {
- O2Surface *surface=[[O2Surface alloc] initWithBytes:bytes width:width height:height bitsPerComponent:bitsPerComponent bytesPerRow:bytesPerRow colorSpace:colorSpace bitmapInfo:bitmapInfo];
+ O2Surface *surface=[[[self surfaceClass] alloc] initWithBytes:bytes width:width height:height bitsPerComponent:bitsPerComponent bytesPerRow:bytesPerRow colorSpace:colorSpace bitmapInfo:bitmapInfo];
[self initWithSurface:surface flipped:NO];
[surface release];
@@ -152,7 +152,7 @@ -(void)setWidth:(size_t)width height:(size_t)height reallocateOnlyIfRequired:(BO
}
-(O2Surface *)createSurfaceWithWidth:(size_t)width height:(size_t)height {
- return [[O2Surface alloc] initWithBytes:NULL width:width height:height bitsPerComponent:O2ImageGetBitsPerComponent(_surface) bytesPerRow:0 colorSpace:O2ImageGetColorSpace(_surface) bitmapInfo:O2ImageGetBitmapInfo(_surface)];
+ return [[[self surfaceClass] alloc] initWithBytes:NULL width:width height:height bitsPerComponent:O2ImageGetBitsPerComponent(_surface) bytesPerRow:0 colorSpace:O2ImageGetColorSpace(_surface) bitmapInfo:O2ImageGetBitmapInfo(_surface)];
}
-(O2Size)size {
@@ -26,6 +26,10 @@ +(BOOL)canInitBitmap {
return YES;
}
+-(Class)surfaceClass {
+ return [O2Surface_DIBSection class];
+}
+
-initWithSurface:(O2Surface *)surface flipped:(BOOL)flipped {
[super initWithSurface:surface flipped:flipped];
/* FIX: we need to also override initWithBytes:... and create an O2Surface_DIBSection for the pixel format.
@@ -34,6 +34,16 @@ @implementation O2Surface_DIBSection
}
+-initWithBytes:(void *)bytes width:(size_t)width height:(size_t)height bitsPerComponent:(size_t)bitsPerComponent bytesPerRow:(size_t)bytesPerRow colorSpace:(O2ColorSpaceRef)colorSpace bitmapInfo:(O2BitmapInfo)bitmapInfo {
+ if(bytes==NULL && bitsPerComponent==8 && bitmapInfo==(kO2ImageAlphaPremultipliedFirst|kO2BitmapByteOrder32Host) && O2ColorSpaceGetModel(colorSpace)==kO2ColorSpaceModelRGB){
+ return [self initWithWidth:width height:height compatibleWithDeviceContext:nil];
+ }
+
+ height=ABS(height);
+
+ return [super initWithBytes:bytes width:width height:height bitsPerComponent:bitsPerComponent bytesPerRow:bytesPerRow colorSpace:colorSpace bitmapInfo:bitmapInfo];
+}
+
-(void)dealloc {
[_deviceContext release];
[super dealloc];
View
@@ -1,4 +1,4 @@
-#import <Foundation/CAAction.h>
+#import <Foundation/NSObject.h>
@protocol CAAction
View
@@ -1,6 +1,7 @@
#import <Foundation/NSObject.h>
#import <QuartzCore/CABase.h>
#import <QuartzCore/CAMediaTiming.h>
+#import <QuartzCore/CAAction.h>
@class CAMediaTimingFunction;
@@ -14,7 +15,7 @@ CA_EXPORT NSString * const kCATransitionFromRight;
CA_EXPORT NSString * const kCATransitionFromTop;
CA_EXPORT NSString * const kCATransitionFromBottom;
-@interface CAAnimation : NSObject <NSCopying,CAMediaTiming> {
+@interface CAAnimation : NSObject <NSCopying,CAMediaTiming,CAAction> {
id _delegate;
BOOL _removedOnCompletion;
CAMediaTimingFunction *_timingFunction;
View
@@ -16,6 +16,10 @@ enum {
kCALayerMaxYMargin = 0x20,
};
+CA_EXPORT NSString * const kCAFilterLinear;
+CA_EXPORT NSString * const kCAFilterNearest;
+CA_EXPORT NSString * const kCAFilterTrilinear;
+
@interface CALayer : NSObject {
CALayerContext *_context;
CALayer *_superlayer;
@@ -29,8 +33,11 @@ enum {
id _contents;
CATransform3D _transform;
CATransform3D _sublayerTransform;
+ NSString *_minificationFilter;
+ NSString *_magnificationFilter;
BOOL _needsDisplay;
NSMutableDictionary *_animations;
+ NSNumber *_textureId;
}
+layer;
@@ -48,6 +55,9 @@ enum {
//@property CATransform3D transform;
@property CATransform3D sublayerTransform;
+@property(copy) NSString *minificationFilter;
+@property(copy) NSString *magnificationFilter;
+
-init;
-(void)addSublayer:(CALayer *)layer;
View
@@ -4,6 +4,10 @@
#import <QuartzCore/CATransaction.h>
#import <Foundation/NSDictionary.h>
+NSString * const kCAFilterLinear=@"linear";
+NSString * const kCAFilterNearest=@"nearest";
+NSString * const kCAFilterTrilinear=@"trilinear";
+
@implementation CALayer
+layer {
@@ -16,6 +20,12 @@ -(CALayerContext *)_context {
}
-(void)_setContext:(CALayerContext *)context {
+ if(_context!=context){
+ [_context deleteTextureId:_textureId];
+ [_textureId release];
+ _textureId=nil;
+ }
+
_context=context;
[_sublayers makeObjectsPerformSelector:@selector(_setContext:) withObject:context];
}
@@ -163,6 +173,26 @@ -(void)setSublayerTransform:(CATransform3D)value {
_sublayerTransform=value;
}
+-(NSString *)minificationFilter {
+ return _minificationFilter;
+}
+
+-(void)setMinificationFilter:(NSString *)value {
+ value=[value copy];
+ [_minificationFilter release];
+ _minificationFilter=value;
+}
+
+-(NSString *)magnificationFilter {
+ return _magnificationFilter;
+}
+
+-(void)setMagnificationFilter:(NSString *)value {
+ value=[value copy];
+ [_magnificationFilter release];
+ _magnificationFilter=value;
+}
+
-init {
_superlayer=nil;
_sublayers=[NSArray new];
@@ -175,13 +205,17 @@ -(void)setSublayerTransform:(CATransform3D)value {
_contents=nil;
_transform=CATransform3DIdentity;
_sublayerTransform=CATransform3DIdentity;
+ _minificationFilter=kCAFilterLinear;
+ _magnificationFilter=kCAFilterLinear;
_animations=[[NSMutableDictionary alloc] init];
return self;
}
-(void)dealloc {
[_sublayers release];
[_animations release];
+ [_minificationFilter release];
+ [_magnificationFilter release];
[super dealloc];
}
@@ -259,7 +293,6 @@ -(void)addAnimation:(CAAnimation *)animation forKey:(NSString *)key {
return;
[_animations setObject:animation forKey:key];
- NSLog(@"context=%@",_context);
[_context startTimerIfNeeded];
}
@@ -298,4 +331,14 @@ -(NSArray *)animationKeys {
return basic;
}
+-(NSNumber *)_textureId {
+ return _textureId;
+}
+
+-(void)_setTextureId:(NSNumber *)value {
+ value=[value copy];
+ [_textureId release];
+ _textureId=value;
+}
+
@end
@@ -2,7 +2,7 @@
#import <OpenGL/OpenGL.h>
#import <CoreGraphics/CGGeometry.h>
-@class CARenderer,CALayer,CGLPixelSurface,NSTimer;
+@class CARenderer,CALayer,CGLPixelSurface,NSTimer,NSMutableArray,NSNumber;
@interface CALayerContext : NSObject {
CGLPixelFormatObj _pixelFormat;
@@ -11,6 +11,8 @@
CALayer *_layer;
CARenderer *_renderer;
+ NSMutableArray *_deleteTextureIds;
+
NSTimer *_timer;
}
@@ -26,4 +28,6 @@
-(void)startTimerIfNeeded;
+-(void)deleteTextureId:(NSNumber *)textureId;
+
@end
Oops, something went wrong.

0 comments on commit 8822fa8

Please sign in to comment.