Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

Cleaned up a bunch of warnings, started adding Win32 event support

  • Loading branch information
slouken committed Jun 30, 2006
1 parent 7598c3d commit 3097c14a24dc9c9d218a790724c44c1d0f1ec464
@@ -133,7 +133,7 @@ typedef unsigned int uintptr_t;
#ifdef _WIN32_WCE
#define SDL_JOYSTICK_DISABLED 1
#else
#define SDL_JOYSTICK_DINPUT 1
#define SDL_JOYSTICK_WINMM 1
#endif

/* Enable various shared object loading systems */
@@ -150,17 +150,8 @@ typedef unsigned int uintptr_t;
#endif

/* Enable various video drivers */
#ifdef _WIN32_WCE
#define SDL_VIDEO_DRIVER_GAPI 1
#endif
#ifndef _WIN32_WCE
#define SDL_VIDEO_DRIVER_DDRAW 1
#endif
#define SDL_VIDEO_DRIVER_DUMMY 1
#ifndef _WIN32_WCE
#define SDL_VIDEO_DRIVER_GLSDL 1
#endif
#define SDL_VIDEO_DRIVER_WINDIB 1
#define SDL_VIDEO_DRIVER_WIN32 1

/* Enable OpenGL support */
#ifndef _WIN32_WCE
@@ -717,6 +717,18 @@ extern DECLSPEC void SDLCALL SDL_SetWindowGrab(SDL_WindowID windowID,
*/
extern DECLSPEC int SDLCALL SDL_GetWindowGrab(SDL_WindowID windowID);

/**
* \fn SDL_bool SDL_GetWindowWMInfo(SDL_WindowID windowID, struct SDL_SysWMinfo * info)
*
* \brief Get driver specific information about a window.
*
* \note Include SDL_syswm.h for the declaration of SDL_SysWMinfo.
*/
struct SDL_SysWMinfo;
extern DECLSPEC SDL_bool SDLCALL SDL_GetWindowWMInfo(SDL_WindowID windowID,
struct SDL_SysWMinfo
*info);

/**
* \fn void SDL_DestroyWindow(SDL_WindowID windowID)
*
@@ -26,6 +26,7 @@
#include "SDL.h"
#include "SDL_syswm.h"

#include "video/SDL_sysvideo.h"
#include "video/SDL_pixels_c.h"


@@ -94,7 +95,7 @@ SDL_VideoModeOK(int width, int height, int bpp, Uint32 flags)
if (!mode->format) {
return bpp;
}
if (SDL_BITSPERPIXEL(mode->format) >= bpp) {
if (SDL_BITSPERPIXEL(mode->format) >= (Uint32) bpp) {
actual_bpp = SDL_BITSPERPIXEL(mode->format);
}
}
@@ -118,6 +119,7 @@ SDL_ListModes(SDL_PixelFormat * format, Uint32 flags)

/* Memory leak, but this is a compatibility function, who cares? */
nmodes = 0;
modes = NULL;
for (i = 0; i < SDL_GetNumDisplayModes(); ++i) {
const SDL_DisplayMode *mode = SDL_GetDisplayMode(i);
if (!mode->w || !mode->h) {
@@ -243,6 +245,7 @@ SDL_VideoPaletteChanged(void *userdata, SDL_Palette * palette)
if (userdata == SDL_VideoSurface) {
return SDL_SetDisplayPalette(palette->colors, 0, palette->ncolors);
}
return 0;
}

SDL_Surface *
@@ -251,11 +254,9 @@ SDL_SetVideoMode(int width, int height, int bpp, Uint32 flags)
int (*filter) (SDL_Event * event);
const SDL_DisplayMode *desktop_mode;
SDL_DisplayMode mode;
int i;
Uint32 window_flags;
Uint32 desktop_format;
Uint32 desired_format;
Uint32 texture_format;
Uint32 surface_flags;

if (!SDL_GetVideoDevice()) {
@@ -641,6 +642,7 @@ int
SDL_WM_IconifyWindow(void)
{
SDL_MinimizeWindow(SDL_VideoWindow);
return 0;
}

int
@@ -695,7 +697,7 @@ int
SDL_SetPalette(SDL_Surface * surface, int flags, const SDL_Color * colors,
int firstcolor, int ncolors)
{
SDL_SetColors(surface, colors, firstcolor, ncolors);
return SDL_SetColors(surface, colors, firstcolor, ncolors);
}

int
@@ -1333,6 +1335,7 @@ SDL_DisplayYUVOverlay(SDL_Overlay * overlay, SDL_Rect * dstrect)
return -1;
}
SDL_RenderPresent();
return 0;
}

void
@@ -40,14 +40,19 @@
void
SDL_MixAudio_MMX_S16_VC(char *dst, char *src, unsigned int nSize, int volume)
{
/* *INDENT-OFF* */
__asm {

push edi push esi push ebx mov edi, dst // edi = dst
push edi
push esi
push ebx
mov edi, dst // edi = dst
mov esi, src // esi = src
mov eax, volume // eax = volume
mov ebx, nSize // ebx = size
shr ebx, 4 // process 16 bytes per iteration = 8 samples
jz endS16 pxor mm0, mm0 movd mm0, eax //%%eax,%%mm0
jz endS16
pxor mm0, mm0
movd mm0, eax //%%eax,%%mm0
movq mm1, mm0 //%%mm0,%%mm1
psllq mm0, 16 //$16,%%mm0
por mm0, mm1 //%%mm1,%%mm0
@@ -58,13 +63,14 @@ SDL_MixAudio_MMX_S16_VC(char *dst, char *src, unsigned int nSize, int volume)
#ifndef __WATCOMC__
align 16
#endif
mixloopS16:movq mm1,[esi] //(%%esi),%%mm1\n" // mm1 = a|b|c|d
movq mm2, mm1 //%%mm1,%%mm2\n" // mm2 = a|b|c|d
mixloopS16:
movq mm1,[esi] //(%%esi),%%mm1\n" // mm1 = a|b|c|d
movq mm2, mm1 //%%mm1,%%mm2\n" // mm2 = a|b|c|d
movq mm4,[esi + 8] //8(%%esi),%%mm4\n" // mm4 = e|f|g|h
// pre charger le buffer dst dans mm7
movq mm7,[edi] //(%%edi),%%mm7\n" // mm7 = dst[0]"
movq mm7,[edi] //(%%edi),%%mm7\n" // mm7 = dst[0]"
// multiplier par le volume
pmullw mm1, mm0 //%%mm0,%%mm1\n" // mm1 = l(a*v)|l(b*v)|l(c*v)|l(d*v)
pmullw mm1, mm0 //%%mm0,%%mm1\n" // mm1 = l(a*v)|l(b*v)|l(c*v)|l(d*v)
pmulhw mm2, mm0 //%%mm0,%%mm2\n" // mm2 = h(a*v)|h(b*v)|h(c*v)|h(d*v)
movq mm5, mm4 //%%mm4,%%mm5\n" // mm5 = e|f|g|h
pmullw mm4, mm0 //%%mm0,%%mm4\n" // mm4 = l(e*v)|l(f*v)|l(g*v)|l(h*v)
@@ -78,7 +84,7 @@ SDL_MixAudio_MMX_S16_VC(char *dst, char *src, unsigned int nSize, int volume)
// pre charger le buffer dst dans mm5
movq mm5,[edi + 8] //8(%%edi),%%mm5\n" // mm5 = dst[1]
// diviser par 128
psrad mm1, 7 //$7,%%mm1\n" // mm1 = a*v/128|b*v/128 , 128 = SDL_MIX_MAXVOLUME
psrad mm1, 7 //$7,%%mm1\n" // mm1 = a*v/128|b*v/128 , 128 = SDL_MIX_MAXVOLUME
add esi, 16 //$16,%%esi\n"
psrad mm3, 7 //$7,%%mm3\n" // mm3 = c*v/128|d*v/128
psrad mm4, 7 //$7,%%mm4\n" // mm4 = e*v/128|f*v/128
@@ -93,8 +99,14 @@ SDL_MixAudio_MMX_S16_VC(char *dst, char *src, unsigned int nSize, int volume)
movq[edi + 8], mm6 //%%mm6,8(%%edi)\n"
add edi, 16 //$16,%%edi\n"
dec ebx //%%ebx\n"
jnz mixloopS16 ends16:emms pop ebx pop esi pop edi}

jnz mixloopS16
ends16:
emms
pop ebx
pop esi
pop edi
}
/* *INDENT-ON* */
}

////////////////////////////////////////////////
@@ -104,9 +116,13 @@ SDL_MixAudio_MMX_S16_VC(char *dst, char *src, unsigned int nSize, int volume)
void
SDL_MixAudio_MMX_S8_VC(char *dst, char *src, unsigned int nSize, int volume)
{
/* *INDENT-OFF* */
_asm {

push edi push esi push ebx mov edi, dst //movl %0,%%edi // edi = dst
push edi
push esi
push ebx
mov edi, dst //%0,%%edi // edi = dst
mov esi, src //%1,%%esi // esi = src
mov eax, volume //%3,%%eax // eax = volume
movd mm0, eax //%%eax,%%mm0
@@ -124,15 +140,16 @@ SDL_MixAudio_MMX_S8_VC(char *dst, char *src, unsigned int nSize, int volume)
#ifndef __WATCOMC__
align 16
#endif
mixloopS8:pxor mm2, mm2 //%%mm2,%%mm2 // mm2 = 0
mixloopS8:
pxor mm2, mm2 //%%mm2,%%mm2 // mm2 = 0
movq mm1,[esi] //(%%esi),%%mm1 // mm1 = a|b|c|d|e|f|g|h
movq mm3, mm1 //%%mm1,%%mm3 // mm3 = a|b|c|d|e|f|g|h
movq mm3, mm1 //%%mm1,%%mm3 // mm3 = a|b|c|d|e|f|g|h
// on va faire le "sign extension" en faisant un cmp avec 0 qui retourne 1 si <0, 0 si >0
pcmpgtb mm2, mm1 //%%mm1,%%mm2 // mm2 = 11111111|00000000|00000000....
punpckhbw mm1, mm2 //%%mm2,%%mm1 // mm1 = 0|a|0|b|0|c|0|d
punpcklbw mm3, mm2 //%%mm2,%%mm3 // mm3 = 0|e|0|f|0|g|0|h
movq mm2,[edi] //(%%edi),%%mm2 // mm2 = destination
pmullw mm1, mm0 //%%mm0,%%mm1 // mm1 = v*a|v*b|v*c|v*d
pmullw mm1, mm0 //%%mm0,%%mm1 // mm1 = v*a|v*b|v*c|v*d
add esi, 8 //$8,%%esi
pmullw mm3, mm0 //%%mm0,%%mm3 // mm3 = v*e|v*f|v*g|v*h
psraw mm1, 7 //$7,%%mm1 // mm1 = v*a/128|v*b/128|v*c/128|v*d/128
@@ -142,8 +159,16 @@ SDL_MixAudio_MMX_S8_VC(char *dst, char *src, unsigned int nSize, int volume)
movq[edi], mm3 //%%mm3,(%%edi) // store back to ram
add edi, 8 //$8,%%edi
dec ebx //%%ebx
jnz mixloopS8 endS8:emms pop ebx pop esi pop edi}
jnz mixloopS8
endS8:
emms
pop ebx
pop esi
pop edi
}
/* *INDENT-ON* */
}

#endif /* SDL_ASSEMBLY_ROUTINES */

/* vi: set ts=4 sw=4 expandtab: */
@@ -39,11 +39,6 @@ extern int SDL_QuitInit(void);
extern int SDL_SendQuit(void);
extern void SDL_QuitQuit(void);

extern int SDL_SendWindowEvent(SDL_WindowID windowID, Uint8 windowevent,
int data1, int data2);

extern int SDL_SendSysWMEvent(SDL_SysWMmsg * message);

/* The event filter function */
extern SDL_EventFilter SDL_EventOK;

@@ -291,8 +291,6 @@ int
SDL_AddKeyboard(const SDL_Keyboard * keyboard, int index)
{
SDL_Keyboard **keyboards;
SDL_Cursor *cursor;
int selected_keyboard;

/* Add the keyboard to the list of keyboards */
if (index < 0 || index >= SDL_num_keyboards || SDL_keyboards[index]) {
@@ -24,6 +24,9 @@
#ifndef _SDL_keyboard_c_h
#define _SDL_keyboard_c_h

#include "SDL_keysym.h"
#include "SDL_events.h"

typedef struct SDL_Keyboard SDL_Keyboard;

struct SDL_Keyboard
@@ -53,7 +53,6 @@ int
SDL_AddMouse(const SDL_Mouse * mouse, int index)
{
SDL_Mouse **mice;
SDL_Cursor *cursor;
int selected_mouse;

/* Add the mouse to the list of mice */
@@ -398,9 +397,7 @@ SDL_CreateCursor(const Uint8 * data, const Uint8 * mask,
return NULL;
}
for (y = 0; y < h; ++y) {
pixel =
(Uint32 *) ((Uint8 *) surface->pixels + y * surface->pitch +
x * 4);
pixel = (Uint32 *) ((Uint8 *) surface->pixels + y * surface->pitch);
for (x = 0; x < w; ++x) {
if ((x % 8) == 0) {
datab = *data++;
@@ -0,0 +1,34 @@
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997-2006 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Sam Lantinga
slouken@libsdl.org
*/
#include "SDL_config.h"

#ifndef _SDL_windowevents_c_h
#define _SDL_windowevents_c_h

extern int SDL_SendWindowEvent(SDL_WindowID windowID, Uint8 windowevent,
int data1, int data2);

extern int SDL_SendSysWMEvent(SDL_SysWMmsg * message);

#endif /* _SDL_windowevents_c_h */

/* vi: set ts=4 sw=4 expandtab: */
@@ -617,7 +617,9 @@ BlitRGBtoRGBPixelAlphaMMX(SDL_BlitInfo * info)
__m64 src1, dst1, mm_alpha, mm_zero, dmask;

mm_zero = _mm_setzero_si64(); /* 0 -> mm_zero */
multmask = ~(0xFFFFi 64 << (ashift * 2));
/* *INDENT-OFF* */
multmask = ~(0xFFFFI64 << (ashift * 2));
/* *INDENT-ON* */
dmask = *(__m64 *) & multmask; /* dst alpha mask -> dmask */

while (height--) {
@@ -1753,7 +1755,9 @@ BlitRGBtoRGBPixelAlphaMMX3DNOW(SDL_BlitInfo * info)
__m64 src1, dst1, mm_alpha, mm_zero, dmask;

mm_zero = _mm_setzero_si64(); /* 0 -> mm_zero */
multmask = ~(0xFFFFi 64 << (ashift * 2));
/* *INDENT-OFF* */
multmask = ~(0xFFFFI64 << (ashift * 2));
/* *INDENT-ON* */
dmask = *(__m64 *) & multmask; /* dst alpha mask -> dmask */

while (height--) {
@@ -54,8 +54,8 @@ static void SDL_SW_DirtyTexture(SDL_Renderer * renderer,
const SDL_Rect * rects);
static void SDL_SW_SelectRenderTexture(SDL_Renderer * renderer,
SDL_Texture * texture);
static void SDL_SW_RenderFill(SDL_Renderer * renderer, const SDL_Rect * rect,
Uint32 color);
static int SDL_SW_RenderFill(SDL_Renderer * renderer, const SDL_Rect * rect,
Uint32 color);
static int SDL_SW_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture,
const SDL_Rect * srcrect,
const SDL_Rect * dstrect, int blendMode,
@@ -355,7 +355,7 @@ SDL_SW_SelectRenderTexture(SDL_Renderer * renderer, SDL_Texture * texture)
}
}

static void
static int
SDL_SW_RenderFill(SDL_Renderer * renderer, const SDL_Rect * rect,
Uint32 color)
{
@@ -369,7 +369,7 @@ SDL_SW_RenderFill(SDL_Renderer * renderer, const SDL_Rect * rect,
b = (Uint8) (color & 0xFF);
color = SDL_MapRGBA(data->target->format, r, g, b, a);

SDL_FillRect(data->target, &real_rect, color);
return SDL_FillRect(data->target, &real_rect, color);
}

static int
@@ -39,7 +39,6 @@ SDL_CreateRGBSurface(Uint32 flags,
int width, int height, int depth,
Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask)
{
SDL_Surface *screen;
SDL_Surface *surface;

/* FIXME!! */

0 comments on commit 3097c14

Please sign in to comment.