[SLOF] [PATCH v3 2/6] fbuffer: Precalculate line length in bytes
thuth at redhat.com
Tue Aug 4 15:38:38 AEST 2015
On 04/08/15 05:48, Alexey Kardashevskiy wrote:
> On 08/04/2015 07:06 AM, Thomas Huth wrote:
>> The framebuffer code calculates the length of a line in bytes over
>> and over again, even in the tight innermost loops of the drawing
>> functions. We can easily avoid this multiplication and make the
>> code more readable by storing this value in a variable instead.
>> Signed-off-by: Thomas Huth <thuth at redhat.com>
>> Reviewed-by: Nikunj A Dadhania <nikunj at linux.vnet.ibm.com>
>> slof/fs/fbuffer.fs | 25 ++++++++++++++-----------
>> 1 file changed, 14 insertions(+), 11 deletions(-)
>> diff --git a/slof/fs/fbuffer.fs b/slof/fs/fbuffer.fs
>> index bfe7ebf..4704608 100644
>> --- a/slof/fs/fbuffer.fs
>> +++ b/slof/fs/fbuffer.fs
>> @@ -179,6 +180,7 @@ CREATE bitmap-buffer 400 4 * allot
>> : fb8-install ( width height #columns #lines -- )
>> 1 to screen-depth
>> 2swap to screen-height to screen-width
>> + screen-width to screen-line-bytes
> This does not seem right...
This is the "fb8-install" function which is used to initialize a 8-bit
(i.e. 256 colors) surface (see the IEEE 1275 spec). It does not know
about other screen depths, so screen-line-bytes = screen-width is the
only thing we can assume by default here ...
>> screen-#rows min to #lines
>> screen-#columns min to #columns
>> screen-height char-height #lines * - 2/ to window-top
>> @@ -200,6 +202,7 @@ CREATE bitmap-buffer 400 4 * allot
>> r> to screen-depth
>> + screen-width screen-depth * to screen-line-bytes
> ... but this seems correct.
... and here were in the "fb-install" function which handles higher bit
depths, too. So this overrides the value from fb8-install if necessary -
and everything should then be fine for higher bit depths, too!
More information about the SLOF