static void d3d_destroy_bitmap(ALLEGRO_BITMAP *bitmap) { ALLEGRO_BITMAP_D3D *d3d_bmp = (ALLEGRO_BITMAP_D3D *)bitmap; if (!al_is_sub_bitmap(bitmap)) { if (d3d_bmp->video_texture) { if (d3d_bmp->video_texture->Release() != 0) { ALLEGRO_WARN("d3d_destroy_bitmap: Release video texture failed.\n"); } } if (d3d_bmp->system_texture) { if (d3d_bmp->system_texture->Release() != 0) { ALLEGRO_WARN("d3d_destroy_bitmap: Release system texture failed.\n"); } } if (d3d_bmp->render_target) { if (d3d_bmp->render_target->Release() != 0) { ALLEGRO_WARN("d3d_destroy_bitmap: Release render target failed.\n"); } } } _al_vector_find_and_delete(&created_bitmaps, &d3d_bmp); }
/* Function: al_destroy_bitmap */ void al_destroy_bitmap(ALLEGRO_BITMAP *bitmap) { if (!bitmap) { return; } /* As a convenience, implicitly untarget the bitmap on the calling thread * before it is destroyed, but maintain the current display. */ if (bitmap == al_get_target_bitmap()) { ALLEGRO_DISPLAY *display = al_get_current_display(); if (display) al_set_target_bitmap(al_get_backbuffer(display)); else al_set_target_bitmap(NULL); } _al_set_bitmap_shader_field(bitmap, NULL); _al_unregister_destructor(_al_dtor_list, bitmap); if (!al_is_sub_bitmap(bitmap)) { ALLEGRO_DISPLAY* disp = _al_get_bitmap_display(bitmap); if (al_get_bitmap_flags(bitmap) & ALLEGRO_MEMORY_BITMAP) { destroy_memory_bitmap(bitmap); return; } /* Else it's a display bitmap */ if (bitmap->locked) al_unlock_bitmap(bitmap); if (bitmap->vt) bitmap->vt->destroy_bitmap(bitmap); if (disp) _al_vector_find_and_delete(&disp->bitmaps, &bitmap); if (bitmap->memory) al_free(bitmap->memory); } al_free(bitmap); }
static int allua_Bitmap_is_sub(lua_State * L) { ALLUA_bitmap bitmap = allua_check_bitmap(L, 1); lua_pushboolean(L, al_is_sub_bitmap(bitmap)); return 1; }
void MAS::Widget::ReleaseCanvas(ALLEGRO_BITMAP *bmp) { if (bmp && al_is_sub_bitmap(bmp)) al_destroy_bitmap(bmp); }
/** Checks if this bitmap is a subbitmap. @return true if subbitmap. */ bool isSubBitmap() const { return al_is_sub_bitmap(get()); }