summaryrefslogtreecommitdiff
path: root/payloads/libpayload/include
diff options
context:
space:
mode:
authorDaisuke Nojiri <dnojiri@chromium.org>2015-08-03 10:51:38 -0700
committerPatrick Georgi <pgeorgi@google.com>2015-10-27 15:21:42 +0100
commit09ad206cdad1b427c331a8f04a63c198e41b5ae9 (patch)
tree914e02b148bf0cbfa014580d606e2ca8620be480 /payloads/libpayload/include
parent3f66398ef8ce13a05f8a0d5127de0ae761727614 (diff)
cbgfx: add draw_bitmap
draw_bitmap renders a bitmap image on screen with position and sizes scaled relative to the screen. images are scaled up or down by nearest neighbor interpolation. BUG=chrome-os-partner:43444 BRANCH=tot TEST=drew bitmap images on Samus Change-Id: Ib599acc85b25626a6aed1fa9884ecd8e169bb860 Signed-off-by: Patrick Georgi <pgeorgi@chromium.org> Original-Commit-Id: c910c9cdb7efc53aace067bd081aeefc07556811 Original-Reviewed-on: https://chromium-review.googlesource.com/290302 Original-Reviewed-by: Aaron Durbin <adurbin@chromium.org> Original-Change-Id: Ib599acc85b25626a6aed1fa9884ecd8e169bb860 Original-Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Original-Reviewed-on: https://chromium-review.googlesource.com/295532 Reviewed-on: http://review.coreboot.org/11584 Tested-by: build bot (Jenkins) Reviewed-by: Patrick Georgi <pgeorgi@google.com>
Diffstat (limited to 'payloads/libpayload/include')
-rw-r--r--payloads/libpayload/include/cbgfx.h26
1 files changed, 25 insertions, 1 deletions
diff --git a/payloads/libpayload/include/cbgfx.h b/payloads/libpayload/include/cbgfx.h
index 1f3e0b48d2..074a42d408 100644
--- a/payloads/libpayload/include/cbgfx.h
+++ b/payloads/libpayload/include/cbgfx.h
@@ -4,7 +4,9 @@
* Copyright (C) 2015 Google, Inc.
*/
-#include <stdint.h>
+#include <libpayload.h>
+#include <arch/types.h>
+#include <stddef.h>
/*
* API error codes
@@ -16,6 +18,14 @@
#define CBGFX_ERROR_INIT 2
/* drawing beyond canvas boundary */
#define CBGFX_ERROR_BOUNDARY 3
+/* bitmap error: signature mismatch */
+#define CBGFX_ERROR_BITMAP_SIGNATURE 0x10
+/* bitmap error: unsupported format */
+#define CBGFX_ERROR_BITMAP_FORMAT 0x11
+/* bitmap error: invalid data */
+#define CBGFX_ERROR_BITMAP_DATA 0x12
+/* bitmap error: scaling out of range */
+#define CBGFX_ERROR_SCALE_OUT_OF_RANGE 0x13
struct vector {
union {
@@ -64,3 +74,17 @@ int draw_box(const struct vector *top_left_rel,
* Clear the canvas
*/
int clear_canvas(struct rgb_color *rgb);
+
+/*
+ * Draw a bitmap image on screen.
+ *
+ * top_left_rel: coordinate of the top left corner of the image relative to the
+ * canvas (0 - CANVAS_SCALE).
+ * scale_rel: scale factor relative to the canvas width (0 - CANVAS_SCALE).
+ * bitmap: pointer to the bitmap data, starting from the file header.
+ * size: size of the bitmap data
+ *
+ * return: CBGFX_* error codes
+ */
+int draw_bitmap(const struct vector *top_left_rel,
+ size_t scale_rel, const void *bitmap, size_t size);