impr: Small code layout improvements for diagrams
This commit is contained in:
parent
3fa06cc7c0
commit
58ad9f2ca8
@ -110,10 +110,6 @@ namespace hex {
|
|||||||
explicit DiagramDigram() { }
|
explicit DiagramDigram() { }
|
||||||
|
|
||||||
void draw(ImVec2 size) {
|
void draw(ImVec2 size) {
|
||||||
ImGui::PushStyleColor(ImGuiCol_ChildBg, ImU32(ImColor(0, 0, 0)));
|
|
||||||
if (ImGui::BeginChild("##digram", size, true)) {
|
|
||||||
auto drawList = ImGui::GetWindowDrawList();
|
|
||||||
|
|
||||||
if (!m_processing) {
|
if (!m_processing) {
|
||||||
if (!m_textureValid) {
|
if (!m_textureValid) {
|
||||||
std::vector<u32> pixels;
|
std::vector<u32> pixels;
|
||||||
@ -135,11 +131,16 @@ namespace hex {
|
|||||||
m_texture = ImGuiExt::Texture(reinterpret_cast<u8*>(pixels.data()), pixels.size() * 4, m_filter, 0xFF, 0xFF);
|
m_texture = ImGuiExt::Texture(reinterpret_cast<u8*>(pixels.data()), pixels.size() * 4, m_filter, 0xFF, 0xFF);
|
||||||
m_textureValid = m_texture.isValid();
|
m_textureValid = m_texture.isValid();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ImGui::PushStyleColor(ImGuiCol_ChildBg, ImU32(ImColor(0, 0, 0)));
|
||||||
|
if (ImGui::BeginChild("##digram", size, ImGuiChildFlags_Border)) {
|
||||||
|
auto drawList = ImGui::GetWindowDrawList();
|
||||||
|
|
||||||
|
if (m_textureValid) {
|
||||||
auto pos = ImGui::GetWindowPos() + ImVec2(size.x * 0.025F, size.y * 0.025F);
|
auto pos = ImGui::GetWindowPos() + ImVec2(size.x * 0.025F, size.y * 0.025F);
|
||||||
drawList->AddImage(m_texture, pos, pos + size * 0.95F);
|
drawList->AddImage(m_texture, pos, pos + size * 0.95F);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
ImGui::EndChild();
|
ImGui::EndChild();
|
||||||
ImGui::PopStyleColor();
|
ImGui::PopStyleColor();
|
||||||
@ -235,10 +236,6 @@ namespace hex {
|
|||||||
explicit DiagramLayeredDistribution() { }
|
explicit DiagramLayeredDistribution() { }
|
||||||
|
|
||||||
void draw(ImVec2 size) {
|
void draw(ImVec2 size) {
|
||||||
ImGui::PushStyleColor(ImGuiCol_ChildBg, ImU32(ImColor(0, 0, 0)));
|
|
||||||
if (ImGui::BeginChild("##layered_distribution", size, true)) {
|
|
||||||
auto drawList = ImGui::GetWindowDrawList();
|
|
||||||
|
|
||||||
if (!m_processing) {
|
if (!m_processing) {
|
||||||
if (!m_textureValid) {
|
if (!m_textureValid) {
|
||||||
std::vector<u32> pixels;
|
std::vector<u32> pixels;
|
||||||
@ -257,7 +254,13 @@ namespace hex {
|
|||||||
m_texture = ImGuiExt::Texture(reinterpret_cast<u8*>(pixels.data()), pixels.size() * 4, m_filter, 0xFF, 0xFF);
|
m_texture = ImGuiExt::Texture(reinterpret_cast<u8*>(pixels.data()), pixels.size() * 4, m_filter, 0xFF, 0xFF);
|
||||||
m_textureValid = m_texture.isValid();
|
m_textureValid = m_texture.isValid();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ImGui::PushStyleColor(ImGuiCol_ChildBg, ImU32(ImColor(0, 0, 0)));
|
||||||
|
if (ImGui::BeginChild("##layered_distribution", size, ImGuiChildFlags_Border)) {
|
||||||
|
auto drawList = ImGui::GetWindowDrawList();
|
||||||
|
|
||||||
|
if (m_textureValid) {
|
||||||
const auto pos = ImGui::GetWindowPos() + ImVec2(size.x * 0.025F, size.y * 0.025F);
|
const auto pos = ImGui::GetWindowPos() + ImVec2(size.x * 0.025F, size.y * 0.025F);
|
||||||
drawList->AddImage(m_texture, pos, pos + size * 0.95F);
|
drawList->AddImage(m_texture, pos, pos + size * 0.95F);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user