diff options
Diffstat (limited to 'body/fltk-images-bitmaps.adb')
-rw-r--r-- | body/fltk-images-bitmaps.adb | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/body/fltk-images-bitmaps.adb b/body/fltk-images-bitmaps.adb index cfb63d7..5b59c13 100644 --- a/body/fltk-images-bitmaps.adb +++ b/body/fltk-images-bitmaps.adb @@ -118,7 +118,9 @@ package body FLTK.Images.Bitmaps is begin return This : Bitmap do This.Void_Ptr := new_fl_bitmap - (Storage.To_Integer (Data (Data'First)'Address), + ((if Data'Length > 0 + then Storage.To_Integer (Data (Data'First)'Address) + else Null_Pointer), Interfaces.C.int (Width), Interfaces.C.int (Height)); end return; @@ -135,13 +137,13 @@ package body FLTK.Images.Bitmaps is -- Contracts -- - function To_Next_Byte + function Bytes_Needed (Bits : in Natural) return Natural is begin - return Integer (Float'Ceiling (Float (Bits) / Float (Color_Component_Array'Component_Size))) - * Color_Component_Array'Component_Size; - end To_Next_Byte; + return Integer (Float'Ceiling + (Float (Bits) / Float (Color_Component_Array'Component_Size))); + end Bytes_Needed; @@ -189,15 +191,15 @@ package body FLTK.Images.Bitmaps is function Data_Size (This : in Bitmap) - return Natural is + return Size_Type is begin - return To_Next_Byte (This.Get_W) * This.Get_H; + return Size_Type (Bytes_Needed (This.Get_W)) * Size_Type (This.Get_H); end Data_Size; function Get_Datum (This : in Bitmap; - Place : in Positive) + Place : in Positive_Size) return Color_Component is The_Data : Color_Component_Array (1 .. This.Data_Size); @@ -210,7 +212,7 @@ package body FLTK.Images.Bitmaps is procedure Set_Datum (This : in out Bitmap; - Place : in Positive; + Place : in Positive_Size; Value : in Color_Component) is The_Data : Color_Component_Array (1 .. This.Data_Size); @@ -223,8 +225,8 @@ package body FLTK.Images.Bitmaps is function Slice (This : in Bitmap; - Low : in Positive; - High : in Natural) + Low : in Positive_Size; + High : in Size_Type) return Color_Component_Array is The_Data : Color_Component_Array (1 .. This.Data_Size); @@ -237,7 +239,7 @@ package body FLTK.Images.Bitmaps is procedure Overwrite (This : in out Bitmap; - Place : in Positive; + Place : in Positive_Size; Values : in Color_Component_Array) is The_Data : Color_Component_Array (1 .. This.Data_Size); |