Fixed iPhone build
authorSam Lantinga <slouken@libsdl.org>
Wed, 13 Jan 2010 04:58:31 +0000
changeset 36411e2e19d51265
parent 3640 58c1b9ec7074
child 3642 a10ad9826417
Fixed iPhone build
Xcode-iPhoneOS/SDL/SDLiPhoneOS.xcodeproj/project.pbxproj
src/video/SDL_renderer_gles.c
     1.1 --- a/Xcode-iPhoneOS/SDL/SDLiPhoneOS.xcodeproj/project.pbxproj	Mon Jan 11 21:49:09 2010 +0000
     1.2 +++ b/Xcode-iPhoneOS/SDL/SDLiPhoneOS.xcodeproj/project.pbxproj	Wed Jan 13 04:58:31 2010 +0000
     1.3 @@ -34,6 +34,10 @@
     1.4  /* End PBXAggregateTarget section */
     1.5  
     1.6  /* Begin PBXBuildFile section */
     1.7 +		043DD76F10FD8A0000DED673 /* SDL_alphamult.c in Sources */ = {isa = PBXBuildFile; fileRef = 043DD76B10FD8A0000DED673 /* SDL_alphamult.c */; };
     1.8 +		043DD77010FD8A0000DED673 /* SDL_alphamult.h in Headers */ = {isa = PBXBuildFile; fileRef = 043DD76C10FD8A0000DED673 /* SDL_alphamult.h */; };
     1.9 +		043DD77110FD8A0000DED673 /* SDL_blendfillrect.c in Sources */ = {isa = PBXBuildFile; fileRef = 043DD76D10FD8A0000DED673 /* SDL_blendfillrect.c */; };
    1.10 +		043DD77210FD8A0000DED673 /* SDL_drawrect.c in Sources */ = {isa = PBXBuildFile; fileRef = 043DD76E10FD8A0000DED673 /* SDL_drawrect.c */; };
    1.11  		04461DEE0EA76BA3006C462D /* SDL_haptic.h in Headers */ = {isa = PBXBuildFile; fileRef = 04461DED0EA76BA3006C462D /* SDL_haptic.h */; settings = {ATTRIBUTES = (Public, ); }; };
    1.12  		0463873F0F0B5B7D0041FD65 /* SDL_blendline.c in Sources */ = {isa = PBXBuildFile; fileRef = 046387370F0B5B7D0041FD65 /* SDL_blendline.c */; };
    1.13  		046387400F0B5B7D0041FD65 /* SDL_blendpoint.c in Sources */ = {isa = PBXBuildFile; fileRef = 046387380F0B5B7D0041FD65 /* SDL_blendpoint.c */; };
    1.14 @@ -207,6 +211,10 @@
    1.15  /* End PBXContainerItemProxy section */
    1.16  
    1.17  /* Begin PBXFileReference section */
    1.18 +		043DD76B10FD8A0000DED673 /* SDL_alphamult.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_alphamult.c; sourceTree = "<group>"; };
    1.19 +		043DD76C10FD8A0000DED673 /* SDL_alphamult.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_alphamult.h; sourceTree = "<group>"; };
    1.20 +		043DD76D10FD8A0000DED673 /* SDL_blendfillrect.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_blendfillrect.c; sourceTree = "<group>"; };
    1.21 +		043DD76E10FD8A0000DED673 /* SDL_drawrect.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_drawrect.c; sourceTree = "<group>"; };
    1.22  		04461DED0EA76BA3006C462D /* SDL_haptic.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_haptic.h; path = ../../include/SDL_haptic.h; sourceTree = SOURCE_ROOT; };
    1.23  		046387370F0B5B7D0041FD65 /* SDL_blendline.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_blendline.c; sourceTree = "<group>"; };
    1.24  		046387380F0B5B7D0041FD65 /* SDL_blendpoint.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_blendpoint.c; sourceTree = "<group>"; };
    1.25 @@ -768,6 +776,9 @@
    1.26  				0495E6870E97408800152DFE /* SDL_renderer_gl.h */,
    1.27  				0495E6880E97408800152DFE /* SDL_renderer_gles.c */,
    1.28  				0495E6890E97408800152DFE /* SDL_renderer_gles.h */,
    1.29 +				043DD76B10FD8A0000DED673 /* SDL_alphamult.c */,
    1.30 +				043DD76C10FD8A0000DED673 /* SDL_alphamult.h */,
    1.31 +				043DD76D10FD8A0000DED673 /* SDL_blendfillrect.c */,
    1.32  				046387370F0B5B7D0041FD65 /* SDL_blendline.c */,
    1.33  				046387380F0B5B7D0041FD65 /* SDL_blendpoint.c */,
    1.34  				046387390F0B5B7D0041FD65 /* SDL_blendrect.c */,
    1.35 @@ -787,6 +798,7 @@
    1.36  				0463873B0F0B5B7D0041FD65 /* SDL_draw.h */,
    1.37  				0463873C0F0B5B7D0041FD65 /* SDL_drawline.c */,
    1.38  				0463873D0F0B5B7D0041FD65 /* SDL_drawpoint.c */,
    1.39 +				043DD76E10FD8A0000DED673 /* SDL_drawrect.c */,
    1.40  				0463873E0F0B5B7D0041FD65 /* SDL_fillrect.c */,
    1.41  				FDA6830D0DF2374E00F98A1A /* SDL_gamma.c */,
    1.42  				FDA6830E0DF2374E00F98A1A /* SDL_leaks.h */,
    1.43 @@ -903,6 +915,7 @@
    1.44  				04B2ECEE1025CE4800F9BC5F /* SDL_revision.h in Headers */,
    1.45  				04B2ED081025CF9E00F9BC5F /* SDL_config.h in Headers */,
    1.46  				04EC8B521025D12900431D42 /* SDL_config_iphoneos.h in Headers */,
    1.47 +				043DD77010FD8A0000DED673 /* SDL_alphamult.h in Headers */,
    1.48  			);
    1.49  			runOnlyForDeploymentPostprocessing = 0;
    1.50  		};
    1.51 @@ -1079,6 +1092,9 @@
    1.52  				046387450F0B5B7D0041FD65 /* SDL_drawpoint.c in Sources */,
    1.53  				046387460F0B5B7D0041FD65 /* SDL_fillrect.c in Sources */,
    1.54  				04B2ECFF1025CEB900F9BC5F /* SDL_atomic.c in Sources */,
    1.55 +				043DD76F10FD8A0000DED673 /* SDL_alphamult.c in Sources */,
    1.56 +				043DD77110FD8A0000DED673 /* SDL_blendfillrect.c in Sources */,
    1.57 +				043DD77210FD8A0000DED673 /* SDL_drawrect.c in Sources */,
    1.58  			);
    1.59  			runOnlyForDeploymentPostprocessing = 0;
    1.60  		};
     2.1 --- a/src/video/SDL_renderer_gles.c	Mon Jan 11 21:49:09 2010 +0000
     2.2 +++ b/src/video/SDL_renderer_gles.c	Wed Jan 13 04:58:31 2010 +0000
     2.3 @@ -85,12 +85,14 @@
     2.4                                 SDL_Texture * texture);
     2.5  static void GLES_DirtyTexture(SDL_Renderer * renderer, SDL_Texture * texture,
     2.6                                int numrects, const SDL_Rect * rects);
     2.7 -static int GLES_RenderPoints(SDL_Renderer * renderer, const SDL_Point * points,
     2.8 -                             int count);
     2.9 -static int GLES_RenderLines(SDL_Renderer * renderer, const SDL_Point * points,
    2.10 -                            int count);
    2.11 -static int GLES_RenderRects(SDL_Renderer * renderer, const SDL_Rect ** rects,
    2.12 -                            int count);
    2.13 +static int GLES_RenderDrawPoints(SDL_Renderer * renderer,
    2.14 +                                 const SDL_Point * points, int count);
    2.15 +static int GLES_RenderDrawLines(SDL_Renderer * renderer,
    2.16 +                                const SDL_Point * points, int count);
    2.17 +static int GLES_RenderDrawRects(SDL_Renderer * renderer,
    2.18 +                                const SDL_Rect ** rects, int count);
    2.19 +static int GLES_RenderFillRects(SDL_Renderer * renderer,
    2.20 +                                const SDL_Rect ** rects, int count);
    2.21  static int GLES_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture,
    2.22                             const SDL_Rect * srcrect,
    2.23                             const SDL_Rect * dstrect);
    2.24 @@ -244,9 +246,10 @@
    2.25      renderer->LockTexture = GLES_LockTexture;
    2.26      renderer->UnlockTexture = GLES_UnlockTexture;
    2.27      renderer->DirtyTexture = GLES_DirtyTexture;
    2.28 -    renderer->RenderPoints = GLES_RenderPoints;
    2.29 -    renderer->RenderLines = GLES_RenderLines;
    2.30 -    renderer->RenderRects = GLES_RenderRects;
    2.31 +    renderer->RenderDrawPoints = GLES_RenderDrawPoints;
    2.32 +    renderer->RenderDrawLines = GLES_RenderDrawLines;
    2.33 +    renderer->RenderDrawRects = GLES_RenderDrawRects;
    2.34 +    renderer->RenderFillRects = GLES_RenderFillRects;
    2.35      renderer->RenderCopy = GLES_RenderCopy;
    2.36      renderer->RenderPresent = GLES_RenderPresent;
    2.37      renderer->DestroyTexture = GLES_DestroyTexture;
    2.38 @@ -371,7 +374,6 @@
    2.39  GLES_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture)
    2.40  {
    2.41      GLES_RenderData *renderdata = (GLES_RenderData *) renderer->driverdata;
    2.42 -    SDL_Window *window = SDL_GetWindowFromID(renderer->window);
    2.43      GLES_TextureData *data;
    2.44      GLint internalFormat;
    2.45      GLenum format, type;
    2.46 @@ -643,7 +645,8 @@
    2.47  }
    2.48  
    2.49  static int
    2.50 -GLES_RenderPoints(SDL_Renderer * renderer, const SDL_Point * points, int count)
    2.51 +GLES_RenderDrawPoints(SDL_Renderer * renderer, const SDL_Point * points,
    2.52 +                      int count)
    2.53  {
    2.54      GLES_RenderData *data = (GLES_RenderData *) renderer->driverdata;
    2.55      int i;
    2.56 @@ -671,7 +674,8 @@
    2.57  }
    2.58  
    2.59  static int
    2.60 -GLES_RenderLines(SDL_Renderer * renderer, const SDL_Point * points, int count)
    2.61 +GLES_RenderDrawLines(SDL_Renderer * renderer, const SDL_Point * points,
    2.62 +                     int count)
    2.63  {
    2.64      GLES_RenderData *data = (GLES_RenderData *) renderer->driverdata;
    2.65      int i;
    2.66 @@ -706,7 +710,47 @@
    2.67  }
    2.68  
    2.69  static int
    2.70 -GLES_RenderRects(SDL_Renderer * renderer, const SDL_Rect ** rects, int count)
    2.71 +GLES_RenderDrawRects(SDL_Renderer * renderer, const SDL_Rect ** rects,
    2.72 +                     int count)
    2.73 +{
    2.74 +    GLES_RenderData *data = (GLES_RenderData *) renderer->driverdata;
    2.75 +    int i;
    2.76 +
    2.77 +    GLES_SetBlendMode(data, renderer->blendMode, 1);
    2.78 +
    2.79 +    data->glColor4f((GLfloat) renderer->r * inv255f,
    2.80 +                    (GLfloat) renderer->g * inv255f,
    2.81 +                    (GLfloat) renderer->b * inv255f,
    2.82 +                    (GLfloat) renderer->a * inv255f);
    2.83 +
    2.84 +    data->glEnableClientState(GL_VERTEX_ARRAY);
    2.85 +    for (i = 0; i < count; ++i) {
    2.86 +        const SDL_Rect *rect = rects[i];
    2.87 +        GLshort minx = rect->x;
    2.88 +        GLshort maxx = rect->x + rect->w;
    2.89 +        GLshort miny = rect->y;
    2.90 +        GLshort maxy = rect->y + rect->h;
    2.91 +        GLshort vertices[8];
    2.92 +        vertices[0] = minx;
    2.93 +        vertices[1] = miny;
    2.94 +        vertices[2] = maxx;
    2.95 +        vertices[3] = miny;
    2.96 +        vertices[4] = minx;
    2.97 +        vertices[5] = maxy;
    2.98 +        vertices[6] = maxx;
    2.99 +        vertices[7] = maxy;
   2.100 +
   2.101 +        data->glVertexPointer(2, GL_SHORT, 0, vertices);
   2.102 +        data->glDrawArrays(GL_LINE_LOOP, 0, 4);
   2.103 +    }
   2.104 +    data->glDisableClientState(GL_VERTEX_ARRAY);
   2.105 +
   2.106 +    return 0;
   2.107 +}
   2.108 +
   2.109 +static int
   2.110 +GLES_RenderFillRects(SDL_Renderer * renderer, const SDL_Rect ** rects,
   2.111 +                     int count)
   2.112  {
   2.113      GLES_RenderData *data = (GLES_RenderData *) renderer->driverdata;
   2.114      int i;
   2.115 @@ -898,7 +942,6 @@
   2.116  static void
   2.117  GLES_DestroyTexture(SDL_Renderer * renderer, SDL_Texture * texture)
   2.118  {
   2.119 -    GLES_RenderData *renderdata = (GLES_RenderData *) renderer->driverdata;
   2.120      GLES_TextureData *data = (GLES_TextureData *) texture->driverdata;
   2.121  
   2.122      if (!data) {