#include <graphics_sheet_store.h>
Classes | |
| class | Edit |
Public Member Functions | |
| const std::vector< uint8_t > & | pixels () const |
| std::vector< uint8_t > & | mutable_pixels () |
For the graphics_buffer alias and the loader only. | |
| bool | HasSheet (uint16_t sheet) const |
True when the buffer holds all 4096 bytes of sheet. | |
| absl::Span< const uint8_t > | Sheet (uint16_t sheet) const |
| The sheet's 4096 pixels, or an empty span when it is not held. | |
| uint64_t | Revision (uint16_t sheet) const |
| absl::Status | WriteSheet (uint16_t sheet, absl::Span< const uint8_t > pixels, uint8_t max_index=0x0F) |
| void | MarkAllSheetsChanged () |
| Call after the loader refills the buffer: bumps every revision. | |
| void | Clear () |
| Empties the buffer and bumps every revision. | |
Static Public Attributes | |
| static constexpr uint16_t | kSheetCount = 223 |
| static constexpr size_t | kSheetWidth = 128 |
| static constexpr size_t | kSheetHeight = 32 |
| static constexpr size_t | kSheetBytes = kSheetWidth * kSheetHeight |
Private Attributes | |
| std::vector< uint8_t > | pixels_ |
| std::array< uint64_t, kSheetCount > | revisions_ {} |
Definition at line 33 of file graphics_sheet_store.h.
|
inline |
The whole buffer, graphics_buffer layout. May hold fewer than 223 sheets while a load is in progress or after Clear().
Definition at line 42 of file graphics_sheet_store.h.
References pixels_.
Referenced by WriteSheet().
|
inline |
For the graphics_buffer alias and the loader only.
Definition at line 44 of file graphics_sheet_store.h.
References pixels_.
| bool yaze::zelda3::GraphicsSheetStore::HasSheet | ( | uint16_t | sheet | ) | const |
True when the buffer holds all 4096 bytes of sheet.
Definition at line 20 of file graphics_sheet_store.cc.
References kSheetBytes, kSheetCount, and pixels_.
Referenced by yaze::editor::GfxGroupEditor::DrawSheetPicker(), yaze::zelda3::GraphicsSheetStore::Edit::Edit(), yaze::editor::GfxGroupEditor::EditGraphicsSheet(), yaze::editor::DungeonEditorV2::EditRoomGraphicsSheet(), yaze::editor::sprite_graphics_context::Make(), yaze::editor::GraphicsEditor::OpenInContext(), yaze::editor::PlanPalettePixelPermutation(), yaze::editor::GfxGroupEditor::PrepareSheetPreview(), yaze::editor::RomSession::ReloadGraphicsDisplay(), yaze::editor::ResolveOverworldQuadrantTarget(), Sheet(), and WriteSheet().
| absl::Span< const uint8_t > yaze::zelda3::GraphicsSheetStore::Sheet | ( | uint16_t | sheet | ) | const |
The sheet's 4096 pixels, or an empty span when it is not held.
Definition at line 25 of file graphics_sheet_store.cc.
References HasSheet(), kSheetBytes, and pixels_.
Referenced by yaze::zelda3::GraphicsSheetStore::Edit::Edit(), yaze::editor::ScreenEditor::Load(), yaze::editor::SpriteEditor::LoadSpriteGraphicsBuffer(), yaze::editor::PlanPalettePixelPermutation(), yaze::editor::GfxGroupEditor::PrepareSheetPreview(), yaze::editor::ScreenEditor::RefreshDungeonMapGraphicsFromSession(), yaze::editor::RomSession::ReloadGraphicsDisplay(), yaze::editor::RenderDungeonMapTilesGfxPreview(), and yaze::editor::usage_preview::SnapshotSessionSheets().

| uint64_t yaze::zelda3::GraphicsSheetStore::Revision | ( | uint16_t | sheet | ) | const |
Changes each time the store replaces this sheet's pixels; 0 for a sheet out of range.
Definition at line 32 of file graphics_sheet_store.cc.
References kSheetCount, and revisions_.
Referenced by yaze::editor::AttachSheetStore(), yaze::editor::PaletteReorderControl::Begin(), yaze::editor::GraphicsEditor::BuildContextSnapshot(), yaze::editor::UsagePreviewView::HashWatchedSheets(), yaze::editor::sprite_graphics_context::Make(), yaze::editor::MakeDungeonMapTilesGfxEditContext(), yaze::zelda3::Room::RecordSourceSheet(), yaze::zelda3::OverworldMap::RecordSourceSheetRevisions(), yaze::editor::SpriteEditor::RefreshSpritePreviewGraphics(), yaze::editor::UsagePreviewView::SharedUsesHash(), yaze::zelda3::anonymous_namespace{resolved_graphics_context.cc}::SheetRevision(), yaze::zelda3::Overworld::SheetRevisionsForKey(), yaze::editor::PaletteReorderControl::SourceChanged(), yaze::zelda3::Room::SourceSheetsChanged(), and yaze::zelda3::OverworldMap::SourceSheetsChanged().
| absl::Status yaze::zelda3::GraphicsSheetStore::WriteSheet | ( | uint16_t | sheet, |
| absl::Span< const uint8_t > | pixels, | ||
| uint8_t | max_index = 0x0F ) |
Replaces one sheet's pixels and bumps its revision. Refuses a sheet outside the buffer, the wrong size, or indices above max_index. Writing identical pixels changes nothing, including the revision.
Definition at line 36 of file graphics_sheet_store.cc.
References HasSheet(), kSheetBytes, kSheetWidth, pixels(), pixels_, and revisions_.

| void yaze::zelda3::GraphicsSheetStore::MarkAllSheetsChanged | ( | ) |
Call after the loader refills the buffer: bumps every revision.
Definition at line 67 of file graphics_sheet_store.cc.
References revisions_.
Referenced by Clear(), and yaze::zelda3::LoadGraphics().
| void yaze::zelda3::GraphicsSheetStore::Clear | ( | ) |
Empties the buffer and bumps every revision.
Definition at line 73 of file graphics_sheet_store.cc.
References MarkAllSheetsChanged(), and pixels_.
Referenced by yaze::zelda3::GameData::Clear(), and yaze::zelda3::LoadGraphics().

|
staticconstexpr |
Definition at line 35 of file graphics_sheet_store.h.
Referenced by yaze::editor::RoomGraphicsContent::DrawAssignmentPicker(), yaze::editor::GfxGroupEditor::DrawSheetPicker(), yaze::editor::GfxGroupEditor::EditGraphicsSheet(), yaze::editor::DungeonEditorV2::EditRoomGraphicsSheet(), HasSheet(), yaze::editor::GfxGroupEditor::PrepareSheetPreview(), Revision(), and yaze::zelda3::anonymous_namespace{resolved_graphics_context.cc}::SheetRevision().
|
staticconstexpr |
Definition at line 36 of file graphics_sheet_store.h.
Referenced by yaze::zelda3::anonymous_namespace{resolved_graphics_context.cc}::FillSheetShape(), yaze::zelda3::GraphicsSheetStore::Edit::Get(), yaze::zelda3::GraphicsSheetStore::Edit::Set(), yaze::zelda3::GraphicsSheetStore::Edit::width(), and WriteSheet().
|
staticconstexpr |
Definition at line 37 of file graphics_sheet_store.h.
Referenced by yaze::zelda3::anonymous_namespace{resolved_graphics_context.cc}::FillSheetShape(), and yaze::zelda3::GraphicsSheetStore::Edit::height().
|
staticconstexpr |
Definition at line 38 of file graphics_sheet_store.h.
Referenced by yaze::zelda3::GraphicsSheetStore::Edit::Get(), HasSheet(), yaze::zelda3::GraphicsSheetStore::Edit::Set(), Sheet(), and WriteSheet().
|
private |
Definition at line 102 of file graphics_sheet_store.h.
Referenced by Clear(), HasSheet(), mutable_pixels(), pixels(), Sheet(), and WriteSheet().
|
private |
Definition at line 103 of file graphics_sheet_store.h.
Referenced by MarkAllSheetsChanged(), Revision(), and WriteSheet().