Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

foncache.c File Reference

#include "stdarg.h"
#include "stdio.h"
#include "ntddk.h"
#include "fsvga.h"
#include "fsvgalog.h"

Go to the source code of this file.

Defines

#define ADD_IMAGE   1
#define REPLACE_IMAGE   2
#define CALC_BITMAP_BITS_FOR_X(FontSizeX, dwAlign)   ( ( ( FontSizeX * BITMAP_BITS_PIXEL + (dwAlign-1) ) & ~(dwAlign-1)) >> BITMAP_ARRAY_BYTE )

Functions

DWORD CalcBitmapBufferSize (IN COORD FontSize, IN DWORD dwAlign)
VOID AlignCopyMemory (OUT PBYTE pDestBits, IN DWORD dwDestAlign, IN PBYTE pSrcBits, IN DWORD dwSrcAlign, IN COORD FontSize)


Define Documentation

#define ADD_IMAGE   1
 

Definition at line 31 of file fullscr/vga/foncache.c.

#define CALC_BITMAP_BITS_FOR_X FontSizeX,
dwAlign   )     ( ( ( FontSizeX * BITMAP_BITS_PIXEL + (dwAlign-1) ) & ~(dwAlign-1)) >> BITMAP_ARRAY_BYTE )
 

Definition at line 35 of file fullscr/vga/foncache.c.

Referenced by AlignCopyMemory(), and CalcBitmapBufferSize().

#define REPLACE_IMAGE   2
 

Definition at line 32 of file fullscr/vga/foncache.c.


Function Documentation

VOID AlignCopyMemory OUT PBYTE  pDestBits,
IN DWORD  dwDestAlign,
IN PBYTE  pSrcBits,
IN DWORD  dwSrcAlign,
IN COORD  FontSize
 

Definition at line 56 of file fullscr/vga/foncache.c.

References BITMAP_BITS_BYTE_ALIGN, BITMAP_BITS_WORD_ALIGN, BYTE_ALIGN, CALC_BITMAP_BITS_FOR_X, CalcBitmapBufferSize(), DWORD, EXCEPTION_EXECUTE_HANDLER, and WORD_ALIGN.

Referenced by FsgWriteToFrameBuffer().

00063 { 00064 DWORD dwDestBufferSize; 00065 COORD coord; 00066 00067 try 00068 { 00069 00070 if (dwDestAlign == dwSrcAlign) { 00071 dwDestBufferSize = CalcBitmapBufferSize(FontSize, dwDestAlign); 00072 RtlCopyMemory(pDestBits, pSrcBits, dwDestBufferSize); 00073 return; 00074 } 00075 00076 switch (dwDestAlign) { 00077 default: 00078 case WORD_ALIGN: 00079 switch (dwSrcAlign) { 00080 default: 00081 // 00082 // pDest = WORD, pSrc = WORD 00083 // 00084 case WORD_ALIGN: 00085 dwDestBufferSize = CalcBitmapBufferSize(FontSize, dwDestAlign); 00086 RtlCopyMemory(pDestBits, pSrcBits, dwDestBufferSize); 00087 break; 00088 // 00089 // pDest = WORD, pSrc = BYTE 00090 // 00091 case BYTE_ALIGN: 00092 dwDestBufferSize = CalcBitmapBufferSize(FontSize, dwDestAlign); 00093 if (((FontSize.X % BITMAP_BITS_BYTE_ALIGN) == 0) && 00094 ((FontSize.X % BITMAP_BITS_WORD_ALIGN) == 0) ) { 00095 RtlCopyMemory(pDestBits, pSrcBits, dwDestBufferSize); 00096 } 00097 else { 00098 RtlZeroMemory(pDestBits, dwDestBufferSize); 00099 for (coord.Y=0; coord.Y < FontSize.Y; coord.Y++) { 00100 for (coord.X=0; 00101 coord.X < CALC_BITMAP_BITS_FOR_X(FontSize.X, BITMAP_BITS_BYTE_ALIGN); 00102 coord.X++) { 00103 *pDestBits++ = *pSrcBits++; 00104 } 00105 if (CALC_BITMAP_BITS_FOR_X(FontSize.X, BITMAP_BITS_BYTE_ALIGN) & 1) 00106 pDestBits++; 00107 } 00108 } 00109 break; 00110 } 00111 break; 00112 case BYTE_ALIGN: 00113 switch (dwSrcAlign) { 00114 // 00115 // pDest = BYTE, pSrc = BYTE 00116 // 00117 case BYTE_ALIGN: 00118 dwDestBufferSize = CalcBitmapBufferSize(FontSize, dwDestAlign); 00119 RtlCopyMemory(pDestBits, pSrcBits, dwDestBufferSize); 00120 break; 00121 default: 00122 // 00123 // pDest = BYTE, pSrc = WORD 00124 // 00125 case WORD_ALIGN: 00126 dwDestBufferSize = CalcBitmapBufferSize(FontSize, dwDestAlign); 00127 if (((FontSize.X % BITMAP_BITS_BYTE_ALIGN) == 0) && 00128 ((FontSize.X % BITMAP_BITS_WORD_ALIGN) == 0) ) { 00129 RtlCopyMemory(pDestBits, pSrcBits, dwDestBufferSize); 00130 } 00131 else { 00132 RtlZeroMemory(pDestBits, dwDestBufferSize); 00133 for (coord.Y=0; coord.Y < FontSize.Y; coord.Y++) { 00134 for (coord.X=0; 00135 coord.X < CALC_BITMAP_BITS_FOR_X(FontSize.X, BITMAP_BITS_BYTE_ALIGN); 00136 coord.X++) { 00137 *pDestBits++ = *pSrcBits++; 00138 } 00139 if (CALC_BITMAP_BITS_FOR_X(FontSize.X, BITMAP_BITS_BYTE_ALIGN) & 1) 00140 pSrcBits++; 00141 } 00142 } 00143 break; 00144 } 00145 break; 00146 } 00147 00148 } 00149 except (EXCEPTION_EXECUTE_HANDLER) 00150 { 00151 } 00152 }

DWORD CalcBitmapBufferSize IN COORD  FontSize,
IN DWORD  dwAlign
 

Definition at line 41 of file fullscr/vga/foncache.c.

References BITMAP_BITS_BYTE_ALIGN, BITMAP_BITS_WORD_ALIGN, BITMAP_PLANES, BYTE_ALIGN, CALC_BITMAP_BITS_FOR_X, and DWORD.

Referenced by AlignCopyMemory(), FsgWriteToFrameBuffer(), SetRAMFont(), and SetRAMFontCodePage().

00045 { 00046 DWORD uiCount; 00047 00048 uiCount = CALC_BITMAP_BITS_FOR_X(FontSize.X, 00049 (dwAlign==BYTE_ALIGN ? BITMAP_BITS_BYTE_ALIGN : BITMAP_BITS_WORD_ALIGN)); 00050 uiCount = uiCount * BITMAP_PLANES * FontSize.Y; 00051 return uiCount; 00052 }


Generated on Sat May 15 19:43:44 2004 for test by doxygen 1.3.7