aboutsummaryrefslogtreecommitdiff
path: root/body
diff options
context:
space:
mode:
authorJedidiah Barber <contact@jedbarber.id.au>2025-04-11 22:21:26 +1200
committerJedidiah Barber <contact@jedbarber.id.au>2025-04-11 22:21:26 +1200
commitfb4183c9244ee31aa5cb8bc9745c9242b1fafeeb (patch)
treea33c13dd090a1798a6638b9762dcc7187438f980 /body
parent192b9538fcbe46649dccd44b499a0d52d17cf283 (diff)
Moved Size_Type to FLTK and better incorporated it into Bitmaps and RGB_Images
Diffstat (limited to 'body')
-rw-r--r--body/fltk-draw.adb9
-rw-r--r--body/fltk-images-bitmaps.adb14
-rw-r--r--body/fltk-images-rgb.adb16
3 files changed, 21 insertions, 18 deletions
diff --git a/body/fltk-draw.adb b/body/fltk-draw.adb
index 3ce8918..38ccb80 100644
--- a/body/fltk-draw.adb
+++ b/body/fltk-draw.adb
@@ -1049,7 +1049,7 @@ package body FLTK.Draw is
X, Y, W : in Interfaces.C.int;
Buf_Ptr : in Storage.Integer_Address)
is
- Data_Buffer : Color_Component_Array (1 .. Integer (W));
+ Data_Buffer : Color_Component_Array (1 .. Size_Type (W));
for Data_Buffer'Address use Storage.To_Address (Buf_Ptr);
pragma Import (Ada, Data_Buffer);
begin
@@ -1120,7 +1120,7 @@ package body FLTK.Draw is
X, Y, W : in Interfaces.C.int;
Buf_Ptr : in Storage.Integer_Address)
is
- Data_Buffer : Color_Component_Array (1 .. Integer (W));
+ Data_Buffer : Color_Component_Array (1 .. Size_Type (W));
for Data_Buffer'Address use Storage.To_Address (Buf_Ptr);
pragma Import (Ada, Data_Buffer);
begin
@@ -1173,7 +1173,10 @@ package body FLTK.Draw is
Alpha : in Integer := 0)
return Color_Component_Array
is
- My_Len : constant Integer := (if Alpha = 0 then W * H * 3 else W * H * 4);
+ My_Len : constant Size_Type :=
+ (if Alpha = 0
+ then Size_Type (W) * Size_Type (H) * 3
+ else Size_Type (W) * Size_Type (H) * 4);
Result : Color_Component_Array (1 .. My_Len);
Buffer : Storage.Integer_Address;
begin
diff --git a/body/fltk-images-bitmaps.adb b/body/fltk-images-bitmaps.adb
index 4597151..5b59c13 100644
--- a/body/fltk-images-bitmaps.adb
+++ b/body/fltk-images-bitmaps.adb
@@ -191,15 +191,15 @@ package body FLTK.Images.Bitmaps is
function Data_Size
(This : in Bitmap)
- return Natural is
+ return Size_Type is
begin
- return Bytes_Needed (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);
@@ -212,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);
@@ -225,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);
@@ -239,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);
diff --git a/body/fltk-images-rgb.adb b/body/fltk-images-rgb.adb
index 00fc1ed..71d2520 100644
--- a/body/fltk-images-rgb.adb
+++ b/body/fltk-images-rgb.adb
@@ -275,21 +275,21 @@ package body FLTK.Images.RGB is
function Data_Size
(This : in RGB_Image)
- return Natural
+ return Size_Type
is
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);
@@ -302,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);
@@ -315,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);
@@ -329,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);