summaryrefslogtreecommitdiff
path: root/src/mga_dga.c
diff options
context:
space:
mode:
authorAdam Jackson <ajax@nwnk.net>2006-03-20 19:12:50 +0000
committerAdam Jackson <ajax@nwnk.net>2006-03-20 19:12:50 +0000
commit88ece3c37c4ed529686b6cdea1bf9b6eed8fceea (patch)
treeb77f097e1d11610306339690a8eb40956a4f86dc /src/mga_dga.c
parent089c7be83d6cace94a692ec46a4c3a05b32fd4f4 (diff)
Bug #5587: Refactor mga_storm.c to only build once for all color depths.
(Ian Romanick)
Diffstat (limited to 'src/mga_dga.c')
-rw-r--r--src/mga_dga.c90
1 files changed, 23 insertions, 67 deletions
diff --git a/src/mga_dga.c b/src/mga_dga.c
index 28ff766..e728484 100644
--- a/src/mga_dga.c
+++ b/src/mga_dga.c
@@ -366,21 +366,8 @@ MGA_FillRect (
if(!pMga->AccelInfoRec) return;
- switch(pMga->CurrentLayout.bitsPerPixel) {
- case 8:
- Mga8SetupForSolidFill(pScrn, color, GXcopy, ~0);
- break;
- case 16:
- Mga16SetupForSolidFill(pScrn, color, GXcopy, ~0);
- break;
- case 24:
- Mga24SetupForSolidFill(pScrn, color, GXcopy, ~0);
- break;
- case 32:
- Mga32SetupForSolidFill(pScrn, color, GXcopy, ~0);
- break;
- }
-
+ mgaDoSetupForSolidFill(pScrn, color, GXcopy, ~0,
+ pMga->CurrentLayout.bitsPerPixel);
(*pMga->AccelInfoRec->SubsequentSolidFillRect)(pScrn, x, y, w, h);
SET_SYNC_FLAG(pMga->AccelInfoRec);
@@ -399,24 +386,8 @@ MGA_BlitRect(
if(!pMga->AccelInfoRec) return;
- switch(pMga->CurrentLayout.bitsPerPixel) {
- case 8:
- Mga8SetupForScreenToScreenCopy(
- pScrn, xdir, ydir, GXcopy, ~0, -1);
- break;
- case 16:
- Mga16SetupForScreenToScreenCopy(
- pScrn, xdir, ydir, GXcopy, ~0, -1);
- break;
- case 24:
- Mga24SetupForScreenToScreenCopy(
- pScrn, xdir, ydir, GXcopy, ~0, -1);
- break;
- case 32:
- Mga32SetupForScreenToScreenCopy(
- pScrn, xdir, ydir, GXcopy, ~0, -1);
- break;
- }
+ mgaDoSetupForScreenToScreenCopy( pScrn, xdir, ydir, GXcopy, ~0, -1,
+ pMga->CurrentLayout.bitsPerPixel );
(*pMga->AccelInfoRec->SubsequentScreenToScreenCopy)(
pScrn, srcx, srcy, dstx, dsty, w, h);
@@ -425,45 +396,30 @@ MGA_BlitRect(
}
-static void
-MGA_BlitTransRect(
- ScrnInfoPtr pScrn,
- int srcx, int srcy,
- int w, int h,
- int dstx, int dsty,
- unsigned long color
-){
+static void MGA_BlitTransRect( ScrnInfoPtr pScrn, int srcx, int srcy,
+ int w, int h, int dstx, int dsty,
+ unsigned long color )
+{
MGAPtr pMga = MGAPTR(pScrn);
- int xdir = ((srcx < dstx) && (srcy == dsty)) ? -1 : 1;
- int ydir = (srcy < dsty) ? -1 : 1;
- if(!pMga->AccelInfoRec) return;
- if(pMga->CurrentLayout.bitsPerPixel == 24) return;
- if(pMga->Chipset == PCI_CHIP_MGA2064) return;
-
- pMga->DrawTransparent = TRUE;
-
- switch(pMga->CurrentLayout.bitsPerPixel) {
- case 8:
- Mga8SetupForScreenToScreenCopy(
- pScrn, xdir, ydir, GXcopy, ~0, color);
- break;
- case 16:
- Mga16SetupForScreenToScreenCopy(
- pScrn, xdir, ydir, GXcopy, ~0, color);
- break;
- case 32:
- Mga32SetupForScreenToScreenCopy(
- pScrn, xdir, ydir, GXcopy, ~0, color);
- break;
- }
+ if( (pMga->AccelInfoRec != NULL)
+ && (pMga->CurrentLayout.bitsPerPixel != 24)
+ && (pMga->Chipset != PCI_CHIP_MGA2064) ) {
+ const int xdir = ((srcx < dstx) && (srcy == dsty)) ? -1 : 1;
+ const int ydir = (srcy < dsty) ? -1 : 1;
- pMga->DrawTransparent = FALSE;
+ pMga->DrawTransparent = TRUE;
- (*pMga->AccelInfoRec->SubsequentScreenToScreenCopy)(
- pScrn, srcx, srcy, dstx, dsty, w, h);
+ mgaDoSetupForScreenToScreenCopy( pScrn, xdir, ydir, GXcopy, ~0, color,
+ pMga->CurrentLayout.bitsPerPixel );
- SET_SYNC_FLAG(pMga->AccelInfoRec);
+ pMga->DrawTransparent = FALSE;
+
+ (*pMga->AccelInfoRec->SubsequentScreenToScreenCopy)(
+ pScrn, srcx, srcy, dstx, dsty, w, h);
+
+ SET_SYNC_FLAG(pMga->AccelInfoRec);
+ }
}