Move RGBA conversion to GEGLTexture
This commit is contained in:
parent
b3aa499cd4
commit
2c3922f64f
@ -194,8 +194,15 @@ void GEGLTexture::updateTexture(void* data, video::ECOLOR_FORMAT format, u32 w,
|
|||||||
}
|
}
|
||||||
else if (format == video::ECF_A8R8G8B8)
|
else if (format == video::ECF_A8R8G8B8)
|
||||||
{
|
{
|
||||||
|
uint8_t* u8_data = (uint8_t*)data;
|
||||||
|
for (unsigned int i = 0; i < w * h; i++)
|
||||||
|
{
|
||||||
|
uint8_t tmp_val = u8_data[i * 4];
|
||||||
|
u8_data[i * 4] = u8_data[i * 4 + 2];
|
||||||
|
u8_data[i * 4 + 2] = tmp_val;
|
||||||
|
}
|
||||||
glTexSubImage2D(GL_TEXTURE_2D, 0, x, y, w, h, GL_RGBA,
|
glTexSubImage2D(GL_TEXTURE_2D, 0, x, y, w, h, GL_RGBA,
|
||||||
GL_UNSIGNED_BYTE, data);
|
GL_UNSIGNED_BYTE, u8_data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (hasMipMaps())
|
if (hasMipMaps())
|
||||||
|
@ -291,13 +291,6 @@ void FontWithFace::insertGlyph(unsigned font_number, unsigned glyph_index)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
uint8_t* scaled_data = (uint8_t*)scaled->lock();
|
uint8_t* scaled_data = (uint8_t*)scaled->lock();
|
||||||
for (unsigned int i = 0; i < cur_glyph_width * cur_glyph_height;
|
|
||||||
i++)
|
|
||||||
{
|
|
||||||
uint8_t tmp_val = scaled_data[i * 4];
|
|
||||||
scaled_data[i * 4] = scaled_data[i * 4 + 2];
|
|
||||||
scaled_data[i * 4 + 2] = tmp_val;
|
|
||||||
}
|
|
||||||
tex->updateTexture(scaled_data, video::ECF_A8R8G8B8,
|
tex->updateTexture(scaled_data, video::ECF_A8R8G8B8,
|
||||||
cur_glyph_width, cur_glyph_height, m_used_width,
|
cur_glyph_width, cur_glyph_height, m_used_width,
|
||||||
m_used_height);
|
m_used_height);
|
||||||
|
Loading…
Reference in New Issue
Block a user