aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/llimage
diff options
context:
space:
mode:
Diffstat (limited to 'linden/indra/llimage')
-rw-r--r--linden/indra/llimage/llimage.cpp11
-rw-r--r--linden/indra/llimage/llimage.h6
-rw-r--r--linden/indra/llimage/llimagebmp.cpp3
-rw-r--r--linden/indra/llimage/llimagebmp.h3
-rw-r--r--linden/indra/llimage/llimagedxt.cpp3
-rw-r--r--linden/indra/llimage/llimagedxt.h3
-rw-r--r--linden/indra/llimage/llimagej2c.cpp44
-rw-r--r--linden/indra/llimage/llimagej2c.h4
-rw-r--r--linden/indra/llimage/llimagejpeg.cpp3
-rw-r--r--linden/indra/llimage/llimagejpeg.h3
-rw-r--r--linden/indra/llimage/llimagepng.cpp6
-rw-r--r--linden/indra/llimage/llimagepng.h6
-rw-r--r--linden/indra/llimage/llimagetga.cpp50
-rw-r--r--linden/indra/llimage/llimagetga.h3
-rw-r--r--linden/indra/llimage/llimageworker.cpp8
-rw-r--r--linden/indra/llimage/llimageworker.h3
-rw-r--r--linden/indra/llimage/llmapimagetype.h3
-rw-r--r--linden/indra/llimage/llpngwrapper.cpp6
-rw-r--r--linden/indra/llimage/llpngwrapper.h6
19 files changed, 143 insertions, 31 deletions
diff --git a/linden/indra/llimage/llimage.cpp b/linden/indra/llimage/llimage.cpp
index fccd7b3..db19bd6 100644
--- a/linden/indra/llimage/llimage.cpp
+++ b/linden/indra/llimage/llimage.cpp
@@ -2,6 +2,8 @@
2 * @file llimage.cpp 2 * @file llimage.cpp
3 * @brief Base class for images. 3 * @brief Base class for images.
4 * 4 *
5 * $LicenseInfo:firstyear=2001&license=viewergpl$
6 *
5 * Copyright (c) 2001-2007, Linden Research, Inc. 7 * Copyright (c) 2001-2007, Linden Research, Inc.
6 * 8 *
7 * Second Life Viewer Source Code 9 * Second Life Viewer Source Code
@@ -24,22 +26,17 @@
24 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO 26 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
25 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, 27 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
26 * COMPLETENESS OR PERFORMANCE. 28 * COMPLETENESS OR PERFORMANCE.
29 * $/LicenseInfo$
27 */ 30 */
28 31
29#include "linden_common.h" 32#include "linden_common.h"
30 33
31#include <stdlib.h> 34#include "llimage.h"
32#include <string.h>
33#include <stdio.h>
34#include <algorithm>
35#include <iostream>
36 35
37#include "llmath.h" 36#include "llmath.h"
38#include "stdtypes.h"
39#include "v4coloru.h" 37#include "v4coloru.h"
40#include "llmemtype.h" 38#include "llmemtype.h"
41 39
42#include "llimage.h"
43#include "llimagebmp.h" 40#include "llimagebmp.h"
44#include "llimagetga.h" 41#include "llimagetga.h"
45#include "llimagej2c.h" 42#include "llimagej2c.h"
diff --git a/linden/indra/llimage/llimage.h b/linden/indra/llimage/llimage.h
index e706c0a..65a7c54 100644
--- a/linden/indra/llimage/llimage.h
+++ b/linden/indra/llimage/llimage.h
@@ -2,6 +2,8 @@
2 * @file llimage.h 2 * @file llimage.h
3 * @brief Object for managing images and their textures. 3 * @brief Object for managing images and their textures.
4 * 4 *
5 * $LicenseInfo:firstyear=2000&license=viewergpl$
6 *
5 * Copyright (c) 2000-2007, Linden Research, Inc. 7 * Copyright (c) 2000-2007, Linden Research, Inc.
6 * 8 *
7 * Second Life Viewer Source Code 9 * Second Life Viewer Source Code
@@ -24,12 +26,12 @@
24 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO 26 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
25 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, 27 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
26 * COMPLETENESS OR PERFORMANCE. 28 * COMPLETENESS OR PERFORMANCE.
29 * $/LicenseInfo$
27 */ 30 */
28 31
29#ifndef LL_LLIMAGE_H 32#ifndef LL_LLIMAGE_H
30#define LL_LLIMAGE_H 33#define LL_LLIMAGE_H
31 34
32#include "stdtypes.h"
33#include "lluuid.h" 35#include "lluuid.h"
34#include "llstring.h" 36#include "llstring.h"
35#include "llmemory.h" 37#include "llmemory.h"
@@ -112,7 +114,7 @@ protected:
112public: 114public:
113 static const LLString& getLastError() {return sLastErrorMessage;}; 115 static const LLString& getLastError() {return sLastErrorMessage;};
114 static void resetLastError() {sLastErrorMessage = LLString("No Error"); }; 116 static void resetLastError() {sLastErrorMessage = LLString("No Error"); };
115 static BOOL setLastError(const LLString& message, const LLString& filename = ""); // returns FALSE 117 static BOOL setLastError(const LLString& message, const LLString& filename = LLString()); // returns FALSE
116 118
117 static void generateMip(const U8 *indata, U8* mipdata, int width, int height, S32 nchannels); 119 static void generateMip(const U8 *indata, U8* mipdata, int width, int height, S32 nchannels);
118 120
diff --git a/linden/indra/llimage/llimagebmp.cpp b/linden/indra/llimage/llimagebmp.cpp
index eaed63d..f842300 100644
--- a/linden/indra/llimage/llimagebmp.cpp
+++ b/linden/indra/llimage/llimagebmp.cpp
@@ -1,6 +1,8 @@
1/** 1/**
2 * @file llimagebmp.cpp 2 * @file llimagebmp.cpp
3 * 3 *
4 * $LicenseInfo:firstyear=2001&license=viewergpl$
5 *
4 * Copyright (c) 2001-2007, Linden Research, Inc. 6 * Copyright (c) 2001-2007, Linden Research, Inc.
5 * 7 *
6 * Second Life Viewer Source Code 8 * Second Life Viewer Source Code
@@ -23,6 +25,7 @@
23 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO 25 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
24 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, 26 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
25 * COMPLETENESS OR PERFORMANCE. 27 * COMPLETENESS OR PERFORMANCE.
28 * $/LicenseInfo$
26 */ 29 */
27 30
28#include "linden_common.h" 31#include "linden_common.h"
diff --git a/linden/indra/llimage/llimagebmp.h b/linden/indra/llimage/llimagebmp.h
index 556b4a2..2924ff4 100644
--- a/linden/indra/llimage/llimagebmp.h
+++ b/linden/indra/llimage/llimagebmp.h
@@ -2,6 +2,8 @@
2 * @file llimagebmp.h 2 * @file llimagebmp.h
3 * @brief Image implementation for BMP. 3 * @brief Image implementation for BMP.
4 * 4 *
5 * $LicenseInfo:firstyear=2001&license=viewergpl$
6 *
5 * Copyright (c) 2001-2007, Linden Research, Inc. 7 * Copyright (c) 2001-2007, Linden Research, Inc.
6 * 8 *
7 * Second Life Viewer Source Code 9 * Second Life Viewer Source Code
@@ -24,6 +26,7 @@
24 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO 26 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
25 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, 27 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
26 * COMPLETENESS OR PERFORMANCE. 28 * COMPLETENESS OR PERFORMANCE.
29 * $/LicenseInfo$
27 */ 30 */
28 31
29#ifndef LL_LLIMAGEBMP_H 32#ifndef LL_LLIMAGEBMP_H
diff --git a/linden/indra/llimage/llimagedxt.cpp b/linden/indra/llimage/llimagedxt.cpp
index 22d7557..6feece4 100644
--- a/linden/indra/llimage/llimagedxt.cpp
+++ b/linden/indra/llimage/llimagedxt.cpp
@@ -1,6 +1,8 @@
1/** 1/**
2 * @file llimagedxt.cpp 2 * @file llimagedxt.cpp
3 * 3 *
4 * $LicenseInfo:firstyear=2001&license=viewergpl$
5 *
4 * Copyright (c) 2001-2007, Linden Research, Inc. 6 * Copyright (c) 2001-2007, Linden Research, Inc.
5 * 7 *
6 * Second Life Viewer Source Code 8 * Second Life Viewer Source Code
@@ -23,6 +25,7 @@
23 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO 25 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
24 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, 26 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
25 * COMPLETENESS OR PERFORMANCE. 27 * COMPLETENESS OR PERFORMANCE.
28 * $/LicenseInfo$
26 */ 29 */
27 30
28#include "linden_common.h" 31#include "linden_common.h"
diff --git a/linden/indra/llimage/llimagedxt.h b/linden/indra/llimage/llimagedxt.h
index c52c866..23a5047 100644
--- a/linden/indra/llimage/llimagedxt.h
+++ b/linden/indra/llimage/llimagedxt.h
@@ -1,6 +1,8 @@
1/** 1/**
2 * @file llimagedxt.h 2 * @file llimagedxt.h
3 * 3 *
4 * $LicenseInfo:firstyear=2001&license=viewergpl$
5 *
4 * Copyright (c) 2001-2007, Linden Research, Inc. 6 * Copyright (c) 2001-2007, Linden Research, Inc.
5 * 7 *
6 * Second Life Viewer Source Code 8 * Second Life Viewer Source Code
@@ -23,6 +25,7 @@
23 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO 25 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
24 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, 26 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
25 * COMPLETENESS OR PERFORMANCE. 27 * COMPLETENESS OR PERFORMANCE.
28 * $/LicenseInfo$
26 */ 29 */
27 30
28#ifndef LL_LLIMAGEDXT_H 31#ifndef LL_LLIMAGEDXT_H
diff --git a/linden/indra/llimage/llimagej2c.cpp b/linden/indra/llimage/llimagej2c.cpp
index 305b11d..0911c43 100644
--- a/linden/indra/llimage/llimagej2c.cpp
+++ b/linden/indra/llimage/llimagej2c.cpp
@@ -1,6 +1,8 @@
1/** 1/**
2 * @file llimagej2c.cpp 2 * @file llimagej2c.cpp
3 * 3 *
4 * $LicenseInfo:firstyear=2001&license=viewergpl$
5 *
4 * Copyright (c) 2001-2007, Linden Research, Inc. 6 * Copyright (c) 2001-2007, Linden Research, Inc.
5 * 7 *
6 * Second Life Viewer Source Code 8 * Second Life Viewer Source Code
@@ -23,6 +25,7 @@
23 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO 25 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
24 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, 26 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
25 * COMPLETENESS OR PERFORMANCE. 27 * COMPLETENESS OR PERFORMANCE.
28 * $/LicenseInfo$
26 */ 29 */
27#include "linden_common.h" 30#include "linden_common.h"
28 31
@@ -35,11 +38,13 @@
35 38
36typedef LLImageJ2CImpl* (*CreateLLImageJ2CFunction)(); 39typedef LLImageJ2CImpl* (*CreateLLImageJ2CFunction)();
37typedef void (*DestroyLLImageJ2CFunction)(LLImageJ2CImpl*); 40typedef void (*DestroyLLImageJ2CFunction)(LLImageJ2CImpl*);
41typedef const char* (*EngineInfoLLImageJ2CFunction)();
38 42
39//some "private static" variables so we only attempt to load 43//some "private static" variables so we only attempt to load
40//dynamic libaries once 44//dynamic libaries once
41CreateLLImageJ2CFunction j2cimpl_create_func; 45CreateLLImageJ2CFunction j2cimpl_create_func;
42DestroyLLImageJ2CFunction j2cimpl_destroy_func; 46DestroyLLImageJ2CFunction j2cimpl_destroy_func;
47EngineInfoLLImageJ2CFunction j2cimpl_engineinfo_func;
43apr_pool_t *j2cimpl_dso_memory_pool; 48apr_pool_t *j2cimpl_dso_memory_pool;
44apr_dso_handle_t *j2cimpl_dso_handle; 49apr_dso_handle_t *j2cimpl_dso_handle;
45 50
@@ -49,9 +54,10 @@ apr_dso_handle_t *j2cimpl_dso_handle;
49//function should ever be included 54//function should ever be included
50LLImageJ2CImpl* fallbackCreateLLImageJ2CImpl(); 55LLImageJ2CImpl* fallbackCreateLLImageJ2CImpl();
51void fallbackDestroyLLImageJ2CImpl(LLImageJ2CImpl* impl); 56void fallbackDestroyLLImageJ2CImpl(LLImageJ2CImpl* impl);
57const char* fallbackEngineInfoLLImageJ2CImpl();
52 58
53//static 59//static
54//Loads the required "create" and "destroy" functions needed 60//Loads the required "create", "destroy" and "engineinfo" functions needed
55void LLImageJ2C::openDSO() 61void LLImageJ2C::openDSO()
56{ 62{
57 //attempt to load a DSO and get some functions from it 63 //attempt to load a DSO and get some functions from it
@@ -70,8 +76,8 @@ void LLImageJ2C::openDSO()
70#endif 76#endif
71 77
72 dso_path = gDirUtilp->findFile(dso_name, 78 dso_path = gDirUtilp->findFile(dso_name,
73 gDirUtilp->getAppRODataDir(), 79 gDirUtilp->getAppRODataDir(),
74 gDirUtilp->getExecutableDir()); 80 gDirUtilp->getExecutableDir());
75 81
76 j2cimpl_dso_handle = NULL; 82 j2cimpl_dso_handle = NULL;
77 j2cimpl_dso_memory_pool = NULL; 83 j2cimpl_dso_memory_pool = NULL;
@@ -89,6 +95,7 @@ void LLImageJ2C::openDSO()
89 //now we want to load the functions we're interested in 95 //now we want to load the functions we're interested in
90 CreateLLImageJ2CFunction create_func = NULL; 96 CreateLLImageJ2CFunction create_func = NULL;
91 DestroyLLImageJ2CFunction dest_func = NULL; 97 DestroyLLImageJ2CFunction dest_func = NULL;
98 EngineInfoLLImageJ2CFunction engineinfo_func = NULL;
92 99
93 rv = apr_dso_sym((apr_dso_handle_sym_t*)&create_func, 100 rv = apr_dso_sym((apr_dso_handle_sym_t*)&create_func,
94 j2cimpl_dso_handle, 101 j2cimpl_dso_handle,
@@ -100,13 +107,21 @@ void LLImageJ2C::openDSO()
100 //so lets check for a destruction function 107 //so lets check for a destruction function
101 rv = apr_dso_sym((apr_dso_handle_sym_t*)&dest_func, 108 rv = apr_dso_sym((apr_dso_handle_sym_t*)&dest_func,
102 j2cimpl_dso_handle, 109 j2cimpl_dso_handle,
103 "destroyLLImageJ2CKDU"); 110 "destroyLLImageJ2CKDU");
104 if ( rv == APR_SUCCESS ) 111 if ( rv == APR_SUCCESS )
105 { 112 {
106 //k, everything is loaded alright 113 //we've loaded the destroy function ok
107 j2cimpl_create_func = create_func; 114 rv = apr_dso_sym((apr_dso_handle_sym_t*)&engineinfo_func,
108 j2cimpl_destroy_func = dest_func; 115 j2cimpl_dso_handle,
109 all_functions_loaded = true; 116 "engineInfoLLImageJ2CKDU");
117 if ( rv == APR_SUCCESS )
118 {
119 //ok, everything is loaded alright
120 j2cimpl_create_func = create_func;
121 j2cimpl_destroy_func = dest_func;
122 j2cimpl_engineinfo_func = engineinfo_func;
123 all_functions_loaded = true;
124 }
110 } 125 }
111 } 126 }
112 } 127 }
@@ -149,6 +164,15 @@ void LLImageJ2C::closeDSO()
149 if (j2cimpl_dso_memory_pool) apr_pool_destroy(j2cimpl_dso_memory_pool); 164 if (j2cimpl_dso_memory_pool) apr_pool_destroy(j2cimpl_dso_memory_pool);
150} 165}
151 166
167//static
168std::string LLImageJ2C::getEngineInfo()
169{
170 if (!j2cimpl_engineinfo_func)
171 j2cimpl_engineinfo_func = fallbackEngineInfoLLImageJ2CImpl;
172
173 return j2cimpl_engineinfo_func();
174}
175
152LLImageJ2C::LLImageJ2C() : LLImageFormatted(IMG_CODEC_J2C), 176LLImageJ2C::LLImageJ2C() : LLImageFormatted(IMG_CODEC_J2C),
153 mMaxBytes(0), 177 mMaxBytes(0),
154 mRawDiscardLevel(-1), 178 mRawDiscardLevel(-1),
@@ -156,7 +180,7 @@ LLImageJ2C::LLImageJ2C() : LLImageFormatted(IMG_CODEC_J2C),
156 mReversible(FALSE) 180 mReversible(FALSE)
157 181
158{ 182{
159 //We assume here that if we wanted to destory via 183 //We assume here that if we wanted to create via
160 //a dynamic library that the approriate open calls were made 184 //a dynamic library that the approriate open calls were made
161 //before any calls to this constructor. 185 //before any calls to this constructor.
162 186
@@ -175,7 +199,7 @@ LLImageJ2C::LLImageJ2C() : LLImageFormatted(IMG_CODEC_J2C),
175// virtual 199// virtual
176LLImageJ2C::~LLImageJ2C() 200LLImageJ2C::~LLImageJ2C()
177{ 201{
178 //We assume here that if we wanted to destory via 202 //We assume here that if we wanted to destroy via
179 //a dynamic library that the approriate open calls were made 203 //a dynamic library that the approriate open calls were made
180 //before any calls to this destructor. 204 //before any calls to this destructor.
181 205
diff --git a/linden/indra/llimage/llimagej2c.h b/linden/indra/llimage/llimagej2c.h
index 00cb919..35b4d6b 100644
--- a/linden/indra/llimage/llimagej2c.h
+++ b/linden/indra/llimage/llimagej2c.h
@@ -2,6 +2,8 @@
2 * @file llimagej2c.h 2 * @file llimagej2c.h
3 * @brief Image implmenation for jpeg2000. 3 * @brief Image implmenation for jpeg2000.
4 * 4 *
5 * $LicenseInfo:firstyear=2001&license=viewergpl$
6 *
5 * Copyright (c) 2001-2007, Linden Research, Inc. 7 * Copyright (c) 2001-2007, Linden Research, Inc.
6 * 8 *
7 * Second Life Viewer Source Code 9 * Second Life Viewer Source Code
@@ -24,6 +26,7 @@
24 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO 26 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
25 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, 27 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
26 * COMPLETENESS OR PERFORMANCE. 28 * COMPLETENESS OR PERFORMANCE.
29 * $/LicenseInfo$
27 */ 30 */
28 31
29#ifndef LL_LLIMAGEJ2C_H 32#ifndef LL_LLIMAGEJ2C_H
@@ -68,6 +71,7 @@ public:
68 71
69 static void openDSO(); 72 static void openDSO();
70 static void closeDSO(); 73 static void closeDSO();
74 static std::string getEngineInfo();
71 75
72protected: 76protected:
73 friend class LLImageJ2CImpl; 77 friend class LLImageJ2CImpl;
diff --git a/linden/indra/llimage/llimagejpeg.cpp b/linden/indra/llimage/llimagejpeg.cpp
index 4ceecdf..f9b36bd 100644
--- a/linden/indra/llimage/llimagejpeg.cpp
+++ b/linden/indra/llimage/llimagejpeg.cpp
@@ -1,6 +1,8 @@
1/** 1/**
2 * @file llimagejpeg.cpp 2 * @file llimagejpeg.cpp
3 * 3 *
4 * $LicenseInfo:firstyear=2002&license=viewergpl$
5 *
4 * Copyright (c) 2002-2007, Linden Research, Inc. 6 * Copyright (c) 2002-2007, Linden Research, Inc.
5 * 7 *
6 * Second Life Viewer Source Code 8 * Second Life Viewer Source Code
@@ -23,6 +25,7 @@
23 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO 25 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
24 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, 26 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
25 * COMPLETENESS OR PERFORMANCE. 27 * COMPLETENESS OR PERFORMANCE.
28 * $/LicenseInfo$
26 */ 29 */
27 30
28#include "linden_common.h" 31#include "linden_common.h"
diff --git a/linden/indra/llimage/llimagejpeg.h b/linden/indra/llimage/llimagejpeg.h
index 34b3f76..0be4002 100644
--- a/linden/indra/llimage/llimagejpeg.h
+++ b/linden/indra/llimage/llimagejpeg.h
@@ -2,6 +2,8 @@
2 * @file llimagejpeg.h 2 * @file llimagejpeg.h
3 * @brief This class compresses and decompresses JPEG files 3 * @brief This class compresses and decompresses JPEG files
4 * 4 *
5 * $LicenseInfo:firstyear=2002&license=viewergpl$
6 *
5 * Copyright (c) 2002-2007, Linden Research, Inc. 7 * Copyright (c) 2002-2007, Linden Research, Inc.
6 * 8 *
7 * Second Life Viewer Source Code 9 * Second Life Viewer Source Code
@@ -24,6 +26,7 @@
24 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO 26 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
25 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, 27 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
26 * COMPLETENESS OR PERFORMANCE. 28 * COMPLETENESS OR PERFORMANCE.
29 * $/LicenseInfo$
27 */ 30 */
28 31
29#ifndef LL_LLIMAGEJPEG_H 32#ifndef LL_LLIMAGEJPEG_H
diff --git a/linden/indra/llimage/llimagepng.cpp b/linden/indra/llimage/llimagepng.cpp
index d6b62a8..3e0414f 100644
--- a/linden/indra/llimage/llimagepng.cpp
+++ b/linden/indra/llimage/llimagepng.cpp
@@ -2,8 +2,9 @@
2 * @file llimagepng.cpp 2 * @file llimagepng.cpp
3 * @brief LLImageFormatted glue to encode / decode PNG files. 3 * @brief LLImageFormatted glue to encode / decode PNG files.
4 * 4 *
5 * Copyright (c) 2007 Peekay Semyorka. 5 * $LicenseInfo:firstyear=2007&license=viewergpl$
6 * Copyright (c) 2007-2007, Linden Research, Inc. 6 *
7 * Copyright (c) 2007, Linden Research, Inc.
7 * 8 *
8 * Second Life Viewer Source Code 9 * Second Life Viewer Source Code
9 * The source code in this file ("Source Code") is provided by Linden Lab 10 * The source code in this file ("Source Code") is provided by Linden Lab
@@ -25,6 +26,7 @@
25 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO 26 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
26 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, 27 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
27 * COMPLETENESS OR PERFORMANCE. 28 * COMPLETENESS OR PERFORMANCE.
29 * $/LicenseInfo$
28 */ 30 */
29 31
30#include "linden_common.h" 32#include "linden_common.h"
diff --git a/linden/indra/llimage/llimagepng.h b/linden/indra/llimage/llimagepng.h
index abdff7c..7a8e1f9 100644
--- a/linden/indra/llimage/llimagepng.h
+++ b/linden/indra/llimage/llimagepng.h
@@ -1,8 +1,9 @@
1/* 1/*
2 * @file llimagepng.h 2 * @file llimagepng.h
3 * 3 *
4 * Copyright (c) 2007 Peekay Semyorka. 4 * $LicenseInfo:firstyear=2007&license=viewergpl$
5 * Copyright (c) 2007-2007, Linden Research, Inc. 5 *
6 * Copyright (c) 2007, Linden Research, Inc.
6 * 7 *
7 * Second Life Viewer Source Code 8 * Second Life Viewer Source Code
8 * The source code in this file ("Source Code") is provided by Linden Lab 9 * The source code in this file ("Source Code") is provided by Linden Lab
@@ -24,6 +25,7 @@
24 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO 25 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
25 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, 26 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
26 * COMPLETENESS OR PERFORMANCE. 27 * COMPLETENESS OR PERFORMANCE.
28 * $/LicenseInfo$
27 */ 29 */
28 30
29#ifndef LL_LLIMAGEPNG_H 31#ifndef LL_LLIMAGEPNG_H
diff --git a/linden/indra/llimage/llimagetga.cpp b/linden/indra/llimage/llimagetga.cpp
index 39da50a..805297f 100644
--- a/linden/indra/llimage/llimagetga.cpp
+++ b/linden/indra/llimage/llimagetga.cpp
@@ -1,6 +1,8 @@
1/** 1/**
2 * @file llimagetga.cpp 2 * @file llimagetga.cpp
3 * 3 *
4 * $LicenseInfo:firstyear=2001&license=viewergpl$
5 *
4 * Copyright (c) 2001-2007, Linden Research, Inc. 6 * Copyright (c) 2001-2007, Linden Research, Inc.
5 * 7 *
6 * Second Life Viewer Source Code 8 * Second Life Viewer Source Code
@@ -23,6 +25,7 @@
23 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO 25 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
24 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, 26 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
25 * COMPLETENESS OR PERFORMANCE. 27 * COMPLETENESS OR PERFORMANCE.
28 * $/LicenseInfo$
26 */ 29 */
27 30
28#include "linden_common.h" 31#include "linden_common.h"
@@ -747,6 +750,7 @@ BOOL LLImageTGA::decodeTruecolorRle32( LLImageRaw* raw_image, BOOL &alpha_opaque
747 U32* dst_pixels = (U32*) dst; 750 U32* dst_pixels = (U32*) dst;
748 751
749 U8* src = getData() + mDataOffset; 752 U8* src = getData() + mDataOffset;
753 U8* last_src = src + getDataSize();
750 754
751 U32 rgba; 755 U32 rgba;
752 U8* rgba_byte_p = (U8*) &rgba; 756 U8* rgba_byte_p = (U8*) &rgba;
@@ -755,6 +759,10 @@ BOOL LLImageTGA::decodeTruecolorRle32( LLImageRaw* raw_image, BOOL &alpha_opaque
755 while( dst_pixels <= last_dst_pixel ) 759 while( dst_pixels <= last_dst_pixel )
756 { 760 {
757 // Read RLE block header 761 // Read RLE block header
762
763 if (src >= last_src)
764 return FALSE;
765
758 U8 block_header_byte = *src; 766 U8 block_header_byte = *src;
759 src++; 767 src++;
760 768
@@ -762,6 +770,10 @@ BOOL LLImageTGA::decodeTruecolorRle32( LLImageRaw* raw_image, BOOL &alpha_opaque
762 if( block_header_byte & 0x80 ) 770 if( block_header_byte & 0x80 )
763 { 771 {
764 // Encoded (duplicate-pixel) block 772 // Encoded (duplicate-pixel) block
773
774 if (src + 3 >= last_src)
775 return FALSE;
776
765 rgba_byte_p[0] = src[2]; 777 rgba_byte_p[0] = src[2];
766 rgba_byte_p[1] = src[1]; 778 rgba_byte_p[1] = src[1];
767 rgba_byte_p[2] = src[0]; 779 rgba_byte_p[2] = src[0];
@@ -786,6 +798,9 @@ BOOL LLImageTGA::decodeTruecolorRle32( LLImageRaw* raw_image, BOOL &alpha_opaque
786 // Unencoded block 798 // Unencoded block
787 do 799 do
788 { 800 {
801 if (src + 3 >= last_src)
802 return FALSE;
803
789 ((U8*)dst_pixels)[0] = src[2]; 804 ((U8*)dst_pixels)[0] = src[2];
790 ((U8*)dst_pixels)[1] = src[1]; 805 ((U8*)dst_pixels)[1] = src[1];
791 ((U8*)dst_pixels)[2] = src[0]; 806 ((U8*)dst_pixels)[2] = src[0];
@@ -813,10 +828,16 @@ BOOL LLImageTGA::decodeTruecolorRle15( LLImageRaw* raw_image )
813 U8* dst = raw_image->getData(); 828 U8* dst = raw_image->getData();
814 U8* src = getData() + mDataOffset; 829 U8* src = getData() + mDataOffset;
815 830
831 U8* last_src = src + getDataSize();
816 U8* last_dst = dst + getComponents() * (getHeight() * getWidth() - 1); 832 U8* last_dst = dst + getComponents() * (getHeight() * getWidth() - 1);
833
817 while( dst <= last_dst ) 834 while( dst <= last_dst )
818 { 835 {
819 // Read RLE block header 836 // Read RLE block header
837
838 if (src >= last_src)
839 return FALSE;
840
820 U8 block_header_byte = *src; 841 U8 block_header_byte = *src;
821 src++; 842 src++;
822 843
@@ -826,6 +847,9 @@ BOOL LLImageTGA::decodeTruecolorRle15( LLImageRaw* raw_image )
826 // Encoded (duplicate-pixel) block 847 // Encoded (duplicate-pixel) block
827 do 848 do
828 { 849 {
850 if (src + 2 >= last_src)
851 return FALSE;
852
829 decodeTruecolorPixel15( dst, src ); // slow 853 decodeTruecolorPixel15( dst, src ); // slow
830 dst += 3; 854 dst += 3;
831 block_pixel_count--; 855 block_pixel_count--;
@@ -838,6 +862,9 @@ BOOL LLImageTGA::decodeTruecolorRle15( LLImageRaw* raw_image )
838 // Unencoded block 862 // Unencoded block
839 do 863 do
840 { 864 {
865 if (src + 2 >= last_src)
866 return FALSE;
867
841 decodeTruecolorPixel15( dst, src ); 868 decodeTruecolorPixel15( dst, src );
842 dst += 3; 869 dst += 3;
843 src += 2; 870 src += 2;
@@ -859,10 +886,16 @@ BOOL LLImageTGA::decodeTruecolorRle24( LLImageRaw* raw_image )
859 U8* dst = raw_image->getData(); 886 U8* dst = raw_image->getData();
860 U8* src = getData() + mDataOffset; 887 U8* src = getData() + mDataOffset;
861 888
889 U8* last_src = src + getDataSize();
862 U8* last_dst = dst + getComponents() * (getHeight() * getWidth() - 1); 890 U8* last_dst = dst + getComponents() * (getHeight() * getWidth() - 1);
891
863 while( dst <= last_dst ) 892 while( dst <= last_dst )
864 { 893 {
865 // Read RLE block header 894 // Read RLE block header
895
896 if (src >= last_src)
897 return FALSE;
898
866 U8 block_header_byte = *src; 899 U8 block_header_byte = *src;
867 src++; 900 src++;
868 901
@@ -872,6 +905,8 @@ BOOL LLImageTGA::decodeTruecolorRle24( LLImageRaw* raw_image )
872 // Encoded (duplicate-pixel) block 905 // Encoded (duplicate-pixel) block
873 do 906 do
874 { 907 {
908 if (src + 2 >= last_src)
909 return FALSE;
875 dst[0] = src[2]; 910 dst[0] = src[2];
876 dst[1] = src[1]; 911 dst[1] = src[1];
877 dst[2] = src[0]; 912 dst[2] = src[0];
@@ -886,6 +921,9 @@ BOOL LLImageTGA::decodeTruecolorRle24( LLImageRaw* raw_image )
886 // Unencoded block 921 // Unencoded block
887 do 922 do
888 { 923 {
924 if (src + 2 >= last_src)
925 return FALSE;
926
889 dst[0] = src[2]; 927 dst[0] = src[2];
890 dst[1] = src[1]; 928 dst[1] = src[1];
891 dst[2] = src[0]; 929 dst[2] = src[0];
@@ -908,16 +946,25 @@ BOOL LLImageTGA::decodeTruecolorRle8( LLImageRaw* raw_image )
908 U8* dst = raw_image->getData(); 946 U8* dst = raw_image->getData();
909 U8* src = getData() + mDataOffset; 947 U8* src = getData() + mDataOffset;
910 948
949 U8* last_src = src + getDataSize();
911 U8* last_dst = dst + getHeight() * getWidth() - 1; 950 U8* last_dst = dst + getHeight() * getWidth() - 1;
951
912 while( dst <= last_dst ) 952 while( dst <= last_dst )
913 { 953 {
914 // Read RLE block header 954 // Read RLE block header
955
956 if (src >= last_src)
957 return FALSE;
958
915 U8 block_header_byte = *src; 959 U8 block_header_byte = *src;
916 src++; 960 src++;
917 961
918 U8 block_pixel_count = (block_header_byte & 0x7F) + 1; 962 U8 block_pixel_count = (block_header_byte & 0x7F) + 1;
919 if( block_header_byte & 0x80 ) 963 if( block_header_byte & 0x80 )
920 { 964 {
965 if (src >= last_src)
966 return FALSE;
967
921 // Encoded (duplicate-pixel) block 968 // Encoded (duplicate-pixel) block
922 memset( dst, *src, block_pixel_count ); 969 memset( dst, *src, block_pixel_count );
923 dst += block_pixel_count; 970 dst += block_pixel_count;
@@ -928,6 +975,9 @@ BOOL LLImageTGA::decodeTruecolorRle8( LLImageRaw* raw_image )
928 // Unencoded block 975 // Unencoded block
929 do 976 do
930 { 977 {
978 if (src >= last_src)
979 return FALSE;
980
931 *dst = *src; 981 *dst = *src;
932 dst++; 982 dst++;
933 src++; 983 src++;
diff --git a/linden/indra/llimage/llimagetga.h b/linden/indra/llimage/llimagetga.h
index d4d56d0..3bfe4e6 100644
--- a/linden/indra/llimage/llimagetga.h
+++ b/linden/indra/llimage/llimagetga.h
@@ -2,6 +2,8 @@
2 * @file llimagetga.h 2 * @file llimagetga.h
3 * @brief Image implementation to compresses and decompressed TGA files. 3 * @brief Image implementation to compresses and decompressed TGA files.
4 * 4 *
5 * $LicenseInfo:firstyear=2001&license=viewergpl$
6 *
5 * Copyright (c) 2001-2007, Linden Research, Inc. 7 * Copyright (c) 2001-2007, Linden Research, Inc.
6 * 8 *
7 * Second Life Viewer Source Code 9 * Second Life Viewer Source Code
@@ -24,6 +26,7 @@
24 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO 26 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
25 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, 27 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
26 * COMPLETENESS OR PERFORMANCE. 28 * COMPLETENESS OR PERFORMANCE.
29 * $/LicenseInfo$
27 */ 30 */
28 31
29#ifndef LL_LLIMAGETGA_H 32#ifndef LL_LLIMAGETGA_H
diff --git a/linden/indra/llimage/llimageworker.cpp b/linden/indra/llimage/llimageworker.cpp
index 9affd59..61b15b2 100644
--- a/linden/indra/llimage/llimageworker.cpp
+++ b/linden/indra/llimage/llimageworker.cpp
@@ -2,6 +2,8 @@
2 * @file llimageworker.cpp 2 * @file llimageworker.cpp
3 * @brief Base class for images. 3 * @brief Base class for images.
4 * 4 *
5 * $LicenseInfo:firstyear=2001&license=viewergpl$
6 *
5 * Copyright (c) 2001-2007, Linden Research, Inc. 7 * Copyright (c) 2001-2007, Linden Research, Inc.
6 * 8 *
7 * Second Life Viewer Source Code 9 * Second Life Viewer Source Code
@@ -24,6 +26,7 @@
24 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO 26 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
25 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, 27 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
26 * COMPLETENESS OR PERFORMANCE. 28 * COMPLETENESS OR PERFORMANCE.
29 * $/LicenseInfo$
27 */ 30 */
28 31
29#include "linden_common.h" 32#include "linden_common.h"
@@ -99,10 +102,7 @@ bool LLImageWorker::doWork(S32 param)
99 } 102 }
100 else 103 else
101 { 104 {
102 S32 nc = param ? 1 : mFormattedImage->getComponents(); 105 mDecodedImage = new LLImageRaw(); // allow possibly smaller size set during decoding
103 mDecodedImage = new LLImageRaw(mFormattedImage->getWidth(),
104 mFormattedImage->getHeight(),
105 nc);
106 } 106 }
107 } 107 }
108 if (!decoded) 108 if (!decoded)
diff --git a/linden/indra/llimage/llimageworker.h b/linden/indra/llimage/llimageworker.h
index a84918d..f9c592f 100644
--- a/linden/indra/llimage/llimageworker.h
+++ b/linden/indra/llimage/llimageworker.h
@@ -2,6 +2,8 @@
2 * @file llimageworker.h 2 * @file llimageworker.h
3 * @brief Object for managing images and their textures. 3 * @brief Object for managing images and their textures.
4 * 4 *
5 * $LicenseInfo:firstyear=2000&license=viewergpl$
6 *
5 * Copyright (c) 2000-2007, Linden Research, Inc. 7 * Copyright (c) 2000-2007, Linden Research, Inc.
6 * 8 *
7 * Second Life Viewer Source Code 9 * Second Life Viewer Source Code
@@ -24,6 +26,7 @@
24 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO 26 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
25 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, 27 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
26 * COMPLETENESS OR PERFORMANCE. 28 * COMPLETENESS OR PERFORMANCE.
29 * $/LicenseInfo$
27 */ 30 */
28 31
29#ifndef LL_LLIMAGEWORKER_H 32#ifndef LL_LLIMAGEWORKER_H
diff --git a/linden/indra/llimage/llmapimagetype.h b/linden/indra/llimage/llmapimagetype.h
index 690d3ec..b9d20d1 100644
--- a/linden/indra/llimage/llmapimagetype.h
+++ b/linden/indra/llimage/llmapimagetype.h
@@ -1,6 +1,8 @@
1/** 1/**
2 * @file llmapimagetype.h 2 * @file llmapimagetype.h
3 * 3 *
4 * $LicenseInfo:firstyear=2003&license=viewergpl$
5 *
4 * Copyright (c) 2003-2007, Linden Research, Inc. 6 * Copyright (c) 2003-2007, Linden Research, Inc.
5 * 7 *
6 * Second Life Viewer Source Code 8 * Second Life Viewer Source Code
@@ -23,6 +25,7 @@
23 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO 25 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
24 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, 26 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
25 * COMPLETENESS OR PERFORMANCE. 27 * COMPLETENESS OR PERFORMANCE.
28 * $/LicenseInfo$
26 */ 29 */
27 30
28#ifndef LL_LLMAPIMAGETYPE_H 31#ifndef LL_LLMAPIMAGETYPE_H
diff --git a/linden/indra/llimage/llpngwrapper.cpp b/linden/indra/llimage/llpngwrapper.cpp
index 52616d1..74a09b2 100644
--- a/linden/indra/llimage/llpngwrapper.cpp
+++ b/linden/indra/llimage/llpngwrapper.cpp
@@ -2,8 +2,9 @@
2 * @file llpngwrapper.cpp 2 * @file llpngwrapper.cpp
3 * @brief Encapsulates libpng read/write functionality. 3 * @brief Encapsulates libpng read/write functionality.
4 * 4 *
5 * Copyright (c) 2007 Peekay Semyorka. 5 * $LicenseInfo:firstyear=2007&license=viewergpl$
6 * Copyright (c) 2007-2007, Linden Research, Inc. 6 *
7 * Copyright (c) 2007, Linden Research, Inc.
7 * 8 *
8 * Second Life Viewer Source Code 9 * Second Life Viewer Source Code
9 * The source code in this file ("Source Code") is provided by Linden Lab 10 * The source code in this file ("Source Code") is provided by Linden Lab
@@ -25,6 +26,7 @@
25 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO 26 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
26 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, 27 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
27 * COMPLETENESS OR PERFORMANCE. 28 * COMPLETENESS OR PERFORMANCE.
29 * $/LicenseInfo$
28 */ 30 */
29 31
30#include "linden_common.h" 32#include "linden_common.h"
diff --git a/linden/indra/llimage/llpngwrapper.h b/linden/indra/llimage/llpngwrapper.h
index 1b5b97f..1c66b8a 100644
--- a/linden/indra/llimage/llpngwrapper.h
+++ b/linden/indra/llimage/llpngwrapper.h
@@ -1,8 +1,9 @@
1/* 1/*
2 * @file llpngwrapper.h 2 * @file llpngwrapper.h
3 * 3 *
4 * Copyright (c) 2007 Peekay Semyorka. 4 * $LicenseInfo:firstyear=2007&license=viewergpl$
5 * Copyright (c) 2007-2007, Linden Research, Inc. 5 *
6 * Copyright (c) 2007, Linden Research, Inc.
6 * 7 *
7 * Second Life Viewer Source Code 8 * Second Life Viewer Source Code
8 * The source code in this file ("Source Code") is provided by Linden Lab 9 * The source code in this file ("Source Code") is provided by Linden Lab
@@ -24,6 +25,7 @@
24 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO 25 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
25 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, 26 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
26 * COMPLETENESS OR PERFORMANCE. 27 * COMPLETENESS OR PERFORMANCE.
28 * $/LicenseInfo$
27 */ 29 */
28 30
29#ifndef LL_LLPNGWRAPPER_H 31#ifndef LL_LLPNGWRAPPER_H