mirror of https://github.com/aap/librw.git
fixed pretty major bugs regarding frame dirty list
This commit is contained in:
parent
a391f263cb
commit
46542cccb0
|
@ -44,22 +44,10 @@ void
|
||||||
Frame::destroy(void)
|
Frame::destroy(void)
|
||||||
{
|
{
|
||||||
s_plglist.destruct(this);
|
s_plglist.destruct(this);
|
||||||
Frame *parent = this->getParent();
|
if(this->getParent())
|
||||||
Frame *child;
|
this->removeChild();
|
||||||
if(parent){
|
if(this->object.privateFlags & Frame::HIERARCHYSYNC)
|
||||||
// remove from child list
|
this->inDirtyList.remove();
|
||||||
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);
|
|
||||||
}
|
|
||||||
for(Frame *f = this->child; f; f = f->next)
|
for(Frame *f = this->child; f; f = f->next)
|
||||||
f->object.parent = nil;
|
f->object.parent = nil;
|
||||||
free(this);
|
free(this);
|
||||||
|
@ -74,6 +62,8 @@ Frame::destroyHierarchy(void)
|
||||||
child->destroyHierarchy();
|
child->destroyHierarchy();
|
||||||
}
|
}
|
||||||
s_plglist.destruct(this);
|
s_plglist.destruct(this);
|
||||||
|
if(this->object.privateFlags & Frame::HIERARCHYSYNC)
|
||||||
|
this->inDirtyList.remove();
|
||||||
free(this);
|
free(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -121,9 +111,8 @@ Frame::removeChild(void)
|
||||||
child->next = this->next;
|
child->next = this->next;
|
||||||
}
|
}
|
||||||
this->object.parent = this->next = nil;
|
this->object.parent = this->next = nil;
|
||||||
this->root = this;
|
// give the hierarchy a new root
|
||||||
for(child = this->child; child; child = child->next)
|
this->setHierarchyRoot(this);
|
||||||
child->setHierarchyRoot(this);
|
|
||||||
this->updateObjects();
|
this->updateObjects();
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,17 +32,25 @@ rasterCreate(Raster *raster)
|
||||||
case Raster::C8888:
|
case Raster::C8888:
|
||||||
natras->internalFormat = GL_RGBA;
|
natras->internalFormat = GL_RGBA;
|
||||||
natras->format = GL_RGBA;
|
natras->format = GL_RGBA;
|
||||||
|
natras->type = GL_UNSIGNED_BYTE;
|
||||||
natras->hasAlpha = 1;
|
natras->hasAlpha = 1;
|
||||||
break;
|
break;
|
||||||
case Raster::C888:
|
case Raster::C888:
|
||||||
natras->internalFormat = GL_RGB;
|
natras->internalFormat = GL_RGB;
|
||||||
natras->format = GL_RGB;
|
natras->format = GL_RGB;
|
||||||
|
natras->type = GL_UNSIGNED_BYTE;
|
||||||
natras->hasAlpha = 0;
|
natras->hasAlpha = 0;
|
||||||
break;
|
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:
|
default:
|
||||||
assert(0 && "unsupported raster format");
|
assert(0 && "unsupported raster format");
|
||||||
}
|
}
|
||||||
natras->type = GL_UNSIGNED_BYTE;
|
|
||||||
|
|
||||||
glGenTextures(1, &natras->texid);
|
glGenTextures(1, &natras->texid);
|
||||||
glBindTexture(GL_TEXTURE_2D, natras->texid);
|
glBindTexture(GL_TEXTURE_2D, natras->texid);
|
||||||
|
@ -89,6 +97,9 @@ rasterFromImage(Raster *raster, Image *image)
|
||||||
case 24:
|
case 24:
|
||||||
format = Raster::C888;
|
format = Raster::C888;
|
||||||
break;
|
break;
|
||||||
|
case 16:
|
||||||
|
format = Raster::C1555;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
assert(0 && "image depth\n");
|
assert(0 && "image depth\n");
|
||||||
}
|
}
|
||||||
|
|
|
@ -97,6 +97,7 @@ struct Frame : PluginBase<Frame>
|
||||||
SUBTREESYNC = SUBTREESYNCLTM | SUBTREESYNCOBJ,
|
SUBTREESYNC = SUBTREESYNCLTM | SUBTREESYNCOBJ,
|
||||||
SYNCLTM = HIERARCHYSYNCLTM | SUBTREESYNCLTM,
|
SYNCLTM = HIERARCHYSYNCLTM | SUBTREESYNCLTM,
|
||||||
SYNCOBJ = HIERARCHYSYNCOBJ | SUBTREESYNCOBJ,
|
SYNCOBJ = HIERARCHYSYNCOBJ | SUBTREESYNCOBJ,
|
||||||
|
// STATIC = 0x10
|
||||||
};
|
};
|
||||||
|
|
||||||
Object object;
|
Object object;
|
||||||
|
|
Loading…
Reference in New Issue