| 214 | } |
| 215 | |
| 216 | std::optional<View> getForImage(const ImageId image) |
| 217 | { |
| 218 | // No remapping required so use default palette map |
| 219 | if (!image.hasPrimary() && !image.isBlended()) |
| 220 | { |
| 221 | return std::nullopt; // Will use default |
| 222 | } |
| 223 | |
| 224 | if (image.hasSecondary()) |
| 225 | { |
| 226 | // Combines portions of two different palettes into the global palette map. |
| 227 | auto& paletteMap = _secondaryPaletteMapBuffer; |
| 228 | const auto primaryMap = getForColour(Colours::toExt(image.getPrimary())); |
| 229 | const auto secondaryMap = getForColour(Colours::toExt(image.getSecondary())); |
| 230 | if (!primaryMap || !secondaryMap) |
| 231 | { |
| 232 | assert(false); |
| 233 | } |
| 234 | |
| 235 | // Remap sections are split into two bits for primary |
| 236 | copyPaletteMapData(paletteMap, PaletteIndex::primaryRemap0, *primaryMap, PaletteIndex::primaryRemap0, (PaletteIndex::primaryRemap2 - PaletteIndex::primaryRemap0 + 1)); |
| 237 | copyPaletteMapData(paletteMap, PaletteIndex::primaryRemap3, *primaryMap, PaletteIndex::primaryRemap3, (PaletteIndex::primaryRemapB - PaletteIndex::primaryRemap3 + 1)); |
| 238 | copyPaletteMapData(paletteMap, PaletteIndex::secondaryRemap0, *secondaryMap, PaletteIndex::primaryRemap0, (PaletteIndex::primaryRemap2 - PaletteIndex::primaryRemap0 + 1)); |
| 239 | copyPaletteMapData(paletteMap, PaletteIndex::secondaryRemap3, *secondaryMap, PaletteIndex::primaryRemap3, (PaletteIndex::primaryRemapB - PaletteIndex::primaryRemap3 + 1)); |
| 240 | |
| 241 | return paletteMap; |
| 242 | } |
| 243 | else |
| 244 | { |
| 245 | if (image.isBlended()) |
| 246 | { |
| 247 | return getForColour(image.getTranslucency()); |
| 248 | } |
| 249 | else |
| 250 | { |
| 251 | // For primary flagged images |
| 252 | return getForColour(image.getRemap()); |
| 253 | } |
| 254 | } |
| 255 | } |
| 256 | |
| 257 | void setEntryImage(ExtColour paletteId, uint32_t imageId) |
| 258 | { |
no test coverage detected