Little fixes for setNormalized

This commit is contained in:
Ricardo Quesada 2014-05-30 21:50:39 -07:00
parent 1b8d0d88df
commit b24c674d25
6 changed files with 12 additions and 12 deletions

View File

@ -880,7 +880,7 @@ void Label::drawShadowWithoutBlur()
void Label::draw(Renderer *renderer, const Mat4 &transform, uint32_t flags)
{
// Don't do calculate the culling if the transform was not updated
_insideBounds = (flags & PARENT_DIRTY_MASK) ? renderer->checkVisibility(transform, _contentSize) : _insideBounds;
_insideBounds = (flags & FLAGS_TRANSFORM_DIRTY) ? renderer->checkVisibility(transform, _contentSize) : _insideBounds;
if(_insideBounds) {
_customCommand.init(_globalZOrder);
@ -1066,7 +1066,7 @@ void Label::visit(Renderer *renderer, const Mat4 &parentTransform, uint32_t pare
uint32_t flags = processParentFlags(parentTransform, parentFlags);
if (_shadowEnabled && _shadowBlurRadius <= 0 && (_shadowDirty || (flags & PARENT_DIRTY_MASK)))
if (_shadowEnabled && _shadowBlurRadius <= 0 && (_shadowDirty || (flags & FLAGS_DIRTY_MASK)))
{
_position.x += _shadowOffset.width;
_position.y += _shadowOffset.height;

View File

@ -976,10 +976,10 @@ void Node::visit()
uint32_t Node::processParentFlags(const Mat4& parentTransform, uint32_t parentFlags)
{
uint32_t flags = parentFlags;
flags |= (_transformUpdated ? PARENT_TRANSFORM_DIRTY : 0);
flags |= (_contentSizeDirty ? PARENT_CONTENT_SIZE_DIRTY : 0);
flags |= (_transformUpdated ? FLAGS_TRANSFORM_DIRTY : 0);
flags |= (_contentSizeDirty ? FLAGS_CONTENT_SIZE_DIRTY : 0);
if(_usingNormalizedPosition && (flags & PARENT_CONTENT_SIZE_DIRTY)) {
if(_usingNormalizedPosition && (flags & FLAGS_CONTENT_SIZE_DIRTY)) {
CCASSERT(_parent, "setNormalizedPosition() doesn't work with orphan nodes");
auto s = _parent->getContentSize();
_position.x = _normalizedPosition.x * s.width;
@ -987,7 +987,7 @@ uint32_t Node::processParentFlags(const Mat4& parentTransform, uint32_t parentFl
_transformUpdated = _transformDirty = _inverseDirty = true;
}
if(flags & PARENT_DIRTY_MASK)
if(flags & FLAGS_DIRTY_MASK)
_modelViewTransform = this->transform(parentTransform);
_transformUpdated = false;

View File

@ -108,10 +108,10 @@ public:
static const int INVALID_TAG = -1;
enum {
PARENT_TRANSFORM_DIRTY = (1 << 0),
PARENT_CONTENT_SIZE_DIRTY = (1 << 1),
FLAGS_TRANSFORM_DIRTY = (1 << 0),
FLAGS_CONTENT_SIZE_DIRTY = (1 << 1),
PARENT_DIRTY_MASK = (PARENT_TRANSFORM_DIRTY | PARENT_CONTENT_SIZE_DIRTY),
FLAGS_DIRTY_MASK = (FLAGS_TRANSFORM_DIRTY | FLAGS_CONTENT_SIZE_DIRTY),
};
/// @{
/// @name Constructor, Destructor and Initializers

View File

@ -94,7 +94,7 @@ void NodeGrid::visit(Renderer *renderer, const Mat4 &parentTransform, uint32_t p
renderer->addCommand(&_groupCommand);
renderer->pushGroup(_groupCommand.getRenderQueueID());
bool dirty = (parentFlags & PARENT_TRANSFORM_DIRTY) || _transformUpdated;
bool dirty = (parentFlags & FLAGS_TRANSFORM_DIRTY) || _transformUpdated;
if(dirty)
_modelViewTransform = this->transform(parentTransform);
_transformUpdated = false;

View File

@ -588,7 +588,7 @@ void Sprite::updateTransform(void)
void Sprite::draw(Renderer *renderer, const Mat4 &transform, uint32_t flags)
{
// Don't do calculate the culling if the transform was not updated
_insideBounds = (flags & PARENT_DIRTY_MASK) ? renderer->checkVisibility(transform, _contentSize) : _insideBounds;
_insideBounds = (flags & FLAGS_TRANSFORM_DIRTY) ? renderer->checkVisibility(transform, _contentSize) : _insideBounds;
if(_insideBounds)
{

View File

@ -151,7 +151,7 @@ public:
void draw(Renderer *renderer, const Mat4 &transform, uint32_t flags) override
{
// Don't do calculate the culling if the transform was not updated
_insideBounds = (flags & PARENT_DIRTY_MASK) ? renderer->checkVisibility(transform, _contentSize) : _insideBounds;
_insideBounds = (flags & FLAGS_TRANSFORM_DIRTY) ? renderer->checkVisibility(transform, _contentSize) : _insideBounds;
if(_insideBounds)
{