Mercurial > sdl-ios-xcode
annotate src/video/android/SDL_androidrender.c @ 5081:f2d8e0b59cca
Trying to close Andreas' branch again.
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Sun, 23 Jan 2011 22:34:19 -0800 |
parents | d40bb3165d2b |
children |
rev | line source |
---|---|
4701
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
1 /* |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
2 SDL - Simple DirectMedia Layer |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
3 Copyright (C) 1997-2010 Sam Lantinga |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
4 |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
5 This library is free software; you can redistribute it and/or |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
6 modify it under the terms of the GNU Lesser General Public |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
7 License as published by the Free Software Foundation; either |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
8 version 2.1 of the License, or (at your option) any later version. |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
9 |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
10 This library is distributed in the hope that it will be useful, |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
11 but WITHOUT ANY WARRANTY; without even the implied warranty of |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
13 Lesser General Public License for more details. |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
14 |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
15 You should have received a copy of the GNU Lesser General Public |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
16 License along with this library; if not, write to the Free Software |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
18 |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
19 Sam Lantinga |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
20 slouken@libsdl.org |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
21 */ |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
22 #include "SDL_config.h" |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
23 |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
24 #include "SDL_video.h" |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
25 #include "../SDL_sysvideo.h" |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
26 #include "../SDL_yuv_sw_c.h" |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
27 #include "../SDL_renderer_sw.h" |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
28 |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
29 |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
30 /* SDL surface based renderer implementation */ |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
31 |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
32 static SDL_Renderer *Android_CreateRenderer(SDL_Window * window, |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
33 Uint32 flags); |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
34 static int Android_RenderDrawPoints(SDL_Renderer * renderer, |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
35 const SDL_Point * points, int count); |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
36 static int Android_RenderDrawLines(SDL_Renderer * renderer, |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
37 const SDL_Point * points, int count); |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
38 static int Android_RenderDrawRects(SDL_Renderer * renderer, |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
39 const SDL_Rect ** rects, int count); |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
40 static int Android_RenderFillRects(SDL_Renderer * renderer, |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
41 const SDL_Rect ** rects, int count); |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
42 static int Android_RenderCopy(SDL_Renderer * renderer, |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
43 SDL_Texture * texture, |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
44 const SDL_Rect * srcrect, |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
45 const SDL_Rect * dstrect); |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
46 static int Android_RenderReadPixels(SDL_Renderer * renderer, |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
47 const SDL_Rect * rect, |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
48 Uint32 format, |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
49 void * pixels, int pitch); |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
50 static int Android_RenderWritePixels(SDL_Renderer * renderer, |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
51 const SDL_Rect * rect, |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
52 Uint32 format, |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
53 const void * pixels, int pitch); |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
54 static void Android_RenderPresent(SDL_Renderer * renderer); |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
55 static void Android_DestroyRenderer(SDL_Renderer * renderer); |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
56 |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
57 |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
58 SDL_RenderDriver Android_RenderDriver = { |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
59 Android_CreateRenderer, |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
60 { |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
61 "dummy", |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
62 (SDL_RENDERER_SINGLEBUFFER | SDL_RENDERER_PRESENTCOPY | |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
63 SDL_RENDERER_PRESENTFLIP2 | SDL_RENDERER_PRESENTFLIP3 | |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
64 SDL_RENDERER_PRESENTDISCARD), |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
65 } |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
66 }; |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
67 |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
68 typedef struct |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
69 { |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
70 int current_screen; |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
71 SDL_Surface *screens[3]; |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
72 } Android_RenderData; |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
73 |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
74 SDL_Renderer * |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
75 Android_CreateRenderer(SDL_Window * window, Uint32 flags) |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
76 { |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
77 SDL_VideoDisplay *display = window->display; |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
78 SDL_DisplayMode *displayMode = &display->current_mode; |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
79 SDL_Renderer *renderer; |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
80 Android_RenderData *data; |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
81 int i, n; |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
82 int bpp; |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
83 Uint32 Rmask, Gmask, Bmask, Amask; |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
84 |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
85 if (!SDL_PixelFormatEnumToMasks |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
86 (displayMode->format, &bpp, &Rmask, &Gmask, &Bmask, &Amask)) { |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
87 SDL_SetError("Unknown display format"); |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
88 return NULL; |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
89 } |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
90 |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
91 renderer = (SDL_Renderer *) SDL_calloc(1, sizeof(*renderer)); |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
92 if (!renderer) { |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
93 SDL_OutOfMemory(); |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
94 return NULL; |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
95 } |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
96 |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
97 data = (Android_RenderData *) SDL_malloc(sizeof(*data)); |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
98 if (!data) { |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
99 Android_DestroyRenderer(renderer); |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
100 SDL_OutOfMemory(); |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
101 return NULL; |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
102 } |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
103 SDL_zerop(data); |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
104 |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
105 renderer->RenderDrawPoints = Android_RenderDrawPoints; |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
106 renderer->RenderDrawLines = Android_RenderDrawLines; |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
107 renderer->RenderDrawRects = Android_RenderDrawRects; |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
108 renderer->RenderFillRects = Android_RenderFillRects; |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
109 renderer->RenderCopy = Android_RenderCopy; |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
110 renderer->RenderReadPixels = Android_RenderReadPixels; |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
111 renderer->RenderWritePixels = Android_RenderWritePixels; |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
112 renderer->RenderPresent = Android_RenderPresent; |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
113 renderer->DestroyRenderer = Android_DestroyRenderer; |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
114 renderer->info.name = Android_RenderDriver.info.name; |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
115 renderer->info.flags = 0; |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
116 renderer->window = window; |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
117 renderer->driverdata = data; |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
118 Setup_SoftwareRenderer(renderer); |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
119 |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
120 if (flags & SDL_RENDERER_PRESENTFLIP2) { |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
121 renderer->info.flags |= SDL_RENDERER_PRESENTFLIP2; |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
122 n = 2; |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
123 } else if (flags & SDL_RENDERER_PRESENTFLIP3) { |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
124 renderer->info.flags |= SDL_RENDERER_PRESENTFLIP3; |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
125 n = 3; |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
126 } else { |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
127 renderer->info.flags |= SDL_RENDERER_PRESENTCOPY; |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
128 n = 1; |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
129 } |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
130 for (i = 0; i < n; ++i) { |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
131 data->screens[i] = |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
132 SDL_CreateRGBSurface(0, window->w, window->h, bpp, Rmask, Gmask, |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
133 Bmask, Amask); |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
134 if (!data->screens[i]) { |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
135 Android_DestroyRenderer(renderer); |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
136 return NULL; |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
137 } |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
138 SDL_SetSurfacePalette(data->screens[i], display->palette); |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
139 } |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
140 data->current_screen = 0; |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
141 |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
142 return renderer; |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
143 } |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
144 |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
145 static int |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
146 Android_RenderDrawPoints(SDL_Renderer * renderer, |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
147 const SDL_Point * points, int count) |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
148 { |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
149 Android_RenderData *data = |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
150 (Android_RenderData *) renderer->driverdata; |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
151 SDL_Surface *target = data->screens[data->current_screen]; |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
152 |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
153 if (renderer->blendMode == SDL_BLENDMODE_NONE || |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
154 renderer->blendMode == SDL_BLENDMODE_MASK) { |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
155 Uint32 color = SDL_MapRGBA(target->format, |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
156 renderer->r, renderer->g, renderer->b, |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
157 renderer->a); |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
158 |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
159 return SDL_DrawPoints(target, points, count, color); |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
160 } else { |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
161 return SDL_BlendPoints(target, points, count, renderer->blendMode, |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
162 renderer->r, renderer->g, renderer->b, |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
163 renderer->a); |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
164 } |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
165 } |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
166 |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
167 static int |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
168 Android_RenderDrawLines(SDL_Renderer * renderer, |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
169 const SDL_Point * points, int count) |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
170 { |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
171 Android_RenderData *data = |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
172 (Android_RenderData *) renderer->driverdata; |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
173 SDL_Surface *target = data->screens[data->current_screen]; |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
174 |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
175 if (renderer->blendMode == SDL_BLENDMODE_NONE || |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
176 renderer->blendMode == SDL_BLENDMODE_MASK) { |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
177 Uint32 color = SDL_MapRGBA(target->format, |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
178 renderer->r, renderer->g, renderer->b, |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
179 renderer->a); |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
180 |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
181 return SDL_DrawLines(target, points, count, color); |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
182 } else { |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
183 return SDL_BlendLines(target, points, count, renderer->blendMode, |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
184 renderer->r, renderer->g, renderer->b, |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
185 renderer->a); |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
186 } |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
187 } |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
188 |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
189 static int |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
190 Android_RenderDrawRects(SDL_Renderer * renderer, const SDL_Rect ** rects, |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
191 int count) |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
192 { |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
193 Android_RenderData *data = |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
194 (Android_RenderData *) renderer->driverdata; |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
195 SDL_Surface *target = data->screens[data->current_screen]; |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
196 |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
197 if (renderer->blendMode == SDL_BLENDMODE_NONE || |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
198 renderer->blendMode == SDL_BLENDMODE_MASK) { |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
199 Uint32 color = SDL_MapRGBA(target->format, |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
200 renderer->r, renderer->g, renderer->b, |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
201 renderer->a); |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
202 |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
203 return SDL_DrawRects(target, rects, count, color); |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
204 } else { |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
205 return SDL_BlendRects(target, rects, count, |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
206 renderer->blendMode, |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
207 renderer->r, renderer->g, renderer->b, |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
208 renderer->a); |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
209 } |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
210 } |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
211 |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
212 static int |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
213 Android_RenderFillRects(SDL_Renderer * renderer, const SDL_Rect ** rects, |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
214 int count) |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
215 { |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
216 Android_RenderData *data = |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
217 (Android_RenderData *) renderer->driverdata; |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
218 SDL_Surface *target = data->screens[data->current_screen]; |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
219 |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
220 if (renderer->blendMode == SDL_BLENDMODE_NONE || |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
221 renderer->blendMode == SDL_BLENDMODE_MASK) { |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
222 Uint32 color = SDL_MapRGBA(target->format, |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
223 renderer->r, renderer->g, renderer->b, |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
224 renderer->a); |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
225 |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
226 return SDL_FillRects(target, rects, count, color); |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
227 } else { |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
228 return SDL_BlendFillRects(target, rects, count, |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
229 renderer->blendMode, |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
230 renderer->r, renderer->g, renderer->b, |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
231 renderer->a); |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
232 } |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
233 } |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
234 |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
235 static int |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
236 Android_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture, |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
237 const SDL_Rect * srcrect, const SDL_Rect * dstrect) |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
238 { |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
239 Android_RenderData *data = |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
240 (Android_RenderData *) renderer->driverdata; |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
241 SDL_Window *window = renderer->window; |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
242 SDL_VideoDisplay *display = window->display; |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
243 |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
244 if (SDL_ISPIXELFORMAT_FOURCC(texture->format)) { |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
245 SDL_Surface *target = data->screens[data->current_screen]; |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
246 void *pixels = |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
247 (Uint8 *) target->pixels + dstrect->y * target->pitch + |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
248 dstrect->x * target->format->BytesPerPixel; |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
249 return SDL_SW_CopyYUVToRGB((SDL_SW_YUVTexture *) texture->driverdata, |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
250 srcrect, display->current_mode.format, |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
251 dstrect->w, dstrect->h, pixels, |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
252 target->pitch); |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
253 } else { |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
254 SDL_Surface *surface = (SDL_Surface *) texture->driverdata; |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
255 SDL_Surface *target = data->screens[data->current_screen]; |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
256 SDL_Rect real_srcrect = *srcrect; |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
257 SDL_Rect real_dstrect = *dstrect; |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
258 |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
259 return SDL_LowerBlit(surface, &real_srcrect, target, &real_dstrect); |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
260 } |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
261 } |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
262 |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
263 static int |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
264 Android_RenderReadPixels(SDL_Renderer * renderer, const SDL_Rect * rect, |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
265 Uint32 format, void * pixels, int pitch) |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
266 { |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
267 Android_RenderData *data = |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
268 (Android_RenderData *) renderer->driverdata; |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
269 SDL_Window *window = renderer->window; |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
270 SDL_VideoDisplay *display = window->display; |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
271 SDL_Surface *screen = data->screens[data->current_screen]; |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
272 Uint32 screen_format = display->current_mode.format; |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
273 Uint8 *screen_pixels = (Uint8 *) screen->pixels + |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
274 rect->y * screen->pitch + |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
275 rect->x * screen->format->BytesPerPixel; |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
276 int screen_pitch = screen->pitch; |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
277 |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
278 return SDL_ConvertPixels(rect->w, rect->h, |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
279 screen_format, screen_pixels, screen_pitch, |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
280 format, pixels, pitch); |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
281 } |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
282 |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
283 static int |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
284 Android_RenderWritePixels(SDL_Renderer * renderer, const SDL_Rect * rect, |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
285 Uint32 format, const void * pixels, int pitch) |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
286 { |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
287 Android_RenderData *data = |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
288 (Android_RenderData *) renderer->driverdata; |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
289 SDL_Window *window = renderer->window; |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
290 SDL_VideoDisplay *display = window->display; |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
291 SDL_Surface *screen = data->screens[data->current_screen]; |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
292 Uint32 screen_format = display->current_mode.format; |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
293 Uint8 *screen_pixels = (Uint8 *) screen->pixels + |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
294 rect->y * screen->pitch + |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
295 rect->x * screen->format->BytesPerPixel; |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
296 int screen_pitch = screen->pitch; |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
297 |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
298 return SDL_ConvertPixels(rect->w, rect->h, |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
299 format, pixels, pitch, |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
300 screen_format, screen_pixels, screen_pitch); |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
301 } |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
302 |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
303 static void |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
304 Android_RenderPresent(SDL_Renderer * renderer) |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
305 { |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
306 static int frame_number; |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
307 Android_RenderData *data = |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
308 (Android_RenderData *) renderer->driverdata; |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
309 |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
310 /* Send the data to the display */ |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
311 if (SDL_getenv("SDL_VIDEO_DUMMY_SAVE_FRAMES")) { |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
312 char file[128]; |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
313 SDL_snprintf(file, sizeof(file), "SDL_window%d-%8.8d.bmp", |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
314 renderer->window->id, ++frame_number); |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
315 SDL_SaveBMP(data->screens[data->current_screen], file); |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
316 } |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
317 |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
318 /* Update the flipping chain, if any */ |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
319 if (renderer->info.flags & SDL_RENDERER_PRESENTFLIP2) { |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
320 data->current_screen = (data->current_screen + 1) % 2; |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
321 } else if (renderer->info.flags & SDL_RENDERER_PRESENTFLIP3) { |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
322 data->current_screen = (data->current_screen + 1) % 3; |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
323 } |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
324 } |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
325 |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
326 static void |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
327 Android_DestroyRenderer(SDL_Renderer * renderer) |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
328 { |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
329 Android_RenderData *data = |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
330 (Android_RenderData *) renderer->driverdata; |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
331 int i; |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
332 |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
333 if (data) { |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
334 for (i = 0; i < SDL_arraysize(data->screens); ++i) { |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
335 if (data->screens[i]) { |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
336 SDL_FreeSurface(data->screens[i]); |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
337 } |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
338 } |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
339 SDL_free(data); |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
340 } |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
341 SDL_free(renderer); |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
342 } |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
343 |
d40bb3165d2b
Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff
changeset
|
344 /* vi: set ts=4 sw=4 expandtab: */ |