diff options
Diffstat (limited to 'firmware/target/hosted')
-rw-r--r-- | firmware/target/hosted/android/lcd-android.c | 6 | ||||
-rw-r--r-- | firmware/target/hosted/sdl/lcd-bitmap.c | 18 | ||||
-rw-r--r-- | firmware/target/hosted/sdl/lcd-remote-bitmap.c | 4 | ||||
-rw-r--r-- | firmware/target/hosted/ypr0/lcd-ypr0.c | 4 |
4 files changed, 14 insertions, 18 deletions
diff --git a/firmware/target/hosted/android/lcd-android.c b/firmware/target/hosted/android/lcd-android.c index abde72155d..c9a3fd6edf 100644 --- a/firmware/target/hosted/android/lcd-android.c +++ b/firmware/target/hosted/android/lcd-android.c | |||
@@ -75,7 +75,7 @@ void connect_with_java(JNIEnv* env, jobject fb_instance) | |||
75 | 75 | ||
76 | /* Create native_buffer */ | 76 | /* Create native_buffer */ |
77 | jobject buffer = (*env)->NewDirectByteBuffer(env, lcd_framebuffer, | 77 | jobject buffer = (*env)->NewDirectByteBuffer(env, lcd_framebuffer, |
78 | (jlong) sizeof(lcd_framebuffer)); | 78 | (jlong) FRAMEBUFFER_SIZE); |
79 | 79 | ||
80 | /* we need to setup parts for the java object every time */ | 80 | /* we need to setup parts for the java object every time */ |
81 | (*env)->CallVoidMethod(env, fb_instance, java_lcd_init, | 81 | (*env)->CallVoidMethod(env, fb_instance, java_lcd_init, |
@@ -206,10 +206,10 @@ void lcd_blit_yuv(unsigned char * const src[3], | |||
206 | linecounter = height >> 1; | 206 | linecounter = height >> 1; |
207 | 207 | ||
208 | #if LCD_WIDTH >= LCD_HEIGHT | 208 | #if LCD_WIDTH >= LCD_HEIGHT |
209 | dst = &lcd_framebuffer[y][x]; | 209 | dst = FBADDR(x,y); |
210 | row_end = dst + width; | 210 | row_end = dst + width; |
211 | #else | 211 | #else |
212 | dst = &lcd_framebuffer[x][LCD_WIDTH - y - 1]; | 212 | dst = FBADDR(LCD_WIDTH - y - 1,x); |
213 | row_end = dst + LCD_WIDTH * width; | 213 | row_end = dst + LCD_WIDTH * width; |
214 | #endif | 214 | #endif |
215 | 215 | ||
diff --git a/firmware/target/hosted/sdl/lcd-bitmap.c b/firmware/target/hosted/sdl/lcd-bitmap.c index 4ee0bbef5c..7e9bc297ef 100644 --- a/firmware/target/hosted/sdl/lcd-bitmap.c +++ b/firmware/target/hosted/sdl/lcd-bitmap.c | |||
@@ -92,29 +92,25 @@ static unsigned long get_lcd_pixel(int x, int y) | |||
92 | { | 92 | { |
93 | #if LCD_DEPTH == 1 | 93 | #if LCD_DEPTH == 1 |
94 | #ifdef HAVE_NEGATIVE_LCD | 94 | #ifdef HAVE_NEGATIVE_LCD |
95 | return (lcd_framebuffer[y/8][x] & (1 << (y & 7))) ? (NUM_SHADES-1) : 0; | 95 | return (*FBADDR(x, y/8) & (1 << (y & 7))) ? (NUM_SHADES-1) : 0; |
96 | #else | 96 | #else |
97 | return (lcd_framebuffer[y/8][x] & (1 << (y & 7))) ? 0 : (NUM_SHADES-1); | 97 | return (*FBADDR(x, y/8) & (1 << (y & 7))) ? 0 : (NUM_SHADES-1); |
98 | #endif | 98 | #endif |
99 | #elif LCD_DEPTH == 2 | 99 | #elif LCD_DEPTH == 2 |
100 | #if LCD_PIXELFORMAT == HORIZONTAL_PACKING | 100 | #if LCD_PIXELFORMAT == HORIZONTAL_PACKING |
101 | return colorindex[(lcd_framebuffer[y][x/4] >> (2 * (~x & 3))) & 3]; | 101 | return colorindex[(*FBADDR(x/4, y) >> (2 * (~x & 3))) & 3]; |
102 | #elif LCD_PIXELFORMAT == VERTICAL_PACKING | 102 | #elif LCD_PIXELFORMAT == VERTICAL_PACKING |
103 | return colorindex[(lcd_framebuffer[y/4][x] >> (2 * (y & 3))) & 3]; | 103 | return colorindex[(*FBADDR(x, y/4) >> (2 * (y & 3))) & 3]; |
104 | #elif LCD_PIXELFORMAT == VERTICAL_INTERLEAVED | 104 | #elif LCD_PIXELFORMAT == VERTICAL_INTERLEAVED |
105 | unsigned bits = (lcd_framebuffer[y/8][x] >> (y & 7)) & 0x0101; | 105 | unsigned bits = (*FBADDR(x, y/8) >> (y & 7)) & 0x0101; |
106 | return colorindex[(bits | (bits >> 7)) & 3]; | 106 | return colorindex[(bits | (bits >> 7)) & 3]; |
107 | #endif | 107 | #endif |
108 | #elif LCD_DEPTH == 16 | 108 | #elif LCD_DEPTH == 16 |
109 | #if LCD_PIXELFORMAT == RGB565SWAPPED | 109 | #if LCD_PIXELFORMAT == RGB565SWAPPED |
110 | unsigned bits = lcd_framebuffer[y][x]; | 110 | unsigned bits = *FBADDR(x, y); |
111 | return (bits >> 8) | (bits << 8); | 111 | return (bits >> 8) | (bits << 8); |
112 | #else | 112 | #else |
113 | #if defined(LCD_STRIDEFORMAT) && LCD_STRIDEFORMAT == VERTICAL_STRIDE | 113 | return *FBADDR(x, y); |
114 | return *(&lcd_framebuffer[0][0]+LCD_HEIGHT*x+y); | ||
115 | #else | ||
116 | return lcd_framebuffer[y][x]; | ||
117 | #endif | ||
118 | #endif | 114 | #endif |
119 | #endif | 115 | #endif |
120 | } | 116 | } |
diff --git a/firmware/target/hosted/sdl/lcd-remote-bitmap.c b/firmware/target/hosted/sdl/lcd-remote-bitmap.c index 86d45ef446..5f08b4440b 100644 --- a/firmware/target/hosted/sdl/lcd-remote-bitmap.c +++ b/firmware/target/hosted/sdl/lcd-remote-bitmap.c | |||
@@ -50,10 +50,10 @@ static const unsigned char colorindex[4] = {128, 85, 43, 0}; | |||
50 | static unsigned long get_lcd_remote_pixel(int x, int y) | 50 | static unsigned long get_lcd_remote_pixel(int x, int y) |
51 | { | 51 | { |
52 | #if LCD_REMOTE_DEPTH == 1 | 52 | #if LCD_REMOTE_DEPTH == 1 |
53 | return lcd_remote_framebuffer[y/8][x] & (1 << (y & 7)) ? 0 : (NUM_SHADES-1); | 53 | return *FBREMOTEADDR(x, y/8) & (1 << (y & 7)) ? 0 : (NUM_SHADES-1); |
54 | #elif LCD_REMOTE_DEPTH == 2 | 54 | #elif LCD_REMOTE_DEPTH == 2 |
55 | #if LCD_REMOTE_PIXELFORMAT == VERTICAL_INTERLEAVED | 55 | #if LCD_REMOTE_PIXELFORMAT == VERTICAL_INTERLEAVED |
56 | unsigned bits = (lcd_remote_framebuffer[y/8][x] >> (y & 7)) & 0x0101; | 56 | unsigned bits = (*FBREMOTEADDR(x, y/8) >> (y & 7)) & 0x0101; |
57 | return colorindex[(bits | (bits >> 7)) & 3]; | 57 | return colorindex[(bits | (bits >> 7)) & 3]; |
58 | #endif | 58 | #endif |
59 | #endif | 59 | #endif |
diff --git a/firmware/target/hosted/ypr0/lcd-ypr0.c b/firmware/target/hosted/ypr0/lcd-ypr0.c index 083a9fbe28..40528c298a 100644 --- a/firmware/target/hosted/ypr0/lcd-ypr0.c +++ b/firmware/target/hosted/ypr0/lcd-ypr0.c | |||
@@ -39,7 +39,7 @@ fb_data *dev_fb = 0; | |||
39 | void lcd_shutdown(void) | 39 | void lcd_shutdown(void) |
40 | { | 40 | { |
41 | printf("FB closed."); | 41 | printf("FB closed."); |
42 | munmap(dev_fb, sizeof(lcd_framebuffer)); | 42 | munmap(dev_fb, FRAMEBUFFER_SIZE); |
43 | close(dev_fd); | 43 | close(dev_fd); |
44 | } | 44 | } |
45 | 45 | ||
@@ -80,7 +80,7 @@ void lcd_init_device(void) | |||
80 | 80 | ||
81 | /* Figure out the size of the screen in bytes */ | 81 | /* Figure out the size of the screen in bytes */ |
82 | screensize = vinfo.xres * vinfo.yres * vinfo.bits_per_pixel / 8; | 82 | screensize = vinfo.xres * vinfo.yres * vinfo.bits_per_pixel / 8; |
83 | if (screensize != sizeof(lcd_framebuffer)) | 83 | if (screensize != FRAMEBUFFER_SIZE) |
84 | { | 84 | { |
85 | exit(4); | 85 | exit(4); |
86 | perror("Display and framebuffer mismatch!\n"); | 86 | perror("Display and framebuffer mismatch!\n"); |