changed OSystem to allow RBG<->16bit color conversion to be done in the backend; after all, the backend 'knows' best what format the overlay uses. Default implementations of RBGToColor and colorToRBG assume 565 mode, backends other than SDL may want to provide alternate implementations (SDL backend already does the right thing for non-565 modes)
svn-id: r5931
This commit is contained in:
parent
7bcbcde994
commit
4bf96d1c8b
6 changed files with 82 additions and 82 deletions
|
@ -45,6 +45,10 @@ public:
|
|||
virtual void grab_overlay(int16 *buf, int pitch);
|
||||
virtual void copy_rect_overlay(const int16 *buf, int pitch, int x, int y, int w, int h);
|
||||
|
||||
// Methods that convert RBG to/from colors suitable for the overlay.
|
||||
virtual int16 RBGToColor(uint8 r, uint8 g, uint8 b);
|
||||
virtual void colorToRBG(int16 color, uint8 &r, uint8 &g, uint8 &b);
|
||||
|
||||
protected:
|
||||
typedef void ScalerProc(uint8 *srcPtr, uint32 srcPitch, uint8 *deltaPtr,
|
||||
uint8 *dstPtr, uint32 dstPitch, int width, int height);
|
||||
|
@ -153,7 +157,7 @@ void OSystem_SDL_Normal::draw_mouse() {
|
|||
*bak++ = *dst;
|
||||
color = *src++;
|
||||
if (color != 0xFF) // 0xFF = transparent, don't draw
|
||||
*dst = RGB_TO_16(_currentPalette[color].r, _currentPalette[color].g, _currentPalette[color].b);
|
||||
*dst = RBGToColor(_currentPalette[color].r, _currentPalette[color].g, _currentPalette[color].b);
|
||||
dst++;
|
||||
width--;
|
||||
}
|
||||
|
@ -466,14 +470,20 @@ uint32 OSystem_SDL_Normal::property(int param, Property *value) {
|
|||
}
|
||||
#endif
|
||||
return 1;
|
||||
} else if (param == PROP_OVERLAY_IS_565) {
|
||||
assert(_tmpscreen != 0);
|
||||
return (_tmpscreen->format->Rmask != 0x7C00);
|
||||
}
|
||||
|
||||
return OSystem_SDL_Common::property(param, value);
|
||||
}
|
||||
|
||||
int16 OSystem_SDL_Normal::RBGToColor(uint8 r, uint8 g, uint8 b)
|
||||
{
|
||||
return SDL_MapRGB(_tmpscreen->format, r, g, b);
|
||||
}
|
||||
|
||||
void OSystem_SDL_Normal::colorToRBG(int16 color, uint8 &r, uint8 &g, uint8 &b)
|
||||
{
|
||||
SDL_GetRGB(color, _tmpscreen->format, &r, &g, &b);
|
||||
}
|
||||
|
||||
void OSystem_SDL_Normal::show_overlay()
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue