mirror of https://github.com/stella-emu/stella.git
One final optimization in FrameBufferGP2X. The only calls to SDL_FillRect
are now in hLine() and vLine(), and it's probably optimal to leave them there. git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1184 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
parent
3c93be914a
commit
0a970a97d5
|
@ -13,7 +13,7 @@
|
||||||
// See the file "license" for information on usage and redistribution of
|
// See the file "license" for information on usage and redistribution of
|
||||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||||
//
|
//
|
||||||
// $Id: FrameBufferGP2X.cxx,v 1.8 2006-12-05 21:55:15 stephena Exp $
|
// $Id: FrameBufferGP2X.cxx,v 1.9 2006-12-05 23:49:43 stephena Exp $
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
|
||||||
#include <SDL.h>
|
#include <SDL.h>
|
||||||
|
@ -255,22 +255,16 @@ void FrameBufferGP2X::drawChar(const GUI::Font* FONT, uInt8 chr,
|
||||||
chr -= desc.firstchar;
|
chr -= desc.firstchar;
|
||||||
const uInt16* tmp = desc.bits + (desc.offset ? desc.offset[chr] : (chr * h));
|
const uInt16* tmp = desc.bits + (desc.offset ? desc.offset[chr] : (chr * h));
|
||||||
|
|
||||||
SDL_Rect rect;
|
uInt16* buffer = (uInt16*) myScreen->pixels + yorig * myScreen->w + xorig;
|
||||||
for(int y = 0; y < h; y++)
|
for(int y = 0; y < h; ++y)
|
||||||
{
|
{
|
||||||
const uInt16 buffer = *tmp++;
|
const uInt16 ptr = *tmp++;
|
||||||
uInt16 mask = 0x8000;
|
uInt16 mask = 0x8000;
|
||||||
|
for(int x = 0; x < w; ++x, mask >>= 1)
|
||||||
|
if(ptr & mask)
|
||||||
|
buffer[x] = (uInt16) myDefPalette[color];
|
||||||
|
|
||||||
for(int x = 0; x < w; x++, mask >>= 1)
|
buffer += myScreen->w;
|
||||||
{
|
|
||||||
if ((buffer & mask) != 0)
|
|
||||||
{
|
|
||||||
rect.x = x + xorig;
|
|
||||||
rect.y = y + yorig;
|
|
||||||
rect.w = rect.h = 1;
|
|
||||||
SDL_FillRect(myScreen, &rect, myDefPalette[color]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -278,21 +272,15 @@ void FrameBufferGP2X::drawChar(const GUI::Font* FONT, uInt8 chr,
|
||||||
void FrameBufferGP2X::drawBitmap(uInt32* bitmap, Int32 xorig, Int32 yorig,
|
void FrameBufferGP2X::drawBitmap(uInt32* bitmap, Int32 xorig, Int32 yorig,
|
||||||
int color, Int32 h)
|
int color, Int32 h)
|
||||||
{
|
{
|
||||||
SDL_Rect rect;
|
uInt16* buffer = (uInt16*) myScreen->pixels + yorig * myScreen->w + xorig;
|
||||||
for(int y = 0; y < h; y++)
|
for(int y = 0; y < h; ++y)
|
||||||
{
|
{
|
||||||
uInt32 mask = 0xF0000000;
|
uInt32 mask = 0xF0000000;
|
||||||
|
for(int x = 0; x < 8; ++x, mask >>= 4)
|
||||||
for(int x = 0; x < 8; x++, mask >>= 4)
|
|
||||||
{
|
|
||||||
if(bitmap[y] & mask)
|
if(bitmap[y] & mask)
|
||||||
{
|
buffer[x] = (uInt16) myDefPalette[color];
|
||||||
rect.x = x + xorig;
|
|
||||||
rect.y = y + yorig;
|
buffer += myScreen->w;
|
||||||
rect.w = rect.h = 1;
|
|
||||||
SDL_FillRect(myScreen, &rect, myDefPalette[color]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue