Commit Graph

6844 Commits

Author SHA1 Message Date
Ben Carter
b175371325 Texture-based round corners: Added sampling offset and bitmask for generated radii 2022-02-15 16:10:55 +01:00
Ben Carter
75f5aaaa1c Texture-based round corners: Use separate textures for square corners and fix a bunch of corner-case issues 2022-02-15 16:10:55 +01:00
ocornut
5820a7e248 Texture-based round corners: Fix building for stroke width 1,2,4 instead of 1,3,4. 2022-02-15 16:10:55 +01:00
ocornut
a6fa56609b Texture-based round corners: Fix UV coordinates used by RenderWindowResizeGrip() - render was broken 2022-02-15 16:10:55 +01:00
ocornut
05d9502075 Texture-based round corners: Moved RenderResizeGripWithTex to RenderWindowResizeGrip 2022-02-15 16:10:55 +01:00
ocornut
5947842934 Texture-based round corners: Tweaks, renaming to match tex lines branch. 2022-02-15 16:10:55 +01:00
omar
f41e86c78e Texture-based round corners: Default circle segment count to 0 + fix warnings, remove unused macro 2022-02-15 16:10:55 +01:00
omar
1858d8d3f5 Texture-based round corners: Removed polling for Shift key in draw functions, moved that responsibility to demo code.
Minor coding style tweaks. Using IM_ASSERT_PARANOID where suitable.
2022-02-15 16:10:54 +01:00
Ben Carter
ff3e7feba7 Texture-based round corners: Added support for multiple stroke widths 2022-02-15 16:10:54 +01:00
Ben Carter
8e97a4a724 Texture-based round corners: Refactoring and upgrades
Changed texture-based rounded rectangle edges to draw using thin polygons
Rearranged data for texture-based rounded rectangles to reduce allocations and pre-calculate parametric coordinate
Made max texture-based corner size a constant
Added API for drawing n-gons
Added support in circle API to auto-calculate suitable segment count
2022-02-15 16:10:24 +01:00
Ben Carter
a0ef8c9187 Texture-based round corners: Added support for window grip rendering 2022-02-15 16:09:57 +01:00
Ben Carter
3f671bd282 Texture-based round corners: Adding style/drawlist flags for rounded corner textures 2022-02-15 16:09:57 +01:00
omar
a1efd8fc06 Texture-based round corners: Minor tweaks 2022-02-15 16:09:57 +01:00
Ben Carter
ed1e598ebe Texture-based round corners: Optimized texture-based rounded rectangle/circle code for better CPU performance at the cost of fill-rate 2022-02-15 16:09:57 +01:00
omar
edb797538d Texture-based round corners: Using ImFabs() + Minor coding style fixes for consistency 2022-02-15 16:09:57 +01:00
Ben Carter
054c87fc4f Texture-based round corners: Fixed not drawing correctly with small radii
Combined filled/outline arc textures into one texture rectangle per radius
Made rounded rectangles/circles draw using (moderately) tight-fitting geometry to minimise fill-rate usage
Hooked up texture-based rounded rectangle/circle code to main render path, with fallback to stroke system
Made AddCircleFilled/AddCircle explicitly not draw circles of radius 0 or less (to avoid inconsistency between them)
Fixed bug in PrimReserve() where releasing more vertices/indices than you used would try and immediately render the entire buffer
2022-02-15 16:09:57 +01:00
omar
d81c5cbae3 Texture-based round corners: Make FIXME consistent so they can be grepped. Tidying and added notes of things to fix. 2022-02-15 16:09:57 +01:00
Francisco Demartino
fbc6bce06b Texture-based round corners: Store rounded corners in texture to use 1 quad per corner. 2022-02-15 16:09:57 +01:00
thedmd
b6b8f6634e ImVector: Fixed erase() with empty range. (#5009) 2022-02-15 11:16:08 +01:00
ocornut
5854da10e6 Declare other structures as constexpr (#4995) + rename ImGuiInputEventType_Char to ImGuiInputEventType_Text for consistency with event structure. 2022-02-11 12:29:55 +01:00
Jeff Mears
71f98dd056 Declare ImVec2 and ImVec4 constructors as constexpr (#4995) 2022-02-11 12:27:27 +01:00
Borislav Stanimirov
955aacfbc5
GCC: Disable deprecated-enum-enum-conversion for gcc as well (#4997) 2022-02-09 09:47:11 +01:00
thedmd
4691fa0ed5 ImDrawList: PthArcTo: Add small tolerance when comparing angles (#4993) 2022-02-08 17:37:45 +01:00
ocornut
aa79d0cd2f Stack Tool: Added option to copy item path to clipboard. (#4631) 2022-02-08 16:36:54 +01:00
ocornut
88de982071 Version 1.88 WIP 2022-02-08 14:45:26 +01:00
ocornut
97b1abd6dd Internals: rework RenderMouseCursor() signature so we can use it in docking branch more naturally. 2022-02-08 12:22:46 +01:00
ocornut
c71a50deb5 Version 1.87 2022-02-07 18:16:54 +01:00
ocornut
e52bb147a7 Backends: GLFW: Added ImGui_ImplGlfw_InstallCallbacks()/ImGui_ImplGlfw_RestoreCallbacks(). (#4981) 2022-02-07 16:11:05 +01:00
ocornut
732bc2058e Backends: GLFW: Handle spurious leave/enter sequences apparently submitted by X11/GLFW combo. (#4984) 2022-02-07 15:59:49 +01:00
Rokas Kupstys
40fd163a3b Backends: OpenGL3: Fix OpenGL ES2 includes on Apple systems.
# Conflicts:
#	backends/imgui_impl_opengl3.cpp
#	docs/CHANGELOG.txt
2022-02-07 12:26:19 +01:00
ocornut
2554b512c0 Backends: OSX: Forward keyDown/keyUp events to OS when unused by Dear ImGui. 2022-02-07 11:55:24 +01:00
Clownacy
c6cab1f352 Backends: SDL: Added SDL_Renderer* parameter to ImGui_ImplSDL2_InitForSDLRenderer(). Use SDL_GetRendererOutputSize() instead of SDL_GL_GetDrawableSize() when bound to a SDL_Renderer. (#4927)
This is (kind of) an OpenGL-only function, which should be avoided when SDL2 isn't using OpenGL.
The only alternative that is recommended is SDL_GetRendererOutputSize, which limits this fix to the SDL_Renderer backend. Still, I think it's better than nothing.
I say that SDL_GL_GetDrawableSize is "kind of" OpenGL-only because it does technically work even when SDL2 isn't using OpenGL.
It's just that it becomes a shim to SDL_GetWindowSize, which is not suitable for high-DPI usage because it reflects the size of the window in screen coordinates, not actual pixels, so it really should be avoided when not using OpenGL.
2022-02-04 16:51:29 +01:00
Clownacy
c39192ba64 Backends: SDL_Renderer: Fix texture atlas format on big-endian hardware (#4927)
SDL_PIXELFORMAT_RGBA32 is intended for byte arrays where the channels
are specifically in the RGBA order. However, this is not what
GetTexDataAsRGBA32 does: rather, it constructs an array where each
pixel is an unsigned int in ABGR order. On little-endian platforms,
this does indeed result in an RGBA byte order, however, on big-endian
platforms, this results in an ABGR byte order, which does not match
the PIXELFORMAT enum.

What should be used is the SDL_PIXELFORMAT_ABGR8888 enum, which
specifies that the pixels are in native-endian ABGR, which they are.
2022-02-04 16:43:05 +01:00
ocornut
43177324c0 Backends: GLFW: Fixed miss untranslation of keypad keys. (#4921, #452) 2022-02-01 15:29:10 +01:00
ocornut
6f73dbea80 TestEngine: submit window data to item system. 2022-02-01 15:20:32 +01:00
ocornut
35e197f413 TestEngine: fixed InvisibleButton() and ArrowButton() not calling the info macro. 2022-02-01 11:52:38 +01:00
rokups
551ab84c2d Backends: OSX: Fix building with old Xcode versions.
Builds have failed on Xcode versions that do not yet support `@available` or do not have new APIs (that are unavailable on target OS version) defined at all. Using true build time version checks fixes these issues.
2022-01-31 14:41:56 +01:00
Clownacy
422902dbda Correct typos (#4954, #4955), use IM_STATIC_ASSERT now that old pre-C++11 macro has been obsoleted. 2022-01-31 11:58:33 +01:00
ocornut
64d910ad37 Removed IMGUI_API from inline templated classes. (#4962) 2022-01-29 18:10:36 +01:00
ocornut
49e38a5b32 Revert moving ImGuiKeyModFlags to internal.h (amendc906c65) 2022-01-28 15:53:09 +01:00
ocornut
9def2b04d7 IO: Added simple (incomplete) filter for duplicates to reduce data spam. (#4921, #4858) 2022-01-27 17:46:48 +01:00
thedmd
5429f0f6b5 Backends: OSX, Android: Replaced AddKeyModsEvent() added by 790132a in favor of unified key enum system. (#4921, #4858) 2022-01-27 17:46:48 +01:00
ocornut
c906c65cac (BREAKING) Replaced AddKeyModsEvent() added by 790132a in favor of unified key enum system. Backends: update most. (#4921, #4858)
Sorry this is an unusual breaking but since we are WIP it is a good time to make a correction.
2022-01-27 17:46:48 +01:00
ocornut
718daa153d Rendering: defer responsability of calling _PopUnusedDrawCmd() later so RenderDimmedBackgrounds()/RenderMouseCursor() don't need to deal with the side-effects (#4857, #4317) 2022-01-27 16:59:24 +01:00
ocornut
075f4ac661 Don't merge ImDrawCmd which have had their IdxOffset changed to not be sequential. Fixed CTRL+Tab into an empty window causing artefacts on the highlight rectangle due to bad reordering on ImDrawCmd.
This is bit of a weird edge case adding weight to ImDrawCmd merging, if we could rework the mess in RenderDimmedBackgroundBehindWindow() we may be able to undo some of that.
2022-01-26 15:53:18 +01:00
ocornut
8555335935 Shallow alignment of ImGuiKey stuff + moving some in internals. Internals: add offset to ImBitArray<>, simpify ActiveIdUsingKeyInputMask. 2022-01-25 18:11:34 +01:00
ocornut
08f3aa8972 Popups: Fix b17b2fb (#4936) 2022-01-24 14:14:34 +01:00
ocornut
4caf1e9b59 Backends: GLFW: fix ImGui_ImplGlfw_TranslateUntranslatedKey() for grave accents. (#456, #2625) + fix preceeding commit.
Amend 100ede57 + amend b17b2fb
2022-01-24 13:49:57 +01:00
ocornut
b17b2fb732 Popups: Fixed an issue when reopening a same popup multiple times would offset them by 1 pixel on the right. (#4936)
Passing explicit ImGuiPopupFlags_MouseButtonRight to OpenPopupOnItemClick() calls somehow document the unusual (due to legacy) default value.
2022-01-24 13:24:54 +01:00
ocornut
cda3db1449 Backends: SDL: Fixed key mapping for ImGuiKey_Menu (#4921) + misc typos (#4928) 2022-01-24 12:19:51 +01:00