void gr_flip(void) { if (-EINVAL == overlay_display_frame(gr_fb_fd, gr_mem_surface.data, (fi.line_length * vi.yres))) { GGLContext *gl = gr_context; /* swap front and back buffers */ if (double_buffering) gr_active_fb = (gr_active_fb + 1) & 1; #ifdef BOARD_HAS_FLIPPED_SCREEN /* flip buffer 180 degrees for devices with physicaly inverted screens */ unsigned int i; unsigned int j; uint8_t tmp; for (i = 0; i < ((vi.xres_virtual * vi.yres)/2); i++) { for (j = 0; j < PIXEL_SIZE; j++) { tmp = gr_mem_surface.data[i * PIXEL_SIZE + j]; gr_mem_surface.data[i * PIXEL_SIZE + j] = gr_mem_surface.data[(vi.xres_virtual * vi.yres * PIXEL_SIZE) - ((i+1) * PIXEL_SIZE) + j]; gr_mem_surface.data[(vi.xres_virtual * vi.yres * PIXEL_SIZE) - ((i+1) * PIXEL_SIZE) + j] = tmp; } } #endif /* copy data from the in-memory surface to the buffer we're about * to make active. */ memcpy(gr_framebuffer[gr_active_fb].data, gr_mem_surface.data, vi.xres_virtual * vi.yres * PIXEL_SIZE); /* inform the display driver */ set_active_framebuffer(gr_active_fb); } }
void gr_flip(void) { if (has_overlay) { // Allocate overly. It'll exit early if overlay already // allocated and allocate it if not already allocated. allocate_overlay(gr_fb_fd, gr_framebuffer); if (overlay_display_frame(gr_fb_fd,gr_mem_surface.data, (fi.line_length * vi.yres)) < 0) { // Free overlay in failure case free_overlay(gr_fb_fd); } } else { GGLContext *gl = gr_context; /* swap front and back buffers */ if (double_buffering) gr_active_fb = (gr_active_fb + 1) & 1; /* copy data from the in-memory surface to the buffer we're about * to make active. */ memcpy(gr_framebuffer[gr_active_fb].data, gr_mem_surface.data, fi.line_length * vi.yres); /* inform the display driver */ set_active_framebuffer(gr_active_fb); } }
void gr_flip(void) { if (-EINVAL == overlay_display_frame(gr_fb_fd, gr_mem_surface.data, (fi.line_length * vi.yres))) { GGLContext *gl = gr_context; /* swap front and back buffers */ if (double_buffering) gr_active_fb = (gr_active_fb + 1) & 1; /* copy data from the in-memory surface to the buffer we're about * to make active. */ memcpy(gr_framebuffer[gr_active_fb].data, gr_mem_surface.data, vi.xres_virtual * vi.yres * PIXEL_SIZE); /* inform the display driver */ set_active_framebuffer(gr_active_fb); } }
void gr_flip(void) { if (has_overlay) { // Allocate overly. It'll exit early if overlay already // allocated and allocate it if not already allocated. allocate_overlay(gr_fb_fd, gr_framebuffer); if (overlay_display_frame(gr_fb_fd,gr_mem_surface.data, (fi.line_length * vi.yres)) < 0) { // Free overlay in failure case free_overlay(gr_fb_fd); } } else { GGLContext *gl = gr_context; /* swap front and back buffers */ if (double_buffering) gr_active_fb = (gr_active_fb + 1) & 1; #ifdef BOARD_HAS_FLIPPED_SCREEN /* flip buffer 180 degrees for devices with physicaly inverted screens */ unsigned int i; unsigned int j; uint8_t tmp; vi.xres_virtual = fi.line_length / PIXEL_SIZE; for (i = 0; i < ((vi.xres_virtual * vi.yres)/2); i++) { for (j = 0; j < PIXEL_SIZE; j++) { tmp = gr_mem_surface.data[i * PIXEL_SIZE + j]; gr_mem_surface.data[i * PIXEL_SIZE + j] = gr_mem_surface.data[(vi.xres_virtual * vi.yres * PIXEL_SIZE) - ((i+1) * PIXEL_SIZE) + j]; gr_mem_surface.data[(vi.xres_virtual * vi.yres * PIXEL_SIZE) - ((i+1) * PIXEL_SIZE) + j] = tmp; } } #endif /* copy data from the in-memory surface to the buffer we're about * to make active. */ memcpy(gr_framebuffer[gr_active_fb].data, gr_mem_surface.data, fi.line_length * vi.yres); /* inform the display driver */ set_active_framebuffer(gr_active_fb); } }
void gr_flip(void) { if (has_overlay) { // Allocate overly. It'll exit early if overlay already // allocated and allocate it if not already allocated. allocate_overlay(gr_fb_fd, gr_framebuffer); if (overlay_display_frame(gr_fb_fd,gr_mem_surface.data, (fi.line_length * vi.yres)) < 0) { // Free overlay in failure case free_overlay(gr_fb_fd); } } else { GGLContext *gl = gr_context; /* swap front and back buffers */ if (double_buffering) gr_active_fb = (gr_active_fb + 1) & 1; /*PERSONAL MOD FOR FLIPPED SCREN like Unite2 */ #ifdef BOARD_HAS_FLIPPED_SCREEN /* flip buffer 180 degrees for devices with physicaly inverted screens */ unsigned int i; for (i = 1; i < (vi.xres * vi.yres); i++) { unsigned short tmp = gr_mem_surface.data[i]; gr_mem_surface.data[i] = gr_mem_surface.data[(vi.xres * vi.yres * 2) - i]; gr_mem_surface.data[(vi.xres * vi.yres * 2) - i] = tmp; } #endif /* copy data from the in-memory surface to the buffer we're about * to make active. */ memcpy(gr_framebuffer[gr_active_fb].data, gr_mem_surface.data, fi.line_length * vi.yres); /* inform the display driver */ set_active_framebuffer(gr_active_fb); } }