annotate src/video/photon/SDL_photon_render.c @ 3315:87ffdad11607

Fixed bug #761 Mason Wheeler 2009-07-05 09:28:33 PDT This patch fixes two issues with SDL_CreateTextureFromSurface. 1. If no renderer is available, the function will return 0 without calling SDL_SetError. (It does this in other places as well, but it appears that in these cases, SDL_SetError was already called by a previous function call.) 2. Removal of a dead code block that checks for an impossible return value.
author Sam Lantinga <slouken@libsdl.org>
date Sat, 26 Sep 2009 10:13:44 +0000
parents 7f684f249ec9
children dd105b317335
rev   line source
3092
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1 /*
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
2 SDL - Simple DirectMedia Layer
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
3 Copyright (C) 1997-2009 Sam Lantinga
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
4
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
5 This library is free software; you can redistribute it and/or
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
6 modify it under the terms of the GNU Lesser General Public
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
7 License as published by the Free Software Foundation; either
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
8 version 2.1 of the License, or (at your option) any later version.
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
9
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
10 This library is distributed in the hope that it will be useful,
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
13 Lesser General Public License for more details.
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
14
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
15 You should have received a copy of the GNU Lesser General Public
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
16 License along with this library; if not, write to the Free Software
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
18
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
19 Sam Lantinga
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
20 slouken@libsdl.org
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
21
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
22 QNX Photon GUI SDL driver
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
23 Copyright (C) 2009 Mike Gorchak
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
24 (mike@malva.ua, lestat@i.com.ua)
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
25 */
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
26
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
27 #include "SDL_config.h"
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
28
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
29 #include "../SDL_pixels_c.h"
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
30 #include "../SDL_yuv_sw_c.h"
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
31
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
32 #include "SDL_video.h"
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
33
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
34 #include "SDL_photon_render.h"
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
35 #include "SDL_photon.h"
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
36
3139
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
37 static SDL_Renderer *photon_createrenderer(SDL_Window * window, Uint32 flags);
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
38 static int photon_displaymodechanged(SDL_Renderer * renderer);
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
39 static int photon_activaterenderer(SDL_Renderer * renderer);
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
40 static int photon_createtexture(SDL_Renderer * renderer,
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
41 SDL_Texture * texture);
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
42 static int photon_querytexturepixels(SDL_Renderer * renderer,
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
43 SDL_Texture * texture, void **pixels,
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
44 int *pitch);
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
45 static int photon_settexturepalette(SDL_Renderer * renderer,
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
46 SDL_Texture * texture,
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
47 const SDL_Color * colors, int firstcolor,
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
48 int ncolors);
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
49 static int photon_gettexturepalette(SDL_Renderer * renderer,
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
50 SDL_Texture * texture, SDL_Color * colors,
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
51 int firstcolor, int ncolors);
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
52 static int photon_settexturecolormod(SDL_Renderer * renderer,
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
53 SDL_Texture * texture);
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
54 static int photon_settexturealphamod(SDL_Renderer * renderer,
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
55 SDL_Texture * texture);
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
56 static int photon_settextureblendmode(SDL_Renderer * renderer,
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
57 SDL_Texture * texture);
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
58 static int photon_settexturescalemode(SDL_Renderer * renderer,
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
59 SDL_Texture * texture);
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
60 static int photon_updatetexture(SDL_Renderer * renderer,
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
61 SDL_Texture * texture, const SDL_Rect * rect,
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
62 const void *pixels, int pitch);
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
63 static int photon_locktexture(SDL_Renderer * renderer, SDL_Texture * texture,
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
64 const SDL_Rect * rect, int markDirty,
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
65 void **pixels, int *pitch);
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
66 static void photon_unlocktexture(SDL_Renderer * renderer,
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
67 SDL_Texture * texture);
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
68 static void photon_dirtytexture(SDL_Renderer * renderer,
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
69 SDL_Texture * texture, int numrects,
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
70 const SDL_Rect * rects);
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
71 static int photon_renderpoint(SDL_Renderer * renderer, int x, int y);
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
72 static int photon_renderline(SDL_Renderer * renderer, int x1, int y1, int x2,
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
73 int y2);
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
74 static int photon_renderfill(SDL_Renderer * renderer, const SDL_Rect * rect);
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
75 static int photon_rendercopy(SDL_Renderer * renderer, SDL_Texture * texture,
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
76 const SDL_Rect * srcrect,
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
77 const SDL_Rect * dstrect);
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
78 static void photon_renderpresent(SDL_Renderer * renderer);
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
79 static void photon_destroytexture(SDL_Renderer * renderer,
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
80 SDL_Texture * texture);
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
81 static void photon_destroyrenderer(SDL_Renderer * renderer);
3092
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
82
3139
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
83 SDL_RenderDriver photon_renderdriver = {
3092
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
84 photon_createrenderer,
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
85 {
3139
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
86 "photon",
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
87 (SDL_RENDERER_SINGLEBUFFER | SDL_RENDERER_PRESENTCOPY |
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
88 SDL_RENDERER_PRESENTFLIP2 | SDL_RENDERER_PRESENTFLIP3 |
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
89 SDL_RENDERER_PRESENTVSYNC | SDL_RENDERER_PRESENTDISCARD |
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
90 SDL_RENDERER_ACCELERATED),
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
91 (SDL_TEXTUREMODULATE_NONE | SDL_TEXTUREMODULATE_COLOR |
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
92 SDL_TEXTUREMODULATE_ALPHA),
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
93 (SDL_BLENDMODE_NONE | SDL_BLENDMODE_MASK |
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
94 SDL_BLENDMODE_BLEND | SDL_BLENDMODE_ADD | SDL_BLENDMODE_MOD),
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
95 (SDL_TEXTURESCALEMODE_NONE | SDL_TEXTURESCALEMODE_SLOW),
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
96 13,
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
97 {
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
98 SDL_PIXELFORMAT_INDEX8,
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
99 SDL_PIXELFORMAT_RGB555,
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
100 SDL_PIXELFORMAT_RGB565,
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
101 SDL_PIXELFORMAT_RGB888,
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
102 SDL_PIXELFORMAT_BGR888,
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
103 SDL_PIXELFORMAT_ARGB8888,
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
104 SDL_PIXELFORMAT_RGBA8888,
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
105 SDL_PIXELFORMAT_ABGR8888,
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
106 SDL_PIXELFORMAT_BGRA8888,
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
107 SDL_PIXELFORMAT_YV12,
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
108 SDL_PIXELFORMAT_YUY2,
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
109 SDL_PIXELFORMAT_UYVY,
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
110 SDL_PIXELFORMAT_YVYU},
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
111 0,
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
112 0}
3092
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
113 };
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
114
3139
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
115 static SDL_Renderer *
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
116 photon_createrenderer(SDL_Window * window, Uint32 flags)
3092
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
117 {
3139
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
118 SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window);
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
119 SDL_DisplayData *didata = (SDL_DisplayData *) display->driverdata;
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
120 SDL_WindowData *wdata = (SDL_WindowData *) window->driverdata;
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
121 SDL_Renderer *renderer = NULL;
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
122 SDL_RenderData *rdata = NULL;
3092
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
123
3139
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
124 /* Allocate new renderer structure */
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
125 renderer = (SDL_Renderer *) SDL_calloc(1, sizeof(SDL_Renderer));
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
126 if (renderer == NULL) {
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
127 SDL_OutOfMemory();
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
128 return NULL;
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
129 }
3092
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
130
3139
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
131 /* Allocate renderer data */
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
132 rdata = (SDL_RenderData *) SDL_calloc(1, sizeof(SDL_RenderData));
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
133 if (rdata == NULL) {
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
134 SDL_free(renderer);
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
135 SDL_OutOfMemory();
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
136 return NULL;
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
137 }
3092
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
138
3139
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
139 renderer->DisplayModeChanged = photon_displaymodechanged;
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
140 renderer->ActivateRenderer = photon_activaterenderer;
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
141 renderer->CreateTexture = photon_createtexture;
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
142 renderer->QueryTexturePixels = photon_querytexturepixels;
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
143 renderer->SetTexturePalette = photon_settexturepalette;
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
144 renderer->GetTexturePalette = photon_gettexturepalette;
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
145 renderer->SetTextureAlphaMod = photon_settexturealphamod;
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
146 renderer->SetTextureColorMod = photon_settexturecolormod;
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
147 renderer->SetTextureBlendMode = photon_settextureblendmode;
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
148 renderer->SetTextureScaleMode = photon_settexturescalemode;
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
149 renderer->UpdateTexture = photon_updatetexture;
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
150 renderer->LockTexture = photon_locktexture;
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
151 renderer->UnlockTexture = photon_unlocktexture;
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
152 renderer->DirtyTexture = photon_dirtytexture;
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
153 renderer->RenderPoint = photon_renderpoint;
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
154 renderer->RenderLine = photon_renderline;
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
155 renderer->RenderFill = photon_renderfill;
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
156 renderer->RenderCopy = photon_rendercopy;
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
157 renderer->RenderPresent = photon_renderpresent;
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
158 renderer->DestroyTexture = photon_destroytexture;
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
159 renderer->DestroyRenderer = photon_destroyrenderer;
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
160 renderer->info = photon_renderdriver.info;
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
161 renderer->window = window->id;
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
162 renderer->driverdata = rdata;
3092
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
163
3139
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
164 /* Set render acceleration flag in case it is accelerated */
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
165 if ((didata->caps & SDL_PHOTON_ACCELERATED) == SDL_PHOTON_ACCELERATED) {
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
166 renderer->info.flags = SDL_RENDERER_ACCELERATED;
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
167 } else {
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
168 renderer->info.flags &= ~(SDL_RENDERER_ACCELERATED);
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
169 }
3092
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
170
3139
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
171 rdata->window = window;
3092
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
172
3139
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
173 /* Check if upper level requested synchronization on vsync signal */
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
174 if ((flags & SDL_RENDERER_PRESENTVSYNC) == SDL_RENDERER_PRESENTVSYNC) {
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
175 rdata->enable_vsync = SDL_TRUE;
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
176 } else {
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
177 rdata->enable_vsync = SDL_FALSE;
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
178 }
3092
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
179
3139
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
180 /* Check what buffer copy/flip scheme is requested */
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
181 rdata->surfaces_count = 0;
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
182 if ((flags & SDL_RENDERER_SINGLEBUFFER) == SDL_RENDERER_SINGLEBUFFER) {
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
183 if ((flags & SDL_RENDERER_PRESENTDISCARD) ==
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
184 SDL_RENDERER_PRESENTDISCARD) {
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
185 renderer->info.flags |=
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
186 SDL_RENDERER_SINGLEBUFFER | SDL_RENDERER_PRESENTDISCARD;
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
187 } else {
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
188 renderer->info.flags |=
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
189 SDL_RENDERER_SINGLEBUFFER | SDL_RENDERER_PRESENTCOPY;
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
190 }
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
191 rdata->surfaces_count = 1;
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
192 rdata->surface_visible_idx = 0;
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
193 rdata->surface_render_idx = 0;
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
194 } else {
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
195 if ((flags & SDL_RENDERER_PRESENTFLIP2) == SDL_RENDERER_PRESENTFLIP2) {
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
196 renderer->info.flags |= SDL_RENDERER_PRESENTFLIP2;
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
197 rdata->surfaces_count = 2;
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
198 rdata->surface_visible_idx = 0;
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
199 rdata->surface_render_idx = 1;
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
200 } else {
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
201 if ((flags & SDL_RENDERER_PRESENTFLIP3) ==
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
202 SDL_RENDERER_PRESENTFLIP3) {
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
203 renderer->info.flags |= SDL_RENDERER_PRESENTFLIP3;
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
204 rdata->surfaces_count = 3;
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
205 rdata->surface_visible_idx = 0;
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
206 rdata->surface_render_idx = 1;
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
207 } else {
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
208 renderer->info.flags |=
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
209 SDL_RENDERER_SINGLEBUFFER | SDL_RENDERER_PRESENTCOPY;
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
210 rdata->surfaces_count = 1;
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
211 rdata->surface_visible_idx = 0;
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
212 rdata->surface_render_idx = 0;
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
213 }
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
214 }
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
215 }
3092
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
216
3139
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
217 return renderer;
3092
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
218 }
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
219
3139
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
220 void
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
221 photon_addrenderdriver(_THIS)
3092
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
222 {
3139
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
223 uint32_t it;
3092
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
224
3139
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
225 for (it = 0; it < _this->num_displays; it++) {
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
226 SDL_AddRenderDriver(it, &photon_renderdriver);
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
227 }
3092
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
228 }
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
229
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
230 /****************************************************************************/
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
231 /* SDL render interface */
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
232 /****************************************************************************/
3139
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
233 static int
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
234 photon_displaymodechanged(SDL_Renderer * renderer)
3092
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
235 {
3139
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
236 SDL_RenderData *rdata = (SDL_RenderData *) renderer->driverdata;
3092
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
237
3139
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
238 /* 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:
diff changeset
239
3139
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
240 /* 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:
diff changeset
241
3139
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
242 return 0;
3092
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
243 }
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
244
3139
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
245 static int
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
246 photon_activaterenderer(SDL_Renderer * renderer)
3092
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
247 {
3139
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
248 SDL_RenderData *rdata = (SDL_RenderData *) renderer->driverdata;
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
249 SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(rdata->window);
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
250 SDL_DisplayData *didata = (SDL_DisplayData *) display->driverdata;
3092
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
251
3139
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
252 return 0;
3092
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
253 }
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
254
3139
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
255 static int
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
256 photon_createtexture(SDL_Renderer * renderer, SDL_Texture * texture)
3092
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
257 {
3139
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
258 SDL_RenderData *renderdata = (SDL_RenderData *) renderer->driverdata;
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
259 SDL_Window *window = SDL_GetWindowFromID(renderer->window);
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
260 SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window);
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
261 SDL_TextureData *tdata = NULL;
3092
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
262
3139
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
263 /* Allocate texture driver data */
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
264 tdata = (SDL_TextureData *) SDL_calloc(1, sizeof(SDL_TextureData));
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
265 if (tdata == NULL) {
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
266 SDL_OutOfMemory();
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
267 return -1;
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
268 }
3092
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
269
3139
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
270 /* Set texture driver data */
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
271 texture->driverdata = tdata;
3092
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
272
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
273 }
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
274
3139
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
275 static int
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
276 photon_querytexturepixels(SDL_Renderer * renderer, SDL_Texture * texture,
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
277 void **pixels, int *pitch)
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
278 {
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
279 }
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
280
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
281 static int
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
282 photon_settexturepalette(SDL_Renderer * renderer, SDL_Texture * texture,
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
283 const SDL_Color * colors, int firstcolor,
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
284 int ncolors)
3092
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
285 {
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
286 }
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
287
3139
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
288 static int
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
289 photon_gettexturepalette(SDL_Renderer * renderer, SDL_Texture * texture,
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
290 SDL_Color * colors, int firstcolor, int ncolors)
3092
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
291 {
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
292 }
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
293
3139
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
294 static int
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
295 photon_settexturecolormod(SDL_Renderer * renderer, SDL_Texture * texture)
3092
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
296 {
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
297 }
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
298
3139
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
299 static int
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
300 photon_settexturealphamod(SDL_Renderer * renderer, SDL_Texture * texture)
3092
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
301 {
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
302 }
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
303
3139
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
304 static int
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
305 photon_settextureblendmode(SDL_Renderer * renderer, SDL_Texture * texture)
3092
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
306 {
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
307 }
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
308
3139
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
309 static int
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
310 photon_settexturescalemode(SDL_Renderer * renderer, SDL_Texture * texture)
3092
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
311 {
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
312 }
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
313
3139
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
314 static int
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
315 photon_updatetexture(SDL_Renderer * renderer, SDL_Texture * texture,
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
316 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:
diff changeset
317 {
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
318 }
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
319
3139
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
320 static int
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
321 photon_locktexture(SDL_Renderer * renderer, SDL_Texture * texture,
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
322 const SDL_Rect * rect, int markDirty, void **pixels,
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
323 int *pitch)
3092
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
324 {
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
325 }
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
326
3139
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
327 static void
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
328 photon_unlocktexture(SDL_Renderer * renderer, SDL_Texture * texture)
3092
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
329 {
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
330 }
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
331
3139
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
332 static void
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
333 photon_dirtytexture(SDL_Renderer * renderer, SDL_Texture * texture,
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
334 int numrects, const SDL_Rect * rects)
3092
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
335 {
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
336 }
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
337
3139
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
338 static int
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
339 photon_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:
diff changeset
340 {
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
341 }
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
342
3139
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
343 static int
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
344 photon_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:
diff changeset
345 {
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
346 }
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
347
3139
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
348 static int
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
349 photon_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:
diff changeset
350 {
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
351 }
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
352
3139
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
353 static int
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
354 photon_rendercopy(SDL_Renderer * renderer, SDL_Texture * texture,
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
355 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:
diff changeset
356 {
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
357 }
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
358
3139
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
359 static void
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
360 photon_renderpresent(SDL_Renderer * renderer)
3092
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
361 {
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
362 }
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
363
3139
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
364 static void
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
365 photon_destroytexture(SDL_Renderer * renderer, SDL_Texture * texture)
3092
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
366 {
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
367 }
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
368
3139
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
369 static void
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
370 photon_destroyrenderer(SDL_Renderer * renderer)
3092
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
371 {
3139
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
372 SDL_RenderData *rdata = (SDL_RenderData *) renderer->driverdata;
Sam Lantinga <slouken@libsdl.org>
parents: 3108
diff changeset
373 uint32_t it;
3092
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
374
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
375 }
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
376
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
377 /* vi: set ts=4 sw=4 expandtab: */