From 70f8dc7a4f4be217fea5439e474fc75e567c23c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lars=20N=C3=A6sbye=20Christensen?= Date: Sat, 10 Feb 2024 22:37:52 +0100 Subject: miscellaneous: BOOL (int) to real bool --- indra/llappearance/lllocaltextureobject.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'indra/llappearance/lllocaltextureobject.cpp') diff --git a/indra/llappearance/lllocaltextureobject.cpp b/indra/llappearance/lllocaltextureobject.cpp index ab50db3a5a..7c17942c56 100644 --- a/indra/llappearance/lllocaltextureobject.cpp +++ b/indra/llappearance/lllocaltextureobject.cpp @@ -136,7 +136,7 @@ BOOL LLLocalTextureObject::setTexLayer(LLTexLayer *new_tex_layer, U32 index) { if (index >= getNumTexLayers() ) { - return FALSE; + return false; } if (new_tex_layer == NULL) @@ -153,47 +153,47 @@ BOOL LLLocalTextureObject::setTexLayer(LLTexLayer *new_tex_layer, U32 index) } mTexLayers[index] = layer; - return TRUE; + return true; } BOOL LLLocalTextureObject::addTexLayer(LLTexLayer *new_tex_layer, LLWearable *wearable) { if (new_tex_layer == NULL) { - return FALSE; + return false; } LLTexLayer *layer = new LLTexLayer(*new_tex_layer, wearable); layer->setLTO(this); mTexLayers.push_back(layer); - return TRUE; + return true; } BOOL LLLocalTextureObject::addTexLayer(LLTexLayerTemplate *new_tex_layer, LLWearable *wearable) { if (new_tex_layer == NULL) { - return FALSE; + return false; } LLTexLayer *layer = new LLTexLayer(*new_tex_layer, this, wearable); layer->setLTO(this); mTexLayers.push_back(layer); - return TRUE; + return true; } BOOL LLLocalTextureObject::removeTexLayer(U32 index) { if (index >= getNumTexLayers()) { - return FALSE; + return false; } tex_layer_vec_t::iterator iter = mTexLayers.begin(); iter += index; delete *iter; mTexLayers.erase(iter); - return TRUE; + return true; } void LLLocalTextureObject::setID(LLUUID new_id) -- cgit v1.2.3 From 1839def9dc6064a865f6cd05d1509358a53ac9f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lars=20N=C3=A6sbye=20Christensen?= Date: Sun, 11 Feb 2024 16:50:22 +0100 Subject: even more misc: BOOL (int) to real bool --- indra/llappearance/lllocaltextureobject.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'indra/llappearance/lllocaltextureobject.cpp') diff --git a/indra/llappearance/lllocaltextureobject.cpp b/indra/llappearance/lllocaltextureobject.cpp index 7c17942c56..ff82e4e8e3 100644 --- a/indra/llappearance/lllocaltextureobject.cpp +++ b/indra/llappearance/lllocaltextureobject.cpp @@ -122,7 +122,7 @@ S32 LLLocalTextureObject::getDiscard() const return mDiscard; } -BOOL LLLocalTextureObject::getBakedReady() const +bool LLLocalTextureObject::getBakedReady() const { return mIsBakedReady; } @@ -132,7 +132,7 @@ void LLLocalTextureObject::setImage(LLGLTexture* new_image) mImage = new_image; } -BOOL LLLocalTextureObject::setTexLayer(LLTexLayer *new_tex_layer, U32 index) +bool LLLocalTextureObject::setTexLayer(LLTexLayer *new_tex_layer, U32 index) { if (index >= getNumTexLayers() ) { @@ -156,7 +156,7 @@ BOOL LLLocalTextureObject::setTexLayer(LLTexLayer *new_tex_layer, U32 index) return true; } -BOOL LLLocalTextureObject::addTexLayer(LLTexLayer *new_tex_layer, LLWearable *wearable) +bool LLLocalTextureObject::addTexLayer(LLTexLayer *new_tex_layer, LLWearable *wearable) { if (new_tex_layer == NULL) { @@ -169,7 +169,7 @@ BOOL LLLocalTextureObject::addTexLayer(LLTexLayer *new_tex_layer, LLWearable *we return true; } -BOOL LLLocalTextureObject::addTexLayer(LLTexLayerTemplate *new_tex_layer, LLWearable *wearable) +bool LLLocalTextureObject::addTexLayer(LLTexLayerTemplate *new_tex_layer, LLWearable *wearable) { if (new_tex_layer == NULL) { @@ -182,7 +182,7 @@ BOOL LLLocalTextureObject::addTexLayer(LLTexLayerTemplate *new_tex_layer, LLWear return true; } -BOOL LLLocalTextureObject::removeTexLayer(U32 index) +bool LLLocalTextureObject::removeTexLayer(U32 index) { if (index >= getNumTexLayers()) { -- cgit v1.2.3 From 9e854b697a06abed2a0917fb6120445f176764f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lars=20N=C3=A6sbye=20Christensen?= Date: Fri, 16 Feb 2024 19:29:51 +0100 Subject: misc: BOOL to bool --- indra/llappearance/lllocaltextureobject.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'indra/llappearance/lllocaltextureobject.cpp') diff --git a/indra/llappearance/lllocaltextureobject.cpp b/indra/llappearance/lllocaltextureobject.cpp index ff82e4e8e3..84c0fd8380 100644 --- a/indra/llappearance/lllocaltextureobject.cpp +++ b/indra/llappearance/lllocaltextureobject.cpp @@ -36,14 +36,14 @@ LLLocalTextureObject::LLLocalTextureObject() : - mIsBakedReady(FALSE), + mIsBakedReady(false), mDiscard(MAX_DISCARD_LEVEL+1) { mImage = NULL; } LLLocalTextureObject::LLLocalTextureObject(LLGLTexture* image, const LLUUID& id) : - mIsBakedReady(FALSE), + mIsBakedReady(false), mDiscard(MAX_DISCARD_LEVEL+1) { mImage = image; @@ -206,7 +206,7 @@ void LLLocalTextureObject::setDiscard(S32 new_discard) mDiscard = new_discard; } -void LLLocalTextureObject::setBakedReady(BOOL ready) +void LLLocalTextureObject::setBakedReady(bool ready) { mIsBakedReady = ready; } -- cgit v1.2.3 From e2e37cced861b98de8c1a7c9c0d3a50d2d90e433 Mon Sep 17 00:00:00 2001 From: Ansariel Date: Wed, 22 May 2024 21:25:21 +0200 Subject: Fix line endlings --- indra/llappearance/lllocaltextureobject.cpp | 424 ++++++++++++++-------------- 1 file changed, 212 insertions(+), 212 deletions(-) (limited to 'indra/llappearance/lllocaltextureobject.cpp') diff --git a/indra/llappearance/lllocaltextureobject.cpp b/indra/llappearance/lllocaltextureobject.cpp index 65464e7f65..9707f002ee 100644 --- a/indra/llappearance/lllocaltextureobject.cpp +++ b/indra/llappearance/lllocaltextureobject.cpp @@ -1,212 +1,212 @@ -/** - * @file lllocaltextureobject.cpp - * - * $LicenseInfo:firstyear=2009&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#include "linden_common.h" - -#include "lllocaltextureobject.h" - -#include "llimage.h" -#include "llrender.h" -#include "lltexlayer.h" -#include "llgltexture.h" -#include "lluuid.h" -#include "llwearable.h" - - -LLLocalTextureObject::LLLocalTextureObject() : - mIsBakedReady(false), - mDiscard(MAX_DISCARD_LEVEL+1) -{ - mImage = NULL; -} - -LLLocalTextureObject::LLLocalTextureObject(LLGLTexture* image, const LLUUID& id) : - mIsBakedReady(false), - mDiscard(MAX_DISCARD_LEVEL+1) -{ - mImage = image; - gGL.getTexUnit(0)->bind(mImage); - mID = id; -} - -LLLocalTextureObject::LLLocalTextureObject(const LLLocalTextureObject& lto) : - mImage(lto.mImage), - mID(lto.mID), - mIsBakedReady(lto.mIsBakedReady), - mDiscard(lto.mDiscard) -{ - U32 num_layers = lto.getNumTexLayers(); - mTexLayers.reserve(num_layers); - for (U32 index = 0; index < num_layers; index++) - { - LLTexLayer* original_layer = lto.getTexLayer(index); - if (!original_layer) - { - LL_ERRS() << "could not clone Local Texture Object: unable to extract texlayer!" << LL_ENDL; - continue; - } - - LLTexLayer* new_layer = new LLTexLayer(*original_layer); - new_layer->setLTO(this); - mTexLayers.push_back(new_layer); - } -} - -LLLocalTextureObject::~LLLocalTextureObject() -{ - delete_and_clear(mTexLayers); -} - -LLGLTexture* LLLocalTextureObject::getImage() const -{ - return mImage; -} - -LLTexLayer* LLLocalTextureObject::getTexLayer(U32 index) const -{ - if (index >= getNumTexLayers()) - { - return NULL; - } - - return mTexLayers[index]; -} - -LLTexLayer* LLLocalTextureObject::getTexLayer(const std::string &name) -{ - for(LLTexLayer* layer : mTexLayers) - { - if (layer->getName().compare(name) == 0) - { - return layer; - } - } - - return NULL; -} - -U32 LLLocalTextureObject::getNumTexLayers() const -{ - return mTexLayers.size(); -} - -LLUUID LLLocalTextureObject::getID() const -{ - return mID; -} - -S32 LLLocalTextureObject::getDiscard() const -{ - return mDiscard; -} - -bool LLLocalTextureObject::getBakedReady() const -{ - return mIsBakedReady; -} - -void LLLocalTextureObject::setImage(LLGLTexture* new_image) -{ - mImage = new_image; -} - -bool LLLocalTextureObject::setTexLayer(LLTexLayer *new_tex_layer, U32 index) -{ - if (index >= getNumTexLayers() ) - { - return false; - } - - if (new_tex_layer == NULL) - { - return removeTexLayer(index); - } - - LLTexLayer *layer = new LLTexLayer(*new_tex_layer); - layer->setLTO(this); - - if (mTexLayers[index]) - { - delete mTexLayers[index]; - } - mTexLayers[index] = layer; - - return true; -} - -bool LLLocalTextureObject::addTexLayer(LLTexLayer *new_tex_layer, LLWearable *wearable) -{ - if (new_tex_layer == NULL) - { - return false; - } - - LLTexLayer *layer = new LLTexLayer(*new_tex_layer, wearable); - layer->setLTO(this); - mTexLayers.push_back(layer); - return true; -} - -bool LLLocalTextureObject::addTexLayer(LLTexLayerTemplate *new_tex_layer, LLWearable *wearable) -{ - if (new_tex_layer == NULL) - { - return false; - } - - LLTexLayer *layer = new LLTexLayer(*new_tex_layer, this, wearable); - layer->setLTO(this); - mTexLayers.push_back(layer); - return true; -} - -bool LLLocalTextureObject::removeTexLayer(U32 index) -{ - if (index >= getNumTexLayers()) - { - return false; - } - tex_layer_vec_t::iterator iter = mTexLayers.begin(); - iter += index; - - delete *iter; - mTexLayers.erase(iter); - return true; -} - -void LLLocalTextureObject::setID(LLUUID new_id) -{ - mID = new_id; -} - -void LLLocalTextureObject::setDiscard(S32 new_discard) -{ - mDiscard = new_discard; -} - -void LLLocalTextureObject::setBakedReady(bool ready) -{ - mIsBakedReady = ready; -} +/** + * @file lllocaltextureobject.cpp + * + * $LicenseInfo:firstyear=2009&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#include "linden_common.h" + +#include "lllocaltextureobject.h" + +#include "llimage.h" +#include "llrender.h" +#include "lltexlayer.h" +#include "llgltexture.h" +#include "lluuid.h" +#include "llwearable.h" + + +LLLocalTextureObject::LLLocalTextureObject() : + mIsBakedReady(false), + mDiscard(MAX_DISCARD_LEVEL+1) +{ + mImage = NULL; +} + +LLLocalTextureObject::LLLocalTextureObject(LLGLTexture* image, const LLUUID& id) : + mIsBakedReady(false), + mDiscard(MAX_DISCARD_LEVEL+1) +{ + mImage = image; + gGL.getTexUnit(0)->bind(mImage); + mID = id; +} + +LLLocalTextureObject::LLLocalTextureObject(const LLLocalTextureObject& lto) : + mImage(lto.mImage), + mID(lto.mID), + mIsBakedReady(lto.mIsBakedReady), + mDiscard(lto.mDiscard) +{ + U32 num_layers = lto.getNumTexLayers(); + mTexLayers.reserve(num_layers); + for (U32 index = 0; index < num_layers; index++) + { + LLTexLayer* original_layer = lto.getTexLayer(index); + if (!original_layer) + { + LL_ERRS() << "could not clone Local Texture Object: unable to extract texlayer!" << LL_ENDL; + continue; + } + + LLTexLayer* new_layer = new LLTexLayer(*original_layer); + new_layer->setLTO(this); + mTexLayers.push_back(new_layer); + } +} + +LLLocalTextureObject::~LLLocalTextureObject() +{ + delete_and_clear(mTexLayers); +} + +LLGLTexture* LLLocalTextureObject::getImage() const +{ + return mImage; +} + +LLTexLayer* LLLocalTextureObject::getTexLayer(U32 index) const +{ + if (index >= getNumTexLayers()) + { + return NULL; + } + + return mTexLayers[index]; +} + +LLTexLayer* LLLocalTextureObject::getTexLayer(const std::string &name) +{ + for(LLTexLayer* layer : mTexLayers) + { + if (layer->getName().compare(name) == 0) + { + return layer; + } + } + + return NULL; +} + +U32 LLLocalTextureObject::getNumTexLayers() const +{ + return mTexLayers.size(); +} + +LLUUID LLLocalTextureObject::getID() const +{ + return mID; +} + +S32 LLLocalTextureObject::getDiscard() const +{ + return mDiscard; +} + +bool LLLocalTextureObject::getBakedReady() const +{ + return mIsBakedReady; +} + +void LLLocalTextureObject::setImage(LLGLTexture* new_image) +{ + mImage = new_image; +} + +bool LLLocalTextureObject::setTexLayer(LLTexLayer *new_tex_layer, U32 index) +{ + if (index >= getNumTexLayers() ) + { + return false; + } + + if (new_tex_layer == NULL) + { + return removeTexLayer(index); + } + + LLTexLayer *layer = new LLTexLayer(*new_tex_layer); + layer->setLTO(this); + + if (mTexLayers[index]) + { + delete mTexLayers[index]; + } + mTexLayers[index] = layer; + + return true; +} + +bool LLLocalTextureObject::addTexLayer(LLTexLayer *new_tex_layer, LLWearable *wearable) +{ + if (new_tex_layer == NULL) + { + return false; + } + + LLTexLayer *layer = new LLTexLayer(*new_tex_layer, wearable); + layer->setLTO(this); + mTexLayers.push_back(layer); + return true; +} + +bool LLLocalTextureObject::addTexLayer(LLTexLayerTemplate *new_tex_layer, LLWearable *wearable) +{ + if (new_tex_layer == NULL) + { + return false; + } + + LLTexLayer *layer = new LLTexLayer(*new_tex_layer, this, wearable); + layer->setLTO(this); + mTexLayers.push_back(layer); + return true; +} + +bool LLLocalTextureObject::removeTexLayer(U32 index) +{ + if (index >= getNumTexLayers()) + { + return false; + } + tex_layer_vec_t::iterator iter = mTexLayers.begin(); + iter += index; + + delete *iter; + mTexLayers.erase(iter); + return true; +} + +void LLLocalTextureObject::setID(LLUUID new_id) +{ + mID = new_id; +} + +void LLLocalTextureObject::setDiscard(S32 new_discard) +{ + mDiscard = new_discard; +} + +void LLLocalTextureObject::setBakedReady(bool ready) +{ + mIsBakedReady = ready; +} -- cgit v1.2.3 From b42f9d836b4c0f7fbd4bdae1734021e2a09fdbe8 Mon Sep 17 00:00:00 2001 From: Ansariel Date: Sat, 1 Jun 2024 15:49:26 +0200 Subject: Re-enable a lot of compiler warnings for MSVC and address the C4267 "possible loss of precision" warnings --- indra/llappearance/lllocaltextureobject.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llappearance/lllocaltextureobject.cpp') diff --git a/indra/llappearance/lllocaltextureobject.cpp b/indra/llappearance/lllocaltextureobject.cpp index 9707f002ee..f743f7b517 100644 --- a/indra/llappearance/lllocaltextureobject.cpp +++ b/indra/llappearance/lllocaltextureobject.cpp @@ -109,7 +109,7 @@ LLTexLayer* LLLocalTextureObject::getTexLayer(const std::string &name) U32 LLLocalTextureObject::getNumTexLayers() const { - return mTexLayers.size(); + return static_cast(mTexLayers.size()); } LLUUID LLLocalTextureObject::getID() const -- cgit v1.2.3