diff --git a/ChangeLog b/ChangeLog index 65937d3..9995922 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2002-08-28 18:55 Alexander Malmberg + + * Source/x11/XGBitmapImageRep.m, Source/xlib/XGBitmapImageRep.m, + Source/x11/GNUmakefile, Source/xlib/GNUmakefile: Move + XGBitmapImageRep.m from xlib/ to x11/. + + * Source/art/ARTContext.m: Remove the copy of the XGBitmapImageRep + code. + + * Source/art/blit.m: Add missing include of NSDebug.h. + 2002-08-28 16:01 Alexander Malmberg * Source/art/blit.m (artcontext_setup_draw_info): Change NSLog to diff --git a/Source/art/ARTContext.m b/Source/art/ARTContext.m index 7e4c45e..b8b1c89 100644 --- a/Source/art/ARTContext.m +++ b/Source/art/ARTContext.m @@ -1430,6 +1430,7 @@ static ArtSVP *copy_svp(ArtSVP *svp) -(void) _setup_stuff: (int)window : (RDSClient *)remote; #else -(void) _setup_stuff: (gswindow_device_t *)win : (int)x : (int)y; +-(void) GSCurrentDevice: (void **)device : (int *)x : (int *)y; #endif @end @@ -1494,6 +1495,16 @@ static ArtSVP *copy_svp(ArtSVP *svp) DESTROY(wi); wi=[ARTWindowBuffer artWindowBufferForWindow: window]; } + +-(void) GSCurrentDevice: (void **)device : (int *)x : (int *)y +{ + *x = *y = 0; + if (wi) + *device = wi->window; + else + *device = NULL; +} + #endif @end @@ -1620,151 +1631,13 @@ static ArtSVP *copy_svp(ArtSVP *svp) { [(ARTGState *)gstate _setup_stuff: device : x : y]; } -#endif -@end - - -#ifndef RDS - -#include -@implementation NSImage (dummy) --(Pixmap) xPixmapMask -{ /* TODO */ - return 0; -} -@end - - - -/* - XGBitmapImageRep.m - - NSBitmapImageRep for GNUstep GUI X/GPS Backend - - Copyright (C) 1996-1999 Free Software Foundation, Inc. - - Author: Adam Fedor - Author: Scott Christley - Date: Feb 1996 - Author: Felipe A. Rodriguez - Date: May 1998 - Author: Richard Frith-Macdonald - Date: Mar 1999 - Rewritten: Adam Fedor - Date: May 2000 - - This file is part of the GNUstep GUI X/GPS Backend. - - 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; see the file COPYING.LIB. - If not, write to the Free Software Foundation, - 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ - -#include -#include -#include -#include - -#ifdef HAVE_WRASTER_H -#include "wraster.h" -#else -#include "x11/wraster.h" -#endif -#include "x11/XGServerWindow.h" -#include -#include -#include -#include -#include -#include - -@interface NSBitmapImageRep (BackEnd) -- (Pixmap) xPixmapMask; -@end - - -@implementation NSBitmapImageRep (Backend) - -#ifdef WITH_WRASTER -+ (NSArray *) _wrasterFileTypes +-(void) GSCurrentDevice: (void **)device : (int *)x : (int *)y { - int i; - NSMutableArray *warray; - char **types = RSupportedFileFormats(); - - i = 0; - warray = [NSMutableArray arrayWithCapacity: 4]; - while (types[i] != NULL) - { - NSString *type = [NSString stringWithCString: types[i]]; - type = [type lowercaseString]; - if (strcmp(types[i], "TIFF") != 0) - { - [warray addObject: type]; - if (strcmp(types[i], "JPEG") == 0) - [warray addObject: @"jpg"]; - else if (strcmp(types[i], "PPM") == 0) - [warray addObject: @"pgm"]; - } - i++; - } - return warray; + [(ARTGState *)gstate GSCurrentDevice: device : x : y]; } -- _initFromWrasterFile: (NSString *)filename number: (int)imageNumber -{ - int screen; - RImage *image; - RContext *context; +#endif - if (imageNumber > 0) - { - /* RLoadImage doesn't handle this very well */ - RELEASE(self); - return nil; - } - - NSDebugLLog(@"NSImage", @"Loading %@ using wraster routines", filename); - screen = [[[GSCurrentServer() screenList] objectAtIndex: 0] intValue]; - context = [(XGServer *)GSCurrentServer() xrContextForScreen: screen]; - image = RLoadImage(context, (char *)[filename cString], imageNumber); - if (!image) - { - RELEASE(self); - return nil; - } - [self initWithBitmapDataPlanes: &(image->data) - pixelsWide: image->width - pixelsHigh: image->height - bitsPerSample: 8 - samplesPerPixel: (image->format == RRGBAFormat) ? 4 : 3 - hasAlpha: (image->format == RRGBAFormat) ? YES : NO - isPlanar: NO - colorSpaceName: NSDeviceRGBColorSpace - bytesPerRow: 0 - bitsPerPixel: 0]; - - /* Make NSBitmapImageRep own the data */ - _imageData = [NSMutableData dataWithBytesNoCopy: image->data - length: (_bytesPerRow*image->height)]; - RETAIN(_imageData); - free(image); - - return self; -} -#endif /* WITH_WRASTER */ - -#endif /* RDS */ +@end diff --git a/Source/art/blit.m b/Source/art/blit.m index 77d763f..68d6135 100644 --- a/Source/art/blit.m +++ b/Source/art/blit.m @@ -29,6 +29,8 @@ This file includes itself. Many times. You have been warned. #include #include +#include + #include "x11/XGServer.h" #include "blit.h" diff --git a/Source/x11/GNUmakefile b/Source/x11/GNUmakefile index 535cd88..03850ab 100644 --- a/Source/x11/GNUmakefile +++ b/Source/x11/GNUmakefile @@ -60,7 +60,8 @@ XGServerEvent.m \ XGServerWindow.m \ XGDragView.m \ XGSlideView.m \ -XIMInputServer.m +XIMInputServer.m \ +XGBitmapImageRep.m x11_HEADER_FILES_DIR = ../../Headers/x11 x11_HEADER_FILES_INSTALL_DIR = gnustep/x11 diff --git a/Source/xlib/XGBitmapImageRep.m b/Source/x11/XGBitmapImageRep.m similarity index 96% rename from Source/xlib/XGBitmapImageRep.m rename to Source/x11/XGBitmapImageRep.m index 3d22533..e960978 100644 --- a/Source/xlib/XGBitmapImageRep.m +++ b/Source/x11/XGBitmapImageRep.m @@ -38,7 +38,6 @@ #include #include -#include "xlib/XGPrivate.h" #include "x11/XGServerWindow.h" #include #include @@ -47,6 +46,12 @@ #include #include +#ifdef HAVE_WRASTER_H +#include "wraster.h" +#else +#include "x11/wraster.h" +#endif + @interface NSBitmapImageRep (BackEnd) - (Pixmap) xPixmapMask; @end @@ -126,20 +131,18 @@ - (Pixmap) xPixmapMask { unsigned char *bData; - XGContext *ctxt = (XGContext*)GSCurrentContext(); + NSGraphicsContext *ctxt = (NSGraphicsContext*)GSCurrentContext(); gswindow_device_t *gs_win; - // Only produce pixmaps for meshed images with alpha if ((_numColors != 4) || _isPlanar) return 0; - bData = [self bitmapData]; [ctxt GSCurrentDevice: (void**)&gs_win : NULL : NULL]; // FIXME: This optimistic computing works only, if there are no // additional bytes at the end of a line. - return xgps_cursor_mask (gs_win->display, GET_XDRAWABLE(gs_win), + return xgps_cursor_mask (gs_win->display, GET_XDRAWABLE(gs_win), bData, _pixelsWide, _pixelsHigh, _numColors); } diff --git a/Source/xlib/GNUmakefile b/Source/xlib/GNUmakefile index 87eefb3..5088dfc 100644 --- a/Source/xlib/GNUmakefile +++ b/Source/xlib/GNUmakefile @@ -38,7 +38,6 @@ SUBPROJECT_NAME=xlib # The Objective-C source files to be compiled xlib_OBJC_FILES = \ -XGBitmapImageRep.m \ XGBitmap.m \ XGCommonFont.m \ XGFont.m \