diff options
Diffstat (limited to 'firmware/target/hosted/sdl/lcd-sdl.c')
-rw-r--r-- | firmware/target/hosted/sdl/lcd-sdl.c | 39 |
1 files changed, 33 insertions, 6 deletions
diff --git a/firmware/target/hosted/sdl/lcd-sdl.c b/firmware/target/hosted/sdl/lcd-sdl.c index 96b1a04aa6..5559369e0e 100644 --- a/firmware/target/hosted/sdl/lcd-sdl.c +++ b/firmware/target/hosted/sdl/lcd-sdl.c | |||
@@ -30,10 +30,40 @@ void sdl_update_rect(SDL_Surface *surface, int x_start, int y_start, int width, | |||
30 | int height, int max_x, int max_y, | 30 | int height, int max_x, int max_y, |
31 | unsigned long (*getpixel)(int, int)) | 31 | unsigned long (*getpixel)(int, int)) |
32 | { | 32 | { |
33 | SDL_Rect dest; | ||
34 | #if LCD_DEPTH >= 8 && (LCD_PIXELFORMAT == RGB565) \ | ||
35 | && !defined(LCD_STRIDEFORMAT) && !defined(HAVE_LCD_SPLIT) | ||
36 | SDL_Rect src; | ||
37 | (void)max_x; | ||
38 | (void)max_y; | ||
39 | (void)getpixel; | ||
40 | /* Update complete screen via one blit operation (fast) */ | ||
41 | SDL_Surface *lcd = SDL_CreateRGBSurfaceFrom(lcd_framebuffer, LCD_FBWIDTH, | ||
42 | LCD_FBHEIGHT, LCD_DEPTH, | ||
43 | LCD_FBWIDTH * LCD_DEPTH/8, | ||
44 | 0, 0, 0, 0); | ||
45 | src.x = x_start; | ||
46 | src.y = y_start; | ||
47 | src.w = width; | ||
48 | src.h = height; | ||
49 | |||
50 | if (display_zoom == 1) { | ||
51 | dest = src; | ||
52 | SDL_BlitSurface(lcd, &src, surface, &dest); | ||
53 | } else { | ||
54 | /* Note: SDL_SoftStretch is currently marked as DO NOT USE | ||
55 | but there are no real alternatives for efficent zooming. */ | ||
56 | dest.x = src.x * display_zoom; | ||
57 | dest.y = src.y * display_zoom; | ||
58 | dest.w = src.w * display_zoom; | ||
59 | dest.h = src.h * display_zoom; | ||
60 | SDL_SoftStretch(lcd, &src, surface, &dest); | ||
61 | } | ||
62 | SDL_FreeSurface(lcd); | ||
63 | #else | ||
33 | int x, y; | 64 | int x, y; |
34 | int xmax, ymax; | 65 | int xmax, ymax; |
35 | SDL_Rect dest; | 66 | /* Very slow pixel-by-pixel drawing */ |
36 | |||
37 | ymax = y_start + height; | 67 | ymax = y_start + height; |
38 | xmax = x_start + width; | 68 | xmax = x_start + width; |
39 | 69 | ||
@@ -42,8 +72,6 @@ void sdl_update_rect(SDL_Surface *surface, int x_start, int y_start, int width, | |||
42 | if(ymax >= max_y) | 72 | if(ymax >= max_y) |
43 | ymax = max_y; | 73 | ymax = max_y; |
44 | 74 | ||
45 | SDL_LockSurface(surface); | ||
46 | |||
47 | dest.w = display_zoom; | 75 | dest.w = display_zoom; |
48 | dest.h = display_zoom; | 76 | dest.h = display_zoom; |
49 | 77 | ||
@@ -69,8 +97,7 @@ void sdl_update_rect(SDL_Surface *surface, int x_start, int y_start, int width, | |||
69 | } | 97 | } |
70 | #endif | 98 | #endif |
71 | } | 99 | } |
72 | 100 | #endif | |
73 | SDL_UnlockSurface(surface); | ||
74 | } | 101 | } |
75 | 102 | ||
76 | void sdl_gui_update(SDL_Surface *surface, int x_start, int y_start, int width, | 103 | void sdl_gui_update(SDL_Surface *surface, int x_start, int y_start, int width, |