#include <graphics_sheet_store.h>

Public Member Functions | |
| Edit (GraphicsSheetStore &store, uint16_t sheet) | |
ok() is false when store does not hold sheet. | |
| ~Edit () | |
| Edit (const Edit &)=delete | |
| Edit & | operator= (const Edit &)=delete |
| bool | ok () const |
| uint16_t | sheet () const |
| uint8_t | Get (int x, int y) const |
| The pixel at (x, y), or 0 outside the sheet. | |
| bool | Set (int x, int y, uint8_t index) |
| const std::vector< uint8_t > & | before () const |
| The sheet as it was when the Edit began. | |
| absl::Span< const uint8_t > | pixels () const |
| The sheet now, including uncommitted pixels. | |
| void | Commit () |
| Bumps the revision once if any pixel changed since the last commit. | |
Static Public Member Functions | |
| static constexpr int | width () |
| static constexpr int | height () |
Private Attributes | |
| GraphicsSheetStore * | store_ = nullptr |
| uint16_t | sheet_ = 0 |
| std::vector< uint8_t > | before_ |
| bool | uncommitted_ = false |
One stroke on one sheet. Set() changes the store's pixels at once, so every reader sees them; the sheet's revision changes once, on Commit() or when the Edit ends. An Edit points into its store: keep it no longer than the stroke.
Definition at line 69 of file graphics_sheet_store.h.
| yaze::zelda3::GraphicsSheetStore::Edit::Edit | ( | GraphicsSheetStore & | store, |
| uint16_t | sheet ) |
ok() is false when store does not hold sheet.
Definition at line 78 of file graphics_sheet_store.cc.
References before_, yaze::zelda3::GraphicsSheetStore::HasSheet(), sheet(), yaze::zelda3::GraphicsSheetStore::Sheet(), and store_.

| yaze::zelda3::GraphicsSheetStore::Edit::~Edit | ( | ) |
Definition at line 88 of file graphics_sheet_store.cc.
|
delete |
|
inline |
Definition at line 77 of file graphics_sheet_store.h.
References store_.
|
inline |
|
inlinestaticconstexpr |
Definition at line 79 of file graphics_sheet_store.h.
References yaze::zelda3::GraphicsSheetStore::kSheetWidth.
|
inlinestaticconstexpr |
Definition at line 80 of file graphics_sheet_store.h.
References yaze::zelda3::GraphicsSheetStore::kSheetHeight.
| uint8_t yaze::zelda3::GraphicsSheetStore::Edit::Get | ( | int | x, |
| int | y ) const |
The pixel at (x, y), or 0 outside the sheet.
Definition at line 92 of file graphics_sheet_store.cc.
References yaze::zelda3::GraphicsSheetStore::kSheetBytes, and yaze::zelda3::GraphicsSheetStore::kSheetWidth.
| bool yaze::zelda3::GraphicsSheetStore::Edit::Set | ( | int | x, |
| int | y, | ||
| uint8_t | index ) |
Writes one pixel; ignores coordinates outside the sheet. Returns true when the pixel changed.
Definition at line 99 of file graphics_sheet_store.cc.
References yaze::zelda3::GraphicsSheetStore::kSheetBytes, and yaze::zelda3::GraphicsSheetStore::kSheetWidth.
|
inline |
The sheet as it was when the Edit began.
Definition at line 88 of file graphics_sheet_store.h.
References before_.
| absl::Span< const uint8_t > yaze::zelda3::GraphicsSheetStore::Edit::pixels | ( | ) | const |
The sheet now, including uncommitted pixels.
Definition at line 112 of file graphics_sheet_store.cc.
| void yaze::zelda3::GraphicsSheetStore::Edit::Commit | ( | ) |
Bumps the revision once if any pixel changed since the last commit.
Definition at line 116 of file graphics_sheet_store.cc.
|
private |
Definition at line 95 of file graphics_sheet_store.h.
|
private |
Definition at line 96 of file graphics_sheet_store.h.
Referenced by sheet().
|
private |
Definition at line 97 of file graphics_sheet_store.h.
|
private |
Definition at line 98 of file graphics_sheet_store.h.