Exemple #1
0
Scale9Sprite* Scale9Sprite::create()
{ 
    Scale9Sprite *pReturn = new Scale9Sprite();
    if (pReturn && pReturn->init())
    { 
        pReturn->autorelease();   
        return pReturn;
    } 
    CC_SAFE_DELETE(pReturn);
    return NULL;
}
Scale9Sprite* Scale9Sprite::create()
{
    Scale9Sprite *ret = new (std::nothrow) Scale9Sprite();
    if (ret && ret->init())
    {
        ret->autorelease();
        return ret;
    }
    CC_SAFE_DELETE(ret);
    return nullptr;
}
Exemple #3
0
 Scale9Sprite* Scale9Sprite::resizableSpriteWithCapInsets(const Rect& capInsets) const
 {
     Scale9Sprite* pReturn = new (std::nothrow) Scale9Sprite();
     if ( pReturn && pReturn->init(_scale9Image, _spriteRect, _spriteFrameRotated, _offset, _originalSize, _capInsets) )
     {
         pReturn->autorelease();
         return pReturn;
     }
     CC_SAFE_DELETE(pReturn);
     return NULL;
 }
Scale9Sprite* Scale9Sprite::resizableSpriteWithCapInsets(const Rect& capInsets) const
{
    // FIXME: there are no test cases for this method
    Scale9Sprite* ret = new (std::nothrow) Scale9Sprite();
    if (ret && ret->init(const_cast<Scale9Sprite*>(this),
                         _rect,
                         _rectRotated,
                         Vec2::ZERO,
                         _originalContentSize,
                         capInsets) )
    {
        ret->autorelease();
        return ret;
    }
    CC_SAFE_DELETE(ret);
    return nullptr;
}