#define HEIGHT 600
#define HBORDER 32
#define VBORDER 8
+#define RX (0.5)
+#define RY (0.5)
#define STOP_INTERVAL (2*1000)
#define FPS (100)
static cairo_surface_t *surface = NULL;
static cairo_t *ctx = NULL;
cairo_surface_t *source;
+ double rx, ry;
if (data == NULL && surface == NULL && ctx == NULL)
{
data = malloc (WIDTH * HEIGHT * 4);
surface = cairo_image_surface_create_for_data (data, CAIRO_FORMAT_ARGB32,
WIDTH, HEIGHT, WIDTH * 4);
ctx = cairo_create (surface);
- cairo_scale (ctx, 2, 2);
+ rx = (double) WIDTH / (double) image->w;
+ ry = (double) HEIGHT / (double) image->h;
+ cairo_scale (ctx, rx, ry);
}
source = CairoFromSDL (image);
cairo_set_source_surface (ctx, source, 0, 0);
SDL_Surface *text;
SDL_Rect box;
SDL_Color Yellow = { 255, 255, 0, 0};
+ double rx, ry;
+ rx = RX;
+ ry = RY;
center = GetNextPoint ();
- slice = SDL_CreateRGBSurface (SDL_SWSURFACE, WIDTH/2, HEIGHT/2,
+ slice = SDL_CreateRGBSurface (SDL_SWSURFACE, WIDTH*rx, HEIGHT*ry,
32,
0x00ff0000, 0x0000ff00, 0x000000ff, 0xff000000);
- center.x -= (WIDTH/2) / 2;
- center.y -= (HEIGHT/2) / 2;
- center.w /= 2;
- center.h /= 2;
+ center.x -= (WIDTH/2) * rx;
+ center.y -= (HEIGHT/2) * ry;
+ center.w *= rx;
+ center.h *= ry;
SDL_BlitSurface (image, ¢er, slice, NULL);
SDL_UpdateRect (slice, 0, 0, 0, 0);
scale = CairoTarget (slice);