Skip to content

Instantly share code, notes, and snippets.

@rutvik95
Created August 10, 2014 17:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rutvik95/0bdc093d80ced09911a2 to your computer and use it in GitHub Desktop.
Save rutvik95/0bdc093d80ced09911a2 to your computer and use it in GitHub Desktop.
From 06fa01734bd172b750d4e3472932cb884f962661 Mon Sep 17 00:00:00 2001
From: Rutvik Rajagopal <rutvik_95@yahoo.co.in>
Date: Sun, 10 Aug 2014 23:09:06 +0530
Subject: [PATCH] fix fr galaxy grand neo recovery
Change-Id: If1ca4101962a5bd94f2b3b565f05e71200730ba9
---
minui/graphics.c | 45 ++++++++++++++++++++++-----------------------
1 file changed, 22 insertions(+), 23 deletions(-)
diff --git a/minui/graphics.c b/minui/graphics.c
index a578f69..ebe6d24 100644
--- a/minui/graphics.c
+++ b/minui/graphics.c
@@ -278,32 +278,31 @@ static void set_active_framebuffer(unsigned n)
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);
+GGLContext *gl = gr_context;
+
+#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,
+fi.line_length * vi.yres);
- /* inform the display driver */
- set_active_framebuffer(gr_active_fb);
- }
+/* inform the display driver */
+set_active_framebuffer(gr_active_fb);
}
+
void gr_color(unsigned char r, unsigned char g, unsigned char b, unsigned char a)
{
GGLContext *gl = gr_context;
--
1.9.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment