aboutsummaryrefslogtreecommitdiff
path: root/board-js2x
diff options
context:
space:
mode:
authorThomas Huth <thuth@linux.vnet.ibm.com>2015-02-26 13:32:40 +0100
committerAlexey Kardashevskiy <aik@ozlabs.ru>2015-03-12 18:25:35 +1100
commit088baa0de49f9b97000609d3066b292b426cbb3c (patch)
treeef8126f0d9b087b90b97c6e58e7adc534a703ea8 /board-js2x
parent21d5f489c2e311227f2a72cc7149066714398ae0 (diff)
downloadSLOF-088baa0de49f9b97000609d3066b292b426cbb3c.zip
SLOF-088baa0de49f9b97000609d3066b292b426cbb3c.tar.gz
SLOF-088baa0de49f9b97000609d3066b292b426cbb3c.tar.bz2
Fix rectangle drawing functions to work also with higher bit depths
draw-rectangle, fill-rectangle and read-rectangle were only working with 8-bit color depth displays so far. This is fixed now for 16-bit, 24-bit and 32-bit color depths, too, by taking the "screen-depth" into account. And while we're at it, consolidate all the same copies of these functions into one common file (graphics.fs) so that we do not have to do these modifications multiple times in different files. Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com> Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
Diffstat (limited to 'board-js2x')
-rw-r--r--board-js2x/slof/Makefile1
-rw-r--r--board-js2x/slof/vga-display.fs60
2 files changed, 2 insertions, 59 deletions
diff --git a/board-js2x/slof/Makefile b/board-js2x/slof/Makefile
index 5be9f07..ab3e683 100644
--- a/board-js2x/slof/Makefile
+++ b/board-js2x/slof/Makefile
@@ -76,6 +76,7 @@ OF_FFS_FILES = \
$(SLOFBRDDIR)/ipmi-kcs.fs \
$(SLOFCMNDIR)/fs/ide.fs \
$(SLOFCMNDIR)/fs/fbuffer.fs \
+ $(SLOFCMNDIR)/fs/graphics.fs \
$(SLOFCMNDIR)/fs/generic-disk.fs \
$(SLOFCMNDIR)/fs/scsi-disk.fs \
$(SLOFCMNDIR)/fs/scsi-host-helpers.fs \
diff --git a/board-js2x/slof/vga-display.fs b/board-js2x/slof/vga-display.fs
index 0295e88..96417e2 100644
--- a/board-js2x/slof/vga-display.fs
+++ b/board-js2x/slof/vga-display.fs
@@ -61,62 +61,6 @@ THEN
THEN
;
-\ as of OF 8bit Graphics Recommendation, these shall be implemented:
-
-: draw-rectangle ( adr x y w h -- )
- is-installed? IF
- 0 ?DO
- 4dup ( adr x y w adr x y w )
- drop ( adr x y w adr x y )
- i + screen-width * + \ calculate offset into framebuffer ((y + i) * screen_width + x)
- ( adr x y w adr offs )
- frame-buffer-adr + \ add to frame-buffer-adr ( adr x y w adr fb_adr )
- 1 pick 3 pick i * + swap 3 pick ( adr x y w adr adr_offs fb_adr w )
- rmove \ copy line ( adr x y w adr )
- drop ( adr x y w )
- LOOP
- 4drop
- ELSE
- 4drop drop
- THEN
-;
-
-: fill-rectangle ( number x y w h -- )
- is-installed? IF
- 0 ?DO
- 4dup ( number x y w number x y w )
- drop ( number x y w number x y )
- i + screen-width * + \ calculate offset into framebuffer ((y + i) * screen_width + x)
- ( number x y w number offs )
- frame-buffer-adr + \ add to frame-buffer-adr ( number x y w number adr )
- 2 pick 2 pick ( number x y w number adr w number )
- rfill \ draw line ( number x y w number )
- drop ( number x y w )
- LOOP
- 4drop
- ELSE
- 4drop drop
- THEN
-;
-
-: read-rectangle ( adr x y w h -- )
- is-installed? IF
- 0 ?DO
- 4dup ( adr x y w adr x y w )
- drop ( adr x y w adr x y )
- i + screen-width * + \ calculate offset into framebuffer ((y + i) * screen_width + x)
- ( adr x y w adr offs )
- frame-buffer-adr + \ add to frame-buffer-adr ( adr x y w adr fb_adr )
- 1 pick 3 pick i * + 3 pick ( adr x y w adr fb_adr adr_offs w )
- rmove \ copy line ( adr x y w adr )
- drop ( adr x y w )
- LOOP
- 4drop
- ELSE
- 4drop drop
- THEN
-;
-
: color! ( r g b number -- )
\ 3c8 is RAMDAC write mode select palette entry register
\ 3c9 is RAMDAC write mode write palette entry register ( 3 consecutive writes set new entry )
@@ -195,9 +139,7 @@ THEN
2drop
;
-: dimensions ( -- width height )
-width height
-;
+include graphics.fs
\ clear screen
mem-adr width height * 0 rfill