mirror of
https://github.com/darlinghq/darling-cocotron.git
synced 2024-11-23 12:09:51 +00:00
CA fixes
This commit is contained in:
parent
2858245160
commit
02a7635f37
@ -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;
|
||||
}
|
||||
|
||||
|
@ -29,7 +29,6 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
||||
}
|
||||
|
||||
-init {
|
||||
_eventMask=0;
|
||||
_eventQueue=[NSMutableArray new];
|
||||
return self;
|
||||
}
|
||||
@ -95,8 +94,6 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
||||
-(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 */
|
||||
|
@ -19,6 +19,8 @@ typedef void (*O2BitmapContextReleaseDataCallback)(void *userInfo,void *data);
|
||||
O2Surface *_surface;
|
||||
}
|
||||
|
||||
-(Class)surfaceClass;
|
||||
|
||||
-initWithSurface:(O2Surface *)surface flipped:(BOOL)flipped;
|
||||
|
||||
-(O2Surface *)surface;
|
||||
|
@ -25,8 +25,12 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
||||
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 O2DContextClipAndFillEdges(O2Context_builtin *self,int fillRuleMask);
|
||||
}
|
||||
|
||||
-(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 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
||||
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 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
||||
|
||||
}
|
||||
|
||||
-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];
|
||||
|
@ -1,4 +1,4 @@
|
||||
#import <Foundation/CAAction.h>
|
||||
#import <Foundation/NSObject.h>
|
||||
|
||||
@protocol CAAction
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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 @@
|
||||
}
|
||||
|
||||
-(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 @@
|
||||
_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,6 +205,8 @@
|
||||
_contents=nil;
|
||||
_transform=CATransform3DIdentity;
|
||||
_sublayerTransform=CATransform3DIdentity;
|
||||
_minificationFilter=kCAFilterLinear;
|
||||
_magnificationFilter=kCAFilterLinear;
|
||||
_animations=[[NSMutableDictionary alloc] init];
|
||||
return self;
|
||||
}
|
||||
@ -182,6 +214,8 @@
|
||||
-(void)dealloc {
|
||||
[_sublayers release];
|
||||
[_animations release];
|
||||
[_minificationFilter release];
|
||||
[_magnificationFilter release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
@ -259,7 +293,6 @@
|
||||
return;
|
||||
|
||||
[_animations setObject:animation forKey:key];
|
||||
NSLog(@"context=%@",_context);
|
||||
[_context startTimerIfNeeded];
|
||||
}
|
||||
|
||||
@ -298,4 +331,14 @@
|
||||
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
|
||||
|
@ -6,6 +6,8 @@
|
||||
|
||||
@interface CALayer(private)
|
||||
-(void)_setContext:(CALayerContext *)context;
|
||||
-(NSNumber *)_textureId;
|
||||
-(void)_setTextureId:(NSNumber *)value;
|
||||
@end
|
||||
|
||||
@implementation CALayerContext
|
||||
@ -71,6 +73,19 @@
|
||||
-(void)invalidate {
|
||||
}
|
||||
|
||||
-(void)assignTextureIdsToLayerTree:(CALayer *)layer {
|
||||
|
||||
if([layer _textureId]==nil){
|
||||
GLuint texture;
|
||||
|
||||
glGenTextures(1,&texture);
|
||||
[layer _setTextureId:[NSNumber numberWithUnsignedInt:texture]];
|
||||
}
|
||||
|
||||
for(CALayer *child in layer.sublayers)
|
||||
[self assignTextureIdsToLayerTree:child];
|
||||
}
|
||||
|
||||
-(void)renderLayer:(CALayer *)layer intoSurface:(CGLPixelSurface *)pixelSurface {
|
||||
CGLSetCurrentContext(_glContext);
|
||||
|
||||
@ -86,6 +101,19 @@
|
||||
glLoadIdentity();
|
||||
glOrtho (0, width, 0, height, -1, 1);
|
||||
|
||||
GLsizei i=0;
|
||||
GLuint deleteIds[[_deleteTextureIds count]];
|
||||
|
||||
for(NSNumber *number in _deleteTextureIds)
|
||||
deleteIds[i++]=[number unsignedIntValue];
|
||||
|
||||
if(i>0)
|
||||
glDeleteTextures(i,deleteIds);
|
||||
|
||||
[_deleteTextureIds removeAllObjects];
|
||||
|
||||
[self assignTextureIdsToLayerTree:layer];
|
||||
|
||||
[_renderer render];
|
||||
|
||||
[pixelSurface flushBuffer];
|
||||
@ -108,4 +136,8 @@
|
||||
_timer=[[NSTimer scheduledTimerWithTimeInterval:1.0/60.0 target:self selector:@selector(timer:) userInfo:nil repeats:YES] retain];
|
||||
}
|
||||
|
||||
-(void)deleteTextureId:(NSNumber *)textureId {
|
||||
[_deleteTextureIds addObject:textureId];
|
||||
}
|
||||
|
||||
@end
|
||||
|
@ -180,6 +180,19 @@ static CGRect interpolateRectInLayerKey(CALayer *layer,NSString *key,CFTimeInter
|
||||
return CGRectMake(0,0,0,0);
|
||||
}
|
||||
|
||||
static GLint interpolationFromName(NSString *name){
|
||||
if(name==kCAFilterLinear)
|
||||
return GL_LINEAR;
|
||||
else if(name==kCAFilterNearest)
|
||||
return GL_NEAREST;
|
||||
else if([name isEqualToString:kCAFilterLinear])
|
||||
return GL_LINEAR;
|
||||
else if([name isEqualToString:kCAFilterNearest])
|
||||
return GL_NEAREST;
|
||||
else
|
||||
return GL_LINEAR;
|
||||
}
|
||||
|
||||
-(void)_renderLayer:(CALayer *)layer z:(float)z currentTime:(CFTimeInterval)currentTime {
|
||||
CGImageRef image=layer.contents;
|
||||
|
||||
@ -189,7 +202,7 @@ static CGRect interpolateRectInLayerKey(CALayer *layer,NSString *key,CFTimeInter
|
||||
|
||||
CGDataProviderRef provider=CGImageGetDataProvider(image);
|
||||
CFDataRef data=CGDataProviderCopyData(provider);
|
||||
const void *pixelBytes=CFDataGetBytePtr(data);
|
||||
const uint8_t *pixelBytes=CFDataGetBytePtr(data);
|
||||
|
||||
|
||||
GLenum glFormat=GL_BGRA;
|
||||
@ -233,31 +246,51 @@ static CGRect interpolateRectInLayerKey(CALayer *layer,NSString *key,CFTimeInter
|
||||
case kCGImageAlphaOnly:
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
glTexImage2D(GL_TEXTURE_2D,0,GL_RGBA8,imageWidth,imageHeight,0,glFormat,glType,pixelBytes);
|
||||
|
||||
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST);
|
||||
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST);
|
||||
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,GL_REPEAT);
|
||||
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL_REPEAT);
|
||||
NSNumber *textureId=[layer _textureId];
|
||||
GLuint texture=[textureId unsignedIntValue];
|
||||
GLboolean loadPixelData=GL_FALSE;
|
||||
|
||||
if(texture==0)
|
||||
loadPixelData=GL_TRUE;
|
||||
else {
|
||||
|
||||
if(glIsTexture(texture)==GL_FALSE){
|
||||
loadPixelData=GL_TRUE;
|
||||
}
|
||||
glBindTexture(GL_TEXTURE_2D,texture);
|
||||
|
||||
}
|
||||
|
||||
if(loadPixelData){
|
||||
glTexImage2D(GL_TEXTURE_2D,0,GL_RGBA8,imageWidth,imageHeight,0,glFormat,glType,pixelBytes);
|
||||
|
||||
GLint minFilter=interpolationFromName(layer.minificationFilter);
|
||||
GLint magFilter=interpolationFromName(layer.magnificationFilter);
|
||||
|
||||
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,minFilter);
|
||||
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,magFilter);
|
||||
|
||||
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,GL_REPEAT);
|
||||
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL_REPEAT);
|
||||
}
|
||||
|
||||
CGPoint anchorPoint=interpolatePointInLayerKey(layer,@"anchorPoint",currentTime);
|
||||
CGPoint position=interpolatePointInLayerKey(layer,@"position",currentTime);
|
||||
CGRect bounds=interpolateRectInLayerKey(layer,@"bounds",currentTime);
|
||||
float opacity=interpolateFloatInLayerKey(layer,@"opacity",currentTime);
|
||||
|
||||
GLfloat texture[4*2];
|
||||
GLfloat textureVertices[4*2];
|
||||
GLfloat vertices[4*3];
|
||||
|
||||
texture[0]=0;
|
||||
texture[1]=1;
|
||||
texture[2]=1;
|
||||
texture[3]=1;
|
||||
texture[4]=0;
|
||||
texture[5]=0;
|
||||
texture[6]=1;
|
||||
texture[7]=0;
|
||||
textureVertices[0]=0;
|
||||
textureVertices[1]=1;
|
||||
textureVertices[2]=1;
|
||||
textureVertices[3]=1;
|
||||
textureVertices[4]=0;
|
||||
textureVertices[5]=0;
|
||||
textureVertices[6]=1;
|
||||
textureVertices[7]=0;
|
||||
|
||||
vertices[0]=0;
|
||||
vertices[1]=0;
|
||||
@ -278,7 +311,7 @@ static CGRect interpolateRectInLayerKey(CALayer *layer,NSString *key,CFTimeInter
|
||||
|
||||
glPushMatrix();
|
||||
// glTranslatef(width/2,height/2,0);
|
||||
glTexCoordPointer(2, GL_FLOAT, 0, texture);
|
||||
glTexCoordPointer(2, GL_FLOAT, 0, textureVertices);
|
||||
glVertexPointer(3, GL_FLOAT, 0, vertices);
|
||||
|
||||
|
||||
@ -288,6 +321,7 @@ static CGRect interpolateRectInLayerKey(CALayer *layer,NSString *key,CFTimeInter
|
||||
|
||||
// glRotatef(1,0,0,1);
|
||||
glColor4f(opacity,opacity,opacity,opacity);
|
||||
|
||||
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
|
||||
|
||||
for(CALayer *child in layer.sublayers)
|
||||
@ -300,16 +334,22 @@ static CGRect interpolateRectInLayerKey(CALayer *layer,NSString *key,CFTimeInter
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glLoadIdentity();
|
||||
|
||||
glClearColor(1, 0, 0, 1);
|
||||
glClearColor(0, 0, 0, 1);
|
||||
glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
|
||||
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
glDepthFunc(GL_LEQUAL);
|
||||
|
||||
glEnable( GL_TEXTURE_2D );
|
||||
glEnableClientState(GL_VERTEX_ARRAY);
|
||||
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||
|
||||
glEnable (GL_BLEND);
|
||||
glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
|
||||
glBlendFunc(GL_ONE,GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
glAlphaFunc ( GL_GREATER, 0 ) ;
|
||||
glEnable ( GL_ALPHA_TEST ) ;
|
||||
|
||||
[self _renderLayer:_rootLayer z:0 currentTime:CACurrentMediaTime()];
|
||||
|
||||
glFlush();
|
||||
|
@ -122,6 +122,41 @@
|
||||
remoteGlobalIDString = FE5A884510C6F286005E348A;
|
||||
remoteInfo = "CoreGraphics-FreeBSD-i386";
|
||||
};
|
||||
FE2A2CE412D2C7410028C06D /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = FE2A2CDE12D2C7410028C06D /* OpenGL.xcodeproj */;
|
||||
proxyType = 2;
|
||||
remoteGlobalIDString = 8DC2EF5B0486A6940098B216 /* OpenGL.framework */;
|
||||
remoteInfo = "OpenGL-Windows-i386";
|
||||
};
|
||||
FE2A2CE612D2C7410028C06D /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = FE2A2CDE12D2C7410028C06D /* OpenGL.xcodeproj */;
|
||||
proxyType = 2;
|
||||
remoteGlobalIDString = C8E0BE8A0F0E544700677729 /* OpenGL.framework */;
|
||||
remoteInfo = "OpenGL-Darwin-i386";
|
||||
};
|
||||
FE2A2CE812D2C7410028C06D /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = FE2A2CDE12D2C7410028C06D /* OpenGL.xcodeproj */;
|
||||
proxyType = 2;
|
||||
remoteGlobalIDString = FE5A876310C6F244005E348A /* OpenGL.framework */;
|
||||
remoteInfo = "OpenGL-FreeBSD-i386";
|
||||
};
|
||||
FE2A2CED12D2C74E0028C06D /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = FE2A2CDE12D2C7410028C06D /* OpenGL.xcodeproj */;
|
||||
proxyType = 1;
|
||||
remoteGlobalIDString = 8DC2EF4F0486A6940098B216 /* OpenGL-Windows-i386 */;
|
||||
remoteInfo = "OpenGL-Windows-i386";
|
||||
};
|
||||
FE2A2CEF12D2C75A0028C06D /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = FE2A2CDE12D2C7410028C06D /* OpenGL.xcodeproj */;
|
||||
proxyType = 1;
|
||||
remoteGlobalIDString = FE5A875610C6F244005E348A /* OpenGL-FreeBSD-i386 */;
|
||||
remoteInfo = "OpenGL-FreeBSD-i386";
|
||||
};
|
||||
FE4301A111E2556B00EBDD56 /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = FE43019D11E2556B00EBDD56 /* CoreVideo.xcodeproj */;
|
||||
@ -196,6 +231,7 @@
|
||||
FE0FB9B810F9815300EBA597 /* CIVector.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CIVector.h; sourceTree = "<group>"; };
|
||||
FE0FB9B910F9815300EBA597 /* CIVector.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CIVector.m; sourceTree = "<group>"; };
|
||||
FE255FEF10F10397005CE23E /* CoreImage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CoreImage.h; sourceTree = "<group>"; };
|
||||
FE2A2CDE12D2C7410028C06D /* OpenGL.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = OpenGL.xcodeproj; path = ../OpenGL/OpenGL.xcodeproj; sourceTree = SOURCE_ROOT; };
|
||||
FE41B88812BEA2EE00ED6C10 /* CATransaction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CATransaction.h; sourceTree = "<group>"; };
|
||||
FE43019D11E2556B00EBDD56 /* CoreVideo.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = CoreVideo.xcodeproj; path = ../CoreVideo/CoreVideo.xcodeproj; sourceTree = SOURCE_ROOT; };
|
||||
FE4301AB11E255A500EBDD56 /* CoreVideo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CoreVideo.h; sourceTree = "<group>"; };
|
||||
@ -272,6 +308,7 @@
|
||||
0867D691FE84028FC02AAC07 /* QuartzCore */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
FE2A2CDE12D2C7410028C06D /* OpenGL.xcodeproj */,
|
||||
FEDEB73F12D2378C008E5A59 /* CAAction.h */,
|
||||
FEDEABC012C98F59008E5A59 /* CALayerContext.h */,
|
||||
FEDEAA6612C2608F008E5A59 /* CAValueFunction.h */,
|
||||
@ -373,6 +410,16 @@
|
||||
name = "Other Sources";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
FE2A2CDF12D2C7410028C06D /* Products */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
FE2A2CE512D2C7410028C06D /* OpenGL.framework */,
|
||||
FE2A2CE712D2C7410028C06D /* OpenGL.framework */,
|
||||
FE2A2CE912D2C7410028C06D /* OpenGL.framework */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
FE43019E11E2556B00EBDD56 /* Products */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
@ -511,6 +558,7 @@
|
||||
);
|
||||
dependencies = (
|
||||
FED38C9310E13FDC00A2A651 /* PBXTargetDependency */,
|
||||
FE2A2CF012D2C75A0028C06D /* PBXTargetDependency */,
|
||||
);
|
||||
name = "QuartzCore-FreeBSD-i386";
|
||||
productInstallPath = "$(HOME)/Library/Frameworks";
|
||||
@ -533,6 +581,7 @@
|
||||
dependencies = (
|
||||
FECA81AE10EBB2AC003472F1 /* PBXTargetDependency */,
|
||||
FE4301A411E2557400EBDD56 /* PBXTargetDependency */,
|
||||
FE2A2CEE12D2C74E0028C06D /* PBXTargetDependency */,
|
||||
);
|
||||
name = "QuartzCore-Windows-i386";
|
||||
productInstallPath = "$(HOME)/Library/Frameworks";
|
||||
@ -588,6 +637,10 @@
|
||||
ProductGroup = FE43019E11E2556B00EBDD56 /* Products */;
|
||||
ProjectRef = FE43019D11E2556B00EBDD56 /* CoreVideo.xcodeproj */;
|
||||
},
|
||||
{
|
||||
ProductGroup = FE2A2CDF12D2C7410028C06D /* Products */;
|
||||
ProjectRef = FE2A2CDE12D2C7410028C06D /* OpenGL.xcodeproj */;
|
||||
},
|
||||
);
|
||||
projectRoot = "";
|
||||
targets = (
|
||||
@ -606,6 +659,27 @@
|
||||
remoteRef = FE293C5D10D984D10031C1DC /* PBXContainerItemProxy */;
|
||||
sourceTree = BUILT_PRODUCTS_DIR;
|
||||
};
|
||||
FE2A2CE512D2C7410028C06D /* OpenGL.framework */ = {
|
||||
isa = PBXReferenceProxy;
|
||||
fileType = wrapper.framework;
|
||||
path = OpenGL.framework;
|
||||
remoteRef = FE2A2CE412D2C7410028C06D /* PBXContainerItemProxy */;
|
||||
sourceTree = BUILT_PRODUCTS_DIR;
|
||||
};
|
||||
FE2A2CE712D2C7410028C06D /* OpenGL.framework */ = {
|
||||
isa = PBXReferenceProxy;
|
||||
fileType = wrapper.framework;
|
||||
path = OpenGL.framework;
|
||||
remoteRef = FE2A2CE612D2C7410028C06D /* PBXContainerItemProxy */;
|
||||
sourceTree = BUILT_PRODUCTS_DIR;
|
||||
};
|
||||
FE2A2CE912D2C7410028C06D /* OpenGL.framework */ = {
|
||||
isa = PBXReferenceProxy;
|
||||
fileType = wrapper.framework;
|
||||
path = OpenGL.framework;
|
||||
remoteRef = FE2A2CE812D2C7410028C06D /* PBXContainerItemProxy */;
|
||||
sourceTree = BUILT_PRODUCTS_DIR;
|
||||
};
|
||||
FE4301A211E2556B00EBDD56 /* CoreVideo.framework */ = {
|
||||
isa = PBXReferenceProxy;
|
||||
fileType = wrapper.framework;
|
||||
@ -685,6 +759,16 @@
|
||||
/* End PBXSourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXTargetDependency section */
|
||||
FE2A2CEE12D2C74E0028C06D /* PBXTargetDependency */ = {
|
||||
isa = PBXTargetDependency;
|
||||
name = "OpenGL-Windows-i386";
|
||||
targetProxy = FE2A2CED12D2C74E0028C06D /* PBXContainerItemProxy */;
|
||||
};
|
||||
FE2A2CF012D2C75A0028C06D /* PBXTargetDependency */ = {
|
||||
isa = PBXTargetDependency;
|
||||
name = "OpenGL-FreeBSD-i386";
|
||||
targetProxy = FE2A2CEF12D2C75A0028C06D /* PBXContainerItemProxy */;
|
||||
};
|
||||
FE4301A411E2557400EBDD56 /* PBXTargetDependency */ = {
|
||||
isa = PBXTargetDependency;
|
||||
name = "CoreVideo-Windows-i386";
|
||||
|
Loading…
Reference in New Issue
Block a user