Skip to content
This repository was archived by the owner on Jan 5, 2024. It is now read-only.

Commit e4df9be

Browse files
committed
Make FrameMan::BPP public and actually use it
1 parent 2431608 commit e4df9be

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

Managers/FrameMan.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ namespace RTE {
8989
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
9090

9191
int FrameMan::Initialize() {
92-
set_color_depth(m_BPP);
92+
set_color_depth(c_BPP);
9393
// Sets the allowed color conversions when loading bitmaps from files
9494
set_color_conversion(COLORCONV_MOST);
9595

@@ -122,10 +122,10 @@ namespace RTE {
122122
ClearBackBuffer8();
123123

124124
// Create the post-processing buffer, it'll be used for glow effects etc
125-
m_BackBuffer32 = std::unique_ptr<BITMAP, BitmapDeleter>(create_bitmap_ex(32, resX, resY));
125+
m_BackBuffer32 = std::unique_ptr<BITMAP, BitmapDeleter>(create_bitmap_ex(c_BPP, resX, resY));
126126
ClearBackBuffer32();
127127

128-
m_OverlayBitmap32 = std::unique_ptr<BITMAP, BitmapDeleter>(create_bitmap_ex(32, resX, resY));
128+
m_OverlayBitmap32 = std::unique_ptr<BITMAP, BitmapDeleter>(create_bitmap_ex(c_BPP, resX, resY));
129129
clear_to_color(m_OverlayBitmap32.get(), 0);
130130

131131
// Create all the network 8bpp back buffers
@@ -550,12 +550,12 @@ namespace RTE {
550550
case ScenePreviewDump:
551551
case WorldDump:
552552
if (!m_WorldDumpBuffer || (m_WorldDumpBuffer->w != g_SceneMan.GetSceneWidth() || m_WorldDumpBuffer->h != g_SceneMan.GetSceneHeight())) {
553-
m_WorldDumpBuffer = std::unique_ptr<BITMAP, BitmapDeleter>(create_bitmap_ex(32, g_SceneMan.GetSceneWidth(), g_SceneMan.GetSceneHeight()));
553+
m_WorldDumpBuffer = std::unique_ptr<BITMAP, BitmapDeleter>(create_bitmap_ex(c_BPP, g_SceneMan.GetSceneWidth(), g_SceneMan.GetSceneHeight()));
554554
}
555555
if (modeToSave == ScenePreviewDump) {
556556
DrawWorldDump(true);
557557

558-
BITMAP *scenePreviewDumpBuffer = create_bitmap_ex(32, c_ScenePreviewWidth, c_ScenePreviewHeight);
558+
BITMAP *scenePreviewDumpBuffer = create_bitmap_ex(c_BPP, c_ScenePreviewWidth, c_ScenePreviewHeight);
559559
blit(m_ScenePreviewDumpGradient.get(), scenePreviewDumpBuffer, 0, 0, 0, 0, scenePreviewDumpBuffer->w, scenePreviewDumpBuffer->h);
560560
masked_stretch_blit(m_WorldDumpBuffer.get(), scenePreviewDumpBuffer, 0, 0, m_WorldDumpBuffer->w, m_WorldDumpBuffer->h, 0, 0, scenePreviewDumpBuffer->w, scenePreviewDumpBuffer->h);
561561

Managers/FrameMan.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ namespace RTE {
2727

2828
public:
2929

30+
static constexpr int c_BPP = 32; //!< Color depth (bits per pixel).
31+
3032
Vector SLOffset[c_MaxScreenCount][c_MaxLayersStoredForNetwork]; //!< SceneLayer offsets for each screen in online multiplayer.
3133

3234
#pragma region Creation
@@ -466,8 +468,6 @@ namespace RTE {
466468
/// </summary>
467469
enum SaveBitmapMode { SingleBitmap, ScreenDump, WorldDump, ScenePreviewDump };
468470

469-
static constexpr int m_BPP = 32; //!< Color depth (bits per pixel).
470-
471471
static const std::array<std::function<void(int r, int g, int b, int a)>, DrawBlendMode::BlendModeCount> c_BlenderSetterFunctions; //!< Array of function references to Allegro blender setters for convenient access when creating new color tables.
472472

473473
bool m_HSplit; //!< Whether the screen is split horizontally across the screen, ie as two splitscreens one above the other.

Managers/PerformanceMan.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ namespace RTE {
3636
m_SimUpdateTimer = std::make_unique<Timer>();
3737

3838
m_IntermediateDrawBitmap = create_bitmap_ex(8, 280, 380);
39-
m_ColorConversionBitmap = create_bitmap_ex(32, 280, 380);
39+
m_ColorConversionBitmap = create_bitmap_ex(FrameMan::c_BPP, 280, 380);
4040

4141
for (int counter = 0; counter < PerformanceCounters::PerfCounterCount; ++counter) {
4242
m_PerfData[counter].fill(0);

Managers/WindowMan.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -570,7 +570,7 @@ namespace RTE {
570570
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
571571

572572
void WindowMan::UploadFrame() const {
573-
static constexpr int bytesPerPixel = FrameMan::m_BPP / 8;
573+
static constexpr int bytesPerPixel = FrameMan::c_BPP / 8;
574574

575575
const BITMAP *backbuffer = g_FrameMan.GetBackBuffer32();
576576

0 commit comments

Comments
 (0)