Overlay functions are being replaced by YUV textures. SDL-1.3
authorSam Lantinga <slouken@libsdl.org>
Sun, 11 Jun 2006 07:30:16 +0000
branchSDL-1.3
changeset 1675d33dcfc3fde7
parent 1674 7688a73b25b1
child 1676 e136f3ffdc1b
Overlay functions are being replaced by YUV textures.
If the driver doesn't support YUV textures, they can be emulated by backing
the texture with an RGB texture and using the software conversion routines.

Note that it doesn't make sense to lock a portion of a YV12 texture, since
you'd need to return three pixel pointers and pitch values instead of the
one that's available through the API. I'm guessing that's one of the reasons
DirectX 9 doesn't support this format at all.
include/SDL_compat.h
include/SDL_pixels.h
include/SDL_video.h
src/SDL_compat.c
src/video/SDL_sysvideo.h
src/video/SDL_yuv.c
src/video/SDL_yuvfuncs.h
     1.1 --- a/include/SDL_compat.h	Sun Jun 11 05:27:10 2006 +0000
     1.2 +++ b/include/SDL_compat.h	Sun Jun 11 07:30:16 2006 +0000
     1.3 @@ -79,6 +79,37 @@
     1.4      SDL_PixelFormat *vfmt;
     1.5  } SDL_VideoInfo;
     1.6  
     1.7 +/* The most common video overlay formats.
     1.8 +   For an explanation of these pixel formats, see:
     1.9 +   http://www.webartz.com/fourcc/indexyuv.htm
    1.10 +
    1.11 +   For information on the relationship between color spaces, see:
    1.12 +   http://www.neuro.sfc.keio.ac.jp/~aly/polygon/info/color-space-faq.html
    1.13 + */
    1.14 +#define SDL_YV12_OVERLAY  0x32315659    /* Planar mode: Y + V + U  (3 planes) */
    1.15 +#define SDL_IYUV_OVERLAY  0x56555949    /* Planar mode: Y + U + V  (3 planes) */
    1.16 +#define SDL_YUY2_OVERLAY  0x32595559    /* Packed mode: Y0+U0+Y1+V0 (1 plane) */
    1.17 +#define SDL_UYVY_OVERLAY  0x59565955    /* Packed mode: U0+Y0+V0+Y1 (1 plane) */
    1.18 +#define SDL_YVYU_OVERLAY  0x55595659    /* Packed mode: Y0+V0+Y1+U0 (1 plane) */
    1.19 +
    1.20 +/* The YUV hardware video overlay */
    1.21 +typedef struct SDL_Overlay
    1.22 +{
    1.23 +    Uint32 format;              /* Read-only */
    1.24 +    int w, h;                   /* Read-only */
    1.25 +    int planes;                 /* Read-only */
    1.26 +    Uint16 *pitches;            /* Read-only */
    1.27 +    Uint8 **pixels;             /* Read-write */
    1.28 +
    1.29 +    /* Hardware-specific surface info */
    1.30 +    struct private_yuvhwfuncs *hwfuncs;
    1.31 +    struct private_yuvhwdata *hwdata;
    1.32 +
    1.33 +    /* Special flags */
    1.34 +    Uint32 hw_overlay:1;        /* Flag: This overlay hardware accelerated? */
    1.35 +    Uint32 UnusedBits:31;
    1.36 +} SDL_Overlay;
    1.37 +
    1.38  typedef enum
    1.39  {
    1.40      SDL_GRAB_QUERY = -1,
    1.41 @@ -114,7 +145,6 @@
    1.42  extern DECLSPEC int SDLCALL SDL_WM_IconifyWindow(void);
    1.43  extern DECLSPEC int SDLCALL SDL_WM_ToggleFullScreen(SDL_Surface * surface);
    1.44  extern DECLSPEC SDL_GrabMode SDLCALL SDL_WM_GrabInput(SDL_GrabMode mode);
    1.45 -extern DECLSPEC Uint8 SDLCALL SDL_GetAppState(void);
    1.46  extern DECLSPEC int SDLCALL SDL_SetPalette(SDL_Surface * surface, int flags,
    1.47                                             SDL_Color * colors,
    1.48                                             int firstcolor, int ncolors);
    1.49 @@ -122,6 +152,18 @@
    1.50                                                  SDL_Color * colors,
    1.51                                                  int firstcolor, int ncolors);
    1.52  extern DECLSPEC int SDLCALL SDL_GetWMInfo(SDL_SysWMinfo * info);
    1.53 +extern DECLSPEC Uint8 SDLCALL SDL_GetAppState(void);
    1.54 +extern DECLSPEC void SDLCALL SDL_WarpMouse(Uint16 x, Uint16 y);
    1.55 +extern DECLSPEC SDL_Overlay *SDLCALL SDL_CreateYUVOverlay(int width,
    1.56 +                                                          int height,
    1.57 +                                                          Uint32 format,
    1.58 +                                                          SDL_Surface *
    1.59 +                                                          display);
    1.60 +extern DECLSPEC int SDLCALL SDL_LockYUVOverlay(SDL_Overlay * overlay);
    1.61 +extern DECLSPEC void SDLCALL SDL_UnlockYUVOverlay(SDL_Overlay * overlay);
    1.62 +extern DECLSPEC int SDLCALL SDL_DisplayYUVOverlay(SDL_Overlay * overlay,
    1.63 +                                                  SDL_Rect * dstrect);
    1.64 +extern DECLSPEC void SDLCALL SDL_FreeYUVOverlay(SDL_Overlay * overlay);
    1.65  
    1.66  /* Ends C function definitions when using C++ */
    1.67  #ifdef __cplusplus
    1.68 @@ -134,4 +176,3 @@
    1.69  #endif /* _SDL_compat_h */
    1.70  
    1.71  /* vi: set ts=4 sw=4 expandtab: */
    1.72 -extern DECLSPEC void SDLCALL SDL_WarpMouse(Uint16 x, Uint16 y);
     2.1 --- a/include/SDL_pixels.h	Sun Jun 11 05:27:10 2006 +0000
     2.2 +++ b/include/SDL_pixels.h	Sun Jun 11 07:30:16 2006 +0000
     2.3 @@ -95,6 +95,9 @@
     2.4      SDL_PackedLayout_1010102,
     2.5  };
     2.6  
     2.7 +#define SDL_DEFINE_PIXELFOURCC(A, B, C, D) \
     2.8 +    ((A) | ((B) << 8) | ((C) << 16) | ((D) << 24))
     2.9 +
    2.10  #define SDL_DEFINE_PIXELFORMAT(type, order, layout, bits, bytes) \
    2.11      ((1 << 31) | ((type) << 24) | ((order) << 20) | ((layout) << 16) | \
    2.12       ((bits) << 8) | ((bytes) << 0))
    2.13 @@ -167,6 +170,12 @@
    2.14      SDL_PixelFormat_ARGB2101010 =
    2.15          SDL_DEFINE_PIXELFORMAT(SDL_PixelType_Packed32, SDL_PackedOrder_ARGB,
    2.16                                 SDL_PackedLayout_2101010, 32, 4),
    2.17 +
    2.18 +    SDL_PixelFormat_YV12 = SDL_DEFINE_PIXELFOURCC('Y', 'V', '1', '2'),
    2.19 +    SDL_PixelFormat_IYUV = SDL_DEFINE_PIXELFOURCC('I', 'Y', 'U', 'V'),
    2.20 +    SDL_PixelFormat_YUY2 = SDL_DEFINE_PIXELFOURCC('Y', 'U', 'Y', '2'),
    2.21 +    SDL_PixelFormat_UYVY = SDL_DEFINE_PIXELFOURCC('U', 'Y', 'V', 'Y'),
    2.22 +    SDL_PixelFormat_YVYU = SDL_DEFINE_PIXELFOURCC('Y', 'V', 'Y', 'U'),
    2.23  };
    2.24  
    2.25  typedef struct SDL_Color
     3.1 --- a/include/SDL_video.h	Sun Jun 11 05:27:10 2006 +0000
     3.2 +++ b/include/SDL_video.h	Sun Jun 11 07:30:16 2006 +0000
     3.3 @@ -274,37 +274,6 @@
     3.4                           struct SDL_Surface * dst, SDL_Rect * dstrect);
     3.5  
     3.6  
     3.7 -/* The most common video overlay formats.
     3.8 -   For an explanation of these pixel formats, see:
     3.9 -   http://www.webartz.com/fourcc/indexyuv.htm
    3.10 -
    3.11 -   For information on the relationship between color spaces, see:
    3.12 -   http://www.neuro.sfc.keio.ac.jp/~aly/polygon/info/color-space-faq.html
    3.13 - */
    3.14 -#define SDL_YV12_OVERLAY  0x32315659    /* Planar mode: Y + V + U  (3 planes) */
    3.15 -#define SDL_IYUV_OVERLAY  0x56555949    /* Planar mode: Y + U + V  (3 planes) */
    3.16 -#define SDL_YUY2_OVERLAY  0x32595559    /* Packed mode: Y0+U0+Y1+V0 (1 plane) */
    3.17 -#define SDL_UYVY_OVERLAY  0x59565955    /* Packed mode: U0+Y0+V0+Y1 (1 plane) */
    3.18 -#define SDL_YVYU_OVERLAY  0x55595659    /* Packed mode: Y0+V0+Y1+U0 (1 plane) */
    3.19 -
    3.20 -/* The YUV hardware video overlay */
    3.21 -typedef struct SDL_Overlay
    3.22 -{
    3.23 -    Uint32 format;              /* Read-only */
    3.24 -    int w, h;                   /* Read-only */
    3.25 -    int planes;                 /* Read-only */
    3.26 -    Uint16 *pitches;            /* Read-only */
    3.27 -    Uint8 **pixels;             /* Read-write */
    3.28 -
    3.29 -    /* Hardware-specific surface info */
    3.30 -    struct private_yuvhwfuncs *hwfuncs;
    3.31 -    struct private_yuvhwdata *hwdata;
    3.32 -
    3.33 -    /* Special flags */
    3.34 -    Uint32 hw_overlay:1;        /* Flag: This overlay hardware accelerated? */
    3.35 -    Uint32 UnusedBits:31;
    3.36 -} SDL_Overlay;
    3.37 -
    3.38  /**
    3.39   * \enum SDL_GLattr
    3.40   *
    3.41 @@ -1341,39 +1310,6 @@
    3.42                                              SDL_Surface * dst,
    3.43                                              SDL_Rect * dstrect);
    3.44  
    3.45 -
    3.46 -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
    3.47 -/* YUV video surface overlay functions                                       */
    3.48 -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
    3.49 -
    3.50 -/* This function creates a video output overlay
    3.51 -   Calling the returned surface an overlay is something of a misnomer because
    3.52 -   the contents of the display surface underneath the area where the overlay
    3.53 -   is shown is undefined - it may be overwritten with the converted YUV data.
    3.54 -*/
    3.55 -extern DECLSPEC SDL_Overlay *SDLCALL SDL_CreateYUVOverlay(int width,
    3.56 -                                                          int height,
    3.57 -                                                          Uint32 format,
    3.58 -                                                          SDL_Surface *
    3.59 -                                                          display);
    3.60 -
    3.61 -/* Lock an overlay for direct access, and unlock it when you are done */
    3.62 -extern DECLSPEC int SDLCALL SDL_LockYUVOverlay(SDL_Overlay * overlay);
    3.63 -extern DECLSPEC void SDLCALL SDL_UnlockYUVOverlay(SDL_Overlay * overlay);
    3.64 -
    3.65 -/* Blit a video overlay to the display surface.
    3.66 -   The contents of the video surface underneath the blit destination are
    3.67 -   not defined.  
    3.68 -   The width and height of the destination rectangle may be different from
    3.69 -   that of the overlay, but currently only 2x scaling is supported.
    3.70 -*/
    3.71 -extern DECLSPEC int SDLCALL SDL_DisplayYUVOverlay(SDL_Overlay * overlay,
    3.72 -                                                  SDL_Rect * dstrect);
    3.73 -
    3.74 -/* Free a video overlay */
    3.75 -extern DECLSPEC void SDLCALL SDL_FreeYUVOverlay(SDL_Overlay * overlay);
    3.76 -
    3.77 -
    3.78  /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
    3.79  /* OpenGL support functions.                                                 */
    3.80  /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
     4.1 --- a/src/SDL_compat.c	Sun Jun 11 05:27:10 2006 +0000
     4.2 +++ b/src/SDL_compat.c	Sun Jun 11 07:30:16 2006 +0000
     4.3 @@ -1235,4 +1235,119 @@
     4.4      }
     4.5  }
     4.6  
     4.7 +SDL_Overlay *
     4.8 +SDL_CreateYUVOverlay(int w, int h, Uint32 format, SDL_Surface * display)
     4.9 +{
    4.10 +    SDL_VideoDevice *_this = SDL_GetVideoDevice();
    4.11 +    SDL_Window *window;
    4.12 +    const char *yuv_hwaccel;
    4.13 +    SDL_Overlay *overlay;
    4.14 +
    4.15 +    window = SDL_GetWindowFromSurface(display);
    4.16 +    if (window && (window->flags & SDL_WINDOW_OPENGL)) {
    4.17 +        SDL_SetError("YUV overlays are not supported in OpenGL mode");
    4.18 +        return NULL;
    4.19 +    }
    4.20 +
    4.21 +    /* Display directly on video surface, if possible */
    4.22 +    if (SDL_getenv("SDL_VIDEO_YUV_DIRECT")) {
    4.23 +        if (window &&
    4.24 +            ((window->surface->format->BytesPerPixel == 2) ||
    4.25 +             (window->surface->format->BytesPerPixel == 4))) {
    4.26 +            display = window->surface;
    4.27 +        }
    4.28 +    }
    4.29 +    overlay = NULL;
    4.30 +    yuv_hwaccel = SDL_getenv("SDL_VIDEO_YUV_HWACCEL");
    4.31 +    if (((display->flags & SDL_SCREEN_SURFACE) && _this->CreateYUVOverlay) &&
    4.32 +        (!yuv_hwaccel || (SDL_atoi(yuv_hwaccel) > 0))) {
    4.33 +        overlay = _this->CreateYUVOverlay(_this, w, h, format, display);
    4.34 +    }
    4.35 +    /* If hardware YUV overlay failed ... */
    4.36 +    if (overlay == NULL) {
    4.37 +        overlay = SDL_CreateYUV_SW(_this, w, h, format, display);
    4.38 +    }
    4.39 +    return overlay;
    4.40 +}
    4.41 +
    4.42 +int
    4.43 +SDL_LockYUVOverlay(SDL_Overlay * overlay)
    4.44 +{
    4.45 +    SDL_VideoDevice *_this = SDL_GetVideoDevice();
    4.46 +    return overlay->hwfuncs->Lock(_this, overlay);
    4.47 +}
    4.48 +
    4.49 +void
    4.50 +SDL_UnlockYUVOverlay(SDL_Overlay * overlay)
    4.51 +{
    4.52 +    SDL_VideoDevice *_this = SDL_GetVideoDevice();
    4.53 +    overlay->hwfuncs->Unlock(_this, overlay);
    4.54 +}
    4.55 +
    4.56 +int
    4.57 +SDL_DisplayYUVOverlay(SDL_Overlay * overlay, SDL_Rect * dstrect)
    4.58 +{
    4.59 +    SDL_VideoDevice *_this = SDL_GetVideoDevice();
    4.60 +    SDL_Rect src, dst;
    4.61 +    int srcx, srcy, srcw, srch;
    4.62 +    int dstx, dsty, dstw, dsth;
    4.63 +
    4.64 +    /* Clip the rectangle to the screen area */
    4.65 +    srcx = 0;
    4.66 +    srcy = 0;
    4.67 +    srcw = overlay->w;
    4.68 +    srch = overlay->h;
    4.69 +    dstx = dstrect->x;
    4.70 +    dsty = dstrect->y;
    4.71 +    dstw = dstrect->w;
    4.72 +    dsth = dstrect->h;
    4.73 +    if (dstx < 0) {
    4.74 +        srcw += (dstx * overlay->w) / dstrect->w;
    4.75 +        dstw += dstx;
    4.76 +        srcx -= (dstx * overlay->w) / dstrect->w;
    4.77 +        dstx = 0;
    4.78 +    }
    4.79 +    if ((dstx + dstw) > SDL_VideoSurface->w) {
    4.80 +        int extra = (dstx + dstw - SDL_VideoSurface->w);
    4.81 +        srcw -= (extra * overlay->w) / dstrect->w;
    4.82 +        dstw -= extra;
    4.83 +    }
    4.84 +    if (dsty < 0) {
    4.85 +        srch += (dsty * overlay->h) / dstrect->h;
    4.86 +        dsth += dsty;
    4.87 +        srcy -= (dsty * overlay->h) / dstrect->h;
    4.88 +        dsty = 0;
    4.89 +    }
    4.90 +    if ((dsty + dsth) > SDL_VideoSurface->h) {
    4.91 +        int extra = (dsty + dsth - SDL_VideoSurface->h);
    4.92 +        srch -= (extra * overlay->h) / dstrect->h;
    4.93 +        dsth -= extra;
    4.94 +    }
    4.95 +    if (srcw <= 0 || srch <= 0 || srch <= 0 || dsth <= 0) {
    4.96 +        return 0;
    4.97 +    }
    4.98 +    /* Ugh, I can't wait for SDL_Rect to be int values */
    4.99 +    src.x = srcx;
   4.100 +    src.y = srcy;
   4.101 +    src.w = srcw;
   4.102 +    src.h = srch;
   4.103 +    dst.x = dstx;
   4.104 +    dst.y = dsty;
   4.105 +    dst.w = dstw;
   4.106 +    dst.h = dsth;
   4.107 +    return overlay->hwfuncs->Display(_this, overlay, &src, &dst);
   4.108 +}
   4.109 +
   4.110 +void
   4.111 +SDL_FreeYUVOverlay(SDL_Overlay * overlay)
   4.112 +{
   4.113 +    SDL_VideoDevice *_this = SDL_GetVideoDevice();
   4.114 +    if (overlay) {
   4.115 +        if (overlay->hwfuncs) {
   4.116 +            overlay->hwfuncs->FreeHW(_this, overlay);
   4.117 +        }
   4.118 +        SDL_free(overlay);
   4.119 +    }
   4.120 +}
   4.121 +
   4.122  /* vi: set ts=4 sw=4 expandtab: */
     5.1 --- a/src/video/SDL_sysvideo.h	Sun Jun 11 05:27:10 2006 +0000
     5.2 +++ b/src/video/SDL_sysvideo.h	Sun Jun 11 07:30:16 2006 +0000
     5.3 @@ -200,13 +200,6 @@
     5.4        SDL_bool(*GetWindowWMInfo) (_THIS, SDL_Window * window,
     5.5                                    SDL_SysWMinfo * info);
     5.6  
     5.7 -    /* Create a YUV video surface (possibly overlay) of the given
     5.8 -       format.  The hardware should be able to perform at least 2x
     5.9 -       scaling on display.
    5.10 -     */
    5.11 -    SDL_Overlay *(*CreateYUVOverlay) (_THIS, int width, int height,
    5.12 -                                      Uint32 format, SDL_Surface * display);
    5.13 -
    5.14      /* Reverse the effects VideoInit() -- called if VideoInit() fails
    5.15         or if the application is shutting down the video subsystem.
    5.16       */
     6.1 --- a/src/video/SDL_yuv.c	Sun Jun 11 05:27:10 2006 +0000
     6.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.3 @@ -1,147 +0,0 @@
     6.4 -/*
     6.5 -    SDL - Simple DirectMedia Layer
     6.6 -    Copyright (C) 1997-2006 Sam Lantinga
     6.7 -
     6.8 -    This library is free software; you can redistribute it and/or
     6.9 -    modify it under the terms of the GNU Lesser General Public
    6.10 -    License as published by the Free Software Foundation; either
    6.11 -    version 2.1 of the License, or (at your option) any later version.
    6.12 -
    6.13 -    This library is distributed in the hope that it will be useful,
    6.14 -    but WITHOUT ANY WARRANTY; without even the implied warranty of
    6.15 -    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    6.16 -    Lesser General Public License for more details.
    6.17 -
    6.18 -    You should have received a copy of the GNU Lesser General Public
    6.19 -    License along with this library; if not, write to the Free Software
    6.20 -    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
    6.21 -
    6.22 -    Sam Lantinga
    6.23 -    slouken@libsdl.org
    6.24 -*/
    6.25 -#include "SDL_config.h"
    6.26 -
    6.27 -/* This is the implementation of the YUV video surface support */
    6.28 -
    6.29 -#include "SDL_video.h"
    6.30 -#include "SDL_sysvideo.h"
    6.31 -#include "SDL_yuvfuncs.h"
    6.32 -#include "SDL_yuv_sw_c.h"
    6.33 -
    6.34 -
    6.35 -SDL_Overlay *
    6.36 -SDL_CreateYUVOverlay(int w, int h, Uint32 format, SDL_Surface * display)
    6.37 -{
    6.38 -    SDL_VideoDevice *_this = SDL_GetVideoDevice();
    6.39 -    SDL_Window *window;
    6.40 -    const char *yuv_hwaccel;
    6.41 -    SDL_Overlay *overlay;
    6.42 -
    6.43 -    window = SDL_GetWindowFromSurface(display);
    6.44 -    if (window && (window->flags & SDL_WINDOW_OPENGL)) {
    6.45 -        SDL_SetError("YUV overlays are not supported in OpenGL mode");
    6.46 -        return NULL;
    6.47 -    }
    6.48 -
    6.49 -    /* Display directly on video surface, if possible */
    6.50 -    if (SDL_getenv("SDL_VIDEO_YUV_DIRECT")) {
    6.51 -        if (window &&
    6.52 -            ((window->surface->format->BytesPerPixel == 2) ||
    6.53 -             (window->surface->format->BytesPerPixel == 4))) {
    6.54 -            display = window->surface;
    6.55 -        }
    6.56 -    }
    6.57 -    overlay = NULL;
    6.58 -    yuv_hwaccel = SDL_getenv("SDL_VIDEO_YUV_HWACCEL");
    6.59 -    if (((display->flags & SDL_SCREEN_SURFACE) && _this->CreateYUVOverlay) &&
    6.60 -        (!yuv_hwaccel || (SDL_atoi(yuv_hwaccel) > 0))) {
    6.61 -        overlay = _this->CreateYUVOverlay(_this, w, h, format, display);
    6.62 -    }
    6.63 -    /* If hardware YUV overlay failed ... */
    6.64 -    if (overlay == NULL) {
    6.65 -        overlay = SDL_CreateYUV_SW(_this, w, h, format, display);
    6.66 -    }
    6.67 -    return overlay;
    6.68 -}
    6.69 -
    6.70 -int
    6.71 -SDL_LockYUVOverlay(SDL_Overlay * overlay)
    6.72 -{
    6.73 -    SDL_VideoDevice *_this = SDL_GetVideoDevice();
    6.74 -    return overlay->hwfuncs->Lock(_this, overlay);
    6.75 -}
    6.76 -
    6.77 -void
    6.78 -SDL_UnlockYUVOverlay(SDL_Overlay * overlay)
    6.79 -{
    6.80 -    SDL_VideoDevice *_this = SDL_GetVideoDevice();
    6.81 -    overlay->hwfuncs->Unlock(_this, overlay);
    6.82 -}
    6.83 -
    6.84 -int
    6.85 -SDL_DisplayYUVOverlay(SDL_Overlay * overlay, SDL_Rect * dstrect)
    6.86 -{
    6.87 -    SDL_VideoDevice *_this = SDL_GetVideoDevice();
    6.88 -    SDL_Rect src, dst;
    6.89 -    int srcx, srcy, srcw, srch;
    6.90 -    int dstx, dsty, dstw, dsth;
    6.91 -
    6.92 -    /* Clip the rectangle to the screen area */
    6.93 -    srcx = 0;
    6.94 -    srcy = 0;
    6.95 -    srcw = overlay->w;
    6.96 -    srch = overlay->h;
    6.97 -    dstx = dstrect->x;
    6.98 -    dsty = dstrect->y;
    6.99 -    dstw = dstrect->w;
   6.100 -    dsth = dstrect->h;
   6.101 -    if (dstx < 0) {
   6.102 -        srcw += (dstx * overlay->w) / dstrect->w;
   6.103 -        dstw += dstx;
   6.104 -        srcx -= (dstx * overlay->w) / dstrect->w;
   6.105 -        dstx = 0;
   6.106 -    }
   6.107 -    if ((dstx + dstw) > SDL_VideoSurface->w) {
   6.108 -        int extra = (dstx + dstw - SDL_VideoSurface->w);
   6.109 -        srcw -= (extra * overlay->w) / dstrect->w;
   6.110 -        dstw -= extra;
   6.111 -    }
   6.112 -    if (dsty < 0) {
   6.113 -        srch += (dsty * overlay->h) / dstrect->h;
   6.114 -        dsth += dsty;
   6.115 -        srcy -= (dsty * overlay->h) / dstrect->h;
   6.116 -        dsty = 0;
   6.117 -    }
   6.118 -    if ((dsty + dsth) > SDL_VideoSurface->h) {
   6.119 -        int extra = (dsty + dsth - SDL_VideoSurface->h);
   6.120 -        srch -= (extra * overlay->h) / dstrect->h;
   6.121 -        dsth -= extra;
   6.122 -    }
   6.123 -    if (srcw <= 0 || srch <= 0 || srch <= 0 || dsth <= 0) {
   6.124 -        return 0;
   6.125 -    }
   6.126 -    /* Ugh, I can't wait for SDL_Rect to be int values */
   6.127 -    src.x = srcx;
   6.128 -    src.y = srcy;
   6.129 -    src.w = srcw;
   6.130 -    src.h = srch;
   6.131 -    dst.x = dstx;
   6.132 -    dst.y = dsty;
   6.133 -    dst.w = dstw;
   6.134 -    dst.h = dsth;
   6.135 -    return overlay->hwfuncs->Display(_this, overlay, &src, &dst);
   6.136 -}
   6.137 -
   6.138 -void
   6.139 -SDL_FreeYUVOverlay(SDL_Overlay * overlay)
   6.140 -{
   6.141 -    SDL_VideoDevice *_this = SDL_GetVideoDevice();
   6.142 -    if (overlay) {
   6.143 -        if (overlay->hwfuncs) {
   6.144 -            overlay->hwfuncs->FreeHW(_this, overlay);
   6.145 -        }
   6.146 -        SDL_free(overlay);
   6.147 -    }
   6.148 -}
   6.149 -
   6.150 -/* vi: set ts=4 sw=4 expandtab: */
     7.1 --- a/src/video/SDL_yuvfuncs.h	Sun Jun 11 05:27:10 2006 +0000
     7.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.3 @@ -1,40 +0,0 @@
     7.4 -/*
     7.5 -    SDL - Simple DirectMedia Layer
     7.6 -    Copyright (C) 1997-2006 Sam Lantinga
     7.7 -
     7.8 -    This library is free software; you can redistribute it and/or
     7.9 -    modify it under the terms of the GNU Lesser General Public
    7.10 -    License as published by the Free Software Foundation; either
    7.11 -    version 2.1 of the License, or (at your option) any later version.
    7.12 -
    7.13 -    This library is distributed in the hope that it will be useful,
    7.14 -    but WITHOUT ANY WARRANTY; without even the implied warranty of
    7.15 -    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    7.16 -    Lesser General Public License for more details.
    7.17 -
    7.18 -    You should have received a copy of the GNU Lesser General Public
    7.19 -    License along with this library; if not, write to the Free Software
    7.20 -    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
    7.21 -
    7.22 -    Sam Lantinga
    7.23 -    slouken@libsdl.org
    7.24 -*/
    7.25 -#include "SDL_config.h"
    7.26 -
    7.27 -/* This is the definition of the YUV video surface function structure */
    7.28 -
    7.29 -#include "SDL_video.h"
    7.30 -#include "SDL_sysvideo.h"
    7.31 -
    7.32 -#ifndef _THIS
    7.33 -#define _THIS	SDL_VideoDevice *_this
    7.34 -#endif
    7.35 -struct private_yuvhwfuncs
    7.36 -{
    7.37 -    int (*Lock) (_THIS, SDL_Overlay * overlay);
    7.38 -    void (*Unlock) (_THIS, SDL_Overlay * overlay);
    7.39 -    int (*Display) (_THIS, SDL_Overlay * overlay, SDL_Rect * src,
    7.40 -                    SDL_Rect * dst);
    7.41 -    void (*FreeHW) (_THIS, SDL_Overlay * overlay);
    7.42 -};
    7.43 -/* vi: set ts=4 sw=4 expandtab: */