From 9aed1465d70c32e186c2c65e83240630453bf017 Mon Sep 17 00:00:00 2001 From: Daisuke Nojiri Date: Thu, 8 Oct 2015 14:03:56 -0700 Subject: cbgfx: make the code more descriptive This change makes the code in graphics.c more descriptive and readable. Especially, it makes expressions for scale calculation look what they are meant to do. It also includes: - Rename variables (struct fraction, dim_org, etc.) for more consistency - Add more input validation (div-by-zero, etc.) BUG=chromium:502066 BRANCH=master TEST=Tested on Samus CQ-DEPEND=CL:304860 Change-Id: I2694912bb7b6017d5655de2fd655b95432addb22 Signed-off-by: Patrick Georgi Original-Commit-Id: 0863dc3ee925d3a05c83c66397b19a57f5478ef3 Original-Change-Id: Id8e349b8e09082fb84c3e1a984617f916e16c518 Original-Signed-off-by: Daisuke Nojiri Original-Reviewed-on: https://chromium-review.googlesource.com/304861 Original-Reviewed-by: Aaron Durbin Reviewed-on: http://review.coreboot.org/11928 Tested-by: build bot (Jenkins) --- payloads/libpayload/include/cbgfx.h | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'payloads/libpayload/include') diff --git a/payloads/libpayload/include/cbgfx.h b/payloads/libpayload/include/cbgfx.h index ffd8534d13..54d395395a 100644 --- a/payloads/libpayload/include/cbgfx.h +++ b/payloads/libpayload/include/cbgfx.h @@ -30,8 +30,8 @@ #define CBGFX_ERROR_SCALE_OUT_OF_RANGE 0x13 struct fraction { - int32_t nume; - int32_t deno; + int32_t n; + int32_t d; }; struct scale { @@ -147,5 +147,4 @@ int draw_bitmap(const void *bitmap, size_t size, * @return CBGFX_* error codes */ int draw_bitmap_direct(const void *bitmap, size_t size, - const struct vector *pos); - + const struct vector *top_left); -- cgit v1.2.3