diff options
author | Merov Linden <merov@lindenlab.com> | 2010-11-11 09:33:29 -0800 |
---|---|---|
committer | Merov Linden <merov@lindenlab.com> | 2010-11-11 09:33:29 -0800 |
commit | 94f44437d7e7ccb54f227e35523fa8a4e027d7d2 (patch) | |
tree | dd899aa6e98b2c10b22fa0db58cfca866a0322de /indra/llkdu/llblockdata.h | |
parent | ee8df375449e97476408417ec6dea0d6a8853d73 (diff) | |
parent | 0e07758b540374aa421d2938ce5ed13e2b9eefe4 (diff) |
STORM-151 : merge kdu static linking, add indra/llkdu implementation. Doesn't build yet.
Diffstat (limited to 'indra/llkdu/llblockdata.h')
-rw-r--r-- | indra/llkdu/llblockdata.h | 107 |
1 files changed, 107 insertions, 0 deletions
diff --git a/indra/llkdu/llblockdata.h b/indra/llkdu/llblockdata.h new file mode 100644 index 0000000000..dcc847e7e2 --- /dev/null +++ b/indra/llkdu/llblockdata.h @@ -0,0 +1,107 @@ +/** + * @file llblockdata.h + * @brief Image block structure + * + * $LicenseInfo:firstyear=2010&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$ + */ + +#ifndef LL_LLBLOCKDATA_H +#define LL_LLBLOCKDATA_H + +#include "stdtypes.h" + +////////////////////////////////////////////////// +// +// This class stores all of the information about +// a single channel of raw data, either integer +// or floating point. +// +class LLBlockData +{ +protected: + U32 mType; + U32 mWidth; + U32 mHeight; + U32 mRowStride; + U8 *mData; +public: + enum + { + BLOCK_TYPE_U32 = 1, + BLOCK_TYPE_F32 = 2 + }; + + LLBlockData(const U32 type); + virtual ~LLBlockData() {} + + void setData(U8 *data, const U32 width, const U32 height, const U32 row_stride = 0); + + U32 getType() const; + U8 *getData() const; + virtual U32 getSize() const; + U32 getWidth() const; + U32 getHeight() const; + U32 getRowStride() const; +}; + +class LLBlockDataU32 : public LLBlockData +{ +protected: + U32 mPrecision; +public: + LLBlockDataU32(); + + void setData(U32 *data, const U32 width, const U32 height, const U32 row_stride = 0); + void setPrecision(const U32 bits); + + /*virtual*/ U32 getSize() const; + U32 getPrecision() const; +}; + +class LLBlockDataF32 : public LLBlockData +{ +protected: + U32 mPrecision; + F32 mMin; + F32 mMax; +public: + LLBlockDataF32() + : LLBlockData(LLBlockData::BLOCK_TYPE_F32), + mPrecision(0), + mMin(0.f), + mMax(0.f) + {}; + + void setData(F32 *data, const U32 width, const U32 height, const U32 row_stride = 0); + + void setPrecision(const U32 bits); + void setMin(const F32 min); + void setMax(const F32 max); + + void calcMinMax(); + + U32 getPrecision() const; + F32 getMin() const; + F32 getMax() const; +}; + +#endif // LL_LLBLOCKDATA_H |