src/render/SDL_yuv_sw_c.h
changeset 5156 307ccc9c135e
parent 3697 f7b03b6838cb
child 5262 b530ef003506
equal deleted inserted replaced
5155:f3ebd1950442 5156:307ccc9c135e
       
     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 
       
    26 /* This is the software implementation of the YUV texture support */
       
    27 
       
    28 struct SDL_SW_YUVTexture
       
    29 {
       
    30     Uint32 format;
       
    31     Uint32 target_format;
       
    32     int w, h;
       
    33     Uint8 *pixels;
       
    34     int *colortab;
       
    35     Uint32 *rgb_2_pix;
       
    36     void (*Display1X) (int *colortab, Uint32 * rgb_2_pix,
       
    37                        unsigned char *lum, unsigned char *cr,
       
    38                        unsigned char *cb, unsigned char *out,
       
    39                        int rows, int cols, int mod);
       
    40     void (*Display2X) (int *colortab, Uint32 * rgb_2_pix,
       
    41                        unsigned char *lum, unsigned char *cr,
       
    42                        unsigned char *cb, unsigned char *out,
       
    43                        int rows, int cols, int mod);
       
    44 
       
    45     /* These are just so we don't have to allocate them separately */
       
    46     Uint16 pitches[3];
       
    47     Uint8 *planes[3];
       
    48 
       
    49     /* This is a temporary surface in case we have to stretch copy */
       
    50     SDL_Surface *stretch;
       
    51     SDL_Surface *display;
       
    52 };
       
    53 
       
    54 typedef struct SDL_SW_YUVTexture SDL_SW_YUVTexture;
       
    55 
       
    56 SDL_SW_YUVTexture *SDL_SW_CreateYUVTexture(Uint32 format, int w, int h);
       
    57 int SDL_SW_QueryYUVTexturePixels(SDL_SW_YUVTexture * swdata, void **pixels,
       
    58                                  int *pitch);
       
    59 int SDL_SW_UpdateYUVTexture(SDL_SW_YUVTexture * swdata, const SDL_Rect * rect,
       
    60                             const void *pixels, int pitch);
       
    61 int SDL_SW_LockYUVTexture(SDL_SW_YUVTexture * swdata, const SDL_Rect * rect,
       
    62                           void **pixels, int *pitch);
       
    63 void SDL_SW_UnlockYUVTexture(SDL_SW_YUVTexture * swdata);
       
    64 int SDL_SW_CopyYUVToRGB(SDL_SW_YUVTexture * swdata, const SDL_Rect * srcrect,
       
    65                         Uint32 target_format, int w, int h, void *pixels,
       
    66                         int pitch);
       
    67 void SDL_SW_DestroyYUVTexture(SDL_SW_YUVTexture * swdata);
       
    68 
       
    69 /* vi: set ts=4 sw=4 expandtab: */