changeset 3641:1e2e19d51265

Fixed iPhone build
author Sam Lantinga <slouken@libsdl.org>
date Wed, 13 Jan 2010 04:58:31 +0000
parents 58c1b9ec7074
children a10ad9826417
files Xcode-iPhoneOS/SDL/SDLiPhoneOS.xcodeproj/project.pbxproj src/video/SDL_renderer_gles.c
diffstat 2 files changed, 73 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/Xcode-iPhoneOS/SDL/SDLiPhoneOS.xcodeproj/project.pbxproj	Mon Jan 11 21:49:09 2010 +0000
+++ b/Xcode-iPhoneOS/SDL/SDLiPhoneOS.xcodeproj/project.pbxproj	Wed Jan 13 04:58:31 2010 +0000
@@ -34,6 +34,10 @@
 /* End PBXAggregateTarget section */
 
 /* Begin PBXBuildFile section */
+		043DD76F10FD8A0000DED673 /* SDL_alphamult.c in Sources */ = {isa = PBXBuildFile; fileRef = 043DD76B10FD8A0000DED673 /* SDL_alphamult.c */; };
+		043DD77010FD8A0000DED673 /* SDL_alphamult.h in Headers */ = {isa = PBXBuildFile; fileRef = 043DD76C10FD8A0000DED673 /* SDL_alphamult.h */; };
+		043DD77110FD8A0000DED673 /* SDL_blendfillrect.c in Sources */ = {isa = PBXBuildFile; fileRef = 043DD76D10FD8A0000DED673 /* SDL_blendfillrect.c */; };
+		043DD77210FD8A0000DED673 /* SDL_drawrect.c in Sources */ = {isa = PBXBuildFile; fileRef = 043DD76E10FD8A0000DED673 /* SDL_drawrect.c */; };
 		04461DEE0EA76BA3006C462D /* SDL_haptic.h in Headers */ = {isa = PBXBuildFile; fileRef = 04461DED0EA76BA3006C462D /* SDL_haptic.h */; settings = {ATTRIBUTES = (Public, ); }; };
 		0463873F0F0B5B7D0041FD65 /* SDL_blendline.c in Sources */ = {isa = PBXBuildFile; fileRef = 046387370F0B5B7D0041FD65 /* SDL_blendline.c */; };
 		046387400F0B5B7D0041FD65 /* SDL_blendpoint.c in Sources */ = {isa = PBXBuildFile; fileRef = 046387380F0B5B7D0041FD65 /* SDL_blendpoint.c */; };
@@ -207,6 +211,10 @@
 /* End PBXContainerItemProxy section */
 
 /* Begin PBXFileReference section */
+		043DD76B10FD8A0000DED673 /* SDL_alphamult.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_alphamult.c; sourceTree = "<group>"; };
+		043DD76C10FD8A0000DED673 /* SDL_alphamult.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_alphamult.h; sourceTree = "<group>"; };
+		043DD76D10FD8A0000DED673 /* SDL_blendfillrect.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_blendfillrect.c; sourceTree = "<group>"; };
+		043DD76E10FD8A0000DED673 /* SDL_drawrect.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_drawrect.c; sourceTree = "<group>"; };
 		04461DED0EA76BA3006C462D /* SDL_haptic.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_haptic.h; path = ../../include/SDL_haptic.h; sourceTree = SOURCE_ROOT; };
 		046387370F0B5B7D0041FD65 /* SDL_blendline.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_blendline.c; sourceTree = "<group>"; };
 		046387380F0B5B7D0041FD65 /* SDL_blendpoint.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_blendpoint.c; sourceTree = "<group>"; };
@@ -768,6 +776,9 @@
 				0495E6870E97408800152DFE /* SDL_renderer_gl.h */,
 				0495E6880E97408800152DFE /* SDL_renderer_gles.c */,
 				0495E6890E97408800152DFE /* SDL_renderer_gles.h */,
+				043DD76B10FD8A0000DED673 /* SDL_alphamult.c */,
+				043DD76C10FD8A0000DED673 /* SDL_alphamult.h */,
+				043DD76D10FD8A0000DED673 /* SDL_blendfillrect.c */,
 				046387370F0B5B7D0041FD65 /* SDL_blendline.c */,
 				046387380F0B5B7D0041FD65 /* SDL_blendpoint.c */,
 				046387390F0B5B7D0041FD65 /* SDL_blendrect.c */,
@@ -787,6 +798,7 @@
 				0463873B0F0B5B7D0041FD65 /* SDL_draw.h */,
 				0463873C0F0B5B7D0041FD65 /* SDL_drawline.c */,
 				0463873D0F0B5B7D0041FD65 /* SDL_drawpoint.c */,
+				043DD76E10FD8A0000DED673 /* SDL_drawrect.c */,
 				0463873E0F0B5B7D0041FD65 /* SDL_fillrect.c */,
 				FDA6830D0DF2374E00F98A1A /* SDL_gamma.c */,
 				FDA6830E0DF2374E00F98A1A /* SDL_leaks.h */,
@@ -903,6 +915,7 @@
 				04B2ECEE1025CE4800F9BC5F /* SDL_revision.h in Headers */,
 				04B2ED081025CF9E00F9BC5F /* SDL_config.h in Headers */,
 				04EC8B521025D12900431D42 /* SDL_config_iphoneos.h in Headers */,
+				043DD77010FD8A0000DED673 /* SDL_alphamult.h in Headers */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -1079,6 +1092,9 @@
 				046387450F0B5B7D0041FD65 /* SDL_drawpoint.c in Sources */,
 				046387460F0B5B7D0041FD65 /* SDL_fillrect.c in Sources */,
 				04B2ECFF1025CEB900F9BC5F /* SDL_atomic.c in Sources */,
+				043DD76F10FD8A0000DED673 /* SDL_alphamult.c in Sources */,
+				043DD77110FD8A0000DED673 /* SDL_blendfillrect.c in Sources */,
+				043DD77210FD8A0000DED673 /* SDL_drawrect.c in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
--- a/src/video/SDL_renderer_gles.c	Mon Jan 11 21:49:09 2010 +0000
+++ b/src/video/SDL_renderer_gles.c	Wed Jan 13 04:58:31 2010 +0000
@@ -85,12 +85,14 @@
                                SDL_Texture * texture);
 static void GLES_DirtyTexture(SDL_Renderer * renderer, SDL_Texture * texture,
                               int numrects, const SDL_Rect * rects);
-static int GLES_RenderPoints(SDL_Renderer * renderer, const SDL_Point * points,
-                             int count);
-static int GLES_RenderLines(SDL_Renderer * renderer, const SDL_Point * points,
-                            int count);
-static int GLES_RenderRects(SDL_Renderer * renderer, const SDL_Rect ** rects,
-                            int count);
+static int GLES_RenderDrawPoints(SDL_Renderer * renderer,
+                                 const SDL_Point * points, int count);
+static int GLES_RenderDrawLines(SDL_Renderer * renderer,
+                                const SDL_Point * points, int count);
+static int GLES_RenderDrawRects(SDL_Renderer * renderer,
+                                const SDL_Rect ** rects, int count);
+static int GLES_RenderFillRects(SDL_Renderer * renderer,
+                                const SDL_Rect ** rects, int count);
 static int GLES_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture,
                            const SDL_Rect * srcrect,
                            const SDL_Rect * dstrect);
@@ -244,9 +246,10 @@
     renderer->LockTexture = GLES_LockTexture;
     renderer->UnlockTexture = GLES_UnlockTexture;
     renderer->DirtyTexture = GLES_DirtyTexture;
-    renderer->RenderPoints = GLES_RenderPoints;
-    renderer->RenderLines = GLES_RenderLines;
-    renderer->RenderRects = GLES_RenderRects;
+    renderer->RenderDrawPoints = GLES_RenderDrawPoints;
+    renderer->RenderDrawLines = GLES_RenderDrawLines;
+    renderer->RenderDrawRects = GLES_RenderDrawRects;
+    renderer->RenderFillRects = GLES_RenderFillRects;
     renderer->RenderCopy = GLES_RenderCopy;
     renderer->RenderPresent = GLES_RenderPresent;
     renderer->DestroyTexture = GLES_DestroyTexture;
@@ -371,7 +374,6 @@
 GLES_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture)
 {
     GLES_RenderData *renderdata = (GLES_RenderData *) renderer->driverdata;
-    SDL_Window *window = SDL_GetWindowFromID(renderer->window);
     GLES_TextureData *data;
     GLint internalFormat;
     GLenum format, type;
@@ -643,7 +645,8 @@
 }
 
 static int
-GLES_RenderPoints(SDL_Renderer * renderer, const SDL_Point * points, int count)
+GLES_RenderDrawPoints(SDL_Renderer * renderer, const SDL_Point * points,
+                      int count)
 {
     GLES_RenderData *data = (GLES_RenderData *) renderer->driverdata;
     int i;
@@ -671,7 +674,8 @@
 }
 
 static int
-GLES_RenderLines(SDL_Renderer * renderer, const SDL_Point * points, int count)
+GLES_RenderDrawLines(SDL_Renderer * renderer, const SDL_Point * points,
+                     int count)
 {
     GLES_RenderData *data = (GLES_RenderData *) renderer->driverdata;
     int i;
@@ -706,7 +710,47 @@
 }
 
 static int
-GLES_RenderRects(SDL_Renderer * renderer, const SDL_Rect ** rects, int count)
+GLES_RenderDrawRects(SDL_Renderer * renderer, const SDL_Rect ** rects,
+                     int count)
+{
+    GLES_RenderData *data = (GLES_RenderData *) renderer->driverdata;
+    int i;
+
+    GLES_SetBlendMode(data, renderer->blendMode, 1);
+
+    data->glColor4f((GLfloat) renderer->r * inv255f,
+                    (GLfloat) renderer->g * inv255f,
+                    (GLfloat) renderer->b * inv255f,
+                    (GLfloat) renderer->a * inv255f);
+
+    data->glEnableClientState(GL_VERTEX_ARRAY);
+    for (i = 0; i < count; ++i) {
+        const SDL_Rect *rect = rects[i];
+        GLshort minx = rect->x;
+        GLshort maxx = rect->x + rect->w;
+        GLshort miny = rect->y;
+        GLshort maxy = rect->y + rect->h;
+        GLshort vertices[8];
+        vertices[0] = minx;
+        vertices[1] = miny;
+        vertices[2] = maxx;
+        vertices[3] = miny;
+        vertices[4] = minx;
+        vertices[5] = maxy;
+        vertices[6] = maxx;
+        vertices[7] = maxy;
+
+        data->glVertexPointer(2, GL_SHORT, 0, vertices);
+        data->glDrawArrays(GL_LINE_LOOP, 0, 4);
+    }
+    data->glDisableClientState(GL_VERTEX_ARRAY);
+
+    return 0;
+}
+
+static int
+GLES_RenderFillRects(SDL_Renderer * renderer, const SDL_Rect ** rects,
+                     int count)
 {
     GLES_RenderData *data = (GLES_RenderData *) renderer->driverdata;
     int i;
@@ -898,7 +942,6 @@
 static void
 GLES_DestroyTexture(SDL_Renderer * renderer, SDL_Texture * texture)
 {
-    GLES_RenderData *renderdata = (GLES_RenderData *) renderer->driverdata;
     GLES_TextureData *data = (GLES_TextureData *) texture->driverdata;
 
     if (!data) {