vesad: Error in width/height calculation when switching from TextScreen to GraphicsScreen
In vesad/src/scheme.rs
, SchemeMut for DisplayScheme
, fn write
, if the command is Activate
and the mode is Graphic
, a new GraphicScreen
is created. However, the width()
and height()
are taken from the previous Screen type, which are calculated in pixels for GraphicsScreen
and in characters for TextScreen
. So if the previous screen type was TextScreen
, the width and height are now a fraction of the correct values.
Note that the original TextScreen
is created with width
and height
fields calculated in pixels. It's not clear to me if those fields should always be in pixels and the width()
and height()
functions should convert to character sizes. Either way, it is not consistent and should be corrected and documented.
Since the Screen
struct is Box<dyn Screen>
, the information is lost about whether the Screen
is a TextScreen
or a GraphicsScreen
, so either the calculations need to be in pixels always, or there needs to be an addition to the Screen
trait to provide width_in_pixels()
and height_in_pixels()
.