src/video/cybergfx/SDL_cgxvideo.h
author Sam Lantinga <slouken@libsdl.org>
Mon, 29 May 2006 04:04:35 +0000
branchSDL-1.3
changeset 1668 4da1ee79c9af
parent 1662 782fd950bd46
permissions -rw-r--r--
more tweaking indent options
     1 /*
     2     SDL - Simple DirectMedia Layer
     3     Copyright (C) 1997-2006 Sam Lantinga
     4 
     5     This library is free software; you can redistribute it and/or
     6     modify it under the terms of the GNU Lesser General Public
     7     License as published by the Free Software Foundation; either
     8     version 2.1 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     Lesser General Public License for more details.
    14 
    15     You should have received a copy of the GNU Lesser General Public
    16     License along with this library; if not, write to the Free Software
    17     Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
    18 
    19     Sam Lantinga
    20     slouken@libsdl.org
    21 */
    22 #include "SDL_config.h"
    23 
    24 #ifndef _SDL_cgxvideo_h
    25 #define _SDL_cgxvideo_h
    26 
    27 
    28 #include <exec/exec.h>
    29 #include <cybergraphx/cybergraphics.h>
    30 #include <graphics/scale.h>
    31 #include <graphics/gfx.h>
    32 #include <intuition/intuition.h>
    33 #if defined(__SASC) || defined(STORMC4_WOS)
    34 #include <proto/exec.h>
    35 #include <proto/cybergraphics.h>
    36 #include <proto/graphics.h>
    37 #include <proto/intuition.h>
    38 #include <proto/console.h>
    39 #else
    40 #include <inline/exec.h>
    41 #include <inline/cybergraphics.h>
    42 #include <inline/graphics.h>
    43 #include <inline/intuition.h>
    44 #include <inline/console.h>
    45 #endif
    46 
    47 #include "SDL_mouse.h"
    48 #include "../SDL_sysvideo.h"
    49 #include "mydebug.h"
    50 
    51 #define USE_CGX_WRITELUTPIXEL
    52 
    53 /* Hidden "this" pointer for the video functions */
    54 #define _THIS	SDL_VideoDevice *this
    55 
    56 /* Private display data */
    57 struct SDL_PrivateVideoData
    58 {
    59     struct Screen *Public_Display;      /* Used for events and window management */
    60     struct Screen *GFX_Display; /* Used for graphics and colormap stuff */
    61     Uint32 SDL_VisualUnused;    /* The visual used by our window */
    62     struct Window *SDL_Window;  /* Shared by both displays (no X security?) */
    63     unsigned char *BlankCursor; /* The invisible cursor */
    64 
    65     char *SDL_windowid;         /* Flag: true if we have been passed a window */
    66 
    67     /* The variables used for displaying graphics */
    68     Uint8 *Ximage;              /* The X image for our window */
    69     int swap_pixels;            /* Flag: true if display is swapped endian */
    70 
    71     /* Support for internal mouse warping */
    72     struct
    73     {
    74         int x;
    75         int y;
    76     } mouse_last;
    77     struct
    78     {
    79         int numerator;
    80         int denominator;
    81         int threshold;
    82     } mouse_accel;
    83     int mouse_relative;
    84 
    85     /* The current list of available video modes */
    86     SDL_Rect **modelist;
    87 
    88     /* available visuals of interest to us, sorted deepest first */
    89     struct
    90     {
    91         Uint32 visual;
    92         int depth;              /* number of significant bits/pixel */
    93         int bpp;                /* pixel quantum in bits */
    94     } visuals[5];               /* at most entries for 8, 15, 16, 24 */
    95     int nvisuals;
    96 
    97     Uint32 vis;                 /* current visual in use */
    98     int depth;                  /* current visual depth (not bpp) */
    99     int BytesPerPixel;
   100     int currently_fullscreen, same_format, dbuffer;
   101 
   102     /* Automatic mode switching support (entering/leaving fullscreen) */
   103     Uint32 switch_waiting;
   104     Uint32 switch_time;
   105 
   106     /* Prevent too many XSync() calls */
   107     int blit_queued;
   108 
   109     /* Colormap handling */
   110     LONG Pens;
   111     Sint32 *XPixels;            /* A list of pixels that have been allocated, the size depends on the screen format */
   112     struct ScreenBuffer *SB[2];
   113     struct RastPort *RP;
   114     short *iconcolors;          /* List of colors used by the icon */
   115 };
   116 
   117 /* Old variable names */
   118 #define local_X11		(this->hidden->local_X11)
   119 #define SDL_Display		(this->hidden->Public_Display)
   120 #define GFX_Display		(this->hidden->GFX_Display)
   121 #define SDL_Screen		DefaultScreen(this->hidden->Public_Display)
   122 
   123 #define SDL_Visual		(this->hidden->vis)
   124 
   125 #define SDL_Root		RootWindow(SDL_Display, SDL_Screen)
   126 #define WMwindow		(this->hidden->WMwindow)
   127 #define FSwindow		(this->hidden->FSwindow)
   128 #define SDL_Window		(this->hidden->SDL_Window)
   129 #define WM_DELETE_WINDOW	(this->hidden->WM_DELETE_WINDOW)
   130 #define SDL_BlankCursor		(this->hidden->BlankCursor)
   131 #define SDL_windowid		(this->hidden->SDL_windowid)
   132 #define SDL_Ximage		(this->hidden->Ximage)
   133 #define SDL_GC			(this->hidden->gc)
   134 #define swap_pixels		(this->hidden->swap_pixels)
   135 #define mouse_last		(this->hidden->mouse_last)
   136 #define mouse_accel		(this->hidden->mouse_accel)
   137 #define mouse_relative		(this->hidden->mouse_relative)
   138 #define SDL_modelist		(this->hidden->modelist)
   139 #define SDL_RastPort		(this->hidden->RP)
   140 #define saved_mode		(this->hidden->saved_mode)
   141 #define saved_view		(this->hidden->saved_view)
   142 #define currently_fullscreen	(this->hidden->currently_fullscreen)
   143 #define blit_queued		(this->hidden->blit_queued)
   144 #define SDL_DisplayColormap	(this->hidden->GFX_Display->ViewPort.ColorMap)
   145 #define SDL_XPixels		(this->hidden->XPixels)
   146 #define SDL_iconcolors		(this->hidden->iconcolors)
   147 
   148 /* Used to get the X cursor from a window-manager specific cursor */
   149 // extern Cursor SDL_GetWMXCursor(WMcursor *cursor);
   150 
   151 extern int CGX_CreateWindow(_THIS, SDL_Surface * screen,
   152                             int w, int h, int bpp, Uint32 flags);
   153 extern int CGX_ResizeWindow(_THIS,
   154                             SDL_Surface * screen, int w, int h, Uint32 flags);
   155 
   156 extern void CGX_DestroyWindow(_THIS, SDL_Surface * screen);
   157 
   158 extern struct Library *CyberGfxBase;
   159 extern struct IntuitionBase *IntuitionBase;
   160 extern struct GfxBase *GfxBase;
   161 extern struct ExecBase *SysBase;
   162 extern struct DosLibrary *DOSBase;
   163 
   164 struct private_hwdata
   165 {
   166     struct BitMap *bmap;
   167     APTR lock;
   168     struct SDL_VideoDevice *videodata;
   169     APTR mask;
   170     int allocated;
   171 };
   172 
   173 int CGX_CheckHWBlit(_THIS, SDL_Surface * src, SDL_Surface * dst);
   174 int CGX_FillHWRect(_THIS, SDL_Surface * dst, SDL_Rect * dstrect,
   175                    Uint32 color);
   176 int CGX_SetHWColorKey(_THIS, SDL_Surface * surface, Uint32 key);
   177 #endif /* _SDL_x11video_h */
   178 /* vi: set ts=4 sw=4 expandtab: */