Monopoly — Portage moderne
0.1.0
Portage moderne C/C++23 du Monopoly de 1999
Loading...
Searching...
No Matches
BitmapRuntime.hpp
Go to the documentation of this file.
1
#pragma once
2
#include "
LegacyBitmap.hpp
"
3
#include "
LegacyDataArchive.hpp
"
4
#include <memory>
5
#include <array>
6
#include <optional>
7
#include <unordered_map>
8
9
namespace
monopoly::data
10
{
11
struct
BitmapRuntimeAsset
12
{
13
DataId
dataId
{};
14
LegacyDataType
sourceType
{
LegacyDataType::Unknown
};
15
SharedDataBytes
source
;
16
LegacyBitmapRGBA8
image
;
17
// Opt-in presentation artwork. Retail and runtime text retain nearest sampling.
18
bool
preferLinearFiltering
{};
19
// Qualified presentation-only rectangle; original CNK bounds remain untouched.
20
std::optional<std::array<float, 4>>
presentationRect
;
21
};
22
// Immutable payload identity prevents DataId reuse across snapshots from
23
// returning stale pixels. Consumers retain their old asset after replacement.
24
class
BitmapRuntimeCache
final
25
{
26
public
:
27
[[
nodiscard
]] std::expected<std::shared_ptr<const BitmapRuntimeAsset>,
BitmapError
>
28
resolve
(
DataId
id
,
LegacyDataType
sourceType,
SharedDataBytes
bytes
);
29
// Called after render publication retires the previous consumers.
30
// Keep active immutable assets; unused entries must not pin DAT leases.
31
[[
nodiscard
]] std::size_t
releaseUnused
()
noexcept
;
32
void
clear
()
noexcept
{ assets_.clear(); }
33
[[
nodiscard
]] std::size_t
size
()
const
noexcept
{
return
assets_.size(); }
34
private
:
35
std::unordered_map<DataId, std::shared_ptr<const BitmapRuntimeAsset>> assets_;
36
};
37
}
bytes
std::vector< std::byte > bytes
Definition
BoardTextureRuntime.cpp:15
LegacyBitmap.hpp
LegacyDataArchive.hpp
index
unsigned index
Definition
ModernIBarSkin.cpp:25
monopoly::data::BitmapRuntimeCache
Definition
BitmapRuntime.hpp:25
monopoly::data::BitmapRuntimeCache::size
std::size_t size() const noexcept
Definition
BitmapRuntime.hpp:33
monopoly::data::BitmapRuntimeCache::releaseUnused
std::size_t releaseUnused() noexcept
Definition
BitmapRuntime.cpp:4
monopoly::data::BitmapRuntimeCache::clear
void clear() noexcept
Definition
BitmapRuntime.hpp:32
monopoly::data::BitmapRuntimeCache::resolve
std::expected< std::shared_ptr< const BitmapRuntimeAsset >, BitmapError > resolve(DataId id, LegacyDataType sourceType, SharedDataBytes bytes)
Definition
BitmapRuntime.cpp:11
monopoly::data
Definition
ArchiveAssembly.cpp:21
monopoly::data::DataId
std::uint32_t DataId
Definition
DataBanks.hpp:10
monopoly::data::LegacyDataType
LegacyDataType
Definition
LegacyDataArchive.hpp:24
monopoly::data::LegacyDataType::Unknown
@ Unknown
monopoly::data::SharedDataBytes
std::shared_ptr< const DataBytes > SharedDataBytes
Definition
LegacyDataArchive.hpp:152
monopoly::data::BitmapError
Definition
LegacyBitmap.hpp:35
monopoly::data::BitmapRuntimeAsset
Definition
BitmapRuntime.hpp:12
monopoly::data::BitmapRuntimeAsset::image
LegacyBitmapRGBA8 image
Definition
BitmapRuntime.hpp:16
monopoly::data::BitmapRuntimeAsset::presentationRect
std::optional< std::array< float, 4 > > presentationRect
Definition
BitmapRuntime.hpp:20
monopoly::data::BitmapRuntimeAsset::dataId
DataId dataId
Definition
BitmapRuntime.hpp:13
monopoly::data::BitmapRuntimeAsset::preferLinearFiltering
bool preferLinearFiltering
Definition
BitmapRuntime.hpp:18
monopoly::data::BitmapRuntimeAsset::sourceType
LegacyDataType sourceType
Definition
BitmapRuntime.hpp:14
monopoly::data::BitmapRuntimeAsset::source
SharedDataBytes source
Definition
BitmapRuntime.hpp:15
monopoly::data::LegacyBitmapRGBA8
Definition
LegacyBitmap.hpp:64
BitmapRuntime.hpp
Generated by
1.9.8