minor drawing code cleanup

This commit is contained in:
notaz 2013-07-28 00:49:35 +03:00
parent 19886062f1
commit 41946d7023
14 changed files with 23 additions and 58 deletions

View file

@ -82,6 +82,7 @@ static void convert_pal555(int invert_prio)
} \
}
// this is almost never used (Wiz and menu bg gen only)
void FinalizeLine32xRGB555(int sh, int line)
{
unsigned short *pd = DrawLineDest;
@ -306,20 +307,23 @@ void PicoDraw32xLayerMdOnly(int offs, int lines)
}
}
void PicoDraw32xSetFrameMode(int is_on, int only_32x)
void PicoDrawSetOutFormat32x(pdso_t which, int use_32x_line_mode)
{
#ifdef _ASM_32X_DRAW
extern void *Pico32xNativePal;
Pico32xNativePal = Pico32xMem->pal_native;
#endif
if (is_on) {
// use the same layout as alt renderer
PicoDrawSetInternalBuf(PicoDraw2FB, 328);
Pico32xDrawMode = only_32x ? PDM32X_32X_ONLY : PDM32X_BOTH;
} else {
if (which == PDF_RGB555 && use_32x_line_mode) {
// we'll draw via FinalizeLine32xRGB555 (rare)
PicoDrawSetInternalBuf(NULL, 0);
Pico32xDrawMode = PDM32X_OFF;
return;
}
// use the same layout as alt renderer
PicoDrawSetInternalBuf(PicoDraw2FB, 328);
Pico32xDrawMode = (which == PDF_RGB555) ? PDM32X_32X_ONLY : PDM32X_BOTH;
}
// vim:shiftwidth=2:ts=2:expandtab

View file

@ -1546,7 +1546,7 @@ void PicoDrawUpdateHighPal(void)
}
}
void PicoDrawSetOutFormat(pdso_t which, int allow_32x)
void PicoDrawSetOutFormat(pdso_t which, int use_32x_line_mode)
{
switch (which)
{
@ -1555,7 +1555,7 @@ void PicoDrawSetOutFormat(pdso_t which, int allow_32x)
break;
case PDF_RGB555:
if ((PicoAHW & PAHW_32X) && allow_32x)
if ((PicoAHW & PAHW_32X) && use_32x_line_mode)
FinalizeLine = FinalizeLine32xRGB555;
else
FinalizeLine = FinalizeLine555;
@ -1565,6 +1565,7 @@ void PicoDrawSetOutFormat(pdso_t which, int allow_32x)
FinalizeLine = NULL;
break;
}
PicoDrawSetOutFormat32x(which, use_32x_line_mode);
PicoDrawSetOutputMode4(which);
rendstatus_old = -1;
}

View file

@ -15,8 +15,6 @@
#define TILE_ROWS END_ROW-START_ROW
#define USE_CACHE
// note: this is not implemented in ARM asm
#if defined(DRAW2_OVERRIDE_LINE_WIDTH)
#define LINE_WIDTH DRAW2_OVERRIDE_LINE_WIDTH
@ -24,6 +22,9 @@
#define LINE_WIDTH 328
#endif
static unsigned char PicoDraw2FB_[(8+320) * (8+240+8)];
unsigned char *PicoDraw2FB = PicoDraw2FB_;
static int HighCache2A[41*(TILE_ROWS+1)+1+1]; // caches for high layers
static int HighCache2B[41*(TILE_ROWS+1)+1+1];

View file

@ -171,7 +171,7 @@ typedef enum
PDF_RGB555, // RGB/BGR output, depends on compile options
PDF_8BIT, // 8-bit out (handles shadow/hilight mode, sonic water)
} pdso_t;
void PicoDrawSetOutFormat(pdso_t which, int allow_32x);
void PicoDrawSetOutFormat(pdso_t which, int use_32x_line_mode);
void PicoDrawSetOutBuf(void *dest, int increment);
void PicoDrawSetCallbacks(int (*begin)(unsigned int num), int (*end)(unsigned int num));
extern void *DrawLineDest;
@ -216,9 +216,6 @@ extern void (*PicoPrepareCram)(); // prepares PicoCramHigh for renderer to us
void Pico32xSetClocks(int msh2_hz, int ssh2_hz);
// 32x/draw.c
void PicoDraw32xSetFrameMode(int is_on, int only_32x);
#else
#define Pico32xSetClocks(msh2_khz, ssh2_khz)

View file

@ -757,6 +757,7 @@ void p32x_m68k_poll_event(unsigned int flags);
void p32x_sh2_poll_event(SH2 *sh2, unsigned int flags, unsigned int m68k_cycles);
// 32x/draw.c
void PicoDrawSetOutFormat32x(pdso_t which, int use_32x_line_mode);
void FinalizeLine32xRGB555(int sh, int line);
void PicoDraw32xLayer(int offs, int lines, int mdbg);
void PicoDraw32xLayerMdOnly(int offs, int lines);
@ -784,7 +785,6 @@ void p32x_pwm_schedule_sh2(SH2 *sh2);
#define PicoFrame32x()
#define PicoUnload32x()
#define Pico32xStateLoaded()
#define PicoDraw32xSetFrameMode(...)
#define FinalizeLine32xRGB555 NULL
#define p32x_pwm_update(...)
#define p32x_timers_recalc()