@@ -56,13 +56,14 @@ func (v *Display) Visit(f uefi.Firmware) error {
56
56
57
57
b := bytes .NewBuffer (f .Buf ())
58
58
os .WriteFile (v .Name , f .Buf (), 0644 )
59
- // The display is 256KiB x however many rows we need.
59
+ numblocks := b .Len ()/ uefi .RegionBlockSize
60
+ // The display is 256 blocks x however many rows we need.
60
61
// So that's len(buf) / (256x1024)
61
- squareSize := 1
62
- wid := 100 + 256 * squareSize
63
- ht := 100 + squareSize * b . Len () / ( wid * 1024 )
62
+ squareSize := 2
63
+ wid := 256 * squareSize
64
+ ht := squareSize * ( numblocks / 256 )
64
65
// Initialize the draw context with a dynamically-sized window
65
- d , err := draw .Init (nil , "" , v .Name , fmt .Sprintf ("256x% d" , ht ))
66
+ d , err := draw .Init (nil , "" , v .Name , fmt .Sprintf ("%dx% d" , wid + 50 , ht + 20 ))
66
67
if err != nil {
67
68
return fmt .Errorf ("failed to initialize draw: %w" , err )
68
69
}
@@ -86,7 +87,7 @@ func (v *Display) Visit(f uefi.Firmware) error {
86
87
for y := 0 ; y < winHeight ; y ++ {
87
88
for x := 0 ; x < winWidth ; x ++ {
88
89
// Calculate the top-left corner of the square
89
- pt := draw .Pt (50 + x * squareSize , 50 + y * squareSize )
90
+ pt := draw .Pt (20 + x * squareSize , 20 + y * squareSize )
90
91
rect := draw .Rect (pt .X , pt .Y , pt .X + squareSize , pt .Y + squareSize )
91
92
n , err := b .Read (buf [:])
92
93
if err != nil && err != io .EOF {
0 commit comments