mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-21 01:05:59 +00:00
GRAPHICS: Palette constants cleanup, added Palette methods to ManagedSurface
This commit is contained in:
parent
f0609ad962
commit
1f65be27d9
@ -26,6 +26,12 @@
|
||||
|
||||
namespace Graphics {
|
||||
|
||||
/**
|
||||
* Constants available for use in paletted code
|
||||
*/
|
||||
#define PALETTE_COUNT 256
|
||||
#define PALETTE_SIZE (256 * 3)
|
||||
|
||||
/**
|
||||
* @brief Simple class for handling a palette data.
|
||||
*
|
||||
|
@ -112,7 +112,7 @@ public:
|
||||
virtual void grabPalette(byte *colors, uint start, uint num) const = 0;
|
||||
|
||||
Graphics::Palette grabPalette(uint start, uint num) {
|
||||
byte tmp[256 * 3];
|
||||
byte tmp[PALETTE_SIZE];
|
||||
grabPalette(tmp, start, num);
|
||||
return Graphics::Palette(tmp, num);
|
||||
}
|
||||
|
@ -23,6 +23,7 @@
|
||||
#define GRAPHICS_SCREEN_H
|
||||
|
||||
#include "graphics/managed_surface.h"
|
||||
#include "graphics/palette.h"
|
||||
#include "graphics/pixelformat.h"
|
||||
#include "common/list.h"
|
||||
#include "common/rect.h"
|
||||
@ -38,9 +39,6 @@ namespace Graphics {
|
||||
* @{
|
||||
*/
|
||||
|
||||
#define PALETTE_COUNT 256
|
||||
#define PALETTE_SIZE (256 * 3)
|
||||
|
||||
/**
|
||||
* Implements a specialised surface that represents the screen.
|
||||
* It keeps track of any areas of itself that are updated by drawing
|
||||
@ -110,6 +108,15 @@ public:
|
||||
*/
|
||||
void getPalette(byte *palette, uint start, uint num);
|
||||
|
||||
/**
|
||||
* Return a portion of the currently active palette as a palette object
|
||||
*/
|
||||
Graphics::Palette getPalette(uint start = 0, uint num = PALETTE_COUNT) {
|
||||
byte tmp[PALETTE_SIZE];
|
||||
getPalette(tmp, start, num);
|
||||
return Graphics::Palette(tmp, num);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the palette
|
||||
*/
|
||||
@ -120,6 +127,13 @@ public:
|
||||
*/
|
||||
void setPalette(const byte *palette, uint start, uint num);
|
||||
|
||||
/**
|
||||
* Set a palette based on a passed palette object
|
||||
*/
|
||||
void setPalette(const Graphics::Palette &pal, uint start = 0) {
|
||||
setPalette(pal.data(), start, pal.size());
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears the current palette, setting all entries to black
|
||||
*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user