src/video/gem/SDL_gemvideo.h
author Patrice Mandin
Sat, 06 Nov 2004 08:56:23 +0000
changeset 964 d9209754ebee
parent 926 83db694556eb
child 984 44fd54a0ae5f
permissions -rw-r--r--
Prevent redraws till internal buffers are correctly setup
     1 /*
     2     SDL - Simple DirectMedia Layer
     3     Copyright (C) 1997-2004 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
    24 static char rcsid =
    25  "@(#) $Id$";
    26 #endif
    27 
    28 #ifndef _SDL_gemvideo_h
    29 #define _SDL_gemvideo_h
    30 
    31 #include "SDL_sysvideo.h"
    32 #include "SDL_mutex.h"
    33 
    34 /* Hidden "this" pointer for the video functions */
    35 #define _THIS	SDL_VideoDevice *this
    36 
    37 /* Functions prototypes */
    38 void GEM_wind_redraw(_THIS, int winhandle, short *inside);
    39 
    40 /* Private display data */
    41 
    42 #define B2S_C2P_1TO2		(1<<0)	/* C2P convert buffer 1 to buffer 2 */
    43 #define B2S_C2P_1TOS		(1<<1)	/* C2P convert buffer 1 to screen */
    44 #define B2S_VROCPYFM_1TOS	(1<<2)	/* vro_cpyfm() buffer 1 to screen */
    45 #define B2S_VROCPYFM_2TOS	(1<<3)	/* vro_cpyfm() buffer 2 to screen */
    46 
    47 #define SDL_NUMMODES	1		/* Fullscreen */
    48 
    49 struct SDL_PrivateVideoData {
    50 	Uint16	buf2scr_ops;		/* Operations to get buffer to screen */
    51     void *buffer1;				/* Our shadow buffers */
    52 	void *buffer2;
    53 
    54 	/* VDI infos */
    55 	short vdi_handle;			/* VDI handle */
    56 	short full_w, full_h;		/* Fullscreen size */
    57     short bpp;					/* Colour depth */
    58 	short pixelsize;			/* Bytes per pixel */
    59 	short old_numcolors;		/* Number of colors in saved palette */
    60 	Uint16 pitch;				/* Line length */
    61 	Uint16 format;				/* Screen format */
    62 	void *screen;				/* Screen address */
    63 	Uint32 red, green, blue, alpha;	/* Screen components */
    64 	Uint32 screensize;
    65 	short	blit_coords[8];		/* Coordinates for bitblt */
    66 	MFDB	src_mfdb, dst_mfdb;	/* VDI MFDB for bitblt */
    67 	Uint16 old_palette[256][3];	/* Saved current palette */
    68 
    69 	/* GEM infos */
    70 	short desk_x, desk_y;		/* Desktop properties */
    71 	short desk_w, desk_h;
    72 	short win_handle;			/* Our window handle */
    73 	int window_type;			/* Window type */
    74 	const char *title_name;		/* Window title */
    75 	const char *icon_name;		/* Icon title */
    76 	short version;				/* AES version */
    77 	short wfeatures;			/* AES window features */
    78 	SDL_bool refresh_name;		/* Change window title ? */
    79 	SDL_bool window_fulled;		/* Window maximized ? */
    80 	SDL_bool mouse_relative;	/* Report relative mouse movement */
    81 	SDL_bool locked;			/* AES locked for fullscreen ? */
    82 	SDL_bool lock_redraw;		/* Prevent redraw till buffers are setup */
    83 	short message[8];			/* To self-send an AES message */
    84 
    85 	SDL_bool fullscreen;		/* Fullscreen or windowed mode ? */
    86 	SDL_Rect *SDL_modelist[SDL_NUMMODES+1];	/* Mode list */
    87 	SDL_Surface *icon;			/* The icon */
    88 };
    89 
    90 /* Hidden structure -> variables names */
    91 #define VDI_handle			(this->hidden->vdi_handle)
    92 #define VDI_w				(this->hidden->full_w)
    93 #define VDI_h				(this->hidden->full_h)
    94 #define VDI_bpp				(this->hidden->bpp)
    95 #define VDI_pixelsize		(this->hidden->pixelsize)
    96 #define VDI_oldnumcolors	(this->hidden->old_numcolors)
    97 #define VDI_oldpalette		(this->hidden->old_palette)
    98 #define VDI_pitch			(this->hidden->pitch)
    99 #define VDI_format			(this->hidden->format)
   100 #define VDI_screen			(this->hidden->screen)
   101 #define VDI_redmask			(this->hidden->red)
   102 #define VDI_greenmask		(this->hidden->green)
   103 #define VDI_bluemask		(this->hidden->blue)
   104 #define VDI_alphamask		(this->hidden->alpha)
   105 #define VDI_screensize		(this->hidden->screensize)
   106 #define VDI_src_mfdb		(this->hidden->src_mfdb)
   107 #define VDI_dst_mfdb		(this->hidden->dst_mfdb)
   108 #define VDI_blit_coords		(this->hidden->blit_coords)
   109 
   110 #define GEM_desk_x			(this->hidden->desk_x)
   111 #define GEM_desk_y			(this->hidden->desk_y)
   112 #define GEM_desk_w			(this->hidden->desk_w)
   113 #define GEM_desk_h			(this->hidden->desk_h)
   114 #define GEM_handle			(this->hidden->win_handle)
   115 #define GEM_win_type		(this->hidden->window_type)
   116 #define GEM_title_name		(this->hidden->title_name)
   117 #define GEM_icon_name		(this->hidden->icon_name)
   118 #define GEM_refresh_name	(this->hidden->refresh_name)
   119 #define GEM_version			(this->hidden->version)
   120 #define GEM_wfeatures		(this->hidden->wfeatures)
   121 #define GEM_win_fulled		(this->hidden->window_fulled)
   122 #define GEM_mouse_relative	(this->hidden->mouse_relative)
   123 #define GEM_locked			(this->hidden->locked)
   124 #define GEM_lock_redraw		(this->hidden->lock_redraw)
   125 #define GEM_message			(this->hidden->message)
   126 #define SDL_modelist		(this->hidden->SDL_modelist)
   127 #define GEM_icon			(this->hidden->icon)
   128 #define GEM_fullscreen		(this->hidden->fullscreen)
   129 
   130 #define GEM_buffer1			(this->hidden->buffer1)
   131 #define GEM_buffer2			(this->hidden->buffer2)
   132 #define GEM_bufops			(this->hidden->buf2scr_ops)
   133 
   134 #define VDI_FBMASK(amask, rmask, gmask, bmask) \
   135 	VDI_alphamask = (amask); \
   136 	VDI_redmask = (rmask); \
   137 	VDI_greenmask = (gmask); \
   138 	VDI_bluemask = (bmask);
   139 
   140 /*
   141 	Possible buffer to screen operations:
   142 
   143 	TC: 8 (chunky),15,16,24,32 bpp
   144 	8I: 8 bpp planes
   145 	FB: screen framebuffer address available
   146 	FS: fullscreen
   147 
   148 	TC, FB, FS:
   149 		- draw to screen
   150 	8I, FB, FS:
   151 		- draw to buffer 1
   152 		- C2P from buffer 1 to screen
   153 
   154 	TC, !FB, FS:
   155 		- draw to buffer 1
   156 		- vro_cpyfm() from buffer 1 to screen
   157 	8I, !FB, FS:
   158 		- draw to buffer 1
   159 		- C2P from buffer 1 to buffer 2
   160 		- vro_cpyfm() from buffer 2 to screen
   161 
   162 	TC, FB, !FS:
   163 		- draw to buffer 1
   164 		- vro_cpyfm() from buffer 1 to screen
   165 	8I, FB, !FS:
   166 		- draw to buffer 1
   167 		- C2P from buffer 1 to buffer 2
   168 		- vro_cpyfm() from buffer 2 to screen
   169 
   170 	TC, !FB, !FS:
   171 		- draw to buffer 1
   172 		- vro_cpyfm() from buffer 1 to screen
   173 	8I, !FB, !FS:
   174 		- draw to buffer 1
   175 		- C2P from buffer 1 to buffer 2
   176 		- vro_cpyfm() from buffer 2 to screen
   177 */
   178 
   179 #endif /* _SDL_gemvideo_h */