Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(519)

Unified Diff: lib/gfx/gfx.c

Issue 1777783003: [display] Refactor to avoid implicit framebuffer allocation. (Closed) Base URL: https://github.com/littlekernel/lk.git@master
Patch Set: update other targets Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: lib/gfx/gfx.c
diff --git a/lib/gfx/gfx.c b/lib/gfx/gfx.c
index 757c1d119d8b41222e8efd8376fef9c226817dee..7d05d9d48a1d5dd8ac73fb6dec8a8606ff0260dd 100644
--- a/lib/gfx/gfx.c
+++ b/lib/gfx/gfx.c
@@ -657,27 +657,27 @@ gfx_surface *gfx_create_surface(void *ptr, uint width, uint height, uint stride,
/**
* @brief Create a new graphics surface object from a display
*/
-gfx_surface *gfx_create_surface_from_display(struct display_info *info)
+gfx_surface *gfx_create_surface_from_display(struct display_framebuffer *fb)
gkalsi 2016/03/09 21:13:37 DEBUG_ASSERT(fb);
cdotstout 2016/03/09 22:48:00 Done.
{
gfx_surface *surface;
gfx_format format;
- switch (info->format) {
- case DISPLAY_FORMAT_RGB_565:
+ switch (fb->image.format) {
+ case IMAGE_FORMAT_RGB_565:
format = GFX_FORMAT_RGB_565;
break;
- case DISPLAY_FORMAT_RGB_332:
+ case IMAGE_FORMAT_RGB_332:
format = GFX_FORMAT_RGB_332;
break;
- case DISPLAY_FORMAT_RGB_2220:
+ case IMAGE_FORMAT_RGB_2220:
format = GFX_FORMAT_RGB_2220;
break;
- case DISPLAY_FORMAT_ARGB_8888:
+ case IMAGE_FORMAT_ARGB_8888:
format = GFX_FORMAT_ARGB_8888;
break;
- case DISPLAY_FORMAT_RGB_x888:
+ case IMAGE_FORMAT_RGB_x888:
format = GFX_FORMAT_RGB_x888;
break;
- case DISPLAY_FORMAT_MONO_8:
+ case IMAGE_FORMAT_MONO_8:
format = GFX_FORMAT_MONO;
break;
default:
@@ -686,9 +686,9 @@ gfx_surface *gfx_create_surface_from_display(struct display_info *info)
return NULL;
}
- surface = gfx_create_surface(info->framebuffer, info->width, info->height, info->stride, format);
+ surface = gfx_create_surface(fb->image.pixels, fb->image.width, fb->image.height, fb->image.rowbytes, format);
- surface->flush = info->flush;
+ surface->flush = fb->flush;
return surface;
}
@@ -711,11 +711,11 @@ void gfx_surface_destroy(struct gfx_surface *surface)
*/
void gfx_draw_pattern(void)
{
- struct display_info info;
- if (display_get_info(&info) < 0)
+ struct display_framebuffer fb;
+ if (display_get_framebuffer(&fb) < 0)
return;
- gfx_surface *surface = gfx_create_surface_from_display(&info);
+ gfx_surface *surface = gfx_create_surface_from_display(&fb);
uint x, y;
for (y = 0; y < surface->height; y++) {
@@ -740,11 +740,11 @@ void gfx_draw_pattern(void)
*/
void gfx_draw_pattern_white(void)
{
- struct display_info info;
- if (display_get_info(&info) < 0)
+ struct display_framebuffer fb;
+ if (display_get_framebuffer(&fb) < 0)
return;
- gfx_surface *surface = gfx_create_surface_from_display(&info);
+ gfx_surface *surface = gfx_create_surface_from_display(&fb);
uint x, y;
for (y = 0; y < surface->height; y++) {
@@ -809,19 +809,19 @@ static int cmd_gfx(int argc, const cmd_args *argv)
return -1;
}
- struct display_info info;
- if (display_get_info(&info) < 0) {
+ struct display_framebuffer fb;
+ if (display_get_framebuffer(&fb) < 0) {
printf("no display to draw on!\n");
return -1;
}
- gfx_surface *surface = gfx_create_surface_from_display(&info);
+ gfx_surface *surface = gfx_create_surface_from_display(&fb);
if (!strcmp(argv[1].str, "display_info")) {
printf("display:\n");
- printf("\tframebuffer %p\n", info.framebuffer);
- printf("\twidth %u height %u stride %u\n", info.width, info.height, info.stride);
- printf("\tformat %u\n", info.format);
+ printf("\tframebuffer %p\n", fb.image.pixels);
+ printf("\twidth %u height %u stride %u\n", fb.image.width, fb.image.height, fb.image.rowbytes);
+ printf("\tformat %u\n", fb.image.format);
} else if (!strcmp(argv[1].str, "rgb_bars")) {
gfx_draw_rgb_bars(surface);
} else if (!strcmp(argv[1].str, "test_pattern")) {

Powered by Google App Engine
This is Rietveld 408576698