diff options
author | Hop311 <hop3114@gmail.com> | 2023-09-25 22:52:57 +0200 |
---|---|---|
committer | Hop311 <hop3114@gmail.com> | 2023-09-25 22:52:57 +0200 |
commit | 932b43953d623557236a31b30899b706307260ed (patch) | |
tree | f259ab717ad77faf2562f97c809fd641e37ea58a /src/openvic-simulation/map/Map.cpp | |
parent | b84f5a03b40f1925c456cd247c2c2f04af8ef778 (diff) |
Added review comments
Diffstat (limited to 'src/openvic-simulation/map/Map.cpp')
-rw-r--r-- | src/openvic-simulation/map/Map.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/openvic-simulation/map/Map.cpp b/src/openvic-simulation/map/Map.cpp index 936feba..e29f104 100644 --- a/src/openvic-simulation/map/Map.cpp +++ b/src/openvic-simulation/map/Map.cpp @@ -404,6 +404,10 @@ bool Map::load_region_file(ast::NodeCPtr root) { } static constexpr colour_t colour_at(uint8_t const* colour_data, int32_t idx) { + /* colour_data is filled with BGR byte triplets - to get pixel idx as a + * single RGB value, multiply idx by 3 to get the index of the corresponding + * triplet, then combine the bytes in reverse order. + */ idx *= 3; return (colour_data[idx + 2] << 16) | (colour_data[idx + 1] << 8) | colour_data[idx]; } |