text
stringlengths
0
234
-- if Llen /= Rlen then
-- Raise_Error;
-- end if;
-- this routine is called only for 1, 2, or 4 byte lengths.
-- The Rlen/Llen parameter is either, 8, 16, or 32.
if Llen = 8 then
declare
use Interfaces;
Left_Byte : Unsigned_8;
for Left_Byte'Address use Left;
Right_Byte : Unsigned_8;
for Right_Byte'Address use Right;
Result_Byte : Unsigned_8;
for Result_Byte'Address use Result;
begin
Result_Byte := Left_Byte and Right_Byte;
Function Definition: function To_Stack_Pool is new
Function Body: Ada.Unchecked_Conversion (Address, Stk_Pool_Access);
pragma Warnings (Off);
function To_Global_Ptr is new
Ada.Unchecked_Conversion (Address, SS_Stack_Ptr);
pragma Warnings (On);
-- Suppress aliasing warning since the pointer we return will
-- be the only access to the stack.
Local_Stk_Address : System.Address;
begin
Num_Of_Assigned_Stacks := Num_Of_Assigned_Stacks + 1;
Local_Stk_Address :=
To_Stack_Pool
(Default_Sized_SS_Pool) (Num_Of_Assigned_Stacks)'Address;
Stack := To_Global_Ptr (Local_Stk_Address);
Function Definition: procedure Draw_Glyph is new Hershey_Fonts.Draw_Glyph
Function Body: (Internal_Draw_Line);
Current : Point := Start;
begin
Buffer.Set_Source (Foreground);
for C of Msg loop
exit when Current.X > Buffer.Width;
Draw_Glyph
(Fnt => Font,
C => C,
X => Current.X,
Y => Current.Y,
Height => Height,
Bold => Bold);
end loop;
end Draw_String;
-----------------
-- Draw_String --
-----------------
procedure Draw_String
(Buffer : in out Bitmap_Buffer'Class;
Area : Rect;
Msg : String;
Font : Hershey_Font;
Bold : Boolean;
Outline : Boolean;
Foreground : Bitmap_Color;
Fast : Boolean := True)
is
Length : constant Natural :=
Hershey_Fonts.Strlen (Msg, Font, Area.Height);
Ratio : Float;
Current : Point := (0, 0);
Prev : UInt32;
FG : constant UInt32 := Bitmap_Color_To_Word (Buffer.Color_Mode,
Foreground);
Blk : constant UInt32 := Bitmap_Color_To_Word (Buffer.Color_Mode,
Black);
procedure Internal_Draw_Line
(X0, Y0, X1, Y1 : Natural;
Width : Positive);
procedure Internal_Draw_Line
(X0, Y0, X1, Y1 : Natural;
Width : Positive)
is
begin
Draw_Line (Buffer,
(Area.Position.X + Natural (Float (X0) * Ratio),
Area.Position.Y + Y0),
(Area.Position.X + Natural (Float (X1) * Ratio),
Area.Position.Y + Y1),
Width,
Fast);
end Internal_Draw_Line;
procedure Draw_Glyph is new Hershey_Fonts.Draw_Glyph