MCPcopy Create free account
hub / github.com/OpenImageDebugger/OpenImageDebugger / apply_format

Function apply_format

src/host/ui/panels/toolbar_panel.cpp:92–118  ·  view source on GitHub ↗

Applies the combo selection to `b`, mirroring the legacy Qt frontend's apply_format() (see tag legacy-qt) exactly, including its display-channel-mode / pixel-layout pairing.

Source from the content-addressed store, hash-verified

90// apply_format() (see tag legacy-qt) exactly, including its
91// display-channel-mode / pixel-layout pairing.
92void apply_format(oid::Buffer& b, int sel) {
93 using enum PixelFormat;
94 switch (sel) {
95 case static_cast<int>(kBgra):
96 b.set_display_channel_mode(-1);
97 b.set_pixel_layout("bgra");
98 break;
99 case static_cast<int>(kRgba):
100 b.set_display_channel_mode(-1);
101 b.set_pixel_layout("rgba");
102 break;
103 case static_cast<int>(kChannel0):
104 b.set_display_channel_mode(1);
105 b.set_pixel_layout("rrra");
106 break;
107 case static_cast<int>(kChannel1):
108 b.set_display_channel_mode(1);
109 b.set_pixel_layout("ggga");
110 break;
111 case static_cast<int>(kChannel2):
112 b.set_display_channel_mode(1);
113 b.set_pixel_layout("bbba");
114 break;
115 default:
116 break;
117 }
118}
119
120// Derives the combo's current selection from the buffer's live state
121// (display-channel-mode + pixel layout) every frame rather than caching a

Callers 1

draw_toolbarFunction · 0.85

Calls 2

set_pixel_layoutMethod · 0.80

Tested by

no test coverage detected