From aef4391b4bfb3f88953f6e7d0c1de42c2a68d7b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ivan=20Vu=C4=8Dica?= Date: Sat, 14 Sep 2013 21:41:53 +0000 Subject: [PATCH] Small experimental changes on GState-less branch, from August 2013. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/back/branches/gstateless-opal@37079 72102866-910b-0410-8b05-ffd578937521 --- ChangeLog | 10 +++++++++ Source/opal/OpalContext+Drawing.m | 2 +- Source/opal/OpalContext.m | 36 +++++++++++++++++++++++++++++++ configure | 2 +- configure.ac | 2 +- 5 files changed, 49 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5b9d71e..d4cb055 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2013-09-14 Ivan Vucica + + * Source/opal/OpalContext+Drawing.m: + * Source/opal/OpalContext.m: + Small experimental changes on GState-less branch, from August 2013. + + * configure: + * configure.ac: + Added Xrender for Opal. Was needed under Cygwin. + 2013-08-04 Ivan Vucica * Source/opal/GNUmakefile: diff --git a/Source/opal/OpalContext+Drawing.m b/Source/opal/OpalContext+Drawing.m index 55c0710..5468629 100644 --- a/Source/opal/OpalContext+Drawing.m +++ b/Source/opal/OpalContext+Drawing.m @@ -38,6 +38,7 @@ if(![_opalSurface cgContext]) \ { \ NSLog(@"%p: No CG context while in %s", self, __PRETTY_FUNCTION__); \ + /*raise(SIGSTOP);*/ \ return what; \ } @@ -438,7 +439,6 @@ static CGFloat theAlpha = 1.; // TODO: removeme OFFSET = theOffset; #endif - [super setOffset: theOffset]; } /* - (void) setColor: (device_color_t *)color state: (color_state_t)cState diff --git a/Source/opal/OpalContext.m b/Source/opal/OpalContext.m index 9bc9a43..87adcfc 100644 --- a/Source/opal/OpalContext.m +++ b/Source/opal/OpalContext.m @@ -30,6 +30,7 @@ #import "opal/OpalFontEnumerator.h" #import "opal/OpalSurface.h" #import "gsc/GSStreamContext.h" +#import // NSDeviceIsScreen #define OGSTATE self //((OpalGState *)gstate) @@ -65,9 +66,11 @@ if (!self) return nil; + _backGStateStackHeight = 1; // Special handling for window drawing id dest; dest = [info objectForKey: NSGraphicsContextDestinationAttributeName]; + NSLog(@"Dest: %@", dest); if ((dest != nil) && [dest isKindOfClass: [NSWindow class]]) { /* A context is only associated with one server. Do not retain @@ -84,6 +87,8 @@ // TODO: we may want to create a default OpalSurface, in case GSSetDevice is not called + + // -[GState initWithDrawContext] would call DPSinitgraphics [self DPSinitgraphics]; [self DPSinitclip]; @@ -142,6 +147,15 @@ return [surface cgContext]; } +- (BOOL) supportsDrawGState +{ + // required to get NSImageRep to use -[NSImageRep nativeDrawInRect:...] + + // TODO: determine other uses for this + + return YES; +} + #if BUILD_SERVER == SERVER_x11 #ifdef XSHM + (void) _gotShmCompletion: (Drawable)d @@ -183,4 +197,26 @@ NSLog(@"%s: trying to replace gstate not on top of the stack", __PRETTY_FUNCTION__); } +- (void) GSdraw: (NSInteger)gstateNum + toPoint: (NSPoint)aPoint + fromRect: (NSRect)srcRect + operation: (NSCompositingOperation)op + fraction: (CGFloat)delta +{ +/* + GSGState *g = gstate; + + if (gstateNum) + { + [self DPSexecuserobject: gstateNum]; + ctxt_pop(g, opstack, GSGState); + } + + [gstate drawGState: g + fromRect: srcRect + toPoint: aPoint + op: op + fraction: delta]; +*/ +} @end diff --git a/configure b/configure index c6021a4..f77f58c 100755 --- a/configure +++ b/configure @@ -7158,7 +7158,7 @@ elif test x"$BUILD_GRAPHICS" = "xxlib"; then elif test x"$BUILD_GRAPHICS" = "xwinlib"; then : # Nothing to do elif test x"$BUILD_GRAPHICS" = "xopal"; then - LIBS="-lopal -lgnustep-corebase $LIBS" + LIBS="-lopal -lgnustep-corebase -lXrender $LIBS" else as_fn_error $? "Invalid graphics backend $BUILD_GRAPHICS" "$LINENO" 5 fi diff --git a/configure.ac b/configure.ac index 1041fd8..c8d29ad 100644 --- a/configure.ac +++ b/configure.ac @@ -642,7 +642,7 @@ elif test x"$BUILD_GRAPHICS" = "xxlib"; then elif test x"$BUILD_GRAPHICS" = "xwinlib"; then : # Nothing to do elif test x"$BUILD_GRAPHICS" = "xopal"; then - LIBS="-lopal -lgnustep-corebase $LIBS" + LIBS="-lopal -lgnustep-corebase -lXrender $LIBS" else AC_MSG_ERROR([Invalid graphics backend $BUILD_GRAPHICS]) fi