mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-02 09:52:27 -04:00
fix fonts issue (generated textures were upside down)
This commit is contained in:
parent
1168011850
commit
fc8935035a
@ -256,11 +256,16 @@ GenerateTexture(Rocket::Core::TextureHandle& texture_handle,
|
||||
PTA_uchar image = tex->modify_ram_image();
|
||||
|
||||
// Convert RGBA to BGRA
|
||||
for (size_t i = 0; i < image.size(); i += 4) {
|
||||
image[i] = source[i + 2];
|
||||
image[i + 1] = source[i + 1];
|
||||
image[i + 2] = source[i];
|
||||
image[i + 3] = source[i + 3];
|
||||
size_t row_size = source_dimensions.x * 4;
|
||||
size_t y2 = image.size();
|
||||
for (size_t y = 0; y < image.size(); y += row_size) {
|
||||
y2 -= row_size;
|
||||
for (size_t i = 0; i < row_size; i += 4) {
|
||||
image[y2 + i + 0] = source[y + i + 2];
|
||||
image[y2 + i + 1] = source[y + i + 1];
|
||||
image[y2 + i + 2] = source[y + i];
|
||||
image[y2 + i + 3] = source[y + i + 3];
|
||||
}
|
||||
}
|
||||
|
||||
tex->set_wrap_u(Texture::WM_clamp);
|
||||
|
Loading…
x
Reference in New Issue
Block a user