コード例 #1
0
ファイル: sprite.cpp プロジェクト: airways/aseprite
Layer* Sprite::indexToLayer(LayerIndex index) const
{
  if (index < LayerIndex(0))
    return NULL;

  int index_count = -1;
  return index2layer(folder(), index, &index_count);
}
コード例 #2
0
ファイル: sprite.cpp プロジェクト: felipeita/aseprite
static Layer* index2layer(const Layer* layer, const LayerIndex& index, int* index_count)
{
  if (index == *index_count)
    return (Layer*)layer;
  else {
    (*index_count)++;

    if (layer->isFolder()) {
      Layer *found;

      LayerConstIterator it = static_cast<const LayerFolder*>(layer)->getLayerBegin();
      LayerConstIterator end = static_cast<const LayerFolder*>(layer)->getLayerEnd();

      for (; it != end; ++it) {
        if ((found = index2layer(*it, index, index_count)))
          return found;
      }
    }

    return NULL;
  }
}
コード例 #3
0
ファイル: sprite.cpp プロジェクト: felipeita/aseprite
Layer* Sprite::indexToLayer(LayerIndex index) const
{
  int index_count = -1;
  return index2layer(getFolder(), index, &index_count);
}