zwcloud / ImGui

Immediate Mode GUI for C#
https://zwcloud.net/#project/imgui
GNU Affero General Public License v3.0
197 stars 21 forks source link

Restore clipping. #36

Closed zwcloud closed 4 years ago

zwcloud commented 4 years ago
zwcloud commented 4 years ago

implemented clipping for layout group at https://github.com/zwcloud/ImGui/commit/936ead0118724a258ea6aba31ef15354ac4dde51

detail:

  1. Each node will use its parent's ContentRect/Rect as the clip-rect when rendering its Node.content
  2. In Node.RenderContent, that clip-rect will be assigned to RenderContext
  3. And will be pushed to the clip-rect stack of the GeometryRender in RenderContext.ConsumeContent
  4. When the GeometryRender converts content records to mesh, it will assign the top-most clip rect on the stack to DrawCommand.CilpRect
  5. DrawCommand.CilpRect will be used by the native renderer: for example, Win32OpenGLRenderer -> glScissor
zwcloud commented 4 years ago

Before: image After: image