Page MenuHomeFreeBSD

D50801.id.diff
No OneTemporary

D50801.id.diff

diff --git a/stand/lua/drawer.lua b/stand/lua/drawer.lua
--- a/stand/lua/drawer.lua
+++ b/stand/lua/drawer.lua
@@ -330,20 +330,23 @@
branddef = getBranddef(drawer.default_brand)
end
- local graphic = branddef.graphic
+ local graphic = branddef.ascii.image
x = x + shift.x
y = y + shift.y
- if branddef.shift ~= nil then
- x = x + branddef.shift.x
- y = y + branddef.shift.y
- end
- local gfx_requested = branddef.image and gfxenabled()
+ local gfx_requested = branddef.fb and gfxenabled()
if gfx_requested and gfxcapable() then
- if gfx.term_putimage(branddef.image, x, y, 0, 7, 0) then
+ if branddef.fb.shift then
+ x = x + (branddef.fb.shift.x or 0)
+ y = y + (branddef.fb.shift.y or 0)
+ end
+ if gfx.term_putimage(branddef.fb.image, x, y, 0, 7, 0) then
return true
end
+ elseif branddef.ascii.shift then
+ x = x + (branddef.ascii.shift.x or 0)
+ y = y + (branddef.ascii.shift.y or 0)
end
draw(x, y, graphic)
end
@@ -359,8 +362,8 @@
local logodef = getLogodef(logo)
- if logodef == nil or logodef.graphic == nil or
- (not colored and logodef.requires_color) then
+ if logodef == nil or logodef.ascii == nil or
+ (not colored and logodef.ascii.requires_color) then
-- Choose a sensible default
if colored then
logodef = getLogodef(drawer.default_color_logodef)
@@ -374,7 +377,8 @@
end
end
- if logodef ~= nil and logodef.graphic == none then
+ -- XXX What the hell is going on here?
+ if logodef and logodef.ascii.image == none then
shift = logodef.shift
else
shift = default_shift
@@ -383,20 +387,23 @@
x = x + shift.x
y = y + shift.y
- if logodef ~= nil and logodef.shift ~= nil then
- x = x + logodef.shift.x
- y = y + logodef.shift.y
- end
-
- local gfx_requested = logodef.image and gfxenabled()
+ local gfx_requested = logodef.fb and gfxenabled()
if gfx_requested and gfxcapable() then
- local y1 = logodef.image_rl or 15
+ local y1 = logodef.fb.width or 15
- if gfx.term_putimage(logodef.image, x, y, 0, y + y1, 0) then
+ if logodef.fb.shift then
+ x = x + (logodef.fb.shift.x or 0)
+ y = y + (logodef.fb.shift.y or 0)
+ end
+ if gfx.term_putimage(logodef.fb.image, x, y, 0, y + y1, 0) then
return true
end
+ elseif logodef.ascii.shift then
+ x = x + (logodef.ascii.shift.x or 0)
+ y = y + (logodef.ascii.shift.y or 0)
end
- draw(x, y, logodef.graphic)
+
+ draw(x, y, logodef.ascii.image)
end
local function drawitem(func)
@@ -453,11 +460,15 @@
-- Indexed by valid values for loader_brand in loader.conf(5). Valid
-- keys are: graphic (table depicting graphic)
["fbsd"] = {
- graphic = fbsd_brand,
- image = "/boot/images/freebsd-brand-rev.png",
+ ascii = {
+ image = fbsd_brand,
+ },
+ fb = {
+ image = "/boot/images/freebsd-brand-rev.png",
+ },
},
["none"] = {
- graphic = none,
+ fb = { image = none },
},
}
@@ -466,13 +477,19 @@
-- are: requires_color (boolean), graphic (table depicting graphic), and
-- shift (table containing x and y).
["tribute"] = {
- graphic = fbsd_brand,
+ ascii = {
+ image = fbsd_brand,
+ },
},
["tributebw"] = {
- graphic = fbsd_brand,
+ ascii = {
+ image = fbsd_brand,
+ },
},
["none"] = {
- graphic = none,
+ ascii = {
+ image = none,
+ },
shift = {x = 17, y = 0},
},
}
@@ -492,14 +509,43 @@
-- drawer module in case it's a filesystem issue.
drawer.default_fallback_logodef = 'none'
--- These should go away after FreeBSD 13; only available for backwards
--- compatibility with old logo- files.
+-- Backwards compatibility shims for previous FreeBSD versions, please document
+-- new additions
+local function adapt_fb_shim(def)
+ -- In FreeBSD 14.x+, we have improved framebuffer support in the loader
+ -- and some graphics may have images that we can actually draw on the
+ -- screen. Those graphics may come with shifts that are distinct from
+ -- the ASCII version, so we move both ascii and image versions into
+ -- their own tables.
+ if not def.ascii then
+ def.ascii = {
+ image = def.graphic,
+ requires_color = def.requires_color,
+ shift = def.shift,
+ }
+ end
+ if def.image then
+ assert(not def.fb,
+ "Unrecognized graphic definition format")
+
+ -- Legacy images may have adapted a shift from the ASCII
+ -- version, or perhaps we just didn't care enough to adjust it.
+ -- Steal the shift.
+ def.fb = {
+ image = def.image,
+ width = def.image_rl,
+ shift = def.shift,
+ }
+ end
+ return def
+end
+
function drawer.addBrand(name, def)
- branddefs[name] = def
+ branddefs[name] = adapt_fb_shim(def)
end
function drawer.addLogo(name, def)
- logodefs[name] = def
+ logodefs[name] = adapt_fb_shim(def)
end
drawer.frame_styles = {
diff --git a/stand/lua/gfx-orb.lua b/stand/lua/gfx-orb.lua
--- a/stand/lua/gfx-orb.lua
+++ b/stand/lua/gfx-orb.lua
@@ -27,7 +27,8 @@
return {
logo = {
- graphic = {
+ ascii = {
+ image = {
" \027[31m``` \027[31;1m`\027[31m",
" s` `.....---...\027[31;1m....--.``` -/\027[31m",
" +o .--` \027[31;1m/y:` +.\027[31m",
@@ -43,10 +44,14 @@
" `:` \027[31;1m`:`",
" \027[31;1m.-- `--.",
" .---.....----.\027[m",
+ },
+ requires_color = true,
+ shift = {x = 5, y = -1},
+ },
+ fb = {
+ image = "/boot/images/freebsd-logo-rev.png",
+ width = 15,
+ shift = {x = 2, y = -2},
},
- requires_color = true,
- shift = {x = 2, y = -1},
- image = "/boot/images/freebsd-logo-rev.png",
- image_rl = 15
}
}
diff --git a/stand/lua/gfx-orbbw.lua b/stand/lua/gfx-orbbw.lua
--- a/stand/lua/gfx-orbbw.lua
+++ b/stand/lua/gfx-orbbw.lua
@@ -27,23 +27,25 @@
return {
logo = {
- graphic = {
- " ``` `",
- " s` `.....---.......--.``` -/",
- " +o .--` /y:` +.",
- " yo`:. :o `+-",
- " y/ -/` -o/",
- " .- ::/sy+:.",
- " / `-- /",
- " `: :`",
- " `: :`",
- " / /",
- " .- -.",
- " -- -.",
- " `:` `:`",
- " .-- `--.",
- " .---.....----.",
+ ascii = {
+ image = {
+ " ``` `",
+ " s` `.....---.......--.``` -/",
+ " +o .--` /y:` +.",
+ " yo`:. :o `+-",
+ " y/ -/` -o/",
+ " .- ::/sy+:.",
+ " / `-- /",
+ " `: :`",
+ " `: :`",
+ " / /",
+ " .- -.",
+ " -- -.",
+ " `:` `:`",
+ " .-- `--.",
+ " .---.....----.",
+ },
+ shift = {x = 2, y = -1},
},
- shift = {x = 2, y = -1},
}
}

File Metadata

Mime Type
text/plain
Expires
Thu, Oct 16, 9:22 PM (20 h, 3 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
23789965
Default Alt Text
D50801.id.diff (6 KB)

Event Timeline