Skip to content

Commit

Permalink
Add BGR555 format
Browse files Browse the repository at this point in the history
The existing formats are

bytes                                  n-bit value
RRRRRRRR GGGGGGGG BBBBBBBB                     BBBBBBBBGGGGGGGGRRRRRRRR
RRRRRRRR GGGGGGGG BBBBBBBB AAAAAAAA    AAAAAAAABBBBBBBBGGGGGGGGRRRRRRRR
GGGRRRRR BBBBBGGG                              BBBBB   GGGGGG  RRRRR

This is
GGGBBBBB xRRRRRGG                      x       RRRRR   GGGGG   BBBBB

So as it's the other way around, call it BGR.

(Even though our RGB565 is a bit backwards, though if you consider them
as packed formats, they're ALL backwards)
  • Loading branch information
Daft-Freak committed Sep 29, 2023
1 parent 5e4303a commit 8a21799
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
5 changes: 5 additions & 0 deletions 32blit/graphics/surface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,11 @@ namespace blit {
bbf = RGBA_RGB565;
pgf = get_pen_rgb565;
}break;
default: {
pbf = nullptr;
bbf = nullptr;
pgf = nullptr;
}break;
}
}

Expand Down
4 changes: 3 additions & 1 deletion 32blit/graphics/surface.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,14 +80,16 @@ namespace blit {

// supported as the screen format
RGB565 = 4, // red (5-bits), green (6-bits), blue (5bits)
BGR555 = 5, // blue (5-bits), green (5-bits), red (5bits)
};

static const uint8_t pixel_format_stride[] = {
3, // RGB
4, // RGBA
1, // P
1, // M
2 // RGB565
2, // RGB565
2, // BGR555
};

#pragma pack(push, 1)
Expand Down

0 comments on commit 8a21799

Please sign in to comment.