📄 m8b_fil.c
字号:
/*************************************************************************/
/* */
/* 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. */
/* */
/*************************************************************************/
/*************************************************************************/
/* */
/* FLLE NAME VERSION */
/* */
/* m8b_fil.c 1.9 */
/* */
/* COMPONENT */
/* */
/* All */
/* */
/* DESCRIPTION */
/* */
/* This file contains the mwFLA0 function. */
/* */
/* AUTHOR */
/* */
/* Bob Burrill, Accelerated Technology, Inc. */
/* */
/* DATA STRUCTURES */
/* */
/* None */
/* */
/* FUNCTIONS */
/* */
/* None */
/* */
/* DEPENDENCIES */
/* */
/* None */
/* */
/* HISTORY */
/* */
/* NAME DATE REMARKS */
/* */
/* */
/*************************************************************************/
#include "meta_wnd.h"
#include "metconst.h" /* MetaWINDOW Constant & Stucture Definitions */
#include "metports.h" /* MetaWINDOW Port & Bitmap Definitions */
#include "grafdata.h"
#include "metmacs3.h"
#include "fill_5.h"
/* Function mwFLA0 is a special case optimization for MultiFill, monochrome
to memory, rectangular and/or region clipping with color translation. mwFLA0
forms the outer processing loop for this mode which internally dispatches
to one of several other optimizations based upon the specific rasterOp
transfer mode and LCD destination. */
void mwFLA0(blitRcd *fillRec)
{
void mwFLM4(blitRcd *fillRec);
void SolidFillMem(blitRcd *fillRec);
void MonoPatternFillMem(blitRcd *fillRec);
void MultiColorFillMem(blitRcd *fillRec);
/* Figure out whether this is a multicolor pattern, and, if so, whether the
raster op is replace. All non-multicolor patterns are handled here, as are
replace-op multicolor, but non-replace multicolor patterns are handled by
the multiplane fill handler. */
lclPortMask = fillRec->blitMask;
/* save the pattern header address here temporarily */
if (fillRec->blitPat > 1)
{ /* it's a patterned fill */
patStart = fillRec->blitPatl->patPtr[fillRec->blitPat];
if (patStart->patBits > 1)
{ /* it's a multicolor fill */
if((fillRec->blitRop & 0x0f) > 0)
{ /* non-replace multicolor, handle thru general plane filler */
fillRec->blitDmap->mapWinPlane = -1;
mwFLM4(fillRec);
return;
}
else
{ /* we'll do a replace multicolor fill locally */
MultiColorFillMem(fillRec);
return;
}
}
else
{ /* we'll do a monocolor pattern fill locally */
MonoPatternFillMem(fillRec);
return;
}
}
else
{/* we'll do a solid fill locally */
SolidFillMem(fillRec);
return;
}
}
/* Function MultiColorFill is a special case optimization for multicolor,
patterned fill to memory, rectangular clipping with color translation. */
void MultiColorFillMem(blitRcd *fillRec)
{
int Check_YX_Band(rect *bandRect, rect *blitRectPtr, rect *clipR,
int *rectCnt);
void MultiColorFillRectM(blitRcd *fillRec);
int Set_Up_Clip(blitRcd *clipBlit, rect *clipR, int blitMayOverlap,
int isLine);
int Fill_Clip_Region(blitRcd *fillRec, rect *fillRect);
void nuResume(grafMap *dstBmap);
rect clipR; /* Clip rect */
rect *rListPtr; /* list pointer */
int blitMayOverlap = 0; /* Set false for region clipping*/
int isLine = 0; /* Set false */
savePat = (image *) patStart;/* retrieve the pattern header address */
rectCnt = fillRec->blitCnt;
rListPtr = (rect *) fillRec->blitList;
dstBmap = fillRec->blitDmap;
patHeight = savePat->imHeight;/* height in rows */
patWidthInBytes = savePat->imWidth;
patLength = patWidthInBytes * patHeight;
patPlaneOffset = patLength;/* distance from one plane to the next */
M_PAUSE(dstBmap);
/* set up clipping */
if (Set_Up_Clip(fillRec, &clipR, blitMayOverlap, isLine))
{
nuResume(dstBmap);
return;
}
while (--rectCnt >= 0 )
{
dRect = *rListPtr++;
if (clipToRectFlag != 0) /* do we need to worry about clipping */
{ /* yes, do trivial reject */
if (dRect.Xmin < clipR.Xmin) dRect.Xmin = clipR.Xmin;
if (dRect.Ymin < clipR.Ymin) dRect.Ymin = clipR.Ymin;
if (dRect.Xmax > clipR.Xmax) dRect.Xmax = clipR.Xmax;
if (dRect.Ymax > clipR.Ymax) dRect.Ymax = clipR.Ymax;
if (dRect.Ymin >= dRect.Ymax)
{ /* Check to see whether the rectangle was trivially
clipped because it was fully below the clip rect,
in which case we can discard the rest of a YX banded
blitList, or because it was fully above the clip
rect, in which case we can whiz ahead through a YX
banded blitList until we run out of rects or find a
rect that isn't fully above the clip rect. */
if (Check_YX_Band(&dRect, rListPtr, &clipR,
&rectCnt)) break;
continue;
}
if (dRect.Xmin >= dRect.Xmax) continue;
/* do we need to worry about region clipping? */
if (clipToRegionFlag != 0)
{ /* yes, decide whether to copy top->bottom
or bottom->top */
FillDrawer = &MultiColorFillRectM;
if (Fill_Clip_Region(fillRec, &dRect) == 0) break;
continue;
}
}
MultiColorFillRectM(fillRec); /* blit the rectangle */
}
nuResume(dstBmap);
return;
}
void SolidFillMem(blitRcd *fillRec )
{
int Check_YX_Band(rect *bandRect, rect *blitRectPtr, rect *clipR,
int *rectCnt);
void SolidFillRectM(blitRcd *fillRec);
int Set_Up_Clip(blitRcd *clipBlit, rect *clipR, int blitMayOverlap,
int isLine);
int Fill_Clip_Region(blitRcd *fillRec, rect *fillRect);
void SetDestMem(void);
void FillOXADestMem(void);
void NotDestFillMem(void);
void InvertDestMem(void);
void QuickEnd(void);
void nuResume(grafMap *dstBmap);
rect clipR; /* Clip rect */
rect *rListPtr; /* list pointer */
int blitMayOverlap = 0; /* Set false for region clipping*/
int isLine = 0; /* Set false */
rectCnt = fillRec->blitCnt;
rListPtr = (rect *) fillRec->blitList;
dstBmap = fillRec->blitDmap;
if(fillRec->blitPat == 0)
{
if((fillRec->blitRop & 0x10) != 0)
{ /* transparent with background color is a NOP */
nuResume(dstBmap);
return;
}
pnColr = (char) fillRec->blitBack;
}
else
{
pnColr = (char) fillRec->blitFore;
}
M_PAUSE(dstBmap);
dstClass = fillRec->blitRop & 0x0f;
switch (dstClass)
{ /* look up the optimization routine */
/* Memory non-transparent */
case 0: /* zREPz : src */
case 4: /* zNREPz : (NOT src) */
case 8: /* zCLEARz : 0's */
case 12: /* zSETz : 1's */
optPtr = &SetDestMem;
break;
case 1: /* zORz : src OR dst */
case 2: /* zXORz : src XOR dst */
case 3: /* zNANDz : (NOT src) AND dst */
case 5: /* zNORz : (NOT src) OR dst */
case 6: /* zNXORz : (NOT src) XOR dst */
case 7: /* zANDz : src AND dst */
optPtr = &FillOXADestMem;
break;
case 9: /* zORNz : src OR (NOT dst) */
case 11: /* zANDNz : src AND (NOT dst) */
case 13: /* zNORNz : (NOT src) OR (NOT dst) */
case 15: /* zNANDNz : (NOT src) AND (NOT dst) */
optPtr = &NotDestFillMem;
break;
case 10: /* zNOPz : dst <NOP> */
optPtr = &QuickEnd;
break;
case 14: /* zINVERTz: (NOT dst) */
optPtr = &InvertDestMem;
break;
}
/* set up clipping */
if (Set_Up_Clip(fillRec, &clipR, blitMayOverlap, isLine))
{
nuResume(dstBmap);
return;
}
while (--rectCnt >= 0 )
{
dRect = *rListPtr++;
if (clipToRectFlag != 0) /* do we need to worry about clipping */
{ /* yes, do trivial reject */
if (dRect.Xmin < clipR.Xmin) dRect.Xmin = clipR.Xmin;
if (dRect.Ymin < clipR.Ymin) dRect.Ymin = clipR.Ymin;
if (dRect.Xmax > clipR.Xmax) dRect.Xmax = clipR.Xmax;
if (dRect.Ymax > clipR.Ymax) dRect.Ymax = clipR.Ymax;
if (dRect.Ymin >= dRect.Ymax)
{ /* Check to see whether the rectangle was trivially
clipped because it was fully below the clip rect,
in which case we can discard the rest of a YX banded
blitList, or because it was fully above the clip
rect, in which case we can whiz ahead through a YX
banded blitList until we run out of rects or find a
rect that isn't fully above the clip rect. */
if (Check_YX_Band(&dRect, rListPtr, &clipR,
&rectCnt)) break;
continue;
}
if (dRect.Xmin >= dRect.Xmax) continue;
/* do we need to worry about region clipping? */
if (clipToRegionFlag != 0)
{ /* yes, decide whether to copy top->bottom
or bottom->top */
FillDrawer = &SolidFillRectM;
if (Fill_Clip_Region(fillRec, &dRect) == 0) break;
continue;
}
}
SolidFillRectM(fillRec); /* blit the rectangle */
}
nuResume(dstBmap);
return;
}
/* Set up for monocolor pattern fill. */
void MonoPatternFillMem(blitRcd *fillRec )
{
int Check_YX_Band(rect *bandRect, rect *blitRectPtr, rect *clipR,
int *rectCnt);
void SolidFillRectM(blitRcd *fillRec);
int Set_Up_Clip(blitRcd *clipBlit, rect *clipR, int blitMayOverlap,
int isLine);
int Fill_Clip_Region(blitRcd *fillRec, rect *fillRect);
void MonoFillDestMem(void);
void MonoFillOXADestMem(void);
void NotDestMonoFillMem(void);
void InvertDestMem(void);
void QuickEnd(void);
void nuResume(grafMap *dstBmap);
rect clipR; /* Clip rect */
rect *rListPtr; /* list pointer */
int blitMayOverlap = 0; /* Set false for region clipping*/
int isLine = 0; /* Set false */
rectCnt = fillRec->blitCnt;
rListPtr = (rect *) fillRec->blitList;
dstBmap = fillRec->blitDmap;
pnColr = (char) fillRec->blitFore;
bkColr = (char) fillRec->blitBack;
savePat = (image *) patStart;/* retrieve the pattern header address */
ptrnData = savePat->imData;/* skip over the pattern header to
the bit pattern */
patHeight = savePat->imHeight;/* height in rows */
patWidthInBytes = savePat->imWidth >> 3;
patLength = patWidthInBytes * patHeight;
patPlaneOffset = patLength;/* distance from one plane to the next */
M_PAUSE(dstBmap);
dstClass = fillRec->blitRop & 0x0f;
switch (dstClass)
{ /* look up the optimization routine */
/* Memory non-transparent */
case 0: /* zREPz : src */
case 4: /* zNREPz : (NOT src) */
case 8: /* zCLEARz : 0's */
case 12: /* zSETz : 1's */
optPtr = &MonoFillDestMem;
break;
case 1: /* zORz : src OR dst */
case 2: /* zXORz : src XOR dst */
case 3: /* zNANDz : (NOT src) AND dst */
case 5: /* zNORz : (NOT src) OR dst */
case 6: /* zNXORz : (NOT src) XOR dst */
case 7: /* zANDz : src AND dst */
optPtr = &MonoFillOXADestMem;
break;
case 9: /* zORNz : src OR (NOT dst) */
case 11: /* zANDNz : src AND (NOT dst) */
case 13: /* zNORNz : (NOT src) OR (NOT dst) */
case 15: /* zNANDNz : (NOT src) AND (NOT dst) */
optPtr = &NotDestMonoFillMem;
break;
case 10: /* zNOPz : dst <NOP> */
optPtr = &QuickEnd;
break;
case 14: /* zINVERTz: (NOT dst) */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -