SDL_Surface *surface_screen;
SDL_Surface *surface_qemu;
+SDL_Surface *processing_screen = NULL;
GLuint texture;
static double current_scale_factor = 1.0;
h = temp;
}
- /*if (capability_check_gl != 0) {
+#if 0
+ if (capability_check_gl != 0) {
ERR("GL check returned non-zero\n");
surface_screen = NULL;
} else {
if (surface_screen == NULL) {
sdl_opengl = 0;
INFO("No OpenGL support on this system!??\n");
- ERR("%s\n", SDL_GetError());*/
+ ERR("%s\n", SDL_GetError());
+#endif
surface_screen = SDL_SetVideoMode(w, h, get_emul_sdl_bpp(), SDL_FLAGS);
if (surface_screen == NULL) {
ERR("Could not open SDL display (%dx%dx%d): %s\n", w, h, get_emul_sdl_bpp(), SDL_GetError());
return;
}
- /*} else {
+#if 0
+ } else {
sdl_opengl = 1;
INFO("OpenGL is supported on this system.\n");
- }*/
+ }
+#endif
+
+ /* create buffer for image processing */
+ SDL_FreeSurface(processing_screen);
+ processing_screen = SDL_CreateRGBSurface(SDL_SWSURFACE, w, h, get_emul_sdl_bpp(),
+ surface_qemu->format->Rmask, surface_qemu->format->Gmask,
+ surface_qemu->format->Bmask, surface_qemu->format->Amask);
if (sdl_opengl == 1) {
/* Set the OpenGL state */
}
else
{ //sdl surface
- SDL_Surface *processing_screen = NULL;
-
- if (current_scale_factor < 0.5) {
+ if (current_scale_factor < 0.5)
+ {
+ /* process by sdl_gfx */
// workaround
// set color key 'magenta'
surface_qemu->format->colorkey = 0xFF00FF;
+ SDL_Surface *temp_surface = NULL;
+
+ temp_surface = rotozoomSurface(
+ surface_qemu, current_screen_degree, current_scale_factor, 1);
+ SDL_BlitSurface(temp_surface, NULL, surface_screen, NULL);
+
+ SDL_FreeSurface(temp_surface);
+ }
+ else if (current_scale_factor != 1.0 || current_screen_degree != 0.0)
+ {
//image processing
- processing_screen = rotozoomSurface(surface_qemu, current_screen_degree, current_scale_factor, 1);
- SDL_BlitSurface(processing_screen, NULL, surface_screen, NULL);
- } else if (current_scale_factor != 1.0 || current_screen_degree != 0.0) {
- //image processing
- processing_screen = maru_rotozoom(surface_qemu, (int)current_screen_degree, current_scale_factor);
+ processing_screen = maru_rotozoom(
+ surface_qemu, processing_screen, (int)current_screen_degree);
SDL_BlitSurface(processing_screen, NULL, surface_screen, NULL);
- } else { //as-is
+ }
+ else //as-is
+ {
SDL_BlitSurface(surface_qemu, NULL, surface_screen, NULL);
}
- SDL_FreeSurface(processing_screen);
-
/* draw multi-touch finger points */
MultiTouchState *mts = get_emul_multi_touch_state();
if (mts->multitouch_enable != 0 && mts->finger_point_surface != NULL) {
glDeleteTextures(1, &texture);
}
+ SDL_FreeSurface(processing_screen);
SDL_Quit();
}
#define G_CHANNEL_MASK 0x0000ff00
#define B_CHANNEL_MASK 0x000000ff
-SDL_Surface *maru_rotozoom(SDL_Surface *rz_src, int angle, double zoom);
+SDL_Surface *maru_rotozoom(SDL_Surface *rz_src, SDL_Surface *rz_dst, int angle);
+
static void interpolate_pixel_cpy(unsigned int *dst, unsigned int *src_addr, unsigned int src_w, unsigned int src_h, int x, int y)
{
((sum_g / 4) & G_CHANNEL_MASK) | ((sum_b / 4) & B_CHANNEL_MASK);
}
-//TODO: optimization
-SDL_Surface *maru_rotozoom(SDL_Surface *rz_src, int angle, double zoom)
+SDL_Surface *maru_rotozoom(SDL_Surface *rz_src, SDL_Surface *rz_dst, int angle)
{
#define PRECISION 4096
#define SHIFT 12
int i, j;
- SDL_Surface *rz_dst;
- unsigned int dst_width = (unsigned int)(rz_src->w * zoom);
- unsigned int dst_height = (unsigned int)(rz_src->h * zoom);
+ unsigned int dst_width = 0;
+ unsigned int dst_height = 0;
+
+ unsigned int sx = 0;
+ unsigned int sy = 0;
+ unsigned int row_index = 0;
+ unsigned int col_index = 0;
+
+ unsigned int *out = NULL;
+ unsigned int *row = NULL;
switch(angle) {
case 90:
case 270:
- rz_dst = SDL_CreateRGBSurface(SDL_SWSURFACE, dst_height, dst_width, 32,
- rz_src->format->Rmask, rz_src->format->Gmask,
- rz_src->format->Bmask, rz_src->format->Amask);
+ dst_width = rz_dst->h;
+ dst_height = rz_dst->w;
break;
case 0:
case 180:
default:
- rz_dst = SDL_CreateRGBSurface(SDL_SWSURFACE, dst_width, dst_height, 32,
- rz_src->format->Rmask, rz_src->format->Gmask,
- rz_src->format->Bmask, rz_src->format->Amask);
+ dst_width = rz_dst->w;
+ dst_height = rz_dst->h;
break;
- } //TODO: exile
-
- unsigned int sx = (rz_src->w) * PRECISION / dst_width;
- unsigned int sy = (rz_src->h) * PRECISION / dst_height; //TODO: exile
- unsigned int row_index = 0;
- unsigned int col_index = 0;
+ }
- unsigned int *out = NULL;
- unsigned int *row = NULL;
+ sx = (rz_src->w) * PRECISION / dst_width;
+ sy = (rz_src->h) * PRECISION / dst_height;
SDL_LockSurface(rz_src);