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

Unified Diff: lib/gfx/gfx.c

Issue 1741463002: [target][dartuinoP0] Allow for varying framebuffer format and stride. (Closed) Base URL: https://github.com/littlekernel/lk.git@master
Patch Set: Created 4 years, 10 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
« no previous file with comments | « include/dev/display.h ('k') | target/dartuinoP0/display/LS013B7DH06.c » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/gfx/gfx.c
diff --git a/lib/gfx/gfx.c b/lib/gfx/gfx.c
index 3e614c019e3c462df07d71a349cfa332e15d713d..757c1d119d8b41222e8efd8376fef9c226817dee 100644
--- a/lib/gfx/gfx.c
+++ b/lib/gfx/gfx.c
@@ -44,7 +44,6 @@
#define LOCAL_TRACE 0
-
// Convert a 32bit ARGB image to its respective gamma corrected grayscale value.
static uint32_t ARGB8888_to_Luma(uint32_t in)
{
@@ -661,7 +660,33 @@ gfx_surface *gfx_create_surface(void *ptr, uint width, uint height, uint stride,
gfx_surface *gfx_create_surface_from_display(struct display_info *info)
{
gfx_surface *surface;
- surface = gfx_create_surface(info->framebuffer, info->width, info->height, info->stride, info->format);
+ gfx_format format;
+ switch (info->format) {
+ case DISPLAY_FORMAT_RGB_565:
+ format = GFX_FORMAT_RGB_565;
+ break;
+ case DISPLAY_FORMAT_RGB_332:
+ format = GFX_FORMAT_RGB_332;
+ break;
+ case DISPLAY_FORMAT_RGB_2220:
+ format = GFX_FORMAT_RGB_2220;
+ break;
+ case DISPLAY_FORMAT_ARGB_8888:
+ format = GFX_FORMAT_ARGB_8888;
+ break;
+ case DISPLAY_FORMAT_RGB_x888:
+ format = GFX_FORMAT_RGB_x888;
+ break;
+ case DISPLAY_FORMAT_MONO_8:
+ format = GFX_FORMAT_MONO;
+ break;
+ default:
+ dprintf(INFO, "invalid graphics format)");
+ DEBUG_ASSERT(0);
+ return NULL;
+ }
+
+ surface = gfx_create_surface(info->framebuffer, info->width, info->height, info->stride, format);
surface->flush = info->flush;
« no previous file with comments | « include/dev/display.h ('k') | target/dartuinoP0/display/LS013B7DH06.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698