Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Added SDL_LockRect() and SDL_UnlockRect()
 Incorporated XFree86 extension libraries into the source
  • Loading branch information
slouken committed Mar 5, 2002
1 parent 0448ba7 commit bbf4b4c
Show file tree
Hide file tree
Showing 49 changed files with 8,402 additions and 206 deletions.
2 changes: 1 addition & 1 deletion Makefile.am
Expand Up @@ -45,7 +45,7 @@ EXTRA_DIST = \
EpocBuildFiles.zip \
WhatsNew \
docs.html \
sdl.m4 \
sdl.m4 \
SDL.spec \
autogen.sh \
strip_fPIC.sh
Expand Down
6 changes: 6 additions & 0 deletions WhatsNew
Expand Up @@ -3,6 +3,12 @@ This is a list of API changes in SDL's version history.

Version 1.0:

1.2.4:
Added SDL_LockRect() and SDL_UnlockRect() to lock a portion of a
surface. This may be more efficient than a full lock if you are
using a hardware surface and plan to make a few changes to small
areas in the surface.

1.2.0:
Added SDL_VIDEOEXPOSE event to signal that the screen needs to
be redrawn. This is currently only delivered to OpenGL windows
Expand Down
190 changes: 91 additions & 99 deletions configure.in
Expand Up @@ -372,7 +372,7 @@ dnl See if the NAS audio interface is supported
CheckNAS()
{
AC_ARG_ENABLE(nas,
[ --enable-nas support the NAS audio API [default=yes]],
[ --enable-nas support the NAS audio API [default=yes]],
, enable_nas=yes)
if test x$enable_audio = xyes -a x$enable_nas = xyes; then
AC_MSG_CHECKING(for NAS audio support)
Expand All @@ -394,7 +394,7 @@ dnl rcg07142001 See if the user wants the disk writer audio driver...
CheckDiskAudio()
{
AC_ARG_ENABLE(diskaudio,
[ --enable-diskaudio support the disk writer audio driver [default=yes]],
[ --enable-diskaudio support the disk writer audio driver [default=yes]],
, enable_diskaudio=yes)
if test x$enable_audio = xyes -a x$enable_diskaudio = xyes; then
CFLAGS="$CFLAGS -DDISKAUD_SUPPORT"
Expand Down Expand Up @@ -445,44 +445,44 @@ CheckNASM()
dnl Find the nanox include and library directories
CheckNANOX()
{
AC_ARG_ENABLE(video-nanox,
[ --enable-video-nanox use nanox video driver [default=no]],
, enable_video_nanox=no)
AC_ARG_ENABLE(nanox-debug,
[ --enable-nanox-debug print debug messages [default=no]],
, enable_nanox_debug=no)
AC_ARG_ENABLE(nanox-share-memory,
[ --enable-nanox-share-memory use share memory [default=no]],
, enable_nanox_share_memory=no)

AC_ARG_WITH(nanox_pixel_type,
[ --with-nanox-pixel-type=[rgb/0888/888/565/555/332/pal]])

if test x$enable_video = xyes -a x$enable_video_nanox = xyes; then
if test x$enable_nanox_debug = xyes; then
CFLAGS="$CFLAGS -DENABLE_NANOX_DEBUG"
fi

if test x$enable_nanox_share_memory = xyes; then
CFLAGS="$CFLAGS -DNANOX_SHARE_MEMORY"
fi

case "$with_nanox_pixel_type" in
rgb) CFLAGS="$CFLAGS -DNANOX_PIXEL_RGB" ;;
0888) CFLAGS="$CFLAGS -DNANOX_PIXEL_0888" ;;
888) CFLAGS="$CFLAGS -DNANOX_PIXEL_888" ;;
565) CFLAGS="$CFLAGS -DNANOX_PIXEL_565" ;;
555) CFLAGS="$CFLAGS -DNANOX_PIXEL_555" ;;
332) CFLAGS="$CFLAGS -DNANOX_PIXEL_332" ;;
pal) CFLAGS="$CFLAGS -DNANOX_PIXEL_PAL" ;;
*) AC_MSG_ERROR([Invalid nanox_pixel_type]);;
esac

CFLAGS="$CFLAGS $X_CFLAGS -DENABLE_NANOX"
SYSTEM_LIBS="$SYSTEM_LIBS -lnano-X"
VIDEO_SUBDIRS="$VIDEO_SUBDIRS nanox"
VIDEO_DRIVERS="$VIDEO_DRIVERS nanox/libvideo_nanox.la"
fi
AC_ARG_ENABLE(video-nanox,
[ --enable-video-nanox use nanox video driver [default=no]],
, enable_video_nanox=no)
AC_ARG_ENABLE(nanox-debug,
[ --enable-nanox-debug print debug messages [default=no]],
, enable_nanox_debug=no)
AC_ARG_ENABLE(nanox-share-memory,
[ --enable-nanox-share-memory use share memory [default=no]],
, enable_nanox_share_memory=no)

AC_ARG_WITH(nanox_pixel_type,
[ --with-nanox-pixel-type=[rgb/0888/888/565/555/332/pal]])

if test x$enable_video = xyes -a x$enable_video_nanox = xyes; then
if test x$enable_nanox_debug = xyes; then
CFLAGS="$CFLAGS -DENABLE_NANOX_DEBUG"
fi

if test x$enable_nanox_share_memory = xyes; then
CFLAGS="$CFLAGS -DNANOX_SHARE_MEMORY"
fi

case "$with_nanox_pixel_type" in
rgb) CFLAGS="$CFLAGS -DNANOX_PIXEL_RGB" ;;
0888) CFLAGS="$CFLAGS -DNANOX_PIXEL_0888" ;;
888) CFLAGS="$CFLAGS -DNANOX_PIXEL_888" ;;
565) CFLAGS="$CFLAGS -DNANOX_PIXEL_565" ;;
555) CFLAGS="$CFLAGS -DNANOX_PIXEL_555" ;;
332) CFLAGS="$CFLAGS -DNANOX_PIXEL_332" ;;
pal) CFLAGS="$CFLAGS -DNANOX_PIXEL_PAL" ;;
*) AC_MSG_ERROR([Invalid nanox_pixel_type]);;
esac

CFLAGS="$CFLAGS $X_CFLAGS -DENABLE_NANOX"
SYSTEM_LIBS="$SYSTEM_LIBS -lnano-X"
VIDEO_SUBDIRS="$VIDEO_SUBDIRS nanox"
VIDEO_DRIVERS="$VIDEO_DRIVERS nanox/libvideo_nanox.la"
fi
}

dnl Find the X11 include and library directories
Expand All @@ -495,7 +495,7 @@ CheckX11()
AC_PATH_X
AC_PATH_XTRA
if test x$have_x = xyes; then
CFLAGS="$CFLAGS $X_CFLAGS -DENABLE_X11"
CFLAGS="$CFLAGS $X_CFLAGS -DENABLE_X11 -Isrc/video"
if test x$ac_cv_func_shmat != xyes; then
CFLAGS="$CFLAGS -DNO_SHARED_MEMORY"
fi
Expand All @@ -511,42 +511,23 @@ CheckX11()
video_x11_vm=no
AC_TRY_COMPILE([
#include <X11/Xlib.h>
#include <X11/extensions/xf86vmode.h>
#include <XFree86/extensions/xf86vmode.h>
],[
],[
video_x11_vm=yes
])
AC_MSG_RESULT($video_x11_vm)
if test x$video_x11_vm = xyes; then
CFLAGS="$CFLAGS -DXFREE86_VM"
# Check for nasty XFree86 4.0/Glide hack
AC_ARG_ENABLE(xfree86_glidehack,
[ --enable-xfree86-glidehack Alternate vidmode lib for old Glide [default=no]],
, enable_xfreeglidehack=no)
if test x$enable_xfree86_glidehack = xyes; then
ac_save_libs="$LIBS"
LIBS="$LIBS $X_LIBS -lX11 -lXext"
if test x$xfree86_glidehack = x; then
AC_CHECK_LIB(Xxf86vm, XF40VidModeQueryExtension, xfree86_glidehack=Xxf86vm)
fi
if test x$xfree86_glidehack = x; then
AC_CHECK_LIB(Xxf86vm40, XF40VidModeQueryExtension, xfree86_glidehack=Xxf86vm40)
fi
LIBS="$ac_save_libs"
fi
if test x$xfree86_glidehack != x; then
CFLAGS="$CFLAGS -DXFREE86_VM_DYNAMIC_HACK"
SYSTEM_LIBS="$SYSTEM_LIBS -l$xfree86_glidehack"
else
SYSTEM_LIBS="$SYSTEM_LIBS -lXxf86vm"
fi
VIDEO_SUBDIRS="$VIDEO_SUBDIRS XFree86/Xxf86vm"
VIDEO_DRIVERS="$VIDEO_DRIVERS XFree86/Xxf86vm/libXFree86_Xxf86vm.la"
AC_MSG_CHECKING(for XFree86 VidMode gamma support)
video_x11_vmgamma=no
AC_TRY_COMPILE([
#include <X11/Xlib.h>
#include <X11/extensions/xf86vmode.h>
#include <XFree86/extensions/xf86vmode.h>
],[
XF86VidModeGamma gamma;
SDL_NAME(XF86VidModeGamma) gamma;
],[
video_x11_vmgamma=yes
])
Expand All @@ -567,7 +548,7 @@ CheckX11()
video_x11_dga=no
AC_TRY_COMPILE([
#include <X11/Xlib.h>
#include <X11/extensions/xf86dga.h>
#include <XFree86/extensions/xf86dga.h>
],[
],[
video_x11_dga=yes
Expand All @@ -578,7 +559,8 @@ CheckX11()
if test x$enable_video_x11_dgamouse = xyes; then
CFLAGS="$CFLAGS -DDEFAULT_DGAMOUSE"
fi
SYSTEM_LIBS="$SYSTEM_LIBS -lXxf86dga"
VIDEO_SUBDIRS="$VIDEO_SUBDIRS XFree86/Xxf86dga"
VIDEO_DRIVERS="$VIDEO_DRIVERS XFree86/Xxf86dga/libXFree86_Xxf86dga.la"
fi
fi
AC_ARG_ENABLE(video-x11-xv,
Expand All @@ -592,16 +574,17 @@ CheckX11()
#include <sys/ipc.h>
#include <sys/shm.h>
#include <X11/extensions/XShm.h>
#include <X11/extensions/Xvlib.h>
#include <XFree86/extensions/Xvlib.h>
],[
XvImage *image;
SDL_NAME(XvImage) *image;
],[
video_x11_xv=yes
])
AC_MSG_RESULT($video_x11_xv)
if test x$video_x11_xv = xyes; then
CFLAGS="$CFLAGS -DXFREE86_XV"
SYSTEM_LIBS="$SYSTEM_LIBS -lXv"
VIDEO_SUBDIRS="$VIDEO_SUBDIRS XFree86/Xv"
VIDEO_DRIVERS="$VIDEO_DRIVERS XFree86/Xv/libXFree86_Xv.la"
fi
fi
AC_ARG_ENABLE(video-x11-xinerama,
Expand All @@ -612,16 +595,17 @@ CheckX11()
video_x11_xinerama=no
AC_TRY_COMPILE([
#include <X11/Xlib.h>
#include <X11/extensions/Xinerama.h>
#include <XFree86/extensions/Xinerama.h>
],[
XineramaScreenInfo *xinerama;
SDL_NAME(XineramaScreenInfo) *xinerama;
],[
video_x11_xinerama=yes
])
AC_MSG_RESULT($video_x11_xinerama)
if test x$video_x11_xinerama = xyes; then
CFLAGS="$CFLAGS -DHAVE_XINERAMA"
SYSTEM_LIBS="$SYSTEM_LIBS -lXinerama"
VIDEO_SUBDIRS="$VIDEO_SUBDIRS XFree86/Xinerama"
VIDEO_DRIVERS="$VIDEO_DRIVERS XFree86/Xinerama/libXFree86_Xinerama.la"
fi
fi
AC_ARG_ENABLE(video-x11-xme,
Expand All @@ -648,6 +632,33 @@ CheckX11()
fi
}

dnl Find the X11 DGA 2.0 include and library directories
CheckDGA()
{
AC_ARG_ENABLE(video-dga,
[ --enable-video-dga use DGA 2.0 video driver [default=yes]],
, enable_video_dga=yes)
if test x$video_x11_dga = xyes -a x$enable_video_dga = xyes; then
save_CFLAGS="$CFLAGS"; CFLAGS="$CFLAGS -Isrc/video"
AC_MSG_CHECKING(for XFree86 DGA 2.0 support)
video_x11_dga2=no
AC_TRY_COMPILE([
#include <X11/Xlib.h>
#include <XFree86/extensions/xf86dga.h>
],[
SDL_NAME(XDGAEvent) xevent;
],[
video_x11_dga2=yes
])
AC_MSG_RESULT($video_x11_dga2)
if test x$video_x11_dga2 = xyes; then
CFLAGS="$CFLAGS -DENABLE_DGA"
VIDEO_SUBDIRS="$VIDEO_SUBDIRS dga"
VIDEO_DRIVERS="$VIDEO_DRIVERS dga/libvideo_dga.la"
fi
fi
}

CheckPHOTON()
{
AC_ARG_ENABLE(video-photon,
Expand Down Expand Up @@ -677,32 +688,6 @@ CheckPHOTON()
fi
}

dnl Find the X11 DGA 2.0 include and library directories
CheckDGA()
{
AC_ARG_ENABLE(video-dga,
[ --enable-video-dga use DGA 2.0 video driver [default=yes]],
, enable_video_dga=yes)
if test x$video_x11_dga = xyes -a x$enable_video_dga = xyes; then
AC_MSG_CHECKING(for XFree86 DGA 2.0 support)
video_x11_dga2=no
AC_TRY_COMPILE([
#include <X11/Xlib.h>
#include <X11/extensions/xf86dga.h>
],[
XDGAEvent xevent;
],[
video_x11_dga2=yes
])
AC_MSG_RESULT($video_x11_dga2)
if test x$video_x11_dga2 = xyes; then
CFLAGS="$CFLAGS -DENABLE_DGA"
VIDEO_SUBDIRS="$VIDEO_SUBDIRS dga"
VIDEO_DRIVERS="$VIDEO_DRIVERS dga/libvideo_dga.la"
fi
fi
}

dnl Find the framebuffer console includes
CheckFBCON()
{
Expand Down Expand Up @@ -2335,6 +2320,7 @@ CFLAGS="$CFLAGS -I\$(top_srcdir)/src -I\$(top_srcdir)/src/$ARCH"
CFLAGS="$CFLAGS -I\$(top_srcdir)/src/main"
CFLAGS="$CFLAGS -I\$(top_srcdir)/src/audio"
CFLAGS="$CFLAGS -I\$(top_srcdir)/src/video"
CFLAGS="$CFLAGS -I\$(top_srcdir)/src/video/XFree86/extensions"
CFLAGS="$CFLAGS -I\$(top_srcdir)/src/events"
CFLAGS="$CFLAGS -I\$(top_srcdir)/src/joystick"
CFLAGS="$CFLAGS -I\$(top_srcdir)/src/cdrom"
Expand Down Expand Up @@ -2391,6 +2377,12 @@ src/audio/windib/Makefile
src/audio/windx5/Makefile
src/audio/disk/Makefile
src/video/Makefile
src/video/XFree86/Makefile
src/video/XFree86/extensions/Makefile
src/video/XFree86/Xinerama/Makefile
src/video/XFree86/Xv/Makefile
src/video/XFree86/Xxf86dga/Makefile
src/video/XFree86/Xxf86vm/Makefile
src/video/cybergfx/Makefile
src/video/x11/Makefile
src/video/dga/Makefile
Expand Down
2 changes: 2 additions & 0 deletions docs.html
Expand Up @@ -16,6 +16,8 @@ <H2>
Major changes since SDL 1.0.0:
</H2>
<UL>
<LI> 1.2.4: Added SDL_LockRect() and SDL_UnlockRect()
<LI> 1.2.4: Incorporated XFree86 extension libraries into the source
<LI> 1.2.4: Added initial support for Atari (thanks Patrice!)
<LI> 1.2.4: Added support for joysticks on *BSD (thanks Wilbern!)
<LI> 1.2.4: Added a YUV overlay test program (thanks Jon!)
Expand Down
20 changes: 20 additions & 0 deletions include/SDL_video.h
Expand Up @@ -531,6 +531,26 @@ extern DECLSPEC void SDL_FreeSurface(SDL_Surface *surface);
extern DECLSPEC int SDL_LockSurface(SDL_Surface *surface);
extern DECLSPEC void SDL_UnlockSurface(SDL_Surface *surface);

/*
* SDL_LockRect() locks a portion of the surface designated by the 'rect'
* parameter, and saves the resulting pixels and pitch in the arguments.
* The rect will be clipped if it extends beyond the bounds of the surface
*
* This may be more efficient than a full lock if you are using a hardware
* surface and plan to make a few changes to small areas in the surface.
*
* While a rectangle is locked, no other lock or blit call may be called
* on the surface. No operating system or library calls should be made
* between lock/unlock pairs, as critical system locks may be held during
* this time.
*
* After the surface is unlocked, the pixels pointer is no longer valid.
*
* SDL_LockRect() returns 0, or -1 if the surface couldn't be locked.
*/
extern DECLSPEC int SDL_LockRect(SDL_Surface *surface, SDL_Rect *rect, void **pixels, int *pitch);
extern DECLSPEC void SDL_UnlockRect(SDL_Surface *surface);

/*
* Load a surface from a seekable SDL data source (memory or file.)
* If 'freesrc' is non-zero, the source will be closed after being read.
Expand Down
4 changes: 4 additions & 0 deletions src/main/beos/exports/SDL.exp
Expand Up @@ -74,6 +74,7 @@ _SDL_GetKeyState
_SDL_GetModState
_SDL_SetModState
_SDL_GetKeyName
_SDL_SetModuleHandle
_SDL_RegisterApp
_SDL_InitQuickDraw
_SDL_GetMouseState
Expand Down Expand Up @@ -143,6 +144,8 @@ _SDL_CreateRGBSurfaceFrom
_SDL_FreeSurface
_SDL_LockSurface
_SDL_UnlockSurface
_SDL_LockRect
_SDL_UnlockRect
_SDL_LoadBMP_RW
_SDL_SaveBMP_RW
_SDL_SetColorKey
Expand Down Expand Up @@ -174,3 +177,4 @@ _SDL_WM_SetIcon
_SDL_WM_IconifyWindow
_SDL_WM_ToggleFullScreen
_SDL_WM_GrabInput
_SDL_SoftStretch

0 comments on commit bbf4b4c

Please sign in to comment.