From 46542cccb017fa92b1c09948103e207a5c361e0d Mon Sep 17 00:00:00 2001 From: aap Date: Wed, 3 Aug 2016 20:32:43 +0200 Subject: [PATCH] fixed pretty major bugs regarding frame dirty list --- src/frame.cpp | 27 ++++++++------------------- src/gl/gl3raster.cpp | 13 ++++++++++++- src/rwobjects.h | 1 + 3 files changed, 21 insertions(+), 20 deletions(-) diff --git a/src/frame.cpp b/src/frame.cpp index 761c366..262d8af 100644 --- a/src/frame.cpp +++ b/src/frame.cpp @@ -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; } diff --git a/src/gl/gl3raster.cpp b/src/gl/gl3raster.cpp index 5dc19b7..b8f14e9 100644 --- a/src/gl/gl3raster.cpp +++ b/src/gl/gl3raster.cpp @@ -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"); } diff --git a/src/rwobjects.h b/src/rwobjects.h index 02b1d5e..20a4fcb 100644 --- a/src/rwobjects.h +++ b/src/rwobjects.h @@ -97,6 +97,7 @@ struct Frame : PluginBase SUBTREESYNC = SUBTREESYNCLTM | SUBTREESYNCOBJ, SYNCLTM = HIERARCHYSYNCLTM | SUBTREESYNCLTM, SYNCOBJ = HIERARCHYSYNCOBJ | SUBTREESYNCOBJ, + // STATIC = 0x10 }; Object object;