Skip to content

Commit

Permalink
Merge branch 'hdr_desktop_capture' of https://github.com/SpecialKO/SKIV
Browse files Browse the repository at this point in the history
… into hdr_desktop_capture
  • Loading branch information
Aemony committed Jun 24, 2024
2 parents 3f189b5 + 8dc2e49 commit 9be9b85
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/tabs/viewer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1920,9 +1920,29 @@ SKIF_UI_Tab_DrawViewer (void)
SKIV_HDR_MaxCLL = 1.0f;

ImVec2 image_pos = ImGui::GetCursorScreenPos ( ); // NOTE! Actual screen position (since that's what ImGui::Image uses)
// Snap position to integer coordinates, starting at (0,0)
//
if (image_pos.x < 1.0f) image_pos.x = 0.0f;
if (image_pos.y < 1.0f) image_pos.y = 0.0f;

image_pos = ImVec2 ( roundf (image_pos.x),
roundf (image_pos.y) );

ImGui::SetCursorPos (image_pos);
ImRect image_rect = ImRect (image_pos, image_pos + sizeCover);

#if 1
// Display game cover image
ImDrawList* draw_list =
ImGui::GetWindowDrawList ();

if (cover.pRawTexSRV.p != nullptr)
{
draw_list->AddImage (cover.pRawTexSRV.p, image_pos, ImVec2 (image_pos.x+sizeCover.x, image_pos.y+sizeCover.y),
cover.light_info.isHDR ? hdr_uv0 : cover.uv0, // Top Left coordinates
cover.light_info.isHDR ? hdr_uv1 : cover.uv1); // Bottom Right coordinates
}
#else
SKIF_ImGui_OptImage (cover.pRawTexSRV.p,
ImVec2 (sizeCover.x,
sizeCover.y),
Expand All @@ -1931,6 +1951,7 @@ SKIF_UI_Tab_DrawViewer (void)
(_registry._StyleLightMode) ? ImVec4 (1.0f, 1.0f, 1.0f, fGammaCorrectedTint * AdjustAlpha (fAlpha)) :
ImVec4 (1.f, 1.f, 1.f, 1.f) // Alpha transparency (2024-01-01, removed fGammaCorrectedTint * fAlpha for the light style)
);
#endif

isImageHovered = ImGui::IsItemHovered();

Expand Down

0 comments on commit 9be9b85

Please sign in to comment.