diff options
Diffstat (limited to 'body/fltk-images-rgb.adb')
-rw-r--r-- | body/fltk-images-rgb.adb | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/body/fltk-images-rgb.adb b/body/fltk-images-rgb.adb index f3dff61..71d2520 100644 --- a/body/fltk-images-rgb.adb +++ b/body/fltk-images-rgb.adb @@ -159,7 +159,9 @@ package body FLTK.Images.RGB is begin return This : RGB_Image do This.Void_Ptr := new_fl_rgb_image - (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), Interfaces.C.int (Depth), @@ -192,14 +194,14 @@ package body FLTK.Images.RGB is -- Static Settings -- function Get_Max_Size - return Natural is + return Size_Type is begin - return Natural (fl_rgb_image_get_max_size); + return Size_Type (fl_rgb_image_get_max_size); end Get_Max_Size; procedure Set_Max_Size - (Value : in Natural) is + (Value : in Size_Type) is begin fl_rgb_image_set_max_size (Interfaces.C.size_t (Value)); end Set_Max_Size; @@ -273,21 +275,21 @@ package body FLTK.Images.RGB is function Data_Size (This : in RGB_Image) - return Natural + return Size_Type is - Per_Line : Natural := This.Get_Line_Size; + Per_Line : constant Natural := This.Get_Line_Size; begin if Per_Line = 0 then - return This.Get_W * This.Get_D * This.Get_H; + return Size_Type (This.Get_W) * Size_Type (This.Get_D) * Size_Type (This.Get_H); else - return Per_Line * This.Get_H; + return Size_Type (Per_Line) * Size_Type (This.Get_H); end if; end Data_Size; function Get_Datum (This : in RGB_Image; - Place : in Positive) + Place : in Positive_Size) return Color_Component is The_Data : Color_Component_Array (1 .. This.Data_Size); @@ -300,7 +302,7 @@ package body FLTK.Images.RGB is procedure Set_Datum (This : in out RGB_Image; - Place : in Positive; + Place : in Positive_Size; Value : in Color_Component) is The_Data : Color_Component_Array (1 .. This.Data_Size); @@ -313,8 +315,8 @@ package body FLTK.Images.RGB is function Slice (This : in RGB_Image; - 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); @@ -327,7 +329,7 @@ package body FLTK.Images.RGB is procedure Overwrite (This : in out RGB_Image; - Place : in Positive; + Place : in Positive_Size; Values : in Color_Component_Array) is The_Data : Color_Component_Array (1 .. This.Data_Size); |