19682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/*
29682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall    SDL - Simple DirectMedia Layer
39682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall    Copyright (C) 1997-2012 Sam Lantinga
49682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall
59682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall    This library is free software; you can redistribute it and/or
69682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall    modify it under the terms of the GNU Lesser General Public
79682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall    License as published by the Free Software Foundation; either
89682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall    version 2.1 of the License, or (at your option) any later version.
99682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall
109682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall    This library is distributed in the hope that it will be useful,
119682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall    but WITHOUT ANY WARRANTY; without even the implied warranty of
129682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
139682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall    Lesser General Public License for more details.
149682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall
159682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall    You should have received a copy of the GNU Lesser General Public
169682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall    License along with this library; if not, write to the Free Software
179682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
189682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall
199682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall    Sam Lantinga
209682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall    slouken@libsdl.org
219682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall*/
229682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#include "SDL_config.h"
239682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall
249682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/* Dummy SDL video driver implementation; this is just enough to make an
259682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall *  SDL-based application THINK it's got a working video driver, for
269682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall *  applications that call SDL_Init(SDL_INIT_VIDEO) when they don't need it,
279682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall *  and also for use as a collection of stubs when porting SDL to a new
289682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall *  platform for which you haven't yet written a valid video driver.
299682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall *
309682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * This is also a great way to determine bottlenecks: if you think that SDL
319682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall *  is a performance problem for a given platform, enable this driver, and
329682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall *  then see if your application runs faster without video overhead.
339682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall *
349682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * Initial work by Ryan C. Gordon (icculus@icculus.org). A good portion
359682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall *  of this was cut-and-pasted from Stephane Peter's work in the AAlib
369682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall *  SDL video driver.  Renamed to "DUMMY" by Sam Lantinga.
379682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall */
389682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall
399682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#include "SDL_video.h"
409682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#include "SDL_mouse.h"
419682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#include "../SDL_sysvideo.h"
429682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#include "../SDL_pixels_c.h"
439682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#include "../../events/SDL_events_c.h"
449682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall
459682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#include "SDL_nullvideo.h"
469682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#include "SDL_nullevents_c.h"
479682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#include "SDL_nullmouse_c.h"
489682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall
499682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define DUMMYVID_DRIVER_NAME "dummy"
509682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall
519682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/* Initialization/Query functions */
529682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallstatic int DUMMY_VideoInit(_THIS, SDL_PixelFormat *vformat);
539682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallstatic SDL_Rect **DUMMY_ListModes(_THIS, SDL_PixelFormat *format, Uint32 flags);
549682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallstatic SDL_Surface *DUMMY_SetVideoMode(_THIS, SDL_Surface *current, int width, int height, int bpp, Uint32 flags);
559682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallstatic int DUMMY_SetColors(_THIS, int firstcolor, int ncolors, SDL_Color *colors);
569682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallstatic void DUMMY_VideoQuit(_THIS);
579682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall
589682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/* Hardware surface functions */
599682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallstatic int DUMMY_AllocHWSurface(_THIS, SDL_Surface *surface);
609682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallstatic int DUMMY_LockHWSurface(_THIS, SDL_Surface *surface);
619682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallstatic void DUMMY_UnlockHWSurface(_THIS, SDL_Surface *surface);
629682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallstatic void DUMMY_FreeHWSurface(_THIS, SDL_Surface *surface);
639682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall
649682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/* etc. */
659682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallstatic void DUMMY_UpdateRects(_THIS, int numrects, SDL_Rect *rects);
669682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall
679682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/* DUMMY driver bootstrap functions */
689682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall
699682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallstatic int DUMMY_Available(void)
709682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall{
719682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	const char *envr = SDL_getenv("SDL_VIDEODRIVER");
729682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	if ((envr) && (SDL_strcmp(envr, DUMMYVID_DRIVER_NAME) == 0)) {
739682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall		return(1);
749682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	}
759682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall
769682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	return(0);
779682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall}
789682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall
799682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallstatic void DUMMY_DeleteDevice(SDL_VideoDevice *device)
809682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall{
819682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	SDL_free(device->hidden);
829682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	SDL_free(device);
839682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall}
849682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall
859682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallstatic SDL_VideoDevice *DUMMY_CreateDevice(int devindex)
869682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall{
879682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	SDL_VideoDevice *device;
889682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall
899682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	/* Initialize all variables that we clean on shutdown */
909682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	device = (SDL_VideoDevice *)SDL_malloc(sizeof(SDL_VideoDevice));
919682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	if ( device ) {
929682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall		SDL_memset(device, 0, (sizeof *device));
939682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall		device->hidden = (struct SDL_PrivateVideoData *)
949682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall				SDL_malloc((sizeof *device->hidden));
959682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	}
969682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	if ( (device == NULL) || (device->hidden == NULL) ) {
979682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall		SDL_OutOfMemory();
989682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall		if ( device ) {
999682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall			SDL_free(device);
1009682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall		}
1019682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall		return(0);
1029682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	}
1039682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	SDL_memset(device->hidden, 0, (sizeof *device->hidden));
1049682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall
1059682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	/* Set the function pointers */
1069682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	device->VideoInit = DUMMY_VideoInit;
1079682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	device->ListModes = DUMMY_ListModes;
1089682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	device->SetVideoMode = DUMMY_SetVideoMode;
1099682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	device->CreateYUVOverlay = NULL;
1109682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	device->SetColors = DUMMY_SetColors;
1119682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	device->UpdateRects = DUMMY_UpdateRects;
1129682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	device->VideoQuit = DUMMY_VideoQuit;
1139682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	device->AllocHWSurface = DUMMY_AllocHWSurface;
1149682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	device->CheckHWBlit = NULL;
1159682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	device->FillHWRect = NULL;
1169682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	device->SetHWColorKey = NULL;
1179682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	device->SetHWAlpha = NULL;
1189682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	device->LockHWSurface = DUMMY_LockHWSurface;
1199682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	device->UnlockHWSurface = DUMMY_UnlockHWSurface;
1209682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	device->FlipHWSurface = NULL;
1219682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	device->FreeHWSurface = DUMMY_FreeHWSurface;
1229682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	device->SetCaption = NULL;
1239682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	device->SetIcon = NULL;
1249682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	device->IconifyWindow = NULL;
1259682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	device->GrabInput = NULL;
1269682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	device->GetWMInfo = NULL;
1279682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	device->InitOSKeymap = DUMMY_InitOSKeymap;
1289682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	device->PumpEvents = DUMMY_PumpEvents;
1299682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall
1309682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	device->free = DUMMY_DeleteDevice;
1319682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall
1329682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	return device;
1339682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall}
1349682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall
1359682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse HallVideoBootStrap DUMMY_bootstrap = {
1369682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	DUMMYVID_DRIVER_NAME, "SDL dummy video driver",
1379682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	DUMMY_Available, DUMMY_CreateDevice
1389682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall};
1399682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall
1409682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall
1419682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallint DUMMY_VideoInit(_THIS, SDL_PixelFormat *vformat)
1429682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall{
1439682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	/*
1449682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	fprintf(stderr, "WARNING: You are using the SDL dummy video driver!\n");
1459682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	*/
1469682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall
1479682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	/* Determine the screen depth (use default 8-bit depth) */
1489682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	/* we change this during the SDL_SetVideoMode implementation... */
1499682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	vformat->BitsPerPixel = 8;
1509682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	vformat->BytesPerPixel = 1;
1519682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall
1529682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	/* We're done! */
1539682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	return(0);
1549682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall}
1559682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall
1569682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse HallSDL_Rect **DUMMY_ListModes(_THIS, SDL_PixelFormat *format, Uint32 flags)
1579682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall{
1589682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall   	 return (SDL_Rect **) -1;
1599682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall}
1609682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall
1619682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse HallSDL_Surface *DUMMY_SetVideoMode(_THIS, SDL_Surface *current,
1629682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall				int width, int height, int bpp, Uint32 flags)
1639682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall{
1649682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	if ( this->hidden->buffer ) {
1659682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall		SDL_free( this->hidden->buffer );
1669682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	}
1679682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall
1689682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	this->hidden->buffer = SDL_malloc(width * height * (bpp / 8));
1699682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	if ( ! this->hidden->buffer ) {
1709682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall		SDL_SetError("Couldn't allocate buffer for requested mode");
1719682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall		return(NULL);
1729682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	}
1739682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall
1749682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/* 	printf("Setting mode %dx%d\n", width, height); */
1759682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall
1769682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	SDL_memset(this->hidden->buffer, 0, width * height * (bpp / 8));
1779682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall
1789682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	/* Allocate the new pixel format for the screen */
1799682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	if ( ! SDL_ReallocFormat(current, bpp, 0, 0, 0, 0) ) {
1809682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall		SDL_free(this->hidden->buffer);
1819682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall		this->hidden->buffer = NULL;
1829682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall		SDL_SetError("Couldn't allocate new pixel format for requested mode");
1839682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall		return(NULL);
1849682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	}
1859682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall
1869682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	/* Set up the new mode framebuffer */
1879682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	current->flags = flags & SDL_FULLSCREEN;
1889682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	this->hidden->w = current->w = width;
1899682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	this->hidden->h = current->h = height;
1909682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	current->pitch = current->w * (bpp / 8);
1919682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	current->pixels = this->hidden->buffer;
1929682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall
1939682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	/* We're done */
1949682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	return(current);
1959682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall}
1969682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall
1979682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/* We don't actually allow hardware surfaces other than the main one */
1989682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallstatic int DUMMY_AllocHWSurface(_THIS, SDL_Surface *surface)
1999682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall{
2009682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	return(-1);
2019682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall}
2029682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallstatic void DUMMY_FreeHWSurface(_THIS, SDL_Surface *surface)
2039682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall{
2049682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	return;
2059682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall}
2069682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall
2079682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/* We need to wait for vertical retrace on page flipped displays */
2089682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallstatic int DUMMY_LockHWSurface(_THIS, SDL_Surface *surface)
2099682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall{
2109682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	return(0);
2119682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall}
2129682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall
2139682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallstatic void DUMMY_UnlockHWSurface(_THIS, SDL_Surface *surface)
2149682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall{
2159682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	return;
2169682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall}
2179682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall
2189682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallstatic void DUMMY_UpdateRects(_THIS, int numrects, SDL_Rect *rects)
2199682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall{
2209682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	/* do nothing. */
2219682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall}
2229682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall
2239682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallint DUMMY_SetColors(_THIS, int firstcolor, int ncolors, SDL_Color *colors)
2249682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall{
2259682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	/* do nothing of note. */
2269682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	return(1);
2279682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall}
2289682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall
2299682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/* Note:  If we are terminated, this could be called in the middle of
2309682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall   another SDL video routine -- notably UpdateRects.
2319682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall*/
2329682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallvoid DUMMY_VideoQuit(_THIS)
2339682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall{
2349682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	if (this->screen->pixels != NULL)
2359682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	{
2369682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall		SDL_free(this->screen->pixels);
2379682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall		this->screen->pixels = NULL;
2389682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	}
2399682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall}
240