mirror of
https://github.com/ocornut/imgui.git
synced 2026-01-05 21:07:51 +00:00
Amend/fix ee8941e.
This commit is contained in:
@@ -268,8 +268,6 @@ void ImGui_ImplAllegro5_UpdateTexture(ImTextureData* tex)
|
|||||||
al_set_new_bitmap_flags(ALLEGRO_MEMORY_BITMAP | ALLEGRO_MIN_LINEAR | ALLEGRO_MAG_LINEAR);
|
al_set_new_bitmap_flags(ALLEGRO_MEMORY_BITMAP | ALLEGRO_MIN_LINEAR | ALLEGRO_MAG_LINEAR);
|
||||||
al_set_new_bitmap_format(ALLEGRO_PIXEL_FORMAT_ABGR_8888_LE);
|
al_set_new_bitmap_format(ALLEGRO_PIXEL_FORMAT_ABGR_8888_LE);
|
||||||
ALLEGRO_BITMAP* cpu_bitmap = al_create_bitmap(tex->Width, tex->Height);
|
ALLEGRO_BITMAP* cpu_bitmap = al_create_bitmap(tex->Width, tex->Height);
|
||||||
al_set_new_bitmap_flags(new_bitmap_flags);
|
|
||||||
al_set_new_bitmap_format(new_bitmap_format);
|
|
||||||
IM_ASSERT(cpu_bitmap != nullptr && "Backend failed to create texture!");
|
IM_ASSERT(cpu_bitmap != nullptr && "Backend failed to create texture!");
|
||||||
|
|
||||||
// Upload pixels
|
// Upload pixels
|
||||||
@@ -279,10 +277,15 @@ void ImGui_ImplAllegro5_UpdateTexture(ImTextureData* tex)
|
|||||||
al_unlock_bitmap(cpu_bitmap);
|
al_unlock_bitmap(cpu_bitmap);
|
||||||
|
|
||||||
// Convert software texture to hardware texture.
|
// Convert software texture to hardware texture.
|
||||||
|
al_set_new_bitmap_flags(ALLEGRO_VIDEO_BITMAP);
|
||||||
|
al_set_new_bitmap_format(ALLEGRO_PIXEL_FORMAT_ANY_32_WITH_ALPHA);
|
||||||
ALLEGRO_BITMAP* gpu_bitmap = al_clone_bitmap(cpu_bitmap);
|
ALLEGRO_BITMAP* gpu_bitmap = al_clone_bitmap(cpu_bitmap);
|
||||||
al_destroy_bitmap(cpu_bitmap);
|
al_destroy_bitmap(cpu_bitmap);
|
||||||
IM_ASSERT(gpu_bitmap != nullptr && "Backend failed to create texture!");
|
IM_ASSERT(gpu_bitmap != nullptr && "Backend failed to create texture!");
|
||||||
|
|
||||||
|
al_set_new_bitmap_flags(new_bitmap_flags);
|
||||||
|
al_set_new_bitmap_format(new_bitmap_format);
|
||||||
|
|
||||||
// Store identifiers
|
// Store identifiers
|
||||||
tex->SetTexID((ImTextureID)(intptr_t)gpu_bitmap);
|
tex->SetTexID((ImTextureID)(intptr_t)gpu_bitmap);
|
||||||
tex->SetStatus(ImTextureStatus_OK);
|
tex->SetStatus(ImTextureStatus_OK);
|
||||||
@@ -521,7 +524,7 @@ void ImGui_ImplAllegro5_SetDisplay(ALLEGRO_DISPLAY* display)
|
|||||||
|
|
||||||
if (bd->Display && !bd->VertexDecl)
|
if (bd->Display && !bd->VertexDecl)
|
||||||
{
|
{
|
||||||
// Create custom vertex declaration.
|
// Create custom vertex declaration.
|
||||||
// Unfortunately Allegro doesn't support 32-bits packed colors so we have to convert them to 4 floats.
|
// Unfortunately Allegro doesn't support 32-bits packed colors so we have to convert them to 4 floats.
|
||||||
// We still use a custom declaration to use 'ALLEGRO_PRIM_TEX_COORD' instead of 'ALLEGRO_PRIM_TEX_COORD_PIXEL' else we can't do a reliable conversion.
|
// We still use a custom declaration to use 'ALLEGRO_PRIM_TEX_COORD' instead of 'ALLEGRO_PRIM_TEX_COORD_PIXEL' else we can't do a reliable conversion.
|
||||||
ALLEGRO_VERTEX_ELEMENT elems[] =
|
ALLEGRO_VERTEX_ELEMENT elems[] =
|
||||||
|
|||||||
@@ -43,6 +43,8 @@ Breaking Changes:
|
|||||||
|
|
||||||
Other Changes:
|
Other Changes:
|
||||||
|
|
||||||
|
- Backends: Allegro5: Fixed texture format setup which didn't work on all
|
||||||
|
setups/drivers. (#8770, #8465)
|
||||||
- Backends: Allegro5: Added ImGui_ImplAllegro5_SetDisplay() function to
|
- Backends: Allegro5: Added ImGui_ImplAllegro5_SetDisplay() function to
|
||||||
change current ALLEGRO_DISPLAY, as Allegro applications often need to do that.
|
change current ALLEGRO_DISPLAY, as Allegro applications often need to do that.
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user