fixed pretty major bugs regarding frame dirty list

This commit is contained in:
aap 2016-08-03 20:32:43 +02:00
parent a391f263cb
commit 46542cccb0
3 changed files with 21 additions and 20 deletions

View File

@ -44,22 +44,10 @@ void
Frame::destroy(void)
{
s_plglist.destruct(this);
Frame *parent = this->getParent();
Frame *child;
if(parent){
// remove from child list
child = parent->child;
if(child == this)
parent->child = this->next;
else{
for(child = child->next; child != this; child = child->next)
;
child->next = this->next;
}
this->object.parent = nil;
// Doesn't seem to make much sense, blame criterion.
this->setHierarchyRoot(this);
}
if(this->getParent())
this->removeChild();
if(this->object.privateFlags & Frame::HIERARCHYSYNC)
this->inDirtyList.remove();
for(Frame *f = this->child; f; f = f->next)
f->object.parent = nil;
free(this);
@ -74,6 +62,8 @@ Frame::destroyHierarchy(void)
child->destroyHierarchy();
}
s_plglist.destruct(this);
if(this->object.privateFlags & Frame::HIERARCHYSYNC)
this->inDirtyList.remove();
free(this);
}
@ -121,9 +111,8 @@ Frame::removeChild(void)
child->next = this->next;
}
this->object.parent = this->next = nil;
this->root = this;
for(child = this->child; child; child = child->next)
child->setHierarchyRoot(this);
// give the hierarchy a new root
this->setHierarchyRoot(this);
this->updateObjects();
return this;
}

View File

@ -32,17 +32,25 @@ rasterCreate(Raster *raster)
case Raster::C8888:
natras->internalFormat = GL_RGBA;
natras->format = GL_RGBA;
natras->type = GL_UNSIGNED_BYTE;
natras->hasAlpha = 1;
break;
case Raster::C888:
natras->internalFormat = GL_RGB;
natras->format = GL_RGB;
natras->type = GL_UNSIGNED_BYTE;
natras->hasAlpha = 0;
break;
case Raster::C1555:
// TODO: check if this is correct
natras->internalFormat = GL_RGBA;
natras->format = GL_RGBA;
natras->type = GL_UNSIGNED_SHORT_5_5_5_1;
natras->hasAlpha = 1;
break;
default:
assert(0 && "unsupported raster format");
}
natras->type = GL_UNSIGNED_BYTE;
glGenTextures(1, &natras->texid);
glBindTexture(GL_TEXTURE_2D, natras->texid);
@ -89,6 +97,9 @@ rasterFromImage(Raster *raster, Image *image)
case 24:
format = Raster::C888;
break;
case 16:
format = Raster::C1555;
break;
default:
assert(0 && "image depth\n");
}

View File

@ -97,6 +97,7 @@ struct Frame : PluginBase<Frame>
SUBTREESYNC = SUBTREESYNCLTM | SUBTREESYNCOBJ,
SYNCLTM = HIERARCHYSYNCLTM | SUBTREESYNCLTM,
SYNCOBJ = HIERARCHYSYNCOBJ | SUBTREESYNCOBJ,
// STATIC = 0x10
};
Object object;