BACKENDS: Constify PaletteManager::grabPalette implementations

This commit is contained in:
Colin Snover 2017-10-15 13:46:41 -05:00
parent f9ba31e465
commit bda253b1ac
24 changed files with 24 additions and 24 deletions

View file

@ -51,7 +51,7 @@ public:
memcpy(_palette + 3 * start, colors, 3 * num); memcpy(_palette + 3 * start, colors, 3 * num);
setPaletteIntern(colors, start, num); setPaletteIntern(colors, start, num);
} }
void grabPalette(byte *colors, uint start, uint num) { void grabPalette(byte *colors, uint start, uint num) const {
assert(start + num <= 256); assert(start + num <= 256);
memcpy(colors, _palette + 3 * start, 3 * num); memcpy(colors, _palette + 3 * start, 3 * num);
} }

View file

@ -98,7 +98,7 @@ public:
// Graphics::PaletteManager interface // Graphics::PaletteManager interface
//virtual void setPalette(const byte *colors, uint start, uint num) = 0; //virtual void setPalette(const byte *colors, uint start, uint num) = 0;
//virtual void grabPalette(byte *colors, uint start, uint num) = 0; //virtual void grabPalette(byte *colors, uint start, uint num) const = 0;
}; };
#endif #endif

View file

@ -230,7 +230,7 @@ void OSystem_3DS::setPalette(const byte *colors, uint start, uint num) {
flushGameScreen(); flushGameScreen();
} }
} }
void OSystem_3DS::grabPalette(byte *colors, uint start, uint num) { void OSystem_3DS::grabPalette(byte *colors, uint start, uint num) const {
assert(start + num <= 256); assert(start + num <= 256);
memcpy(colors, _palette + 3 * start, 3 * num); memcpy(colors, _palette + 3 * start, 3 * num);
} }

View file

@ -105,7 +105,7 @@ public:
int16 getHeight(){ return _gameHeight; } int16 getHeight(){ return _gameHeight; }
int16 getWidth(){ return _gameWidth; } int16 getWidth(){ return _gameWidth; }
void setPalette(const byte *colors, uint start, uint num); void setPalette(const byte *colors, uint start, uint num);
void grabPalette(byte *colors, uint start, uint num); void grabPalette(byte *colors, uint start, uint num) const;
void copyRectToScreen(const void *buf, int pitch, int x, int y, int w, void copyRectToScreen(const void *buf, int pitch, int x, int y, int w,
int h); int h);
Graphics::Surface *lockScreen(); Graphics::Surface *lockScreen();

View file

@ -234,7 +234,7 @@ private:
protected: protected:
// PaletteManager API // PaletteManager API
virtual void setPalette(const byte *colors, uint start, uint num); virtual void setPalette(const byte *colors, uint start, uint num);
virtual void grabPalette(byte *colors, uint start, uint num); virtual void grabPalette(byte *colors, uint start, uint num) const;
public: public:
virtual void copyRectToScreen(const void *buf, int pitch, int x, int y, virtual void copyRectToScreen(const void *buf, int pitch, int x, int y,

View file

@ -408,7 +408,7 @@ void OSystem_Android::setPalette(const byte *colors, uint start, uint num) {
WRITE_UINT16(p, pf.RGBToColor(colors[0], colors[1], colors[2])); WRITE_UINT16(p, pf.RGBToColor(colors[0], colors[1], colors[2]));
} }
void OSystem_Android::grabPalette(byte *colors, uint start, uint num) { void OSystem_Android::grabPalette(byte *colors, uint start, uint num) const {
ENTER("%p, %u, %u", colors, start, num); ENTER("%p, %u, %u", colors, start, num);
#ifdef USE_RGB_COLOR #ifdef USE_RGB_COLOR

View file

@ -106,7 +106,7 @@ class OSystem_Dreamcast : private DCHardware, public EventsBaseBackend, public P
protected: protected:
// PaletteManager API // PaletteManager API
void setPalette(const byte *colors, uint start, uint num); void setPalette(const byte *colors, uint start, uint num);
void grabPalette(byte *colors, uint start, uint num); void grabPalette(byte *colors, uint start, uint num) const;
public: public:

View file

@ -171,7 +171,7 @@ void OSystem_Dreamcast::setCursorPalette(const byte *colors, uint start, uint nu
_enable_cursor_palette = true; _enable_cursor_palette = true;
} }
void OSystem_Dreamcast::grabPalette(byte *colors, uint start, uint num) void OSystem_Dreamcast::grabPalette(byte *colors, uint start, uint num) const
{ {
const unsigned short *src = palette + start; const unsigned short *src = palette + start;
if (num>0) if (num>0)

View file

@ -268,7 +268,7 @@ void OSystem_DS::setCursorPalette(const byte *colors, uint start, uint num) {
refreshCursor(); refreshCursor();
} }
void OSystem_DS::grabPalette(unsigned char *colors, uint start, uint num) { void OSystem_DS::grabPalette(unsigned char *colors, uint start, uint num) const {
// consolePrintf("Grabpalette"); // consolePrintf("Grabpalette");
for (unsigned int r = start; r < start + num; r++) { for (unsigned int r = start; r < start + num; r++) {

View file

@ -93,7 +93,7 @@ public:
protected: protected:
// PaletteManager API // PaletteManager API
virtual void setPalette(const byte *colors, uint start, uint num); virtual void setPalette(const byte *colors, uint start, uint num);
virtual void grabPalette(byte *colors, uint start, uint num); virtual void grabPalette(byte *colors, uint start, uint num) const;
public: public:
void restoreHardwarePalette(); void restoreHardwarePalette();

View file

@ -153,7 +153,7 @@ public:
protected: protected:
// PaletteManager API // PaletteManager API
virtual void setPalette(const byte *colors, uint start, uint num); virtual void setPalette(const byte *colors, uint start, uint num);
virtual void grabPalette(byte *colors, uint start, uint num); virtual void grabPalette(byte *colors, uint start, uint num) const;
public: public:
virtual void copyRectToScreen(const void *buf, int pitch, int x, int y, int w, int h); virtual void copyRectToScreen(const void *buf, int pitch, int x, int y, int w, int h);

View file

@ -223,7 +223,7 @@ void OSystem_iOS7::setPalette(const byte *colors, uint start, uint num) {
_mouseDirty = _mouseNeedTextureUpdate = true; _mouseDirty = _mouseNeedTextureUpdate = true;
} }
void OSystem_iOS7::grabPalette(byte *colors, uint start, uint num) { void OSystem_iOS7::grabPalette(byte *colors, uint start, uint num) const {
//printf("grabPalette(%p, %u, %u)\n", colors, start, num); //printf("grabPalette(%p, %u, %u)\n", colors, start, num);
assert(start + num <= 256); assert(start + num <= 256);
byte *b = colors; byte *b = colors;

View file

@ -140,7 +140,7 @@ public:
protected: protected:
// PaletteManager API // PaletteManager API
virtual void setPalette(const byte *colors, uint start, uint num); virtual void setPalette(const byte *colors, uint start, uint num);
virtual void grabPalette(byte *colors, uint start, uint num); virtual void grabPalette(byte *colors, uint start, uint num) const;
public: public:
virtual void copyRectToScreen(const void *buf, int pitch, int x, int y, int w, int h); virtual void copyRectToScreen(const void *buf, int pitch, int x, int y, int w, int h);

View file

@ -155,7 +155,7 @@ void OSystem_IPHONE::setPalette(const byte *colors, uint start, uint num) {
_mouseDirty = _mouseNeedTextureUpdate = true; _mouseDirty = _mouseNeedTextureUpdate = true;
} }
void OSystem_IPHONE::grabPalette(byte *colors, uint start, uint num) { void OSystem_IPHONE::grabPalette(byte *colors, uint start, uint num) const {
//printf("grabPalette(%p, %u, %u)\n", colors, start, num); //printf("grabPalette(%p, %u, %u)\n", colors, start, num);
assert(start + num <= 256); assert(start + num <= 256);
byte *b = colors; byte *b = colors;

View file

@ -157,7 +157,7 @@ public:
protected: protected:
// PaletteManager API // PaletteManager API
virtual void setPalette(const byte *colors, uint start, uint num); virtual void setPalette(const byte *colors, uint start, uint num);
virtual void grabPalette(byte *colors, uint start, uint num); virtual void grabPalette(byte *colors, uint start, uint num) const;
public: public:
virtual void copyRectToScreen(const void *buf, int pitch, int x, int y, int w, int h); virtual void copyRectToScreen(const void *buf, int pitch, int x, int y, int w, int h);

View file

@ -408,7 +408,7 @@ void OSystem_N64::rebuildOffscreenMouseBuffer(void) {
} }
} }
void OSystem_N64::grabPalette(byte *colors, uint start, uint num) { void OSystem_N64::grabPalette(byte *colors, uint start, uint num) const {
#ifdef N64_EXTREME_MEMORY_SAVING // This way loses precisions #ifdef N64_EXTREME_MEMORY_SAVING // This way loses precisions
uint32 i; uint32 i;
uint16 color; uint16 color;

View file

@ -556,7 +556,7 @@ void Gs2dScreen::setPalette(const uint8 *pal, uint8 start, uint16 num) {
SignalSema(g_DmacSema); SignalSema(g_DmacSema);
} }
void Gs2dScreen::grabPalette(uint8 *pal, uint8 start, uint16 num) { void Gs2dScreen::grabPalette(uint8 *pal, uint8 start, uint16 num) const {
assert(start + num <= 256); assert(start + num <= 256);
for (uint16 cnt = 0; cnt < num; cnt++) { for (uint16 cnt = 0; cnt < num; cnt++) {
uint16 src = start + cnt; uint16 src = start + cnt;

View file

@ -61,7 +61,7 @@ public:
void copyScreenRect(const uint8 *buf, int pitch, int x, int y, int w, int h); void copyScreenRect(const uint8 *buf, int pitch, int x, int y, int w, int h);
void setPalette(const uint8 *pal, uint8 start, uint16 num); void setPalette(const uint8 *pal, uint8 start, uint16 num);
void updateScreen(void); void updateScreen(void);
void grabPalette(uint8 *pal, uint8 start, uint16 num); void grabPalette(uint8 *pal, uint8 start, uint16 num) const;
//- overlay routines //- overlay routines
void copyOverlayRect(const byte *buf, uint16 pitch, uint16 x, uint16 y, uint16 w, uint16 h); void copyOverlayRect(const byte *buf, uint16 pitch, uint16 x, uint16 y, uint16 w, uint16 h);
void grabOverlay(byte *buf, uint16 pitch); void grabOverlay(byte *buf, uint16 pitch);

View file

@ -678,7 +678,7 @@ void OSystem_PS2::setPalette(const byte *colors, uint start, uint num) {
_screen->setPalette(colors, (uint8)start, (uint16)num); _screen->setPalette(colors, (uint8)start, (uint16)num);
} }
void OSystem_PS2::grabPalette(byte *colors, uint start, uint num) { void OSystem_PS2::grabPalette(byte *colors, uint start, uint num) const {
_screen->grabPalette(colors, (uint8)start, (uint16)num); _screen->grabPalette(colors, (uint8)start, (uint16)num);
} }

View file

@ -61,7 +61,7 @@ public:
protected: protected:
// PaletteManager API // PaletteManager API
virtual void setPalette(const byte *colors, uint start, uint num); virtual void setPalette(const byte *colors, uint start, uint num);
virtual void grabPalette(byte *colors, uint start, uint num); virtual void grabPalette(byte *colors, uint start, uint num) const;
public: public:
virtual void copyRectToScreen(const void *buf, int pitch, int x, int y, int w, int h); virtual void copyRectToScreen(const void *buf, int pitch, int x, int y, int w, int h);

View file

@ -280,7 +280,7 @@ int16 OSystem_PSP::getOverlayHeight() {
return (int16)_overlay.getHeight(); return (int16)_overlay.getHeight();
} }
void OSystem_PSP::grabPalette(byte *colors, uint start, uint num) { void OSystem_PSP::grabPalette(byte *colors, uint start, uint num) const {
DEBUG_ENTER_FUNC(); DEBUG_ENTER_FUNC();
_screen.getPartialPalette(colors, start, num); _screen.getPartialPalette(colors, start, num);
} }

View file

@ -94,7 +94,7 @@ public:
protected: protected:
// PaletteManager API // PaletteManager API
void setPalette(const byte *colors, uint start, uint num); void setPalette(const byte *colors, uint start, uint num);
void grabPalette(byte *colors, uint start, uint num); void grabPalette(byte *colors, uint start, uint num) const;
public: public:
void setCursorPalette(const byte *colors, uint start, uint num); void setCursorPalette(const byte *colors, uint start, uint num);

View file

@ -165,7 +165,7 @@ public:
virtual PaletteManager *getPaletteManager() { return this; } virtual PaletteManager *getPaletteManager() { return this; }
protected: protected:
virtual void setPalette(const byte *colors, uint start, uint num); virtual void setPalette(const byte *colors, uint start, uint num);
virtual void grabPalette(byte *colors, uint start, uint num); virtual void grabPalette(byte *colors, uint start, uint num) const;
public: public:
virtual void setCursorPalette(const byte *colors, uint start, uint num); virtual void setCursorPalette(const byte *colors, uint start, uint num);
virtual void copyRectToScreen(const void *buf, int pitch, int x, int y, virtual void copyRectToScreen(const void *buf, int pitch, int x, int y,

View file

@ -352,7 +352,7 @@ void OSystem_Wii::setPalette(const byte *colors, uint start, uint num) {
} }
} }
void OSystem_Wii::grabPalette(byte *colors, uint start, uint num) { void OSystem_Wii::grabPalette(byte *colors, uint start, uint num) const {
#ifdef USE_RGB_COLOR #ifdef USE_RGB_COLOR
assert(_pfGame.bytesPerPixel == 1); assert(_pfGame.bytesPerPixel == 1);
#endif #endif