瀏覽代碼

rtl-console/amicommon/video: instead of disabling it for AROS, decide runtime based on the allocated bitmap's attributes, which rendering mode to use

git-svn-id: trunk@31143 -
Károly Balogh 10 年之前
父節點
當前提交
37af6b227d
共有 1 個文件被更改,包括 29 次插入20 次删除
  1. 29 20
      packages/rtl-console/src/amicommon/video.pp

+ 29 - 20
packages/rtl-console/src/amicommon/video.pp

@@ -96,9 +96,7 @@ var
   WindowForReqSave: PWindow;
   WindowForReqSave: PWindow;
   Process: PProcess;
   Process: PProcess;
 
 
-{$IFNDEF AROS}
   FontBitmap: PBitmap;
   FontBitmap: PBitmap;
-{$ENDIF}
 (*
 (*
   GetScreen: pScreen;
   GetScreen: pScreen;
 
 
@@ -227,6 +225,7 @@ var
   Counter,
   Counter,
   Counter2: LongInt;
   Counter2: LongInt;
   P: PWord;
   P: PWord;
+  flags: DWord;
 begin
 begin
 {$IFDEF MORPHOS}
 {$IFDEF MORPHOS}
   InitGraphicsLibrary;
   InitGraphicsLibrary;
@@ -293,26 +292,39 @@ begin
      {$endif}
      {$endif}
    end;
    end;
 
 
-{$IFNDEF AROS}
    { Obtain Friend bitmap for font blitting }
    { Obtain Friend bitmap for font blitting }
    FontBitmap:=AllocBitMap(16,16*256,1,0,VideoWindow^.RPort^.Bitmap);
    FontBitmap:=AllocBitMap(16,16*256,1,0,VideoWindow^.RPort^.Bitmap);
 
 
-   { We need to make the data word wide, otherwise the blit will fail
-     miserably on classics (tested on 3.1 + AGA) }
-   if FontBitmap <> nil then
+   if (FontBitmap <> nil) then
    begin
    begin
-     { Locking the bitmap would be better, but that requires CGFX/P96/etc specific calls }
-     Forbid();
-     p:=PWord(FontBitmap^.Planes[0]);
-     for counter:=0 to 255 do
-       for counter2:=0 to 15 do
+     flags:=GetBitmapAttr(FontBitmap,BMA_FLAGS);
+     if (Flags and BMF_STANDARD) > 0 then
+     begin
+       {$ifdef VIDEODEBUG}
+       writeln('Using fontbitmap mode.');
+       {$endif}
+       { Locking the bitmap would be better, but that requires CGFX/P96/etc specific calls }
+       Forbid();
+       { We need to make the data word wide, otherwise the blit will fail
+         miserably on classics (tested on 3.1 + AGA) }
+       p:=PWord(FontBitmap^.Planes[0]);
+       for counter:=0 to 255 do
+         for counter2:=0 to 15 do
          begin
          begin
            p^:=vgafont[counter,counter2] shl 8;
            p^:=vgafont[counter,counter2] shl 8;
            inc(p);
            inc(p);
          end;
          end;
-     Permit();
+       Permit();
+     end
+     else
+     begin
+       {$ifdef VIDEODEBUG}
+       writeln('Using direct-from-fontdata mode.');
+       {$endif}
+       FreeBitmap(FontBitmap);
+       FontBitmap:=nil;
+     end;
    end;
    end;
-{$ENDIF}
 
 
    CursorX := 0;
    CursorX := 0;
    CursorY := 0;
    CursorY := 0;
@@ -356,9 +368,7 @@ begin
     VideoWindow := nil;
     VideoWindow := nil;
   end;
   end;
 
 
-{$IFNDEF AROS}
   FreeBitMap(FontBitmap);
   FreeBitMap(FontBitmap);
-{$ENDIF}
 
 
   {$ifdef WITHBUFFERING}
   {$ifdef WITHBUFFERING}
   FreeBitmap(BufRp^.Bitmap);
   FreeBitmap(BufRp^.Bitmap);
@@ -439,11 +449,10 @@ begin
     SetABPenDrMd(rp, VideoPens[tmpBGColor], VideoPens[tmpFGColor], JAM2);
     SetABPenDrMd(rp, VideoPens[tmpBGColor], VideoPens[tmpFGColor], JAM2);
   end;
   end;
 
 
-{$IFNDEF AROS}
-  BltTemplate(@(PWord(FontBitmap^.Planes[0])[tmpChar * 16]), 0, 2, rp, sX, sY, 8, 16);
-{$ELSE}
-  BltTemplate(@Vgafont[tmpChar, 0], 0, 1, rp, sX, sY, 8, 16);
-{$ENDIF}
+  if FontBitmap <> nil then
+    BltTemplate(@(PWord(FontBitmap^.Planes[0])[tmpChar * 16]), 0, 2, rp, sX, sY, 8, 16)
+  else
+    BltTemplate(@Vgafont[tmpChar, 0], 0, 1, rp, sX, sY, 8, 16);
 
 
   if crType = crUnderLine then
   if crType = crUnderLine then
   begin
   begin