BeginPlot: resolve the cached axis colours once per plot (X1) and copy them to the other five axes instead of resolving the auto colour chain per axis (bench implot scene, items stubbed: 0.457 -> 0.422 ms; draw data unchanged)
This commit is contained in:
1 parent
0e22edaea2
commit
861032a7a4
2 files changed
+22
-4
No files matched your search
+11
-2
@@ -3611,9 +3611,18 @@ return function(G)
|
||||
end
|
||||
|
||||
-- reset axes
|
||||
-- [Luau] the cached colours do not depend on the axis: resolved once (X1) and copied to the other axes
|
||||
-- (resolving the auto colours walks the auto colour chain and allocates: ~1.5 us per axis per frame)
|
||||
local a0 = plot.Axes[0]
|
||||
for i = 0, ImAxis.COUNT - 1 do
|
||||
plot.Axes[i]:Reset()
|
||||
UpdateAxisColors(plot.Axes[i])
|
||||
local axis = plot.Axes[i]
|
||||
axis:Reset()
|
||||
if i == 0 then
|
||||
UpdateAxisColors(axis)
|
||||
else
|
||||
axis.ColorMaj, axis.ColorMin, axis.ColorTick, axis.ColorTxt = a0.ColorMaj, a0.ColorMin, a0.ColorTick, a0.ColorTxt
|
||||
axis.ColorBg, axis.ColorHov, axis.ColorAct = a0.ColorBg, a0.ColorHov, a0.ColorAct
|
||||
end
|
||||
end
|
||||
-- ensure first axes enabled
|
||||
plot.Axes[ImAxis.X1].Enabled = true
|
||||
|
||||
Generated
+11
-2
@@ -3613,9 +3613,18 @@ end plot.Selected = true
|
||||
end
|
||||
|
||||
-- reset axes
|
||||
-- [Luau] the cached colours do not depend on the axis: resolved once (X1) and copied to the other axes
|
||||
-- (resolving the auto colours walks the auto colour chain and allocates: ~1.5 us per axis per frame)
|
||||
local a0 = plot.Axes[0]
|
||||
for i = 0, ImAxis.COUNT - 1 do
|
||||
plot.Axes[i]:Reset()
|
||||
UpdateAxisColors(plot.Axes[i])
|
||||
local axis = plot.Axes[i]
|
||||
axis:Reset()
|
||||
if i == 0 then
|
||||
UpdateAxisColors(axis)
|
||||
else
|
||||
axis.ColorMaj, axis.ColorMin, axis.ColorTick, axis.ColorTxt = a0.ColorMaj, a0.ColorMin, a0.ColorTick, a0.ColorTxt
|
||||
axis.ColorBg, axis.ColorHov, axis.ColorAct = a0.ColorBg, a0.ColorHov, a0.ColorAct
|
||||
end
|
||||
end
|
||||
-- ensure first axes enabled
|
||||
plot.Axes[ImAxis.X1].Enabled = true
|
||||
|
||||
Reference in new issue
Block a user