Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
Advertise the most efficient format for the screen. Of course SDL cod…
Browse files Browse the repository at this point in the history
…e needs

to be fixed to handle framebuffers with alpha...
  • Loading branch information
slouken committed Aug 13, 2007
1 parent 4626c6a commit a21cc71
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 23 deletions.
24 changes: 3 additions & 21 deletions src/video/SDL_renderer_gl.c
Expand Up @@ -457,15 +457,9 @@ GL_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture)
type = GL_UNSIGNED_BYTE;
break;
case SDL_PIXELFORMAT_RGB888:
#ifdef __MACOSX__
internalFormat = GL_RGBA;
format = GL_BGRA;
type = GL_UNSIGNED_INT_8_8_8_8_REV;
#else
internalFormat = GL_RGB8;
format = GL_BGRA;
type = GL_UNSIGNED_BYTE;
#endif
break;
case SDL_PIXELFORMAT_BGR24:
internalFormat = GL_RGB8;
Expand Down Expand Up @@ -574,13 +568,14 @@ GL_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture)
renderdata->glTexParameteri(data->type, GL_TEXTURE_STORAGE_HINT_APPLE,
GL_STORAGE_CACHED_APPLE);
}
if (data->pixels && internalFormat == GL_RGBA && format == GL_BGRA
&& type == GL_UNSIGNED_INT_8_8_8_8_REV && data->pixels) {
if (texture->access == SDL_TEXTUREACCESS_STREAMING && texture->format == SDL_PIXELFORMAT_ARGB8888 ) {
/*
if (renderdata->glTextureRangeAPPLE) {
renderdata->glTextureRangeAPPLE(data->type,
texture->h * data->pitch,
data->pixels);
}
*/
renderdata->glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, GL_TRUE);
renderdata->glTexImage2D(data->type, 0, internalFormat, texture_w,
texture_h, 0, format, type, data->pixels);
Expand Down Expand Up @@ -806,19 +801,6 @@ GL_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture,
int bpp = SDL_BYTESPERPIXEL(texture->format);
int pitch = texturedata->pitch;

#ifdef __MACOSX__
if (texture->format == SDL_PIXELFORMAT_RGB888) {
int i;
Uint8 *p = (Uint8 *) texturedata->pixels;
#if SDL_BYTEORDER == SDL_LIL_ENDIAN
p += 3;
#endif
for (i = texture->h * pitch / 4; i--;) {
*p = 0xff;
p += 4;
}
}
#endif
SetupTextureUpdate(data, texture, pitch);
data->glBindTexture(texturedata->type, texturedata->texture);
for (dirty = texturedata->dirty.list; dirty; dirty = dirty->next) {
Expand Down
4 changes: 2 additions & 2 deletions src/video/cocoa/SDL_cocoamodes.m
Expand Up @@ -118,10 +118,10 @@ - (void) setFrame:(NSRect)frame;
mode->format = SDL_PIXELFORMAT_INDEX8;
break;
case 16:
mode->format = SDL_PIXELFORMAT_RGB555;
mode->format = SDL_PIXELFORMAT_ARGB1555;
break;
case 32:
mode->format = SDL_PIXELFORMAT_RGB888;
mode->format = SDL_PIXELFORMAT_ARGB8888;
break;
}
mode->w = width;
Expand Down

0 comments on commit a21cc71

Please sign in to comment.