       @_referenceCounts[url]--
       if @_referenceCounts[url] == 0
         delete @_cache[url]
+        delete @_loaded[url]
         true
       else
         false

FillableBase = require '../fillable_base'

{ceil, round} = Math
{inspect, min, max, bound, log, createWithPostCreate, isString, isNumber, BaseObject} = Foundation
{point, rect, Matrix, point0, point1} = Atomic

module.exports = createWithPostCreate class BitmapElement extends FillableBase

      else
        throw new Error "unknown mode: #{@_mode}"

  @getter
    currentBitmap: ->
      return @_bitmap if @_bitmap
      if @_altSources
        for url in @_altSources
          return loaded if loaded = sourceToBitmapCache.loaded url

  fillShape: (target, elementToTargetMatrix, options) ->
    if bitmap = @getCurrentBitmap()
      target.drawBitmap @_bitmapToElementMatrix.mul(elementToTargetMatrix), bitmap, options
