source: scripts/untested/blfs-patches/patch-libsdl1.2-libcaca0.7.patch@ fdfb73b

clfs-1.2 clfs-2.1 clfs-3.0.0-systemd clfs-3.0.0-sysvinit systemd sysvinit
Last change on this file since fdfb73b was fd5b1fe, checked in by Jim Gifford <clfs@…>, 19 years ago

r588@server (orig r586): ryan | 2005-08-05 22:47:43 -0700
Add pile of new patches for blfs packages



  • Property mode set to 100644
File size: 21.4 KB
  • libsdl1.2-1.2.

    Submitted By: Ryan Oliver <ryan.oliver@pha.com.au>
    Date: 2005-05-22
    Initial Package Version: 1.2.6
    Upstream Status: unknown
    Origin: libcaca website
    	http://sam.zoy.org/libcaca/patch-libsdl1.2-libcaca0.7.diff
    Description: Adds libcaca support to SDL
    
    $Id: patch-libsdl1.2-libcaca0.7.diff 809 2005-03-23 11:07:40Z sam $
    diff -puriN -x Makefile -x '*.la' libsdl1.2-1.2.6/configure.in libsdl1.2-1.2.6-caca/configure.in
    old new CheckAAlib()  
    952952    fi
    953953}
    954954
     955dnl Find the libcaca includes
     956CheckCaca()
     957{
     958    AC_ARG_ENABLE(video-caca,
     959[  --enable-video-caca     use libcaca video driver [default=no]],
     960                  , enable_video_caca=no)
     961    if test x$enable_video = xyes -a x$enable_video_caca = xyes; then
     962        AC_MSG_CHECKING(for libcaca support)
     963        video_caca=no
     964        AC_TRY_COMPILE([
     965         #include <caca.h>
     966        ],[
     967        ],[
     968        video_caca=yes
     969        ])
     970        AC_MSG_RESULT($video_caca)
     971        if test x$video_caca = xyes; then
     972            CFLAGS="$CFLAGS -DENABLE_CACA `caca-config --cflags`"
     973            SYSTEM_LIBS="$SYSTEM_LIBS `caca-config --plugin-libs`"
     974
     975            VIDEO_SUBDIRS="$VIDEO_SUBDIRS caca"
     976            VIDEO_DRIVERS="$VIDEO_DRIVERS caca/libvideo_caca.la"
     977        fi
     978    fi
     979}
     980
    955981dnl Set up the Atari Xbios driver
    956982CheckAtariXbiosVideo()
    957983{
    case "$target" in  
    17381764        CheckGGI
    17391765        CheckSVGA
    17401766        CheckAAlib
     1767        CheckCaca
    17411768        CheckQtopia
    17421769        CheckPicoGUI
    17431770        CheckOpenGL
    case "$target" in  
    18191846        CheckDGA
    18201847        CheckSVGA
    18211848        CheckAAlib
     1849        CheckCaca
    18221850        CheckOpenGL
    18231851        CheckPTHREAD
    18241852        # Set up files for the main() stub
    case "$target" in  
    18651893        CheckDGA
    18661894        CheckSVGA
    18671895        CheckAAlib
     1896        CheckCaca
    18681897        CheckOpenGL
    18691898        CheckPTHREAD
    18701899        CheckUSBHID
    case "$target" in  
    19031932        CheckNAS
    19041933        CheckX11
    19051934        CheckAAlib
     1935        CheckCaca
    19061936        CheckOpenGL
    19071937        CheckPTHREAD
    19081938        CheckUSBHID
    case "$target" in  
    19451975        CheckNAS
    19461976        CheckX11
    19471977        CheckAAlib
     1978        CheckCaca
    19481979        CheckOpenGL
    19491980        CheckPTHREAD
    19501981        CheckUSBHID
    case "$target" in  
    19882019        CheckNAS
    19892020        CheckX11
    19902021        CheckAAlib
     2022        CheckCaca
    19912023        CheckOpenGL
    19922024        CheckPTHREAD
    19932025        # Set up files for the main() stub
    case "$target" in  
    20312063        CheckNAS
    20322064        CheckX11
    20332065        CheckAAlib
     2066        CheckCaca
    20342067        CheckOpenGL
    20352068        CheckPTHREAD
    20362069        # Set up files for the main() stub
    case "$target" in  
    20712104        CheckNAS
    20722105        CheckX11
    20732106        CheckAAlib
     2107        CheckCaca
    20742108        CheckOpenGL
    20752109        CheckPTHREAD
    20762110        # Set up files for the main() stub
    case "$target" in  
    21232157        CheckX11
    21242158        CheckGGI
    21252159        CheckAAlib
     2160        CheckCaca
    21262161        CheckOpenGL
    21272162        CheckPTHREAD
    21282163        # Set up files for the main() stub
    case "$target" in  
    21642199        CheckX11
    21652200        CheckGGI
    21662201        CheckAAlib
     2202        CheckCaca
    21672203        CheckOpenGL
    21682204        CheckPTHREAD
    21692205        # Set up files for the main() stub
    case "$target" in  
    22022238        CheckX11
    22032239        CheckGGI
    22042240        CheckAAlib
     2241        CheckCaca
    22052242        CheckOpenGL
    22062243        CheckPTHREAD
    22072244        SDL_LIBS="$SDL_LIBS -lrt"
    src/video/Makefile  
    27092746src/video/aalib/Makefile
    27102747src/video/ataricommon/Makefile
    27112748src/video/bwindow/Makefile
     2749src/video/caca/Makefile
    27122750src/video/cybergfx/Makefile
    27132751src/video/dc/Makefile
    27142752src/video/dga/Makefile
  • src/video/Makefile.am

    diff -puriN -x Makefile -x '*.la' libsdl1.2-1.2.6/src/video/Makefile.am libsdl1.2-1.2.6-caca/src/video/Makefile.am
    old new noinst_LTLIBRARIES = libvideo.la  
    55
    66# Define which subdirectories need to be built
    77SUBDIRS = @VIDEO_SUBDIRS@
    8 DIST_SUBDIRS = dummy x11 dga nanox fbcon directfb vgl svga ggi aalib \
     8DIST_SUBDIRS = dummy x11 dga nanox fbcon directfb vgl svga ggi aalib caca \
    99               wincommon windib windx5 \
    1010               maccommon macdsp macrom riscos quartz \
    1111               bwindow ps2gs photon cybergfx epoc picogui \
  • src/video/SDL_sysvideo.h

    diff -puriN -x Makefile -x '*.la' libsdl1.2-1.2.6/src/video/SDL_sysvideo.h libsdl1.2-1.2.6-caca/src/video/SDL_sysvideo.h
    old new extern VideoBootStrap SVGALIB_bootstrap;  
    359359#ifdef ENABLE_AALIB
    360360extern VideoBootStrap AALIB_bootstrap;
    361361#endif
     362#ifdef ENABLE_CACA
     363extern VideoBootStrap Caca_bootstrap;
     364#endif
    362365#ifdef ENABLE_WINDIB
    363366extern VideoBootStrap WINDIB_bootstrap;
    364367#endif
  • src/video/SDL_video.c

    diff -puriN -x Makefile -x '*.la' libsdl1.2-1.2.6/src/video/SDL_video.c libsdl1.2-1.2.6-caca/src/video/SDL_video.c
    old new static VideoBootStrap *bootstrap[] = {  
    7878#ifdef ENABLE_AALIB
    7979        &AALIB_bootstrap,
    8080#endif
     81#ifdef ENABLE_CACA
     82        &Caca_bootstrap,
     83#endif
    8184#ifdef ENABLE_DIRECTX
    8285        &DIRECTX_bootstrap,
    8386#endif
  • src/video/caca/Makefile.am

    diff -puriN -x Makefile -x '*.la' libsdl1.2-1.2.6/src/video/caca/Makefile.am libsdl1.2-1.2.6-caca/src/video/caca/Makefile.am
    old new  
     1
     2## Makefile.am for SDL using the libcaca video driver
     3
     4noinst_LTLIBRARIES = libvideo_caca.la
     5libvideo_caca_la_SOURCES = $(CACA_SRCS)
     6
     7# The SDL libcaca video driver sources
     8CACA_SRCS =                     \
     9        SDL_cacavideo.h         \
     10        SDL_cacaevents.c        \
     11        SDL_cacaevents_c.h      \
     12        SDL_cacavideo.c
     13
  • src/video/caca/SDL_cacaevents.c

    diff -puriN -x Makefile -x '*.la' libsdl1.2-1.2.6/src/video/caca/SDL_cacaevents.c libsdl1.2-1.2.6-caca/src/video/caca/SDL_cacaevents.c
    old new  
     1/*
     2    SDL - Simple DirectMedia Layer
     3    Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002  Sam Lantinga
     4
     5    This library is free software; you can redistribute it and/or
     6    modify it under the terms of the GNU Library General Public
     7    License as published by the Free Software Foundation; either
     8    version 2 of the License, or (at your option) any later version.
     9
     10    This library is distributed in the hope that it will be useful,
     11    but WITHOUT ANY WARRANTY; without even the implied warranty of
     12    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     13    Library General Public License for more details.
     14
     15    You should have received a copy of the GNU Library General Public
     16    License along with this library; if not, write to the Free
     17    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
     18
     19    Sam Lantinga
     20    slouken@libsdl.org
     21*/
     22
     23#ifdef SAVE_RCSID
     24static char rcsid =
     25 "@(#) $Id: patch-libsdl1.2-libcaca0.7.diff 809 2005-03-23 11:07:40Z sam $";
     26#endif
     27
     28#include <stdio.h>
     29
     30#include <caca.h>
     31
     32#include "SDL.h"
     33#include "SDL_sysevents.h"
     34#include "SDL_events_c.h"
     35#include "SDL_cacavideo.h"
     36#include "SDL_cacaevents_c.h"
     37
     38void Caca_PumpEvents(_THIS)
     39{
     40        int posted = 0;
     41        int event;
     42        SDL_keysym keysym;
     43
     44        if( ! this->screen ) /* Wait till we got the screen initialised */
     45          return;
     46
     47        do {
     48                posted = 0;
     49
     50                /* Get libcaca event */
     51                SDL_mutexP(Caca_mutex);
     52                event = caca_get_event(CACA_EVENT_ANY);
     53                SDL_mutexV(Caca_mutex);
     54
     55                if ( event & (CACA_EVENT_KEY_PRESS | CACA_EVENT_KEY_RELEASE)) {
     56                        int key;
     57                        switch ( event & 0xffffff )
     58                        {
     59                                case CACA_KEY_LEFT: key = SDLK_LEFT; break;
     60                                case CACA_KEY_RIGHT: key = SDLK_RIGHT; break;
     61                                case CACA_KEY_UP: key = SDLK_UP; break;
     62                                case CACA_KEY_DOWN: key = SDLK_DOWN; break;
     63                                default: key = event & 0xff; break;
     64                        }
     65                        /* Key pressed */
     66/*                      printf("Key pressed: %d (%c)\n", key, key); */
     67                        keysym.scancode = key;
     68                        keysym.sym = key;
     69                        keysym.mod = KMOD_NONE;
     70                        keysym.unicode = 0;
     71                        if ( SDL_TranslateUNICODE ) {
     72                                keysym.unicode = key;
     73                        }
     74                        posted += SDL_PrivateKeyboard((event & CACA_EVENT_KEY_PRESS) ? SDL_PRESSED : SDL_RELEASED, &keysym);
     75                }
     76                else if ( event & (CACA_EVENT_MOUSE_PRESS | CACA_EVENT_MOUSE_RELEASE) ) {
     77                        /* FIXME: we currently ignore the button type! */
     78                        int button = event & 0x00ffffff;
     79                        if ( button > 3 ) {
     80                                button = 1;
     81                        }
     82                        posted += SDL_PrivateMouseButton((event & CACA_EVENT_MOUSE_PRESS) ? SDL_PRESSED : SDL_RELEASED, button, 0, 0);
     83                }
     84                else if ( event & CACA_EVENT_MOUSE_MOTION ) {
     85                        int new_x = 0, new_y = 0;
     86                        new_x = ((event & 0x00fff000) >> 12) * Caca_w / caca_get_width();
     87                        new_y = ((event & 0x00000fff) >> 0) * Caca_h / caca_get_height();
     88                        posted += SDL_PrivateMouseMotion(0, 0, new_x, new_y);
     89                }
     90        } while ( posted );
     91}
     92
     93void Caca_InitOSKeymap(_THIS)
     94{
     95    return;
     96}
     97
  • src/video/caca/SDL_cacaevents_c.h

    diff -puriN -x Makefile -x '*.la' libsdl1.2-1.2.6/src/video/caca/SDL_cacaevents_c.h libsdl1.2-1.2.6-caca/src/video/caca/SDL_cacaevents_c.h
    old new  
     1/*
     2    SDL - Simple DirectMedia Layer
     3    Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002  Sam Lantinga
     4
     5    This library is free software; you can redistribute it and/or
     6    modify it under the terms of the GNU Library General Public
     7    License as published by the Free Software Foundation; either
     8    version 2 of the License, or (at your option) any later version.
     9
     10    This library is distributed in the hope that it will be useful,
     11    but WITHOUT ANY WARRANTY; without even the implied warranty of
     12    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     13    Library General Public License for more details.
     14
     15    You should have received a copy of the GNU Library General Public
     16    License along with this library; if not, write to the Free
     17    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
     18
     19    Sam Lantinga
     20    slouken@libsdl.org
     21*/
     22
     23#ifdef SAVE_RCSID
     24static char rcsid =
     25 "@(#) $Id: patch-libsdl1.2-libcaca0.7.diff 809 2005-03-23 11:07:40Z sam $";
     26#endif
     27
     28#include "SDL_cacavideo.h"
     29
     30/* Variables and functions exported by SDL_sysevents.c to other parts
     31   of the native video subsystem (SDL_sysvideo.c)
     32*/
     33extern void Caca_PumpEvents(_THIS);
     34extern void Caca_InitOSKeymap(_THIS);
  • src/video/caca/SDL_cacavideo.c

    diff -puriN -x Makefile -x '*.la' libsdl1.2-1.2.6/src/video/caca/SDL_cacavideo.c libsdl1.2-1.2.6-caca/src/video/caca/SDL_cacavideo.c
    old new  
     1/*
     2    SDL - Simple DirectMedia Layer
     3    Copyright (C) 2003  Sam Hocevar
     4
     5    This library is free software; you can redistribute it and/or
     6    modify it under the terms of the GNU Library General Public
     7    License as published by the Free Software Foundation; either
     8    version 2 of the License, or (at your option) any later version.
     9
     10    This library is distributed in the hope that it will be useful,
     11    but WITHOUT ANY WARRANTY; without even the implied warranty of
     12    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     13    Library General Public License for more details.
     14
     15    You should have received a copy of the GNU Library General Public
     16    License along with this library; if not, write to the Free
     17    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
     18
     19    Sam Hocevar
     20    sam@zoy.org
     21*/
     22
     23#ifdef SAVE_RCSID
     24static char rcsid =
     25 "@(#) $Id: patch-libsdl1.2-libcaca0.7.diff 809 2005-03-23 11:07:40Z sam $";
     26#endif
     27
     28/* libcaca based SDL video driver implementation.
     29*/
     30
     31#include <stdlib.h>
     32#include <stdio.h>
     33#include <string.h>
     34#include <unistd.h>
     35#include <sys/stat.h>
     36
     37
     38#include "SDL.h"
     39#include "SDL_error.h"
     40#include "SDL_video.h"
     41#include "SDL_mouse.h"
     42#include "SDL_sysvideo.h"
     43#include "SDL_pixels_c.h"
     44#include "SDL_events_c.h"
     45
     46#include "SDL_cacavideo.h"
     47#include "SDL_cacaevents_c.h"
     48
     49#include <caca.h>
     50
     51/* Initialization/Query functions */
     52static int Caca_VideoInit(_THIS, SDL_PixelFormat *vformat);
     53static SDL_Rect **Caca_ListModes(_THIS, SDL_PixelFormat *format, Uint32 flags);
     54static SDL_Surface *Caca_SetVideoMode(_THIS, SDL_Surface *current, int width, int height, int bpp, Uint32 flags);
     55static void Caca_VideoQuit(_THIS);
     56
     57/* Hardware surface functions */
     58static int Caca_AllocHWSurface(_THIS, SDL_Surface *surface);
     59static int Caca_LockHWSurface(_THIS, SDL_Surface *surface);
     60static int Caca_FlipHWSurface(_THIS, SDL_Surface *surface);
     61static void Caca_UnlockHWSurface(_THIS, SDL_Surface *surface);
     62static void Caca_FreeHWSurface(_THIS, SDL_Surface *surface);
     63
     64/* Cache the VideoDevice struct */
     65static struct SDL_VideoDevice *local_this;
     66
     67/* libcaca driver bootstrap functions */
     68
     69static int Caca_Available(void)
     70{
     71        return 1; /* Always available ! */
     72}
     73
     74static void Caca_DeleteDevice(SDL_VideoDevice *device)
     75{
     76        free(device->hidden);
     77        free(device);
     78}
     79
     80static SDL_VideoDevice *Caca_CreateDevice(int devindex)
     81{
     82        SDL_VideoDevice *device;
     83
     84        /* Initialize all variables that we clean on shutdown */
     85        device = (SDL_VideoDevice *)malloc(sizeof(SDL_VideoDevice));
     86        if ( device ) {
     87                memset(device, 0, (sizeof *device));
     88                device->hidden = (struct SDL_PrivateVideoData *)
     89                                malloc((sizeof *device->hidden));
     90        }
     91        if ( (device == NULL) || (device->hidden == NULL) ) {
     92                SDL_OutOfMemory();
     93                if ( device ) {
     94                        free(device);
     95                }
     96                return(0);
     97        }
     98        memset(device->hidden, 0, (sizeof *device->hidden));
     99
     100        /* Set the function pointers */
     101        device->VideoInit = Caca_VideoInit;
     102        device->ListModes = Caca_ListModes;
     103        device->SetVideoMode = Caca_SetVideoMode;
     104        device->CreateYUVOverlay = NULL;
     105        device->SetColors = NULL;
     106        device->UpdateRects = NULL;
     107        device->VideoQuit = Caca_VideoQuit;
     108        device->AllocHWSurface = Caca_AllocHWSurface;
     109        device->CheckHWBlit = NULL;
     110        device->FillHWRect = NULL;
     111        device->SetHWColorKey = NULL;
     112        device->SetHWAlpha = NULL;
     113        device->LockHWSurface = Caca_LockHWSurface;
     114        device->UnlockHWSurface = Caca_UnlockHWSurface;
     115        device->FlipHWSurface = NULL;
     116        device->FreeHWSurface = Caca_FreeHWSurface;
     117        device->SetCaption = NULL;
     118        device->SetIcon = NULL;
     119        device->IconifyWindow = NULL;
     120        device->GrabInput = NULL;
     121        device->GetWMInfo = NULL;
     122        device->InitOSKeymap = Caca_InitOSKeymap;
     123        device->PumpEvents = Caca_PumpEvents;
     124
     125        device->free = Caca_DeleteDevice;
     126
     127        return device;
     128}
     129
     130VideoBootStrap Caca_bootstrap = {
     131        "caca", "Color ASCII Art Library",
     132        Caca_Available, Caca_CreateDevice
     133};
     134
     135int Caca_VideoInit(_THIS, SDL_PixelFormat *vformat)
     136{
     137        int i;
     138
     139        /* Initialize all variables that we clean on shutdown */
     140        for ( i=0; i<SDL_NUMMODES; ++i ) {
     141                SDL_modelist[i] = malloc(sizeof(SDL_Rect));
     142                SDL_modelist[i]->x = SDL_modelist[i]->y = 0;
     143        }
     144        /* Modes sorted largest to smallest */
     145        SDL_modelist[0]->w = 1024; SDL_modelist[0]->h = 768;
     146        SDL_modelist[1]->w = 800; SDL_modelist[1]->h = 600;
     147        SDL_modelist[2]->w = 640; SDL_modelist[2]->h = 480;
     148        SDL_modelist[3]->w = 320; SDL_modelist[3]->h = 400;
     149        SDL_modelist[4]->w = 320; SDL_modelist[4]->h = 240;
     150        SDL_modelist[5]->w = 320; SDL_modelist[5]->h = 200;
     151        SDL_modelist[6] = NULL;
     152
     153        Caca_mutex = SDL_CreateMutex();
     154
     155        /* Initialize the library */
     156        if ( caca_init() != 0 ) {
     157                SDL_SetError("Unable to initialize libcaca");
     158                return(-1);
     159        }
     160
     161        /* Initialize private variables */
     162        Caca_lastkey = 0;
     163        Caca_bitmap = NULL;
     164        Caca_buffer = NULL;
     165
     166        local_this = this;
     167
     168        /* Determine the screen depth (use default 8-bit depth) */
     169        vformat->BitsPerPixel = 8;
     170        vformat->BytesPerPixel = 1;
     171
     172        /* We're done! */
     173        return(0);
     174}
     175
     176SDL_Rect **Caca_ListModes(_THIS, SDL_PixelFormat *format, Uint32 flags)
     177{
     178     if(format->BitsPerPixel != 8)
     179                return NULL;
     180
     181         if ( flags & SDL_FULLSCREEN ) {
     182                 return SDL_modelist;
     183         } else {
     184                 return (SDL_Rect **) -1;
     185         }
     186}
     187
     188/* Various screen update functions available */
     189static void Caca_DirectUpdate(_THIS, int numrects, SDL_Rect *rects);
     190
     191SDL_Surface *Caca_SetVideoMode(_THIS, SDL_Surface *current,
     192                                int width, int height, int bpp, Uint32 flags)
     193{
     194        if ( Caca_buffer ) {
     195                free( Caca_buffer );
     196                Caca_buffer = NULL;
     197        }
     198
     199        if ( Caca_bitmap ) {
     200                caca_free_bitmap( Caca_bitmap );
     201                Caca_bitmap = NULL;
     202        }
     203
     204        Caca_buffer = malloc(2 * ((width + 15) & ~15) * height);
     205        if ( ! Caca_buffer ) {
     206                SDL_SetError("Couldn't allocate buffer for requested mode");
     207                return(NULL);
     208        }
     209
     210        memset(Caca_buffer, 0, 2 * ((width + 15) & ~15) * height);
     211
     212        /* Allocate the new pixel format for the screen */
     213        if ( ! SDL_ReallocFormat(current, 16, 0xf800, 0x07e0, 0x001f, 0) ) {
     214                return(NULL);
     215        }
     216
     217        /* Set up the new mode framebuffer */
     218        current->flags = SDL_FULLSCREEN;
     219        Caca_w = current->w = width;
     220        Caca_h = current->h = height;
     221        current->pitch = 2 * ((width + 15) & ~15);
     222        current->pixels = Caca_buffer;
     223
     224        /* Create the libcaca bitmap */
     225        Caca_bitmap = caca_create_bitmap( 16, width, height, current->pitch, 0xf800, 0x07e0, 0x001f, 0x0000 );
     226        if ( ! Caca_bitmap ) {
     227                SDL_SetError("Couldn't allocate libcaca bitmap");
     228                return(NULL);
     229        }
     230
     231        /* Set the blit function */
     232        this->UpdateRects = Caca_DirectUpdate;
     233
     234        /* We're done */
     235        return(current);
     236}
     237
     238/* We don't actually allow hardware surfaces other than the main one */
     239static int Caca_AllocHWSurface(_THIS, SDL_Surface *surface)
     240{
     241        return(-1);
     242}
     243static void Caca_FreeHWSurface(_THIS, SDL_Surface *surface)
     244{
     245        return;
     246}
     247
     248/* We need to wait for vertical retrace on page flipped displays */
     249static int Caca_LockHWSurface(_THIS, SDL_Surface *surface)
     250{
     251        /* TODO ? */
     252        return(0);
     253}
     254static void Caca_UnlockHWSurface(_THIS, SDL_Surface *surface)
     255{
     256        return;
     257}
     258
     259/* FIXME: How is this done with libcaca? */
     260static int Caca_FlipHWSurface(_THIS, SDL_Surface *surface)
     261{
     262        SDL_mutexP(Caca_mutex);
     263        caca_refresh();
     264        SDL_mutexV(Caca_mutex);
     265        return(0);
     266}
     267
     268static void Caca_DirectUpdate(_THIS, int numrects, SDL_Rect *rects)
     269{
     270        SDL_mutexP(Caca_mutex);
     271        caca_draw_bitmap( 0, 0, caca_get_width() - 1, caca_get_height() - 1,
     272                          Caca_bitmap, Caca_buffer );
     273        caca_refresh();
     274        SDL_mutexV(Caca_mutex);
     275        return;
     276}
     277
     278/* Note:  If we are terminated, this could be called in the middle of
     279   another SDL video routine -- notably UpdateRects.
     280*/
     281void Caca_VideoQuit(_THIS)
     282{
     283        int i;
     284
     285        /* Free video mode lists */
     286        for ( i=0; i<SDL_NUMMODES; ++i ) {
     287                if ( SDL_modelist[i] != NULL ) {
     288                        free(SDL_modelist[i]);
     289                        SDL_modelist[i] = NULL;
     290                }
     291        }
     292
     293        if ( Caca_bitmap ) {
     294                caca_free_bitmap( Caca_bitmap );
     295                Caca_bitmap = NULL;
     296        }
     297
     298        caca_end();
     299
     300        SDL_DestroyMutex(Caca_mutex);
     301}
  • src/video/caca/SDL_cacavideo.h

    diff -puriN -x Makefile -x '*.la' libsdl1.2-1.2.6/src/video/caca/SDL_cacavideo.h libsdl1.2-1.2.6-caca/src/video/caca/SDL_cacavideo.h
    old new  
     1/*
     2    SDL - Simple DirectMedia Layer
     3    Copyright (C) 2003  Sam Hocevar
     4
     5    This library is free software; you can redistribute it and/or
     6    modify it under the terms of the GNU Library General Public
     7    License as published by the Free Software Foundation; either
     8    version 2 of the License, or (at your option) any later version.
     9
     10    This library is distributed in the hope that it will be useful,
     11    but WITHOUT ANY WARRANTY; without even the implied warranty of
     12    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     13    Library General Public License for more details.
     14
     15    You should have received a copy of the GNU Library General Public
     16    License along with this library; if not, write to the Free
     17    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
     18
     19    Sam Hocevar
     20    sam@zoy.org
     21*/
     22
     23#ifdef SAVE_RCSID
     24static char rcsid =
     25 "@(#) $Id: patch-libsdl1.2-libcaca0.7.diff 809 2005-03-23 11:07:40Z sam $";
     26#endif
     27
     28#ifndef _SDL_cacavideo_h
     29#define _SDL_cacavideo_h
     30
     31#include "SDL_mouse.h"
     32#include "SDL_sysvideo.h"
     33#include "SDL_mutex.h"
     34
     35#include <sys/time.h>
     36#include <time.h>
     37
     38#include <caca.h>
     39
     40/* Hidden "this" pointer for the video functions */
     41#define _THIS   SDL_VideoDevice *this
     42
     43#define SDL_NUMMODES 6
     44
     45/* Private display data */
     46struct SDL_PrivateVideoData {
     47        SDL_Rect *SDL_modelist[SDL_NUMMODES+1];
     48        SDL_mutex *mutex;
     49
     50        struct caca_bitmap *bitmap;
     51        void *buffer;
     52        int w, h;
     53
     54        int lastkey;
     55        struct timeval lasttime;
     56};
     57
     58/* Old variable names */
     59#define SDL_modelist            (this->hidden->SDL_modelist)
     60#define Caca_palette                (this->hidden->palette)
     61#define Caca_bitmap                 (this->hidden->bitmap)
     62#define Caca_buffer                 (this->hidden->buffer)
     63
     64#define Caca_w                      (this->hidden->w)
     65#define Caca_h                      (this->hidden->h)
     66
     67#define Caca_lastkey                (this->hidden->lastkey)
     68#define Caca_lasttime               (this->hidden->lasttime)
     69
     70#define Caca_mutex                  (this->hidden->mutex)
     71
     72#endif /* _SDL_cacavideo_h */
Note: See TracBrowser for help on using the repository browser.