コード例 #1
0
ファイル: map.c プロジェクト: jr314159/giraffe
/* map_freeMap
   Frees the loaded map.
*/
void
map_freeMap(void)
{
  extern Map map;
  int i;

  /* Free it layer by layer */
  for (i = 0; i < map.n_layers; i++)
    {
      int x, y;

      /* Free all of the tiles in the layer */
      for (x = 0; x < map.layers[i].w; x++)
	{
	  for (y = 0; y < map.layers[i].h; y++)
	    {
	      /* Is there a tile here? */
	      if (TILE_AT(i, x, y) != NULL)
		{
		  freeTile(i, x, y);
		}
	    }
	}
      /* Free the array */
      dyn_arrayFree((void **) map.layers[i].data, map.layers[i].w);
    }
  /* Free the array of layers */
  dyn_1dArrayFree(map.layers);
}
コード例 #2
0
ファイル: htmlimage.c プロジェクト: cogitokat/brlcad
/*
 *---------------------------------------------------------------------------
 *
 * imageChanged --
 *
 *     Image-changed callback.
 *
 * Results:
 *     None.
 *
 * Side effects:
 *     None.
 *
 *---------------------------------------------------------------------------
 */
static void 
imageChanged(
    ClientData clientData,
    int x,
    int y,
    int width,
    int height,
    int imgWidth,
    int imgHeight
    )
{
    HtmlImage2 *pImage = (HtmlImage2 *)clientData;
    if (pImage && !pImage->pUnscaled && !pImage->nIgnoreChange) {
        HtmlImage2 *p;
        HtmlTree *pTree = pImage->pImageServer->pTree;
        assert(pImage->image);

        for (p = pImage->pNext; p; p = p->pNext) {
            p->isValid = 0;
            assert(!p->pTileName);
        }
        freeTile(pImage);
        pImage->eAlpha = ALPHA_CHANNEL_UNKNOWN;

        /* Delete the pixmap/compressed-data representation */
        if( pImage->pixmap ){
            Tk_FreePixmap(Tk_Display(pTree->tkwin), pImage->pixmap);
            pImage->pixmap = 0;
        }
        freeImageCompressed(pImage);

        if (imgWidth!=pImage->width || imgHeight!=pImage->height) {
            pImage->width = imgWidth;
            pImage->height = imgHeight;
            HtmlWalkTree(pTree, 0, imageChangedCb, (ClientData)pImage);
        }

        Tcl_DoWhenIdle(asyncPixmapify, (ClientData)pImage);

        /* If the image contents have been modified but the size is
         * constant, then just redraw the display. This is lazy. If
         * there were an efficient way to determine the minimum region
         * to draw, then stuff like animated gifs would be much more
         * efficient.
         */
        HtmlCallbackDamage(pTree, 0, 0, 1000000, 1000000);
    }
}
コード例 #3
0
TileButton::~TileButton()
{
    freeTile();
}
コード例 #4
0
ファイル: htmlimage.c プロジェクト: cogitokat/brlcad
void 
HtmlImageFree (HtmlImage2 *pImage)
{
    if (!pImage) {
        return;
    }

    assert(pImage->nRef > 0);
    pImage->nRef--;
    if (
        pImage->nRef == 0 && 
        (pImage->pUnscaled || !pImage->pImageServer->isSuspendGC)
    ) {
        /* The reference count for this structure has reached zero.
         * Really delete it. The assert() says that an original image
         * cannot be deleted before all of it's scaled copies.
         */
        assert(pImage->pUnscaled || 0 == pImage->pNext);

        freeImageCompressed(pImage);
        freeTile(pImage);
        if (pImage->pixmap) {
            HtmlTree *pTree = pImage->pImageServer->pTree;
            Tk_FreePixmap(Tk_Display(pTree->tkwin), pImage->pixmap);
            pImage->pixmap = 0;
        }
        if (pImage->image) {
            Tk_FreeImage(pImage->image);
        }
        if (pImage->pImageName) {
            Tcl_Interp *interp = pImage->pImageServer->pTree->interp;
            Tcl_Obj *pEval;
            if (!pImage->pDelete) {
                pEval = Tcl_NewStringObj("image delete", -1);
                Tcl_IncrRefCount(pEval);
            } else {
                pEval = pImage->pDelete;
            }
            Tcl_ListObjAppendElement(interp, pEval, pImage->pImageName);
            Tcl_EvalObjEx(interp, pEval, TCL_EVAL_GLOBAL|TCL_EVAL_DIRECT);
            Tcl_DecrRefCount(pEval);
            Tcl_DecrRefCount(pImage->pImageName);
        }

        if (pImage->pUnscaled) {
            HtmlImage2 *pIter;
            for (
                pIter = pImage->pUnscaled; 
                pIter->pNext != pImage; 
                pIter = pIter->pNext
            ) {
                assert(pIter->pNext);
            }
            pIter->pNext = pIter->pNext->pNext;
            HtmlImageFree(pImage->pUnscaled);
        } else {
            const char *zKey = pImage->zUrl;
            Tcl_HashTable *paImage = &pImage->pImageServer->aImage;
            Tcl_HashEntry *pEntry = Tcl_FindHashEntry(paImage, zKey);
            assert(pEntry);
            Tcl_DeleteHashEntry(pEntry);
        }

        HtmlFree(pImage);
        Tcl_CancelIdleCall(asyncPixmapify, (ClientData)pImage);
    }
}
コード例 #5
0
ファイル: LTile.cpp プロジェクト: NASD-Bulgaria/egt-training
LTile::~LTile()
{
    freeTile();
}