annotate src/video/qnxgf/SDL_gf_render.c @ 5142:57851a238c8f

Removed more partially functional renderers
author Sam Lantinga <slouken@libsdl.org>
date Mon, 31 Jan 2011 22:53:45 -0800
parents da10636e5eca
children e743b9c3f6d6
rev   line source
3087
0b6f51c29267 Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1 /*
0b6f51c29267 Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
2 SDL - Simple DirectMedia Layer
3697
f7b03b6838cb Fixed bug #926
Sam Lantinga <slouken@libsdl.org>
parents: 3685
diff changeset
3 Copyright (C) 1997-2010 Sam Lantinga
3087
0b6f51c29267 Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
4
0b6f51c29267 Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
5 This library is free software; you can redistribute it and/or
0b6f51c29267 Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
6 modify it under the terms of the GNU Lesser General Public
0b6f51c29267 Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
7 License as published by the Free Software Foundation; either
0b6f51c29267 Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
8 version 2.1 of the License, or (at your option) any later version.
0b6f51c29267 Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
9
0b6f51c29267 Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
10 This library is distributed in the hope that it will be useful,
0b6f51c29267 Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
0b6f51c29267 Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
0b6f51c29267 Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
13 Lesser General Public License for more details.
0b6f51c29267 Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
14
0b6f51c29267 Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
15 You should have received a copy of the GNU Lesser General Public
0b6f51c29267 Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
16 License along with this library; if not, write to the Free Software
0b6f51c29267 Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
0b6f51c29267 Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
18
0b6f51c29267 Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
19 Sam Lantinga
0b6f51c29267 Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
20 slouken@libsdl.org
3092
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
21
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
22 QNX Graphics Framework SDL driver
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
23 Copyright (C) 2009 Mike Gorchak
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
24 (mike@malva.ua, lestat@i.com.ua)
3087
0b6f51c29267 Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
25 */
0b6f51c29267 Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
26
0b6f51c29267 Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
27 #include "SDL_config.h"
0b6f51c29267 Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
28
0b6f51c29267 Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
29 #include "../SDL_pixels_c.h"
0b6f51c29267 Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
30 #include "../SDL_yuv_sw_c.h"
0b6f51c29267 Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
31
0b6f51c29267 Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
32 #include "SDL_video.h"
0b6f51c29267 Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
33
0b6f51c29267 Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
34 #include "SDL_gf_render.h"
3092
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
35 #include "SDL_qnxgf.h"
3087
0b6f51c29267 Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
36
3139
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
37 static SDL_Renderer *gf_createrenderer(SDL_Window * window, Uint32 flags);
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
38 static int gf_displaymodechanged(SDL_Renderer * renderer);
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
39 static int gf_activaterenderer(SDL_Renderer * renderer);
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
40 static int gf_createtexture(SDL_Renderer * renderer, SDL_Texture * texture);
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
41 static int gf_querytexturepixels(SDL_Renderer * renderer,
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
42 SDL_Texture * texture, void **pixels,
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
43 int *pitch);
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
44 static int gf_settexturepalette(SDL_Renderer * renderer,
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
45 SDL_Texture * texture,
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
46 const SDL_Color * colors, int firstcolor,
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
47 int ncolors);
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
48 static int gf_gettexturepalette(SDL_Renderer * renderer,
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
49 SDL_Texture * texture, SDL_Color * colors,
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
50 int firstcolor, int ncolors);
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
51 static int gf_settexturecolormod(SDL_Renderer * renderer,
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
52 SDL_Texture * texture);
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
53 static int gf_settexturealphamod(SDL_Renderer * renderer,
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
54 SDL_Texture * texture);
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
55 static int gf_settextureblendmode(SDL_Renderer * renderer,
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
56 SDL_Texture * texture);
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
57 static int gf_settexturescalemode(SDL_Renderer * renderer,
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
58 SDL_Texture * texture);
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
59 static int gf_updatetexture(SDL_Renderer * renderer, SDL_Texture * texture,
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
60 const SDL_Rect * rect, const void *pixels,
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
61 int pitch);
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
62 static int gf_locktexture(SDL_Renderer * renderer, SDL_Texture * texture,
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
63 const SDL_Rect * rect, int markDirty, void **pixels,
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
64 int *pitch);
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
65 static void gf_unlocktexture(SDL_Renderer * renderer, SDL_Texture * texture);
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
66 static void gf_dirtytexture(SDL_Renderer * renderer, SDL_Texture * texture,
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
67 int numrects, const SDL_Rect * rects);
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
68 static int gf_renderpoint(SDL_Renderer * renderer, int x, int y);
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
69 static int gf_renderline(SDL_Renderer * renderer, int x1, int y1, int x2,
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
70 int y2);
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
71 static int gf_renderfill(SDL_Renderer * renderer, const SDL_Rect * rect);
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
72 static int gf_rendercopy(SDL_Renderer * renderer, SDL_Texture * texture,
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
73 const SDL_Rect * srcrect, const SDL_Rect * dstrect);
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
74 static void gf_renderpresent(SDL_Renderer * renderer);
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
75 static void gf_destroytexture(SDL_Renderer * renderer, SDL_Texture * texture);
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
76 static void gf_destroyrenderer(SDL_Renderer * renderer);
3092
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
77
3139
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
78 SDL_RenderDriver gf_renderdriver = {
3092
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
79 gf_createrenderer,
3087
0b6f51c29267 Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
80 {
3139
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
81 "qnxgf",
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
82 (SDL_RENDERER_SINGLEBUFFER | SDL_RENDERER_PRESENTCOPY |
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
83 SDL_RENDERER_PRESENTFLIP2 | SDL_RENDERER_PRESENTFLIP3 |
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
84 SDL_RENDERER_PRESENTVSYNC | SDL_RENDERER_PRESENTDISCARD |
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
85 SDL_RENDERER_ACCELERATED),
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
86 (SDL_TEXTUREMODULATE_NONE | SDL_TEXTUREMODULATE_COLOR |
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
87 SDL_TEXTUREMODULATE_ALPHA),
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
88 (SDL_BLENDMODE_NONE | SDL_BLENDMODE_MASK |
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
89 SDL_BLENDMODE_BLEND | SDL_BLENDMODE_ADD | SDL_BLENDMODE_MOD),
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
90 13,
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
91 {
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
92 SDL_PIXELFORMAT_INDEX8,
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
93 SDL_PIXELFORMAT_RGB555,
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
94 SDL_PIXELFORMAT_RGB565,
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
95 SDL_PIXELFORMAT_RGB888,
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
96 SDL_PIXELFORMAT_BGR888,
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
97 SDL_PIXELFORMAT_ARGB8888,
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
98 SDL_PIXELFORMAT_RGBA8888,
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
99 SDL_PIXELFORMAT_ABGR8888,
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
100 SDL_PIXELFORMAT_BGRA8888,
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
101 SDL_PIXELFORMAT_YV12,
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
102 SDL_PIXELFORMAT_YUY2,
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
103 SDL_PIXELFORMAT_UYVY,
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
104 SDL_PIXELFORMAT_YVYU},
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
105 0,
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
106 0}
3087
0b6f51c29267 Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
107 };
3092
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
108
3139
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
109 static SDL_Renderer *
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
110 gf_createrenderer(SDL_Window * window, Uint32 flags)
3092
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
111 {
3685
64ce267332c6 Switched from SDL_WindowID and SDL_TextureID to SDL_Window* and SDL_Texture* for code simplicity and improved performance.
Sam Lantinga <slouken@libsdl.org>
parents: 3500
diff changeset
112 SDL_VideoDisplay *display = window->display;
3139
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
113 SDL_DisplayData *didata = (SDL_DisplayData *) display->driverdata;
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
114 SDL_WindowData *wdata = (SDL_WindowData *) window->driverdata;
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
115 SDL_Renderer *renderer = NULL;
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
116 SDL_RenderData *rdata = NULL;
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
117 uint32_t it;
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
118 int32_t jt;
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
119 int32_t status;
3092
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
120
3139
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
121 /* Check if it is OpenGL ES window */
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
122 if ((window->flags & SDL_WINDOW_OPENGL) == SDL_WINDOW_OPENGL) {
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
123 /* No error, just no need to create 2D renderer for OpenGL ES window */
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
124 return NULL;
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
125 }
3099
82e60908fab1 Date: Mon, 23 Mar 2009 09:17:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3092
diff changeset
126
3139
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
127 /* Allocate new renderer structure */
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
128 renderer = (SDL_Renderer *) SDL_calloc(1, sizeof(SDL_Renderer));
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
129 if (renderer == NULL) {
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
130 SDL_OutOfMemory();
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
131 return NULL;
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
132 }
3092
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
133
3139
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
134 /* Allocate renderer data */
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
135 rdata = (SDL_RenderData *) SDL_calloc(1, sizeof(SDL_RenderData));
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
136 if (rdata == NULL) {
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
137 SDL_free(renderer);
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
138 SDL_OutOfMemory();
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
139 return NULL;
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
140 }
3092
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
141
3139
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
142 renderer->DisplayModeChanged = gf_displaymodechanged;
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
143 renderer->ActivateRenderer = gf_activaterenderer;
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
144 renderer->CreateTexture = gf_createtexture;
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
145 renderer->QueryTexturePixels = gf_querytexturepixels;
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
146 renderer->SetTexturePalette = gf_settexturepalette;
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
147 renderer->GetTexturePalette = gf_gettexturepalette;
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
148 renderer->SetTextureAlphaMod = gf_settexturealphamod;
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
149 renderer->SetTextureColorMod = gf_settexturecolormod;
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
150 renderer->SetTextureBlendMode = gf_settextureblendmode;
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
151 renderer->UpdateTexture = gf_updatetexture;
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
152 renderer->LockTexture = gf_locktexture;
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
153 renderer->UnlockTexture = gf_unlocktexture;
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
154 renderer->DirtyTexture = gf_dirtytexture;
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
155 renderer->RenderPoint = gf_renderpoint;
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
156 renderer->RenderLine = gf_renderline;
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
157 renderer->RenderFill = gf_renderfill;
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
158 renderer->RenderCopy = gf_rendercopy;
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
159 renderer->RenderPresent = gf_renderpresent;
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
160 renderer->DestroyTexture = gf_destroytexture;
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
161 renderer->DestroyRenderer = gf_destroyrenderer;
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
162 renderer->info = gf_renderdriver.info;
3685
64ce267332c6 Switched from SDL_WindowID and SDL_TextureID to SDL_Window* and SDL_Texture* for code simplicity and improved performance.
Sam Lantinga <slouken@libsdl.org>
parents: 3500
diff changeset
163 renderer->window = window;
3139
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
164 renderer->driverdata = rdata;
3092
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
165
3139
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
166 /* Set render acceleration flag in case it is accelerated */
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
167 if ((didata->caps & SDL_GF_ACCELERATED) == SDL_GF_ACCELERATED) {
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
168 renderer->info.flags = SDL_RENDERER_ACCELERATED;
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
169 } else {
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
170 renderer->info.flags &= ~(SDL_RENDERER_ACCELERATED);
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
171 }
3092
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
172
3139
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
173 rdata->window = window;
3092
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
174
3139
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
175 /* Check if upper level requested synchronization on vsync signal */
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
176 if ((flags & SDL_RENDERER_PRESENTVSYNC) == SDL_RENDERER_PRESENTVSYNC) {
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
177 rdata->enable_vsync = SDL_TRUE;
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
178 } else {
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
179 rdata->enable_vsync = SDL_FALSE;
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
180 }
3092
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
181
3139
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
182 /* Check what buffer copy/flip scheme is requested */
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
183 rdata->surfaces_count = 0;
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
184 if ((flags & SDL_RENDERER_SINGLEBUFFER) == SDL_RENDERER_SINGLEBUFFER) {
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
185 if ((flags & SDL_RENDERER_PRESENTDISCARD) ==
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
186 SDL_RENDERER_PRESENTDISCARD) {
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
187 renderer->info.flags |=
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
188 SDL_RENDERER_SINGLEBUFFER | SDL_RENDERER_PRESENTDISCARD;
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
189 } else {
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
190 renderer->info.flags |=
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
191 SDL_RENDERER_SINGLEBUFFER | SDL_RENDERER_PRESENTCOPY;
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
192 }
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
193 rdata->surfaces_count = 1;
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
194 rdata->surface_visible_idx = 0;
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
195 rdata->surface_render_idx = 0;
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
196 } else {
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
197 if ((flags & SDL_RENDERER_PRESENTFLIP2) == SDL_RENDERER_PRESENTFLIP2) {
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
198 renderer->info.flags |= SDL_RENDERER_PRESENTFLIP2;
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
199 rdata->surfaces_count = 2;
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
200 rdata->surface_visible_idx = 0;
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
201 rdata->surface_render_idx = 1;
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
202 } else {
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
203 if ((flags & SDL_RENDERER_PRESENTFLIP3) ==
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
204 SDL_RENDERER_PRESENTFLIP3) {
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
205 renderer->info.flags |= SDL_RENDERER_PRESENTFLIP3;
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
206 rdata->surfaces_count = 3;
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
207 rdata->surface_visible_idx = 0;
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
208 rdata->surface_render_idx = 1;
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
209 } else {
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
210 renderer->info.flags |=
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
211 SDL_RENDERER_SINGLEBUFFER | SDL_RENDERER_PRESENTCOPY;
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
212 rdata->surfaces_count = 1;
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
213 rdata->surface_visible_idx = 0;
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
214 rdata->surface_render_idx = 0;
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
215 }
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
216 }
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
217 }
3092
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
218
3139
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
219 /* Create layer surfaces, which could be visible */
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
220 for (it = 0; it < rdata->surfaces_count; it++) {
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
221 /* TODO: add palette creation */
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
222
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
223 /* Create displayable surfaces */
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
224 status =
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
225 gf_surface_create_layer(&rdata->surface[it], &didata->layer, 1, 0,
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
226 didata->current_mode.w,
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
227 didata->current_mode.h,
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
228 qnxgf_sdl_to_gf_pixelformat(didata->
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
229 current_mode.
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
230 format), NULL,
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
231 GF_SURFACE_CREATE_2D_ACCESSIBLE);
3092
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
232
3139
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
233 if (status != GF_ERR_OK) {
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
234 /* Free already allocated surfaces */
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
235 for (jt = it - 1; jt > 0; jt--) {
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
236 gf_surface_free(rdata->surface[jt]);
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
237 rdata->surface[jt] = NULL;
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
238 }
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
239 SDL_free(rdata);
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
240 SDL_free(renderer);
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
241 if (status == GF_ERR_MEM) {
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
242 SDL_SetError("unsufficient free video memory");
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
243 } else {
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
244 SDL_SetError("error during displayable surface creation");
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
245 }
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
246 return NULL;
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
247 }
3092
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
248
3139
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
249 /* Get detailed information about allocated surface */
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
250 gf_surface_get_info(rdata->surface[it], &rdata->surface_info[it]);
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
251 }
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
252
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
253 return renderer;
3092
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
254 }
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
255
3139
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
256 void
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
257 gf_addrenderdriver(_THIS)
3092
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
258 {
3139
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
259 uint32_t it;
3092
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
260
3139
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
261 for (it = 0; it < _this->num_displays; it++) {
3500
4b594623401b Work in progress on multi-display support:
Sam Lantinga <slouken@libsdl.org>
parents: 3139
diff changeset
262 SDL_AddRenderDriver(&_this->displays[it], &gf_renderdriver);
3139
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
263 }
3092
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
264 }
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
265
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
266 /****************************************************************************/
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
267 /* SDL render interface */
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
268 /****************************************************************************/
3139
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
269 static int
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
270 gf_displaymodechanged(SDL_Renderer * renderer)
3092
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
271 {
3139
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
272 SDL_RenderData *rdata = (SDL_RenderData *) renderer->driverdata;
3092
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
273
3139
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
274 /* Remove all allocated surfaces, they are no more valid */
3092
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
275
3139
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
276 /* TODO: Add video mode change detection and new parameters detection */
3092
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
277
3139
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
278 return 0;
3092
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
279 }
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
280
3139
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
281 static int
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
282 gf_activaterenderer(SDL_Renderer * renderer)
3092
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
283 {
3139
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
284 SDL_RenderData *rdata = (SDL_RenderData *) renderer->driverdata;
3685
64ce267332c6 Switched from SDL_WindowID and SDL_TextureID to SDL_Window* and SDL_Texture* for code simplicity and improved performance.
Sam Lantinga <slouken@libsdl.org>
parents: 3500
diff changeset
285 SDL_VideoDisplay *display = rdata->window->display;
3139
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
286 SDL_DisplayData *didata = (SDL_DisplayData *) display->driverdata;
3092
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
287
3139
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
288 /* Setup current surface as visible */
3109
7b3a09fb9c8b Support for HID devices (mice and keyboards only for now) has been added
Mike Gorchak <lestat@i.com.ua>
parents: 3099
diff changeset
289 // gf_layer_set_surfaces(didata->layer, &rdata->surface[rdata->surface_visible_idx], 1);
3092
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
290
3139
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
291 /* Set visible surface when hardware in idle state */
3109
7b3a09fb9c8b Support for HID devices (mice and keyboards only for now) has been added
Mike Gorchak <lestat@i.com.ua>
parents: 3099
diff changeset
292 // gf_layer_update(didata->layer, GF_LAYER_UPDATE_NO_WAIT_IDLE);
3092
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
293
3139
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
294 return 0;
3092
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
295 }
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
296
3139
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
297 static int
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
298 gf_createtexture(SDL_Renderer * renderer, SDL_Texture * texture)
3092
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
299 {
3139
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
300 SDL_RenderData *renderdata = (SDL_RenderData *) renderer->driverdata;
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
301 SDL_Window *window = SDL_GetWindowFromID(renderer->window);
3685
64ce267332c6 Switched from SDL_WindowID and SDL_TextureID to SDL_Window* and SDL_Texture* for code simplicity and improved performance.
Sam Lantinga <slouken@libsdl.org>
parents: 3500
diff changeset
302 SDL_VideoDisplay *display = window->display;
3139
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
303 SDL_TextureData *tdata = NULL;
3092
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
304
3139
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
305 /* Allocate texture driver data */
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
306 tdata = (SDL_TextureData *) SDL_calloc(1, sizeof(SDL_TextureData));
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
307 if (tdata == NULL) {
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
308 SDL_OutOfMemory();
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
309 return -1;
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
310 }
3092
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
311
3139
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
312 /* Set texture driver data */
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
313 texture->driverdata = tdata;
3092
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
314
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
315 }
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
316
3139
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
317 static int
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
318 gf_querytexturepixels(SDL_Renderer * renderer, SDL_Texture * texture,
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
319 void **pixels, int *pitch)
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
320 {
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
321 }
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
322
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
323 static int
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
324 gf_settexturepalette(SDL_Renderer * renderer, SDL_Texture * texture,
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
325 const SDL_Color * colors, int firstcolor, int ncolors)
3092
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
326 {
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
327 }
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
328
3139
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
329 static int
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
330 gf_gettexturepalette(SDL_Renderer * renderer, SDL_Texture * texture,
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
331 SDL_Color * colors, int firstcolor, int ncolors)
3092
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
332 {
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
333 }
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
334
3139
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
335 static int
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
336 gf_settexturecolormod(SDL_Renderer * renderer, SDL_Texture * texture)
3092
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
337 {
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
338 }
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
339
3139
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
340 static int
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
341 gf_settexturealphamod(SDL_Renderer * renderer, SDL_Texture * texture)
3092
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
342 {
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
343 }
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
344
3139
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
345 static int
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
346 gf_settextureblendmode(SDL_Renderer * renderer, SDL_Texture * texture)
3092
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
347 {
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
348 }
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
349
3139
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
350 static int
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
351 gf_settexturescalemode(SDL_Renderer * renderer, SDL_Texture * texture)
3092
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
352 {
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
353 }
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
354
3139
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
355 static int
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
356 gf_updatetexture(SDL_Renderer * renderer, SDL_Texture * texture,
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
357 const SDL_Rect * rect, const void *pixels, int pitch)
3092
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
358 {
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
359 }
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
360
3139
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
361 static int
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
362 gf_locktexture(SDL_Renderer * renderer, SDL_Texture * texture,
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
363 const SDL_Rect * rect, int markDirty, void **pixels,
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
364 int *pitch)
3092
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
365 {
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
366 }
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
367
3139
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
368 static void
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
369 gf_unlocktexture(SDL_Renderer * renderer, SDL_Texture * texture)
3092
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
370 {
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
371 }
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
372
3139
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
373 static void
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
374 gf_dirtytexture(SDL_Renderer * renderer, SDL_Texture * texture, int numrects,
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
375 const SDL_Rect * rects)
3092
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
376 {
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
377 }
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
378
3139
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
379 static int
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
380 gf_renderpoint(SDL_Renderer * renderer, int x, int y)
3092
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
381 {
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
382 }
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
383
3139
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
384 static int
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
385 gf_renderline(SDL_Renderer * renderer, int x1, int y1, int x2, int y2)
3092
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
386 {
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
387 }
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
388
3139
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
389 static int
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
390 gf_renderfill(SDL_Renderer * renderer, const SDL_Rect * rect)
3092
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
391 {
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
392 }
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
393
3139
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
394 static int
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
395 gf_rendercopy(SDL_Renderer * renderer, SDL_Texture * texture,
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
396 const SDL_Rect * srcrect, const SDL_Rect * dstrect)
3092
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
397 {
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
398 }
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
399
3139
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
400 static void
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
401 gf_renderpresent(SDL_Renderer * renderer)
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
402 {
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
403 }
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
404
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
405 static void
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
406 gf_destroytexture(SDL_Renderer * renderer, SDL_Texture * texture)
3092
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
407 {
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
408 }
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
409
3139
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
410 static void
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
411 gf_destroyrenderer(SDL_Renderer * renderer)
3092
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
412 {
3139
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
413 SDL_RenderData *rdata = (SDL_RenderData *) renderer->driverdata;
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
414 uint32_t it;
3092
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
415
3139
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
416 for (it = 0; it < rdata->surfaces_count; it++) {
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
417 if (rdata->surface[it] != NULL) {
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
418 gf_surface_free(rdata->surface[it]);
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
419 }
Sam Lantinga <slouken@libsdl.org>
parents: 3109
diff changeset
420 }
3092
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
421 }
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
422
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
423 /* vi: set ts=4 sw=4 expandtab: */