ENH don't retroreference rectange geometries

This commit is contained in:
Nathan Dwarshuis 2021-07-10 13:52:28 -04:00
parent 2965bae338
commit ea4884d25f
3 changed files with 39 additions and 43 deletions

2
core

@ -1 +1 @@
Subproject commit f59ee91926fc9b51cb664712127c87dde43500fd Subproject commit fe14fdce991242f892d4e47651c47d30687a9b52

View File

@ -515,14 +515,14 @@ end
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
-- panel -- panel
M.initPanel = function(x, y, w, h) M.initPanel = function(x, y, w, h, thickness)
return _G_Widget_.FillRect( return _G_Widget_.FillRect(
_G_Widget_.make_box( _G_Widget_.make_box(
_G_Widget_.make_point(x + 0.5, y + 0.5), _G_Widget_.make_point(x, y),
w, w,
h h
), ),
1, thickness,
_G_Patterns_.BORDER_FG, _G_Patterns_.BORDER_FG,
_G_Patterns_.PANEL_BG _G_Patterns_.PANEL_BG
) )

View File

@ -131,42 +131,29 @@ local Common = require 'Common'
-- --
-- initialize static surfaces -- initialize static surfaces
-- --
local left = Common.initPanel(
_G_INIT_DATA_.LEFT_X - _G_INIT_DATA_.PANEL_MARGIN_X,
_G_INIT_DATA_.TOP_Y - _G_INIT_DATA_.PANEL_MARGIN_Y,
_G_INIT_DATA_.SECTION_WIDTH + _G_INIT_DATA_.PANEL_MARGIN_X * 2,
_G_INIT_DATA_.SIDE_HEIGHT + _G_INIT_DATA_.PANEL_MARGIN_Y * 2
)
local center = Common.initPanel(
_G_INIT_DATA_.CENTER_LEFT_X - _G_INIT_DATA_.PANEL_MARGIN_X,
_G_INIT_DATA_.TOP_Y - _G_INIT_DATA_.PANEL_MARGIN_Y,
_G_INIT_DATA_.CENTER_WIDTH + _G_INIT_DATA_.PANEL_MARGIN_Y * 2 + _G_INIT_DATA_.CENTER_PAD,
_G_INIT_DATA_.CENTER_HEIGHT + _G_INIT_DATA_.PANEL_MARGIN_Y * 2
)
local right = Common.initPanel(
_G_INIT_DATA_.RIGHT_X - _G_INIT_DATA_.PANEL_MARGIN_X,
_G_INIT_DATA_.TOP_Y - _G_INIT_DATA_.PANEL_MARGIN_Y,
_G_INIT_DATA_.SECTION_WIDTH + _G_INIT_DATA_.PANEL_MARGIN_X * 2,
_G_INIT_DATA_.SIDE_HEIGHT + _G_INIT_DATA_.PANEL_MARGIN_Y * 2
)
local _make_static_surface = function(panel, ...) local _make_static_surface = function(x, y, w, h, modules)
local x = panel.x - panel.thickness * 0.5 local panel_line_thickness = 1
local y = panel.y - panel.thickness * 0.5 -- move over by half a pixel so the lines don't need to be antialiased
local w = panel.width + panel.thickness local _x = x + 0.5
local h = panel.height + panel.thickness local _y = y + 0.5
local panel = Common.initPanel(_x, _y, w, h, panel_line_thickness)
local cs_x = _x - panel_line_thickness * 0.5
local cs_y = _y - panel_line_thickness * 0.5
local cs_w = w + panel_line_thickness
local cs_h = h + panel_line_thickness
local cs = __cairo_image_surface_create(CAIRO_FORMAT_ARGB32, w, h) local cs = __cairo_image_surface_create(CAIRO_FORMAT_ARGB32, cs_w, cs_h)
local cr = __cairo_create(cs) local cr = __cairo_create(cs)
__cairo_translate(cr, -x, -y) __cairo_translate(cr, -cs_x, -cs_y)
FillRect.draw(panel, cr) FillRect.draw(panel, cr)
for _, f in pairs({...}) do for _, f in pairs(modules) do
f(cr) f(cr)
end end
__cairo_destroy(cr) __cairo_destroy(cr)
return { x = x, y = y, s = cs } return { x = cs_x, y = cs_y, s = cs }
end end
local draw_static_surface = function(cr, cs_obj) local draw_static_surface = function(cr, cs_obj)
@ -174,20 +161,29 @@ local draw_static_surface = function(cr, cs_obj)
__cairo_paint(cr) __cairo_paint(cr)
end end
local cs_left = _make_static_surface(left, local cs_left = _make_static_surface(
System.draw_static, _G_INIT_DATA_.LEFT_X - _G_INIT_DATA_.PANEL_MARGIN_X,
Graphics.draw_static, _G_INIT_DATA_.TOP_Y - _G_INIT_DATA_.PANEL_MARGIN_Y,
Processor.draw_static) _G_INIT_DATA_.SECTION_WIDTH + _G_INIT_DATA_.PANEL_MARGIN_X * 2,
_G_INIT_DATA_.SIDE_HEIGHT + _G_INIT_DATA_.PANEL_MARGIN_Y * 2,
{System.draw_static, Graphics.draw_static, Processor.draw_static}
)
local cs_center = _make_static_surface(center, local cs_center = _make_static_surface(
ReadWrite.draw_static, _G_INIT_DATA_.CENTER_LEFT_X - _G_INIT_DATA_.PANEL_MARGIN_X,
Network.draw_static) _G_INIT_DATA_.TOP_Y - _G_INIT_DATA_.PANEL_MARGIN_Y,
_G_INIT_DATA_.CENTER_WIDTH + _G_INIT_DATA_.PANEL_MARGIN_Y * 2 + _G_INIT_DATA_.CENTER_PAD,
_G_INIT_DATA_.CENTER_HEIGHT + _G_INIT_DATA_.PANEL_MARGIN_Y * 2,
{ReadWrite.draw_static, Network.draw_static}
)
local cs_right = _make_static_surface(right, local cs_right = _make_static_surface(
Pacman.draw_static, _G_INIT_DATA_.RIGHT_X - _G_INIT_DATA_.PANEL_MARGIN_X,
FileSystem.draw_static, _G_INIT_DATA_.TOP_Y - _G_INIT_DATA_.PANEL_MARGIN_Y,
Power.draw_static, _G_INIT_DATA_.SECTION_WIDTH + _G_INIT_DATA_.PANEL_MARGIN_X * 2,
Memory.draw_static) _G_INIT_DATA_.SIDE_HEIGHT + _G_INIT_DATA_.PANEL_MARGIN_Y * 2,
{Pacman.draw_static, FileSystem.draw_static, Power.draw_static, Memory.draw_static}
)
-- --
-- kill all the stuff we don't need for the main loop -- kill all the stuff we don't need for the main loop