annotate src/video/android/SDL_androidgl.c @ 4898:164bee619400

XDamageDestroy is called before use_damage is tested. This crashes on my setup. The patch calls XDamageDestroy only when use_damage is true. Kind regards, André
author Sam Lantinga <slouken@libsdl.org>
date Mon, 27 Sep 2010 00:49:56 -0700
parents faa228f7ce5b
children 16fec41375a6
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 /* Android SDL video driver implementation
d40bb3165d2b Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff changeset
25 */
d40bb3165d2b Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff changeset
26
d40bb3165d2b Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff changeset
27 #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
28 #include "SDL_mouse.h"
d40bb3165d2b Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff changeset
29 #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
30 #include "../SDL_pixels_c.h"
d40bb3165d2b Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff changeset
31 #include "../../events/SDL_events_c.h"
d40bb3165d2b Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff changeset
32
d40bb3165d2b Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff changeset
33 #include "SDL_androidvideo.h"
4703
c93b44ddc63e Fixed #includes to fix naming conventions
Paul Hunkin <paul@bieh.net>
parents: 4701
diff changeset
34 #include "SDL_androidevents.h"
c93b44ddc63e Fixed #includes to fix naming conventions
Paul Hunkin <paul@bieh.net>
parents: 4701
diff changeset
35 #include "SDL_androidrender.h"
4701
d40bb3165d2b Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff changeset
36
4707
8b109f0dcd2f Removed old video subsystem, along with (now-unncessary) egl files.
Paul Hunkin <paul@bieh.net>
parents: 4703
diff changeset
37 #include <android/log.h>
4701
d40bb3165d2b Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff changeset
38
4709
6dc26b9d8368 Tweaks to the libsdl side
Paul Hunkin <paul@bieh.net>
parents: 4707
diff changeset
39 #include <pthread.h>
4701
d40bb3165d2b Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff changeset
40
4707
8b109f0dcd2f Removed old video subsystem, along with (now-unncessary) egl files.
Paul Hunkin <paul@bieh.net>
parents: 4703
diff changeset
41 /*
8b109f0dcd2f Removed old video subsystem, along with (now-unncessary) egl files.
Paul Hunkin <paul@bieh.net>
parents: 4703
diff changeset
42 These things are in the JNI android support
8b109f0dcd2f Removed old video subsystem, along with (now-unncessary) egl files.
Paul Hunkin <paul@bieh.net>
parents: 4703
diff changeset
43 */
4722
faa228f7ce5b - Cleaned up a bunch of code
Paul Hunkin <paul@bieh.net>
parents: 4711
diff changeset
44 extern void Android_CreateContext();
faa228f7ce5b - Cleaned up a bunch of code
Paul Hunkin <paul@bieh.net>
parents: 4711
diff changeset
45 extern void Android_Render();
4701
d40bb3165d2b Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff changeset
46
d40bb3165d2b Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff changeset
47 /* GL functions */
d40bb3165d2b Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff changeset
48 int Android_GL_LoadLibrary(_THIS, const char *path){
4707
8b109f0dcd2f Removed old video subsystem, along with (now-unncessary) egl files.
Paul Hunkin <paul@bieh.net>
parents: 4703
diff changeset
49 __android_log_print(ANDROID_LOG_INFO, "SDL", "[STUB] GL_LoadLibrary\n");
4701
d40bb3165d2b Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff changeset
50 return 0;
d40bb3165d2b Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff changeset
51 }
d40bb3165d2b Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff changeset
52
d40bb3165d2b Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff changeset
53 void *Android_GL_GetProcAddress(_THIS, const char *proc){
4707
8b109f0dcd2f Removed old video subsystem, along with (now-unncessary) egl files.
Paul Hunkin <paul@bieh.net>
parents: 4703
diff changeset
54 __android_log_print(ANDROID_LOG_INFO, "SDL", "[STUB] GL_GetProcAddress\n");
4701
d40bb3165d2b Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff changeset
55 return 0;
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 void Android_GL_UnloadLibrary(_THIS){
4707
8b109f0dcd2f Removed old video subsystem, along with (now-unncessary) egl files.
Paul Hunkin <paul@bieh.net>
parents: 4703
diff changeset
59 __android_log_print(ANDROID_LOG_INFO, "SDL", "[STUB] GL_UnloadLibrary\n");
4701
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
d40bb3165d2b Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff changeset
62 /*
d40bb3165d2b Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff changeset
63 int *Android_GL_GetVisual(_THIS, Display * display, int screen){
4707
8b109f0dcd2f Removed old video subsystem, along with (now-unncessary) egl files.
Paul Hunkin <paul@bieh.net>
parents: 4703
diff changeset
64 __android_log_print(ANDROID_LOG_INFO, "SDL","[STUB] GL_GetVisual\n");
4701
d40bb3165d2b Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff changeset
65 return 0;
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
d40bb3165d2b Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff changeset
69 SDL_GLContext Android_GL_CreateContext(_THIS, SDL_Window * window){
4722
faa228f7ce5b - Cleaned up a bunch of code
Paul Hunkin <paul@bieh.net>
parents: 4711
diff changeset
70 Android_CreateContext();
4709
6dc26b9d8368 Tweaks to the libsdl side
Paul Hunkin <paul@bieh.net>
parents: 4707
diff changeset
71 return 1;
4701
d40bb3165d2b Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff changeset
72 }
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 int Android_GL_MakeCurrent(_THIS, SDL_Window * window,
d40bb3165d2b Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff changeset
75 SDL_GLContext context){
4707
8b109f0dcd2f Removed old video subsystem, along with (now-unncessary) egl files.
Paul Hunkin <paul@bieh.net>
parents: 4703
diff changeset
76 __android_log_print(ANDROID_LOG_INFO, "SDL", "[STUB] GL_MakeCurrent\n");
4701
d40bb3165d2b Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff changeset
77 return 0;
d40bb3165d2b Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff changeset
78 }
d40bb3165d2b Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff changeset
79
d40bb3165d2b Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff changeset
80 int Android_GL_SetSwapInterval(_THIS, int interval){
4707
8b109f0dcd2f Removed old video subsystem, along with (now-unncessary) egl files.
Paul Hunkin <paul@bieh.net>
parents: 4703
diff changeset
81 __android_log_print(ANDROID_LOG_INFO, "SDL", "[STUB] GL_SetSwapInterval\n");
4701
d40bb3165d2b Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff changeset
82 return 0;
d40bb3165d2b Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff changeset
83 }
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 int Android_GL_GetSwapInterval(_THIS){
4707
8b109f0dcd2f Removed old video subsystem, along with (now-unncessary) egl files.
Paul Hunkin <paul@bieh.net>
parents: 4703
diff changeset
86 __android_log_print(ANDROID_LOG_INFO, "SDL", "[STUB] GL_GetSwapInterval\n");
4701
d40bb3165d2b Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff changeset
87 return 0;
d40bb3165d2b Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff changeset
88 }
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 void Android_GL_SwapWindow(_THIS, SDL_Window * window){
4722
faa228f7ce5b - Cleaned up a bunch of code
Paul Hunkin <paul@bieh.net>
parents: 4711
diff changeset
91 Android_Render();
4701
d40bb3165d2b Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff changeset
92 }
d40bb3165d2b Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff changeset
93
d40bb3165d2b Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff changeset
94 void Android_GL_DeleteContext(_THIS, SDL_GLContext context){
4707
8b109f0dcd2f Removed old video subsystem, along with (now-unncessary) egl files.
Paul Hunkin <paul@bieh.net>
parents: 4703
diff changeset
95 __android_log_print(ANDROID_LOG_INFO, "SDL", "[STUB] GL_DeleteContext\n");
4701
d40bb3165d2b Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff changeset
96 }