示例#1
0
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);
}
示例#2
0
/* 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);
}
示例#3
0
文件: bitmap.c 项目: trezker/allua
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;
}
示例#4
0
void MAS::Widget::ReleaseCanvas(ALLEGRO_BITMAP *bmp) {
   if (bmp && al_is_sub_bitmap(bmp)) al_destroy_bitmap(bmp);
}
示例#5
0
文件: Bitmap.hpp 项目: arvidsson/ALX
 /**
     Checks if this bitmap is a subbitmap.
     @return true if subbitmap.
  */
 bool isSubBitmap() const {
     return al_is_sub_bitmap(get());
 }