mirror of https://github.com/stella-emu/stella.git
added support for qvga landscape smartphones. cleanup.
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1297 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
parent
494b1cdcdc
commit
4d9223bea7
|
@ -14,7 +14,7 @@
|
|||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//
|
||||
// Windows CE Port by Kostas Nakos
|
||||
// $Id: FrameBufferWinCE.cpp,v 1.10 2007-01-18 16:26:04 knakos Exp $
|
||||
// $Id: FrameBufferWinCE.cpp,v 1.11 2007-01-21 20:07:48 knakos Exp $
|
||||
//============================================================================
|
||||
|
||||
#include <windows.h>
|
||||
|
@ -84,7 +84,13 @@ void FrameBufferWinCE::GetDeviceProperties(void)
|
|||
else if (gxdp.cxWidth == 480 && gxdp.cyHeight == 640)
|
||||
devres = VGA;
|
||||
else
|
||||
{
|
||||
devres = QVGA;
|
||||
// as a special case, qvga landscape devices are represented by the combination of:
|
||||
// devres=QVGA && islandscape=true && displaymode=0
|
||||
if (gxdp.cxWidth > gxdp.cyHeight)
|
||||
islandscape = true;
|
||||
}
|
||||
}
|
||||
|
||||
void FrameBufferWinCE::setTIAPalette(const uInt32* palette)
|
||||
|
@ -152,6 +158,8 @@ bool FrameBufferWinCE::initSubsystem()
|
|||
|
||||
void FrameBufferWinCE::setmode(uInt8 mode)
|
||||
{
|
||||
bool qvga_l = (displaymode == 0) && islandscape;
|
||||
|
||||
displaymode = mode % 3;
|
||||
switch (displaymode)
|
||||
{
|
||||
|
@ -159,23 +167,21 @@ void FrameBufferWinCE::setmode(uInt8 mode)
|
|||
case 0:
|
||||
pixelstep = gxdp.cbxPitch;
|
||||
linestep = gxdp.cbyPitch;
|
||||
islandscape = false;
|
||||
break;
|
||||
|
||||
// landscape
|
||||
case 1:
|
||||
pixelstep = - gxdp.cbyPitch;
|
||||
linestep = gxdp.cbxPitch;
|
||||
islandscape = true;
|
||||
break;
|
||||
|
||||
// inverted landscape
|
||||
case 2:
|
||||
pixelstep = gxdp.cbyPitch;
|
||||
linestep = - gxdp.cbxPitch;
|
||||
islandscape = true;
|
||||
break;
|
||||
}
|
||||
islandscape = displaymode || qvga_l;
|
||||
|
||||
pixelstepdouble = pixelstep << 1;
|
||||
linestepdouble = linestep << 1;
|
||||
|
@ -189,6 +195,7 @@ void FrameBufferWinCE::setmode(uInt8 mode)
|
|||
|
||||
uInt8 FrameBufferWinCE::rotatedisplay(void)
|
||||
{
|
||||
if (!(displaymode == 0 && islandscape))
|
||||
displaymode = (displaymode + 1) % 3;
|
||||
setmode(displaymode);
|
||||
wipescreen();
|
||||
|
@ -660,8 +667,10 @@ void FrameBufferWinCE::drawChar(const GUI::Font* myfont, uInt8 c, uInt32 x, uInt
|
|||
}
|
||||
else if (devres == QVGA)
|
||||
{
|
||||
if (displaymode != 2)
|
||||
d = myDstScreen + (scrheight-x-1) * scrlinestep + (y-1) * scrpixelstep;
|
||||
if (!displaymode && islandscape)
|
||||
d = myDstScreen + y * scrlinestep + x * scrpixelstep;
|
||||
else if (displaymode != 2)
|
||||
d = myDstScreen + (scrheight-x) * scrlinestep + y * scrpixelstep;
|
||||
else
|
||||
d = myDstScreen + x * scrlinestep + (scrwidth-y-1) * scrpixelstep;
|
||||
}
|
||||
|
@ -698,12 +707,16 @@ void FrameBufferWinCE::drawChar(const GUI::Font* myfont, uInt8 c, uInt32 x, uInt
|
|||
{
|
||||
if (buffer & mask)
|
||||
*((uInt16 *)d) = col;
|
||||
if (displaymode != 2)
|
||||
if (!displaymode && islandscape)
|
||||
d += scrpixelstep;
|
||||
else if (displaymode != 2)
|
||||
d -= scrlinestep;
|
||||
else
|
||||
d += scrlinestep;
|
||||
}
|
||||
if (displaymode != 2)
|
||||
if (!displaymode && islandscape)
|
||||
d = tmp + scrlinestep;
|
||||
else if (displaymode != 2)
|
||||
d = tmp + scrpixelstep;
|
||||
else
|
||||
d = tmp - scrpixelstep;
|
||||
|
@ -729,35 +742,9 @@ void FrameBufferWinCE::drawChar(const GUI::Font* myfont, uInt8 c, uInt32 x, uInt
|
|||
else
|
||||
d = tmp - (scrpixelstep<<1);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void FrameBufferWinCE::scanline(uInt32 row, uInt8* data)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
void FrameBufferWinCE::setAspectRatio()
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
bool FrameBufferWinCE::createScreen()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
void FrameBufferWinCE::toggleFilter()
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
uInt32 FrameBufferWinCE::mapRGB(Uint8 r, Uint8 g, Uint8 b)
|
||||
{
|
||||
return 0xFFFFFFFF;
|
||||
}
|
||||
|
||||
void FrameBufferWinCE::hLine(uInt32 x, uInt32 y, uInt32 x2, int color)
|
||||
{
|
||||
if (devres == SM_LOW)
|
||||
|
@ -767,8 +754,10 @@ void FrameBufferWinCE::hLine(uInt32 x, uInt32 y, uInt32 x2, int color)
|
|||
PlothLine(kx, ky, kx2, color);
|
||||
}
|
||||
else if (devres == QVGA)
|
||||
if (displaymode != 2)
|
||||
PlotvLine(y, scrheight-x, scrheight-x2-1, color);
|
||||
if (!displaymode && islandscape)
|
||||
PlothLine(x, y, x2, color);
|
||||
else if (displaymode != 2)
|
||||
PlotvLine(y, scrheight-x, scrheight-x2, color);
|
||||
else
|
||||
PlotvLine(scrwidth-y-1, x, x2+1, color);
|
||||
else
|
||||
|
@ -790,7 +779,7 @@ void FrameBufferWinCE::PlothLine(uInt32 x, uInt32 y, uInt32 x2, int color)
|
|||
if (x>x2) { x2 ^= x; x ^= x2; x2 ^= x;} //lazy swap
|
||||
uInt8 *d = myDstScreen + y * scrlinestep + x * scrpixelstep;
|
||||
uInt16 col = pal[color];
|
||||
for (;x < x2; x++, *((uInt16 *)d) = col, d += scrpixelstep);
|
||||
for (;x <= x2; x++, *((uInt16 *)d) = col, d += scrpixelstep);
|
||||
}
|
||||
|
||||
void FrameBufferWinCE::vLine(uInt32 x, uInt32 y, uInt32 y2, int color)
|
||||
|
@ -802,8 +791,10 @@ void FrameBufferWinCE::vLine(uInt32 x, uInt32 y, uInt32 y2, int color)
|
|||
PlotvLine(kx, ky, ky2, color);
|
||||
}
|
||||
else if (devres == QVGA)
|
||||
if (displaymode != 2)
|
||||
PlothLine(y, scrheight-x-1, y2, color);
|
||||
if (!displaymode && islandscape)
|
||||
PlotvLine(x, y, y2, color);
|
||||
else if (displaymode != 2)
|
||||
PlothLine(y, scrheight-x, y2, color);
|
||||
else
|
||||
PlothLine(scrwidth-y, x, scrwidth-y2, color);
|
||||
else
|
||||
|
@ -825,7 +816,7 @@ void FrameBufferWinCE::PlotvLine(uInt32 x, uInt32 y, uInt32 y2, int color)
|
|||
if (!myDstScreen) return;
|
||||
uInt8 *d = myDstScreen + y * scrlinestep + x * scrpixelstep;
|
||||
uInt16 col = pal[color];
|
||||
for (;y < y2; y++, *((uInt16 *)d) = col, d += scrlinestep);
|
||||
for (;y <= y2; y++, *((uInt16 *)d) = col, d += scrlinestep);
|
||||
}
|
||||
|
||||
void FrameBufferWinCE::fillRect(uInt32 x, uInt32 y, uInt32 w, uInt32 h, int color)
|
||||
|
@ -841,10 +832,15 @@ void FrameBufferWinCE::fillRect(uInt32 x, uInt32 y, uInt32 w, uInt32 h, int colo
|
|||
}
|
||||
else if (devres == QVGA)
|
||||
{
|
||||
if (!displaymode && islandscape)
|
||||
{
|
||||
PlotfillRect(x, y, w, h, color);
|
||||
return;
|
||||
}
|
||||
if (x>scrheight) return; if (y>scrwidth) return;
|
||||
if (x+w>scrheight) w=scrheight-x; if (y+h>scrwidth) h=scrwidth-y;
|
||||
if (displaymode != 2)
|
||||
PlotfillRect(y, scrheight-x-w, h-1, w-1, color);
|
||||
PlotfillRect(y, scrheight-x-w+1, h, w, color);
|
||||
else
|
||||
PlotfillRect(scrwidth-y-h, x, h-1, w-1, color);
|
||||
}
|
||||
|
@ -865,9 +861,9 @@ void FrameBufferWinCE::PlotfillRect(uInt32 x, uInt32 y, uInt32 w, uInt32 h, int
|
|||
if (!myDstScreen) return;
|
||||
uInt8 *d = myDstScreen + y * scrlinestep + x * scrpixelstep;
|
||||
uInt16 col = pal[color];
|
||||
uInt32 stride = (scrwidth - w - 1) * scrpixelstep;
|
||||
for (h++; h != 0; h--, d += stride)
|
||||
for (int w2=w; w2>=0; w2--, *((uInt16 *)d) = col, d += scrpixelstep);
|
||||
uInt32 stride = (scrwidth - w) * scrpixelstep;
|
||||
for (;h != 0; h--, d += stride)
|
||||
for (int w2=w; w2>0; w2--, *((uInt16 *)d) = col, d += scrpixelstep);
|
||||
}
|
||||
|
||||
void FrameBufferWinCE::drawBitmap(uInt32* bitmap, Int32 x, Int32 y, int color, Int32 h)
|
||||
|
@ -877,11 +873,14 @@ void FrameBufferWinCE::drawBitmap(uInt32* bitmap, Int32 x, Int32 y, int color, I
|
|||
uInt32 cold;
|
||||
|
||||
if (!myDstScreen) return;
|
||||
|
||||
if (devres == SM_LOW)
|
||||
return;
|
||||
else if (devres == QVGA)
|
||||
if (displaymode != 2)
|
||||
d = myDstScreen + (scrheight-x-1) * scrlinestep + y * scrpixelstep;
|
||||
if (!displaymode && islandscape)
|
||||
d = myDstScreen + y * scrlinestep + x * scrpixelstep;
|
||||
else if (displaymode != 2)
|
||||
d = myDstScreen + (scrheight-x) * scrlinestep + y * scrpixelstep;
|
||||
else
|
||||
d = myDstScreen + x * scrlinestep + (scrwidth-y-1) * scrpixelstep;
|
||||
else
|
||||
|
@ -896,6 +895,7 @@ void FrameBufferWinCE::drawBitmap(uInt32* bitmap, Int32 x, Int32 y, int color, I
|
|||
{
|
||||
uInt32 mask = 0xF0000000;
|
||||
uInt8 *tmp = d;
|
||||
|
||||
for (int j = 0; j < 8; j++, mask >>= 4)
|
||||
{
|
||||
if(bitmap[i] & mask)
|
||||
|
@ -910,7 +910,9 @@ void FrameBufferWinCE::drawBitmap(uInt32* bitmap, Int32 x, Int32 y, int color, I
|
|||
}
|
||||
if (devres == QVGA)
|
||||
{
|
||||
if (displaymode != 2)
|
||||
if (!displaymode && islandscape)
|
||||
d += scrpixelstep;
|
||||
else if (displaymode != 2)
|
||||
d -= scrlinestep;
|
||||
else
|
||||
d += scrlinestep;
|
||||
|
@ -923,9 +925,12 @@ void FrameBufferWinCE::drawBitmap(uInt32* bitmap, Int32 x, Int32 y, int color, I
|
|||
d += (scrlinestep<<1);
|
||||
}
|
||||
}
|
||||
|
||||
if (devres == QVGA)
|
||||
{
|
||||
if (displaymode != 2)
|
||||
if (!displaymode && islandscape)
|
||||
d = tmp + scrlinestep;
|
||||
else if (displaymode != 2)
|
||||
d = tmp + scrpixelstep;
|
||||
else
|
||||
d = tmp - scrpixelstep;
|
||||
|
@ -981,11 +986,6 @@ void FrameBufferWinCE::addDirtyRect(uInt32 x, uInt32 y, uInt32 w, uInt32 h)
|
|||
return;
|
||||
}
|
||||
|
||||
uInt32 FrameBufferWinCE::lineDim()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
string FrameBufferWinCE::about()
|
||||
{
|
||||
string id = "Video rendering: ";
|
||||
|
|
Loading…
Reference in New Issue