- int ox, oy;
- if (effect == HORIZONTAL_FLIP)
- {
- ox = sdltexture->get_texture_width() - surface->get_x() - surface->get_width();
- }
- else
- {
- ox = surface->get_x();
- }
- if (effect == VERTICAL_FLIP)
- {
- oy = sdltexture->get_texture_height() - surface->get_y() - surface->get_height();
- }
- else
- {
- oy = surface->get_y();
- }
-
- int numerator, denominator;
- float xfactor = (float) config->screenwidth / SCREEN_WIDTH;
- float yfactor = (float) config->screenheight / SCREEN_HEIGHT;
- if(xfactor < yfactor)
- {
- numerator = config->screenwidth;
- denominator = SCREEN_WIDTH;
- }
- else
- {
- numerator = config->screenheight;
- denominator = SCREEN_HEIGHT;
- }
-
- SDL_Rect srcRect;
- srcRect.x = ox * numerator / denominator;
- srcRect.y = oy * numerator / denominator;
- srcRect.w = surface->get_width() * numerator / denominator;
- srcRect.h = surface->get_height() * numerator / denominator;
-
- SDL_Rect dstRect;
- dstRect.x = (int) request.pos.x * numerator / denominator;
- dstRect.y = (int) request.pos.y * numerator / denominator;
+ SDL_Rect *src_rect = surface_data->get_src_rect(effect);
+ SDL_Rect dst_rect;
+ dst_rect.x = (int) request.pos.x * numerator / denominator;
+ dst_rect.y = (int) request.pos.y * numerator / denominator;