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

Function svg_source_for

src/host/ui/svg_icon_cache.cpp:49–71  ·  view source on GitHub ↗

Maps an IconId to its embedded SVG source (headers generated from src/resources/icons/*.svg, one " _svg.h" per icon). Returns {data, size}; every IconId has a matching array, so there is no "not found" case.

Source from the content-addressed store, hash-verified

47// {data, size}; every IconId has a matching array, so there is no
48// "not found" case.
49std::pair<const unsigned char*, std::size_t> svg_source_for(IconId id) {
50 using enum IconId;
51 switch (id) {
52 case ChannelRed:
53 return {icons::kLabelRedChannelSvg, sizeof(icons::kLabelRedChannelSvg)};
54 case ChannelGreen:
55 return {icons::kLabelGreenChannelSvg,
56 sizeof(icons::kLabelGreenChannelSvg)};
57 case ChannelBlue:
58 return {icons::kLabelBlueChannelSvg,
59 sizeof(icons::kLabelBlueChannelSvg)};
60 case ChannelAlpha:
61 return {icons::kLabelAlphaChannelSvg,
62 sizeof(icons::kLabelAlphaChannelSvg)};
63 case LowerUpperBound:
64 return {icons::kLowerUpperBoundSvg, sizeof(icons::kLowerUpperBoundSvg)};
65 case GoToX:
66 return {icons::kXSvg, sizeof(icons::kXSvg)};
67 case GoToY:
68 return {icons::kYSvg, sizeof(icons::kYSvg)};
69 }
70 return {nullptr, 0};
71}
72
73} // namespace
74

Callers 1

texture_forMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected