src/video/SDL_yuv_sw_c.h
author Sam Lantinga <slouken@libsdl.org>
Sun, 24 Jan 2010 21:10:53 +0000
changeset 3697 f7b03b6838cb
parent 3257 94fb40a4a9a7
permissions -rw-r--r--
Fixed bug #926

Updated copyright to LGPL version 2.1 and year 2010
     1 /*
     2     SDL - Simple DirectMedia Layer
     3     Copyright (C) 1997-2010 Sam Lantinga
     4 
     5     This library is free software; you can redistribute it and/or
     6     modify it under the terms of the GNU Lesser General Public
     7     License as published by the Free Software Foundation; either
     8     version 2.1 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     Lesser General Public License for more details.
    14 
    15     You should have received a copy of the GNU Lesser General Public
    16     License along with this library; if not, write to the Free Software
    17     Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
    18 
    19     Sam Lantinga
    20     slouken@libsdl.org
    21 */
    22 #include "SDL_config.h"
    23 
    24 #include "SDL_video.h"
    25 #include "SDL_sysvideo.h"
    26 
    27 /* This is the software implementation of the YUV texture support */
    28 
    29 struct SDL_SW_YUVTexture
    30 {
    31     Uint32 format;
    32     Uint32 target_format;
    33     int w, h;
    34     Uint8 *pixels;
    35     int *colortab;
    36     Uint32 *rgb_2_pix;
    37     void (*Display1X) (int *colortab, Uint32 * rgb_2_pix,
    38                        unsigned char *lum, unsigned char *cr,
    39                        unsigned char *cb, unsigned char *out,
    40                        int rows, int cols, int mod);
    41     void (*Display2X) (int *colortab, Uint32 * rgb_2_pix,
    42                        unsigned char *lum, unsigned char *cr,
    43                        unsigned char *cb, unsigned char *out,
    44                        int rows, int cols, int mod);
    45 
    46     /* These are just so we don't have to allocate them separately */
    47     Uint16 pitches[3];
    48     Uint8 *planes[3];
    49 
    50     /* This is a temporary surface in case we have to stretch copy */
    51     SDL_Surface *stretch;
    52     SDL_Surface *display;
    53 };
    54 
    55 typedef struct SDL_SW_YUVTexture SDL_SW_YUVTexture;
    56 
    57 SDL_SW_YUVTexture *SDL_SW_CreateYUVTexture(Uint32 format, int w, int h);
    58 int SDL_SW_QueryYUVTexturePixels(SDL_SW_YUVTexture * swdata, void **pixels,
    59                                  int *pitch);
    60 int SDL_SW_UpdateYUVTexture(SDL_SW_YUVTexture * swdata, const SDL_Rect * rect,
    61                             const void *pixels, int pitch);
    62 int SDL_SW_LockYUVTexture(SDL_SW_YUVTexture * swdata, const SDL_Rect * rect,
    63                           int markDirty, void **pixels, int *pitch);
    64 void SDL_SW_UnlockYUVTexture(SDL_SW_YUVTexture * swdata);
    65 int SDL_SW_CopyYUVToRGB(SDL_SW_YUVTexture * swdata, const SDL_Rect * srcrect,
    66                         Uint32 target_format, int w, int h, void *pixels,
    67                         int pitch);
    68 void SDL_SW_DestroyYUVTexture(SDL_SW_YUVTexture * swdata);
    69 
    70 /* vi: set ts=4 sw=4 expandtab: */