comparison src/video/SDL_surface.c @ 1678:90bf530ced8e SDL-1.3

SDL_SetVideoMode() compiles now...
author Sam Lantinga <slouken@libsdl.org>
date Wed, 14 Jun 2006 06:14:26 +0000
parents 8e754b82cecc
children 7ae8018b2e5d
comparison
equal deleted inserted replaced
1677:5e4c5e095925 1678:90bf530ced8e
132 SDL_Surface *surface; 132 SDL_Surface *surface;
133 Uint32 format; 133 Uint32 format;
134 int w, h; 134 int w, h;
135 int bpp; 135 int bpp;
136 Uint32 Rmask, Gmask, Bmask, Amask; 136 Uint32 Rmask, Gmask, Bmask, Amask;
137 void *pixels;
138 int pitch;
137 139
138 if (SDL_QueryTexture(textureID, &format, NULL, &w, &h) < 0) { 140 if (SDL_QueryTexture(textureID, &format, NULL, &w, &h) < 0) {
139 return NULL; 141 return NULL;
140 } 142 }
141 143
143 (format, &bpp, &Rmask, &Gmask, &Bmask, &Amask)) { 145 (format, &bpp, &Rmask, &Gmask, &Bmask, &Amask)) {
144 SDL_SetError("Unknown texture format"); 146 SDL_SetError("Unknown texture format");
145 return NULL; 147 return NULL;
146 } 148 }
147 149
148 surface = SDL_CreateRGBSurface(0, 0, 0, bpp, Rmask, Gmask, Bmask, Amask); 150 if (SDL_QueryTexturePixels(textureID, &pixels, &pitch) == 0) {
149 if (surface != NULL) { 151 surface =
150 surface->flags |= (SDL_HWSURFACE | SDL_PREALLOC); 152 SDL_CreateRGBSurfaceFrom(pixels, w, h, bpp, pitch, Rmask, Gmask,
151 surface->w = w; 153 Bmask, Amask);
152 surface->h = h; 154 } else {
153 surface->lock_data = (void *) textureID; 155 surface =
154 SDL_SetClipRect(surface, NULL); 156 SDL_CreateRGBSurface(0, 0, 0, bpp, Rmask, Gmask, Bmask, Amask);
155 } 157 if (surface) {
158 surface->flags |= SDL_HWSURFACE;
159 surface->w = w;
160 surface->h = h;
161 surface->lock_data = (void *) textureID;
162 SDL_SetClipRect(surface, NULL);
163 }
164 }
165
156 return surface; 166 return surface;
157 } 167 }
158 168
159 /* 169 /*
160 * Set the palette in a blittable surface 170 * Set the palette in a blittable surface