src/render/SDL_sysrender.h
author Sam Lantinga <slouken@libsdl.org>
Wed, 05 Jun 2013 22:33:10 -0700
changeset 7286 04087a99e3f4
parent 7240 39eb4958950a
child 7759 869583422e5a
child 8477 ad08f0d710f3
permissions -rw-r--r--
Added testautomation to the Visual Studio 2008 project.
slouken@5154
     1
/*
slouken@5535
     2
  Simple DirectMedia Layer
slouken@6885
     3
  Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
slouken@5154
     4
slouken@5535
     5
  This software is provided 'as-is', without any express or implied
slouken@5535
     6
  warranty.  In no event will the authors be held liable for any damages
slouken@5535
     7
  arising from the use of this software.
slouken@5154
     8
slouken@5535
     9
  Permission is granted to anyone to use this software for any purpose,
slouken@5535
    10
  including commercial applications, and to alter it and redistribute it
slouken@5535
    11
  freely, subject to the following restrictions:
slouken@5154
    12
slouken@5535
    13
  1. The origin of this software must not be misrepresented; you must not
slouken@5535
    14
     claim that you wrote the original software. If you use this software
slouken@5535
    15
     in a product, an acknowledgment in the product documentation would be
slouken@5535
    16
     appreciated but is not required.
slouken@5535
    17
  2. Altered source versions must be plainly marked as such, and must not be
slouken@5535
    18
     misrepresented as being the original software.
slouken@5535
    19
  3. This notice may not be removed or altered from any source distribution.
slouken@5154
    20
*/
slouken@5154
    21
#include "SDL_config.h"
slouken@5154
    22
slouken@5154
    23
#ifndef _SDL_sysrender_h
slouken@5154
    24
#define _SDL_sysrender_h
slouken@5154
    25
slouken@5154
    26
#include "SDL_render.h"
slouken@5154
    27
#include "SDL_events.h"
slouken@5156
    28
#include "SDL_yuv_sw_c.h"
slouken@5154
    29
slouken@5154
    30
/* The SDL 2D rendering system */
slouken@5154
    31
slouken@5154
    32
typedef struct SDL_RenderDriver SDL_RenderDriver;
slouken@5154
    33
slouken@6528
    34
typedef struct
slouken@6528
    35
{
slouken@6528
    36
    float x;
slouken@6528
    37
    float y;
slouken@6528
    38
} SDL_FPoint;
slouken@6528
    39
slouken@6528
    40
typedef struct
slouken@6528
    41
{
slouken@6528
    42
    float x;
slouken@6528
    43
    float y;
slouken@6528
    44
    float w;
slouken@6528
    45
    float h;
slouken@6528
    46
} SDL_FRect;
slouken@6528
    47
slouken@5154
    48
/* Define the SDL texture structure */
slouken@5154
    49
struct SDL_Texture
slouken@5154
    50
{
slouken@5154
    51
    const void *magic;
slouken@5154
    52
    Uint32 format;              /**< The pixel format of the texture */
slouken@5154
    53
    int access;                 /**< SDL_TextureAccess */
slouken@5154
    54
    int w;                      /**< The width of the texture */
slouken@5154
    55
    int h;                      /**< The height of the texture */
slouken@5154
    56
    int modMode;                /**< The texture modulation mode */
slouken@5154
    57
    SDL_BlendMode blendMode;    /**< The texture blend mode */
slouken@5154
    58
    Uint8 r, g, b, a;           /**< Texture modulation values */
slouken@5154
    59
slouken@5154
    60
    SDL_Renderer *renderer;
slouken@5154
    61
slouken@5156
    62
    /* Support for formats not supported directly by the renderer */
slouken@5156
    63
    SDL_Texture *native;
slouken@5156
    64
    SDL_SW_YUVTexture *yuv;
slouken@5156
    65
    void *pixels;
slouken@5156
    66
    int pitch;
slouken@5156
    67
    SDL_Rect locked_rect;
slouken@5156
    68
slouken@5154
    69
    void *driverdata;           /**< Driver specific texture representation */
slouken@5154
    70
slouken@5154
    71
    SDL_Texture *prev;
slouken@5154
    72
    SDL_Texture *next;
slouken@5154
    73
};
slouken@5154
    74
slouken@5154
    75
/* Define the SDL renderer structure */
slouken@5154
    76
struct SDL_Renderer
slouken@5154
    77
{
slouken@5154
    78
    const void *magic;
slouken@5154
    79
slouken@5154
    80
    void (*WindowEvent) (SDL_Renderer * renderer, const SDL_WindowEvent *event);
slouken@7239
    81
    int (*GetOutputSize) (SDL_Renderer * renderer, int *w, int *h);
slouken@5154
    82
    int (*CreateTexture) (SDL_Renderer * renderer, SDL_Texture * texture);
slouken@5154
    83
    int (*SetTextureColorMod) (SDL_Renderer * renderer,
slouken@5154
    84
                               SDL_Texture * texture);
slouken@5154
    85
    int (*SetTextureAlphaMod) (SDL_Renderer * renderer,
slouken@5154
    86
                               SDL_Texture * texture);
slouken@5154
    87
    int (*SetTextureBlendMode) (SDL_Renderer * renderer,
slouken@5154
    88
                                SDL_Texture * texture);
slouken@5154
    89
    int (*UpdateTexture) (SDL_Renderer * renderer, SDL_Texture * texture,
slouken@5154
    90
                          const SDL_Rect * rect, const void *pixels,
slouken@5154
    91
                          int pitch);
slouken@5154
    92
    int (*LockTexture) (SDL_Renderer * renderer, SDL_Texture * texture,
slouken@5156
    93
                        const SDL_Rect * rect, void **pixels, int *pitch);
slouken@5154
    94
    void (*UnlockTexture) (SDL_Renderer * renderer, SDL_Texture * texture);
slouken@6247
    95
    int (*SetRenderTarget) (SDL_Renderer * renderer, SDL_Texture * texture);
slouken@5297
    96
    int (*UpdateViewport) (SDL_Renderer * renderer);
slouken@7141
    97
    int (*UpdateClipRect) (SDL_Renderer * renderer);
slouken@5154
    98
    int (*RenderClear) (SDL_Renderer * renderer);
slouken@6528
    99
    int (*RenderDrawPoints) (SDL_Renderer * renderer, const SDL_FPoint * points,
slouken@5154
   100
                             int count);
slouken@6528
   101
    int (*RenderDrawLines) (SDL_Renderer * renderer, const SDL_FPoint * points,
slouken@5154
   102
                            int count);
slouken@6528
   103
    int (*RenderFillRects) (SDL_Renderer * renderer, const SDL_FRect * rects,
slouken@5154
   104
                            int count);
slouken@5154
   105
    int (*RenderCopy) (SDL_Renderer * renderer, SDL_Texture * texture,
slouken@6528
   106
                       const SDL_Rect * srcrect, const SDL_FRect * dstrect);
gabomdq@6320
   107
    int (*RenderCopyEx) (SDL_Renderer * renderer, SDL_Texture * texture,
slouken@6528
   108
                       const SDL_Rect * srcquad, const SDL_FRect * dstrect,
slouken@6528
   109
                       const double angle, const SDL_FPoint *center, const SDL_RendererFlip flip);
slouken@5154
   110
    int (*RenderReadPixels) (SDL_Renderer * renderer, const SDL_Rect * rect,
slouken@5154
   111
                             Uint32 format, void * pixels, int pitch);
slouken@5154
   112
    void (*RenderPresent) (SDL_Renderer * renderer);
slouken@5154
   113
    void (*DestroyTexture) (SDL_Renderer * renderer, SDL_Texture * texture);
slouken@5154
   114
slouken@5154
   115
    void (*DestroyRenderer) (SDL_Renderer * renderer);
slouken@5154
   116
gabomdq@6414
   117
    int (*GL_BindTexture) (SDL_Renderer * renderer, SDL_Texture *texture, float *texw, float *texh);
gabomdq@6414
   118
    int (*GL_UnbindTexture) (SDL_Renderer * renderer, SDL_Texture *texture);
gabomdq@6414
   119
slouken@5154
   120
    /* The current renderer info */
slouken@5154
   121
    SDL_RendererInfo info;
slouken@5154
   122
slouken@5154
   123
    /* The window associated with the renderer */
slouken@5154
   124
    SDL_Window *window;
slouken@6260
   125
    SDL_bool hidden;
slouken@5154
   126
slouken@6530
   127
    /* The logical resolution for rendering */
slouken@6530
   128
    int logical_w;
slouken@6530
   129
    int logical_h;
slouken@6581
   130
    int logical_w_backup;
slouken@6581
   131
    int logical_h_backup;
slouken@6530
   132
slouken@5297
   133
    /* The drawable area within the window */
slouken@5297
   134
    SDL_Rect viewport;
slouken@6246
   135
    SDL_Rect viewport_backup;
slouken@5297
   136
slouken@7141
   137
    /* The clip rectangle within the window */
slouken@7141
   138
    SDL_Rect clip_rect;
slouken@7141
   139
    SDL_Rect clip_rect_backup;
slouken@7141
   140
slouken@6528
   141
    /* The render output coordinate scale */
slouken@6528
   142
    SDL_FPoint scale;
slouken@6528
   143
    SDL_FPoint scale_backup;
slouken@6528
   144
slouken@5154
   145
    /* The list of textures */
slouken@5154
   146
    SDL_Texture *textures;
slouken@6246
   147
    SDL_Texture *target;
slouken@5154
   148
slouken@5154
   149
    Uint8 r, g, b, a;                   /**< Color for drawing operations values */
slouken@5154
   150
    SDL_BlendMode blendMode;            /**< The drawing blend mode */
slouken@5154
   151
slouken@5154
   152
    void *driverdata;
slouken@5154
   153
};
slouken@5154
   154
slouken@5154
   155
/* Define the SDL render driver structure */
slouken@5154
   156
struct SDL_RenderDriver
slouken@5154
   157
{
slouken@5154
   158
    SDL_Renderer *(*CreateRenderer) (SDL_Window * window, Uint32 flags);
slouken@5154
   159
slouken@5154
   160
    /* Info about the renderer capabilities */
slouken@5154
   161
    SDL_RendererInfo info;
slouken@5154
   162
};
slouken@5154
   163
slouken@5226
   164
#if !SDL_RENDER_DISABLED
slouken@5226
   165
slouken@5154
   166
#if SDL_VIDEO_RENDER_D3D
slouken@5154
   167
extern SDL_RenderDriver D3D_RenderDriver;
slouken@5154
   168
#endif
slouken@5154
   169
#if SDL_VIDEO_RENDER_OGL
slouken@5154
   170
extern SDL_RenderDriver GL_RenderDriver;
slouken@5154
   171
#endif
slouken@5209
   172
#if SDL_VIDEO_RENDER_OGL_ES2
slouken@5209
   173
extern SDL_RenderDriver GLES2_RenderDriver;
slouken@5209
   174
#endif
slouken@5154
   175
#if SDL_VIDEO_RENDER_OGL_ES
slouken@5201
   176
extern SDL_RenderDriver GLES_RenderDriver;
slouken@5201
   177
#endif
slouken@5199
   178
#if SDL_VIDEO_RENDER_DIRECTFB
slouken@5199
   179
extern SDL_RenderDriver DirectFB_RenderDriver;
slouken@5199
   180
#endif
kimonline@7009
   181
#if SDL_VIDEO_RENDER_PSP
kimonline@7009
   182
extern SDL_RenderDriver PSP_RenderDriver;
kimonline@7009
   183
#endif
slouken@5154
   184
extern SDL_RenderDriver SW_RenderDriver;
slouken@5154
   185
slouken@5226
   186
#endif /* !SDL_RENDER_DISABLED */
slouken@5226
   187
slouken@5154
   188
#endif /* _SDL_sysrender_h */
slouken@5154
   189
slouken@5154
   190
/* vi: set ts=4 sw=4 expandtab: */