浏览代码

AA branch: more inline.

ocornut 10 年之前
父节点
当前提交
c3040dee35
共有 2 个文件被更改,包括 9 次插入19 次删除
  1. 0 10
      imgui.cpp
  2. 9 9
      imgui.h

+ 0 - 10
imgui.cpp

@@ -9202,16 +9202,6 @@ void ImDrawList::AddConvexPolyFilled(const ImVec2* points, const int points_coun
     }
 }
 
-void ImDrawList::PathClear()
-{
-    path.resize(0);
-}
-
-void ImDrawList::PathLineTo(const ImVec2& p)
-{
-    path.push_back(p);
-}
-
 void ImDrawList::PathArcToFast(const ImVec2& centre, float radius, int amin, int amax)
 {
     static ImVec2 circle_vtx[12];

+ 9 - 9
imgui.h

@@ -1036,15 +1036,6 @@ struct ImDrawList
     IMGUI_API void  PushTextureID(const ImTextureID& texture_id);
     IMGUI_API void  PopTextureID();
 
-    // Stateful path API (finish with Fill or Stroke)
-    IMGUI_API void  PathClear();
-    IMGUI_API void  PathLineTo(const ImVec2& p);
-    IMGUI_API void  PathArcToFast(const ImVec2& centre, float radius, int a_min, int a_max);
-    IMGUI_API void  PathArcTo(const ImVec2& centre, float radius, float a_min, float a_max, int num_segments = 12);
-    IMGUI_API void  PathRect(const ImVec2& a, const ImVec2& b, float rounding = 0.0f, int rounding_corners = 0x0F);
-    inline    void  PathFill(ImU32 col)                                     { AddConvexPolyFilled(&path[0], (int)path.size(), col); PathClear(); }
-    inline    void  PathStroke(ImU32 col, float thickness, bool closed)     { AddPolyline(&path[0], (int)path.size(), col, thickness, closed); PathClear(); }
-
     // Primitives   
     IMGUI_API void  AddLine(const ImVec2& a, const ImVec2& b, ImU32 col, float thickness = 1.0f);
     IMGUI_API void  AddRect(const ImVec2& a, const ImVec2& b, ImU32 col, float rounding = 0.0f, int rounding_corners = 0x0F);
@@ -1057,6 +1048,15 @@ struct ImDrawList
     IMGUI_API void  AddPolyline(const ImVec2* points, const int num_points, ImU32 col, float thickness, bool closed);
     IMGUI_API void  AddConvexPolyFilled(const ImVec2* points, const int num_points, ImU32 col);
 
+    // Stateful path API, add points finish with PathFill() or PathStroke(). Only convex shapes supported.
+    inline    void  PathClear()                                             { path.resize(0); }
+    inline    void  PathLineTo(const ImVec2& p)                             { path.push_back(p); }
+    IMGUI_API void  PathArcToFast(const ImVec2& centre, float radius, int a_min, int a_max);
+    IMGUI_API void  PathArcTo(const ImVec2& centre, float radius, float a_min, float a_max, int num_segments = 12);
+    IMGUI_API void  PathRect(const ImVec2& a, const ImVec2& b, float rounding = 0.0f, int rounding_corners = 0x0F);
+    inline    void  PathFill(ImU32 col)                                     { AddConvexPolyFilled(&path[0], (int)path.size(), col); PathClear(); }
+    inline    void  PathStroke(ImU32 col, float thickness, bool closed)     { AddPolyline(&path[0], (int)path.size(), col, thickness, closed); PathClear(); }
+
     // Advanced
     IMGUI_API void  AddCallback(ImDrawCallback callback, void* callback_data);   // Your rendering function must check for 'user_callback' in ImDrawCmd and call the function instead of rendering triangles.
     IMGUI_API void  AddDrawCmd();               // This is useful if you need to forcefully create a new draw call (to allow for dependent rendering / blending). Otherwise primitives are merged into the same draw-call as much as possible