AGS: Engine: changed member names in StageScreen to avoid conflicts

From upstream 874953aea46a23f2ea49ee571cbce28fdc701f25
This commit is contained in:
Walter Agazzi 2023-03-02 18:10:08 +01:00 committed by Thierry Crozat
parent 982abc24f3
commit 6343759e09
2 changed files with 12 additions and 12 deletions

View File

@ -229,7 +229,7 @@ void VideoMemoryGraphicsDriver::UpdateSharedDDB(uint32_t sprite_id, Bitmap *bitm
void VideoMemoryGraphicsDriver::SetStageScreen(size_t index, const Size &sz) {
if (_stageScreens.size() <= index)
_stageScreens.resize(index + 1);
_stageScreens[index].Size = sz;
_stageScreens[index].PresetSize = sz;
}
Bitmap *VideoMemoryGraphicsDriver::GetStageScreenRaw(size_t index) {
@ -238,28 +238,28 @@ Bitmap *VideoMemoryGraphicsDriver::GetStageScreenRaw(size_t index) {
return nullptr;
auto &scr = _stageScreens[index];
const Size sz = scr.Size;
if (scr.Bitmap && (scr.Bitmap->GetSize() != sz)) {
scr.Bitmap.reset();
const Size sz = scr.PresetSize;
if (scr.Raw && (scr.Raw->GetSize() != sz)) {
scr.Raw.reset();
if (scr.DDB)
DestroyDDB(scr.DDB);
scr.DDB = nullptr;
}
if (!scr.Bitmap && !sz.IsNull()) {
scr.Bitmap.reset(new Bitmap(sz.Width, sz.Height, _mode.ColorDepth));
if (!scr.Raw && !sz.IsNull()) {
scr.Raw.reset(new Bitmap(sz.Width, sz.Height, _mode.ColorDepth));
scr.DDB = CreateDDB(sz.Width, sz.Height, _mode.ColorDepth, false);
}
return scr.Bitmap.get();
return scr.Raw.get();
}
IDriverDependantBitmap *VideoMemoryGraphicsDriver::UpdateStageScreenDDB(size_t index) {
assert((index < _stageScreens.size()) && _stageScreens[index].DDB);
if ((_stageScreens.size() <= index) || !_stageScreens[index].Bitmap || !_stageScreens[index].DDB)
if ((_stageScreens.size() <= index) || !_stageScreens[index].Raw || !_stageScreens[index].DDB)
return nullptr;
auto &scr = _stageScreens[index];
UpdateDDBFromBitmap(scr.DDB, scr.Bitmap.get(), true);
scr.Bitmap->ClearTransparent();
UpdateDDBFromBitmap(scr.DDB, scr.Raw.get(), true);
scr.Raw->ClearTransparent();
return scr.DDB;
}

View File

@ -307,8 +307,8 @@ private:
// TODO: possibly may be optimized further by having only 1 bitmap/ddb
// pair, and subbitmaps for raw drawing on separate stages.
struct StageScreen {
Size Size; // Size preset (bitmap may be created later)
std::unique_ptr<Bitmap> Bitmap;
Size PresetSize; // Size preset (bitmap may be created later)
std::unique_ptr<Bitmap> Raw;
IDriverDependantBitmap *DDB = nullptr;
};
std::vector<StageScreen> _stageScreens;