Пример #1
0
void
av_sync(void)
{
	int num_rect = 0;
	SDL_Rect r;

#ifdef PROFILE_GRAPHICS
	float tot_area = 0;
	int i = 0;
	Uint32 ticks = SDL_GetTicks();
#endif

	SDL_Scale2x(screen_surf, screen_surf2x);
	/* copy palette and handle fading! */
	transform_palette();
	SDL_SetColors(screen_surf2x, pal_colors, 0, 256);
	SDL_BlitSurface(screen_surf2x, NULL, display, NULL);
	if (video_rect.h && video_rect.w)
	{
		av_need_update(&video_rect);
		r.h = 2 * video_rect.h;
		r.w = 2 * video_rect.w;
		r.x = 2 * video_rect.x;
		r.y = 2 * video_rect.y;
		SDL_DisplayYUVOverlay(video_overlay, &r);
	}
	if (news_rect.h && news_rect.w)
	{
		av_need_update(&news_rect);
		r.h = 2 * news_rect.h;
		r.w = 2 * news_rect.w;
		r.x = 2 * news_rect.x;
		r.y = 2 * news_rect.y;
		SDL_DisplayYUVOverlay(news_overlay, &r);
	}
	num_rect = get_dirty_rect_list();
	SDL_UpdateRects(display, num_rect, dirty_rect_list);
#ifdef PROFILE_GRAPHICS
	for (i = 0; i < num_rect; ++i)
		tot_area += dirty_rect_list[i].w * dirty_rect_list[i].h;
	tot_area = tot_area * 100 / (2 * MAX_X) / (2 * MAX_Y);
	TRACE4("%3d rects (%6.2f%%) updated in ~%3ums\n",
		num_rect, tot_area, SDL_GetTicks() - ticks);
#endif
	screen_dirty = 0;
}
Пример #2
0
void
av_sync(void)
{
    SDL_Rect r;

#ifdef PROFILE_GRAPHICS
    float tot_area = 0;
    int i = 0;
    Uint32 ticks = SDL_GetTicks();
#endif

    SDL_Scale2x(display::graphics.screen()->surface(), display::graphics.scaledScreenSurface());
    /* copy palette and handle fading! */
    transform_palette();
    SDL_SetColors(display::graphics.scaledScreenSurface(), pal_colors, 0, 256);
    SDL_BlitSurface(display::graphics.scaledScreenSurface(), NULL, display::graphics.displaySurface(), NULL);

    if (display::graphics.videoRect().h && display::graphics.videoRect().w) {
        r.h = 2 * display::graphics.videoRect().h;
        r.w = 2 * display::graphics.videoRect().w;
        r.x = 2 * display::graphics.videoRect().x;
        r.y = 2 * display::graphics.videoRect().y;
        SDL_DisplayYUVOverlay(display::graphics.videoOverlay(), &r);
    }

    if (display::graphics.newsRect().h && display::graphics.newsRect().w) {
        r.h = 2 * display::graphics.newsRect().h;
        r.w = 2 * display::graphics.newsRect().w;
        r.x = 2 * display::graphics.newsRect().x;
        r.y = 2 * display::graphics.newsRect().y;
        SDL_DisplayYUVOverlay(display::graphics.newsOverlay(), &r);
    }

    //TODO: Since we're not always tracking the right dirty area (due to the graphics refactoring)
    // for now we update the entire display every time.
    SDL_UpdateRect(display::graphics.displaySurface(), 0, 0, 640, 400);
}