|
@@ -1111,13 +1111,13 @@ void OpenGLBackend::PopulateCursorCache(
|
|
|
for (uint i = 0; i < _cursor.sprite_count; ++i) {
|
|
|
this->cursor_sprite_seq[i] = _cursor.sprite_seq[i];
|
|
|
this->cursor_sprite_pos[i] = _cursor.sprite_pos[i];
|
|
|
SpriteID sprite = _cursor.sprite_seq[i].sprite;
|
|
|
|
|
|
if (!this->cursor_cache.Contains(sprite)) {
|
|
|
Sprite *old = this->cursor_cache.Insert(sprite, (Sprite *)GetRawSprite(sprite, ST_NORMAL, &SimpleSpriteAlloc, this));
|
|
|
Sprite *old = this->cursor_cache.Insert(sprite, (Sprite *)GetRawSprite(sprite, SpriteType::Normal, &SimpleSpriteAlloc, this));
|
|
|
if (old != nullptr) {
|
|
|
OpenGLSprite *gl_sprite = (OpenGLSprite *)old->data;
|
|
|
gl_sprite->~OpenGLSprite();
|
|
|
free(old);
|
|
|
}
|
|
|
}
|
|
@@ -1269,16 +1269,16 @@ void OpenGLBackend::ReleaseAnimBuffer(co
|
|
|
/* virtual */ Sprite *OpenGLBackend::Encode(const SpriteLoader::Sprite *sprite, AllocatorProc *allocator)
|
|
|
{
|
|
|
/* Allocate and construct sprite data. */
|
|
|
Sprite *dest_sprite = (Sprite *)allocator(sizeof(*dest_sprite) + sizeof(OpenGLSprite));
|
|
|
|
|
|
OpenGLSprite *gl_sprite = (OpenGLSprite *)dest_sprite->data;
|
|
|
new (gl_sprite) OpenGLSprite(sprite->width, sprite->height, sprite->type == ST_FONT ? 1 : ZOOM_LVL_COUNT, sprite->colours);
|
|
|
new (gl_sprite) OpenGLSprite(sprite->width, sprite->height, sprite->type == SpriteType::Font ? 1 : ZOOM_LVL_COUNT, sprite->colours);
|
|
|
|
|
|
/* Upload texture data. */
|
|
|
for (int i = 0; i < (sprite->type == ST_FONT ? 1 : ZOOM_LVL_COUNT); i++) {
|
|
|
for (int i = 0; i < (sprite->type == SpriteType::Font ? 1 : ZOOM_LVL_COUNT); i++) {
|
|
|
gl_sprite->Update(sprite[i].width, sprite[i].height, i, sprite[i].data);
|
|
|
}
|
|
|
|
|
|
dest_sprite->height = sprite->height;
|
|
|
dest_sprite->width = sprite->width;
|
|
|
dest_sprite->x_offs = sprite->x_offs;
|
|
@@ -1307,13 +1307,13 @@ void OpenGLBackend::RenderOglSprite(Open
|
|
|
_glBindTexture(GL_TEXTURE_1D, OpenGLSprite::pal_tex);
|
|
|
if (pal != this->last_sprite_pal) {
|
|
|
/* Different remap palette in use, update texture. */
|
|
|
_glBindBuffer(GL_PIXEL_UNPACK_BUFFER, OpenGLSprite::pal_pbo);
|
|
|
_glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
|
|
|
|
|
|
_glBufferSubData(GL_PIXEL_UNPACK_BUFFER, 0, 256, GetNonSprite(GB(pal, 0, PALETTE_WIDTH), ST_RECOLOUR) + 1);
|
|
|
_glBufferSubData(GL_PIXEL_UNPACK_BUFFER, 0, 256, GetNonSprite(GB(pal, 0, PALETTE_WIDTH), SpriteType::Recolour) + 1);
|
|
|
_glTexSubImage1D(GL_TEXTURE_1D, 0, 0, 256, GL_RED, GL_UNSIGNED_BYTE, nullptr);
|
|
|
|
|
|
_glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0);
|
|
|
|
|
|
this->last_sprite_pal = pal;
|
|
|
}
|