Skip to content

Commit

Permalink
XXX Set SDL1 to a 16bit format
Browse files Browse the repository at this point in the history
  • Loading branch information
Ghabry committed Aug 29, 2024
1 parent c5fbfd1 commit 2131d77
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 20 deletions.
16 changes: 3 additions & 13 deletions src/pixel_format.h
Original file line number Diff line number Diff line change
Expand Up @@ -668,6 +668,9 @@ typedef PixelFormatT<32,PF::StaticMasks,PF::StaticAlpha,PF::NoAlpha,PF::IsAligne
typedef PixelFormatT<32,PF::StaticMasks,PF::StaticAlpha,PF::NoAlpha,PF::IsAligned,8,0,8,8,8,16,8,24> format_R8G8B8A8_n;
typedef PixelFormatT<32,PF::StaticMasks,PF::StaticAlpha,PF::NoAlpha,PF::IsAligned,8,24,8,16,8,8,8,0> format_A8B8G8R8_n;
typedef PixelFormatT<32,PF::StaticMasks,PF::StaticAlpha,PF::NoAlpha,PF::IsAligned,8,8,8,16,8,24,8,0> format_A8R8G8B8_n;

typedef PixelFormatT<16,PF::StaticMasks,PF::StaticAlpha,PF::Alpha,PF::IsAligned,5,10,5,5,5,0,1,15> format_A1R5G5B5_a;
typedef PixelFormatT<16,PF::StaticMasks,PF::StaticAlpha,PF::NoAlpha,PF::IsAligned,5,10,5,5,5,0,1,15> format_A1R5G5B5_n;
#else
typedef PixelFormatT<32,PF::StaticMasks,PF::StaticAlpha,PF::Alpha,PF::IsAligned,8,8,8,16,8,24,8,0> format_B8G8R8A8_a;
typedef PixelFormatT<32,PF::StaticMasks,PF::StaticAlpha,PF::Alpha,PF::IsAligned,8,24,8,16,8,8,8,0> format_R8G8B8A8_a;
Expand All @@ -680,17 +683,4 @@ typedef PixelFormatT<32,PF::StaticMasks,PF::StaticAlpha,PF::NoAlpha,PF::IsAligne
typedef PixelFormatT<32,PF::StaticMasks,PF::StaticAlpha,PF::NoAlpha,PF::IsAligned,8,16,8,8,8,0,8,24> format_A8R8G8B8_n;
#endif

typedef PixelFormatT< 8,PF::StaticMasks,PF::StaticAlpha,PF::NoAlpha,PF::IsAligned,8,0,8,0,8,0,0,0> format_L8;

typedef PixelFormatT<32,PF::DynamicMasks,PF::StaticAlpha,PF::Alpha,PF::IsAligned,0,0,0,0,0,0,0,0> format_dynamic_32_a;
typedef PixelFormatT<32,PF::DynamicMasks,PF::StaticAlpha,PF::NoAlpha,PF::IsAligned,0,0,0,0,0,0,0,0> format_dynamic_32_n;
typedef PixelFormatT<32,PF::DynamicMasks,PF::DynamicAlpha,PF::NoAlpha,PF::IsAligned,0,0,0,0,0,0,0,0> format_dynamic_32_d;

typedef PixelFormatT<24,PF::DynamicMasks,PF::StaticAlpha,PF::NoAlpha,PF::IsAligned,0,0,0,0,0,0,0,0> format_dynamic_24_n;
typedef PixelFormatT<24,PF::DynamicMasks,PF::DynamicAlpha,PF::NoAlpha,PF::IsAligned,0,0,0,0,0,0,0,0> format_dynamic_24_d;

typedef PixelFormatT<16,PF::DynamicMasks,PF::StaticAlpha,PF::Alpha,PF::NotAligned,0,0,0,0,0,0,0,0> format_dynamic_16_a;
typedef PixelFormatT<16,PF::DynamicMasks,PF::StaticAlpha,PF::NoAlpha,PF::NotAligned,0,0,0,0,0,0,0,0> format_dynamic_16_n;
typedef PixelFormatT<16,PF::DynamicMasks,PF::DynamicAlpha,PF::NoAlpha,PF::NotAligned,0,0,0,0,0,0,0,0> format_dynamic_16_d;

#endif
9 changes: 2 additions & 7 deletions src/platform/sdl/sdl_ui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include <cstdlib>
#include <cstring>

#include "pixel_format.h"
#include "system.h"

#include "sdl_ui.h"
Expand Down Expand Up @@ -88,13 +89,7 @@ SdlUi::SdlUi(long width, long height, const Game_Config& cfg) : BaseUi(cfg)
0x000000FF,
PF::NoAlpha);
#else
DynamicFormat format = DynamicFormat(
32,
0x00FF0000,
0x0000FF00,
0x000000FF,
0xFF000000,
PF::NoAlpha);
DynamicFormat format = format_A1R5G5B5_n().format();
#endif

Bitmap::SetFormat(Bitmap::ChooseFormat(format));
Expand Down

0 comments on commit 2131d77

Please sign in to comment.