| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 1 | -- |
| 2 | -- Copyright (C) 2015-2016 secunet Security Networks AG |
| 3 | -- |
| 4 | -- This program is free software; you can redistribute it and/or modify |
| 5 | -- it under the terms of the GNU General Public License as published by |
| Nico Huber | 125a29e | 2016-10-18 00:23:54 +0200 | [diff] [blame^] | 6 | -- the Free Software Foundation; either version 2 of the License, or |
| 7 | -- (at your option) any later version. |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 8 | -- |
| 9 | -- This program is distributed in the hope that it will be useful, |
| 10 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | -- GNU General Public License for more details. |
| 13 | -- |
| 14 | |
| 15 | with HW.MMIO_Range; |
| 16 | pragma Elaborate_All (HW.MMIO_Range); |
| 17 | |
| 18 | package body HW.GFX.Framebuffer_Filler |
| 19 | is |
| 20 | |
| 21 | type FB_Index is new Natural range |
| 22 | 0 .. Natural (Width_Type'Last * Height_Type'Last) - 1; |
| 23 | type FB_Range is array (FB_Index) of Word32 with Pack; |
| 24 | package FB is new MMIO_Range (0, Word32, FB_Index, FB_Range); |
| 25 | |
| 26 | procedure Fill (Linear_FB : Word64; Framebuffer : Framebuffer_Type) |
| 27 | is |
| 28 | Line_Start : Int32 := 0; |
| 29 | begin |
| 30 | FB.Set_Base_Address (Linear_FB); |
| 31 | for Line in 0 .. Framebuffer.Height - 1 loop |
| 32 | pragma Loop_Invariant (Line_Start = Line * Framebuffer.Stride); |
| 33 | for Col in 0 .. Framebuffer.Width - 1 loop |
| 34 | pragma Loop_Invariant (Line_Start = Line * Framebuffer.Stride); |
| 35 | FB.Write (FB_Index (Line_Start + Col), 16#ff000000#); |
| 36 | end loop; |
| 37 | Line_Start := Line_Start + Framebuffer.Stride; |
| 38 | end loop; |
| 39 | end Fill; |
| 40 | |
| 41 | end HW.GFX.Framebuffer_Filler; |