Skip to content

Commit

Permalink
Late colour conversion for picovision
Browse files Browse the repository at this point in the history
  • Loading branch information
Daft-Freak committed Dec 11, 2023
1 parent ff51693 commit 5d051a4
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions engine/render_rasterize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,25 @@ uint8_t animated_texture_counter = 0;
#define RASTERIZE_SECTION __scratch_x("render_rasterize")
#endif

#ifdef BLIT_BOARD_PIMORONI_PICOVISION
// convert to 555 and R/B swap
inline constexpr uint16_t pack_colour(uint8_t r, uint8_t g, uint8_t b) {
return r << 10 | (g >> 1) << 5 | b;
}

inline constexpr uint16_t convert_colour(uint16_t col) {
return (col & 0x7C0) >> 1 | col >> 11 | col << 10;
}
#else
// 565 all the way
inline constexpr uint16_t pack_colour(uint8_t r, uint8_t g, uint8_t b) {
return r | g << 5 | b << 11;
}

inline constexpr uint16_t convert_colour(uint16_t col) {
return col;
}
#endif

void RASTERIZE_SECTION render_rasterize(uint32_t num_triangle, color_t *fb) {

Expand Down

0 comments on commit 5d051a4

Please sign in to comment.