bits0.c
来自「nucleus 文件系统,内核和彩色图形系统,在小系统上非常好用」· C语言 代码 · 共 145 行
C
145 行
/*************************************************************************/
/* */
/* Copyright (c) 1997 - 1999 Accelerated Technology, Inc. */
/* */
/* PROPRIETARY RIGHTS of Accelerated Technology are involved in the */
/* subject matter of this material. All manufacturing, reproduction, */
/* use, and sales rights pertaining to this subject matter are governed */
/* by the license agreement. The recipient of this software implicitly */
/* accepts the terms of the license. */
/* */
/*************************************************************************/
/*************************************************************************/
/* */
/* FILE NAME VERSION */
/* */
/* BITS0.c 1.9 */
/* */
/* COMPONENT */
/* */
/* All */
/* */
/* DESCRIPTION */
/* */
/* This file contains the INITROWTABLE function. */
/* */
/* AUTHOR */
/* */
/* Robert G. Burrill, Accelerated Technology, Inc. */
/* */
/* DATA STRUCTURES */
/* */
/* None */
/* */
/* FUNCTIONS */
/* */
/* None */
/* */
/* DEPENDENCIES */
/* */
/* None */
/* */
/* HISTORY */
/* */
/* NAME DATE REMARKS */
/* */
/* BobB 5/8/98 Modified for PPC compiler */
/* */
/*************************************************************************/
#include "meta_wnd.h"
#include "metconst.h" /* MetaWINDOW Constant & Stucture Definitions */
#include "metports.h" /* MetaWINDOW Port & Bitmap Definitions */
#include "grafdata.h"
#include "wndo.h"
/* Procedure INITROWTABLE initializes the rowtables specified in the
grafmap data record (BMAP) to point to each raster in the bitmap. The
remaining procedure parameters are used to determine how the rowtable
addresses should progress. interLeave specifies the delta between rowtable
entries to address the bitmap in sequence from top to bottom. interSeg and
interOff are the constants that should be added to offset each rowtable entry
to the next sequential raster.
Note: if the grafMaps pixHeight is greater than its mapWinScans value, then
the rowtables will repeat for each mapWinScans interval (each bank will have
identical rowtables). */
void InitRowTable( grafMap *argBitMap, int argInrLve, int argInrSeg, int argInrSize )
{
long baseAdr;
long scanAdr;
long rowAddr;
int rwBytes;
unsigned int winSize;
int iPln;
long *rowTable;
int iRow;
int nRow;
unsigned int wRow;
int intrlv;
int segInc;
const long segOvrFlow = 65536;
#if PROT386
segInc = segOvrFlow; /* just carry into high word */
#else
segInc = hugeSelAdd<<16; /* get segment increment value */
#endif /* PROT386 */
if(argInrLve <= 0) argInrLve = 1; /* if interleave <= 0, make = 1 */
/* get some things from the bitmap */
nRow = argBitMap->pixHeight;
rwBytes = argBitMap->pixBytes;
winSize = argBitMap->mapWinScans;
/* BobB 5/8/98 - modified the following line for the PPC compiler
if (winSize == -1) segInc = 0;*/ /* disable segment addition */
if (winSize == 0xffff) segInc = 0; /* disable segment addition */
for (iPln = argBitMap->pixPlanes - 1; iPln >= 0; iPln--)
{
rowTable = (long*) argBitMap->mapTable[iPln];
baseAdr = *rowTable;
scanAdr = 0;
iRow = 0;
wRow = 0;
while (1)
{
rowAddr = baseAdr + scanAdr;
for (intrlv = argInrLve; intrlv >0; intrlv--) /* for each interleave */
{
*rowTable = rowAddr;
iRow++;
wRow++;
if (iRow>= nRow) goto NextPlane; /* jump out if done */
rowTable += 1;
rowAddr = rowAddr + argInrSize;
if (wRow >= winSize)
{
wRow = 0;
scanAdr = 0;
}
} /* next interleave */
if (wRow > 0)
{
scanAdr = scanAdr + rwBytes;
if (scanAdr >= segOvrFlow) /* check for segment overflow */
{
baseAdr += segInc;
scanAdr -= segOvrFlow;
}
}
} /* still looping */
NextPlane:
;
} /* next iPln */
return;
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?