src/render/SDL_sysrender.h
author Sam Lantinga <slouken@libsdl.org>
Sat, 05 Feb 2011 16:07:10 -0800
changeset 5199 164f20ba08eb
parent 5157 657543cc92f9
child 5201 523409574510
permissions -rw-r--r--
Updated the DirectFB support, from Couriersud

attached is a working directfb driver diff which works with the current
changes. There are a number of changes around it as well, e.g.
configure.in.

The directfb renderdriver right now still depends on a some "includes"
from src/video/directfb. That's why it is not yet moved to the new
render folder.
slouken@5154
     1
/*
slouken@5154
     2
    SDL - Simple DirectMedia Layer
slouken@5154
     3
    Copyright (C) 1997-2010 Sam Lantinga
slouken@5154
     4
slouken@5154
     5
    This library is free software; you can redistribute it and/or
slouken@5154
     6
    modify it under the terms of the GNU Lesser General Public
slouken@5154
     7
    License as published by the Free Software Foundation; either
slouken@5154
     8
    version 2.1 of the License, or (at your option) any later version.
slouken@5154
     9
slouken@5154
    10
    This library is distributed in the hope that it will be useful,
slouken@5154
    11
    but WITHOUT ANY WARRANTY; without even the implied warranty of
slouken@5154
    12
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
slouken@5154
    13
    Lesser General Public License for more details.
slouken@5154
    14
slouken@5154
    15
    You should have received a copy of the GNU Lesser General Public
slouken@5154
    16
    License along with this library; if not, write to the Free Software
slouken@5154
    17
    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
slouken@5154
    18
slouken@5154
    19
    Sam Lantinga
slouken@5154
    20
    slouken@libsdl.org
slouken@5154
    21
*/
slouken@5154
    22
#include "SDL_config.h"
slouken@5154
    23
slouken@5154
    24
#ifndef _SDL_sysrender_h
slouken@5154
    25
#define _SDL_sysrender_h
slouken@5154
    26
slouken@5154
    27
#include "SDL_render.h"
slouken@5154
    28
#include "SDL_events.h"
slouken@5156
    29
#include "SDL_yuv_sw_c.h"
slouken@5154
    30
slouken@5154
    31
/* The SDL 2D rendering system */
slouken@5154
    32
slouken@5154
    33
typedef struct SDL_RenderDriver SDL_RenderDriver;
slouken@5154
    34
slouken@5154
    35
/* Define the SDL texture structure */
slouken@5154
    36
struct SDL_Texture
slouken@5154
    37
{
slouken@5154
    38
    const void *magic;
slouken@5154
    39
    Uint32 format;              /**< The pixel format of the texture */
slouken@5154
    40
    int access;                 /**< SDL_TextureAccess */
slouken@5154
    41
    int w;                      /**< The width of the texture */
slouken@5154
    42
    int h;                      /**< The height of the texture */
slouken@5154
    43
    int modMode;                /**< The texture modulation mode */
slouken@5154
    44
    SDL_BlendMode blendMode;    /**< The texture blend mode */
slouken@5154
    45
    Uint8 r, g, b, a;           /**< Texture modulation values */
slouken@5154
    46
slouken@5154
    47
    SDL_Renderer *renderer;
slouken@5154
    48
slouken@5156
    49
    /* Support for formats not supported directly by the renderer */
slouken@5156
    50
    SDL_Texture *native;
slouken@5156
    51
    SDL_SW_YUVTexture *yuv;
slouken@5156
    52
    void *pixels;
slouken@5156
    53
    int pitch;
slouken@5156
    54
    SDL_Rect locked_rect;
slouken@5156
    55
slouken@5154
    56
    void *driverdata;           /**< Driver specific texture representation */
slouken@5154
    57
slouken@5154
    58
    SDL_Texture *prev;
slouken@5154
    59
    SDL_Texture *next;
slouken@5154
    60
};
slouken@5154
    61
slouken@5154
    62
/* Define the SDL renderer structure */
slouken@5154
    63
struct SDL_Renderer
slouken@5154
    64
{
slouken@5154
    65
    const void *magic;
slouken@5154
    66
slouken@5154
    67
    void (*WindowEvent) (SDL_Renderer * renderer, const SDL_WindowEvent *event);
slouken@5154
    68
    int (*CreateTexture) (SDL_Renderer * renderer, SDL_Texture * texture);
slouken@5154
    69
    int (*SetTextureColorMod) (SDL_Renderer * renderer,
slouken@5154
    70
                               SDL_Texture * texture);
slouken@5154
    71
    int (*SetTextureAlphaMod) (SDL_Renderer * renderer,
slouken@5154
    72
                               SDL_Texture * texture);
slouken@5154
    73
    int (*SetTextureBlendMode) (SDL_Renderer * renderer,
slouken@5154
    74
                                SDL_Texture * texture);
slouken@5154
    75
    int (*UpdateTexture) (SDL_Renderer * renderer, SDL_Texture * texture,
slouken@5154
    76
                          const SDL_Rect * rect, const void *pixels,
slouken@5154
    77
                          int pitch);
slouken@5154
    78
    int (*LockTexture) (SDL_Renderer * renderer, SDL_Texture * texture,
slouken@5156
    79
                        const SDL_Rect * rect, void **pixels, int *pitch);
slouken@5154
    80
    void (*UnlockTexture) (SDL_Renderer * renderer, SDL_Texture * texture);
slouken@5154
    81
    int (*RenderClear) (SDL_Renderer * renderer);
slouken@5154
    82
    int (*RenderDrawPoints) (SDL_Renderer * renderer, const SDL_Point * points,
slouken@5154
    83
                             int count);
slouken@5154
    84
    int (*RenderDrawLines) (SDL_Renderer * renderer, const SDL_Point * points,
slouken@5154
    85
                            int count);
slouken@5154
    86
    int (*RenderFillRects) (SDL_Renderer * renderer, const SDL_Rect ** rects,
slouken@5154
    87
                            int count);
slouken@5154
    88
    int (*RenderCopy) (SDL_Renderer * renderer, SDL_Texture * texture,
slouken@5154
    89
                       const SDL_Rect * srcrect, const SDL_Rect * dstrect);
slouken@5154
    90
    int (*RenderReadPixels) (SDL_Renderer * renderer, const SDL_Rect * rect,
slouken@5154
    91
                             Uint32 format, void * pixels, int pitch);
slouken@5154
    92
    void (*RenderPresent) (SDL_Renderer * renderer);
slouken@5154
    93
    void (*DestroyTexture) (SDL_Renderer * renderer, SDL_Texture * texture);
slouken@5154
    94
slouken@5154
    95
    void (*DestroyRenderer) (SDL_Renderer * renderer);
slouken@5154
    96
slouken@5154
    97
    /* The current renderer info */
slouken@5154
    98
    SDL_RendererInfo info;
slouken@5154
    99
slouken@5154
   100
    /* The window associated with the renderer */
slouken@5154
   101
    SDL_Window *window;
slouken@5154
   102
slouken@5154
   103
    /* The list of textures */
slouken@5154
   104
    SDL_Texture *textures;
slouken@5154
   105
slouken@5154
   106
    Uint8 r, g, b, a;                   /**< Color for drawing operations values */
slouken@5154
   107
    SDL_BlendMode blendMode;            /**< The drawing blend mode */
slouken@5154
   108
slouken@5154
   109
    void *driverdata;
slouken@5154
   110
};
slouken@5154
   111
slouken@5154
   112
/* Define the SDL render driver structure */
slouken@5154
   113
struct SDL_RenderDriver
slouken@5154
   114
{
slouken@5154
   115
    SDL_Renderer *(*CreateRenderer) (SDL_Window * window, Uint32 flags);
slouken@5154
   116
slouken@5154
   117
    /* Info about the renderer capabilities */
slouken@5154
   118
    SDL_RendererInfo info;
slouken@5154
   119
};
slouken@5154
   120
slouken@5154
   121
#if SDL_VIDEO_RENDER_D3D
slouken@5154
   122
extern SDL_RenderDriver D3D_RenderDriver;
slouken@5154
   123
#endif
slouken@5154
   124
#if SDL_VIDEO_RENDER_OGL
slouken@5154
   125
extern SDL_RenderDriver GL_RenderDriver;
slouken@5154
   126
#endif
slouken@5154
   127
#if SDL_VIDEO_RENDER_OGL_ES
slouken@5154
   128
extern SDL_RenderDriver GL_ES_RenderDriver;
slouken@5154
   129
#endif
slouken@5199
   130
#if SDL_VIDEO_RENDER_DIRECTFB
slouken@5199
   131
extern SDL_RenderDriver DirectFB_RenderDriver;
slouken@5199
   132
#endif
slouken@5154
   133
extern SDL_RenderDriver SW_RenderDriver;
slouken@5154
   134
slouken@5154
   135
#endif /* _SDL_sysrender_h */
slouken@5154
   136
slouken@5154
   137
/* vi: set ts=4 sw=4 expandtab: */