summaryrefslogtreecommitdiff
path: root/payloads/libpayload/include
diff options
context:
space:
mode:
authorYu-Ping Wu <yupingso@chromium.org>2020-08-03 12:32:43 +0800
committerJulius Werner <jwerner@chromium.org>2020-08-13 22:25:18 +0000
commit7b54c15a676636961ae7d449e439a89acf669ec6 (patch)
tree8ce1091eda1b54fab2853d2697b1b3f6e65189b4 /payloads/libpayload/include
parente7ef6c380d0878dcce434c05e00943ad51abe093 (diff)
libpayload: cbgfx: Add color mapping functionality
Similar to set_blend(), add set_color_map() for mapping background and foreground colors of a bitmap. Also add clear_color_map() for clearing the saved color mappings. Note that when drawing a bitmap, the color mapping will be applied before blending. Also remove unnecessary initialization for static variable 'blend'. BRANCH=puff BUG=b:146399181, b:162357639 TEST=emerge-puff libpayload Change-Id: I640ff3e8455cd4aaa5a41d03a0183dff282648a5 Signed-off-by: Yu-Ping Wu <yupingso@chromium.org> Reviewed-on: https://review.coreboot.org/c/coreboot/+/44375 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Joel Kitching <kitching@google.com> Reviewed-by: Julius Werner <jwerner@chromium.org>
Diffstat (limited to 'payloads/libpayload/include')
-rw-r--r--payloads/libpayload/include/cbgfx.h20
1 files changed, 18 insertions, 2 deletions
diff --git a/payloads/libpayload/include/cbgfx.h b/payloads/libpayload/include/cbgfx.h
index f2883b0c43..85b61a7b10 100644
--- a/payloads/libpayload/include/cbgfx.h
+++ b/payloads/libpayload/include/cbgfx.h
@@ -228,6 +228,24 @@ int draw_bitmap_direct(const void *bitmap, size_t size,
int get_bitmap_dimension(const void *bitmap, size_t sz, struct scale *dim_rel);
/**
+ * Setup color mappings of background and foreground colors. Black and white
+ * pixels will be mapped to the background and foreground colors, respectively.
+ * Call clear_color_map() to disabled color mapping.
+ *
+ * @param[in] background Background color.
+ * @param[in] foreground Foreground color.
+ *
+ * @return CBGFX_* error codes
+ */
+int set_color_map(const struct rgb_color *background,
+ const struct rgb_color *foreground);
+
+/**
+ * Clear color mappings.
+ */
+void clear_color_map(void);
+
+/**
* Setup alpha and rgb values for alpha blending. When alpha is != 0,
* this enables a translucent layer of color (defined by rgb) to be
* blended at a given translucency (alpha) to all things drawn. Call
@@ -244,8 +262,6 @@ int set_blend(const struct rgb_color *rgb, uint8_t alpha);
/**
* Clear alpha and rgb values, thus disabling any alpha blending.
- *
- * @return CBGFX_* error codes
*/
void clear_blend(void);