{
screen = SDL_GetVideoSurface();
- float xfactor = (float) config->screenwidth / SCREEN_WIDTH;
- float yfactor = (float) config->screenheight / SCREEN_HEIGHT;
+ //float xfactor = 1.0f; // FIXME: (float) config->screenwidth / SCREEN_WIDTH;
+ //float yfactor = 1.0f; // FIXME: (float) config->screenheight / SCREEN_HEIGHT;
+
+ numerator = 1;
+ denominator = 1;
+
+ /* FIXME:
if(xfactor < yfactor)
{
numerator = config->screenwidth;
numerator = config->screenheight;
denominator = SCREEN_HEIGHT;
}
+ */
LIGHTMAP_DIV = 8 * numerator / denominator;
if(LIGHTMAP_DIV == 1)
{
int bpp = screen->format->BytesPerPixel;
+ if(SDL_MUSTLOCK(screen))
+ {
+ SDL_LockSurface(screen);
+ }
Uint8 *pixel = (Uint8 *) screen->pixels;
int loc = 0;
for(int y = 0;y < height;y++) {
}
pixel += screen->pitch - width * bpp;
}
+ if(SDL_MUSTLOCK(screen))
+ {
+ SDL_UnlockSurface(screen);
+ }
}
else
{
int bpp = screen->format->BytesPerPixel;
+ if(SDL_MUSTLOCK(screen))
+ {
+ SDL_LockSurface(screen);
+ }
Uint8 *div_pixel = (Uint8 *) screen->pixels;
int loc = 0;
for(int y = 0;y < height;y++) {
}
div_pixel += (screen->pitch - width * bpp) * LIGHTMAP_DIV;
}
+ if(SDL_MUSTLOCK(screen))
+ {
+ SDL_UnlockSurface(screen);
+ }
}
}
int blit_width = src_rect->w / LIGHTMAP_DIV;
int blit_height = src_rect->h / LIGHTMAP_DIV;
int bpp = src->format->BytesPerPixel;
+ if(SDL_MUSTLOCK(src))
+ {
+ SDL_LockSurface(src);
+ }
Uint8 *pixel = (Uint8 *) src->pixels + srcy * src->pitch + srcx * bpp;
int loc = dsty * width + dstx;
for(int y = 0;y < blit_height;y++) {
pixel += (src->pitch - blit_width * bpp) * LIGHTMAP_DIV;
loc += width - blit_width;
}
+ if(SDL_MUSTLOCK(src))
+ {
+ SDL_UnlockSurface(src);
+ }
}
/*void Lightmap::light_blit(SDL_Surface *src, SDL_Rect *src_rect, int dstx, int dsty)
{
int bpp = src->format->BytesPerPixel;
- Uint8 *pixel = (Uint8 *) src->pixels + src_rect->y * src->pitch + src_rect->x * bpp;
+ if(SDL_MUSTLOCK(src))
+ {
+ SDL_LockSurface(src);
+ }
+ Uint8 *pixel = (Uint8 *) src->pixels + src_rect->y * src->pitch + src_rect->x * bpp;
int loc = dsty * width + dstx;
for(int y = 0;y < src_rect->h;y++) {
for(int x = 0;x < src_rect->w;x++, pixel += bpp, loc++) {
pixel += src->pitch - src_rect->w * bpp;
loc += width - src_rect->w;
}
+ if(SDL_MUSTLOCK(src))
+ {
+ SDL_UnlockSurface(src);
+ }
}*/
void
if (transform == 0) {
std::cerr << "Warning: Tried to draw NULL surface, skipped draw" << std::endl;
return;
- }
+ }
SDL_Rect *src_rect = surface_data->get_src_rect(effect);
int dstx = (int) request.pos.x * numerator / denominator;
if (transform == 0) {
std::cerr << "Warning: Tried to draw NULL surface, skipped draw" << std::endl;
return;
- }
+ }
int ox, oy;
if (effect == HORIZONTAL_FLIP)
}
void
- Lightmap::draw_text(const DrawingRequest& /*request*/)
- {
- //const TextRequest* textrequest = (TextRequest*) request.request_data;
-
- //textrequest->font->draw(textrequest->text, request.pos,
- // textrequest->alignment, request.drawing_effect, request.alpha);
- }
-
- void
Lightmap::draw_filled_rect(const DrawingRequest& request)
{
const FillRectRequest* fillrectrequest