closed #3991, Remove the method CCTextureCache::updateTexture().

This commit is contained in:
zhangbin 2014-03-06 17:38:18 +08:00
parent ed97658549
commit 56a46892fe
2 changed files with 0 additions and 34 deletions

View File

@ -34,7 +34,6 @@ THE SOFTWARE.
#include "CCTexture2D.h" #include "CCTexture2D.h"
#include "ccMacros.h" #include "ccMacros.h"
#include "CCDirector.h" #include "CCDirector.h"
#include "CCSprite.h"
#include "platform/CCFileUtils.h" #include "platform/CCFileUtils.h"
#include "ccUtils.h" #include "ccUtils.h"
#include "CCScheduler.h" #include "CCScheduler.h"
@ -409,33 +408,6 @@ bool TextureCache::reloadTexture(const std::string& fileName)
return ret; return ret;
} }
void TextureCache::updateTexture(Node* node, Texture2D* texture)
{
if (nullptr == node || nullptr == texture) {
return;
}
// update self
auto sprite = dynamic_cast<Sprite*>(node);
if (nullptr != sprite && sprite->getTexture() == texture) {
auto size = texture->getContentSize();
sprite->setTextureRect(Rect(0, 0, size.width, size.height));
}
// update children
auto children = node->getChildren();
if (children.size() > 0)
{
for (auto obj : children)
{
auto childNode = dynamic_cast<Node*>(obj);
if (nullptr != childNode) {
updateTexture(childNode, texture);
}
}
}
}
// TextureCache - Remove // TextureCache - Remove
void TextureCache::removeAllTextures() void TextureCache::removeAllTextures()

View File

@ -142,12 +142,6 @@ public:
*/ */
bool reloadTexture(const std::string& fileName); bool reloadTexture(const std::string& fileName);
/** Update the nodes & it's children which used texture
* The "node" parameter is the root node will be updated
* The "texture" parameter is the texture which was updated
*/
void updateTexture(Node* node, Texture2D* texture);
/** Purges the dictionary of loaded textures. /** Purges the dictionary of loaded textures.
* Call this method if you receive the "Memory Warning" * Call this method if you receive the "Memory Warning"
* In the short term: it will free some resources preventing your app from being killed * In the short term: it will free some resources preventing your app from being killed