yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
screen_editor_internal.h
Go to the documentation of this file.
1#ifndef YAZE_APP_EDITOR_GRAPHICS_SCREEN_EDITOR_INTERNAL_H_
2#define YAZE_APP_EDITOR_GRAPHICS_SCREEN_EDITOR_INTERNAL_H_
3
6
7namespace yaze {
8namespace editor {
9namespace internal {
10
11// Make a composite-output bitmap safe to draw this frame.
12//
13// Composites (title-screen BG1+BG2 overlay, dungeon room renderer output,
14// etc.) are owned by the editor pipeline that produced them, not by Arena's
15// gfx_sheets array. The first time the editor reaches the canvas-draw call
16// the bitmap may have a surface but no SDL texture yet, in which case
17// canvas_rendering's `if (!texture()) return;` guard silently drops the
18// draw and the canvas renders blank for one frame. A4 (title screen) and
19// A3 (dungeon room) both surfaced this race during the audit.
20//
21// Behavior:
22// * surface == nullptr -> no-op (bitmap not initialized).
23// * !is_active -> mark active.
24// * texture == nullptr -> queue CREATE.
25// * texture != nullptr, modified -> queue UPDATE and clear modified.
26// * else -> no-op.
27//
28// Stamps `metadata().purpose = kCompositeOutput` so the canvas-render
29// diagnostic log (canvas_rendering.cc) and any future role-aware tooling
30// can identify the bitmap correctly.
31//
32// Safe to call every frame; the Arena's CREATE branch checks for an
33// existing texture before allocating, so re-queuing is harmless.
35 if (composite.surface() == nullptr) {
36 return;
37 }
38 if (!composite.is_active()) {
39 composite.set_active(true);
40 }
41 if (composite.texture() == nullptr) {
44 composite.set_modified(false);
45 } else if (composite.modified()) {
48 composite.set_modified(false);
49 }
51}
52
53} // namespace internal
54} // namespace editor
55} // namespace yaze
56
57#endif // YAZE_APP_EDITOR_GRAPHICS_SCREEN_EDITOR_INTERNAL_H_
void QueueTextureCommand(TextureCommandType type, Bitmap *bitmap)
Definition arena.cc:36
static Arena & Get()
Definition arena.cc:21
Represents a bitmap image optimized for SNES ROM hacking.
Definition bitmap.h:67
TextureHandle texture() const
Definition bitmap.h:401
BitmapMetadata & metadata()
Definition bitmap.h:391
bool is_active() const
Definition bitmap.h:405
void set_modified(bool modified)
Definition bitmap.h:409
void set_active(bool active)
Definition bitmap.h:407
SDL_Surface * surface() const
Definition bitmap.h:400
bool modified() const
Definition bitmap.h:404
void EnsureCompositeBitmapTextureQueued(gfx::Bitmap &composite)