22#ifndef HARVESTER_PALETTE_UTILS_H
23#define HARVESTER_PALETTE_UTILS_H
25#include "common/scummsys.h"
29inline byte expandHarvesterVgaDacColor(
byte value) {
31 return (value << 2) | (value >> 4);
34inline void buildHarvesterDisplayPalette(
const byte *source,
float brightness,
byte *dest) {
35 memset(dest, 0, 256 * 3);
39 if (brightness < 0.0f)
42 for (uint color = 1; color < 256; ++color) {
43 for (uint channel = 0; channel < 3; ++channel) {
44 const uint index = color * 3 + channel;
45 const int vgaDacValue = source[index] >> 2;
46 int scaled = (int)(vgaDacValue * brightness + 0.5f);
49 dest[index] = expandHarvesterVgaDacColor((
byte)scaled);