* Headers/opal/OpalSurface.h

* Source/opal/OpalSurface.m: Make the -device method public.
        * Headers/opal/OpalContext.h: Remove method definitions.
        * Source/opal/OpalContext.m: Limit the accepted image types.



git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/back/trunk@37172 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Fred Kiefer 2013-09-29 20:11:38 +00:00
parent 1c35214821
commit c5ef196157
5 changed files with 107 additions and 48 deletions

View file

@ -1,3 +1,10 @@
2013-09-29 Fred Kiefer <FredKiefer@gmx.de>
* Headers/opal/OpalSurface.h
* Source/opal/OpalSurface.m: Make the -device method public.
* Headers/opal/OpalContext.h: Remove method definitions.
* Source/opal/OpalContext.m: Limit the accepted image types.
2013-09-29 Fred Kiefer <FredKiefer@gmx.de>
* Headers/opal/OpalSurface.h

View file

@ -33,12 +33,6 @@
@interface OpalContext : GSContext
{
}
+ (void) initializeBackend;
+ (Class) GStateClass;
- (void) GSSetDevice: (void *)device
: (int)x
: (int)y;
@end
#endif

View file

@ -36,6 +36,7 @@
}
- (id) initWithDevice: (void *)device;
- (void *)device;
- (CGContextRef) CGContext;
- (NSSize) size;

View file

@ -25,6 +25,8 @@
Boston, MA 02110-1301, USA.
*/
#import <AppKit/NSBitmapImageRep.h>
#import <AppKit/NSGraphics.h>
#import "opal/OpalContext.h"
#import "opal/OpalFontInfo.h"
#import "opal/OpalFontEnumerator.h"
@ -35,8 +37,8 @@
#define OGSTATE ((OpalGState *)gstate)
#if BUILD_SERVER == SERVER_x11
# include "x11/XGServerWindow.h"
# include "x11/XWindowBuffer.h"
# import "x11/XGServerWindow.h"
# import "x11/XWindowBuffer.h"
#endif
@implementation OpalContext
@ -54,21 +56,6 @@
return [OpalGState class];
}
- (void) GSSetDevice: (void *)device
: (int)x
: (int)y
{
OpalSurface *surface;
surface = [[OpalSurface alloc] initWithDevice: device];
[OGSTATE GSSetSurface: surface
: x
: y];
[surface release];
}
- (BOOL) supportsDrawGState
{
return YES;
@ -100,6 +87,96 @@
//[surface handleExposeRect: [surface size]];
}
/* Private backend methods */
/**
This handles 'expose' event notifications that arrive from
X11.
*/
+ (void) handleExposeRect: (NSRect)rect forDriver: (void *)driver
{
if ([(id)driver isKindOfClass: [OpalSurface class]])
{
[(OpalSurface *)driver handleExposeRect: rect];
}
}
#if BUILD_SERVER == SERVER_x11
#ifdef XSHM
+ (void) _gotShmCompletion: (Drawable)d
{
[XWindowBuffer _gotShmCompletion: d];
}
- (void) gotShmCompletion: (Drawable)d
{
[XWindowBuffer _gotShmCompletion: d];
}
#endif // XSHM
#endif // BUILD_SERVER = SERVER_x11
@end
@implementation OpalContext (Ops)
- (BOOL) isCompatibleBitmap: (NSBitmapImageRep*)bitmap
{
NSString *colorSpaceName;
if ([bitmap bitmapFormat] != 0)
{
return NO;
}
if ([bitmap isPlanar])
{
return NO;
}
if ([bitmap bitsPerSample] != 8)
{
return NO;
}
// FIXME: Allow more image types as soon as the Opal backend handles them correctly
colorSpaceName = [bitmap colorSpaceName];
if (![colorSpaceName isEqualToString: NSDeviceRGBColorSpace] &&
![colorSpaceName isEqualToString: NSCalibratedRGBColorSpace])
{
return NO;
}
else
{
return YES;
}
}
- (void) GSCurrentDevice: (void **)device : (int *)x : (int *)y
{
OpalSurface *surface;
[OGSTATE GSCurrentSurface: &surface : x : y];
if (device)
{
*device = [surface device];
}
}
- (void) GSSetDevice: (void *)device
: (int)x
: (int)y
{
OpalSurface *surface;
surface = [[OpalSurface alloc] initWithDevice: device];
[OGSTATE GSSetSurface: surface
: x
: y];
[surface release];
}
- (void) DPSgsave
{
[OGSTATE DPSgsave];
@ -117,7 +194,6 @@
**/
- (void) DPSsetgstate: (int)gstateID
{
OPGStateRef previousGState = OPContextCopyGState([OGSTATE CGContext]);
[OGSTATE setOPGState: previousGState];
[previousGState release]; // FIXME
@ -132,37 +208,18 @@
}
}
/**
This handles 'expose' event notifications that arrive from
X11.
*/
+ (void) handleExposeRect: (NSRect)rect forDriver: (void *)driver
- (NSInteger) GSDefineGState
{
if ([(id)driver isKindOfClass: [OpalSurface class]])
{
[(OpalSurface *)driver handleExposeRect: rect];
}
// FIXME
return [super GSDefineGState];
}
- (void *) graphicsPort
{
OpalSurface * surface;
[OGSTATE GSCurrentSurface: &surface : NULL : NULL];
return [surface CGContext];
}
#if BUILD_SERVER == SERVER_x11
#ifdef XSHM
+ (void) _gotShmCompletion: (Drawable)d
{
[XWindowBuffer _gotShmCompletion: d];
}
- (void) gotShmCompletion: (Drawable)d
{
[XWindowBuffer _gotShmCompletion: d];
}
#endif // XSHM
#endif // BUILD_SERVER = SERVER_x11
@end

View file

@ -128,7 +128,7 @@ static CGContextRef createCGBitmapContext(int pixelsWide,
return self;
}
- (gswindow_device_t *) device
- (void *) device
{
return _gsWindowDevice;
}