* Headers/AppKit/NSOpenGL.h,

* Source/NSOpenGLPixelFormat.m: NSOpenGLPixelFormat directly
        * implements
        initWithCoder so that it may marshall the pixel attributes prior
to
        initWithAttributes:. Change the getValues:... method to take an
        int argument instead of long. GLint is mapped to int on most
systems.
        * Source/NSOpenGLContext.m: Use the format decoding to decode an
        * OpenGL context.
        Patch by Clint Smullen <daemonae>.

        * Source/GSLayoutManager.m: Small cleanup in glyph code.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@35923 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
fredkiefer 2012-12-26 19:19:50 +00:00
parent 91c4c487ae
commit 3065898052
5 changed files with 134 additions and 91 deletions

View file

@ -27,29 +27,14 @@
*/
#import <Foundation/NSString.h>
#import <Foundation/NSData.h>
#import <Foundation/NSDebug.h>
#import "AppKit/NSOpenGL.h"
#import "GNUstepGUI/GSDisplayServer.h"
// @interface GSGLPixelFormat : NSOpenGLPixelFormat
// {}
// + _classContext;
// @end
// @implementation GSGLPixelFormat
// - (id)initWithAttributes:(NSOpenGLPixelFormatAttribute *)attribs
// {
// self = [[GSGLPixelFormat _classContext] alloc];
// return [self initWithAttributes: attribs];
// }
// @end
//static GSGLPixelFormat *temp;
@implementation NSOpenGLPixelFormat
+ _classPixelFormat
+ (Class) _classPixelFormat
{
Class glPixelFormatClass = [GSCurrentServer() glPixelFormatClass];
@ -65,16 +50,7 @@
}
}
// + (void) initialize
// {
// if (self == [NSOpenGLPixelFormat class])
// {
// temp = (GSGLPixelFormat *) NSAllocateObject([GSGLPixelFormat class], 0,
// NSDefaultMallocZone());
// }
// }
+ allocWithZone: (NSZone *) z
+ (id) allocWithZone: (NSZone*) z
{
Class c = [self _classPixelFormat];
if (c)
@ -83,25 +59,56 @@
return nil;
}
- (void)getValues:(long *)vals
forAttribute:(NSOpenGLPixelFormatAttribute)attrib
forVirtualScreen:(int)screen
- (void) getValues: (int*)vals
forAttribute: (NSOpenGLPixelFormatAttribute)attrib
forVirtualScreen: (int)screen
{
[self subclassResponsibility: _cmd];
}
- (id)initWithAttributes:(NSOpenGLPixelFormatAttribute *)attribs
- (id) initWithAttributes: (NSOpenGLPixelFormatAttribute*)attribs
{
[self subclassResponsibility: _cmd];
return nil;
}
- (int)numberOfVirtualScreens
- (int) numberOfVirtualScreens
{
[self subclassResponsibility: _cmd];
return 0;
}
- (id) initWithCoder: (NSCoder*)aDecoder
{
if ([aDecoder allowsKeyedCoding])
{
NSMutableData *attrs = [aDecoder decodeObjectForKey: @"NSPixelAttributes"];
if (attrs != nil)
{
NSOpenGLPixelFormatAttribute *glattrs;
unsigned char tmp = 0;
// Ensure that it is zero-terminated
[attrs appendBytes: &tmp length: sizeof(tmp)];
// FIXME: Deserialize an integer array
glattrs = (NSOpenGLPixelFormatAttribute *)[attrs mutableBytes];
return [self initWithAttributes: glattrs];
}
}
else
{
}
return self;
}
- (void) encodeWithCoder: (NSCoder*)aCoder
{
[self subclassResponsibility: _cmd];
}
@end