mirror of
https://github.com/gnustep/libs-back.git
synced 2025-02-24 04:11:28 +00:00
Use cairo specific code for PS file creation
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/back/trunk@25088 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
8b9b2102f3
commit
89c1ce993a
13 changed files with 209 additions and 80 deletions
27
ChangeLog
27
ChangeLog
|
@ -1,3 +1,28 @@
|
||||||
|
2007-04-27 Fred Kiefer <FredKiefer@gmx.de>
|
||||||
|
|
||||||
|
* Headers/cairo/CairoSurface.h,
|
||||||
|
* Source/cairo/CairoSurface.m: Remove default surface type setting.
|
||||||
|
* Headers/cairo/XGCairoSurface.h: Remove includes.
|
||||||
|
* Source/cairo/XGCairoSurface.m: Add includes.
|
||||||
|
* Headers/cairo/XGCairoXImageSurface.h: Remove includes.
|
||||||
|
* Source/cairo/XGCairoXImageSurface.m: Add includes, add missing
|
||||||
|
dealloc method.
|
||||||
|
* Headers/cairo/CairoPSSurface.h,
|
||||||
|
* Source/cairo/CairoPSSurface.m: New files.
|
||||||
|
* Source/cairo/GNUmakefile: Add CairoPSSurface.
|
||||||
|
* Headers/cairo/CairoGState.h,
|
||||||
|
* Source/cairo/CairoGState.m: Replace method -GSSetDevice::: with
|
||||||
|
-GSSetDevice::: and GSCurrentDevice::: with GSCurrentSurface:::.
|
||||||
|
* Source/cairo/CairoGState.m (-DPSshowpage): Implement this method.
|
||||||
|
* Source/cairo/CairoContext.m (-DPSgrestore, -DPSgsave): Remove
|
||||||
|
these newly added methods.
|
||||||
|
* Source/cairo/CairoContext.m (-initializeBackend): No longer set
|
||||||
|
default surface type.
|
||||||
|
* Source/cairo/CairoContext.m (-GSSetDevice:::): Create the
|
||||||
|
surface here.
|
||||||
|
* Source/cairo/CairoContext.m (-initWithContextInfo:): For PS
|
||||||
|
output set the surface here.
|
||||||
|
|
||||||
2007-04-24 Fred Kiefer <FredKiefer@gmx.de>
|
2007-04-24 Fred Kiefer <FredKiefer@gmx.de>
|
||||||
|
|
||||||
* Source/x11/XGDragView.m (-sendExternalEvent:... toWindow:) Tell
|
* Source/x11/XGDragView.m (-sendExternalEvent:... toWindow:) Tell
|
||||||
|
@ -50,7 +75,7 @@
|
||||||
* Source/art/ARTConext.m: Removed ARTContext bits.
|
* Source/art/ARTConext.m: Removed ARTContext bits.
|
||||||
* Source/art/blit-main.m: New file split out from blit.m.
|
* Source/art/blit-main.m: New file split out from blit.m.
|
||||||
* Source/art/blit.m: Removed self include stuff.
|
* Source/art/blit.m: Removed self include stuff.
|
||||||
* Source/GNUmakefile: Add new source files.
|
* Source/art/GNUmakefile: Add new source files.
|
||||||
* Source/art/composite.m: Adopt to GNUstep coding style.
|
* Source/art/composite.m: Adopt to GNUstep coding style.
|
||||||
|
|
||||||
2007-03-22 Fred Kiefer <FredKiefer@gmx.de>
|
2007-03-22 Fred Kiefer <FredKiefer@gmx.de>
|
||||||
|
|
|
@ -36,8 +36,8 @@
|
||||||
CairoSurface *_surface;
|
CairoSurface *_surface;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) GSCurrentDevice: (void **)device: (int *)x : (int *)y;
|
- (void) GSCurrentSurface: (CairoSurface **)surface: (int *)x : (int *)y;
|
||||||
- (void) GSSetDevice: (void *)device : (int)x : (int)y;
|
- (void) GSSetSurface: (CairoSurface *)surface : (int)x : (int)y;
|
||||||
- (void) DPSgsave;
|
- (void) DPSgsave;
|
||||||
- (void) DPSgrestore;
|
- (void) DPSgrestore;
|
||||||
|
|
||||||
|
|
38
Headers/cairo/CairoPSSurface.h
Normal file
38
Headers/cairo/CairoPSSurface.h
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
/*
|
||||||
|
Copyright (C) 2007 Free Software Foundation, Inc.
|
||||||
|
|
||||||
|
Author: Fred Kiefer <fredkiefer@gmx.de>
|
||||||
|
|
||||||
|
This file is part of GNUstep.
|
||||||
|
|
||||||
|
This library is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU Library General Public
|
||||||
|
License as published by the Free Software Foundation; either
|
||||||
|
version 2 of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
This library is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
Library General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Library General Public
|
||||||
|
License along with this library; if not, write to the Free
|
||||||
|
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef XGCairoPSSurface_h
|
||||||
|
#define XGCairoPSSurface_h
|
||||||
|
|
||||||
|
#include "cairo/CairoSurface.h"
|
||||||
|
|
||||||
|
@interface CairoPSSurface : CairoSurface
|
||||||
|
{
|
||||||
|
NSSize size;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)setSize: (NSSize)newSize;
|
||||||
|
- (void)writeComment: (NSString *)comment;
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
#endif
|
|
@ -33,8 +33,6 @@
|
||||||
cairo_surface_t *_surface;
|
cairo_surface_t *_surface;
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (void) setDefaultSurfaceClass: (Class)aClass;
|
|
||||||
|
|
||||||
- (id) initWithDevice: (void *)device;
|
- (id) initWithDevice: (void *)device;
|
||||||
|
|
||||||
- (NSSize) size;
|
- (NSSize) size;
|
||||||
|
|
|
@ -23,9 +23,6 @@
|
||||||
#ifndef XGCairoSurface_h
|
#ifndef XGCairoSurface_h
|
||||||
#define XGCairoSurface_h
|
#define XGCairoSurface_h
|
||||||
|
|
||||||
#include "x11/XGServer.h"
|
|
||||||
#include "x11/XGServerWindow.h"
|
|
||||||
|
|
||||||
#include "cairo/CairoSurface.h"
|
#include "cairo/CairoSurface.h"
|
||||||
|
|
||||||
@interface XGCairoSurface : CairoSurface
|
@interface XGCairoSurface : CairoSurface
|
||||||
|
|
|
@ -23,14 +23,13 @@
|
||||||
#ifndef XGCairoXImageSurface_h
|
#ifndef XGCairoXImageSurface_h
|
||||||
#define XGCairoXImageSurface_h
|
#define XGCairoXImageSurface_h
|
||||||
|
|
||||||
#include "x11/XGServer.h"
|
|
||||||
#include "x11/XGServerWindow.h"
|
|
||||||
#include "x11/XWindowBuffer.h"
|
|
||||||
#include "cairo/CairoSurface.h"
|
#include "cairo/CairoSurface.h"
|
||||||
|
|
||||||
|
@class XWindowBuffer;
|
||||||
|
|
||||||
@interface XGCairoXImageSurface : CairoSurface
|
@interface XGCairoXImageSurface : CairoSurface
|
||||||
{
|
{
|
||||||
@public
|
@private
|
||||||
XWindowBuffer *wi;
|
XWindowBuffer *wi;
|
||||||
}
|
}
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
#include "cairo/CairoContext.h"
|
#include "cairo/CairoContext.h"
|
||||||
#include "cairo/CairoGState.h"
|
#include "cairo/CairoGState.h"
|
||||||
#include "cairo/CairoSurface.h"
|
#include "cairo/CairoSurface.h"
|
||||||
|
#include "cairo/CairoPSSurface.h"
|
||||||
#include "cairo/CairoFontInfo.h"
|
#include "cairo/CairoFontInfo.h"
|
||||||
#include "cairo/CairoFontEnumerator.h"
|
#include "cairo/CairoFontEnumerator.h"
|
||||||
#include "x11/XGServer.h"
|
#include "x11/XGServer.h"
|
||||||
|
@ -32,6 +33,8 @@
|
||||||
#else
|
#else
|
||||||
#include "cairo/XGCairoSurface.h"
|
#include "cairo/XGCairoSurface.h"
|
||||||
#include "cairo/XGCairoXImageSurface.h"
|
#include "cairo/XGCairoXImageSurface.h"
|
||||||
|
#include "x11/XGServerWindow.h"
|
||||||
|
#include "x11/XWindowBuffer.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define CGSTATE ((CairoGState *)gstate)
|
#define CGSTATE ((CairoGState *)gstate)
|
||||||
|
@ -42,15 +45,8 @@
|
||||||
|
|
||||||
+ (void) initializeBackend
|
+ (void) initializeBackend
|
||||||
{
|
{
|
||||||
//NSLog (@"CairoContext : Initializing cairo backend");
|
|
||||||
[NSGraphicsContext setDefaultContextClass: self];
|
[NSGraphicsContext setDefaultContextClass: self];
|
||||||
|
|
||||||
#ifdef USE_GLITZ
|
|
||||||
[CairoSurface setDefaultSurfaceClass: [XGCairoGlitzSurface class]];
|
|
||||||
#else
|
|
||||||
// [CairoSurface setDefaultSurfaceClass: [XGCairoSurface class]];
|
|
||||||
[CairoSurface setDefaultSurfaceClass: [XGCairoXImageSurface class]];
|
|
||||||
#endif
|
|
||||||
[GSFontEnumerator setDefaultClass: [CairoFontEnumerator class]];
|
[GSFontEnumerator setDefaultClass: [CairoFontEnumerator class]];
|
||||||
[GSFontInfo setDefaultClass: [CairoFontInfo class]];
|
[GSFontInfo setDefaultClass: [CairoFontInfo class]];
|
||||||
}
|
}
|
||||||
|
@ -61,16 +57,25 @@
|
||||||
|
|
||||||
contextType = [info objectForKey:
|
contextType = [info objectForKey:
|
||||||
NSGraphicsContextRepresentationFormatAttributeName];
|
NSGraphicsContextRepresentationFormatAttributeName];
|
||||||
self = [super initWithContextInfo: info];
|
// Don't allow super to handle PS case.
|
||||||
if (contextType)
|
self = [super initWithContextInfo: nil];
|
||||||
{
|
if (!self)
|
||||||
/* Most likely this is a PS or PDF context, so just return what
|
|
||||||
super gave us */
|
|
||||||
return self;
|
return self;
|
||||||
}
|
|
||||||
|
|
||||||
gstate = [[CairoGState allocWithZone: [self zone]] initWithDrawContext: self];
|
gstate = [[CairoGState allocWithZone: [self zone]] initWithDrawContext: self];
|
||||||
|
|
||||||
|
if (contextType)
|
||||||
|
{
|
||||||
|
CairoSurface *surface;
|
||||||
|
NSSize size;
|
||||||
|
|
||||||
|
surface = [[CairoPSSurface alloc] initWithDevice: info];
|
||||||
|
// This strange setting is needed because of the way GUI handles offset.
|
||||||
|
size = [surface size];
|
||||||
|
[CGSTATE GSSetSurface: surface : 0.0 : size.height];
|
||||||
|
RELEASE(surface);
|
||||||
|
}
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -105,22 +110,27 @@
|
||||||
|
|
||||||
- (void) GSCurrentDevice: (void **)device : (int *)x : (int *)y
|
- (void) GSCurrentDevice: (void **)device : (int *)x : (int *)y
|
||||||
{
|
{
|
||||||
[CGSTATE GSCurrentDevice: device : x : y];
|
CairoSurface *surface;
|
||||||
|
|
||||||
|
[CGSTATE GSCurrentSurface: &surface : x : y];
|
||||||
|
if (device)
|
||||||
|
{
|
||||||
|
*device = surface->gsDevice;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) GSSetDevice: (void *)device : (int)x : (int)y
|
- (void) GSSetDevice: (void *)device : (int)x : (int)y
|
||||||
{
|
{
|
||||||
[CGSTATE GSSetDevice: device : x : y];
|
CairoSurface *surface;
|
||||||
}
|
|
||||||
|
|
||||||
- (void) DPSgrestore
|
#ifdef USE_GLITZ
|
||||||
{
|
surface = [[XGCairoGlitzSurface alloc] initWithDevice: device];
|
||||||
[CGSTATE DPSgrestore];
|
#else
|
||||||
}
|
//surface = [[XGCairoSurface alloc] initWithDevice: device];
|
||||||
|
surface = [[XGCairoXImageSurface alloc] initWithDevice: device];
|
||||||
|
#endif
|
||||||
|
|
||||||
- (void) DPSgsave
|
[CGSTATE GSSetSurface: surface : x : y];
|
||||||
{
|
|
||||||
[CGSTATE DPSgsave];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -129,51 +129,46 @@
|
||||||
return copy;
|
return copy;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) GSCurrentDevice: (void **)device: (int *)x : (int *)y
|
- (void) GSCurrentSurface: (CairoSurface **)surface: (int *)x : (int *)y
|
||||||
{
|
{
|
||||||
if (x)
|
if (x)
|
||||||
*x = offset.x;
|
*x = offset.x;
|
||||||
if (y)
|
if (y)
|
||||||
*y = offset.y;
|
*y = offset.y;
|
||||||
if (device)
|
if (surface)
|
||||||
{
|
{
|
||||||
if (_surface)
|
*surface = _surface;
|
||||||
{
|
|
||||||
*device = _surface->gsDevice;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
*device = NULL;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) GSSetDevice: (void *)device : (int)x : (int)y
|
- (void) GSSetSurface: (CairoSurface *)surface : (int)x : (int)y
|
||||||
{
|
{
|
||||||
DESTROY(_surface);
|
ASSIGN(_surface, surface);
|
||||||
_surface = [[CairoSurface alloc] initWithDevice: device];
|
|
||||||
[self setOffset: NSMakePoint(x, y)];
|
[self setOffset: NSMakePoint(x, y)];
|
||||||
[self DPSinitgraphics];
|
[self DPSinitgraphics];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) setOffset: (NSPoint)theOffset
|
- (void) setOffset: (NSPoint)theOffset
|
||||||
{
|
{
|
||||||
NSSize size = {0, 0};
|
|
||||||
|
|
||||||
if (_surface != nil)
|
if (_surface != nil)
|
||||||
{
|
{
|
||||||
size = [_surface size];
|
NSSize size = [_surface size];
|
||||||
}
|
|
||||||
[super setOffset: theOffset];
|
|
||||||
cairo_surface_set_device_offset([_surface surface], -theOffset.x,
|
cairo_surface_set_device_offset([_surface surface], -theOffset.x,
|
||||||
theOffset.y - size.height);
|
theOffset.y - size.height);
|
||||||
}
|
}
|
||||||
|
[super setOffset: theOffset];
|
||||||
|
}
|
||||||
|
|
||||||
- (void) DPSgrestore
|
- (void) DPSgrestore
|
||||||
{
|
{
|
||||||
if (_ct)
|
if (_ct)
|
||||||
{
|
{
|
||||||
cairo_restore(_ct);
|
cairo_restore(_ct);
|
||||||
|
if (cairo_status(_ct) == CAIRO_STATUS_INVALID_RESTORE)
|
||||||
|
{
|
||||||
|
// Restore failed because there was no more state on the stack
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -185,6 +180,14 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void) DPSshowpage
|
||||||
|
{
|
||||||
|
if (_ct)
|
||||||
|
{
|
||||||
|
cairo_show_page(_ct);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Color operations
|
* Color operations
|
||||||
*/
|
*/
|
||||||
|
@ -931,11 +934,10 @@ _set_op(cairo_t *ct, NSCompositingOperation op)
|
||||||
path = [NSBezierPath bezierPathWithRect: aRect];
|
path = [NSBezierPath bezierPathWithRect: aRect];
|
||||||
[path transformUsingAffineTransform: ctm];
|
[path transformUsingAffineTransform: ctm];
|
||||||
[self _setPath];
|
[self _setPath];
|
||||||
path = oldPath;
|
|
||||||
cairo_clip(_ct);
|
cairo_clip(_ct);
|
||||||
|
|
||||||
cairo_paint(_ct);
|
cairo_paint(_ct);
|
||||||
cairo_restore(_ct);
|
cairo_restore(_ct);
|
||||||
|
path = oldPath;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
69
Source/cairo/CairoPSSurface.m
Normal file
69
Source/cairo/CairoPSSurface.m
Normal file
|
@ -0,0 +1,69 @@
|
||||||
|
/*
|
||||||
|
Copyright (C) 2007 Free Software Foundation, Inc.
|
||||||
|
|
||||||
|
Author: Fred Kiefer <fredkiefer@gmx.de>
|
||||||
|
|
||||||
|
This file is part of GNUstep.
|
||||||
|
|
||||||
|
This library is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU Library General Public
|
||||||
|
License as published by the Free Software Foundation; either
|
||||||
|
version 2 of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
This library is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
Library General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Library General Public
|
||||||
|
License along with this library; if not, write to the Free
|
||||||
|
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "cairo/CairoPSSurface.h"
|
||||||
|
#include <cairo-ps.h>
|
||||||
|
|
||||||
|
@implementation CairoPSSurface
|
||||||
|
|
||||||
|
- (id) initWithDevice: (void *)device
|
||||||
|
{
|
||||||
|
NSDictionary *info;
|
||||||
|
NSString *path;
|
||||||
|
|
||||||
|
info = (NSDictionary*)device;
|
||||||
|
path = [info objectForKey: @"NSOutputFile"];
|
||||||
|
//NSLog(@"Write to file %@", path);
|
||||||
|
// This gets only set later on:
|
||||||
|
// @"NSPrintSheetBounds"
|
||||||
|
|
||||||
|
|
||||||
|
// FIXME: Hard coded size in points
|
||||||
|
size = NSMakeSize(400, 400);
|
||||||
|
_surface = cairo_ps_surface_create([path fileSystemRepresentation], size.width, size.height);
|
||||||
|
if (cairo_surface_status(_surface))
|
||||||
|
{
|
||||||
|
NSLog(@"Could not create surface");
|
||||||
|
DESTROY(self);
|
||||||
|
}
|
||||||
|
|
||||||
|
return self;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (NSSize) size
|
||||||
|
{
|
||||||
|
return size;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void) setSize: (NSSize)newSize
|
||||||
|
{
|
||||||
|
size = newSize;
|
||||||
|
cairo_ps_surface_set_size(_surface, size.width, size.height);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
- (void) writeComment: (NSString *)comment
|
||||||
|
{
|
||||||
|
cairo_ps_surface_dsc_comment(_surface, [comment UTF8String]);
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
|
@ -22,20 +22,8 @@
|
||||||
|
|
||||||
#include "cairo/CairoSurface.h"
|
#include "cairo/CairoSurface.h"
|
||||||
|
|
||||||
static Class __defaultSurfaceClass;
|
|
||||||
|
|
||||||
@implementation CairoSurface
|
@implementation CairoSurface
|
||||||
|
|
||||||
+ (void) setDefaultSurfaceClass: (Class)aClass
|
|
||||||
{
|
|
||||||
__defaultSurfaceClass = aClass;
|
|
||||||
}
|
|
||||||
|
|
||||||
+ (id) allocWithZone: (NSZone*)zone
|
|
||||||
{
|
|
||||||
return NSAllocateObject(__defaultSurfaceClass, 0, zone);
|
|
||||||
}
|
|
||||||
|
|
||||||
- (id) initWithDevice: (void *) device
|
- (id) initWithDevice: (void *) device
|
||||||
{
|
{
|
||||||
/* TODO FIXME make a more abstract struct for the device */
|
/* TODO FIXME make a more abstract struct for the device */
|
||||||
|
|
|
@ -35,6 +35,7 @@ cairo_OBJC_FILES = CairoSurface.m \
|
||||||
CairoContext.m \
|
CairoContext.m \
|
||||||
CairoFontEnumerator.m \
|
CairoFontEnumerator.m \
|
||||||
CairoFaceInfo.m \
|
CairoFaceInfo.m \
|
||||||
|
CairoPSSurface.m \
|
||||||
XGCairoSurface.m \
|
XGCairoSurface.m \
|
||||||
XGCairoXImageSurface.m
|
XGCairoXImageSurface.m
|
||||||
|
|
||||||
|
|
|
@ -20,6 +20,8 @@
|
||||||
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "x11/XGServer.h"
|
||||||
|
#include "x11/XGServerWindow.h"
|
||||||
#include "cairo/XGCairoSurface.h"
|
#include "cairo/XGCairoSurface.h"
|
||||||
#include <cairo-xlib.h>
|
#include <cairo-xlib.h>
|
||||||
|
|
||||||
|
|
|
@ -20,6 +20,9 @@
|
||||||
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "x11/XGServer.h"
|
||||||
|
#include "x11/XGServerWindow.h"
|
||||||
|
#include "x11/XWindowBuffer.h"
|
||||||
#include "cairo/XGCairoXImageSurface.h"
|
#include "cairo/XGCairoXImageSurface.h"
|
||||||
|
|
||||||
#define GSWINDEVICE ((gswindow_device_t *)gsDevice)
|
#define GSWINDEVICE ((gswindow_device_t *)gsDevice)
|
||||||
|
@ -29,7 +32,6 @@
|
||||||
- (id) initWithDevice: (void *)device
|
- (id) initWithDevice: (void *)device
|
||||||
{
|
{
|
||||||
struct XWindowBuffer_depth_info_s di;
|
struct XWindowBuffer_depth_info_s di;
|
||||||
XWindowBuffer *new_wi;
|
|
||||||
|
|
||||||
gsDevice = device;
|
gsDevice = device;
|
||||||
|
|
||||||
|
@ -37,16 +39,8 @@
|
||||||
di.bytes_per_pixel = 4;
|
di.bytes_per_pixel = 4;
|
||||||
di.inline_alpha = YES;
|
di.inline_alpha = YES;
|
||||||
di.inline_alpha_ofs = 0;
|
di.inline_alpha_ofs = 0;
|
||||||
new_wi = [XWindowBuffer windowBufferForWindow: GSWINDEVICE depthInfo: &di];
|
// This method is somewhat special as it does not return an autoreleased object
|
||||||
if (new_wi != wi)
|
wi = [XWindowBuffer windowBufferForWindow: GSWINDEVICE depthInfo: &di];
|
||||||
{
|
|
||||||
DESTROY(wi);
|
|
||||||
wi = new_wi;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
DESTROY(new_wi);
|
|
||||||
}
|
|
||||||
|
|
||||||
_surface = cairo_image_surface_create_for_data((unsigned char*)wi->data,
|
_surface = cairo_image_surface_create_for_data((unsigned char*)wi->data,
|
||||||
CAIRO_FORMAT_ARGB32,
|
CAIRO_FORMAT_ARGB32,
|
||||||
|
@ -56,6 +50,12 @@
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void) dealloc
|
||||||
|
{
|
||||||
|
DESTROY(wi);
|
||||||
|
[super dealloc];
|
||||||
|
}
|
||||||
|
|
||||||
- (NSSize) size
|
- (NSSize) size
|
||||||
{
|
{
|
||||||
return GSWINDEVICE->xframe.size;
|
return GSWINDEVICE->xframe.size;
|
||||||
|
|
Loading…
Reference in a new issue