25#include "common/singleton.h"
26#include "graphics/surface.h"
27#include "common/system.h"
28#include "backends/platform/psp/memory.h"
29#include "backends/platform/psp/psppixelformat.h"
31#define MAX_TEXTURE_SIZE 512
43 bool isVisible() {
return true; }
44 bool isDirty() {
return true; }
61 Point() : x(0), y(0) {}
85 void setPixelFormats(PSPPixelFormat::Type paletteType, PSPPixelFormat::Type bufferType);
89 void set(
byte *values) { setPartial(values, 0,
_numOfEntries); }
90 void setPartial(
const byte *colors, uint start, uint num,
bool supportsAlpha =
false);
91 void getPartial(
byte *colors, uint start, uint num)
const;
92 uint32 getRawColorAt(uint32 position)
const;
93 uint32 getRGBAColorAt(uint32 position)
const;
94 void setSingleColorRGBA(uint32 num,
byte r,
byte g,
byte b,
byte a);
95 void setColorPositionAlpha(uint32 position,
bool alpha);
96 const byte *getRawValues()
const {
return _values; }
97 byte *getRawValues() {
return _values; }
98 bool isAllocated()
const {
return (
_values != 0); }
99 PSPPixelFormat::Type getPixelFormat()
const {
return _pixelFormat.format; }
100 void print(uint32 numToPrint = 0);
121 virtual ~Buffer() { deallocate(); }
124 void setSize(uint32 width, uint32 height, HowToSize textureOrSource = kSizeByTextureSize);
126 void setBytesPerPixel(uint32 bytes) { setBitsPerPixel(bytes << 3); }
127 void setPixelFormat(PSPPixelFormat::Type type);
130 uint32 getWidth()
const {
return _width; }
131 uint32 getWidthInBytes()
const {
return _pixelFormat.pixelsToBytes(getWidth()); }
132 uint32 getHeight()
const {
return _height; }
133 uint32 getSourceWidth()
const {
return _sourceSize.width; }
135 uint32 getSourceHeight()
const {
return _sourceSize.height; }
136 uint32 getTextureWidth()
const {
return _textureSize.width; }
137 uint32 getTextureHeight()
const {
return _textureSize.height; }
138 PSPPixelFormat::Type getPixelFormat()
const {
return _pixelFormat.format; }
140 uint32 getBytesPerPixel()
const {
return getBitsPerPixel() >> 3; }
141 const byte *getPixels()
const {
return _pixels; }
142 byte *getPixels() {
return _pixels; }
143 const byte *getBasePtr(
int x,
int y)
const {
return _pixels +
_pixelFormat.pixelsToBytes((y *
_width) + x); }
144 byte *getBasePtr(
int x,
int y) {
return _pixels +
_pixelFormat.pixelsToBytes((y *
_width) + x); }
148 void copyFromArray(
const byte *buffer,
int pitch);
149 void copyFromRect(
const byte *buf, uint32 pitch,
int destX,
int destY, uint32 recWidth, uint32 recHeight);
150 void copyToArray(
byte *dst,
int pitch);
151 bool allocate(
bool inVram =
false);
153 bool isAllocated()
const {
return (_pixels != 0) ; }
156 static uint32 scaleUpToPowerOfTwo(uint32 size);
157 void print(uint32 mask, uint32 numToPrint = 0);
184 static void setDisplayManager(
DisplayManager *dm) { _displayManager = dm; }
187 void setDrawSize(uint32 width, uint32 height) {
188 _drawSize.width = width;
189 _drawSize.height = height;
191 void setDrawWholeBuffer() {
193 _drawSize.width =
_buffer->getSourceWidth();
194 _drawSize.height =
_buffer->getSourceHeight();
197 void setPalette(
Palette *palette) { _palette = palette; }
200 void setColorTest(
bool value) {
_colorTest = value; }
201 void setKeyColor(uint32 value) { _keyColor = value; }
202 void setAlphaBlending(
bool value) {
_blending = value; }
203 void setAlphaReverse(
bool value) { _alphaReverse = value; }
204 void setFullScreen(
bool value) {
_fullScreen = value; }
206 void setStretch(
bool active) {
_stretch = active; }
207 void setStretchXY(
float x,
float y) {
_stretchX = x; _stretchY = y; }
209 static void cacheInvalidate(
void *pointer, uint32 size);
215 void fillVertices(
Vertex *vertices);
216 void guProgramDrawBehavior();
218 void guLoadTexture();
219 void guLoadPalette();
220 void guProgramTextureFormat();
221 void guProgramTextureBitDepth();
222 void guDrawVertices(
Vertex *vertices);
224 uint32 convertToGuPixelFormat(PSPPixelFormat::Type format);
225 float scaleSourceToOutput(
bool x,
float offset);
226 float stretch(
bool x,
float size);
229 Point _textureLoadOffset;
Definition: display_client.h:113
uint32 _width
True allocated width.
Definition: display_client.h:162
PSPPixelFormat _pixelFormat
Format of the buffer.
Definition: display_client.h:166
uint32 _height
True allocated height.
Definition: display_client.h:163
Dimensions _textureSize
Size rounded up to power of 2. Used for drawing.
Definition: display_client.h:164
Dimensions _sourceSize
Original size of the buffer.
Definition: display_client.h:165
Definition: display_client.h:40
Definition: display_manager.h:103
Definition: display_client.h:174
bool _colorTest
0 counts as full alpha
Definition: display_client.h:239
Point _offsetInBuffer
Where on screen to draw
Definition: display_client.h:231
Point _offsetOnScreen
For rendering textures > 512 pixels
Definition: display_client.h:230
Buffer * _buffer
Scale to the output size on screen
Definition: display_client.h:233
bool _useGlobalScaler
Where in the texture to draw
Definition: display_client.h:232
bool _fullScreen
Color to test against for color test. in 32 bits.
Definition: display_client.h:241
float _stretchX
Whether zooming is activated
Definition: display_client.h:243
bool _blending
Actual size to draw out of the Buffer
Definition: display_client.h:237
bool _stretch
Speeds up for fullscreen rendering
Definition: display_client.h:242
Definition: display_manager.h:72
Definition: atari-screen.h:42
uint32 _numOfEntries
number of palette entries
Definition: display_client.h:104
byte * _values
array of palette data
Definition: display_client.h:103
PSPPixelFormat _pixelFormat
pixel format of the palette data
Definition: display_client.h:105
Definition: display_client.h:67
Definition: display_client.h:58
Definition: display_client.h:53