Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inconsistent result between AddImageRounded and AddImage #7484

Open
pozemka opened this issue Apr 11, 2024 · 0 comments
Open

Inconsistent result between AddImageRounded and AddImage #7484

pozemka opened this issue Apr 11, 2024 · 0 comments

Comments

@pozemka
Copy link

pozemka commented Apr 11, 2024

Version/Branch of Dear ImGui:

v1.90.2 WIP docking

Back-ends:

imgui_impl_win32.h + imgui_impl_dx11.h

Compiler, OS:

Windows 10 + MSVC 2022

Full config/build information:

No response

Details:

Hello!

I am drawing two images in the same place. Background is drawn with AddImageRounded. Foreground is drawn with AddImage

Here black image is drawn using AddImage (same result is for AddImageRounded with 0.0f corner radius).
image
Here black image is drawn using AddImageRounded with 25.0f corner radius
image
Zoom of the second image:
image
as you can see in the second case black image looks moved half pixel up.

draw_list->AddImageRounded(texture.texid,
                           bb0,
                           bb1,
                           ImVec2 {0.f, 0.f},
                           ImVec2 {1.f, 1.f},
                           IM_COL32_WHITE,
                           25.0f);
draw_list->AddImage(texture2.texid,
                           bb0,
                           bb1);

The reason is that bb0.y has value 1190.5. When I apply flooring to y coordinate, both images are aligned perfectly.

This may be expected for someone, but for me it was confusing to find out that two very similar functions (or even AddImageRounded with radius <0.5f) behave different. Not sure if this is a defect report or just observation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants