summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/fl_surface_device.html4
-rw-r--r--src/fltk-devices-surface.adb33
-rw-r--r--src/fltk-devices-surface.ads12
3 files changed, 18 insertions, 31 deletions
diff --git a/doc/fl_surface_device.html b/doc/fl_surface_device.html
index b6ba5f5..48a1693 100644
--- a/doc/fl_surface_device.html
+++ b/doc/fl_surface_device.html
@@ -68,7 +68,7 @@ Fl_Surface_Device(Fl_Graphics_Driver *graphics_driver);
</pre></td>
<td><pre>
function Create
- (Graphics : in FLTK.Devices.Graphics.Graphics_Driver)
+ (Graphics : in out FLTK.Devices.Graphics.Graphics_Driver)
return Surface_Device;
</pre></td>
</tr>
@@ -109,7 +109,7 @@ void driver(Fl_Graphics_Driver *graphics_driver);
<td><pre>
procedure Set_Driver
(This : in out Surface_Device;
- Driver : in FLTK.Devices.Graphics.Graphics_Driver'Class);
+ Driver : in out FLTK.Devices.Graphics.Graphics_Driver'Class);
</pre></td>
</tr>
diff --git a/src/fltk-devices-surface.adb b/src/fltk-devices-surface.adb
index 9a93768..8ae558d 100644
--- a/src/fltk-devices-surface.adb
+++ b/src/fltk-devices-surface.adb
@@ -66,22 +66,15 @@ package body FLTK.Devices.Surface is
-- Constructors --
--------------------
- procedure Initialize
- (This : in out Surface_Device) is
- begin
- Wrapper (This.My_Driver).Needs_Dealloc := False;
- end Initialize;
-
-
package body Forge is
function Create
- (Graphics : in FLTK.Devices.Graphics.Graphics_Driver)
+ (Graphics : in out FLTK.Devices.Graphics.Graphics_Driver)
return Surface_Device is
begin
return This : Surface_Device do
This.Void_Ptr := new_fl_surface (Wrapper (Graphics).Void_Ptr);
- Wrapper (This.My_Driver).Void_Ptr := Wrapper (Graphics).Void_Ptr;
+ This.My_Driver := Graphics'Unchecked_Access;
end return;
end Create;
@@ -95,14 +88,13 @@ package body FLTK.Devices.Surface is
-------------------------
Original_Surface : aliased Surface_Device;
- Current_Surface : aliased Surface_Device;
+ Current_Surface : access Surface_Device'Class := Original_Surface'Access;
procedure Set_Current_Bookkeep
- (Surface : in Surface_Device'Class) is
+ (Surface : in out Surface_Device'Class) is
begin
- Current_Surface.Void_Ptr := Surface.Void_Ptr;
- Wrapper (Current_Surface.My_Driver).Void_Ptr := Wrapper (Surface.My_Driver).Void_Ptr;
+ Current_Surface := Surface'Unchecked_Access;
end Set_Current_Bookkeep;
@@ -115,7 +107,7 @@ package body FLTK.Devices.Surface is
function Get_Current
return Surface_Device_Reference is
begin
- return Ref : Surface_Device_Reference (Data => Current_Surface'Access);
+ return Ref : Surface_Device_Reference (Data => Current_Surface);
end Get_Current;
@@ -140,7 +132,8 @@ package body FLTK.Devices.Surface is
(This : in Surface_Device)
return Boolean is
begin
- return Wrapper (This.My_Driver).Void_Ptr /= Null_Pointer;
+ return This.My_Driver /= null and then
+ Wrapper (This.My_Driver.all).Void_Ptr /= Null_Pointer;
end Has_Driver;
@@ -148,17 +141,16 @@ package body FLTK.Devices.Surface is
(This : in out Surface_Device)
return FLTK.Devices.Graphics.Graphics_Driver_Reference is
begin
- return Ref : FLTK.Devices.Graphics.Graphics_Driver_Reference
- (Data => This.My_Driver'Unchecked_Access);
+ return Ref : FLTK.Devices.Graphics.Graphics_Driver_Reference (Data => This.My_Driver);
end Get_Driver;
procedure Set_Driver
(This : in out Surface_Device;
- Driver : in FLTK.Devices.Graphics.Graphics_Driver'Class) is
+ Driver : in out FLTK.Devices.Graphics.Graphics_Driver'Class) is
begin
fl_surface_set_driver (This.Void_Ptr, Wrapper (Driver).Void_Ptr);
- Wrapper (This.My_Driver).Void_Ptr := Wrapper (Driver).Void_Ptr;
+ This.My_Driver := Driver'Unchecked_Access;
end Set_Driver;
@@ -168,9 +160,6 @@ begin
Original_Surface.Void_Ptr := fl_surface_get_surface;
Original_Surface.Needs_Dealloc := False;
- Current_Surface.Void_Ptr := Original_Surface.Void_Ptr;
- Current_Surface.Needs_Dealloc := False;
-
end FLTK.Devices.Surface;
diff --git a/src/fltk-devices-surface.ads b/src/fltk-devices-surface.ads
index cbad055..68d0df7 100644
--- a/src/fltk-devices-surface.ads
+++ b/src/fltk-devices-surface.ads
@@ -26,7 +26,7 @@ package FLTK.Devices.Surface is
package Forge is
function Create
- (Graphics : in FLTK.Devices.Graphics.Graphics_Driver)
+ (Graphics : in out FLTK.Devices.Graphics.Graphics_Driver)
return Surface_Device;
end Forge;
@@ -56,25 +56,23 @@ package FLTK.Devices.Surface is
procedure Set_Driver
(This : in out Surface_Device;
- Driver : in FLTK.Devices.Graphics.Graphics_Driver'Class);
+ Driver : in out FLTK.Devices.Graphics.Graphics_Driver'Class);
private
type Surface_Device is new Device with record
- My_Driver : aliased FLTK.Devices.Graphics.Graphics_Driver;
+ My_Driver : access FLTK.Devices.Graphics.Graphics_Driver'Class;
end record;
- overriding procedure Initialize
- (This : in out Surface_Device);
-
overriding procedure Finalize
(This : in out Surface_Device);
procedure Set_Current_Bookkeep
- (Surface : in Surface_Device'Class);
+ (Surface : in out Surface_Device'Class)
+ with Inline;
pragma Inline (Get_Current);