Compare commits
202 Commits
unimap
...
archive/V2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ea10825c27 | ||
|
|
a8f4b3ed4a | ||
|
|
09133307a1 | ||
|
|
ae50fc4404 | ||
|
|
cff618f67d | ||
|
|
1d90b8624b | ||
|
|
6cf9c3b4ed | ||
|
|
226de66b81 | ||
|
|
89c6f11072 | ||
|
|
41dc9f9751 | ||
|
|
ee2508274e | ||
|
|
4bb68e5a34 | ||
|
|
e3b328a115 | ||
|
|
0dd3e189fc | ||
|
|
a694742522 | ||
|
|
d2f66f9bd0 | ||
|
|
8b12d794c5 | ||
|
|
2dff12433c | ||
|
|
332cfdb532 | ||
|
|
722a1dda04 | ||
|
|
0909a4ddbe | ||
|
|
9a8a28ee1a | ||
|
|
ab35a07f0e | ||
|
|
51133c3894 | ||
|
|
0f0d506928 | ||
|
|
8cf8814f8b | ||
|
|
06f14eae42 | ||
|
|
4f264f0359 | ||
|
|
80db7f58c7 | ||
|
|
04b3dee767 | ||
|
|
b6c0436c1b | ||
|
|
5954e0d71c | ||
|
|
50540049c1 | ||
|
|
2d882e527f | ||
|
|
ac12349a8a | ||
|
|
f7a5394904 | ||
|
|
af203533b3 | ||
|
|
41f42fc741 | ||
|
|
c694d12c93 | ||
|
|
f190644464 | ||
|
|
0b1b7c6618 | ||
|
|
98c2b7e11f | ||
|
|
7b1736ea9d | ||
|
|
673a338bf5 | ||
|
|
d3c91698bf | ||
|
|
ab20e881ce | ||
|
|
41fe5f47e1 | ||
|
|
73cf43cbc9 | ||
|
|
26058999b3 | ||
|
|
8f09dedb1e | ||
|
|
955ca21298 | ||
|
|
25b4452a12 | ||
|
|
5d5231fe8c | ||
|
|
d2291b5903 | ||
|
|
4c068a4a85 | ||
|
|
eded2546fc | ||
|
|
0c2ea7cc9b | ||
|
|
0b9a44a842 | ||
|
|
e81f2ea3be | ||
|
|
cacf87e962 | ||
|
|
c816d25e68 | ||
|
|
2afa251b64 | ||
|
|
a6c802bd86 | ||
|
|
d32f820903 | ||
|
|
c38a47ea48 | ||
|
|
ad19c0209b | ||
|
|
3901893a3a | ||
|
|
d2d53fec7f | ||
|
|
8204ec5565 | ||
|
|
48538fe182 | ||
|
|
2abece1819 | ||
|
|
8018a8842f | ||
|
|
68a95b5b1a | ||
|
|
ef43a87ac0 | ||
|
|
0c2765511e | ||
|
|
1a0387f918 | ||
|
|
b9203e487a | ||
|
|
4f9b8443e2 | ||
|
|
dbd26ddee1 | ||
|
|
4d2dde73d7 | ||
|
|
6cbbe493dd | ||
|
|
8ff0a29f9d | ||
|
|
f30dc32503 | ||
|
|
a35a59d56b | ||
|
|
4d4c49cd24 | ||
|
|
aa1167e4d5 | ||
|
|
9e4bc6754a | ||
|
|
c6fa0be39b | ||
|
|
15a8a86b15 | ||
|
|
125a90e46b | ||
|
|
e9147cb7fb | ||
|
|
db5ba95f58 | ||
|
|
ab8656d5d8 | ||
|
|
711a4fdacd | ||
|
|
156bb5415d | ||
|
|
88fe5d6979 | ||
|
|
4e3501d034 | ||
|
|
b390d74b9c | ||
|
|
fcc98ffe46 | ||
|
|
fd8866c411 | ||
|
|
0d3c91269b | ||
|
|
b952d3f4e6 | ||
|
|
186bd80ba0 | ||
|
|
e6b5811e7e | ||
|
|
344cafcb1b | ||
|
|
3a3805fd18 | ||
|
|
58102daf94 | ||
|
|
753c0b9285 | ||
|
|
ad4d974812 | ||
|
|
3fca56df23 | ||
|
|
b7cc1932f1 | ||
|
|
c17b67399b | ||
|
|
cd7b1e434d | ||
|
|
f9e0b122ae | ||
|
|
7e895d4590 | ||
|
|
6dd9212d16 | ||
|
|
0f038bbffc | ||
|
|
6e437d4188 | ||
|
|
b92dec7530 | ||
|
|
8b54d6503a | ||
|
|
05102e98ab | ||
|
|
758c5bbfeb | ||
|
|
b3593f0ffe | ||
|
|
b34d9fb88e | ||
|
|
4b4096857f | ||
|
|
497e63bfb6 | ||
|
|
e756140e1d | ||
|
|
a028c4edba | ||
|
|
6b693d7571 | ||
|
|
838c2851da | ||
|
|
b4237a8200 | ||
|
|
de109f9f97 | ||
|
|
acf31bb885 | ||
|
|
74659e6121 | ||
|
|
dc62c29af0 | ||
|
|
18af6baedd | ||
|
|
8323a701e8 | ||
|
|
9435671d8d | ||
|
|
1054ea2519 | ||
|
|
ba9bd7d41e | ||
|
|
18b10638be | ||
|
|
2298aee369 | ||
|
|
b6b18b0693 | ||
|
|
b887d3147e | ||
|
|
459deb4288 | ||
|
|
f73c666f0e | ||
|
|
86f7987e13 | ||
|
|
82667f5618 | ||
|
|
179f4ddabb | ||
|
|
39af56c6f7 | ||
|
|
0150bac422 | ||
|
|
23e1521a6b | ||
|
|
e4df5c7fd0 | ||
|
|
ad91dcc6e1 | ||
|
|
d4b6ece24b | ||
|
|
67915fe8c8 | ||
|
|
611b8f48d6 | ||
|
|
15c01ed310 | ||
|
|
baac16b5d2 | ||
|
|
e70a91311f | ||
|
|
472dade93a | ||
|
|
3b567d3eae | ||
|
|
4ce89f203d | ||
|
|
1166db3436 | ||
|
|
77b5ac28e6 | ||
|
|
919d321d4a | ||
|
|
689337eb8c | ||
|
|
51a71f27e9 | ||
|
|
40c0a8d210 | ||
|
|
bdd4f911e9 | ||
|
|
ee60606a04 | ||
|
|
34fe62ba53 | ||
|
|
5882ea5643 | ||
|
|
7b98e5f2f1 | ||
|
|
387e8ed756 | ||
|
|
1c33889762 | ||
|
|
0eab7bd2a5 | ||
|
|
ef4c050e35 | ||
|
|
62d7f3d59f | ||
|
|
6ee243d0d5 | ||
|
|
e29d969631 | ||
|
|
b06dcb45c0 | ||
|
|
a8ef46888e | ||
|
|
343bb22b5c | ||
|
|
81174cffa7 | ||
|
|
d27e5a2676 | ||
|
|
f67c761341 | ||
|
|
e63279a692 | ||
|
|
a05fdaa63e | ||
|
|
ed457e3539 | ||
|
|
fc1fc600d9 | ||
|
|
68fa3ae13c | ||
|
|
19f9af6c29 | ||
|
|
580054380c | ||
|
|
564f7067f7 | ||
|
|
862ce4807c | ||
|
|
ef90cc74e4 | ||
|
|
1b039a1be6 | ||
|
|
60f3104eb6 | ||
|
|
4c3a73658c | ||
|
|
996aaf6345 | ||
|
|
3ce40cf763 |
@@ -1,14 +0,0 @@
|
||||
Copyright 2000-2004 The Apache Software Foundation
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
Portions of this software are copyright (c) 2003 The FreeType
|
||||
Project (www.freetype.org). All rights reserved.
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
The json-cpp library and this documentation are in Public Domain.
|
||||
Retrieved from http://jsoncpp.sourceforge.net/ on 2009-09-04.
|
||||
@@ -1,23 +0,0 @@
|
||||
* Copyright (c) 2008, Jan Ciger (jan.ciger (at) gmail.com)
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * The name of its contributors may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY Jan Ciger ''AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL Jan Ciger BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
@@ -1,116 +0,0 @@
|
||||
Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
|
||||
All rights reserved.
|
||||
|
||||
This package is an SSL implementation written
|
||||
by Eric Young (eay@cryptsoft.com).
|
||||
The implementation was written so as to conform with Netscapes SSL.
|
||||
|
||||
This library is free for commercial and non-commercial use as long as
|
||||
the following conditions are aheared to. The following conditions
|
||||
apply to all code found in this distribution, be it the RC4, RSA,
|
||||
lhash, DES, etc., code; not just the SSL code. The SSL documentation
|
||||
included with this distribution is covered by the same copyright terms
|
||||
except that the holder is Tim Hudson (tjh@cryptsoft.com).
|
||||
|
||||
Copyright remains Eric Young's, and as such any Copyright notices in
|
||||
the code are not to be removed.
|
||||
If this package is used in a product, Eric Young should be given attribution
|
||||
as the author of the parts of the library used.
|
||||
This can be in the form of a textual message at program startup or
|
||||
in documentation (online or textual) provided with the package.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
1. Redistributions of source code must retain the copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
3. All advertising materials mentioning features or use of this software
|
||||
must display the following acknowledgement:
|
||||
"This product includes cryptographic software written by
|
||||
Eric Young (eay@cryptsoft.com)"
|
||||
The word 'cryptographic' can be left out if the rouines from the library
|
||||
being used are not cryptographic related :-).
|
||||
4. If you include any Windows specific code (or a derivative thereof) from
|
||||
the apps directory (application code) you must include an acknowledgement:
|
||||
"This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGE.
|
||||
|
||||
The licence and distribution terms for any publically available version or
|
||||
derivative of this code cannot be changed. i.e. this code cannot simply be
|
||||
copied and put under another distribution licence
|
||||
[including the GNU Public Licence.]
|
||||
|
||||
****************
|
||||
* SSLeay
|
||||
****************
|
||||
|
||||
Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
|
||||
All rights reserved.
|
||||
|
||||
This package is an SSL implementation written
|
||||
by Eric Young (eay@cryptsoft.com).
|
||||
The implementation was written so as to conform with Netscapes SSL.
|
||||
|
||||
This library is free for commercial and non-commercial use as long as
|
||||
the following conditions are aheared to. The following conditions
|
||||
apply to all code found in this distribution, be it the RC4, RSA,
|
||||
lhash, DES, etc., code; not just the SSL code. The SSL documentation
|
||||
included with this distribution is covered by the same copyright terms
|
||||
except that the holder is Tim Hudson (tjh@cryptsoft.com).
|
||||
|
||||
Copyright remains Eric Young's, and as such any Copyright notices in
|
||||
the code are not to be removed.
|
||||
If this package is used in a product, Eric Young should be given attribution
|
||||
as the author of the parts of the library used.
|
||||
This can be in the form of a textual message at program startup or
|
||||
in documentation (online or textual) provided with the package.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
1. Redistributions of source code must retain the copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
3. All advertising materials mentioning features or use of this software
|
||||
must display the following acknowledgement:
|
||||
"This product includes cryptographic software written by
|
||||
Eric Young (eay@cryptsoft.com)"
|
||||
The word 'cryptographic' can be left out if the rouines from the library
|
||||
being used are not cryptographic related :-).
|
||||
4. If you include any Windows specific code (or a derivative thereof) from
|
||||
the apps directory (application code) you must include an acknowledgement:
|
||||
"This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGE.
|
||||
|
||||
The licence and distribution terms for any publically available version or
|
||||
derivative of this code cannot be changed. i.e. this code cannot simply be
|
||||
copied and put under another distribution licence
|
||||
[including the GNU Public Licence.]
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
Copyright 2000 Epinions, Inc.
|
||||
|
||||
Subject to the following 3 conditions, Epinions, Inc. permits you, free of charge, to (a) use, copy, distribute, modify, perform and display this software and associated documentation files (the "Software"), and (b) permit others to whom the Software is furnished to do so as well.
|
||||
|
||||
1) The above copyright notice and this permission notice shall be included without modification in all copies or substantial portions of the Software.
|
||||
|
||||
2) THE SOFTWARE IS PROVIDED "AS IS", WITHOUT ANY WARRANTY OR CONDITION OF ANY KIND, EXPRESS, IMPLIED OR STATUTORY, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OF ACCURACY, MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
|
||||
|
||||
3) IN NO EVENT SHALL EPINIONS, INC. BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES OR LOST PROFITS ARISING OUT OF OR IN CONNECTION WITH THE SOFTWARE (HOWEVER ARISING, INCLUDING NEGLIGENCE), EVEN IF EPINIONS, INC. IS AWARE OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
@@ -10,6 +10,8 @@ include(Variables)
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "-D_DEBUG -DLL_DEBUG=1")
|
||||
set(CMAKE_CXX_FLAGS_RELEASE
|
||||
"-DLL_RELEASE=1 -DLL_RELEASE_FOR_DOWNLOAD=1 -D_SECURE_SCL=0 -DLL_SEND_CRASH_REPORTS=1 -DNDEBUG")
|
||||
set(CMAKE_C_FLAGS_RELEASE
|
||||
"${CMAKE_CXX_FLAGS_RELEASE}")
|
||||
set(CMAKE_CXX_FLAGS_RELEASESSE2
|
||||
"-DLL_RELEASE=1 -DLL_RELEASE_FOR_DOWNLOAD=1 -D_SECURE_SCL=0 -DLL_SEND_CRASH_REPORTS=1 -DNDEBUG")
|
||||
#llimage now requires this (?)
|
||||
@@ -65,7 +67,7 @@ if (WINDOWS)
|
||||
/Oy-
|
||||
)
|
||||
|
||||
if(MSVC80 OR MSVC90 OR MSVC100)
|
||||
if(MSVC80 OR MSVC90 OR MSVC10)
|
||||
set(CMAKE_CXX_FLAGS_RELEASE
|
||||
"${CMAKE_CXX_FLAGS_RELEASE} -D_SECURE_STL=0 -D_HAS_ITERATOR_DEBUGGING=0"
|
||||
CACHE STRING "C++ compiler release options" FORCE)
|
||||
@@ -78,7 +80,7 @@ if (WINDOWS)
|
||||
add_definitions(
|
||||
/Zc:wchar_t-
|
||||
)
|
||||
endif (MSVC80 OR MSVC90 OR MSVC100)
|
||||
endif (MSVC80 OR MSVC90 OR MSVC10)
|
||||
|
||||
# Are we using the crummy Visual Studio KDU build workaround?
|
||||
if (NOT VS_DISABLE_FATAL_WARNINGS)
|
||||
@@ -97,7 +99,7 @@ if (WINDOWS)
|
||||
elseif (MSVC90)
|
||||
set(MSVC_DIR 9.0)
|
||||
set(MSVC_SUFFIX 90)
|
||||
elseif (MSVC100)
|
||||
elseif (MSVC10)
|
||||
set(MSVC_DIR 10.0)
|
||||
set(MSVC_SUFFIX 100)
|
||||
endif (MSVC71)
|
||||
@@ -201,10 +203,13 @@ if (LINUX)
|
||||
endif (NOT STANDALONE)
|
||||
set(CMAKE_CXX_FLAGS_RELEASESSE2 "${CMAKE_CXX_FLAGS_RELEASESSE2} -march=pentium4 -mfpmath=sse -msse2 ${GCC_EXTRA_OPTIMIZATIONS}")
|
||||
set(CMAKE_C_FLAGS_RELEASESSE2 "${CMAKE_C_FLAGS_RELEASESSE2} -march=pentium4 -mfpmath=sse -msse2 "${GCC_EXTRA_OPTIMIZATIONS})
|
||||
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O3 ${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -march=pentium4 -mfpmath=sse -msse2 ${GCC_EXTRA_OPTIMIZATIONS}")
|
||||
set(CMAKE_C_FLAGS_RELWITHDEBINFO "-O3 ${CMAKE_C_FLAGS_RELWITHDEBINFO} -march=pentium4 -mfpmath=sse -msse2 "${GCC_EXTRA_OPTIMIZATIONS})
|
||||
endif (VIEWER)
|
||||
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "-fno-inline ${CMAKE_CXX_FLAGS_DEBUG}")
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "-O3 ${CMAKE_CXX_FLAGS_RELEASE}")
|
||||
set(CMAKE_C_FLAGS_RELEASE "-O3 ${CMAKE_C_FLAGS_RELEASE}")
|
||||
set(CMAKE_CXX_FLAGS_RELEASESSE2 "-O3 ${CMAKE_CXX_FLAGS_RELEASESSE2}")
|
||||
set(CMAKE_C_FLAGS_RELEASESSE2 "-O3 ${CMAKE_C_FLAGS_RELEASESSE2}")
|
||||
endif (LINUX)
|
||||
|
||||
@@ -17,7 +17,7 @@ else (STANDALONE)
|
||||
set(Boost_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/include)
|
||||
|
||||
if (WINDOWS)
|
||||
set(BOOST_VERSION 1_39)
|
||||
set(BOOST_VERSION 1_45)
|
||||
|
||||
# SNOW-788
|
||||
# 00-Common.cmake alreay sets MSVC_SUFFIX to be correct for the VS we are using eg VC71, VC80, VC90 etc
|
||||
|
||||
@@ -28,6 +28,7 @@ set(cmake_SOURCE_FILES
|
||||
FindCARes.cmake
|
||||
FindELFIO.cmake
|
||||
FindGooglePerfTools.cmake
|
||||
FindHunSpell.cmake
|
||||
FindMono.cmake
|
||||
FindMT.cmake
|
||||
FindMySQL.cmake
|
||||
@@ -39,6 +40,7 @@ set(cmake_SOURCE_FILES
|
||||
FreeType.cmake
|
||||
GStreamer010Plugin.cmake
|
||||
GooglePerfTools.cmake
|
||||
HUNSPELL.cmake
|
||||
JPEG.cmake
|
||||
LLAddBuildTest.cmake
|
||||
LLAudio.cmake
|
||||
|
||||
@@ -25,6 +25,7 @@ set(all_targets ${all_targets} ${out_targets})
|
||||
|
||||
set(debug_src_dir "${CMAKE_SOURCE_DIR}/../libraries/i686-win32/lib/debug")
|
||||
set(debug_files
|
||||
libhunspell.dll
|
||||
libapr-1.dll
|
||||
libaprutil-1.dll
|
||||
libapriconv-1.dll
|
||||
@@ -243,6 +244,7 @@ set(release_src_dir "${CMAKE_SOURCE_DIR}/../libraries/i686-win32/lib/release")
|
||||
set(release_files
|
||||
libtcmalloc_minimal.dll
|
||||
fmod.dll
|
||||
libhunspell.dll
|
||||
libapr-1.dll
|
||||
libaprutil-1.dll
|
||||
libapriconv-1.dll
|
||||
|
||||
34
indra/cmake/FindHunSpell.cmake
Normal file
34
indra/cmake/FindHunSpell.cmake
Normal file
@@ -0,0 +1,34 @@
|
||||
FIND_PATH(HUNSPELL_INCLUDE_DIR hunspell.hxx
|
||||
/usr/local/include/hunspell
|
||||
/usr/local/include
|
||||
/usr/include/hunspell
|
||||
/usr/include
|
||||
)
|
||||
|
||||
SET(HUNSPELL_NAMES ${HUNSPELL_NAMES} hunspell hunspell-1.2)
|
||||
FIND_LIBRARY(HUNSPELL_LIBRARY
|
||||
NAMES ${HUNSPELL_NAMES}
|
||||
PATHS /usr/lib /usr/local/lib
|
||||
)
|
||||
|
||||
IF(HUNSPELL_LIBRARY AND HUNSPELL_INCLUDE_DIR)
|
||||
SET(HUNSPELL_LIBRARIES ${HUNSPELL_LIBRARY})
|
||||
SET(HUNSPELL_FOUND "YES")
|
||||
ELSE(HUNSPELL_LIBRARY AND HUNSPELL_INCLUDE_DIR)
|
||||
SET(HUNSPELL_FOUND "NO")
|
||||
ENDIF(HUNSPELL_LIBRARY AND HUNSPELL_INCLUDE_DIR)
|
||||
|
||||
IF(HUNSPELL_FOUND)
|
||||
IF(NOT HUNSPELL_FIND_QUIETLY)
|
||||
MESSAGE(STATUS "Found Hunspell: ${HUNSPELL_LIBRARIES}")
|
||||
ENDIF(NOT HUNSPELL_FIND_QUIETLY)
|
||||
ELSE(HUNSPELL_FOUND)
|
||||
IF(HUNSPELL_FIND_REQUIRED)
|
||||
MESSAGE(FATAL_ERROR "Could not find HunSpell library")
|
||||
ENDIF(HUNSPELL_FIND_REQUIRED)
|
||||
ENDIF(HUNSPELL_FOUND)
|
||||
|
||||
MARK_AS_ADVANCED(
|
||||
HUNSPELL_LIBRARY
|
||||
HUNSPELL_INCLUDE_DIR
|
||||
)
|
||||
16
indra/cmake/HUNSPELL.cmake
Normal file
16
indra/cmake/HUNSPELL.cmake
Normal file
@@ -0,0 +1,16 @@
|
||||
# -*- cmake -*-
|
||||
include(Prebuilt)
|
||||
|
||||
if (STANDALONE)
|
||||
include(FindHunSpell)
|
||||
else (STANDALONE)
|
||||
use_prebuilt_binary(hunspell)
|
||||
|
||||
set(HUNSPELL_INCLUDE_DIR ${LIBS_PREBUILT_DIR}/include/hunspell)
|
||||
|
||||
if (LINUX OR DARWIN)
|
||||
set(HUNSPELL_LIBRARY hunspell-1.2)
|
||||
else (LINUX OR DARWIN)
|
||||
set(HUNSPELL_LIBRARY libhunspell)
|
||||
endif (LINUX OR DARWIN)
|
||||
endif (STANDALONE)
|
||||
@@ -4,6 +4,7 @@ include(Prebuilt)
|
||||
if (NOT STANDALONE)
|
||||
use_prebuilt_binary(GL)
|
||||
# possible glh_linear should have its own .cmake file instead
|
||||
use_prebuilt_binary(glh_linear)
|
||||
#use_prebuilt_binary(glh_linear)
|
||||
# actually... not any longer, it's now in git -SG
|
||||
set(GLEXT_INCLUDE_DIR ${LIBS_PREBUILT_DIR}/${LL_ARCH_DIR}/include)
|
||||
endif (NOT STANDALONE)
|
||||
|
||||
@@ -518,9 +518,16 @@ class WindowsSetup(PlatformSetup):
|
||||
self.using_express = True
|
||||
print 'Building with ', self.gens[version]['gen'] , "Express edition"
|
||||
break
|
||||
else:
|
||||
print >> sys.stderr, 'Cannot find any Visual Studio installation'
|
||||
sys.exit(1)
|
||||
else:
|
||||
for version in 'vc80 vc90 vc100 vc71'.split():
|
||||
if self.find_visual_studio_express_single(version):
|
||||
self._generator = version
|
||||
self.using_express = True
|
||||
print 'Building with ', self.gens[version]['gen'] , "Express edition"
|
||||
break
|
||||
else:
|
||||
print >> sys.stderr, 'Cannot find any Visual Studio installation'
|
||||
sys.exit(1)
|
||||
return self._generator
|
||||
|
||||
def _set_generator(self, gen):
|
||||
@@ -605,6 +612,28 @@ class WindowsSetup(PlatformSetup):
|
||||
except WindowsError, err:
|
||||
print >> sys.stderr, "Didn't find ", self.gens[gen]['gen']
|
||||
return ''
|
||||
|
||||
def find_visual_studio_express_single(self, gen=None):
|
||||
if gen is None:
|
||||
gen = self._generator
|
||||
gen = gen.lower()
|
||||
try:
|
||||
import _winreg
|
||||
key_str = (r'SOFTWARE\Microsoft\VCEXpress\%s_Config\Setup\VC' %
|
||||
self.gens[gen]['ver'])
|
||||
value_str = (r'ProductDir')
|
||||
print ('Reading VS environment from HKEY_CURRENT_USER\%s\%s' %
|
||||
(key_str, value_str))
|
||||
print key_str
|
||||
|
||||
reg = _winreg.ConnectRegistry(None, _winreg.HKEY_CURRENT_USER)
|
||||
key = _winreg.OpenKey(reg, key_str)
|
||||
value = _winreg.QueryValueEx(key, value_str)[0]+"IDE"
|
||||
print 'Found: %s' % value
|
||||
return value
|
||||
except WindowsError, err:
|
||||
print >> sys.stderr, "Didn't find ", self.gens[gen]['gen']
|
||||
return ''
|
||||
|
||||
def get_build_cmd(self):
|
||||
if self.incredibuild:
|
||||
@@ -617,13 +646,15 @@ class WindowsSetup(PlatformSetup):
|
||||
if environment == '':
|
||||
environment = self.find_visual_studio_express()
|
||||
if environment == '':
|
||||
print >> sys.stderr, "Something went very wrong during build stage, could not find a Visual Studio?"
|
||||
else:
|
||||
build_dirs=self.build_dirs()
|
||||
print >> sys.stderr, "\nSolution generation complete, it can can now be found in:", build_dirs[0]
|
||||
print >> sys.stderr, "\nAs you are using an Express Visual Studio, the build step cannot be automated"
|
||||
print >> sys.stderr, "\nPlease see https://wiki.secondlife.com/wiki/Microsoft_Visual_Studio#Extra_steps_for_Visual_Studio_Express_editions for Visual Studio Express specific information"
|
||||
exit(0)
|
||||
environment = self.find_visual_studio_express_single()
|
||||
if environment == '':
|
||||
print >> sys.stderr, "Something went very wrong during build stage, could not find a Visual Studio?"
|
||||
else:
|
||||
build_dirs=self.build_dirs()
|
||||
print >> sys.stderr, "\nSolution generation complete, it can can now be found in:", build_dirs[0]
|
||||
print >> sys.stderr, "\nAs you are using an Express Visual Studio, the build step cannot be automated"
|
||||
print >> sys.stderr, "\nPlease see https://wiki.secondlife.com/wiki/Microsoft_Visual_Studio#Extra_steps_for_Visual_Studio_Express_editions for Visual Studio Express specific information"
|
||||
exit(0)
|
||||
|
||||
# devenv.com is CLI friendly, devenv.exe... not so much.
|
||||
return ('"%sdevenv.com" %s.sln /build %s' %
|
||||
|
||||
@@ -246,9 +246,9 @@ public:
|
||||
return rtn;
|
||||
}
|
||||
|
||||
LLVisualParam* getVisualParam(S32 id)
|
||||
LLVisualParam* getVisualParam(S32 id) const
|
||||
{
|
||||
visual_param_index_map_t::iterator iter = mVisualParamIndexMap.find(id);
|
||||
visual_param_index_map_t::const_iterator iter = mVisualParamIndexMap.find(id);
|
||||
return (iter == mVisualParamIndexMap.end()) ? 0 : iter->second;
|
||||
}
|
||||
S32 getVisualParamID(LLVisualParam *id)
|
||||
|
||||
@@ -27,6 +27,7 @@ set(llcommon_SOURCE_FILES
|
||||
llcriticaldamp.cpp
|
||||
llcursortypes.cpp
|
||||
lldate.cpp
|
||||
lldictionary.cpp
|
||||
llerror.cpp
|
||||
llerrorthread.cpp
|
||||
llevent.cpp
|
||||
@@ -106,6 +107,7 @@ set(llcommon_HEADER_FILES
|
||||
lldate.h
|
||||
lldefs.h
|
||||
lldepthstack.h
|
||||
lldictionary.h
|
||||
lldlinked.h
|
||||
lldqueueptr.h
|
||||
llendianswizzle.h
|
||||
|
||||
@@ -34,7 +34,6 @@
|
||||
#ifndef LL_LLCHAT_H
|
||||
#define LL_LLCHAT_H
|
||||
|
||||
#include "llstring.h"
|
||||
#include "lluuid.h"
|
||||
#include "v3math.h"
|
||||
|
||||
@@ -71,7 +70,7 @@ typedef enum e_chat_audible_level
|
||||
class LLChat
|
||||
{
|
||||
public:
|
||||
LLChat(const std::string& text = LLStringUtil::null)
|
||||
LLChat(const std::string& text = std::string())
|
||||
: mText(text),
|
||||
mFromName(),
|
||||
mFromID(),
|
||||
|
||||
@@ -202,7 +202,7 @@ public:
|
||||
{
|
||||
U32 n = mVector.size();
|
||||
mIndexMap[k] = n;
|
||||
mVector.resize(n+1);
|
||||
mVector.push_back(Type());
|
||||
llassert(mVector.size() == mIndexMap.size());
|
||||
return mVector[n];
|
||||
}
|
||||
|
||||
54
indra/llcommon/lldictionary.cpp
Normal file
54
indra/llcommon/lldictionary.cpp
Normal file
@@ -0,0 +1,54 @@
|
||||
/**
|
||||
* @file lldictionary.cpp
|
||||
* @brief Lldictionary class header file
|
||||
*
|
||||
* $LicenseInfo:firstyear=2002&license=viewergpl$
|
||||
*
|
||||
* Copyright (c) 2002-2010, Linden Research, Inc.
|
||||
*
|
||||
* Second Life Viewer Source Code
|
||||
* The source code in this file ("Source Code") is provided by Linden Lab
|
||||
* to you under the terms of the GNU General Public License, version 2.0
|
||||
* ("GPL"), unless you have obtained a separate licensing agreement
|
||||
* ("Other License"), formally executed by you and Linden Lab. Terms of
|
||||
* the GPL can be found in doc/GPL-license.txt in this distribution, or
|
||||
* online at http://secondlife.com/developers/opensource/gplv2
|
||||
*
|
||||
* There are special exceptions to the terms and conditions of the GPL as
|
||||
* it is applied to this Source Code. View the full text of the exception
|
||||
* in the file doc/FLOSS-exception.txt in this software distribution, or
|
||||
* online at
|
||||
* http://secondlife.com/developers/opensource/flossexception
|
||||
*
|
||||
* By copying, modifying or distributing this software, you acknowledge
|
||||
* that you have read and understood your obligations described above,
|
||||
* and agree to abide by those obligations.
|
||||
*
|
||||
* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
|
||||
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
|
||||
* COMPLETENESS OR PERFORMANCE.
|
||||
* $/LicenseInfo$
|
||||
*
|
||||
*/
|
||||
|
||||
#include "linden_common.h"
|
||||
|
||||
#include "lldictionary.h"
|
||||
|
||||
#include "llstring.h"
|
||||
|
||||
// Define in .cpp file to prevent header include of llstring.h
|
||||
LLDictionaryEntry::LLDictionaryEntry(const std::string &name)
|
||||
: mName(name)
|
||||
{
|
||||
mNameCapitalized = mName;
|
||||
LLStringUtil::replaceChar(mNameCapitalized, '-', ' ');
|
||||
LLStringUtil::replaceChar(mNameCapitalized, '_', ' ');
|
||||
for (U32 i=0; i < mNameCapitalized.size(); i++)
|
||||
{
|
||||
if (i == 0 || mNameCapitalized[i-1] == ' ') // don't change ordering of this statement or crash
|
||||
{
|
||||
mNameCapitalized[i] = toupper(mNameCapitalized[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
103
indra/llcommon/lldictionary.h
Normal file
103
indra/llcommon/lldictionary.h
Normal file
@@ -0,0 +1,103 @@
|
||||
/**
|
||||
* @file lldictionary.h
|
||||
* @brief Lldictionary class header file
|
||||
*
|
||||
* $LicenseInfo:firstyear=2002&license=viewergpl$
|
||||
*
|
||||
* Copyright (c) 2002-2010, Linden Research, Inc.
|
||||
*
|
||||
* Second Life Viewer Source Code
|
||||
* The source code in this file ("Source Code") is provided by Linden Lab
|
||||
* to you under the terms of the GNU General Public License, version 2.0
|
||||
* ("GPL"), unless you have obtained a separate licensing agreement
|
||||
* ("Other License"), formally executed by you and Linden Lab. Terms of
|
||||
* the GPL can be found in doc/GPL-license.txt in this distribution, or
|
||||
* online at http://secondlife.com/developers/opensource/gplv2
|
||||
*
|
||||
* There are special exceptions to the terms and conditions of the GPL as
|
||||
* it is applied to this Source Code. View the full text of the exception
|
||||
* in the file doc/FLOSS-exception.txt in this software distribution, or
|
||||
* online at
|
||||
* http://secondlife.com/developers/opensource/flossexception
|
||||
*
|
||||
* By copying, modifying or distributing this software, you acknowledge
|
||||
* that you have read and understood your obligations described above,
|
||||
* and agree to abide by those obligations.
|
||||
*
|
||||
* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
|
||||
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
|
||||
* COMPLETENESS OR PERFORMANCE.
|
||||
* $/LicenseInfo$
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LL_LLDICTIONARY_H
|
||||
#define LL_LLDICTIONARY_H
|
||||
|
||||
#include <map>
|
||||
#include <string>
|
||||
|
||||
struct LL_COMMON_API LLDictionaryEntry
|
||||
{
|
||||
LLDictionaryEntry(const std::string &name);
|
||||
virtual ~LLDictionaryEntry() {}
|
||||
const std::string mName;
|
||||
std::string mNameCapitalized;
|
||||
};
|
||||
|
||||
template <class Index, class Entry>
|
||||
class LLDictionary : public std::map<Index, Entry *>
|
||||
{
|
||||
public:
|
||||
typedef std::map<Index, Entry *> map_t;
|
||||
typedef typename map_t::iterator iterator_t;
|
||||
typedef typename map_t::const_iterator const_iterator_t;
|
||||
|
||||
LLDictionary() {}
|
||||
virtual ~LLDictionary()
|
||||
{
|
||||
for (iterator_t iter = map_t::begin(); iter != map_t::end(); ++iter)
|
||||
delete (iter->second);
|
||||
}
|
||||
|
||||
const Entry *lookup(Index index) const
|
||||
{
|
||||
const_iterator_t dictionary_iter = map_t::find(index);
|
||||
if (dictionary_iter == map_t::end()) return NULL;
|
||||
return dictionary_iter->second;
|
||||
}
|
||||
const Index lookup(const std::string &name) const
|
||||
{
|
||||
for (const_iterator_t dictionary_iter = map_t::begin();
|
||||
dictionary_iter != map_t::end();
|
||||
dictionary_iter++)
|
||||
{
|
||||
const Entry *entry = dictionary_iter->second;
|
||||
if (entry->mName == name)
|
||||
{
|
||||
return dictionary_iter->first;
|
||||
}
|
||||
}
|
||||
return notFound();
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual Index notFound() const
|
||||
{
|
||||
// default is to assert
|
||||
// don't assert -- makes it impossible to work on mesh-development and viewer-development simultaneously
|
||||
// -- davep 2010.10.29
|
||||
//llassert(false);
|
||||
return Index(-1);
|
||||
}
|
||||
void addEntry(Index index, Entry *entry)
|
||||
{
|
||||
if (lookup(index))
|
||||
{
|
||||
llerrs << "Dictionary entry already added (attempted to add duplicate entry)" << llendl;
|
||||
}
|
||||
(*this)[index] = entry;
|
||||
}
|
||||
};
|
||||
|
||||
#endif // LL_LLDICTIONARY_H
|
||||
@@ -45,9 +45,6 @@
|
||||
# include <syslog.h>
|
||||
# include <unistd.h>
|
||||
#endif // !LL_WINDOWS
|
||||
#if LL_WINDOWS
|
||||
# include <windows.h>
|
||||
#endif // LL_WINDOWS
|
||||
#include <vector>
|
||||
|
||||
#include "llapp.h"
|
||||
|
||||
@@ -75,6 +75,10 @@ const int LL_ERR_PRICE_MISMATCH = -23018;
|
||||
#define SHOW_ASSERT
|
||||
#else // _DEBUG
|
||||
|
||||
#ifdef LL_RELEASE_WITH_DEBUG_INFO
|
||||
#define SHOW_ASSERT
|
||||
#endif // LL_RELEASE_WITH_DEBUG_INFO
|
||||
|
||||
#ifdef RELEASE_SHOW_DEBUG
|
||||
#define SHOW_DEBUG
|
||||
#endif
|
||||
@@ -103,17 +107,14 @@ const int LL_ERR_PRICE_MISMATCH = -23018;
|
||||
|
||||
#define llwarning(msg, num) llwarns << "Warning # " << num << ": " << msg << llendl;
|
||||
|
||||
#ifdef SHOW_ASSERT
|
||||
#define llassert(func) if (!(func)) llerrs << "ASSERT (" << #func << ")" << llendl;
|
||||
#else
|
||||
#define llassert(func)
|
||||
#endif
|
||||
#define llassert_always(func) if (!(func)) llerrs << "ASSERT (" << #func << ")" << llendl;
|
||||
#define llassert_always(func) if (LL_UNLIKELY(!(func))) llerrs << "ASSERT (" << #func << ")" << llendl;
|
||||
|
||||
#ifdef SHOW_ASSERT
|
||||
#define llverify(func) if (!(func)) llerrs << "ASSERT (" << #func << ")" << llendl;
|
||||
#define llassert(func) llassert_always(func)
|
||||
#define llverify(func) llassert_always(func)
|
||||
#else
|
||||
#define llverify(func) (func); // get rid of warning C4189
|
||||
#define llassert(func)
|
||||
#define llverify(func) do {if (func) {}} while(0)
|
||||
#endif
|
||||
|
||||
// handy compile-time assert - enforce those template parameters!
|
||||
|
||||
@@ -98,6 +98,17 @@ LLFILE* LLFile::_fsopen(const std::string& filename, const char* mode, int shari
|
||||
#endif
|
||||
}
|
||||
|
||||
int LLFile::close(LLFILE * file)
|
||||
{
|
||||
int ret_value = 0;
|
||||
if (file)
|
||||
{
|
||||
ret_value = fclose(file);
|
||||
}
|
||||
return ret_value;
|
||||
}
|
||||
|
||||
|
||||
int LLFile::remove(const std::string& filename)
|
||||
{
|
||||
#if LL_WINDOWS
|
||||
|
||||
@@ -77,6 +77,8 @@ public:
|
||||
static LLFILE* fopen(const std::string& filename,const char* accessmode); /* Flawfinder: ignore */
|
||||
static LLFILE* _fsopen(const std::string& filename,const char* accessmode,int sharingFlag);
|
||||
|
||||
static int close(LLFILE * file);
|
||||
|
||||
// perms is a permissions mask like 0777 or 0700. In most cases it will
|
||||
// be overridden by the user's umask. It is ignored on Windows.
|
||||
static int mkdir(const std::string& filename, int perms = 0700);
|
||||
|
||||
@@ -192,9 +192,10 @@ void LLMD5::update(std::istream& stream){
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void LLMD5::update(const std::string& s)
|
||||
{
|
||||
update((unsigned char *)s.c_str(),s.length());
|
||||
}
|
||||
|
||||
// MD5 finalization. Ends an MD5 message-digest operation, writing the
|
||||
// the message digest and zeroizing the context.
|
||||
@@ -277,7 +278,7 @@ LLMD5::LLMD5(const unsigned char *s)
|
||||
finalize();
|
||||
}
|
||||
|
||||
void LLMD5::raw_digest(unsigned char *s)
|
||||
void LLMD5::raw_digest(unsigned char *s) const
|
||||
{
|
||||
if (!finalized)
|
||||
{
|
||||
@@ -293,7 +294,7 @@ void LLMD5::raw_digest(unsigned char *s)
|
||||
|
||||
|
||||
|
||||
void LLMD5::hex_digest(char *s)
|
||||
void LLMD5::hex_digest(char *s) const
|
||||
{
|
||||
int i;
|
||||
|
||||
@@ -327,13 +328,25 @@ std::ostream& operator<<(std::ostream &stream, LLMD5 context)
|
||||
return stream;
|
||||
}
|
||||
|
||||
bool operator==(const LLMD5& a, const LLMD5& b)
|
||||
{
|
||||
unsigned char a_guts[16];
|
||||
unsigned char b_guts[16];
|
||||
a.raw_digest(a_guts);
|
||||
b.raw_digest(b_guts);
|
||||
if (memcmp(a_guts,b_guts,16)==0)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool operator!=(const LLMD5& a, const LLMD5& b)
|
||||
{
|
||||
return !(a==b);
|
||||
}
|
||||
|
||||
// PRIVATE METHODS:
|
||||
|
||||
|
||||
|
||||
void LLMD5::init(){
|
||||
finalized=0; // we just started!
|
||||
|
||||
|
||||
@@ -95,6 +95,7 @@ public:
|
||||
void update (const uint1 *input, const uint4 input_length);
|
||||
void update (std::istream& stream);
|
||||
void update (FILE *file);
|
||||
void update (const std::string& str);
|
||||
void finalize ();
|
||||
|
||||
// constructors for special circumstances. All these constructors finalize
|
||||
@@ -105,8 +106,8 @@ public:
|
||||
LLMD5 (const unsigned char *string, const unsigned int number);
|
||||
|
||||
// methods to acquire finalized result
|
||||
void raw_digest(unsigned char *array); // provide 16-byte array for binary data
|
||||
void hex_digest(char *string); // provide 33-byte array for ascii-hex string
|
||||
void raw_digest(unsigned char *array) const; // provide 16-byte array for binary data
|
||||
void hex_digest(char *string) const; // provide 33-byte array for ascii-hex string
|
||||
friend std::ostream& operator<< (std::ostream&, LLMD5 context);
|
||||
|
||||
|
||||
@@ -131,4 +132,7 @@ private:
|
||||
|
||||
};
|
||||
|
||||
LL_COMMON_API bool operator==(const LLMD5& a, const LLMD5& b);
|
||||
LL_COMMON_API bool operator!=(const LLMD5& a, const LLMD5& b);
|
||||
|
||||
#endif // LL_LLMD5_H
|
||||
|
||||
@@ -426,7 +426,16 @@ protected:
|
||||
template <typename T>
|
||||
class LLSingleton
|
||||
{
|
||||
static bool &needsInit()
|
||||
{
|
||||
static bool needs_init = true;
|
||||
return needs_init;
|
||||
}
|
||||
public:
|
||||
static bool instanceExists()
|
||||
{
|
||||
return !needsInit();
|
||||
}
|
||||
virtual ~LLSingleton() {}
|
||||
#ifdef LL_MSVC7
|
||||
// workaround for VC7 compiler bug
|
||||
@@ -445,7 +454,7 @@ public:
|
||||
#endif
|
||||
{
|
||||
static T instance;
|
||||
static bool needs_init = true;
|
||||
bool &needs_init = needsInit();
|
||||
if (needs_init)
|
||||
{
|
||||
needs_init = false;
|
||||
|
||||
@@ -349,13 +349,13 @@ namespace
|
||||
|
||||
virtual LLSD::Boolean asBoolean() const { return !mData.empty(); }
|
||||
|
||||
virtual bool has(const LLSD::String&) const;
|
||||
|
||||
using LLSD::Impl::get; // Unhiding get(LLSD::Integer)
|
||||
using LLSD::Impl::erase; // Unhiding erase(LLSD::Integer)
|
||||
using LLSD::Impl::ref; // Unhiding ref(LLSD::Integer)
|
||||
|
||||
virtual bool has(const LLSD::String&) const;
|
||||
virtual LLSD get(const LLSD::String&) const;
|
||||
LLSD& insert(const LLSD::String& k, const LLSD& v);
|
||||
void insert(const LLSD::String& k, const LLSD& v);
|
||||
virtual void erase(const LLSD::String&);
|
||||
LLSD& ref(const LLSD::String&);
|
||||
virtual const LLSD& ref(const LLSD::String&) const;
|
||||
@@ -394,14 +394,9 @@ namespace
|
||||
return (i != mData.end()) ? i->second : LLSD();
|
||||
}
|
||||
|
||||
LLSD& ImplMap::insert(const LLSD::String& k, const LLSD& v)
|
||||
void ImplMap::insert(const LLSD::String& k, const LLSD& v)
|
||||
{
|
||||
mData.insert(DataMap::value_type(k, v));
|
||||
#ifdef LL_MSVC7
|
||||
return *((LLSD*)this);
|
||||
#else
|
||||
return *dynamic_cast<LLSD*>(this);
|
||||
#endif
|
||||
}
|
||||
|
||||
void ImplMap::erase(const LLSD::String& k)
|
||||
@@ -444,15 +439,13 @@ namespace
|
||||
|
||||
virtual LLSD::Boolean asBoolean() const { return !mData.empty(); }
|
||||
|
||||
using LLSD::Impl::get; // Unhiding get(LLSD::String)
|
||||
using LLSD::Impl::erase; // Unhiding erase(LLSD::String)
|
||||
using LLSD::Impl::ref; // Unhiding ref(LLSD::String)
|
||||
virtual int size() const;
|
||||
|
||||
using LLSD::Impl::get; // Unhiding get(LLSD::Integer)
|
||||
using LLSD::Impl::erase; // Unhiding erase(LLSD::Integer)
|
||||
using LLSD::Impl::ref; // Unhiding ref(LLSD::Integer)
|
||||
|
||||
virtual LLSD get(LLSD::Integer) const;
|
||||
void set(LLSD::Integer, const LLSD&);
|
||||
LLSD& insert(LLSD::Integer, const LLSD&);
|
||||
void insert(LLSD::Integer, const LLSD&);
|
||||
void append(const LLSD&);
|
||||
virtual void erase(LLSD::Integer);
|
||||
LLSD& ref(LLSD::Integer);
|
||||
@@ -501,14 +494,10 @@ namespace
|
||||
mData[index] = v;
|
||||
}
|
||||
|
||||
LLSD& ImplArray::insert(LLSD::Integer i, const LLSD& v)
|
||||
void ImplArray::insert(LLSD::Integer i, const LLSD& v)
|
||||
{
|
||||
if (i < 0) {
|
||||
#ifdef LL_MSVC7
|
||||
return *((LLSD*)this);
|
||||
#else
|
||||
return *dynamic_cast<LLSD*>(this);
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
DataVector::size_type index = i;
|
||||
|
||||
@@ -518,11 +507,6 @@ namespace
|
||||
}
|
||||
|
||||
mData.insert(mData.begin() + index, v);
|
||||
#ifdef LL_MSVC7
|
||||
return *((LLSD*)this);
|
||||
#else
|
||||
return *dynamic_cast<LLSD*>(this);
|
||||
#endif
|
||||
}
|
||||
|
||||
void ImplArray::append(const LLSD& v)
|
||||
@@ -765,11 +749,16 @@ LLSD LLSD::emptyMap()
|
||||
|
||||
bool LLSD::has(const String& k) const { return safe(impl).has(k); }
|
||||
LLSD LLSD::get(const String& k) const { return safe(impl).get(k); }
|
||||
void LLSD::insert(const String& k, const LLSD& v) { makeMap(impl).insert(k, v); }
|
||||
|
||||
LLSD& LLSD::insert(const String& k, const LLSD& v)
|
||||
LLSD& LLSD::with(const String& k, const LLSD& v)
|
||||
{
|
||||
makeMap(impl).insert(k, v);
|
||||
return *dynamic_cast<LLSD*>(this);
|
||||
#ifdef LL_MSVC7
|
||||
return *dynamic_cast<LLSD*>(this);
|
||||
#else
|
||||
return *this;
|
||||
#endif
|
||||
}
|
||||
void LLSD::erase(const String& k) { makeMap(impl).erase(k); }
|
||||
|
||||
@@ -790,11 +779,16 @@ int LLSD::size() const { return safe(impl).size(); }
|
||||
|
||||
LLSD LLSD::get(Integer i) const { return safe(impl).get(i); }
|
||||
void LLSD::set(Integer i, const LLSD& v){ makeArray(impl).set(i, v); }
|
||||
void LLSD::insert(Integer i, const LLSD& v) { makeArray(impl).insert(i, v); }
|
||||
|
||||
LLSD& LLSD::insert(Integer i, const LLSD& v)
|
||||
LLSD& LLSD::with(Integer i, const LLSD& v)
|
||||
{
|
||||
makeArray(impl).insert(i, v);
|
||||
return *this;
|
||||
#ifdef LL_MSVC7
|
||||
return *dynamic_cast<LLSD*>(this);
|
||||
#else
|
||||
return *this;
|
||||
#endif
|
||||
}
|
||||
void LLSD::append(const LLSD& v) { makeArray(impl).append(v); }
|
||||
void LLSD::erase(Integer i) { makeArray(impl).erase(i); }
|
||||
@@ -821,9 +815,15 @@ static const char *llsd_dump(const LLSD &llsd, bool useXMLFormat)
|
||||
{
|
||||
std::ostringstream out;
|
||||
if (useXMLFormat)
|
||||
out << LLSDXMLStreamer(llsd);
|
||||
{
|
||||
LLSDXMLStreamer xml_streamer(llsd);
|
||||
out << xml_streamer;
|
||||
}
|
||||
else
|
||||
out << LLSDNotationStreamer(llsd);
|
||||
{
|
||||
LLSDNotationStreamer notation_streamer(llsd);
|
||||
out << notation_streamer;
|
||||
}
|
||||
out_string = out.str();
|
||||
}
|
||||
int len = out_string.length();
|
||||
|
||||
@@ -226,8 +226,9 @@ public:
|
||||
|
||||
bool has(const String&) const;
|
||||
LLSD get(const String&) const;
|
||||
LLSD& insert(const String&, const LLSD&);
|
||||
void insert(const String&, const LLSD&);
|
||||
void erase(const String&);
|
||||
LLSD& with(const String&, const LLSD&);
|
||||
|
||||
LLSD& operator[](const String&);
|
||||
LLSD& operator[](const char* c) { return (*this)[String(c)]; }
|
||||
@@ -241,9 +242,10 @@ public:
|
||||
|
||||
LLSD get(Integer) const;
|
||||
void set(Integer, const LLSD&);
|
||||
LLSD& insert(Integer, const LLSD&);
|
||||
void insert(Integer, const LLSD&);
|
||||
void append(const LLSD&);
|
||||
void erase(Integer);
|
||||
LLSD& with(Integer, const LLSD&);
|
||||
|
||||
const LLSD& operator[](Integer) const;
|
||||
LLSD& operator[](Integer);
|
||||
|
||||
@@ -77,7 +77,7 @@ void LLSDSerialize::serialize(const LLSD& sd, std::ostream& str, ELLSD_Serialize
|
||||
break;
|
||||
|
||||
default:
|
||||
llwarns << "serialize request for unkown ELLSD_Serialize" << llendl;
|
||||
llwarns << "serialize request for unknown ELLSD_Serialize" << llendl;
|
||||
}
|
||||
|
||||
if (f.notNull())
|
||||
|
||||
@@ -639,7 +639,7 @@ protected:
|
||||
* </code>
|
||||
*/
|
||||
template <class Formatter>
|
||||
class LLSDOStreamer : public Formatter
|
||||
class LLSDOStreamer
|
||||
{
|
||||
public:
|
||||
/**
|
||||
@@ -660,7 +660,8 @@ public:
|
||||
std::ostream& str,
|
||||
const LLSDOStreamer<Formatter>& formatter)
|
||||
{
|
||||
formatter.format(formatter.mSD, str, formatter.mOptions);
|
||||
LLPointer<Formatter> f = new Formatter;
|
||||
f->format(formatter.mSD, str, formatter.mOptions);
|
||||
return str;
|
||||
}
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ public:
|
||||
void setStride (S32 skipBytes) { mSkip = (skipBytes ? skipBytes : sizeof(Object));}
|
||||
|
||||
void skip(const U32 index) { mBytep += mSkip*index;}
|
||||
|
||||
U32 getSkip() const { return mSkip; }
|
||||
Object* get() { return mObjectp; }
|
||||
Object* operator->() { return mObjectp; }
|
||||
Object& operator *() { return *mObjectp; }
|
||||
|
||||
@@ -76,6 +76,75 @@ extern int errno;
|
||||
static const S32 CPUINFO_BUFFER_SIZE = 16383;
|
||||
LLCPUInfo gSysCPU;
|
||||
|
||||
#if LL_WINDOWS
|
||||
#ifndef DLLVERSIONINFO
|
||||
typedef struct _DllVersionInfo
|
||||
{
|
||||
DWORD cbSize;
|
||||
DWORD dwMajorVersion;
|
||||
DWORD dwMinorVersion;
|
||||
DWORD dwBuildNumber;
|
||||
DWORD dwPlatformID;
|
||||
}DLLVERSIONINFO;
|
||||
#endif
|
||||
|
||||
#ifndef DLLGETVERSIONPROC
|
||||
typedef int (FAR WINAPI *DLLGETVERSIONPROC) (DLLVERSIONINFO *);
|
||||
#endif
|
||||
|
||||
bool get_shell32_dll_version(DWORD& major, DWORD& minor, DWORD& build_number)
|
||||
{
|
||||
bool result = false;
|
||||
const U32 BUFF_SIZE = 32767;
|
||||
WCHAR tempBuf[BUFF_SIZE];
|
||||
if(GetSystemDirectory((LPWSTR)&tempBuf, BUFF_SIZE))
|
||||
{
|
||||
|
||||
std::basic_string<WCHAR> shell32_path(tempBuf);
|
||||
|
||||
// Shell32.dll contains the DLLGetVersion function.
|
||||
// according to msdn its not part of the API
|
||||
// so you have to go in and get it.
|
||||
// http://msdn.microsoft.com/en-us/library/bb776404(VS.85).aspx
|
||||
shell32_path += TEXT("\\shell32.dll");
|
||||
|
||||
HMODULE hDllInst = LoadLibrary(shell32_path.c_str()); //load the DLL
|
||||
if(hDllInst)
|
||||
{ // Could successfully load the DLL
|
||||
DLLGETVERSIONPROC pDllGetVersion;
|
||||
/*
|
||||
You must get this function explicitly because earlier versions of the DLL
|
||||
don't implement this function. That makes the lack of implementation of the
|
||||
function a version marker in itself.
|
||||
*/
|
||||
pDllGetVersion = (DLLGETVERSIONPROC) GetProcAddress(hDllInst,
|
||||
"DllGetVersion");
|
||||
|
||||
if(pDllGetVersion)
|
||||
{
|
||||
// DLL supports version retrieval function
|
||||
DLLVERSIONINFO dvi;
|
||||
|
||||
ZeroMemory(&dvi, sizeof(dvi));
|
||||
dvi.cbSize = sizeof(dvi);
|
||||
HRESULT hr = (*pDllGetVersion)(&dvi);
|
||||
|
||||
if(SUCCEEDED(hr))
|
||||
{ // Finally, the version is at our hands
|
||||
major = dvi.dwMajorVersion;
|
||||
minor = dvi.dwMinorVersion;
|
||||
build_number = dvi.dwBuildNumber;
|
||||
result = true;
|
||||
}
|
||||
}
|
||||
|
||||
FreeLibrary(hDllInst); // Release DLL
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
#endif // LL_WINDOWS
|
||||
|
||||
LLOSInfo::LLOSInfo() :
|
||||
mMajorVer(0), mMinorVer(0), mBuild(0)
|
||||
{
|
||||
@@ -98,6 +167,11 @@ LLOSInfo::LLOSInfo() :
|
||||
mMinorVer = osvi.dwMinorVersion;
|
||||
mBuild = osvi.dwBuildNumber;
|
||||
|
||||
DWORD shell32_major, shell32_minor, shell32_build;
|
||||
bool got_shell32_version = get_shell32_dll_version(shell32_major,
|
||||
shell32_minor,
|
||||
shell32_build);
|
||||
|
||||
switch(osvi.dwPlatformId)
|
||||
{
|
||||
case VER_PLATFORM_WIN32_NT:
|
||||
@@ -122,14 +196,50 @@ LLOSInfo::LLOSInfo() :
|
||||
else
|
||||
mOSStringSimple = "Microsoft Windows Server 2003 ";
|
||||
}
|
||||
else if(osvi.dwMajorVersion == 6 && osvi.dwMinorVersion == 0)
|
||||
else if(osvi.dwMajorVersion == 6 && osvi.dwMinorVersion <= 1)
|
||||
{
|
||||
if(osvi.wProductType == VER_NT_WORKSTATION)
|
||||
if(osvi.dwMinorVersion == 0)
|
||||
{
|
||||
mOSStringSimple = "Microsoft Windows Vista ";
|
||||
else mOSStringSimple = "Microsoft Windows Vista Server ";
|
||||
}
|
||||
else if(osvi.dwMinorVersion == 1)
|
||||
{
|
||||
mOSStringSimple = "Microsoft Windows 7 ";
|
||||
}
|
||||
|
||||
if(osvi.wProductType != VER_NT_WORKSTATION)
|
||||
{
|
||||
mOSStringSimple += "Server ";
|
||||
}
|
||||
|
||||
///get native system info if available..
|
||||
typedef void (WINAPI *PGNSI)(LPSYSTEM_INFO); ///function pointer for loading GetNativeSystemInfo
|
||||
SYSTEM_INFO si; //System Info object file contains architecture info
|
||||
PGNSI pGNSI; //pointer object
|
||||
ZeroMemory(&si, sizeof(SYSTEM_INFO)); //zero out the memory in information
|
||||
pGNSI = (PGNSI) GetProcAddress(GetModuleHandle(TEXT("kernel32.dll")), "GetNativeSystemInfo"); //load kernel32 get function
|
||||
if(NULL != pGNSI) //check if it has failed
|
||||
pGNSI(&si); //success
|
||||
else
|
||||
GetSystemInfo(&si); //if it fails get regular system info
|
||||
//(Warning: If GetSystemInfo it may result in incorrect information in a WOW64 machine, if the kernel fails to load)
|
||||
|
||||
//msdn microsoft finds 32 bit and 64 bit flavors this way..
|
||||
//http://msdn.microsoft.com/en-us/library/ms724429(VS.85).aspx (example code that contains quite a few more flavors
|
||||
//of windows than this code does (in case it is needed for the future)
|
||||
if ( si.wProcessorArchitecture==PROCESSOR_ARCHITECTURE_AMD64 ) //check for 64 bit
|
||||
{
|
||||
mOSStringSimple += "64-bit ";
|
||||
}
|
||||
else if (si.wProcessorArchitecture==PROCESSOR_ARCHITECTURE_INTEL )
|
||||
{
|
||||
mOSStringSimple += "32-bit ";
|
||||
}
|
||||
}
|
||||
else // Use the registry on early versions of Windows NT.
|
||||
{
|
||||
mOSStringSimple = "Microsoft Windows (unrecognized) ";
|
||||
|
||||
HKEY hKey;
|
||||
WCHAR szProductType[80];
|
||||
DWORD dwBufLen;
|
||||
@@ -170,6 +280,7 @@ LLOSInfo::LLOSInfo() :
|
||||
csdversion.c_str(),
|
||||
(osvi.dwBuildNumber & 0xffff));
|
||||
}
|
||||
|
||||
mOSString = mOSStringSimple + tmpstr;
|
||||
}
|
||||
break;
|
||||
@@ -199,6 +310,21 @@ LLOSInfo::LLOSInfo() :
|
||||
mOSString = mOSStringSimple;
|
||||
break;
|
||||
}
|
||||
|
||||
std::string compatibility_mode;
|
||||
if(got_shell32_version)
|
||||
{
|
||||
if(osvi.dwMajorVersion != shell32_major
|
||||
|| osvi.dwMinorVersion != shell32_minor)
|
||||
{
|
||||
compatibility_mode = llformat(" compatibility mode. real ver: %d.%d (Build %d)",
|
||||
shell32_major,
|
||||
shell32_minor,
|
||||
shell32_build);
|
||||
}
|
||||
}
|
||||
mOSString += compatibility_mode;
|
||||
|
||||
#else
|
||||
struct utsname un;
|
||||
if(uname(&un) != -1)
|
||||
@@ -226,8 +352,8 @@ LLOSInfo::LLOSInfo() :
|
||||
else if (ostype == "Linux")
|
||||
{
|
||||
// Only care about major and minor Linux versions, truncate at second '.'
|
||||
S32 idx1 = mOSStringSimple.find_first_of(".", 0);
|
||||
S32 idx2 = (idx1 != std::string::npos) ? mOSStringSimple.find_first_of(".", idx1+1) : std::string::npos;
|
||||
std::string::size_type idx1 = mOSStringSimple.find_first_of(".", 0);
|
||||
std::string::size_type idx2 = (idx1 != std::string::npos) ? mOSStringSimple.find_first_of(".", idx1+1) : std::string::npos;
|
||||
std::string simple = mOSStringSimple.substr(0, idx2);
|
||||
if (simple.length() > 0)
|
||||
mOSStringSimple = simple;
|
||||
@@ -393,15 +519,15 @@ LLCPUInfo::LLCPUInfo()
|
||||
mHasSSE = info->_Ext.SSE_StreamingSIMD_Extensions;
|
||||
mHasSSE2 = info->_Ext.SSE2_StreamingSIMD2_Extensions;
|
||||
mHasAltivec = info->_Ext.Altivec_Extensions;
|
||||
mCPUMhz = (S32)(proc.GetCPUFrequency(50)/1000000.0);
|
||||
mCPUMHz = (F64)(proc.GetCPUFrequency(50)/1000000.0);
|
||||
mFamily.assign( info->strFamily );
|
||||
mCPUString = "Unknown";
|
||||
|
||||
#if LL_WINDOWS || LL_DARWIN || LL_SOLARIS
|
||||
out << proc.strCPUName;
|
||||
if (200 < mCPUMhz && mCPUMhz < 10000) // *NOTE: cpu speed is often way wrong, do a sanity check
|
||||
if (200 < mCPUMHz && mCPUMHz < 10000) // *NOTE: cpu speed is often way wrong, do a sanity check
|
||||
{
|
||||
out << " (" << mCPUMhz << " MHz)";
|
||||
out << " (" << mCPUMHz << " MHz)";
|
||||
}
|
||||
mCPUString = out.str();
|
||||
|
||||
@@ -446,7 +572,7 @@ LLCPUInfo::LLCPUInfo()
|
||||
if (LLStringUtil::convertToF64(cpuinfo["cpu mhz"], mhz)
|
||||
&& 200.0 < mhz && mhz < 10000.0)
|
||||
{
|
||||
mCPUMhz = (S32)llrint(mhz);
|
||||
mCPUMHz = (F64)llrint(mhz);
|
||||
}
|
||||
if (!cpuinfo["model name"].empty())
|
||||
mCPUString = cpuinfo["model name"];
|
||||
@@ -469,9 +595,9 @@ bool LLCPUInfo::hasSSE2() const
|
||||
return mHasSSE2;
|
||||
}
|
||||
|
||||
S32 LLCPUInfo::getMhz() const
|
||||
F64 LLCPUInfo::getMHz() const
|
||||
{
|
||||
return mCPUMhz;
|
||||
return mCPUMHz;
|
||||
}
|
||||
|
||||
std::string LLCPUInfo::getCPUString() const
|
||||
@@ -518,7 +644,7 @@ void LLCPUInfo::stream(std::ostream& s) const
|
||||
s << "->mHasSSE: " << (U32)mHasSSE << std::endl;
|
||||
s << "->mHasSSE2: " << (U32)mHasSSE2 << std::endl;
|
||||
s << "->mHasAltivec: " << (U32)mHasAltivec << std::endl;
|
||||
s << "->mCPUMhz: " << mCPUMhz << std::endl;
|
||||
s << "->mCPUMHz: " << mCPUMHz << std::endl;
|
||||
s << "->mCPUString: " << mCPUString << std::endl;
|
||||
}
|
||||
|
||||
@@ -595,6 +721,26 @@ U32 LLMemoryInfo::getPhysicalMemoryClamped() const
|
||||
}
|
||||
}
|
||||
|
||||
//static
|
||||
void LLMemoryInfo::getAvailableMemoryKB(U32& avail_physical_mem_kb, U32& avail_virtual_mem_kb)
|
||||
{
|
||||
#if LL_WINDOWS
|
||||
MEMORYSTATUSEX state;
|
||||
state.dwLength = sizeof(state);
|
||||
GlobalMemoryStatusEx(&state);
|
||||
|
||||
avail_physical_mem_kb = (U32)(state.ullAvailPhys/1024) ;
|
||||
avail_virtual_mem_kb = (U32)(state.ullAvailVirtual/1024) ;
|
||||
|
||||
#else
|
||||
//do not know how to collect available memory info for other systems.
|
||||
//leave it blank here for now.
|
||||
|
||||
avail_physical_mem_kb = -1 ;
|
||||
avail_virtual_mem_kb = -1 ;
|
||||
#endif
|
||||
}
|
||||
|
||||
void LLMemoryInfo::stream(std::ostream& s) const
|
||||
{
|
||||
#if LL_WINDOWS
|
||||
|
||||
@@ -81,7 +81,7 @@ public:
|
||||
bool hasAltivec() const;
|
||||
bool hasSSE() const;
|
||||
bool hasSSE2() const;
|
||||
S32 getMhz() const;
|
||||
F64 getMHz() const;
|
||||
|
||||
// Family is "AMD Duron" or "Intel Pentium Pro"
|
||||
const std::string& getFamily() const { return mFamily; }
|
||||
@@ -90,7 +90,7 @@ private:
|
||||
bool mHasSSE;
|
||||
bool mHasSSE2;
|
||||
bool mHasAltivec;
|
||||
S32 mCPUMhz;
|
||||
F64 mCPUMHz;
|
||||
std::string mFamily;
|
||||
std::string mCPUString;
|
||||
};
|
||||
@@ -120,6 +120,9 @@ public:
|
||||
** be returned.
|
||||
*/
|
||||
U32 getPhysicalMemoryClamped() const; ///< Memory size in clamped bytes
|
||||
|
||||
//get the available memory infomation in KiloBytes.
|
||||
static void getAvailableMemoryKB(U32& avail_physical_mem_kb, U32& avail_virtual_mem_kb);
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -46,10 +46,21 @@
|
||||
|
||||
void encode_character(std::ostream& ostr, std::string::value_type val)
|
||||
{
|
||||
ostr << "%" << std::uppercase << std::hex << std::setw(2) << std::setfill('0')
|
||||
ostr << "%"
|
||||
|
||||
<< std::uppercase
|
||||
<< std::hex
|
||||
<< std::setw(2)
|
||||
<< std::setfill('0')
|
||||
|
||||
// VWR-4010 Cannot cast to U32 because sign-extension on
|
||||
// chars > 128 will result in FFFFFFC3 instead of F3.
|
||||
<< static_cast<S32>(static_cast<U8>(val));
|
||||
<< static_cast<S32>(static_cast<U8>(val))
|
||||
|
||||
// reset stream state
|
||||
<< std::nouppercase
|
||||
<< std::dec
|
||||
<< std::setfill(' ');
|
||||
}
|
||||
|
||||
// static
|
||||
@@ -221,7 +232,8 @@ static BOOL isDefault(const std::string& scheme, U16 port)
|
||||
void LLURI::parseAuthorityAndPathUsingOpaque()
|
||||
{
|
||||
if (mScheme == "http" || mScheme == "https" ||
|
||||
mScheme == "ftp" || mScheme == "secondlife" )
|
||||
mScheme == "ftp" || mScheme == "secondlife" ||
|
||||
mScheme == "x-grid-location-info")
|
||||
{
|
||||
if (mEscapedOpaque.substr(0,2) != "//")
|
||||
{
|
||||
|
||||
@@ -35,8 +35,8 @@
|
||||
|
||||
const S32 LL_VERSION_MAJOR = 1;
|
||||
const S32 LL_VERSION_MINOR = 5;
|
||||
const S32 LL_VERSION_PATCH = 5;
|
||||
const S32 LL_VERSION_BUILD = 0;
|
||||
const S32 LL_VERSION_PATCH = 6;
|
||||
const S32 LL_VERSION_BUILD = 1;
|
||||
|
||||
const char * const LL_CHANNEL = "Singularity";
|
||||
|
||||
|
||||
@@ -139,7 +139,7 @@ void LLImageBase::sanityCheck()
|
||||
void LLImageBase::deleteData()
|
||||
{
|
||||
if(mData)
|
||||
free(mData);//delete[] mData;
|
||||
delete[] mData;
|
||||
mData = NULL;
|
||||
mDataSize = 0;
|
||||
}
|
||||
@@ -166,17 +166,14 @@ U8* LLImageBase::allocateData(S32 size)
|
||||
{
|
||||
deleteData(); // virtual
|
||||
mBadBufferAllocation = FALSE ;
|
||||
U8 *data = (U8 *)realloc(mData,sizeof(U8)*size);//new U8[size];
|
||||
if (!data)
|
||||
mData = new U8[size];
|
||||
if (!mData)
|
||||
{
|
||||
if(mData)
|
||||
free(mData);
|
||||
llwarns << "allocate image data: " << size << llendl;
|
||||
size = 0 ;
|
||||
mWidth = mHeight = 0 ;
|
||||
mBadBufferAllocation = TRUE ;
|
||||
}
|
||||
mData = data;
|
||||
mDataSize = size;
|
||||
}
|
||||
|
||||
@@ -186,17 +183,25 @@ U8* LLImageBase::allocateData(S32 size)
|
||||
// virtual
|
||||
U8* LLImageBase::reallocateData(S32 size)
|
||||
{
|
||||
LLMemType mt1((LLMemType::EMemType)mMemType);
|
||||
U8 *data = (U8 *)realloc(mData,sizeof(U8)*size);
|
||||
if(data)
|
||||
{
|
||||
mData = data;
|
||||
mDataSize = size;
|
||||
}
|
||||
else
|
||||
llwarns << "Out of memory in LLImageBase::reallocateData" << llendl;
|
||||
if(mData && (mDataSize == size))
|
||||
return mData;
|
||||
|
||||
return data;
|
||||
LLMemType mt1((LLMemType::EMemType)mMemType);
|
||||
U8 *new_datap = new U8[size];
|
||||
if (!new_datap)
|
||||
{
|
||||
llwarns << "Out of memory in LLImageBase::reallocateData" << llendl;
|
||||
return 0;
|
||||
}
|
||||
if (mData)
|
||||
{
|
||||
S32 bytes = llmin(mDataSize, size);
|
||||
memcpy(new_datap, mData, bytes); /* Flawfinder: ignore */
|
||||
delete[] mData;
|
||||
}
|
||||
mData = new_datap;
|
||||
mDataSize = size;
|
||||
return mData;
|
||||
}
|
||||
|
||||
const U8* LLImageBase::getData() const
|
||||
@@ -243,16 +248,17 @@ U8* LLImageBase::allocateDataSize(S32 width, S32 height, S32 ncomponents, S32 si
|
||||
|
||||
S32 LLImageRaw::sGlobalRawMemory = 0;
|
||||
S32 LLImageRaw::sRawImageCount = 0;
|
||||
S32 LLImageRaw::sRawImageCachedCount = 0;
|
||||
|
||||
LLImageRaw::LLImageRaw()
|
||||
: LLImageBase()
|
||||
: LLImageBase(), mCacheEntries(0)
|
||||
{
|
||||
mMemType = LLMemType::MTYPE_IMAGERAW;
|
||||
++sRawImageCount;
|
||||
}
|
||||
|
||||
LLImageRaw::LLImageRaw(U16 width, U16 height, S8 components)
|
||||
: LLImageBase()
|
||||
: LLImageBase(), mCacheEntries(0)
|
||||
{
|
||||
mMemType = LLMemType::MTYPE_IMAGERAW;
|
||||
llassert( S32(width) * S32(height) * S32(components) <= MAX_IMAGE_DATA_SIZE );
|
||||
@@ -261,7 +267,7 @@ LLImageRaw::LLImageRaw(U16 width, U16 height, S8 components)
|
||||
}
|
||||
|
||||
LLImageRaw::LLImageRaw(U8 *data, U16 width, U16 height, S8 components)
|
||||
: LLImageBase()
|
||||
: LLImageBase(), mCacheEntries(0)
|
||||
{
|
||||
mMemType = LLMemType::MTYPE_IMAGERAW;
|
||||
if(allocateDataSize(width, height, components) && data)
|
||||
@@ -272,7 +278,7 @@ LLImageRaw::LLImageRaw(U8 *data, U16 width, U16 height, S8 components)
|
||||
}
|
||||
|
||||
LLImageRaw::LLImageRaw(const std::string& filename, bool j2c_lowest_mip_only)
|
||||
: LLImageBase()
|
||||
: LLImageBase(), mCacheEntries(0)
|
||||
{
|
||||
createFromFile(filename, j2c_lowest_mip_only);
|
||||
}
|
||||
@@ -283,6 +289,7 @@ LLImageRaw::~LLImageRaw()
|
||||
// NOT LLImageRaw::deleteData()
|
||||
deleteData();
|
||||
--sRawImageCount;
|
||||
setInCache(false);
|
||||
}
|
||||
|
||||
// virtual
|
||||
@@ -309,6 +316,21 @@ void LLImageRaw::deleteData()
|
||||
LLImageBase::deleteData();
|
||||
}
|
||||
|
||||
void LLImageRaw::setDataAndSize(U8 *data, S32 width, S32 height, S8 components)
|
||||
{
|
||||
if(data == getData())
|
||||
{
|
||||
return ;
|
||||
}
|
||||
|
||||
deleteData();
|
||||
|
||||
LLImageBase::setSize(width, height, components) ;
|
||||
LLImageBase::setDataAndSize(data, width * height * components) ;
|
||||
|
||||
sGlobalRawMemory += getDataSize();
|
||||
}
|
||||
|
||||
BOOL LLImageRaw::resize(U16 width, U16 height, S8 components)
|
||||
{
|
||||
if ((getWidth() == width) && (getHeight() == height) && (getComponents() == components))
|
||||
@@ -556,6 +578,11 @@ void LLImageRaw::compositeScaled4onto3(LLImageRaw* src)
|
||||
// Vertical: scale but no composite
|
||||
S32 temp_data_size = src->getWidth() * dst->getHeight() * src->getComponents();
|
||||
U8* temp_buffer = new U8[ temp_data_size ];
|
||||
if (!temp_buffer )
|
||||
{
|
||||
llerrs << "Out of memory in LLImageRaw::compositeScaled4onto3()" << llendl;
|
||||
return;
|
||||
}
|
||||
for( S32 col = 0; col < src->getWidth(); col++ )
|
||||
{
|
||||
copyLineScaled( src->getData() + (src->getComponents() * col), temp_buffer + (src->getComponents() * col), src->getHeight(), dst->getHeight(), src->getWidth(), src->getWidth() );
|
||||
@@ -808,6 +835,11 @@ void LLImageRaw::copyScaled( LLImageRaw* src )
|
||||
S32 temp_data_size = src->getWidth() * dst->getHeight() * getComponents();
|
||||
llassert_always(temp_data_size > 0);
|
||||
U8* temp_buffer = new U8[ temp_data_size ];
|
||||
if (!temp_buffer )
|
||||
{
|
||||
llerrs << "Out of memory in LLImageRaw::copyScaled()" << llendl;
|
||||
return;
|
||||
}
|
||||
for( S32 col = 0; col < src->getWidth(); col++ )
|
||||
{
|
||||
copyLineScaled( src->getData() + (getComponents() * col), temp_buffer + (getComponents() * col), src->getHeight(), dst->getHeight(), src->getWidth(), src->getWidth() );
|
||||
@@ -824,6 +856,52 @@ void LLImageRaw::copyScaled( LLImageRaw* src )
|
||||
}
|
||||
|
||||
|
||||
//scale down image by not blending a pixel with its neighbors.
|
||||
BOOL LLImageRaw::scaleDownWithoutBlending( S32 new_width, S32 new_height)
|
||||
{
|
||||
LLMemType mt1((LLMemType::EMemType)mMemType);
|
||||
|
||||
S8 c = getComponents() ;
|
||||
llassert((1 == c) || (3 == c) || (4 == c) );
|
||||
|
||||
S32 old_width = getWidth();
|
||||
S32 old_height = getHeight();
|
||||
|
||||
S32 new_data_size = old_width * new_height * c ;
|
||||
llassert_always(new_data_size > 0);
|
||||
|
||||
F32 ratio_x = (F32)old_width / new_width ;
|
||||
F32 ratio_y = (F32)old_height / new_height ;
|
||||
if( ratio_x < 1.0f || ratio_y < 1.0f )
|
||||
{
|
||||
return TRUE; // Nothing to do.
|
||||
}
|
||||
ratio_x -= 1.0f ;
|
||||
ratio_y -= 1.0f ;
|
||||
|
||||
U8* new_data = new U8[new_data_size] ;
|
||||
llassert_always(new_data != NULL) ;
|
||||
|
||||
U8* old_data = getData() ;
|
||||
S32 i, j, k, s, t;
|
||||
for(i = 0, s = 0, t = 0 ; i < new_height ; i++)
|
||||
{
|
||||
for(j = 0 ; j < new_width ; j++)
|
||||
{
|
||||
for(k = 0 ; k < c ; k++)
|
||||
{
|
||||
new_data[s++] = old_data[t++] ;
|
||||
}
|
||||
t += (S32)(ratio_x * c + 0.1f) ;
|
||||
}
|
||||
t += (S32)(ratio_y * old_width * c + 0.1f) ;
|
||||
}
|
||||
|
||||
setDataAndSize(new_data, new_width, new_height, c) ;
|
||||
|
||||
return TRUE ;
|
||||
}
|
||||
|
||||
BOOL LLImageRaw::scale( S32 new_width, S32 new_height, BOOL scale_image_data )
|
||||
{
|
||||
LLMemType mt1((LLMemType::EMemType)mMemType);
|
||||
@@ -845,6 +923,11 @@ BOOL LLImageRaw::scale( S32 new_width, S32 new_height, BOOL scale_image_data )
|
||||
S32 temp_data_size = old_width * new_height * getComponents();
|
||||
llassert_always(temp_data_size > 0);
|
||||
U8* temp_buffer = new U8[ temp_data_size ];
|
||||
if (!temp_buffer )
|
||||
{
|
||||
llerrs << "Out of memory in LLImageRaw::scale()" << llendl;
|
||||
return FALSE;
|
||||
}
|
||||
for( S32 col = 0; col < old_width; col++ )
|
||||
{
|
||||
copyLineScaled( getData() + (getComponents() * col), temp_buffer + (getComponents() * col), old_height, new_height, old_width, old_width );
|
||||
|
||||
@@ -189,6 +189,7 @@ public:
|
||||
void contractToPowerOfTwo(S32 max_dim = MAX_IMAGE_SIZE, BOOL scale_image = TRUE);
|
||||
void biasedScaleToPowerOfTwo(S32 max_dim = MAX_IMAGE_SIZE);
|
||||
BOOL scale( S32 new_width, S32 new_height, BOOL scale_image = TRUE );
|
||||
BOOL scaleDownWithoutBlending( S32 new_width, S32 new_height) ;
|
||||
|
||||
// Fill the buffer with a constant color
|
||||
void fill( const LLColor4U& color );
|
||||
@@ -237,9 +238,29 @@ protected:
|
||||
|
||||
U8 fastFractionalMult(U8 a,U8 b);
|
||||
|
||||
void setDataAndSize(U8 *data, S32 width, S32 height, S8 components) ;
|
||||
|
||||
public:
|
||||
static S32 sGlobalRawMemory;
|
||||
static S32 sRawImageCount;
|
||||
|
||||
static S32 sRawImageCachedCount;
|
||||
S32 mCacheEntries;
|
||||
void setInCache(bool in_cache)
|
||||
{
|
||||
if(in_cache)
|
||||
{
|
||||
if(!mCacheEntries)
|
||||
sRawImageCachedCount++;
|
||||
mCacheEntries++;
|
||||
}
|
||||
else if(mCacheEntries)
|
||||
{
|
||||
mCacheEntries--;
|
||||
if(!mCacheEntries)
|
||||
sRawImageCachedCount--;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// Compressed representation of image.
|
||||
|
||||
@@ -179,8 +179,8 @@ LLImageJ2C::LLImageJ2C() : LLImageFormatted(IMG_CODEC_J2C),
|
||||
mMaxBytes(0),
|
||||
mRawDiscardLevel(-1),
|
||||
mRate(0.0f),
|
||||
mReversible(FALSE)
|
||||
|
||||
mReversible(FALSE),
|
||||
mAreaUsedForDataSizeCalcs(0)
|
||||
{
|
||||
//We assume here that if we wanted to create via
|
||||
//a dynamic library that the approriate open calls were made
|
||||
@@ -196,6 +196,13 @@ LLImageJ2C::LLImageJ2C() : LLImageFormatted(IMG_CODEC_J2C),
|
||||
}
|
||||
|
||||
mImpl = j2cimpl_create_func();
|
||||
|
||||
// Clear data size table
|
||||
for( S32 i = 0; i <= MAX_DISCARD_LEVEL; i++)
|
||||
{ // Array size is MAX_DISCARD_LEVEL+1
|
||||
mDataSizes[i] = 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// virtual
|
||||
@@ -371,9 +378,44 @@ S32 LLImageJ2C::calcHeaderSize()
|
||||
return calcHeaderSizeJ2C();
|
||||
}
|
||||
|
||||
// calcDataSize() returns how many bytes to read
|
||||
// to load discard_level (including header and higher discard levels)
|
||||
S32 LLImageJ2C::calcDataSize(S32 discard_level)
|
||||
{
|
||||
return calcDataSizeJ2C(getWidth(), getHeight(), getComponents(), discard_level, mRate);
|
||||
discard_level = llclamp(discard_level, 0, MAX_DISCARD_LEVEL);
|
||||
|
||||
if ( mAreaUsedForDataSizeCalcs != (getHeight() * getWidth())
|
||||
|| mDataSizes[0] == 0)
|
||||
{
|
||||
mAreaUsedForDataSizeCalcs = getHeight() * getWidth();
|
||||
|
||||
S32 level = MAX_DISCARD_LEVEL; // Start at the highest discard
|
||||
while ( level >= 0 )
|
||||
{
|
||||
mDataSizes[level] = calcDataSizeJ2C(getWidth(), getHeight(), getComponents(), level, mRate);
|
||||
level--;
|
||||
}
|
||||
|
||||
/* This is technically a more correct way to calculate the size required
|
||||
for each discard level, since they should include the size needed for
|
||||
lower levels. Unfortunately, this doesn't work well and will lead to
|
||||
download stalls. The true correct way is to parse the header. This will
|
||||
all go away with http textures at some point.
|
||||
|
||||
// Calculate the size for each discard level. Lower levels (higher quality)
|
||||
// contain the cumulative size of higher levels
|
||||
S32 total_size = calcHeaderSizeJ2C();
|
||||
|
||||
S32 level = MAX_DISCARD_LEVEL; // Start at the highest discard
|
||||
while ( level >= 0 )
|
||||
{ // Add in this discard level and all before it
|
||||
total_size += calcDataSizeJ2C(getWidth(), getHeight(), getComponents(), level, mRate);
|
||||
mDataSizes[level] = total_size;
|
||||
level--;
|
||||
}
|
||||
*/
|
||||
}
|
||||
return mDataSizes[discard_level];
|
||||
}
|
||||
|
||||
S32 LLImageJ2C::calcDiscardLevelBytes(S32 bytes)
|
||||
|
||||
@@ -87,6 +87,8 @@ protected:
|
||||
void updateRawDiscardLevel();
|
||||
|
||||
S32 mMaxBytes; // Maximum number of bytes of data to use...
|
||||
S32 mDataSizes[MAX_DISCARD_LEVEL+1]; // Size of data required to reach a given level
|
||||
U32 mAreaUsedForDataSizeCalcs; // Height * width used to calculate mDataSizes
|
||||
S8 mRawDiscardLevel;
|
||||
F32 mRate;
|
||||
BOOL mReversible;
|
||||
|
||||
@@ -35,8 +35,6 @@
|
||||
|
||||
#include <csetjmp>
|
||||
|
||||
#include "llimage.h"
|
||||
|
||||
extern "C" {
|
||||
#ifdef LL_STANDALONE
|
||||
# include <jpeglib.h>
|
||||
@@ -47,6 +45,8 @@ extern "C" {
|
||||
#endif
|
||||
}
|
||||
|
||||
#include "llimage.h"
|
||||
|
||||
class LLImageJPEG : public LLImageFormatted
|
||||
{
|
||||
protected:
|
||||
|
||||
@@ -131,6 +131,7 @@ BOOL LLImagePNG::encode(const LLImageRaw* raw_image, F32 encode_time)
|
||||
if (! pngWrapper.writePng(raw_image, getData()))
|
||||
{
|
||||
setLastError(pngWrapper.getErrorMessage());
|
||||
deleteData();
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -138,6 +139,7 @@ BOOL LLImagePNG::encode(const LLImageRaw* raw_image, F32 encode_time)
|
||||
if(!reallocateData(pngWrapper.getFinalSize())) //Shrink. Returns NULL on failure.
|
||||
{
|
||||
setLastError("LLImagePNG::encode failed reallocateData");
|
||||
deleteData();
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
|
||||
@@ -171,7 +171,7 @@ void LLImageDecodeThread::ImageRequest::finishRequest(bool completed)
|
||||
{
|
||||
if (mResponder.notNull())
|
||||
{
|
||||
bool success = completed && mDecodedRaw && (!mNeedsAux || mDecodedAux);
|
||||
bool success = completed && mDecodedRaw && mDecodedImageRaw->getDataSize() && (!mNeedsAux || mDecodedAux);
|
||||
mResponder->completed(success, mDecodedImageRaw, mDecodedImageAux);
|
||||
}
|
||||
// Will automatically be deleted
|
||||
|
||||
@@ -151,13 +151,8 @@ BOOL LLImageJ2COJ::decodeImpl(LLImageJ2C &base, LLImageRaw &raw_image, F32 decod
|
||||
/* open a byte stream */
|
||||
cio = opj_cio_open((opj_common_ptr)dinfo, base.getData(), base.getDataSize());
|
||||
|
||||
/* decode the stream and fill the image structure, also fill in an additional
|
||||
structure to get the decoding result. This structure is a bit unusual in that
|
||||
it is not received through opj, but still has some dynamically allocated fields
|
||||
that need to be cleared up at the end by calling a destroy function. */
|
||||
opj_codestream_info_t cinfo;
|
||||
memset(&cinfo, 0, sizeof(opj_codestream_info_t));
|
||||
image = opj_decode_with_info(dinfo, cio, &cinfo);
|
||||
/* decode the stream and fill the image structure */
|
||||
image = opj_decode(dinfo, cio);
|
||||
|
||||
/* close the byte stream */
|
||||
opj_cio_close(cio);
|
||||
@@ -171,70 +166,45 @@ BOOL LLImageJ2COJ::decodeImpl(LLImageJ2C &base, LLImageRaw &raw_image, F32 decod
|
||||
// The image decode failed if the return was NULL or the component
|
||||
// count was zero. The latter is just a sanity check before we
|
||||
// dereference the array.
|
||||
if(!image)
|
||||
if(!image || !image->numcomps)
|
||||
{
|
||||
LL_DEBUGS("Openjpeg") << "ERROR -> decodeImpl: failed to decode image - no image" << LL_ENDL;
|
||||
return TRUE; // done
|
||||
}
|
||||
|
||||
S32 img_components = image->numcomps;
|
||||
|
||||
if( !img_components ) // < 1 ||img_components > 4 )
|
||||
{
|
||||
LL_DEBUGS("Openjpeg") << "ERROR -> decodeImpl: failed to decode image wrong number of components: " << img_components << LL_ENDL;
|
||||
llwarns << "ERROR -> decodeImpl: failed to decode image!" << llendl;
|
||||
if (image)
|
||||
{
|
||||
opj_destroy_cstr_info(&cinfo);
|
||||
opj_image_destroy(image);
|
||||
}
|
||||
|
||||
base.decodeFailed();
|
||||
return TRUE; // done
|
||||
}
|
||||
|
||||
// sometimes we get bad data out of the cache - check to see if the decode succeeded
|
||||
int decompdifference = 0;
|
||||
if (cinfo.numdecompos) // sanity
|
||||
for (S32 i = 0; i < image->numcomps; i++)
|
||||
{
|
||||
for (int comp = 0; comp < image->numcomps; comp++)
|
||||
{ /* get maximum decomposition level difference, first field is from the COD header and the second
|
||||
is what is actually met in the codestream, NB: if everything was ok, this calculation will
|
||||
return what was set in the cp_reduce value! */
|
||||
decompdifference = llmax(decompdifference, cinfo.numdecompos[comp] - image->comps[comp].resno_decoded);
|
||||
}
|
||||
if (decompdifference < 0) // sanity
|
||||
if (image->comps[i].factor != base.getRawDiscardLevel())
|
||||
{
|
||||
decompdifference = 0;
|
||||
// if we didn't get the discard level we're expecting, fail
|
||||
opj_image_destroy(image);
|
||||
base.decodeFailed();
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* if OpenJPEG failed to decode all requested decomposition levels
|
||||
the difference will be greater than this level */
|
||||
if (decompdifference > base.getRawDiscardLevel())
|
||||
if(image->numcomps <= first_channel)
|
||||
{
|
||||
llwarns << "not enough data for requested discard level, setting mDecoding to FALSE, difference: " << (decompdifference - base.getRawDiscardLevel()) << llendl;
|
||||
opj_destroy_cstr_info(&cinfo);
|
||||
opj_image_destroy(image);
|
||||
base.mDecoding = FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if(img_components <= first_channel)
|
||||
{
|
||||
// sanity
|
||||
LL_DEBUGS("Openjpeg") << "trying to decode more channels than are present in image: numcomps: " << img_components << " first_channel: " << first_channel << LL_ENDL;
|
||||
llwarns << "trying to decode more channels than are present in image: numcomps: " << image->numcomps << " first_channel: " << first_channel << llendl;
|
||||
if (image)
|
||||
{
|
||||
opj_destroy_cstr_info(&cinfo);
|
||||
opj_image_destroy(image);
|
||||
}
|
||||
|
||||
|
||||
base.decodeFailed();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// Copy image data into our raw image format (instead of the separate channel format
|
||||
|
||||
|
||||
S32 img_components = image->numcomps;
|
||||
S32 channels = img_components - first_channel;
|
||||
if( channels > max_channel_count )
|
||||
channels = max_channel_count;
|
||||
@@ -274,19 +244,15 @@ BOOL LLImageJ2COJ::decodeImpl(LLImageJ2C &base, LLImageRaw &raw_image, F32 decod
|
||||
else // Some rare OpenJPEG versions have this bug.
|
||||
{
|
||||
llwarns << "ERROR -> decodeImpl: failed to decode image! (NULL comp data - OpenJPEG bug)" << llendl;
|
||||
opj_destroy_cstr_info(&cinfo);
|
||||
opj_image_destroy(image);
|
||||
|
||||
|
||||
base.decodeFailed();
|
||||
return TRUE; // done
|
||||
}
|
||||
}
|
||||
|
||||
/* free opj data structures */
|
||||
if (image)
|
||||
{
|
||||
opj_destroy_cstr_info(&cinfo);
|
||||
opj_image_destroy(image);
|
||||
}
|
||||
/* free image data structure */
|
||||
opj_image_destroy(image);
|
||||
|
||||
return TRUE; // done
|
||||
}
|
||||
@@ -349,7 +315,7 @@ BOOL LLImageJ2COJ::encodeImpl(LLImageJ2C &base, const LLImageRaw &raw_image, con
|
||||
OPJ_COLOR_SPACE color_space = CLRSPC_SRGB;
|
||||
opj_image_cmptparm_t cmptparm[MAX_COMPS];
|
||||
opj_image_t * image = NULL;
|
||||
S32 numcomps = llmin((S32)raw_image.getComponents(),(S32)MAX_COMPS);
|
||||
S32 numcomps = llmin((S32)raw_image.getComponents(), MAX_COMPS);
|
||||
S32 width = raw_image.getWidth();
|
||||
S32 height = raw_image.getHeight();
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@ set(llinventory_SOURCE_FILES
|
||||
llcategory.cpp
|
||||
lleconomy.cpp
|
||||
llinventory.cpp
|
||||
llinventorydefines.cpp
|
||||
llinventorytype.cpp
|
||||
lllandmark.cpp
|
||||
llnotecard.cpp
|
||||
@@ -35,6 +36,7 @@ set(llinventory_HEADER_FILES
|
||||
llcategory.h
|
||||
lleconomy.h
|
||||
llinventory.h
|
||||
llinventorydefines.h
|
||||
llinventorytype.h
|
||||
lllandmark.h
|
||||
llnotecard.h
|
||||
|
||||
@@ -64,34 +64,27 @@ static const std::string INV_CREATION_DATE_LABEL("created_at");
|
||||
// key used by agent-inventory-service
|
||||
static const std::string INV_ASSET_TYPE_LABEL_WS("type_default");
|
||||
static const std::string INV_FOLDER_ID_LABEL_WS("category_id");
|
||||
|
||||
///----------------------------------------------------------------------------
|
||||
/// Local function declarations, constants, enums, and typedefs
|
||||
///----------------------------------------------------------------------------
|
||||
|
||||
const U8 TASK_INVENTORY_ITEM_KEY = 0;
|
||||
const U8 TASK_INVENTORY_ASSET_KEY = 1;
|
||||
|
||||
const LLUUID MAGIC_ID("3c115e51-04f4-523c-9fa6-98aff1034730");
|
||||
|
||||
|
||||
///----------------------------------------------------------------------------
|
||||
/// Class LLInventoryObject
|
||||
///----------------------------------------------------------------------------
|
||||
|
||||
LLInventoryObject::LLInventoryObject(
|
||||
const LLUUID& uuid,
|
||||
const LLUUID& parent_uuid,
|
||||
LLAssetType::EType type,
|
||||
const std::string& name) :
|
||||
LLInventoryObject::LLInventoryObject(const LLUUID& uuid,
|
||||
const LLUUID& parent_uuid,
|
||||
LLAssetType::EType type,
|
||||
const std::string& name) :
|
||||
mUUID(uuid),
|
||||
mParentUUID(parent_uuid),
|
||||
mType(type),
|
||||
mName(name)
|
||||
{
|
||||
LLStringUtil::replaceNonstandardASCII(mName, ' ');
|
||||
LLStringUtil::replaceChar(mName, '|', ' ');
|
||||
LLStringUtil::trim(mName);
|
||||
LLStringUtil::truncate(mName, DB_INV_ITEM_NAME_STR_LEN);
|
||||
correctInventoryName(mName);
|
||||
}
|
||||
|
||||
LLInventoryObject::LLInventoryObject() :
|
||||
@@ -99,7 +92,7 @@ LLInventoryObject::LLInventoryObject() :
|
||||
{
|
||||
}
|
||||
|
||||
LLInventoryObject::~LLInventoryObject( void )
|
||||
LLInventoryObject::~LLInventoryObject()
|
||||
{
|
||||
}
|
||||
|
||||
@@ -158,12 +151,8 @@ void LLInventoryObject::setUUID(const LLUUID& new_uuid)
|
||||
void LLInventoryObject::rename(const std::string& n)
|
||||
{
|
||||
std::string new_name(n);
|
||||
LLStringUtil::replaceNonstandardASCII(new_name, ' ');
|
||||
LLStringUtil::replaceChar(new_name, '|', ' ');
|
||||
LLStringUtil::trim(new_name);
|
||||
LLStringUtil::truncate(new_name, DB_INV_ITEM_NAME_STR_LEN);
|
||||
|
||||
if( new_name != mName )
|
||||
correctInventoryName(new_name);
|
||||
if( !new_name.empty() && new_name != mName )
|
||||
{
|
||||
mName = new_name;
|
||||
}
|
||||
@@ -224,10 +213,7 @@ BOOL LLInventoryObject::importLegacyStream(std::istream& input_stream)
|
||||
" %254s %254[^|]",
|
||||
keyword, valuestr);
|
||||
mName.assign(valuestr);
|
||||
LLStringUtil::replaceNonstandardASCII(mName, ' ');
|
||||
LLStringUtil::replaceChar(mName, '|', ' ');
|
||||
LLStringUtil::trim(mName);
|
||||
LLStringUtil::truncate(mName, DB_INV_ITEM_NAME_STR_LEN);
|
||||
correctInventoryName(mName);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -287,23 +273,31 @@ void LLInventoryObject::updateServer(BOOL) const
|
||||
llwarns << "LLInventoryObject::updateServer() called. Doesn't do anything." << llendl;
|
||||
}
|
||||
|
||||
inline
|
||||
void LLInventoryObject::correctInventoryName(std::string& name)
|
||||
{
|
||||
LLStringUtil::replaceNonstandardASCII(name, ' ');
|
||||
LLStringUtil::replaceChar(name, '|', ' ');
|
||||
LLStringUtil::trim(name);
|
||||
LLStringUtil::truncate(name, DB_INV_ITEM_NAME_STR_LEN);
|
||||
}
|
||||
|
||||
|
||||
///----------------------------------------------------------------------------
|
||||
/// Class LLInventoryItem
|
||||
///----------------------------------------------------------------------------
|
||||
|
||||
LLInventoryItem::LLInventoryItem(
|
||||
const LLUUID& uuid,
|
||||
const LLUUID& parent_uuid,
|
||||
const LLPermissions& permissions,
|
||||
const LLUUID& asset_uuid,
|
||||
LLAssetType::EType type,
|
||||
LLInventoryType::EType inv_type,
|
||||
const std::string& name,
|
||||
const std::string& desc,
|
||||
const LLSaleInfo& sale_info,
|
||||
U32 flags,
|
||||
S32 creation_date_utc) :
|
||||
LLInventoryItem::LLInventoryItem(const LLUUID& uuid,
|
||||
const LLUUID& parent_uuid,
|
||||
const LLPermissions& permissions,
|
||||
const LLUUID& asset_uuid,
|
||||
LLAssetType::EType type,
|
||||
LLInventoryType::EType inv_type,
|
||||
const std::string& name,
|
||||
const std::string& desc,
|
||||
const LLSaleInfo& sale_info,
|
||||
U32 flags,
|
||||
S32 creation_date_utc) :
|
||||
LLInventoryObject(uuid, parent_uuid, type, name),
|
||||
mPermissions(permissions),
|
||||
mAssetUUID(asset_uuid),
|
||||
@@ -315,6 +309,7 @@ LLInventoryItem::LLInventoryItem(
|
||||
{
|
||||
LLStringUtil::replaceNonstandardASCII(mDescription, ' ');
|
||||
LLStringUtil::replaceChar(mDescription, '|', ' ');
|
||||
mPermissions.initMasks(inv_type);
|
||||
}
|
||||
|
||||
LLInventoryItem::LLInventoryItem() :
|
||||
@@ -446,6 +441,9 @@ void LLInventoryItem::setDescription(const std::string& d)
|
||||
void LLInventoryItem::setPermissions(const LLPermissions& perm)
|
||||
{
|
||||
mPermissions = perm;
|
||||
|
||||
// Override permissions to unrestricted if this is a landmark
|
||||
mPermissions.initMasks(mInventoryType);
|
||||
}
|
||||
|
||||
void LLInventoryItem::setInventoryType(LLInventoryType::EType inv_type)
|
||||
@@ -463,6 +461,46 @@ void LLInventoryItem::setCreationDate(time_t creation_date_utc)
|
||||
mCreationDate = creation_date_utc;
|
||||
}
|
||||
|
||||
// Currently only used in the Viewer to handle calling cards
|
||||
// where the creator is actually used to store the target.
|
||||
void LLInventoryItem::setCreator(const LLUUID& creator)
|
||||
{
|
||||
mPermissions.setCreator(creator);
|
||||
}
|
||||
|
||||
void LLInventoryItem::accumulatePermissionSlamBits(const LLInventoryItem& old_item)
|
||||
{
|
||||
// Remove any pre-existing II_FLAGS_PERM_OVERWRITE_MASK flags
|
||||
// because we now detect when they should be set.
|
||||
setFlags( old_item.getFlags() | (getFlags() & ~(LLInventoryItemFlags::II_FLAGS_PERM_OVERWRITE_MASK)) );
|
||||
|
||||
// Enforce the PERM_OVERWRITE flags for any masks that are different
|
||||
// but only for AT_OBJECT's since that is the only asset type that can
|
||||
// exist in-world (instead of only in-inventory or in-object-contents).
|
||||
if (LLAssetType::AT_OBJECT == getType())
|
||||
{
|
||||
LLPermissions old_permissions = old_item.getPermissions();
|
||||
U32 flags_to_be_set = 0;
|
||||
if(old_permissions.getMaskNextOwner() != getPermissions().getMaskNextOwner())
|
||||
{
|
||||
flags_to_be_set |= LLInventoryItemFlags::II_FLAGS_OBJECT_SLAM_PERM;
|
||||
}
|
||||
if(old_permissions.getMaskEveryone() != getPermissions().getMaskEveryone())
|
||||
{
|
||||
flags_to_be_set |= LLInventoryItemFlags::II_FLAGS_OBJECT_PERM_OVERWRITE_EVERYONE;
|
||||
}
|
||||
if(old_permissions.getMaskGroup() != getPermissions().getMaskGroup())
|
||||
{
|
||||
flags_to_be_set |= LLInventoryItemFlags::II_FLAGS_OBJECT_PERM_OVERWRITE_GROUP;
|
||||
}
|
||||
LLSaleInfo old_sale_info = old_item.getSaleInfo();
|
||||
if(old_sale_info != getSaleInfo())
|
||||
{
|
||||
flags_to_be_set |= LLInventoryItemFlags::II_FLAGS_OBJECT_SLAM_SALE;
|
||||
}
|
||||
setFlags(getFlags() | flags_to_be_set);
|
||||
}
|
||||
}
|
||||
|
||||
const LLSaleInfo& LLInventoryItem::getSaleInfo() const
|
||||
{
|
||||
@@ -517,6 +555,7 @@ BOOL LLInventoryItem::unpackMessage(LLMessageSystem* msg, const char* block, S32
|
||||
mType = static_cast<LLAssetType::EType>(type);
|
||||
msg->getS8(block, "InvType", type, block_num);
|
||||
mInventoryType = static_cast<LLInventoryType::EType>(type);
|
||||
mPermissions.initMasks(mInventoryType);
|
||||
|
||||
msg->getU32Fast(block, _PREHASH_Flags, mFlags, block_num);
|
||||
|
||||
@@ -707,6 +746,9 @@ BOOL LLInventoryItem::importFile(LLFILE* fp)
|
||||
lldebugs << "Resetting inventory type for " << mUUID << llendl;
|
||||
mInventoryType = LLInventoryType::defaultForAssetType(mType);
|
||||
}
|
||||
|
||||
mPermissions.initMasks(mInventoryType);
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
@@ -746,8 +788,8 @@ BOOL LLInventoryItem::exportFile(LLFILE* fp, BOOL include_asset_key) const
|
||||
fprintf(fp, "\t\tasset_id\t%s\n", uuid_str.c_str());
|
||||
}
|
||||
fprintf(fp, "\t\ttype\t%s\n", LLAssetType::lookup(mType));
|
||||
const char* inv_type_str = LLInventoryType::lookup(mInventoryType);
|
||||
if(inv_type_str) fprintf(fp, "\t\tinv_type\t%s\n", inv_type_str);
|
||||
const std::string inv_type_str = LLInventoryType::lookup(mInventoryType);
|
||||
if(!inv_type_str.empty()) fprintf(fp, "\t\tinv_type\t%s\n", inv_type_str.c_str());
|
||||
fprintf(fp, "\t\tflags\t%08x\n", mFlags);
|
||||
mSaleInfo.exportFile(fp);
|
||||
fprintf(fp, "\t\tname\t%s|\n", mName.c_str());
|
||||
@@ -910,6 +952,9 @@ BOOL LLInventoryItem::importLegacyStream(std::istream& input_stream)
|
||||
lldebugs << "Resetting inventory type for " << mUUID << llendl;
|
||||
mInventoryType = LLInventoryType::defaultForAssetType(mType);
|
||||
}
|
||||
|
||||
mPermissions.initMasks(mInventoryType);
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
@@ -949,8 +994,8 @@ BOOL LLInventoryItem::exportLegacyStream(std::ostream& output_stream, BOOL inclu
|
||||
output_stream << "\t\tasset_id\t" << uuid_str << "\n";
|
||||
}
|
||||
output_stream << "\t\ttype\t" << LLAssetType::lookup(mType) << "\n";
|
||||
const char* inv_type_str = LLInventoryType::lookup(mInventoryType);
|
||||
if(inv_type_str)
|
||||
const std::string inv_type_str = LLInventoryType::lookup(mInventoryType);
|
||||
if(!inv_type_str.empty())
|
||||
output_stream << "\t\tinv_type\t" << inv_type_str << "\n";
|
||||
std::string buffer;
|
||||
buffer = llformat( "\t\tflags\t%08x\n", mFlags);
|
||||
@@ -966,6 +1011,12 @@ BOOL LLInventoryItem::exportLegacyStream(std::ostream& output_stream, BOOL inclu
|
||||
LLSD LLInventoryItem::asLLSD() const
|
||||
{
|
||||
LLSD sd = LLSD();
|
||||
asLLSD(sd);
|
||||
return sd;
|
||||
}
|
||||
|
||||
void LLInventoryItem::asLLSD( LLSD& sd ) const
|
||||
{
|
||||
sd[INV_ITEM_ID_LABEL] = mUUID;
|
||||
sd[INV_PARENT_ID_LABEL] = mParentUUID;
|
||||
sd[INV_PERMISSIONS_LABEL] = ll_create_sd_from_permissions(mPermissions);
|
||||
@@ -986,8 +1037,8 @@ LLSD LLInventoryItem::asLLSD() const
|
||||
}
|
||||
sd[INV_ASSET_TYPE_LABEL] = LLAssetType::lookup(mType);
|
||||
sd[INV_INVENTORY_TYPE_LABEL] = mInventoryType;
|
||||
const char* inv_type_str = LLInventoryType::lookup(mInventoryType);
|
||||
if(inv_type_str)
|
||||
const std::string inv_type_str = LLInventoryType::lookup(mInventoryType);
|
||||
if(!inv_type_str.empty())
|
||||
{
|
||||
sd[INV_INVENTORY_TYPE_LABEL] = inv_type_str;
|
||||
}
|
||||
@@ -997,11 +1048,9 @@ LLSD LLInventoryItem::asLLSD() const
|
||||
sd[INV_NAME_LABEL] = mName;
|
||||
sd[INV_DESC_LABEL] = mDescription;
|
||||
sd[INV_CREATION_DATE_LABEL] = (S32) mCreationDate;
|
||||
|
||||
return sd;
|
||||
}
|
||||
|
||||
bool LLInventoryItem::fromLLSD(LLSD& sd)
|
||||
bool LLInventoryItem::fromLLSD(const LLSD& sd)
|
||||
{
|
||||
mInventoryType = LLInventoryType::IT_NONE;
|
||||
mAssetUUID.setNull();
|
||||
@@ -1128,6 +1177,8 @@ bool LLInventoryItem::fromLLSD(LLSD& sd)
|
||||
mInventoryType = LLInventoryType::defaultForAssetType(mType);
|
||||
}
|
||||
|
||||
mPermissions.initMasks(mInventoryType);
|
||||
|
||||
return true;
|
||||
fail:
|
||||
return false;
|
||||
@@ -1294,23 +1345,19 @@ void LLInventoryItem::unpackBinaryBucket(U8* bin_bucket, S32 bin_bucket_size)
|
||||
// Early exit on an empty binary bucket.
|
||||
if (bin_bucket_size <= 1) return;
|
||||
|
||||
// Convert the bin_bucket into a string.
|
||||
char* item_buffer = new char[bin_bucket_size+1];
|
||||
if ((item_buffer != NULL) && (bin_bucket != NULL))
|
||||
if (NULL == bin_bucket)
|
||||
{
|
||||
memcpy(item_buffer, bin_bucket, bin_bucket_size); /* Flawfinder: ignore */
|
||||
}
|
||||
else
|
||||
{
|
||||
llerrs << "unpackBinaryBucket failed. item_buffer or bin_bucket is Null." << llendl;
|
||||
delete[] item_buffer;
|
||||
llerrs << "unpackBinaryBucket failed. bin_bucket is NULL." << llendl;
|
||||
return;
|
||||
}
|
||||
item_buffer[bin_bucket_size] = '\0';
|
||||
std::string str(item_buffer);
|
||||
|
||||
lldebugs << "item buffer: " << item_buffer << llendl;
|
||||
delete[] item_buffer;
|
||||
// Convert the bin_bucket into a string.
|
||||
std::vector<char> item_buffer(bin_bucket_size+1);
|
||||
memcpy(&item_buffer[0], bin_bucket, bin_bucket_size); /* Flawfinder: ignore */
|
||||
item_buffer[bin_bucket_size] = '\0';
|
||||
std::string str(&item_buffer[0]);
|
||||
|
||||
lldebugs << "item buffer: " << str << llendl;
|
||||
|
||||
// Tokenize the string.
|
||||
typedef boost::tokenizer<boost::char_separator<char> > tokenizer;
|
||||
@@ -1385,11 +1432,10 @@ BOOL item_date_sort( LLInventoryItem* a, LLInventoryItem* b )
|
||||
/// Class LLInventoryCategory
|
||||
///----------------------------------------------------------------------------
|
||||
|
||||
LLInventoryCategory::LLInventoryCategory(
|
||||
const LLUUID& uuid,
|
||||
const LLUUID& parent_uuid,
|
||||
LLAssetType::EType preferred_type,
|
||||
const std::string& name) :
|
||||
LLInventoryCategory::LLInventoryCategory(const LLUUID& uuid,
|
||||
const LLUUID& parent_uuid,
|
||||
LLAssetType::EType preferred_type,
|
||||
const std::string& name) :
|
||||
LLInventoryObject(uuid, parent_uuid, LLAssetType::AT_CATEGORY, name),
|
||||
mPreferredType(preferred_type)
|
||||
{
|
||||
@@ -1451,7 +1497,7 @@ void LLInventoryCategory::packMessage(LLMessageSystem* msg) const
|
||||
msg->addStringFast(_PREHASH_Name, mName);
|
||||
}
|
||||
|
||||
bool LLInventoryCategory::fromLLSD(LLSD& sd)
|
||||
bool LLInventoryCategory::fromLLSD(const LLSD& sd)
|
||||
{
|
||||
std::string w;
|
||||
|
||||
|
||||
@@ -33,180 +33,107 @@
|
||||
#ifndef LL_LLINVENTORY_H
|
||||
#define LL_LLINVENTORY_H
|
||||
|
||||
#include <functional>
|
||||
|
||||
#include "llassetstorage.h"
|
||||
#include "lldarray.h"
|
||||
#include "llinventorytype.h"
|
||||
#include "llinventorydefines.h"
|
||||
#include "llmemtype.h"
|
||||
#include "llpermissions.h"
|
||||
#include "llsaleinfo.h"
|
||||
#include "llsd.h"
|
||||
#include "lluuid.h"
|
||||
#include "llxmlnode.h"
|
||||
|
||||
// consts for Key field in the task inventory update message
|
||||
extern const U8 TASK_INVENTORY_ITEM_KEY;
|
||||
extern const U8 TASK_INVENTORY_ASSET_KEY;
|
||||
|
||||
// anonymous enumeration to specify a max inventory buffer size for
|
||||
// use in packBinaryBucket()
|
||||
enum
|
||||
{
|
||||
MAX_INVENTORY_BUFFER_SIZE = 1024
|
||||
};
|
||||
|
||||
|
||||
class LLMessageSystem;
|
||||
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// Class LLInventoryObject
|
||||
//
|
||||
// This is the base class for inventory objects that handles the
|
||||
// common code between items and categories. The 'mParentUUID' member
|
||||
// means the parent category since all inventory objects except each
|
||||
// user's root category are in some category. Each user's root
|
||||
// category will have mParentUUID==LLUUID::null.
|
||||
// Base class for anything in the user's inventory. Handles the common code
|
||||
// between items and categories.
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
class LLMessageSystem;
|
||||
|
||||
class LLInventoryObject : public LLRefCount
|
||||
{
|
||||
protected:
|
||||
LLUUID mUUID;
|
||||
LLUUID mParentUUID;
|
||||
LLAssetType::EType mType;
|
||||
std::string mName;
|
||||
public:
|
||||
typedef std::list<LLPointer<LLInventoryObject> > object_list_t;
|
||||
|
||||
protected:
|
||||
virtual ~LLInventoryObject( void );
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// Initialization
|
||||
//--------------------------------------------------------------------
|
||||
public:
|
||||
MEM_TYPE_NEW(LLMemType::MTYPE_INVENTORY);
|
||||
LLInventoryObject(const LLUUID& uuid, const LLUUID& parent_uuid,
|
||||
LLAssetType::EType type, const std::string& name);
|
||||
LLInventoryObject();
|
||||
LLInventoryObject(const LLUUID& uuid,
|
||||
const LLUUID& parent_uuid,
|
||||
LLAssetType::EType type,
|
||||
const std::string& name);
|
||||
void copyObject(const LLInventoryObject* other); // LLRefCount requires custom copy
|
||||
protected:
|
||||
virtual ~LLInventoryObject();
|
||||
|
||||
// accessors
|
||||
virtual const LLUUID& getUUID() const;
|
||||
//--------------------------------------------------------------------
|
||||
// Accessors
|
||||
//--------------------------------------------------------------------
|
||||
public:
|
||||
virtual const LLUUID& getUUID() const; // inventoryID that this item points to
|
||||
virtual const LLUUID& getLinkedUUID() const; // inventoryID that this item points to, else this item's inventoryID
|
||||
const LLUUID& getParentUUID() const;
|
||||
virtual const LLUUID& getLinkedUUID() const; // get the inventoryID that this item points to, else this item's inventoryID
|
||||
virtual const std::string& getName() const;
|
||||
virtual LLAssetType::EType getType() const;
|
||||
LLAssetType::EType getActualType() const; // bypasses indirection for linked items
|
||||
BOOL getIsLinkType() const;
|
||||
// mutators - will not call updateServer();
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// Mutators
|
||||
// Will not call updateServer
|
||||
//--------------------------------------------------------------------
|
||||
public:
|
||||
void setUUID(const LLUUID& new_uuid);
|
||||
virtual void rename(const std::string& new_name);
|
||||
void setParent(const LLUUID& new_parent);
|
||||
void setType(LLAssetType::EType type);
|
||||
|
||||
// file support - implemented here so that a minimal information
|
||||
// set can be transmitted between simulator and viewer.
|
||||
// virtual BOOL importFile(LLFILE* fp);
|
||||
virtual BOOL exportFile(LLFILE* fp, BOOL include_asset_key = TRUE) const;
|
||||
private:
|
||||
// in place correction for inventory name string
|
||||
void correctInventoryName(std::string& name);
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// File Support
|
||||
// Implemented here so that a minimal information set can be transmitted
|
||||
// between simulator and viewer.
|
||||
//--------------------------------------------------------------------
|
||||
public:
|
||||
// virtual BOOL importFile(LLFILE* fp);
|
||||
virtual BOOL exportFile(LLFILE* fp, BOOL include_asset_key = TRUE) const;
|
||||
virtual BOOL importLegacyStream(std::istream& input_stream);
|
||||
virtual BOOL exportLegacyStream(std::ostream& output_stream, BOOL include_asset_key = TRUE) const;
|
||||
|
||||
// virtual methods
|
||||
virtual void removeFromServer();
|
||||
virtual void updateParentOnServer(BOOL) const;
|
||||
virtual void updateServer(BOOL) const;
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// Member Variables
|
||||
//--------------------------------------------------------------------
|
||||
protected:
|
||||
LLUUID mUUID;
|
||||
LLUUID mParentUUID; // Parent category. Root categories have LLUUID::NULL.
|
||||
LLAssetType::EType mType;
|
||||
std::string mName;
|
||||
};
|
||||
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// Class LLInventoryItem
|
||||
//
|
||||
// An inventory item represents something that the current user has in
|
||||
// their inventory.
|
||||
// An item in the current user's inventory.
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
class LLInventoryItem : public LLInventoryObject
|
||||
{
|
||||
public:
|
||||
typedef LLDynamicArray<LLPointer<LLInventoryItem> > item_array_t;
|
||||
|
||||
protected:
|
||||
LLPermissions mPermissions;
|
||||
LLUUID mAssetUUID;
|
||||
std::string mDescription;
|
||||
LLSaleInfo mSaleInfo;
|
||||
LLInventoryType::EType mInventoryType;
|
||||
U32 mFlags;
|
||||
time_t mCreationDate; // seconds from 1/1/1970, UTC
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
* Anonymous enumeration for specifying the inventory item flags.
|
||||
*/
|
||||
enum
|
||||
{
|
||||
// The shared flags at the top are shared among all inventory
|
||||
// types. After that section, all values of flags are type
|
||||
// dependent. The shared flags will start at 2^30 and work
|
||||
// down while item type specific flags will start at 2^0 and
|
||||
// work up.
|
||||
II_FLAGS_NONE = 0,
|
||||
|
||||
|
||||
//
|
||||
// Shared flags
|
||||
//
|
||||
//
|
||||
|
||||
// This value means that the asset has only one reference in
|
||||
// the system. If the inventory item is deleted, or the asset
|
||||
// id updated, then we can remove the old reference.
|
||||
II_FLAGS_SHARED_SINGLE_REFERENCE = 0x40000000,
|
||||
|
||||
|
||||
//
|
||||
// Landmark flags
|
||||
//
|
||||
II_FLAGS_LANDMARK_VISITED = 1,
|
||||
|
||||
//
|
||||
// Object flags
|
||||
//
|
||||
|
||||
// flag to indicate that object permissions should have next
|
||||
// owner perm be more restrictive on rez. We bump this into
|
||||
// the second byte of the flags since the low byte is used to
|
||||
// track attachment points.
|
||||
II_FLAGS_OBJECT_SLAM_PERM = 0x100,
|
||||
|
||||
// flag to indicate that the object sale information has been changed.
|
||||
II_FLAGS_OBJECT_SLAM_SALE = 0x1000,
|
||||
|
||||
// These flags specify which permissions masks to overwrite
|
||||
// upon rez. Normally, if no permissions slam (above) or
|
||||
// overwrite flags are set, the asset's permissions are
|
||||
// used and the inventory's permissions are ignored. If
|
||||
// any of these flags are set, the inventory's permissions
|
||||
// take precedence.
|
||||
II_FLAGS_OBJECT_PERM_OVERWRITE_BASE = 0x010000,
|
||||
II_FLAGS_OBJECT_PERM_OVERWRITE_OWNER = 0x020000,
|
||||
II_FLAGS_OBJECT_PERM_OVERWRITE_GROUP = 0x040000,
|
||||
II_FLAGS_OBJECT_PERM_OVERWRITE_EVERYONE = 0x080000,
|
||||
II_FLAGS_OBJECT_PERM_OVERWRITE_NEXT_OWNER = 0x100000,
|
||||
|
||||
// flag to indicate whether an object that is returned is composed
|
||||
// of muiltiple items or not.
|
||||
II_FLAGS_OBJECT_HAS_MULTIPLE_ITEMS = 0x200000,
|
||||
|
||||
//
|
||||
// wearables use the low order byte of flags to store the
|
||||
// EWearableType enumeration found in newview/llwearable.h
|
||||
//
|
||||
II_FLAGS_WEARABLES_MASK = 0xff,
|
||||
};
|
||||
|
||||
protected:
|
||||
~LLInventoryItem(); // ref counted
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// Initialization
|
||||
//--------------------------------------------------------------------
|
||||
public:
|
||||
MEM_TYPE_NEW(LLMemType::MTYPE_INVENTORY);
|
||||
LLInventoryItem(const LLUUID& uuid,
|
||||
@@ -226,13 +153,19 @@ public:
|
||||
// is prohibited
|
||||
LLInventoryItem(const LLInventoryItem* other);
|
||||
virtual void copyItem(const LLInventoryItem* other); // LLRefCount requires custom copy
|
||||
|
||||
// As a constructor alternative, the clone() method works like a
|
||||
void generateUUID() { mUUID.generate(); }
|
||||
|
||||
// As a constructor alternative, the clone() method works like a
|
||||
// copy constructor, but gens a new UUID.
|
||||
// It is up to the caller to delete (unref) the item.
|
||||
virtual void cloneItem(LLPointer<LLInventoryItem>& newitem) const;
|
||||
protected:
|
||||
~LLInventoryItem(); // ref counted
|
||||
|
||||
// accessors
|
||||
//--------------------------------------------------------------------
|
||||
// Accessors
|
||||
//--------------------------------------------------------------------
|
||||
public:
|
||||
virtual const LLUUID& getLinkedUUID() const;
|
||||
virtual const LLPermissions& getPermissions() const;
|
||||
virtual const LLUUID& getCreatorUUID() const;
|
||||
@@ -244,8 +177,12 @@ public:
|
||||
virtual time_t getCreationDate() const;
|
||||
virtual U32 getCRC32() const; // really more of a checksum.
|
||||
|
||||
// mutators - will not call updateServer(), and will never fail
|
||||
// (though it may correct to sane values)
|
||||
//--------------------------------------------------------------------
|
||||
// Mutators
|
||||
// Will not call updateServer and will never fail
|
||||
// (though it may correct to sane values)
|
||||
//--------------------------------------------------------------------
|
||||
public:
|
||||
void setAssetUUID(const LLUUID& asset_id);
|
||||
void setDescription(const std::string& new_desc);
|
||||
void setSaleInfo(const LLSaleInfo& sale_info);
|
||||
@@ -253,34 +190,56 @@ public:
|
||||
void setInventoryType(LLInventoryType::EType inv_type);
|
||||
void setFlags(U32 flags);
|
||||
void setCreationDate(time_t creation_date_utc);
|
||||
void setCreator(const LLUUID& creator); // only used for calling cards
|
||||
|
||||
// Put this inventory item onto the current outgoing mesage. It
|
||||
// assumes you have already called nextBlock().
|
||||
// Check for changes in permissions masks and sale info
|
||||
// and set the corresponding bits in mFlags.
|
||||
void accumulatePermissionSlamBits(const LLInventoryItem& old_item);
|
||||
|
||||
// Put this inventory item onto the current outgoing mesage.
|
||||
// Assumes you have already called nextBlock().
|
||||
virtual void packMessage(LLMessageSystem* msg) const;
|
||||
|
||||
// unpack returns TRUE if the inventory item came through the
|
||||
// network ok. It uses a simple crc check which is defeatable, but
|
||||
// we want to detect network mangling somehow.
|
||||
virtual BOOL unpackMessage(LLMessageSystem* msg, const char* block, S32 block_num = 0);
|
||||
// file support
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// File Support
|
||||
//--------------------------------------------------------------------
|
||||
public:
|
||||
virtual BOOL importFile(LLFILE* fp);
|
||||
virtual BOOL exportFile(LLFILE* fp, BOOL include_asset_key = TRUE) const;
|
||||
|
||||
virtual BOOL importLegacyStream(std::istream& input_stream);
|
||||
virtual BOOL exportLegacyStream(std::ostream& output_stream, BOOL include_asset_key = TRUE) const;
|
||||
|
||||
virtual LLXMLNode *exportFileXML(BOOL include_asset_key = TRUE) const;
|
||||
BOOL importXML(LLXMLNode* node);
|
||||
|
||||
// helper functions
|
||||
//--------------------------------------------------------------------
|
||||
// Helper Functions
|
||||
//--------------------------------------------------------------------
|
||||
public:
|
||||
// Pack all information needed to reconstruct this item into the given binary bucket.
|
||||
|
||||
// pack all information needed to reconstruct this item into the given binary bucket.
|
||||
// perm_override is optional
|
||||
S32 packBinaryBucket(U8* bin_bucket, LLPermissions* perm_override = NULL) const;
|
||||
void unpackBinaryBucket(U8* bin_bucket, S32 bin_bucket_size);
|
||||
LLSD asLLSD() const;
|
||||
bool fromLLSD(LLSD& sd);
|
||||
void asLLSD( LLSD& sd ) const;
|
||||
bool fromLLSD(const LLSD& sd);
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// Member Variables
|
||||
//--------------------------------------------------------------------
|
||||
protected:
|
||||
LLPermissions mPermissions;
|
||||
LLUUID mAssetUUID;
|
||||
std::string mDescription;
|
||||
LLSaleInfo mSaleInfo;
|
||||
LLInventoryType::EType mInventoryType;
|
||||
U32 mFlags;
|
||||
time_t mCreationDate; // seconds from 1/1/1970, UTC
|
||||
};
|
||||
|
||||
BOOL item_dictionary_sort(LLInventoryItem* a,LLInventoryItem* b);
|
||||
@@ -300,9 +259,9 @@ class LLInventoryCategory : public LLInventoryObject
|
||||
public:
|
||||
typedef LLDynamicArray<LLPointer<LLInventoryCategory> > cat_array_t;
|
||||
|
||||
protected:
|
||||
~LLInventoryCategory();
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// Initialization
|
||||
//--------------------------------------------------------------------
|
||||
public:
|
||||
MEM_TYPE_NEW(LLMemType::MTYPE_INVENTORY);
|
||||
LLInventoryCategory(const LLUUID& uuid, const LLUUID& parent_uuid,
|
||||
@@ -311,29 +270,39 @@ public:
|
||||
LLInventoryCategory();
|
||||
LLInventoryCategory(const LLInventoryCategory* other);
|
||||
void copyCategory(const LLInventoryCategory* other); // LLRefCount requires custom copy
|
||||
protected:
|
||||
~LLInventoryCategory();
|
||||
|
||||
// accessors and mutators
|
||||
//--------------------------------------------------------------------
|
||||
// Accessors And Mutators
|
||||
//--------------------------------------------------------------------
|
||||
public:
|
||||
LLAssetType::EType getPreferredType() const;
|
||||
void setPreferredType(LLAssetType::EType type);
|
||||
// For messaging system support
|
||||
LLSD asLLSD() const;
|
||||
bool fromLLSD(const LLSD& sd);
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// Messaging
|
||||
//--------------------------------------------------------------------
|
||||
public:
|
||||
virtual void packMessage(LLMessageSystem* msg) const;
|
||||
virtual void unpackMessage(LLMessageSystem* msg, const char* block, S32 block_num = 0);
|
||||
|
||||
LLSD asLLSD() const;
|
||||
bool fromLLSD(LLSD& sd);
|
||||
|
||||
// file support
|
||||
//--------------------------------------------------------------------
|
||||
// File Support
|
||||
//--------------------------------------------------------------------
|
||||
public:
|
||||
virtual BOOL importFile(LLFILE* fp);
|
||||
virtual BOOL exportFile(LLFILE* fp, BOOL include_asset_key = TRUE) const;
|
||||
|
||||
virtual BOOL importLegacyStream(std::istream& input_stream);
|
||||
virtual BOOL exportLegacyStream(std::ostream& output_stream, BOOL include_asset_key = TRUE) const;
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// Member Variables
|
||||
//--------------------------------------------------------------------
|
||||
protected:
|
||||
// The type of asset that this category was "meant" to hold
|
||||
// (although it may in fact hold any type).
|
||||
LLAssetType::EType mPreferredType;
|
||||
|
||||
LLAssetType::EType mPreferredType; // Type that this category was "meant" to hold (although it may hold any type).
|
||||
};
|
||||
|
||||
|
||||
@@ -404,8 +373,8 @@ struct SetNotForSale
|
||||
if(LLAssetType::AT_OBJECT == item->getType())
|
||||
{
|
||||
U32 flags = item->getFlags();
|
||||
flags |= LLInventoryItem::II_FLAGS_OBJECT_PERM_OVERWRITE_GROUP;
|
||||
flags |= LLInventoryItem::II_FLAGS_OBJECT_PERM_OVERWRITE_EVERYONE;
|
||||
flags |= LLInventoryItemFlags::II_FLAGS_OBJECT_PERM_OVERWRITE_GROUP;
|
||||
flags |= LLInventoryItemFlags::II_FLAGS_OBJECT_PERM_OVERWRITE_EVERYONE;
|
||||
item->setFlags(flags);
|
||||
}
|
||||
|
||||
|
||||
38
indra/llinventory/llinventorydefines.cpp
Normal file
38
indra/llinventory/llinventorydefines.cpp
Normal file
@@ -0,0 +1,38 @@
|
||||
/**
|
||||
* @file llinventorydefines.cpp
|
||||
* @brief Implementation of the inventory defines.
|
||||
*
|
||||
* $LicenseInfo:firstyear=2001&license=viewergpl$
|
||||
*
|
||||
* Copyright (c) 2001-2010, Linden Research, Inc.
|
||||
*
|
||||
* Second Life Viewer Source Code
|
||||
* The source code in this file ("Source Code") is provided by Linden Lab
|
||||
* to you under the terms of the GNU General Public License, version 2.0
|
||||
* ("GPL"), unless you have obtained a separate licensing agreement
|
||||
* ("Other License"), formally executed by you and Linden Lab. Terms of
|
||||
* the GPL can be found in doc/GPL-license.txt in this distribution, or
|
||||
* online at http://secondlife.com/developers/opensource/gplv2
|
||||
*
|
||||
* There are special exceptions to the terms and conditions of the GPL as
|
||||
* it is applied to this Source Code. View the full text of the exception
|
||||
* in the file doc/FLOSS-exception.txt in this software distribution, or
|
||||
* online at
|
||||
* http://secondlife.com/developers/opensource/flossexception
|
||||
*
|
||||
* By copying, modifying or distributing this software, you acknowledge
|
||||
* that you have read and understood your obligations described above,
|
||||
* and agree to abide by those obligations.
|
||||
*
|
||||
* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
|
||||
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
|
||||
* COMPLETENESS OR PERFORMANCE.
|
||||
* $/LicenseInfo$
|
||||
*
|
||||
*/
|
||||
|
||||
#include "linden_common.h"
|
||||
#include "llinventorydefines.h"
|
||||
|
||||
const U8 TASK_INVENTORY_ITEM_KEY = 0;
|
||||
const U8 TASK_INVENTORY_ASSET_KEY = 1;
|
||||
107
indra/llinventory/llinventorydefines.h
Normal file
107
indra/llinventory/llinventorydefines.h
Normal file
@@ -0,0 +1,107 @@
|
||||
/**
|
||||
* @file llinventorydefines.h
|
||||
* @brief LLInventoryDefines
|
||||
*
|
||||
* $LicenseInfo:firstyear=2001&license=viewergpl$
|
||||
*
|
||||
* Copyright (c) 2001-2010, Linden Research, Inc.
|
||||
*
|
||||
* Second Life Viewer Source Code
|
||||
* The source code in this file ("Source Code") is provided by Linden Lab
|
||||
* to you under the terms of the GNU General Public License, version 2.0
|
||||
* ("GPL"), unless you have obtained a separate licensing agreement
|
||||
* ("Other License"), formally executed by you and Linden Lab. Terms of
|
||||
* the GPL can be found in doc/GPL-license.txt in this distribution, or
|
||||
* online at http://secondlife.com/developers/opensource/gplv2
|
||||
*
|
||||
* There are special exceptions to the terms and conditions of the GPL as
|
||||
* it is applied to this Source Code. View the full text of the exception
|
||||
* in the file doc/FLOSS-exception.txt in this software distribution, or
|
||||
* online at
|
||||
* http://secondlife.com/developers/opensource/flossexception
|
||||
*
|
||||
* By copying, modifying or distributing this software, you acknowledge
|
||||
* that you have read and understood your obligations described above,
|
||||
* and agree to abide by those obligations.
|
||||
*
|
||||
* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
|
||||
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
|
||||
* COMPLETENESS OR PERFORMANCE.
|
||||
* $/LicenseInfo$
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LL_LLINVENTORYDEFINES_H
|
||||
#define LL_LLINVENTORYDEFINES_H
|
||||
|
||||
// Consts for "key" field in the task inventory update message
|
||||
extern const U8 TASK_INVENTORY_ITEM_KEY;
|
||||
extern const U8 TASK_INVENTORY_ASSET_KEY;
|
||||
|
||||
// Max inventory buffer size (for use in packBinaryBucket)
|
||||
enum
|
||||
{
|
||||
MAX_INVENTORY_BUFFER_SIZE = 1024
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// Inventory item flags enums
|
||||
// The shared flags at the top are shared among all inventory
|
||||
// types. After that section, all values of flags are type
|
||||
// dependent. The shared flags will start at 2^30 and work
|
||||
// down while item type specific flags will start at 2^0 and work up.
|
||||
//--------------------------------------------------------------------
|
||||
class LLInventoryItemFlags
|
||||
{
|
||||
public:
|
||||
enum EType
|
||||
{
|
||||
II_FLAGS_NONE = 0,
|
||||
|
||||
II_FLAGS_SHARED_SINGLE_REFERENCE = 0x40000000,
|
||||
// The asset has only one reference in the system. If the
|
||||
// inventory item is deleted, or the assetid updated, then we
|
||||
// can remove the old reference.
|
||||
|
||||
II_FLAGS_LANDMARK_VISITED = 1,
|
||||
|
||||
II_FLAGS_OBJECT_SLAM_PERM = 0x100,
|
||||
// Object permissions should have next owner perm be more
|
||||
// restrictive on rez. We bump this into the second byte of the
|
||||
// flags since the low byte is used to track attachment points.
|
||||
|
||||
II_FLAGS_OBJECT_SLAM_SALE = 0x1000,
|
||||
// The object sale information has been changed.
|
||||
|
||||
II_FLAGS_OBJECT_PERM_OVERWRITE_BASE = 0x010000,
|
||||
II_FLAGS_OBJECT_PERM_OVERWRITE_OWNER = 0x020000,
|
||||
II_FLAGS_OBJECT_PERM_OVERWRITE_GROUP = 0x040000,
|
||||
II_FLAGS_OBJECT_PERM_OVERWRITE_EVERYONE = 0x080000,
|
||||
II_FLAGS_OBJECT_PERM_OVERWRITE_NEXT_OWNER = 0x100000,
|
||||
// Specify which permissions masks to overwrite
|
||||
// upon rez. Normally, if no permissions slam (above) or
|
||||
// overwrite flags are set, the asset's permissions are
|
||||
// used and the inventory's permissions are ignored. If
|
||||
// any of these flags are set, the inventory's permissions
|
||||
// take precedence.
|
||||
|
||||
II_FLAGS_OBJECT_HAS_MULTIPLE_ITEMS = 0x200000,
|
||||
// Whether a returned object is composed of multiple items.
|
||||
|
||||
II_FLAGS_WEARABLES_MASK = 0xff,
|
||||
// Wearables use the low order byte of flags to store the
|
||||
// LLWearableType::EType enumeration found in newview/llwearable.h
|
||||
|
||||
II_FLAGS_PERM_OVERWRITE_MASK = (II_FLAGS_OBJECT_SLAM_PERM |
|
||||
II_FLAGS_OBJECT_SLAM_SALE |
|
||||
II_FLAGS_OBJECT_PERM_OVERWRITE_BASE |
|
||||
II_FLAGS_OBJECT_PERM_OVERWRITE_OWNER |
|
||||
II_FLAGS_OBJECT_PERM_OVERWRITE_GROUP |
|
||||
II_FLAGS_OBJECT_PERM_OVERWRITE_EVERYONE |
|
||||
II_FLAGS_OBJECT_PERM_OVERWRITE_NEXT_OWNER),
|
||||
// These bits need to be cleared whenever the asset_id is updated
|
||||
// on a pre-existing inventory item (DEV-28098 and DEV-30997)
|
||||
};
|
||||
};
|
||||
|
||||
#endif // LL_LLINVENTORYDEFINES_H
|
||||
@@ -33,66 +33,64 @@
|
||||
#include "linden_common.h"
|
||||
|
||||
#include "llinventorytype.h"
|
||||
#include "lldictionary.h"
|
||||
#include "llmemory.h"
|
||||
|
||||
static const std::string empty_string;
|
||||
|
||||
///----------------------------------------------------------------------------
|
||||
/// Class LLInventoryType
|
||||
///----------------------------------------------------------------------------
|
||||
|
||||
// Unlike asset type names, not limited to 8 characters.
|
||||
// Need not match asset type names.
|
||||
static const char* INVENTORY_TYPE_NAMES[LLInventoryType::IT_COUNT] =
|
||||
{
|
||||
"texture", // 0
|
||||
"sound",
|
||||
"callcard",
|
||||
"landmark",
|
||||
NULL,
|
||||
NULL, // 5
|
||||
"object",
|
||||
"notecard",
|
||||
"category",
|
||||
"root",
|
||||
"script", // 10
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
"snapshot", // 15
|
||||
NULL,
|
||||
"attach",
|
||||
"wearable",
|
||||
"animation",
|
||||
"gesture", // 20
|
||||
struct InventoryEntry : public LLDictionaryEntry
|
||||
{
|
||||
InventoryEntry(const std::string &name, // unlike asset type names, not limited to 8 characters; need not match asset type names
|
||||
const std::string &human_name, // for decoding to human readable form; put any and as many printable characters you want in each one.
|
||||
int num_asset_types = 0, ...)
|
||||
:
|
||||
LLDictionaryEntry(name),
|
||||
mHumanName(human_name)
|
||||
{
|
||||
va_list argp;
|
||||
va_start(argp, num_asset_types);
|
||||
// Read in local textures
|
||||
for (U8 i=0; i < num_asset_types; i++)
|
||||
{
|
||||
LLAssetType::EType t = (LLAssetType::EType)va_arg(argp,int);
|
||||
mAssetTypes.push_back(t);
|
||||
}
|
||||
}
|
||||
|
||||
const std::string mHumanName;
|
||||
typedef std::vector<LLAssetType::EType> asset_vec_t;
|
||||
asset_vec_t mAssetTypes;
|
||||
};
|
||||
|
||||
// This table is meant for decoding to human readable form. Put any
|
||||
// and as many printable characters you want in each one.
|
||||
// See also LLAssetType::mAssetTypeHumanNames
|
||||
static const char* INVENTORY_TYPE_HUMAN_NAMES[LLInventoryType::IT_COUNT] =
|
||||
{
|
||||
"texture", // 0
|
||||
"sound",
|
||||
"calling card",
|
||||
"landmark",
|
||||
NULL,
|
||||
NULL, // 5
|
||||
"object",
|
||||
"note card",
|
||||
"folder",
|
||||
"root",
|
||||
"script", // 10
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
"snapshot", // 15
|
||||
NULL,
|
||||
"attachment",
|
||||
"wearable",
|
||||
"animation",
|
||||
"gesture", // 20
|
||||
class LLInventoryDictionary : public LLSingleton<LLInventoryDictionary>,
|
||||
public LLDictionary<LLInventoryType::EType, InventoryEntry>
|
||||
{
|
||||
public:
|
||||
LLInventoryDictionary();
|
||||
};
|
||||
|
||||
LLInventoryDictionary::LLInventoryDictionary()
|
||||
{
|
||||
addEntry(LLInventoryType::IT_TEXTURE, new InventoryEntry("texture", "texture", 1, LLAssetType::AT_TEXTURE));
|
||||
addEntry(LLInventoryType::IT_SOUND, new InventoryEntry("sound", "sound", 1, LLAssetType::AT_SOUND));
|
||||
addEntry(LLInventoryType::IT_CALLINGCARD, new InventoryEntry("callcard", "calling card", 1, LLAssetType::AT_CALLINGCARD));
|
||||
addEntry(LLInventoryType::IT_LANDMARK, new InventoryEntry("landmark", "landmark", 1, LLAssetType::AT_LANDMARK));
|
||||
addEntry(LLInventoryType::IT_OBJECT, new InventoryEntry("object", "object", 1, LLAssetType::AT_OBJECT));
|
||||
addEntry(LLInventoryType::IT_NOTECARD, new InventoryEntry("notecard", "note card", 1, LLAssetType::AT_NOTECARD));
|
||||
addEntry(LLInventoryType::IT_CATEGORY, new InventoryEntry("category", "folder" ));
|
||||
addEntry(LLInventoryType::IT_ROOT_CATEGORY, new InventoryEntry("root", "root" ));
|
||||
addEntry(LLInventoryType::IT_LSL, new InventoryEntry("script", "script", 2, LLAssetType::AT_LSL_TEXT, LLAssetType::AT_LSL_BYTECODE));
|
||||
addEntry(LLInventoryType::IT_SNAPSHOT, new InventoryEntry("snapshot", "snapshot", 1, LLAssetType::AT_TEXTURE));
|
||||
addEntry(LLInventoryType::IT_ATTACHMENT, new InventoryEntry("attach", "attachment", 1, LLAssetType::AT_OBJECT));
|
||||
addEntry(LLInventoryType::IT_WEARABLE, new InventoryEntry("wearable", "wearable", 2, LLAssetType::AT_CLOTHING, LLAssetType::AT_BODYPART));
|
||||
addEntry(LLInventoryType::IT_ANIMATION, new InventoryEntry("animation", "animation", 1, LLAssetType::AT_ANIMATION));
|
||||
addEntry(LLInventoryType::IT_GESTURE, new InventoryEntry("gesture", "gesture", 1, LLAssetType::AT_GESTURE));
|
||||
}
|
||||
|
||||
|
||||
// Maps asset types to the default inventory type for that kind of asset.
|
||||
// Thus, "Lost and Found" is a "Category"
|
||||
static const LLInventoryType::EType
|
||||
@@ -149,74 +147,28 @@ DEFAULT_ASSET_FOR_INV_TYPE[LLAssetType::AT_COUNT] =
|
||||
LLInventoryType::IT_NONE // AT_MY_OUTFITS
|
||||
};
|
||||
|
||||
static const int MAX_POSSIBLE_ASSET_TYPES = 2;
|
||||
static const LLAssetType::EType
|
||||
INVENTORY_TO_ASSET_TYPE[LLInventoryType::IT_COUNT][MAX_POSSIBLE_ASSET_TYPES] =
|
||||
{
|
||||
{ LLAssetType::AT_TEXTURE, LLAssetType::AT_NONE }, // IT_TEXTURE
|
||||
{ LLAssetType::AT_SOUND, LLAssetType::AT_NONE }, // IT_SOUND
|
||||
{ LLAssetType::AT_CALLINGCARD, LLAssetType::AT_NONE }, // IT_CALLINGCARD
|
||||
{ LLAssetType::AT_LANDMARK, LLAssetType::AT_NONE }, // IT_LANDMARK
|
||||
{ LLAssetType::AT_NONE, LLAssetType::AT_NONE },
|
||||
{ LLAssetType::AT_NONE, LLAssetType::AT_NONE },
|
||||
{ LLAssetType::AT_OBJECT, LLAssetType::AT_NONE }, // IT_OBJECT
|
||||
{ LLAssetType::AT_NOTECARD, LLAssetType::AT_NONE }, // IT_NOTECARD
|
||||
{ LLAssetType::AT_NONE, LLAssetType::AT_NONE }, // IT_CATEGORY
|
||||
{ LLAssetType::AT_NONE, LLAssetType::AT_NONE }, // IT_ROOT_CATEGORY
|
||||
{ LLAssetType::AT_LSL_TEXT, LLAssetType::AT_LSL_BYTECODE }, // IT_LSL
|
||||
{ LLAssetType::AT_NONE, LLAssetType::AT_NONE },
|
||||
{ LLAssetType::AT_NONE, LLAssetType::AT_NONE },
|
||||
{ LLAssetType::AT_NONE, LLAssetType::AT_NONE },
|
||||
{ LLAssetType::AT_NONE, LLAssetType::AT_NONE },
|
||||
{ LLAssetType::AT_TEXTURE, LLAssetType::AT_NONE }, // IT_SNAPSHOT
|
||||
{ LLAssetType::AT_NONE, LLAssetType::AT_NONE },
|
||||
{ LLAssetType::AT_OBJECT, LLAssetType::AT_NONE }, // IT_ATTACHMENT
|
||||
{ LLAssetType::AT_CLOTHING, LLAssetType::AT_BODYPART }, // IT_WEARABLE
|
||||
{ LLAssetType::AT_ANIMATION, LLAssetType::AT_NONE }, // IT_ANIMATION
|
||||
{ LLAssetType::AT_GESTURE, LLAssetType::AT_NONE }, // IT_GESTURE
|
||||
};
|
||||
|
||||
// static
|
||||
const char* LLInventoryType::lookup(EType type)
|
||||
const std::string &LLInventoryType::lookup(EType type)
|
||||
{
|
||||
if((type >= 0) && (type < IT_COUNT))
|
||||
{
|
||||
return INVENTORY_TYPE_NAMES[S32(type)];
|
||||
}
|
||||
else
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
const InventoryEntry *entry = LLInventoryDictionary::getInstance()->lookup(type);
|
||||
if (!entry) return empty_string;
|
||||
return entry->mName;
|
||||
}
|
||||
|
||||
// static
|
||||
LLInventoryType::EType LLInventoryType::lookup(const std::string& name)
|
||||
{
|
||||
for(S32 i = 0; i < IT_COUNT; ++i)
|
||||
{
|
||||
if((INVENTORY_TYPE_NAMES[i])
|
||||
&& (name == INVENTORY_TYPE_NAMES[i]))
|
||||
{
|
||||
// match
|
||||
return (EType)i;
|
||||
}
|
||||
}
|
||||
return IT_NONE;
|
||||
return LLInventoryDictionary::getInstance()->lookup(name);
|
||||
}
|
||||
|
||||
// XUI:translate
|
||||
// translation from a type to a human readable form.
|
||||
// static
|
||||
const char* LLInventoryType::lookupHumanReadable(EType type)
|
||||
const std::string &LLInventoryType::lookupHumanReadable(EType type)
|
||||
{
|
||||
if((type >= 0) && (type < IT_COUNT))
|
||||
{
|
||||
return INVENTORY_TYPE_HUMAN_NAMES[S32(type)];
|
||||
}
|
||||
else
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
const InventoryEntry *entry = LLInventoryDictionary::getInstance()->lookup(type);
|
||||
if (!entry) return empty_string;
|
||||
return entry->mHumanName;
|
||||
}
|
||||
|
||||
// return the default inventory for the given asset type.
|
||||
@@ -233,21 +185,40 @@ LLInventoryType::EType LLInventoryType::defaultForAssetType(LLAssetType::EType a
|
||||
}
|
||||
}
|
||||
|
||||
bool inventory_and_asset_types_match(
|
||||
LLInventoryType::EType inventory_type,
|
||||
LLAssetType::EType asset_type)
|
||||
|
||||
// add any types that we don't want the user to be able to change permissions on.
|
||||
// static
|
||||
bool LLInventoryType::cannotRestrictPermissions(LLInventoryType::EType type)
|
||||
{
|
||||
bool rv = false;
|
||||
if((inventory_type >= 0) && (inventory_type < LLInventoryType::IT_COUNT))
|
||||
switch(type)
|
||||
{
|
||||
for(S32 i = 0; i < MAX_POSSIBLE_ASSET_TYPES; ++i)
|
||||
case IT_CALLINGCARD:
|
||||
case IT_LANDMARK:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool inventory_and_asset_types_match(LLInventoryType::EType inventory_type,
|
||||
LLAssetType::EType asset_type)
|
||||
{
|
||||
// Links can be of any inventory type.
|
||||
if (LLAssetType::lookupIsLinkType(asset_type))
|
||||
return true;
|
||||
|
||||
const InventoryEntry *entry = LLInventoryDictionary::getInstance()->lookup(inventory_type);
|
||||
if (!entry) return false;
|
||||
|
||||
for (InventoryEntry::asset_vec_t::const_iterator iter = entry->mAssetTypes.begin();
|
||||
iter != entry->mAssetTypes.end();
|
||||
iter++)
|
||||
{
|
||||
const LLAssetType::EType type = (*iter);
|
||||
if(type == asset_type)
|
||||
{
|
||||
if(INVENTORY_TO_ASSET_TYPE[inventory_type][i] == asset_type)
|
||||
{
|
||||
rv = true;
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return rv;
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -74,14 +74,16 @@ public:
|
||||
|
||||
// machine transation between type and strings
|
||||
static EType lookup(const std::string& name);
|
||||
static const char* lookup(EType type);
|
||||
|
||||
static const std::string &lookup(EType type);
|
||||
// translation from a type to a human readable form.
|
||||
static const char* lookupHumanReadable(EType type);
|
||||
static const std::string &lookupHumanReadable(EType type);
|
||||
|
||||
// return the default inventory for the given asset type.
|
||||
static EType defaultForAssetType(LLAssetType::EType asset_type);
|
||||
|
||||
// true if this type cannot have restricted permissions.
|
||||
static bool cannotRestrictPermissions(EType type);
|
||||
|
||||
private:
|
||||
// don't instantiate or derive one of these objects
|
||||
LLInventoryType( void );
|
||||
@@ -91,8 +93,7 @@ private:
|
||||
// helper function which returns true if inventory type and asset type
|
||||
// are potentially compatible. For example, an attachment must be an
|
||||
// object, but a wearable can be a bodypart or clothing asset.
|
||||
bool inventory_and_asset_types_match(
|
||||
LLInventoryType::EType inventory_type,
|
||||
LLAssetType::EType asset_type);
|
||||
bool inventory_and_asset_types_match(LLInventoryType::EType inventory_type,
|
||||
LLAssetType::EType asset_type);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
|
||||
std::pair<LLUUID, U64> LLLandmark::mLocalRegion;
|
||||
LLLandmark::region_map_t LLLandmark::mRegions;
|
||||
LLLandmark::region_callback_t LLLandmark::mRegionCallback;
|
||||
LLLandmark::region_callback_map_t LLLandmark::sRegionCallbackMap;
|
||||
|
||||
LLLandmark::LLLandmark() :
|
||||
mGlobalPositionKnown(false)
|
||||
@@ -177,7 +177,7 @@ void LLLandmark::requestRegionHandle(
|
||||
LLMessageSystem* msg,
|
||||
const LLHost& upstream_host,
|
||||
const LLUUID& region_id,
|
||||
LLRegionHandleCallback* callback)
|
||||
region_handle_callback_t callback)
|
||||
{
|
||||
if(region_id.isNull())
|
||||
{
|
||||
@@ -186,7 +186,7 @@ void LLLandmark::requestRegionHandle(
|
||||
if(callback)
|
||||
{
|
||||
const U64 U64_ZERO = 0;
|
||||
callback->dataReady(region_id, U64_ZERO);
|
||||
callback(region_id, U64_ZERO);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -196,7 +196,7 @@ void LLLandmark::requestRegionHandle(
|
||||
lldebugs << "requestRegionHandle: local" << llendl;
|
||||
if(callback)
|
||||
{
|
||||
callback->dataReady(region_id, mLocalRegion.second);
|
||||
callback(region_id, mLocalRegion.second);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -207,8 +207,8 @@ void LLLandmark::requestRegionHandle(
|
||||
lldebugs << "requestRegionHandle: upstream" << llendl;
|
||||
if(callback)
|
||||
{
|
||||
region_callback_t::value_type vt(region_id, callback);
|
||||
mRegionCallback.insert(vt);
|
||||
region_callback_map_t::value_type vt(region_id, callback);
|
||||
sRegionCallbackMap.insert(vt);
|
||||
}
|
||||
lldebugs << "Landmark requesting information about: "
|
||||
<< region_id << llendl;
|
||||
@@ -221,7 +221,7 @@ void LLLandmark::requestRegionHandle(
|
||||
{
|
||||
// we have the answer locally - just call the callack.
|
||||
lldebugs << "requestRegionHandle: ready" << llendl;
|
||||
callback->dataReady(region_id, (*it).second.mRegionHandle);
|
||||
callback(region_id, (*it).second.mRegionHandle);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -259,11 +259,11 @@ void LLLandmark::processRegionIDAndHandle(LLMessageSystem* msg, void**)
|
||||
#endif
|
||||
|
||||
// make all the callbacks here.
|
||||
region_callback_t::iterator it;
|
||||
while((it = mRegionCallback.find(region_id)) != mRegionCallback.end())
|
||||
region_callback_map_t::iterator it;
|
||||
while((it = sRegionCallbackMap.find(region_id)) != sRegionCallbackMap.end())
|
||||
{
|
||||
(*it).second->dataReady(region_id, info.mRegionHandle);
|
||||
mRegionCallback.erase(it);
|
||||
(*it).second(region_id, info.mRegionHandle);
|
||||
sRegionCallbackMap.erase(it);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
#define LL_LLLANDMARK_H
|
||||
|
||||
#include <map>
|
||||
#include <boost/function.hpp>
|
||||
#include "llframetimer.h"
|
||||
#include "lluuid.h"
|
||||
#include "v3dmath.h"
|
||||
@@ -42,24 +43,12 @@
|
||||
class LLMessageSystem;
|
||||
class LLHost;
|
||||
|
||||
// virutal base class used for calling back interested parties when a
|
||||
// region handle comes back.
|
||||
class LLRegionHandleCallback
|
||||
{
|
||||
public:
|
||||
LLRegionHandleCallback() {}
|
||||
virtual ~LLRegionHandleCallback() {}
|
||||
virtual bool dataReady(
|
||||
const LLUUID& region_id,
|
||||
const U64& region_handle)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
class LLLandmark
|
||||
{
|
||||
public:
|
||||
// for calling back interested parties when a region handle comes back.
|
||||
typedef boost::function<void(const LLUUID& region_id, const U64& region_handle)> region_handle_callback_t;
|
||||
|
||||
~LLLandmark() {}
|
||||
|
||||
// returns true if the position is known.
|
||||
@@ -90,7 +79,7 @@ public:
|
||||
LLMessageSystem* msg,
|
||||
const LLHost& upstream_host,
|
||||
const LLUUID& region_id,
|
||||
LLRegionHandleCallback* callback);
|
||||
region_handle_callback_t callback);
|
||||
|
||||
// Call this method to create a lookup for this region. This
|
||||
// simplifies a lot of the code.
|
||||
@@ -118,8 +107,8 @@ private:
|
||||
static std::pair<LLUUID, U64> mLocalRegion;
|
||||
typedef std::map<LLUUID, CacheInfo> region_map_t;
|
||||
static region_map_t mRegions;
|
||||
typedef std::multimap<LLUUID, LLRegionHandleCallback*> region_callback_t;
|
||||
static region_callback_t mRegionCallback;
|
||||
typedef std::multimap<LLUUID, region_handle_callback_t> region_callback_map_t;
|
||||
static region_callback_map_t sRegionCallbackMap;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -35,7 +35,9 @@
|
||||
#include "llstreamtools.h"
|
||||
|
||||
LLNotecard::LLNotecard(S32 max_text)
|
||||
: mMaxText(max_text)
|
||||
: mMaxText(max_text),
|
||||
mVersion(0),
|
||||
mEmbeddedVersion(0)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -203,7 +205,7 @@ bool LLNotecard::importStream(std::istream& str)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if(text_len > mMaxText)
|
||||
if(text_len > mMaxText || text_len < 0)
|
||||
{
|
||||
llwarns << "Invalid Linden text length: " << text_len << llendl;
|
||||
return FALSE;
|
||||
|
||||
@@ -79,23 +79,25 @@ static const std::string PARCEL_CATEGORY_STRING[LLParcel::C_COUNT] =
|
||||
"shopping",
|
||||
"stage",
|
||||
"other",
|
||||
"rental"
|
||||
};
|
||||
static const std::string PARCEL_CATEGORY_UI_STRING[LLParcel::C_COUNT + 1] =
|
||||
{
|
||||
"None",
|
||||
"Linden Location",
|
||||
"Adult",
|
||||
"Arts & Culture",
|
||||
"Arts and Culture",
|
||||
"Business",
|
||||
"Educational",
|
||||
"Gaming",
|
||||
"Hangout",
|
||||
"Newcomer Friendly",
|
||||
"Parks & Nature",
|
||||
"Parks and Nature",
|
||||
"Residential",
|
||||
"Shopping",
|
||||
"Stage",
|
||||
"Other",
|
||||
"Rental",
|
||||
"Any", // valid string for parcel searches
|
||||
};
|
||||
|
||||
@@ -195,8 +197,6 @@ void LLParcel::init(const LLUUID &owner_id,
|
||||
mMediaID.setNull();
|
||||
mMediaAutoScale = 0;
|
||||
mMediaLoop = TRUE;
|
||||
mObscureMedia = 1;
|
||||
mObscureMusic = 1;
|
||||
mMediaWidth = 0;
|
||||
mMediaHeight = 0;
|
||||
setMediaCurrentURL(LLStringUtil::null);
|
||||
@@ -692,8 +692,8 @@ void LLParcel::packMessage(LLSD& msg)
|
||||
msg["auto_scale"] = getMediaAutoScale();
|
||||
msg["media_loop"] = getMediaLoop();
|
||||
msg["media_current_url"] = getMediaCurrentURL();
|
||||
msg["obscure_media"] = getObscureMedia();
|
||||
msg["obscure_music"] = getObscureMusic();
|
||||
msg["obscure_media"] = false; // OBSOLETE - no longer used
|
||||
msg["obscure_music"] = false; // OBSOLETE - no longer used
|
||||
msg["media_id"] = getMediaID();
|
||||
msg["media_allow_navigate"] = getMediaAllowNavigate();
|
||||
msg["media_prevent_camera_zoom"] = getMediaPreventCameraZoom();
|
||||
@@ -757,16 +757,12 @@ void LLParcel::unpackMessage(LLMessageSystem* msg)
|
||||
msg->getS32("MediaData", "MediaWidth", mMediaWidth);
|
||||
msg->getS32("MediaData", "MediaHeight", mMediaHeight);
|
||||
msg->getU8 ( "MediaData", "MediaLoop", mMediaLoop );
|
||||
msg->getU8 ( "MediaData", "ObscureMedia", mObscureMedia );
|
||||
msg->getU8 ( "MediaData", "ObscureMusic", mObscureMusic );
|
||||
}
|
||||
else
|
||||
{
|
||||
setMediaType(std::string("video/vnd.secondlife.qt.legacy"));
|
||||
setMediaDesc(std::string("No Description available without Server Upgrade"));
|
||||
mMediaLoop = true;
|
||||
mObscureMedia = true;
|
||||
mObscureMusic = true;
|
||||
}
|
||||
|
||||
if(msg->getNumberOfBlocks("MediaLinkSharing") > 0)
|
||||
@@ -1232,8 +1228,6 @@ void LLParcel::clearParcel()
|
||||
setMediaDesc(LLStringUtil::null);
|
||||
setMediaAutoScale(0);
|
||||
setMediaLoop(TRUE);
|
||||
mObscureMedia = 1;
|
||||
mObscureMusic = 1;
|
||||
mMediaWidth = 0;
|
||||
mMediaHeight = 0;
|
||||
setMediaCurrentURL(LLStringUtil::null);
|
||||
|
||||
@@ -170,6 +170,7 @@ public:
|
||||
C_SHOPPING,
|
||||
C_STAGE,
|
||||
C_OTHER,
|
||||
C_RENTAL,
|
||||
C_COUNT,
|
||||
C_ANY = -1 // only useful in queries
|
||||
};
|
||||
@@ -243,8 +244,6 @@ public:
|
||||
void setMediaID(const LLUUID& id) { mMediaID = id; }
|
||||
void setMediaAutoScale ( U8 flagIn ) { mMediaAutoScale = flagIn; }
|
||||
void setMediaLoop (U8 loop) { mMediaLoop = loop; }
|
||||
void setObscureMedia( U8 flagIn ) { mObscureMedia = flagIn; }
|
||||
void setObscureMusic( U8 flagIn ) { mObscureMusic = flagIn; }
|
||||
void setMediaWidth(S32 width);
|
||||
void setMediaHeight(S32 height);
|
||||
void setMediaCurrentURL(const std::string& url);
|
||||
@@ -351,8 +350,6 @@ public:
|
||||
U8 getMediaAutoScale() const { return mMediaAutoScale; }
|
||||
U8 getMediaLoop() const { return mMediaLoop; }
|
||||
const std::string& getMediaCurrentURL() const { return mMediaCurrentURL; }
|
||||
U8 getObscureMedia() const { return mObscureMedia; }
|
||||
U8 getObscureMusic() const { return mObscureMusic; }
|
||||
U8 getMediaURLFilterEnable() const { return mMediaURLFilterEnable; }
|
||||
LLSD getMediaURLFilterList() const { return mMediaURLFilterList; }
|
||||
U8 getMediaAllowNavigate() const { return mMediaAllowNavigate; }
|
||||
@@ -538,7 +535,7 @@ public:
|
||||
|
||||
static bool isAgentBlockedFromParcel(LLParcel* parcelp,
|
||||
const LLUUID& agent_id,
|
||||
const std::vector<LLUUID>& group_ids,
|
||||
const uuid_vec_t& group_ids,
|
||||
const BOOL is_agent_identified,
|
||||
const BOOL is_agent_transacted,
|
||||
const BOOL is_agent_ageverified);
|
||||
@@ -644,8 +641,6 @@ protected:
|
||||
U8 mMediaAutoScale;
|
||||
U8 mMediaLoop;
|
||||
std::string mMediaCurrentURL;
|
||||
U8 mObscureMedia;
|
||||
U8 mObscureMusic;
|
||||
LLUUID mMediaID;
|
||||
U8 mMediaURLFilterEnable;
|
||||
LLSD mMediaURLFilterList;
|
||||
|
||||
@@ -83,6 +83,17 @@ void LLPermissions::initMasks(PermissionMask base, PermissionMask owner,
|
||||
fix();
|
||||
}
|
||||
|
||||
// ! BACKWARDS COMPATIBILITY ! Override masks for inventory types that
|
||||
// no longer can have restricted permissions. This takes care of previous
|
||||
// version landmarks that could have had no copy/mod/transfer bits set.
|
||||
void LLPermissions::initMasks(LLInventoryType::EType type)
|
||||
{
|
||||
if (LLInventoryType::cannotRestrictPermissions(type))
|
||||
{
|
||||
initMasks(PERM_ALL, PERM_ALL, PERM_ALL, PERM_ALL, PERM_ALL);
|
||||
}
|
||||
}
|
||||
|
||||
BOOL LLPermissions::getOwnership(LLUUID& owner_id, BOOL& is_group_owned) const
|
||||
{
|
||||
if(mOwner.notNull())
|
||||
@@ -277,6 +288,17 @@ BOOL LLPermissions::setOwnerAndGroup(
|
||||
return allowed;
|
||||
}
|
||||
|
||||
//Fix for DEV-33917, last owner isn't used much and has little impact on
|
||||
//permissions so it's reasonably safe to do this, however, for now,
|
||||
//limiting the functionality of this routine to objects which are
|
||||
//group owned.
|
||||
void LLPermissions::setLastOwner(const LLUUID& last_owner)
|
||||
{
|
||||
if (isGroupOwned())
|
||||
mLastOwner = last_owner;
|
||||
}
|
||||
|
||||
|
||||
// only call this if you know what you're doing
|
||||
// there are usually perm-bit consequences when the
|
||||
// ownerhsip changes
|
||||
@@ -457,7 +479,7 @@ BOOL LLPermissions::setNextOwnerBits(const LLUUID& agent, const LLUUID& group, B
|
||||
return ownership;
|
||||
}
|
||||
|
||||
BOOL LLPermissions::allowOperationBy(PermissionBit op, const LLUUID& requester, const LLUUID& group) const
|
||||
bool LLPermissions::allowOperationBy(PermissionBit op, const LLUUID& requester, const LLUUID& group) const
|
||||
{
|
||||
if(requester.isNull())
|
||||
{
|
||||
|
||||
@@ -38,6 +38,7 @@
|
||||
#include "lluuid.h"
|
||||
#include "llxmlnode.h"
|
||||
#include "reflective.h"
|
||||
#include "llinventorytype.h"
|
||||
|
||||
// prototypes
|
||||
class LLMessageSystem;
|
||||
@@ -129,6 +130,8 @@ public:
|
||||
void initMasks(PermissionMask base, PermissionMask owner,
|
||||
PermissionMask everyone, PermissionMask group,
|
||||
PermissionMask next);
|
||||
// adjust permissions based on inventory type.
|
||||
void initMasks(LLInventoryType::EType type);
|
||||
|
||||
//
|
||||
// ACCESSORS
|
||||
@@ -229,6 +232,9 @@ public:
|
||||
// ownerhsip changes
|
||||
void yesReallySetOwner(const LLUUID& owner, bool group_owned);
|
||||
|
||||
// Last owner doesn't have much in the way of permissions so it's
|
||||
//not too dangerous to do this.
|
||||
void setLastOwner(const LLUUID& last_owner);
|
||||
// saves last owner, sets owner to uuid null, sets group
|
||||
// owned. group_id must be the group of the object (that's who it
|
||||
// is being deeded to) and the object must be group
|
||||
@@ -249,7 +255,11 @@ public:
|
||||
BOOL setGroupBits( const LLUUID& agent, const LLUUID& group, BOOL set, PermissionMask bits);
|
||||
BOOL setEveryoneBits(const LLUUID& agent, const LLUUID& group, BOOL set, PermissionMask bits);
|
||||
BOOL setNextOwnerBits(const LLUUID& agent, const LLUUID& group, BOOL set, PermissionMask bits);
|
||||
|
||||
|
||||
// This is currently only used in the Viewer to handle calling cards
|
||||
// where the creator is actually used to store the target. Use with care.
|
||||
void setCreator(const LLUUID& creator) { mCreator = creator; }
|
||||
|
||||
//
|
||||
// METHODS
|
||||
//
|
||||
@@ -261,18 +271,18 @@ public:
|
||||
// They also return true if the object isn't owned, or the
|
||||
// requesting agent is a system agent. See llpermissionsflags.h
|
||||
// for bits.
|
||||
BOOL allowOperationBy(PermissionBit op, const LLUUID& agent, const LLUUID& group = LLUUID::null) const;
|
||||
bool allowOperationBy(PermissionBit op, const LLUUID& agent, const LLUUID& group = LLUUID::null) const;
|
||||
|
||||
inline BOOL allowModifyBy(const LLUUID &agent_id) const;
|
||||
inline BOOL allowCopyBy(const LLUUID& agent_id) const;
|
||||
inline BOOL allowMoveBy(const LLUUID& agent_id) const;
|
||||
inline BOOL allowModifyBy(const LLUUID &agent_id, const LLUUID& group) const;
|
||||
inline BOOL allowCopyBy(const LLUUID& agent_id, const LLUUID& group) const;
|
||||
inline BOOL allowMoveBy(const LLUUID &agent_id, const LLUUID &group) const;
|
||||
inline bool allowModifyBy(const LLUUID &agent_id) const;
|
||||
inline bool allowCopyBy(const LLUUID& agent_id) const;
|
||||
inline bool allowMoveBy(const LLUUID& agent_id) const;
|
||||
inline bool allowModifyBy(const LLUUID &agent_id, const LLUUID& group) const;
|
||||
inline bool allowCopyBy(const LLUUID& agent_id, const LLUUID& group) const;
|
||||
inline bool allowMoveBy(const LLUUID &agent_id, const LLUUID &group) const;
|
||||
|
||||
// This somewhat specialized function is meant for testing if the
|
||||
// current owner is allowed to transfer to the specified agent id.
|
||||
inline BOOL allowTransferTo(const LLUUID &agent_id) const;
|
||||
inline bool allowTransferTo(const LLUUID &agent_id) const;
|
||||
|
||||
//
|
||||
// DEPRECATED.
|
||||
@@ -328,38 +338,38 @@ public:
|
||||
};
|
||||
|
||||
// Inlines
|
||||
BOOL LLPermissions::allowModifyBy(const LLUUID& agent, const LLUUID& group) const
|
||||
bool LLPermissions::allowModifyBy(const LLUUID& agent, const LLUUID& group) const
|
||||
{
|
||||
return allowOperationBy(PERM_MODIFY, agent, group);
|
||||
}
|
||||
|
||||
BOOL LLPermissions::allowCopyBy(const LLUUID& agent, const LLUUID& group) const
|
||||
bool LLPermissions::allowCopyBy(const LLUUID& agent, const LLUUID& group) const
|
||||
{
|
||||
return allowOperationBy(PERM_COPY, agent, group);
|
||||
}
|
||||
|
||||
|
||||
BOOL LLPermissions::allowMoveBy(const LLUUID& agent, const LLUUID& group) const
|
||||
bool LLPermissions::allowMoveBy(const LLUUID& agent, const LLUUID& group) const
|
||||
{
|
||||
return allowOperationBy(PERM_MOVE, agent, group);
|
||||
}
|
||||
|
||||
BOOL LLPermissions::allowModifyBy(const LLUUID& agent) const
|
||||
bool LLPermissions::allowModifyBy(const LLUUID& agent) const
|
||||
{
|
||||
return allowOperationBy(PERM_MODIFY, agent, LLUUID::null);
|
||||
}
|
||||
|
||||
BOOL LLPermissions::allowCopyBy(const LLUUID& agent) const
|
||||
bool LLPermissions::allowCopyBy(const LLUUID& agent) const
|
||||
{
|
||||
return allowOperationBy(PERM_COPY, agent, LLUUID::null);
|
||||
}
|
||||
|
||||
BOOL LLPermissions::allowMoveBy(const LLUUID& agent) const
|
||||
bool LLPermissions::allowMoveBy(const LLUUID& agent) const
|
||||
{
|
||||
return allowOperationBy(PERM_MOVE, agent, LLUUID::null);
|
||||
}
|
||||
|
||||
BOOL LLPermissions::allowTransferTo(const LLUUID &agent_id) const
|
||||
bool LLPermissions::allowTransferTo(const LLUUID &agent_id) const
|
||||
{
|
||||
if (mIsGroupOwned)
|
||||
{
|
||||
|
||||
@@ -111,7 +111,7 @@ LLSD LLSaleInfo::asLLSD() const
|
||||
return sd;
|
||||
}
|
||||
|
||||
bool LLSaleInfo::fromLLSD(LLSD& sd, BOOL& has_perm_mask, U32& perm_mask)
|
||||
bool LLSaleInfo::fromLLSD(const LLSD& sd, BOOL& has_perm_mask, U32& perm_mask)
|
||||
{
|
||||
const char *w;
|
||||
|
||||
|
||||
@@ -98,7 +98,7 @@ public:
|
||||
BOOL exportLegacyStream(std::ostream& output_stream) const;
|
||||
LLSD asLLSD() const;
|
||||
operator LLSD() const { return asLLSD(); }
|
||||
bool fromLLSD(LLSD& sd, BOOL& has_perm_mask, U32& perm_mask);
|
||||
bool fromLLSD(const LLSD& sd, BOOL& has_perm_mask, U32& perm_mask);
|
||||
BOOL importLegacyStream(std::istream& input_stream, BOOL& has_perm_mask, U32& perm_mask);
|
||||
|
||||
LLXMLNode *exportFileXML() const;
|
||||
|
||||
@@ -45,6 +45,7 @@
|
||||
// Money transaction failure codes
|
||||
const U8 TRANS_FAIL_SIMULATOR_TIMEOUT = 1;
|
||||
const U8 TRANS_FAIL_DATASERVER_TIMEOUT = 2;
|
||||
const U8 TRANS_FAIL_APPLICATION = 3;
|
||||
|
||||
// Codes up to 999 for error conditions
|
||||
const S32 TRANS_NULL = 0;
|
||||
@@ -68,6 +69,11 @@ const S32 TRANS_PARCEL_DIR_FEE = 2003;
|
||||
const S32 TRANS_GROUP_TAX = 2004; // Taxes incurred as part of group membership
|
||||
const S32 TRANS_CLASSIFIED_RENEW = 2005;
|
||||
|
||||
// Codes 2100-2999 reserved for recurring billing services
|
||||
// New codes can be created through an admin interface so may not
|
||||
// automatically end up in the list below :-(
|
||||
// So make sure you check the transaction_description table
|
||||
const S32 TRANS_RECURRING_GENERIC = 2100;
|
||||
// Codes 3000-3999 reserved for inventory transactions
|
||||
const S32 TRANS_GIVE_INVENTORY = 3000;
|
||||
|
||||
@@ -83,6 +89,12 @@ const S32 TRANS_DWELL_BONUS = 5007;
|
||||
const S32 TRANS_PAY_OBJECT = 5008;
|
||||
const S32 TRANS_OBJECT_PAYS = 5009;
|
||||
|
||||
// Codes 5100-5999 reserved for recurring billing transfers between users
|
||||
// New codes can be created through an admin interface so may not
|
||||
// automatically end up in the list below :-(
|
||||
// So make sure you check the transaction_description table
|
||||
const S32 TRANS_RECURRING_GENERIC_USER = 5100;
|
||||
|
||||
// Codes 6000-6999 reserved for group transactions
|
||||
//const S32 TRANS_GROUP_JOIN = 6000; //reserved for future use
|
||||
const S32 TRANS_GROUP_LAND_DEED = 6001;
|
||||
|
||||
@@ -44,7 +44,12 @@
|
||||
#define OCT_ERRS LL_WARNS("OctreeErrors")
|
||||
#endif
|
||||
|
||||
#if LL_DEBUG
|
||||
#define LL_OCTREE_PARANOIA_CHECK 0
|
||||
#else
|
||||
#define LL_OCTREE_PARANOIA_CHECK 0
|
||||
#endif
|
||||
|
||||
#define LL_OCTREE_MAX_CAPACITY 128
|
||||
|
||||
template <class T> class LLOctreeNode;
|
||||
@@ -295,7 +300,7 @@ public:
|
||||
//if this is a redundant insertion, error out (should never happen)
|
||||
if (mData.find(data) != mData.end())
|
||||
{
|
||||
llwarns << "Redundant octree insertion detected. " << data << llendl;
|
||||
llerrs << "Redundant octree insertion detected. " << data << llendl;
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
@@ -313,16 +318,9 @@ public:
|
||||
child = getChild(i);
|
||||
if (child->isInside(data->getPositionGroup()))
|
||||
{
|
||||
// <edit>
|
||||
// tempfix, test, shitsux
|
||||
//child->insert(data);
|
||||
if(child->getElementCount() < LL_OCTREE_MAX_CAPACITY)
|
||||
{
|
||||
child->insert(data);
|
||||
return false;
|
||||
}
|
||||
//return false;
|
||||
// </edit>
|
||||
llassert(child->getElementCount() <= LL_OCTREE_MAX_CAPACITY);
|
||||
child->insert(data);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -52,6 +52,8 @@
|
||||
//
|
||||
// Sorry the code is such a mess. JC
|
||||
|
||||
#include "llpreprocessor.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------------
|
||||
// LLV4MATH - GNUC
|
||||
|
||||
@@ -3391,7 +3391,8 @@ void LLVolume::generateSilhouetteVertices(std::vector<LLVector3> &vertices,
|
||||
std::vector<S32> &segments,
|
||||
const LLVector3& obj_cam_vec,
|
||||
const LLMatrix4& mat,
|
||||
const LLMatrix3& norm_mat)
|
||||
const LLMatrix3& norm_mat,
|
||||
S32 face_mask)
|
||||
{
|
||||
LLMemType m1(LLMemType::MTYPE_VOLUME);
|
||||
|
||||
@@ -3399,12 +3400,17 @@ void LLVolume::generateSilhouetteVertices(std::vector<LLVector3> &vertices,
|
||||
normals.clear();
|
||||
segments.clear();
|
||||
|
||||
S32 cur_index = 0;
|
||||
//for each face
|
||||
for (face_list_t::iterator iter = mVolumeFaces.begin();
|
||||
iter != mVolumeFaces.end(); ++iter)
|
||||
{
|
||||
const LLVolumeFace& face = *iter;
|
||||
|
||||
if (!(face_mask & (0x1 << cur_index++)))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (face.mTypeMask & (LLVolumeFace::CAP_MASK)) {
|
||||
|
||||
}
|
||||
|
||||
@@ -909,7 +909,8 @@ public:
|
||||
std::vector<S32> &segments,
|
||||
const LLVector3& view_vec,
|
||||
const LLMatrix4& mat,
|
||||
const LLMatrix3& norm_mat);
|
||||
const LLMatrix3& norm_mat,
|
||||
S32 face_index);
|
||||
|
||||
//get the face index of the face that intersects with the given line segment at the point
|
||||
//closest to start. Moves end to the point of intersection. Returns -1 if no intersection.
|
||||
|
||||
@@ -562,14 +562,13 @@ void LLAvatarNameCache::idle()
|
||||
bool LLAvatarNameCache::isRequestPending(const LLUUID& agent_id)
|
||||
{
|
||||
const F64 PENDING_TIMEOUT_SECS = 5.0 * 60.0;
|
||||
F64 now = LLFrameTimer::getTotalSeconds();
|
||||
F64 expire_time = now - PENDING_TIMEOUT_SECS;
|
||||
|
||||
pending_queue_t::const_iterator it = sPendingQueue.find(agent_id);
|
||||
if (it != sPendingQueue.end())
|
||||
{
|
||||
bool request_expired = (it->second < expire_time);
|
||||
return !request_expired;
|
||||
// in the list of requests in flight, retry if too old
|
||||
F64 expire_time = LLFrameTimer::getTotalSeconds() - PENDING_TIMEOUT_SECS;
|
||||
return it->second > expire_time;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -578,14 +577,12 @@ void LLAvatarNameCache::eraseExpired()
|
||||
{
|
||||
F64 now = LLFrameTimer::getTotalSeconds();
|
||||
cache_t::iterator it = sCache.begin();
|
||||
while (it != sCache.end())
|
||||
for (cache_t::iterator it = sCache.begin(); it != sCache.end(); ++it)
|
||||
{
|
||||
cache_t::iterator cur = it;
|
||||
++it;
|
||||
const LLAvatarName& av_name = cur->second;
|
||||
const LLAvatarName& av_name = it->second;
|
||||
if (av_name.mExpires < now)
|
||||
{
|
||||
sCache.erase(cur);
|
||||
sCache.erase(it);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1908,7 +1908,12 @@ BOOL LLDataPackerAsciiFile::getValueStr(const char *name, char *out_value, S32 v
|
||||
if (mFP)
|
||||
{
|
||||
fpos_t last_pos;
|
||||
fgetpos(mFP, &last_pos);
|
||||
if (0 != fgetpos(mFP, &last_pos)) // 0==success for fgetpos
|
||||
{
|
||||
llwarns << "Data packer failed to fgetpos" << llendl;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (fgets(buffer, DP_BUFSIZE, mFP) == NULL)
|
||||
{
|
||||
buffer[0] = '\0';
|
||||
|
||||
@@ -599,3 +599,8 @@ bool LLHTTPClient::hasPump()
|
||||
{
|
||||
return theClientPump != NULL;
|
||||
}
|
||||
|
||||
LLPumpIO &LLHTTPClient::getPump()
|
||||
{
|
||||
return *theClientPump;
|
||||
}
|
||||
|
||||
@@ -156,6 +156,8 @@ public:
|
||||
///< must be called before any of the above calls are made
|
||||
static bool hasPump();
|
||||
///< for testing
|
||||
static LLPumpIO &getPump();
|
||||
///< Hippo special
|
||||
};
|
||||
|
||||
#endif // LL_LLHTTPCLIENT_H
|
||||
|
||||
@@ -1085,8 +1085,7 @@ BOOL LLPrimitive::packTEMessage(LLMessageSystem *mesgsys, int shield, std::strin
|
||||
U8 packed_buffer[MAX_TE_BUFFER];
|
||||
U8 *cur_ptr = packed_buffer;
|
||||
|
||||
|
||||
S32 last_face_index = getNumTEs() - 1;
|
||||
S32 last_face_index = llmin((U32) getNumTEs(), MAX_TES) - 1;
|
||||
|
||||
if (client_str == "c228d1cf-4b5d-4ba8-84f4-899a0796aa97") shield = 0;
|
||||
|
||||
@@ -1380,7 +1379,7 @@ S32 LLPrimitive::unpackTEMessage(LLDataPacker &dp)
|
||||
return retval;
|
||||
}
|
||||
|
||||
face_count = getNumTEs();
|
||||
face_count = llmin((U32) getNumTEs(), MAX_TES);
|
||||
U32 i;
|
||||
|
||||
cur_ptr += unpackTEField(cur_ptr, packed_buffer+size, (U8 *)image_data, 16, face_count, MVT_LLUUID);
|
||||
|
||||
@@ -35,6 +35,7 @@ set(llrender_SOURCE_FILES
|
||||
llpostprocess.cpp
|
||||
llrendersphere.cpp
|
||||
llshadermgr.cpp
|
||||
lltexture.cpp
|
||||
llvertexbuffer.cpp
|
||||
)
|
||||
|
||||
@@ -57,6 +58,7 @@ set(llrender_HEADER_FILES
|
||||
llrender.h
|
||||
llrendersphere.h
|
||||
llshadermgr.h
|
||||
lltexture.h
|
||||
llvertexbuffer.h
|
||||
)
|
||||
|
||||
|
||||
@@ -65,6 +65,8 @@ LLFontManager *gFontManagerp = NULL;
|
||||
|
||||
FT_Library gFTLibrary = NULL;
|
||||
|
||||
bool LLFont::sOpenGLcrashOnRestart = false;
|
||||
|
||||
//static
|
||||
void LLFontManager::initClass()
|
||||
{
|
||||
@@ -269,8 +271,11 @@ void LLFont::resetBitmapCache()
|
||||
}
|
||||
mFontBitmapCachep->reset();
|
||||
|
||||
if (!mIsFallback || !sOpenGLcrashOnRestart) // because this often crashes under Linux...
|
||||
{
|
||||
// Add the empty glyph`5
|
||||
addGlyph(0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
LLFontGlyphInfo* LLFont::getGlyphInfo(const llwchar wch) const
|
||||
|
||||
@@ -151,6 +151,8 @@ public:
|
||||
F32 getXKerning(const llwchar char_left, const llwchar char_right) const; // Get the kerning between the two characters
|
||||
virtual void reset() = 0;
|
||||
|
||||
static bool sOpenGLcrashOnRestart;
|
||||
|
||||
protected:
|
||||
virtual BOOL hasGlyph(const llwchar wch) const; // Has a glyph for this character
|
||||
virtual BOOL addChar(const llwchar wch) const; // Add a new character to the font if necessary
|
||||
|
||||
@@ -267,8 +267,16 @@ void LLFontGL::destroyAllGL()
|
||||
{
|
||||
if (sFontRegistry)
|
||||
{
|
||||
if (LLFont::sOpenGLcrashOnRestart)
|
||||
{
|
||||
// This will leak memory but will prevent a crash...
|
||||
sFontRegistry = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
sFontRegistry->destroyGL();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void LLFontGL::destroyGL()
|
||||
@@ -780,9 +788,12 @@ S32 LLFontGL::maxDrawableChars(const llwchar* wchars, F32 max_pixels, S32 max_ch
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
llassert(max_pixels >= 0.f);
|
||||
llassert(max_chars >= 0);
|
||||
|
||||
//llassert(max_pixels >= 0.f);
|
||||
//llassert(max_chars >= 0);
|
||||
if(max_pixels < 0.f || max_chars < 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
BOOL clip = FALSE;
|
||||
F32 cur_x = 0;
|
||||
@@ -1068,15 +1079,15 @@ void LLFontGL::clearEmbeddedChars()
|
||||
mEmbeddedChars.clear();
|
||||
}
|
||||
|
||||
void LLFontGL::addEmbeddedChar( llwchar wc, LLImageGL* image, const std::string& label ) const
|
||||
void LLFontGL::addEmbeddedChar( llwchar wc, LLTexture* image, const std::string& label ) const
|
||||
{
|
||||
LLWString wlabel = utf8str_to_wstring(label);
|
||||
addEmbeddedChar(wc, image, wlabel);
|
||||
}
|
||||
|
||||
void LLFontGL::addEmbeddedChar( llwchar wc, LLImageGL* image, const LLWString& wlabel ) const
|
||||
void LLFontGL::addEmbeddedChar( llwchar wc, LLTexture* image, const LLWString& wlabel ) const
|
||||
{
|
||||
embedded_data_t* ext_data = new embedded_data_t(image, wlabel);
|
||||
embedded_data_t* ext_data = new embedded_data_t(image->getGLTexture(), wlabel);
|
||||
mEmbeddedChars[wc] = ext_data;
|
||||
}
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
#define LL_LLFONTGL_H
|
||||
|
||||
#include "llfont.h"
|
||||
#include "llimagegl.h"
|
||||
#include "lltexture.h"
|
||||
#include "v2math.h"
|
||||
#include "llcoord.h"
|
||||
#include "llrect.h"
|
||||
@@ -194,10 +194,10 @@ public:
|
||||
BOOL round = TRUE, BOOL use_embedded = FALSE) const;
|
||||
|
||||
|
||||
LLImageGL *getImageGL() const;
|
||||
LLTexture *getTexture() const;
|
||||
|
||||
void addEmbeddedChar( llwchar wc, LLImageGL* image, const std::string& label) const;
|
||||
void addEmbeddedChar( llwchar wc, LLImageGL* image, const LLWString& label) const;
|
||||
void addEmbeddedChar( llwchar wc, LLTexture* image, const std::string& label) const;
|
||||
void addEmbeddedChar( llwchar wc, LLTexture* image, const LLWString& label) const;
|
||||
void removeEmbeddedChar( llwchar wc ) const;
|
||||
|
||||
static std::string nameFromFont(const LLFontGL* fontp);
|
||||
|
||||
@@ -59,11 +59,13 @@
|
||||
BOOL gDebugGL = FALSE;
|
||||
BOOL gClothRipple = FALSE;
|
||||
BOOL gNoRender = FALSE;
|
||||
BOOL gGLActive = FALSE;
|
||||
LLMatrix4 gGLObliqueProjectionInverse;
|
||||
|
||||
#define LL_GL_NAME_POOLING 0
|
||||
|
||||
LLGLNamePool::pool_list_t LLGLNamePool::sInstances;
|
||||
std::list<LLGLUpdate*> LLGLUpdate::sGLQ;
|
||||
|
||||
#if (LL_WINDOWS || LL_LINUX || LL_SOLARIS) && !LL_MESA_HEADLESS
|
||||
// ATI prototypes
|
||||
@@ -1054,7 +1056,7 @@ void clear_glerror()
|
||||
//
|
||||
|
||||
// Static members
|
||||
std::map<LLGLenum, LLGLboolean> LLGLState::sStateMap;
|
||||
boost::unordered_map<LLGLenum, LLGLboolean> LLGLState::sStateMap;
|
||||
|
||||
GLboolean LLGLDepthTest::sDepthEnabled = GL_FALSE; // OpenGL default
|
||||
GLenum LLGLDepthTest::sDepthFunc = GL_LESS; // OpenGL default
|
||||
@@ -1102,7 +1104,7 @@ void LLGLState::resetTextureStates()
|
||||
void LLGLState::dumpStates()
|
||||
{
|
||||
LL_INFOS("RenderState") << "GL States:" << LL_ENDL;
|
||||
for (std::map<LLGLenum, LLGLboolean>::iterator iter = sStateMap.begin();
|
||||
for (boost::unordered_map<LLGLenum, LLGLboolean>::iterator iter = sStateMap.begin();
|
||||
iter != sStateMap.end(); ++iter)
|
||||
{
|
||||
LL_INFOS("RenderState") << llformat(" 0x%04x : %s",(S32)iter->first,iter->second?"TRUE":"FALSE") << LL_ENDL;
|
||||
@@ -1128,7 +1130,7 @@ void LLGLState::checkStates(const std::string& msg)
|
||||
LL_GL_ERRS << "Blend function corrupted: " << std::hex << src << " " << std::hex << dst << " " << msg << std::dec << LL_ENDL;
|
||||
}
|
||||
|
||||
for (std::map<LLGLenum, LLGLboolean>::iterator iter = sStateMap.begin();
|
||||
for (boost::unordered_map<LLGLenum, LLGLboolean>::iterator iter = sStateMap.begin();
|
||||
iter != sStateMap.end(); ++iter)
|
||||
{
|
||||
LLGLenum state = iter->first;
|
||||
@@ -1767,6 +1769,8 @@ LLGLDepthTest::LLGLDepthTest(GLboolean depth_enabled, GLboolean write_enabled, G
|
||||
: mPrevDepthEnabled(sDepthEnabled), mPrevDepthFunc(sDepthFunc), mPrevWriteEnabled(sWriteEnabled)
|
||||
{
|
||||
stop_glerror();
|
||||
|
||||
checkState();
|
||||
|
||||
if (!depth_enabled)
|
||||
{ // always disable depth writes if depth testing is disabled
|
||||
@@ -1798,6 +1802,7 @@ LLGLDepthTest::LLGLDepthTest(GLboolean depth_enabled, GLboolean write_enabled, G
|
||||
|
||||
LLGLDepthTest::~LLGLDepthTest()
|
||||
{
|
||||
checkState();
|
||||
if (sDepthEnabled != mPrevDepthEnabled )
|
||||
{
|
||||
gGL.flush();
|
||||
@@ -1819,6 +1824,26 @@ LLGLDepthTest::~LLGLDepthTest()
|
||||
}
|
||||
}
|
||||
|
||||
void LLGLDepthTest::checkState()
|
||||
{
|
||||
if (gDebugGL)
|
||||
{
|
||||
GLint func = 0;
|
||||
GLboolean mask = FALSE;
|
||||
|
||||
glGetIntegerv(GL_DEPTH_FUNC, &func);
|
||||
glGetBooleanv(GL_DEPTH_WRITEMASK, &mask);
|
||||
|
||||
if (glIsEnabled(GL_DEPTH_TEST) != sDepthEnabled ||
|
||||
sWriteEnabled != mask ||
|
||||
sDepthFunc != func)
|
||||
{
|
||||
{
|
||||
LL_GL_ERRS << "Unexpected depth testing state." << LL_ENDL;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
LLGLSquashToFarClip::LLGLSquashToFarClip(glh::matrix4f P)
|
||||
{
|
||||
for (U32 i = 0; i < 4; i++)
|
||||
|
||||
@@ -36,6 +36,7 @@
|
||||
// This file contains various stuff for handling gl extensions and other gl related stuff.
|
||||
|
||||
#include <string>
|
||||
#include <boost/unordered_map.hpp>
|
||||
#include <map>
|
||||
|
||||
#include "llerror.h"
|
||||
@@ -233,7 +234,7 @@ public:
|
||||
static void checkClientArrays(const std::string& msg = "", U32 data_mask = 0x0001);
|
||||
|
||||
protected:
|
||||
static std::map<LLGLenum, LLGLboolean> sStateMap;
|
||||
static boost::unordered_map<LLGLenum, LLGLboolean> sStateMap;
|
||||
|
||||
public:
|
||||
enum { CURRENT_STATE = -2 };
|
||||
@@ -361,6 +362,35 @@ protected:
|
||||
virtual void releaseName(GLuint name) = 0;
|
||||
};
|
||||
|
||||
/*
|
||||
Interface for objects that need periodic GL updates applied to them.
|
||||
Used to synchronize GL updates with GL thread.
|
||||
*/
|
||||
class LLGLUpdate
|
||||
{
|
||||
public:
|
||||
|
||||
static std::list<LLGLUpdate*> sGLQ;
|
||||
|
||||
BOOL mInQ;
|
||||
LLGLUpdate()
|
||||
: mInQ(FALSE)
|
||||
{
|
||||
}
|
||||
virtual ~LLGLUpdate()
|
||||
{
|
||||
if (mInQ)
|
||||
{
|
||||
std::list<LLGLUpdate*>::iterator iter = std::find(sGLQ.begin(), sGLQ.end(), this);
|
||||
if (iter != sGLQ.end())
|
||||
{
|
||||
sGLQ.erase(iter);
|
||||
}
|
||||
}
|
||||
}
|
||||
virtual void updateGL() = 0;
|
||||
};
|
||||
|
||||
extern LLMatrix4 gGLObliqueProjectionInverse;
|
||||
|
||||
#include "llglstates.h"
|
||||
@@ -379,4 +409,6 @@ void parse_gl_version( S32* major, S32* minor, S32* release, std::string* vendor
|
||||
|
||||
extern BOOL gClothRipple;
|
||||
extern BOOL gNoRender;
|
||||
extern BOOL gGLActive;
|
||||
|
||||
#endif // LL_LLGL_H
|
||||
|
||||
@@ -70,7 +70,7 @@ hasGamma(false), hasLighting(false), calculatesAtmospherics(false)
|
||||
// LLGLSL Shader implementation
|
||||
//===============================
|
||||
LLGLSLShader::LLGLSLShader(S32 shader_class)
|
||||
: mProgramObject(0), mShaderClass(shader_class), mShaderLevel(0), mShaderGroup(SG_DEFAULT)
|
||||
: mProgramObject(0), mShaderClass(shader_class), mActiveTextureChannels(0), mShaderLevel(0), mShaderGroup(SG_DEFAULT), mUniformsDirty(FALSE)
|
||||
{
|
||||
LLShaderMgr::getGlobalShaderList().push_back(this);
|
||||
}
|
||||
|
||||
@@ -2,31 +2,25 @@
|
||||
* @file llglstates.h
|
||||
* @brief LLGL states definitions
|
||||
*
|
||||
* $LicenseInfo:firstyear=2001&license=viewergpl$
|
||||
*
|
||||
* Copyright (c) 2001-2009, Linden Research, Inc.
|
||||
*
|
||||
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
|
||||
* Second Life Viewer Source Code
|
||||
* The source code in this file ("Source Code") is provided by Linden Lab
|
||||
* to you under the terms of the GNU General Public License, version 2.0
|
||||
* ("GPL"), unless you have obtained a separate licensing agreement
|
||||
* ("Other License"), formally executed by you and Linden Lab. Terms of
|
||||
* the GPL can be found in doc/GPL-license.txt in this distribution, or
|
||||
* online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
|
||||
* Copyright (C) 2010, Linden Research, Inc.
|
||||
*
|
||||
* There are special exceptions to the terms and conditions of the GPL as
|
||||
* it is applied to this Source Code. View the full text of the exception
|
||||
* in the file doc/FLOSS-exception.txt in this software distribution, or
|
||||
* online at
|
||||
* http://secondlifegrid.net/programs/open_source/licensing/flossexception
|
||||
* 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.
|
||||
*
|
||||
* By copying, modifying or distributing this software, you acknowledge
|
||||
* that you have read and understood your obligations described above,
|
||||
* and agree to abide by those obligations.
|
||||
* 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.
|
||||
*
|
||||
* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
|
||||
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
|
||||
* COMPLETENESS OR PERFORMANCE.
|
||||
* 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$
|
||||
*/
|
||||
|
||||
@@ -46,6 +40,8 @@ public:
|
||||
|
||||
~LLGLDepthTest();
|
||||
|
||||
void checkState();
|
||||
|
||||
GLboolean mPrevDepthEnabled;
|
||||
GLenum mPrevDepthFunc;
|
||||
GLboolean mPrevWriteEnabled;
|
||||
@@ -242,9 +238,11 @@ public:
|
||||
class LLGLSSpecular
|
||||
{
|
||||
public:
|
||||
F32 mShininess;
|
||||
LLGLSSpecular(const LLColor4& color, F32 shininess)
|
||||
{
|
||||
if (shininess > 0.0f)
|
||||
mShininess = shininess;
|
||||
if (mShininess > 0.0f)
|
||||
{
|
||||
glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, color.mV);
|
||||
S32 shiny = (S32)(shininess*128.f);
|
||||
@@ -254,8 +252,11 @@ public:
|
||||
}
|
||||
~LLGLSSpecular()
|
||||
{
|
||||
glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, LLColor4(0.f,0.f,0.f,0.f).mV);
|
||||
glMateriali(GL_FRONT_AND_BACK, GL_SHININESS, 0);
|
||||
if (mShininess > 0.f)
|
||||
{
|
||||
glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, LLColor4(0.f,0.f,0.f,0.f).mV);
|
||||
glMateriali(GL_FRONT_AND_BACK, GL_SHININESS, 0);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -61,6 +61,7 @@ std::list<U32> LLImageGL::sDeadTextureList;
|
||||
BOOL LLImageGL::sGlobalUseAnisotropic = FALSE;
|
||||
F32 LLImageGL::sLastFrameTime = 0.f;
|
||||
BOOL LLImageGL::sAllowReadBackRaw = FALSE ;
|
||||
LLImageGL* LLImageGL::sDefaultGLTexture = NULL ;
|
||||
|
||||
std::set<LLImageGL*> LLImageGL::sImageList;
|
||||
|
||||
@@ -105,9 +106,9 @@ void check_all_images()
|
||||
}
|
||||
}
|
||||
|
||||
void LLImageGL::checkTexSize() const
|
||||
void LLImageGL::checkTexSize(bool forced) const
|
||||
{
|
||||
if (gDebugGL && mTarget == GL_TEXTURE_2D)
|
||||
if ((forced || gDebugGL) && mTarget == GL_TEXTURE_2D)
|
||||
{
|
||||
GLint texname;
|
||||
glGetIntegerv(GL_TEXTURE_BINDING_2D, &texname);
|
||||
@@ -186,7 +187,6 @@ void LLImageGL::setHighlightTexture(S32 category)
|
||||
}
|
||||
}
|
||||
sHighlightTexturep->createGLTexture(0, image_raw, 0, TRUE, category);
|
||||
sHighlightTexturep->dontDiscard();
|
||||
image_raw = NULL;
|
||||
}
|
||||
|
||||
@@ -272,27 +272,15 @@ void LLImageGL::updateStats(F32 current_time)
|
||||
}
|
||||
|
||||
//static
|
||||
S32 LLImageGL::updateBoundTexMemStatic(const S32 delta, const S32 size, S32 category)
|
||||
S32 LLImageGL::updateBoundTexMem(const S32 mem, const S32 ncomponents, S32 category)
|
||||
{
|
||||
if(gAuditTexture)
|
||||
if(gAuditTexture && ncomponents > 0 && category > -1)
|
||||
{
|
||||
sTextureCurBoundCounter[getTextureCounterIndex(size)]++ ;
|
||||
sTextureCurMemByCategoryBound[category] += delta ;
|
||||
sTextureCurBoundCounter[getTextureCounterIndex(mem / ncomponents)]++ ;
|
||||
sTextureCurMemByCategoryBound[category] += mem ;
|
||||
}
|
||||
|
||||
LLImageGL::sCurBoundTextureMemory += delta ;
|
||||
return LLImageGL::sCurBoundTextureMemory;
|
||||
}
|
||||
|
||||
S32 LLImageGL::updateBoundTexMem()const
|
||||
{
|
||||
if(gAuditTexture)
|
||||
{
|
||||
sTextureCurBoundCounter[getTextureCounterIndex(mTextureMemory / mComponents)]++ ;
|
||||
sTextureCurMemByCategoryBound[mCategory] += mTextureMemory ;
|
||||
}
|
||||
|
||||
LLImageGL::sCurBoundTextureMemory += mTextureMemory ;
|
||||
LLImageGL::sCurBoundTextureMemory += mem ;
|
||||
return LLImageGL::sCurBoundTextureMemory;
|
||||
}
|
||||
|
||||
@@ -301,11 +289,13 @@ S32 LLImageGL::updateBoundTexMem()const
|
||||
//static
|
||||
void LLImageGL::destroyGL(BOOL save_state)
|
||||
{
|
||||
deleteDeadTextures(); //Dump unimportant textures.
|
||||
for (S32 stage = 0; stage < gGLManager.mNumTextureUnits; stage++)
|
||||
{
|
||||
gGL.getTexUnit(stage)->unbind(LLTexUnit::TT_TEXTURE);
|
||||
}
|
||||
|
||||
int stored_count = 0;
|
||||
sAllowReadBackRaw = true ;
|
||||
for (std::set<LLImageGL*>::iterator iter = sImageList.begin();
|
||||
iter != sImageList.end(); iter++)
|
||||
@@ -320,18 +310,24 @@ void LLImageGL::destroyGL(BOOL save_state)
|
||||
{
|
||||
glimage->mSaveData = NULL ;
|
||||
}
|
||||
else
|
||||
stored_count++;
|
||||
}
|
||||
|
||||
glimage->destroyGLTexture();
|
||||
stop_glerror();
|
||||
}
|
||||
}
|
||||
llinfos << "Storing " << stored_count << " images..." << llendl;
|
||||
sAllowReadBackRaw = false ;
|
||||
deleteDeadTextures();//Now, actually call glDeleteTextures for everything.
|
||||
}
|
||||
|
||||
//static
|
||||
void LLImageGL::restoreGL()
|
||||
{
|
||||
|
||||
int recovered_count = 0;
|
||||
for (std::set<LLImageGL*>::iterator iter = sImageList.begin();
|
||||
iter != sImageList.end(); iter++)
|
||||
{
|
||||
@@ -346,14 +342,29 @@ void LLImageGL::restoreGL()
|
||||
{
|
||||
glimage->createGLTexture(glimage->mCurrentDiscardLevel, glimage->mSaveData, 0, TRUE, glimage->getCategory());
|
||||
stop_glerror();
|
||||
recovered_count++;
|
||||
}
|
||||
glimage->mSaveData = NULL; // deletes data
|
||||
}
|
||||
}
|
||||
llinfos << "Restored " << recovered_count << " images" << llendl;
|
||||
}
|
||||
|
||||
//static
|
||||
void LLImageGL::dirtyTexOptions()
|
||||
{
|
||||
for (std::set<LLImageGL*>::iterator iter = sImageList.begin();
|
||||
iter != sImageList.end(); iter++)
|
||||
{
|
||||
LLImageGL* glimage = *iter;
|
||||
glimage->mTexOptionsDirty = true;
|
||||
stop_glerror();
|
||||
}
|
||||
|
||||
}
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
//for server side use only.
|
||||
//static
|
||||
BOOL LLImageGL::create(LLPointer<LLImageGL>& dest, BOOL usemipmaps)
|
||||
{
|
||||
@@ -361,12 +372,14 @@ BOOL LLImageGL::create(LLPointer<LLImageGL>& dest, BOOL usemipmaps)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
//for server side use only.
|
||||
BOOL LLImageGL::create(LLPointer<LLImageGL>& dest, U32 width, U32 height, U8 components, BOOL usemipmaps)
|
||||
{
|
||||
dest = new LLImageGL(width, height, components, usemipmaps);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
//for server side use only.
|
||||
BOOL LLImageGL::create(LLPointer<LLImageGL>& dest, const LLImageRaw* imageraw, BOOL usemipmaps)
|
||||
{
|
||||
dest = new LLImageGL(imageraw, usemipmaps);
|
||||
@@ -463,11 +476,7 @@ void LLImageGL::init(BOOL usemipmaps)
|
||||
mMissed = FALSE;
|
||||
#endif
|
||||
|
||||
mCategory = -1 ;
|
||||
|
||||
//LLTexture stuff
|
||||
mDontDiscard = FALSE;
|
||||
mTextureState = NO_DELETE ;
|
||||
mCategory = -1;
|
||||
}
|
||||
|
||||
void LLImageGL::cleanup()
|
||||
@@ -577,7 +586,7 @@ void LLImageGL::forceUpdateBindStats(void) const
|
||||
mLastBindTime = sLastFrameTime;
|
||||
}
|
||||
|
||||
BOOL LLImageGL::updateBindStats() const
|
||||
BOOL LLImageGL::updateBindStats(S32 tex_mem) const
|
||||
{
|
||||
if (mTexName != 0)
|
||||
{
|
||||
@@ -589,32 +598,18 @@ BOOL LLImageGL::updateBindStats() const
|
||||
{
|
||||
// we haven't accounted for this texture yet this frame
|
||||
sUniqueCount++;
|
||||
|
||||
updateBoundTexMem();
|
||||
updateBoundTexMem(tex_mem, mComponents, mCategory);
|
||||
mLastBindTime = sLastFrameTime;
|
||||
|
||||
|
||||
return TRUE ;
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
return FALSE ;
|
||||
}
|
||||
|
||||
//virtual
|
||||
bool LLImageGL::bindError(const S32 stage) const
|
||||
F32 LLImageGL::getTimePassedSinceLastBound()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
//virtual
|
||||
bool LLImageGL::bindDefaultImage(const S32 stage)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
//virtual
|
||||
void LLImageGL::forceImmediateUpdate()
|
||||
{
|
||||
return ;
|
||||
return sLastFrameTime - mLastBindTime ;
|
||||
}
|
||||
|
||||
void LLImageGL::setExplicitFormat( LLGLint internal_format, LLGLenum primary_format, LLGLenum type_format, BOOL swap_bytes )
|
||||
@@ -1169,7 +1164,7 @@ BOOL LLImageGL::createGLTexture(S32 discard_level, const U8* data_in, BOOL data_
|
||||
|
||||
if(gAuditTexture)
|
||||
{
|
||||
decTextureCounter() ;
|
||||
decTextureCounter(mTextureMemory, mComponents, mCategory) ;
|
||||
}
|
||||
|
||||
LLImageGL::deleteTextures(1, &old_name);
|
||||
@@ -1179,11 +1174,10 @@ BOOL LLImageGL::createGLTexture(S32 discard_level, const U8* data_in, BOOL data_
|
||||
|
||||
mTextureMemory = getMipBytes(discard_level);
|
||||
sGlobalTextureMemoryInBytes += mTextureMemory;
|
||||
setActive() ;
|
||||
|
||||
if(gAuditTexture)
|
||||
{
|
||||
incTextureCounter() ;
|
||||
incTextureCounter(mTextureMemory, mComponents, mCategory) ;
|
||||
}
|
||||
// mark this as bound at this point, so we don't throw it out immediately
|
||||
mLastBindTime = sLastFrameTime;
|
||||
@@ -1266,7 +1260,7 @@ BOOL LLImageGL::readBackRaw(S32 discard_level, LLImageRaw* imageraw, bool compre
|
||||
llverify(gGL.getTexUnit(0)->bindManual(mBindTarget, mTexName));
|
||||
|
||||
//debug code, leave it there commented.
|
||||
//checkTexSize() ;
|
||||
checkTexSize() ;
|
||||
|
||||
LLGLint glwidth = 0;
|
||||
glGetTexLevelParameteriv(mTarget, gl_discard, GL_TEXTURE_WIDTH, (GLint*)&glwidth);
|
||||
@@ -1383,20 +1377,21 @@ void LLImageGL::destroyGLTexture()
|
||||
{
|
||||
if(gAuditTexture)
|
||||
{
|
||||
decTextureCounter() ;
|
||||
decTextureCounter(mTextureMemory, mComponents, mCategory) ;
|
||||
}
|
||||
sGlobalTextureMemoryInBytes -= mTextureMemory;
|
||||
mTextureMemory = 0;
|
||||
}
|
||||
|
||||
LLImageGL::deleteTextures(1, &mTexName);
|
||||
mTextureState = DELETED ;
|
||||
LLImageGL::deleteTextures(1, &mTexName);
|
||||
mTexName = 0;
|
||||
mCurrentDiscardLevel = -1 ; //invalidate mCurrentDiscardLevel.
|
||||
mGLTextureCreated = FALSE ;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
void LLImageGL::setAddressMode(LLTexUnit::eTextureAddressMode mode)
|
||||
@@ -1709,59 +1704,6 @@ void LLImageGL::analyzeAlpha(const void* data_in, U32 w, U32 h)
|
||||
}
|
||||
}
|
||||
|
||||
BOOL LLImageGL::isDeleted()
|
||||
{
|
||||
return mTextureState == DELETED ;
|
||||
}
|
||||
|
||||
BOOL LLImageGL::isInactive()
|
||||
{
|
||||
return mTextureState == INACTIVE ;
|
||||
}
|
||||
|
||||
BOOL LLImageGL::isDeletionCandidate()
|
||||
{
|
||||
return mTextureState == DELETION_CANDIDATE ;
|
||||
}
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
|
||||
void LLImageGL::setDeletionCandidate()
|
||||
{
|
||||
if(mTexName && (mTextureState == INACTIVE))
|
||||
{
|
||||
mTextureState = DELETION_CANDIDATE ;
|
||||
}
|
||||
}
|
||||
|
||||
void LLImageGL::forceActive()
|
||||
{
|
||||
mTextureState = ACTIVE ;
|
||||
}
|
||||
|
||||
void LLImageGL::setActive()
|
||||
{
|
||||
if(mTextureState != NO_DELETE)
|
||||
{
|
||||
mTextureState = ACTIVE ;
|
||||
}
|
||||
}
|
||||
|
||||
//set the texture inactive
|
||||
void LLImageGL::setInactive()
|
||||
{
|
||||
if(mTexName && (mTextureState == ACTIVE) && !getBoundRecently())
|
||||
{
|
||||
mTextureState = INACTIVE ;
|
||||
}
|
||||
}
|
||||
|
||||
//set the texture to stay in memory
|
||||
void LLImageGL::setNoDelete()
|
||||
{
|
||||
mTextureState = NO_DELETE ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
void LLImageGL::updatePickMask(S32 width, S32 height, const U8* data_in)
|
||||
{
|
||||
@@ -1913,26 +1855,21 @@ S32 LLImageGL::getTextureCounterIndex(U32 val)
|
||||
return ret ;
|
||||
}
|
||||
}
|
||||
void LLImageGL::incTextureCounterStatic(U32 val, S32 ncomponents, S32 category)
|
||||
|
||||
//static
|
||||
void LLImageGL::incTextureCounter(U32 val, S32 ncomponents, S32 category)
|
||||
{
|
||||
sTextureLoadedCounter[getTextureCounterIndex(val)]++ ;
|
||||
sTextureMemByCategory[category] += (S32)val * ncomponents ;
|
||||
}
|
||||
void LLImageGL::decTextureCounterStatic(U32 val, S32 ncomponents, S32 category)
|
||||
|
||||
//static
|
||||
void LLImageGL::decTextureCounter(U32 val, S32 ncomponents, S32 category)
|
||||
{
|
||||
sTextureLoadedCounter[getTextureCounterIndex(val)]-- ;
|
||||
sTextureMemByCategory[category] += (S32)val * ncomponents ;
|
||||
}
|
||||
void LLImageGL::incTextureCounter()
|
||||
{
|
||||
sTextureLoadedCounter[getTextureCounterIndex(mTextureMemory / mComponents)]++ ;
|
||||
sTextureMemByCategory[mCategory] += mTextureMemory ;
|
||||
}
|
||||
void LLImageGL::decTextureCounter()
|
||||
{
|
||||
sTextureLoadedCounter[getTextureCounterIndex(mTextureMemory / mComponents)]-- ;
|
||||
sTextureMemByCategory[mCategory] -= mTextureMemory ;
|
||||
}
|
||||
|
||||
void LLImageGL::setCurTexSizebar(S32 index, BOOL set_pick_size)
|
||||
{
|
||||
sCurTexSizeBar = index ;
|
||||
|
||||
@@ -59,7 +59,8 @@ public:
|
||||
static S32 dataFormatBytes(S32 dataformat, S32 width, S32 height);
|
||||
static S32 dataFormatComponents(S32 dataformat);
|
||||
|
||||
BOOL updateBindStats(void) const;
|
||||
BOOL updateBindStats(S32 tex_mem) const ;
|
||||
F32 getTimePassedSinceLastBound();
|
||||
void forceUpdateBindStats(void) const;
|
||||
|
||||
// needs to be called every frame
|
||||
@@ -68,10 +69,10 @@ public:
|
||||
// Save off / restore GL textures
|
||||
static void destroyGL(BOOL save_state = TRUE);
|
||||
static void restoreGL();
|
||||
static void dirtyTexOptions();
|
||||
|
||||
// Sometimes called externally for textures not using LLImageGL (should go away...)
|
||||
static S32 updateBoundTexMemStatic(const S32 delta, const S32 size, S32 category) ;
|
||||
S32 updateBoundTexMem()const;
|
||||
static S32 updateBoundTexMem(const S32 mem, const S32 ncomponents, S32 category) ;
|
||||
|
||||
static bool checkSize(S32 width, S32 height);
|
||||
|
||||
@@ -94,11 +95,9 @@ protected:
|
||||
|
||||
public:
|
||||
virtual void dump(); // debugging info to llinfos
|
||||
virtual bool bindError(const S32 stage = 0) const;
|
||||
virtual bool bindDefaultImage(const S32 stage = 0) ;
|
||||
virtual void forceImmediateUpdate() ;
|
||||
|
||||
|
||||
void setSize(S32 width, S32 height, S32 ncomponents);
|
||||
void setComponents(S32 ncomponents) { mComponents = (S8)ncomponents ;}
|
||||
|
||||
// These 3 functions currently wrap glGenTextures(), glDeleteTextures(), and glTexImage2D()
|
||||
// for tracking purposes and will be deprecated in the future
|
||||
@@ -121,7 +120,6 @@ public:
|
||||
void destroyGLTexture();
|
||||
|
||||
void setExplicitFormat(LLGLint internal_format, LLGLenum primary_format, LLGLenum type_format = 0, BOOL swap_bytes = FALSE);
|
||||
void dontDiscard() { mDontDiscard = 1; mTextureState = NO_DELETE; }
|
||||
void setComponents(S8 ncomponents) { mComponents = ncomponents; }
|
||||
|
||||
S32 getDiscardLevel() const { return mCurrentDiscardLevel; }
|
||||
@@ -137,6 +135,7 @@ public:
|
||||
BOOL getBoundRecently() const;
|
||||
BOOL isJustBound() const;
|
||||
LLGLenum getPrimaryFormat() const { return mFormatPrimary; }
|
||||
LLGLenum getFormatType() const { return mFormatType; }
|
||||
|
||||
BOOL getHasGLTexture() const { return mTexName != 0; }
|
||||
LLGLuint getTexName() const { return mTexName; }
|
||||
@@ -152,14 +151,12 @@ public:
|
||||
void setGLTextureCreated (bool initialized) { mGLTextureCreated = initialized; }
|
||||
|
||||
BOOL getUseMipMaps() const { return mUseMipMaps; }
|
||||
void setUseMipMaps(BOOL usemips) { mUseMipMaps = usemips; }
|
||||
BOOL getUseDiscard() const { return mUseMipMaps && !mDontDiscard; }
|
||||
BOOL getDontDiscard() const { return mDontDiscard; }
|
||||
void setUseMipMaps(BOOL usemips) { mUseMipMaps = usemips; }
|
||||
|
||||
void updatePickMask(S32 width, S32 height, const U8* data_in);
|
||||
BOOL getMask(const LLVector2 &tc);
|
||||
|
||||
void checkTexSize() const ;
|
||||
void checkTexSize(bool forced = false) const ;
|
||||
|
||||
// Sets the addressing mode used to sample the texture
|
||||
// (such as wrapping, mirrored wrapping, and clamp)
|
||||
@@ -173,17 +170,7 @@ public:
|
||||
void setFilteringOption(LLTexUnit::eTextureFilterOptions option);
|
||||
LLTexUnit::eTextureFilterOptions getFilteringOption(void) const { return mFilterOption; }
|
||||
|
||||
BOOL isDeleted() ;
|
||||
BOOL isInactive() ;
|
||||
BOOL isDeletionCandidate();
|
||||
void setDeletionCandidate() ;
|
||||
void setInactive() ;
|
||||
void setActive() ;
|
||||
void forceActive() ;
|
||||
void setNoDelete() ;
|
||||
|
||||
void setTextureSize(S32 size) {mTextureMemory = size;}
|
||||
protected:
|
||||
LLGLenum getTexTarget()const { return mTarget ;}
|
||||
void init(BOOL usemipmaps);
|
||||
virtual void cleanup(); // Clean up the LLImageGL so it can be reinitialized. Be careful when using this in derived class destructors
|
||||
|
||||
@@ -222,8 +209,7 @@ protected:
|
||||
|
||||
S8 mComponents;
|
||||
S8 mMaxDiscardLevel;
|
||||
S8 mDontDiscard; // Keep full res version of this image (for UI, etc)
|
||||
|
||||
|
||||
bool mTexOptionsDirty;
|
||||
LLTexUnit::eTextureAddressMode mAddressMode; // Defaults to TAM_WRAP
|
||||
LLTexUnit::eTextureFilterOptions mFilterOption; // Defaults to TFO_TRILINEAR
|
||||
@@ -233,17 +219,6 @@ protected:
|
||||
LLGLenum mFormatPrimary; // = GL format (pixel data format)
|
||||
LLGLenum mFormatType;
|
||||
BOOL mFormatSwapBytes;// if true, use glPixelStorei(GL_UNPACK_SWAP_BYTES, 1)
|
||||
|
||||
protected:
|
||||
typedef enum
|
||||
{
|
||||
DELETED = 0, //removed from memory
|
||||
DELETION_CANDIDATE, //ready to be removed from memory
|
||||
INACTIVE, //not be used for the last certain period (i.e., 30 seconds).
|
||||
ACTIVE, //just being used, can become inactive if not being used for a certain time (10 seconds).
|
||||
NO_DELETE = 99 //stay in memory, can not be removed.
|
||||
} LLGLTexureState;
|
||||
LLGLTexureState mTextureState ;
|
||||
|
||||
// STATICS
|
||||
public:
|
||||
@@ -261,6 +236,8 @@ public:
|
||||
static U32 sBindCount; // Tracks number of texture binds for current frame
|
||||
static U32 sUniqueCount; // Tracks number of unique texture binds for current frame
|
||||
static BOOL sGlobalUseAnisotropic;
|
||||
static LLImageGL* sDefaultGLTexture ;
|
||||
|
||||
#if DEBUG_MISS
|
||||
BOOL mMissed; // Missed on last bind?
|
||||
BOOL getMissed() const { return mMissed; };
|
||||
@@ -298,13 +275,10 @@ public:
|
||||
|
||||
static void setHighlightTexture(S32 category) ;
|
||||
static S32 getTextureCounterIndex(U32 val) ;
|
||||
static void incTextureCounterStatic(U32 val, S32 ncomponents, S32 category) ;
|
||||
static void decTextureCounterStatic(U32 val, S32 ncomponents, S32 category) ;
|
||||
static void incTextureCounter(U32 val, S32 ncomponents, S32 category) ;
|
||||
static void decTextureCounter(U32 val, S32 ncomponents, S32 category) ;
|
||||
static void setCurTexSizebar(S32 index, BOOL set_pick_size = TRUE) ;
|
||||
static void resetCurTexSizebar();
|
||||
|
||||
void incTextureCounter() ;
|
||||
void decTextureCounter() ;
|
||||
//----------------------------------------
|
||||
|
||||
//for debug use: show texture category distribution
|
||||
|
||||
@@ -38,6 +38,7 @@
|
||||
#include "llcubemap.h"
|
||||
#include "llimagegl.h"
|
||||
#include "llrendertarget.h"
|
||||
#include "lltexture.h"
|
||||
|
||||
LLRender gGL;
|
||||
|
||||
@@ -179,50 +180,86 @@ void LLTexUnit::disable(void)
|
||||
}
|
||||
}
|
||||
|
||||
bool LLTexUnit::bind(LLImageGL* texture, bool for_rendering, bool forceBind)
|
||||
bool LLTexUnit::bind(LLTexture* texture, bool for_rendering, bool forceBind)
|
||||
{
|
||||
stop_glerror();
|
||||
if (mIndex < 0) return false;
|
||||
|
||||
gGL.flush();
|
||||
|
||||
if (texture == NULL)
|
||||
LLImageGL* gl_tex = NULL ;
|
||||
if (texture == NULL || !(gl_tex = texture->getGLTexture()))
|
||||
{
|
||||
llwarns << "NULL LLTexUnit::bind texture" << llendl;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!texture->getTexName()) //if texture does not exist
|
||||
{
|
||||
if (texture->isDeleted())
|
||||
{
|
||||
// This will re-generate the texture immediately.
|
||||
texture->forceImmediateUpdate() ;
|
||||
}
|
||||
|
||||
texture->forceUpdateBindStats() ;
|
||||
if (!gl_tex->getTexName()) //if texture does not exist
|
||||
{
|
||||
//if deleted, will re-generate it immediately
|
||||
texture->forceImmediateUpdate() ;
|
||||
|
||||
gl_tex->forceUpdateBindStats() ;
|
||||
return texture->bindDefaultImage(mIndex);
|
||||
}
|
||||
|
||||
//in audit, replace the selected texture by the default one.
|
||||
if(gAuditTexture && for_rendering && LLImageGL::sCurTexPickSize > 0)
|
||||
{
|
||||
if(texture->getWidth() * texture->getHeight() == LLImageGL::sCurTexPickSize)
|
||||
{
|
||||
texture->updateBindStats();
|
||||
gl_tex->updateBindStats(gl_tex->mTextureMemory);
|
||||
return bind(LLImageGL::sHighlightTexturep.get());
|
||||
}
|
||||
}
|
||||
if ((mCurrTexture != gl_tex->getTexName()) || forceBind)
|
||||
{
|
||||
activate();
|
||||
enable(gl_tex->getTarget());
|
||||
mCurrTexture = gl_tex->getTexName();
|
||||
glBindTexture(sGLTextureType[gl_tex->getTarget()], mCurrTexture);
|
||||
if(gl_tex->updateBindStats(gl_tex->mTextureMemory))
|
||||
{
|
||||
texture->setActive() ;
|
||||
texture->updateBindStatsForTester() ;
|
||||
}
|
||||
mHasMipMaps = gl_tex->mHasMipMaps;
|
||||
if (gl_tex->mTexOptionsDirty)
|
||||
{
|
||||
gl_tex->mTexOptionsDirty = false;
|
||||
setTextureAddressMode(gl_tex->mAddressMode);
|
||||
setTextureFilteringOption(gl_tex->mFilterOption);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool LLTexUnit::bind(LLImageGL* texture, bool for_rendering, bool forceBind)
|
||||
{
|
||||
stop_glerror();
|
||||
if (mIndex < 0) return false;
|
||||
|
||||
if(!texture)
|
||||
{
|
||||
llwarns << "NULL LLTexUnit::bind texture" << llendl;
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!texture->getTexName())
|
||||
{
|
||||
if(LLImageGL::sDefaultGLTexture && LLImageGL::sDefaultGLTexture->getTexName())
|
||||
{
|
||||
return bind(LLImageGL::sDefaultGLTexture) ;
|
||||
}
|
||||
return false ;
|
||||
}
|
||||
if ((mCurrTexture != texture->getTexName()) || forceBind)
|
||||
{
|
||||
activate();
|
||||
enable(texture->getTarget());
|
||||
mCurrTexture = texture->getTexName();
|
||||
glBindTexture(sGLTextureType[texture->getTarget()], mCurrTexture);
|
||||
if(texture->updateBindStats())
|
||||
{
|
||||
texture->setActive() ;
|
||||
}
|
||||
texture->updateBindStats(texture->mTextureMemory);
|
||||
mHasMipMaps = texture->mHasMipMaps;
|
||||
if (texture->mTexOptionsDirty)
|
||||
{
|
||||
@@ -255,7 +292,7 @@ bool LLTexUnit::bind(LLCubeMap* cubeMap)
|
||||
mCurrTexture = cubeMap->mImages[0]->getTexName();
|
||||
glBindTexture(GL_TEXTURE_CUBE_MAP_ARB, mCurrTexture);
|
||||
mHasMipMaps = cubeMap->mImages[0]->mHasMipMaps;
|
||||
cubeMap->mImages[0]->updateBindStats();
|
||||
cubeMap->mImages[0]->updateBindStats(cubeMap->mImages[0]->mTextureMemory);
|
||||
if (cubeMap->mImages[0]->mTexOptionsDirty)
|
||||
{
|
||||
cubeMap->mImages[0]->mTexOptionsDirty = false;
|
||||
@@ -795,15 +832,21 @@ void LLRender::setColorMask(bool writeColorR, bool writeColorG, bool writeColorB
|
||||
{
|
||||
flush();
|
||||
|
||||
mCurrColorMask[0] = writeColorR;
|
||||
mCurrColorMask[1] = writeColorG;
|
||||
mCurrColorMask[2] = writeColorB;
|
||||
if (mCurrColorMask[0] != writeColorR ||
|
||||
mCurrColorMask[1] != writeColorG ||
|
||||
mCurrColorMask[2] != writeColorB ||
|
||||
mCurrColorMask[3] != writeAlpha)
|
||||
{
|
||||
mCurrColorMask[0] = writeColorR;
|
||||
mCurrColorMask[1] = writeColorG;
|
||||
mCurrColorMask[2] = writeColorB;
|
||||
mCurrColorMask[3] = writeAlpha;
|
||||
|
||||
glColorMask(writeColorR ? GL_TRUE : GL_FALSE,
|
||||
writeColorG ? GL_TRUE : GL_FALSE,
|
||||
writeColorB ? GL_TRUE : GL_FALSE,
|
||||
writeAlpha ? GL_TRUE : GL_FALSE);
|
||||
writeColorB ? GL_TRUE : GL_FALSE,
|
||||
writeAlpha ? GL_TRUE : GL_FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
void LLRender::setSceneBlendType(eBlendType type)
|
||||
@@ -841,15 +884,19 @@ void LLRender::setAlphaRejectSettings(eCompareFunc func, F32 value)
|
||||
{
|
||||
flush();
|
||||
|
||||
mCurrAlphaFunc = func;
|
||||
mCurrAlphaFuncVal = value;
|
||||
if (func == CF_DEFAULT)
|
||||
if (mCurrAlphaFunc != func ||
|
||||
mCurrAlphaFuncVal != value)
|
||||
{
|
||||
glAlphaFunc(GL_GREATER, 0.01f);
|
||||
}
|
||||
else
|
||||
{
|
||||
glAlphaFunc(sGLCompareFunc[func], value);
|
||||
mCurrAlphaFunc = func;
|
||||
mCurrAlphaFuncVal = value;
|
||||
if (func == CF_DEFAULT)
|
||||
{
|
||||
glAlphaFunc(GL_GREATER, 0.01f);
|
||||
}
|
||||
else
|
||||
{
|
||||
glAlphaFunc(sGLCompareFunc[func], value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -51,6 +51,7 @@ class LLVertexBuffer;
|
||||
class LLCubeMap;
|
||||
class LLImageGL;
|
||||
class LLRenderTarget;
|
||||
class LLTexture ;
|
||||
|
||||
class LLTexUnit
|
||||
{
|
||||
@@ -149,6 +150,7 @@ public:
|
||||
// Binds the LLImageGL to this texture unit
|
||||
// (automatically enables the unit for the LLImageGL's texture type)
|
||||
bool bind(LLImageGL* texture, bool for_rendering = false, bool forceBind = false);
|
||||
bool bind(LLTexture* texture, bool for_rendering = false, bool forceBind = false);
|
||||
|
||||
// Binds a cubemap to this texture unit
|
||||
// (automatically enables the texture unit for cubemaps)
|
||||
|
||||
38
indra/llrender/lltexture.cpp
Normal file
38
indra/llrender/lltexture.cpp
Normal file
@@ -0,0 +1,38 @@
|
||||
/**
|
||||
* @file lltexture.cpp
|
||||
*
|
||||
* $LicenseInfo:firstyear=2000&license=viewergpl$
|
||||
*
|
||||
* Copyright (c) 2000-2010, Linden Research, Inc.
|
||||
*
|
||||
* Second Life Viewer Source Code
|
||||
* The source code in this file ("Source Code") is provided by Linden Lab
|
||||
* to you under the terms of the GNU General Public License, version 2.0
|
||||
* ("GPL"), unless you have obtained a separate licensing agreement
|
||||
* ("Other License"), formally executed by you and Linden Lab. Terms of
|
||||
* the GPL can be found in doc/GPL-license.txt in this distribution, or
|
||||
* online at http://secondlife.com/developers/opensource/gplv2
|
||||
*
|
||||
* There are special exceptions to the terms and conditions of the GPL as
|
||||
* it is applied to this Source Code. View the full text of the exception
|
||||
* in the file doc/FLOSS-exception.txt in this software distribution, or
|
||||
* online at
|
||||
* http://secondlife.com/developers/opensource/flossexception
|
||||
*
|
||||
* By copying, modifying or distributing this software, you acknowledge
|
||||
* that you have read and understood your obligations described above,
|
||||
* and agree to abide by those obligations.
|
||||
*
|
||||
* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
|
||||
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
|
||||
* COMPLETENESS OR PERFORMANCE.
|
||||
* $/LicenseInfo$
|
||||
*
|
||||
*/
|
||||
#include "linden_common.h"
|
||||
#include "lltexture.h"
|
||||
|
||||
//virtual
|
||||
LLTexture::~LLTexture()
|
||||
{
|
||||
}
|
||||
80
indra/llrender/lltexture.h
Normal file
80
indra/llrender/lltexture.h
Normal file
@@ -0,0 +1,80 @@
|
||||
/**
|
||||
* @file lltexture.h
|
||||
* @brief LLTexture definition
|
||||
*
|
||||
* This class acts as a wrapper for OpenGL calls.
|
||||
* The goal of this class is to minimize the number of api calls due to legacy rendering
|
||||
* code, to define an interface for a multiple rendering API abstraction of the UI
|
||||
* rendering, and to abstract out direct rendering calls in a way that is cleaner and easier to maintain.
|
||||
*
|
||||
* $LicenseInfo:firstyear=2001&license=viewergpl$
|
||||
*
|
||||
* Copyright (c) 2001-2010, Linden Research, Inc.
|
||||
*
|
||||
* Second Life Viewer Source Code
|
||||
* The source code in this file ("Source Code") is provided by Linden Lab
|
||||
* to you under the terms of the GNU General Public License, version 2.0
|
||||
* ("GPL"), unless you have obtained a separate licensing agreement
|
||||
* ("Other License"), formally executed by you and Linden Lab. Terms of
|
||||
* the GPL can be found in doc/GPL-license.txt in this distribution, or
|
||||
* online at http://secondlife.com/developers/opensource/gplv2
|
||||
*
|
||||
* There are special exceptions to the terms and conditions of the GPL as
|
||||
* it is applied to this Source Code. View the full text of the exception
|
||||
* in the file doc/FLOSS-exception.txt in this software distribution, or
|
||||
* online at
|
||||
* http://secondlife.com/developers/opensource/flossexception
|
||||
*
|
||||
* By copying, modifying or distributing this software, you acknowledge
|
||||
* that you have read and understood your obligations described above,
|
||||
* and agree to abide by those obligations.
|
||||
*
|
||||
* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
|
||||
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
|
||||
* COMPLETENESS OR PERFORMANCE.
|
||||
* $/LicenseInfo$
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LL_TEXTURE_H
|
||||
#define LL_TEXTURE_H
|
||||
|
||||
#include "llmemory.h"
|
||||
class LLImageGL ;
|
||||
class LLTexUnit ;
|
||||
class LLFontGL ;
|
||||
|
||||
//
|
||||
//this is an abstract class as the parent for the class LLViewerTexture
|
||||
//through the following virtual functions, the class LLViewerTexture can be reached from /llrender.
|
||||
//
|
||||
class LLTexture : public LLRefCount
|
||||
{
|
||||
friend class LLTexUnit ;
|
||||
friend class LLFontGL ;
|
||||
|
||||
protected:
|
||||
virtual ~LLTexture();
|
||||
|
||||
public:
|
||||
LLTexture(){}
|
||||
|
||||
//
|
||||
//interfaces to access LLViewerTexture
|
||||
//
|
||||
virtual S8 getType() const = 0 ;
|
||||
virtual void setKnownDrawSize(S32 width, S32 height) = 0 ;
|
||||
virtual bool bindDefaultImage(const S32 stage = 0) = 0 ;
|
||||
virtual void forceImmediateUpdate() = 0 ;
|
||||
virtual void setActive() = 0 ;
|
||||
virtual S32 getWidth(S32 discard_level = -1) const = 0 ;
|
||||
virtual S32 getHeight(S32 discard_level = -1) const = 0 ;
|
||||
|
||||
private:
|
||||
//note: do not make this function public.
|
||||
virtual LLImageGL* getGLTexture() const = 0 ;
|
||||
|
||||
virtual void updateBindStatsForTester() = 0 ;
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -56,6 +56,7 @@ U32 LLVertexBuffer::sSetCount = 0;
|
||||
S32 LLVertexBuffer::sCount = 0;
|
||||
S32 LLVertexBuffer::sGLCount = 0;
|
||||
S32 LLVertexBuffer::sMappedCount = 0;
|
||||
BOOL LLVertexBuffer::sDisableVBOMapping = FALSE ;
|
||||
BOOL LLVertexBuffer::sEnableVBOs = TRUE;
|
||||
U32 LLVertexBuffer::sGLRenderBuffer = 0;
|
||||
U32 LLVertexBuffer::sGLRenderIndices = 0;
|
||||
@@ -287,9 +288,21 @@ void LLVertexBuffer::drawArrays(U32 mode, U32 first, U32 count) const
|
||||
}
|
||||
|
||||
//static
|
||||
void LLVertexBuffer::initClass(bool use_vbo)
|
||||
void LLVertexBuffer::initClass(bool use_vbo, bool no_vbo_mapping)
|
||||
{
|
||||
sEnableVBOs = use_vbo;
|
||||
sEnableVBOs = use_vbo && gGLManager.mHasVertexBufferObject ;
|
||||
if(sEnableVBOs)
|
||||
{
|
||||
//llassert_always(glBindBufferARB) ; //double check the extention for VBO is loaded.
|
||||
|
||||
llinfos << "VBO is enabled." << llendl ;
|
||||
}
|
||||
else
|
||||
{
|
||||
llinfos << "VBO is disabled." << llendl ;
|
||||
}
|
||||
|
||||
sDisableVBOMapping = sEnableVBOs && no_vbo_mapping ;
|
||||
LLGLNamePool::registerPool(&sDynamicVBOPool);
|
||||
LLGLNamePool::registerPool(&sDynamicIBOPool);
|
||||
LLGLNamePool::registerPool(&sStreamVBOPool);
|
||||
@@ -346,7 +359,9 @@ LLVertexBuffer::LLVertexBuffer(U32 typemask, S32 usage) :
|
||||
mGLBuffer(0),
|
||||
mGLIndices(0),
|
||||
mMappedData(NULL),
|
||||
mMappedIndexData(NULL), mLocked(FALSE),
|
||||
mMappedIndexData(NULL),
|
||||
mVertexLocked(FALSE),
|
||||
mIndexLocked(FALSE),
|
||||
mFinal(FALSE),
|
||||
mFilthy(FALSE),
|
||||
mEmpty(TRUE),
|
||||
@@ -544,6 +559,8 @@ void LLVertexBuffer::destroyGLBuffer()
|
||||
{
|
||||
if (useVBOs())
|
||||
{
|
||||
freeClientBuffer() ;
|
||||
|
||||
if (mMappedData || mMappedIndexData)
|
||||
{
|
||||
llerrs << "Vertex buffer destroyed while mapped!" << llendl;
|
||||
@@ -571,6 +588,8 @@ void LLVertexBuffer::destroyGLIndices()
|
||||
{
|
||||
if (useVBOs())
|
||||
{
|
||||
freeClientBuffer() ;
|
||||
|
||||
if (mMappedData || mMappedIndexData)
|
||||
{
|
||||
llerrs << "Vertex buffer destroyed while mapped." << llendl;
|
||||
@@ -768,6 +787,7 @@ void LLVertexBuffer::resizeBuffer(S32 newnverts, S32 newnindices)
|
||||
|
||||
if (mResized && useVBOs())
|
||||
{
|
||||
freeClientBuffer() ;
|
||||
setBuffer(0);
|
||||
}
|
||||
}
|
||||
@@ -782,104 +802,228 @@ BOOL LLVertexBuffer::useVBOs() const
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
void LLVertexBuffer::freeClientBuffer()
|
||||
{
|
||||
if(useVBOs() && sDisableVBOMapping && (mMappedData || mMappedIndexData))
|
||||
{
|
||||
delete[] mMappedData ;
|
||||
delete[] mMappedIndexData ;
|
||||
mMappedData = NULL ;
|
||||
mMappedIndexData = NULL ;
|
||||
}
|
||||
}
|
||||
|
||||
void LLVertexBuffer::allocateClientVertexBuffer()
|
||||
{
|
||||
if(!mMappedData)
|
||||
{
|
||||
U32 size = getSize() ;
|
||||
mMappedData = new U8[size];
|
||||
memset((void*)mMappedData, 0, size);
|
||||
}
|
||||
}
|
||||
|
||||
void LLVertexBuffer::allocateClientIndexBuffer()
|
||||
{
|
||||
if(!mMappedIndexData)
|
||||
{
|
||||
U32 size = getIndicesSize();
|
||||
mMappedIndexData = new U8[size];
|
||||
memset((void*)mMappedIndexData, 0, size);
|
||||
}
|
||||
}
|
||||
|
||||
// Map for data access
|
||||
volatile U8* LLVertexBuffer::mapBuffer(S32 access)
|
||||
volatile U8* LLVertexBuffer::mapVertexBuffer(S32 type, S32 access)
|
||||
{
|
||||
LLMemType mt(LLMemType::MTYPE_VERTEX_DATA);
|
||||
if (mFinal)
|
||||
{
|
||||
llerrs << "LLVertexBuffer::mapBuffer() called on a finalized buffer." << llendl;
|
||||
llerrs << "LLVertexBuffer::mapVeretxBuffer() called on a finalized buffer." << llendl;
|
||||
}
|
||||
if (!useVBOs() && !mMappedData && !mMappedIndexData)
|
||||
{
|
||||
llerrs << "LLVertexBuffer::mapBuffer() called on unallocated buffer." << llendl;
|
||||
llerrs << "LLVertexBuffer::mapVertexBuffer() called on unallocated buffer." << llendl;
|
||||
}
|
||||
|
||||
if (!mLocked && useVBOs())
|
||||
if (!mVertexLocked && useVBOs())
|
||||
{
|
||||
setBuffer(0);
|
||||
mLocked = TRUE;
|
||||
stop_glerror();
|
||||
mMappedData = (U8*) glMapBufferARB(GL_ARRAY_BUFFER_ARB, GL_WRITE_ONLY_ARB);
|
||||
stop_glerror();
|
||||
mMappedIndexData = (U8*) glMapBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, GL_WRITE_ONLY_ARB);
|
||||
stop_glerror();
|
||||
{
|
||||
setBuffer(0, type);
|
||||
mVertexLocked = TRUE;
|
||||
stop_glerror();
|
||||
|
||||
if(sDisableVBOMapping)
|
||||
{
|
||||
allocateClientVertexBuffer() ;
|
||||
}
|
||||
else
|
||||
{
|
||||
mMappedData = (U8*) glMapBufferARB(GL_ARRAY_BUFFER_ARB, GL_WRITE_ONLY_ARB);
|
||||
}
|
||||
stop_glerror();
|
||||
}
|
||||
|
||||
if (!mMappedData)
|
||||
{
|
||||
//--------------------
|
||||
//print out more debug info before crash
|
||||
llinfos << "vertex buffer size: (num verts : num indices) = " << getNumVerts() << " : " << getNumIndices() << llendl ;
|
||||
GLint size ;
|
||||
glGetBufferParameterivARB(GL_ARRAY_BUFFER_ARB, GL_BUFFER_SIZE_ARB, &size) ;
|
||||
llinfos << "GL_ARRAY_BUFFER_ARB size is " << size << llendl ;
|
||||
//--------------------
|
||||
|
||||
GLint buff;
|
||||
glGetIntegerv(GL_ARRAY_BUFFER_BINDING_ARB, &buff);
|
||||
if ((GLuint)buff != mGLBuffer)
|
||||
if(!sDisableVBOMapping)
|
||||
{
|
||||
llerrs << "Invalid GL vertex buffer bound: " << buff << llendl;
|
||||
//--------------------
|
||||
//print out more debug info before crash
|
||||
llinfos << "vertex buffer size: (num verts : num indices) = " << getNumVerts() << " : " << getNumIndices() << llendl ;
|
||||
GLint size ;
|
||||
glGetBufferParameterivARB(GL_ARRAY_BUFFER_ARB, GL_BUFFER_SIZE_ARB, &size) ;
|
||||
llinfos << "GL_ARRAY_BUFFER_ARB size is " << size << llendl ;
|
||||
//--------------------
|
||||
|
||||
GLint buff;
|
||||
glGetIntegerv(GL_ARRAY_BUFFER_BINDING_ARB, &buff);
|
||||
if ((GLuint)buff != mGLBuffer)
|
||||
{
|
||||
llerrs << "Invalid GL vertex buffer bound: " << buff << llendl;
|
||||
}
|
||||
|
||||
|
||||
llerrs << "glMapBuffer returned NULL (no vertex data)" << llendl;
|
||||
}
|
||||
|
||||
|
||||
llerrs << "glMapBuffer returned NULL (no vertex data)" << llendl;
|
||||
}
|
||||
|
||||
if (!mMappedIndexData)
|
||||
{
|
||||
GLint buff;
|
||||
glGetIntegerv(GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB, &buff);
|
||||
if ((GLuint)buff != mGLIndices)
|
||||
else
|
||||
{
|
||||
llerrs << "Invalid GL index buffer bound: " << buff << llendl;
|
||||
llerrs << "memory allocation for vertex data failed." << llendl ;
|
||||
}
|
||||
|
||||
llerrs << "glMapBuffer returned NULL (no index data)" << llendl;
|
||||
}
|
||||
|
||||
sMappedCount++;
|
||||
}
|
||||
|
||||
return mMappedData;
|
||||
}
|
||||
|
||||
void LLVertexBuffer::unmapBuffer()
|
||||
volatile U8* LLVertexBuffer::mapIndexBuffer(S32 access)
|
||||
{
|
||||
LLMemType mt(LLMemType::MTYPE_VERTEX_DATA);
|
||||
if (mMappedData || mMappedIndexData)
|
||||
if (mFinal)
|
||||
{
|
||||
if (useVBOs() && mLocked)
|
||||
llerrs << "LLVertexBuffer::mapIndexBuffer() called on a finalized buffer." << llendl;
|
||||
}
|
||||
if (!useVBOs() && !mMappedData && !mMappedIndexData)
|
||||
{
|
||||
llerrs << "LLVertexBuffer::mapIndexBuffer() called on unallocated buffer." << llendl;
|
||||
}
|
||||
|
||||
if (!mIndexLocked && useVBOs())
|
||||
{
|
||||
{
|
||||
|
||||
setBuffer(0, TYPE_INDEX);
|
||||
mIndexLocked = TRUE;
|
||||
stop_glerror();
|
||||
|
||||
if(sDisableVBOMapping)
|
||||
{
|
||||
allocateClientIndexBuffer() ;
|
||||
}
|
||||
else
|
||||
{
|
||||
mMappedIndexData = (U8*) glMapBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, GL_WRITE_ONLY_ARB);
|
||||
}
|
||||
stop_glerror();
|
||||
}
|
||||
|
||||
if (!mMappedIndexData)
|
||||
{
|
||||
|
||||
if(!sDisableVBOMapping)
|
||||
{
|
||||
GLint buff;
|
||||
glGetIntegerv(GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB, &buff);
|
||||
if ((GLuint)buff != mGLIndices)
|
||||
{
|
||||
llerrs << "Invalid GL index buffer bound: " << buff << llendl;
|
||||
}
|
||||
|
||||
llerrs << "glMapBuffer returned NULL (no index data)" << llendl;
|
||||
}
|
||||
else
|
||||
{
|
||||
llerrs << "memory allocation for Index data failed. " << llendl ;
|
||||
}
|
||||
}
|
||||
|
||||
sMappedCount++;
|
||||
}
|
||||
|
||||
return mMappedIndexData ;
|
||||
}
|
||||
|
||||
void LLVertexBuffer::unmapBuffer(S32 type)
|
||||
{
|
||||
LLMemType mt(LLMemType::MTYPE_VERTEX_DATA);
|
||||
if (!useVBOs())
|
||||
{
|
||||
return ; //nothing to unmap
|
||||
}
|
||||
|
||||
bool updated_all = false ;
|
||||
if (mMappedData && mVertexLocked && type != TYPE_INDEX)
|
||||
{
|
||||
updated_all = (mIndexLocked && type < 0) ; //both vertex and index buffers done updating
|
||||
|
||||
if(sDisableVBOMapping)
|
||||
{
|
||||
stop_glerror();
|
||||
glBufferSubDataARB(GL_ARRAY_BUFFER_ARB, 0, getSize(), (void*)mMappedData);
|
||||
stop_glerror();
|
||||
}
|
||||
else
|
||||
{
|
||||
stop_glerror();
|
||||
glUnmapBufferARB(GL_ARRAY_BUFFER_ARB);
|
||||
stop_glerror();
|
||||
|
||||
mMappedData = NULL;
|
||||
}
|
||||
|
||||
mVertexLocked = FALSE ;
|
||||
sMappedCount--;
|
||||
}
|
||||
|
||||
if(mMappedIndexData && mIndexLocked && (type < 0 || type == TYPE_INDEX))
|
||||
{
|
||||
if(sDisableVBOMapping)
|
||||
{
|
||||
stop_glerror();
|
||||
glBufferSubDataARB(GL_ELEMENT_ARRAY_BUFFER_ARB, 0, getIndicesSize(), (void*)mMappedIndexData);
|
||||
stop_glerror();
|
||||
}
|
||||
else
|
||||
{
|
||||
stop_glerror();
|
||||
glUnmapBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB);
|
||||
stop_glerror();
|
||||
|
||||
/*if (!sMapped)
|
||||
{
|
||||
llerrs << "Redundantly unmapped VBO!" << llendl;
|
||||
}
|
||||
sMapped = FALSE;*/
|
||||
sMappedCount--;
|
||||
mMappedIndexData = NULL ;
|
||||
}
|
||||
|
||||
if (mUsage == GL_STATIC_DRAW_ARB)
|
||||
{ //static draw buffers can only be mapped a single time
|
||||
//throw out client data (we won't be using it again)
|
||||
mEmpty = TRUE;
|
||||
mFinal = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
mEmpty = FALSE;
|
||||
}
|
||||
mIndexLocked = FALSE ;
|
||||
sMappedCount--;
|
||||
}
|
||||
|
||||
mMappedIndexData = NULL;
|
||||
mMappedData = NULL;
|
||||
|
||||
mLocked = FALSE;
|
||||
if(updated_all)
|
||||
{
|
||||
if(mUsage == GL_STATIC_DRAW_ARB)
|
||||
{
|
||||
//static draw buffers can only be mapped a single time
|
||||
//throw out client data (we won't be using it again)
|
||||
mEmpty = TRUE;
|
||||
mFinal = TRUE;
|
||||
|
||||
if(sDisableVBOMapping)
|
||||
{
|
||||
freeClientBuffer() ;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
mEmpty = FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -893,15 +1037,16 @@ template <class T,S32 type> struct VertexBufferStrider
|
||||
strider_t& strider,
|
||||
S32 index)
|
||||
{
|
||||
if (vbo.mapBuffer() == NULL)
|
||||
{
|
||||
llwarns << "mapBuffer failed!" << llendl;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (type == LLVertexBuffer::TYPE_INDEX)
|
||||
{
|
||||
S32 stride = sizeof(T);
|
||||
|
||||
if (vbo.mapIndexBuffer() == NULL)
|
||||
{
|
||||
llwarns << "mapIndexBuffer failed!" << llendl;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
strider = (T*)(vbo.getMappedIndices() + index*stride);
|
||||
strider.setStride(0);
|
||||
return TRUE;
|
||||
@@ -909,6 +1054,13 @@ template <class T,S32 type> struct VertexBufferStrider
|
||||
else if (vbo.hasDataType(type))
|
||||
{
|
||||
S32 stride = vbo.getStride();
|
||||
|
||||
if (vbo.mapVertexBuffer(type) == NULL)
|
||||
{
|
||||
llwarns << "mapVertexBuffer failed!" << llendl;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
strider = (T*)(vbo.getMappedData() + vbo.getOffset(type) + index*stride);
|
||||
strider.setStride(stride);
|
||||
return TRUE;
|
||||
@@ -989,7 +1141,7 @@ void LLVertexBuffer::setStride(S32 type, S32 new_stride)
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
// Set for rendering
|
||||
void LLVertexBuffer::setBuffer(U32 data_mask)
|
||||
void LLVertexBuffer::setBuffer(U32 data_mask, S32 type)
|
||||
{
|
||||
LLMemType mt(LLMemType::MTYPE_VERTEX_DATA);
|
||||
//set up pointers if the data mask is different ...
|
||||
@@ -1023,6 +1175,7 @@ void LLVertexBuffer::setBuffer(U32 data_mask)
|
||||
sIBOActive = TRUE;
|
||||
}
|
||||
|
||||
BOOL error = FALSE;
|
||||
if (gDebugGL)
|
||||
{
|
||||
GLint buff;
|
||||
@@ -1085,7 +1238,11 @@ void LLVertexBuffer::setBuffer(U32 data_mask)
|
||||
}
|
||||
}
|
||||
|
||||
unmapBuffer();
|
||||
if (error)
|
||||
{
|
||||
llerrs << "LLVertexBuffer::mapBuffer failed" << llendl;
|
||||
}
|
||||
unmapBuffer(type);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1142,7 +1299,31 @@ void LLVertexBuffer::setupVertexBuffer(U32 data_mask) const
|
||||
|
||||
if ((data_mask & mTypeMask) != data_mask)
|
||||
{
|
||||
llerrs << "LLVertexBuffer::setupVertexBuffer missing required components for supplied data mask." << llendl;
|
||||
llerrs << "LLVertexBuffer::setupVertexBuffer missing required components for supplied data mask. Missing: ";
|
||||
|
||||
static const char* mask_names[] = {"VERTEX","NORMAL","TEXCOORD0","TEXCOORD1","TEXCOORD2","TEXCOORD3","COLOR","BINORMAL","WEIGHT","CLOTH_WEIGHT"};
|
||||
for(int i = 0; i < 32; ++i)
|
||||
{
|
||||
if((data_mask & (1<<i)) && !(mTypeMask & (1<<i)))
|
||||
{
|
||||
if(i < (sizeof(mask_names)/sizeof(mask_names[0])))
|
||||
llcont << "MAP_" << mask_names[i] << ", ";
|
||||
else
|
||||
llcont << "MAP_UNKNOWN (1<<" << i << "), ";
|
||||
}
|
||||
}
|
||||
llcont << "\n Has: ";
|
||||
for(int i = 0; i < 32; ++i)
|
||||
{
|
||||
if(mTypeMask & (1<<i))
|
||||
{
|
||||
if(i < (sizeof(mask_names)/sizeof(mask_names[0])))
|
||||
llcont << "MASK_" << mask_names[i] << ", ";
|
||||
else
|
||||
llcont << "MAP_UNKNOWN (1<<" << i << "), ";
|
||||
}
|
||||
}
|
||||
llcont << llendl;
|
||||
}
|
||||
|
||||
if (data_mask & MAP_NORMAL)
|
||||
|
||||
@@ -88,7 +88,7 @@ public:
|
||||
static BOOL sUseStreamDraw;
|
||||
static BOOL sOmitBlank;
|
||||
|
||||
static void initClass(bool use_vbo);
|
||||
static void initClass(bool use_vbo, bool no_vbo_mapping);
|
||||
static void cleanupClass();
|
||||
static void setupClientArrays(U32 data_mask);
|
||||
static void clientCopy(F64 max_time = 0.005); //copy data from client to GL
|
||||
@@ -147,15 +147,20 @@ protected:
|
||||
void updateNumVerts(S32 nverts);
|
||||
void updateNumIndices(S32 nindices);
|
||||
virtual BOOL useVBOs() const;
|
||||
void unmapBuffer();
|
||||
void unmapBuffer(S32 type);
|
||||
void freeClientBuffer() ;
|
||||
void allocateClientVertexBuffer() ;
|
||||
void allocateClientIndexBuffer() ;
|
||||
|
||||
public:
|
||||
LLVertexBuffer(U32 typemask, S32 usage);
|
||||
|
||||
// map for data access
|
||||
volatile U8* mapBuffer(S32 access = -1);
|
||||
volatile U8* mapVertexBuffer(S32 type = -1, S32 access = -1);
|
||||
volatile U8* mapIndexBuffer(S32 access = -1);
|
||||
|
||||
// set for rendering
|
||||
virtual void setBuffer(U32 data_mask); // calls setupVertexBuffer() if data_mask is not 0
|
||||
virtual void setBuffer(U32 data_mask, S32 type = -1); // calls setupVertexBuffer() if data_mask is not 0
|
||||
// allocate buffer
|
||||
void allocateBuffer(S32 nverts, S32 nindices, bool create);
|
||||
virtual void resizeBuffer(S32 newnverts, S32 newnindices);
|
||||
@@ -178,7 +183,7 @@ public:
|
||||
bool getClothWeightStrider(LLStrider<LLVector4>& strider, S32 index=0);
|
||||
|
||||
BOOL isEmpty() const { return mEmpty; }
|
||||
BOOL isLocked() const { return mLocked; }
|
||||
BOOL isLocked() const { return mVertexLocked || mIndexLocked; }
|
||||
S32 getNumVerts() const { return mNumVerts; }
|
||||
S32 getNumIndices() const { return mNumIndices; }
|
||||
S32 getRequestedVerts() const { return mRequestedNumVerts; }
|
||||
@@ -217,13 +222,14 @@ protected:
|
||||
U32 mGLIndices; // GL IBO handle
|
||||
volatile U8* mMappedData; // pointer to currently mapped data (NULL if unmapped)
|
||||
volatile U8* mMappedIndexData; // pointer to currently mapped indices (NULL if unmapped)
|
||||
BOOL mLocked; // if TRUE, buffer is being or has been written to in client memory
|
||||
BOOL mVertexLocked; // if TRUE, vertex buffer is being or has been written to in client memory
|
||||
BOOL mIndexLocked; // if TRUE, index buffer is being or has been written to in client memory
|
||||
BOOL mFinal; // if TRUE, buffer can not be mapped again
|
||||
BOOL mFilthy; // if TRUE, entire buffer must be copied (used to prevent redundant dirty flags)
|
||||
BOOL mEmpty; // if TRUE, client buffer is empty (or NULL). Old values have been discarded.
|
||||
S32 mOffsets[TYPE_MAX];
|
||||
BOOL mEmpty; // if TRUE, client buffer is empty (or NULL). Old values have been discarded.
|
||||
BOOL mResized; // if TRUE, client buffer has been resized and GL buffer has not
|
||||
BOOL mDynamicSize; // if TRUE, buffer has been resized at least once (and should be padded)
|
||||
S32 mOffsets[TYPE_MAX];
|
||||
|
||||
class DirtyRegion
|
||||
{
|
||||
@@ -248,13 +254,14 @@ public:
|
||||
static std::vector<U32> sDeleteList;
|
||||
typedef std::list<LLVertexBuffer*> buffer_list_t;
|
||||
|
||||
static BOOL sDisableVBOMapping; //disable glMapBufferARB
|
||||
static BOOL sEnableVBOs;
|
||||
static BOOL sVBOActive;
|
||||
static BOOL sIBOActive;
|
||||
static S32 sTypeOffsets[TYPE_MAX];
|
||||
static U32 sGLMode[LLRender::NUM_MODES];
|
||||
static U32 sGLRenderBuffer;
|
||||
static U32 sGLRenderIndices;
|
||||
static BOOL sVBOActive;
|
||||
static BOOL sIBOActive;
|
||||
static U32 sGLRenderIndices;
|
||||
static U32 sLastMask;
|
||||
static U32 sAllocatedBytes;
|
||||
static U32 sBindCount;
|
||||
|
||||
@@ -105,7 +105,7 @@ LLComboBox::LLComboBox( const std::string& name, const LLRect &rect, const std::
|
||||
mList->setCommitOnKeyboardMovement(FALSE);
|
||||
addChild(mList);
|
||||
|
||||
mArrowImage = LLUI::sImageProvider->getUIImage("combobox_arrow.tga");
|
||||
mArrowImage = LLUI::getUIImage("combobox_arrow.tga");
|
||||
mButton->setImageOverlay("combobox_arrow.tga", LLFontGL::RIGHT);
|
||||
|
||||
updateLayout();
|
||||
@@ -248,6 +248,8 @@ void LLComboBox::onCommit()
|
||||
mTextEntry->setValue(getSimple());
|
||||
mTextEntry->setTentative(FALSE);
|
||||
}
|
||||
|
||||
setControlValue(getValue());
|
||||
LLUICtrl::onCommit();
|
||||
}
|
||||
|
||||
|
||||
@@ -89,7 +89,7 @@ void LLIconCtrl::setImage(const std::string& image_name)
|
||||
else
|
||||
{
|
||||
mImageName = image_name;
|
||||
mImagep = LLUI::sImageProvider->getUIImage(image_name);
|
||||
mImagep = LLUI::getUIImage(image_name);
|
||||
mImageID.setNull();
|
||||
}
|
||||
}
|
||||
@@ -97,7 +97,7 @@ void LLIconCtrl::setImage(const std::string& image_name)
|
||||
void LLIconCtrl::setImage(const LLUUID& image_id)
|
||||
{
|
||||
mImageName.clear();
|
||||
mImagep = LLUI::sImageProvider->getUIImageByID(image_id);
|
||||
mImagep = LLUI::getUIImageByID(image_id);
|
||||
mImageID = image_id;
|
||||
}
|
||||
|
||||
|
||||
@@ -55,6 +55,7 @@
|
||||
#include "llui.h"
|
||||
#include "lluictrlfactory.h"
|
||||
#include "llclipboard.h"
|
||||
#include "../newview/lgghunspell_wrapper.h"
|
||||
|
||||
//
|
||||
// Imported globals
|
||||
@@ -118,6 +119,7 @@ LLLineEditor::LLLineEditor(const std::string& name, const LLRect& rect,
|
||||
mLastSelectionY(-1),
|
||||
mLastSelectionStart(-1),
|
||||
mLastSelectionEnd(-1),
|
||||
mLastContextMenuX(-1),
|
||||
mPrevalidateFunc( prevalidate_func ),
|
||||
mCursorColor( LLUI::sColorsGroup->getColor( "TextCursorColor" ) ),
|
||||
mFgColor( LLUI::sColorsGroup->getColor( "TextFgColor" ) ),
|
||||
@@ -137,7 +139,8 @@ LLLineEditor::LLLineEditor(const std::string& name, const LLRect& rect,
|
||||
mReadOnly(FALSE),
|
||||
mHaveHistory(FALSE),
|
||||
mImage( sImage ),
|
||||
mReplaceNewlinesWithSpaces( TRUE )
|
||||
mReplaceNewlinesWithSpaces( TRUE ),
|
||||
mSpellCheckable( FALSE )
|
||||
{
|
||||
llassert( max_length_bytes > 0 );
|
||||
|
||||
@@ -187,10 +190,7 @@ LLLineEditor::LLLineEditor(const std::string& name, const LLRect& rect,
|
||||
menu->append(new LLMenuItemCallGL("Paste", context_paste, NULL, this));
|
||||
menu->append(new LLMenuItemCallGL("Delete", context_delete, NULL, this));
|
||||
menu->append(new LLMenuItemCallGL("Select All", context_selectall, NULL, this));
|
||||
menu->appendSeparator("Transep");
|
||||
LLMenuGL* translatemenu = new LLMenuGL("Translate To");
|
||||
translatemenu->setCanTearOff(FALSE);
|
||||
|
||||
menu->appendSeparator("Spelsep");
|
||||
//menu->setBackgroundColor(gColors.getColor("MenuPopupBgColor"));
|
||||
menu->setCanTearOff(FALSE);
|
||||
menu->setVisible(FALSE);
|
||||
@@ -454,6 +454,89 @@ void LLLineEditor::context_copy(void* data)
|
||||
if(line)line->copy();
|
||||
}
|
||||
|
||||
|
||||
void LLLineEditor::spell_correct(void* data)
|
||||
{
|
||||
SpellMenuBind* tempBind = (SpellMenuBind*)data;
|
||||
LLLineEditor* line = tempBind->origin;
|
||||
if(tempBind && line)
|
||||
{
|
||||
llinfos << ((LLMenuItemCallGL *)(tempBind->menuItem))->getName() << " : " << tempBind->origin->getName() << " : " << tempBind->word << llendl;
|
||||
if(line)line->spellReplace(tempBind);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void LLLineEditor::spell_show(void * data)
|
||||
{
|
||||
SpellMenuBind* tempBind = (SpellMenuBind*)data;
|
||||
LLLineEditor* line = tempBind->origin;
|
||||
|
||||
if (tempBind && line)
|
||||
{
|
||||
BOOL show = (tempBind->word == "Show Misspellings");
|
||||
glggHunSpell->setSpellCheckHighlight(show);
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<S32> LLLineEditor::getMisspelledWordsPositions()
|
||||
{
|
||||
std::vector<S32> thePosesOfBadWords;
|
||||
const LLWString& text = mText.getWString();
|
||||
|
||||
//llinfos << "end of box is at " << cursorloc << " and end of text is at " << text.length() << llendl;
|
||||
S32 wordStart=0;
|
||||
S32 wordEnd=mStartSpellHere;
|
||||
while(wordEnd < mEndSpellHere)
|
||||
{
|
||||
//go through all the chars... XD
|
||||
if( LLTextEditor::isPartOfWord( text[wordEnd] ) )
|
||||
|
||||
{
|
||||
// Select word the cursor is over
|
||||
while ((wordEnd > 0) && LLTextEditor::isPartOfWord(text[wordEnd-1]))
|
||||
{
|
||||
wordEnd--;
|
||||
}
|
||||
wordStart=wordEnd;
|
||||
while ((wordEnd < (S32)text.length()) && LLTextEditor::isPartOfWord( text[wordEnd] ) )
|
||||
{
|
||||
wordEnd++;
|
||||
}
|
||||
//got a word :D
|
||||
std::string selectedWord(std::string(text.begin(),
|
||||
text.end()).substr(wordStart,wordEnd-wordStart));
|
||||
|
||||
if(!glggHunSpell->isSpelledRight(selectedWord))
|
||||
{
|
||||
//misspelled word here, and you have just right clicked on it!
|
||||
//get the center of this word..
|
||||
//S32 center = llround( (wordEnd-wordStart)/2 ) + wordStart;
|
||||
//turn this cursor position into a pixel pos
|
||||
//center = findPixelNearestPos(center-getCursor());
|
||||
|
||||
thePosesOfBadWords.push_back(
|
||||
wordStart);
|
||||
thePosesOfBadWords.push_back(wordEnd);
|
||||
}
|
||||
}
|
||||
wordEnd++;
|
||||
}
|
||||
return thePosesOfBadWords;
|
||||
}
|
||||
|
||||
|
||||
void LLLineEditor::spell_add(void* data)
|
||||
{
|
||||
SpellMenuBind* tempBind = (SpellMenuBind*)data;
|
||||
if(tempBind)
|
||||
{
|
||||
glggHunSpell->addWordToCustomDictionary(tempBind->word);
|
||||
tempBind->origin->mPrevSpelledText="";//make it update
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void LLLineEditor::context_paste(void* data)
|
||||
{
|
||||
LLLineEditor* line = (LLLineEditor*)data;
|
||||
@@ -568,6 +651,10 @@ BOOL LLLineEditor::handleRightMouseDown( S32 x, S32 y, MASK mask )
|
||||
setFocus(TRUE);
|
||||
|
||||
//setCursorAtLocalPos( x);
|
||||
S32 wordStart = 0;
|
||||
S32 wordLen = 0;
|
||||
S32 pos = calculateCursorFromMouse(x);
|
||||
|
||||
LLMenuGL* menu = (LLMenuGL*)mPopupMenuHandle.get();
|
||||
if (menu)
|
||||
{
|
||||
@@ -575,7 +662,81 @@ BOOL LLLineEditor::handleRightMouseDown( S32 x, S32 y, MASK mask )
|
||||
{
|
||||
menu->setVisible(FALSE);
|
||||
}
|
||||
for (int i = 0;i<(int)suggestionMenuItems.size();i++)
|
||||
{
|
||||
SpellMenuBind * tempBind = suggestionMenuItems[i];
|
||||
if(tempBind)
|
||||
{
|
||||
menu->remove((LLMenuItemCallGL *)tempBind->menuItem);
|
||||
((LLMenuItemCallGL *)tempBind->menuItem)->die();
|
||||
//delete tempBind->menuItem;
|
||||
//tempBind->menuItem = NULL;
|
||||
delete tempBind;
|
||||
}
|
||||
}
|
||||
suggestionMenuItems.clear();
|
||||
|
||||
// spell_check="true" in xui
|
||||
menu->setItemVisible("Spelsep", !mReadOnly && mSpellCheckable);
|
||||
if (!mReadOnly && mSpellCheckable)
|
||||
{
|
||||
// search for word matches
|
||||
bool is_word_part = getWordBoundriesAt(pos, &wordStart, &wordLen);
|
||||
if (is_word_part)
|
||||
{
|
||||
const LLWString& text = mText.getWString();
|
||||
std::string selectedWord(std::string(text.begin(), text.end()).substr(wordStart,wordLen));
|
||||
|
||||
if (!glggHunSpell->isSpelledRight(selectedWord))
|
||||
{
|
||||
//misspelled word here, and you have just right clicked on it!
|
||||
std::vector<std::string> suggs = glggHunSpell->getSuggestionList(selectedWord);
|
||||
|
||||
for (int i = 0; i<(int)suggs.size() ;i++)
|
||||
{
|
||||
SpellMenuBind * tempStruct = new SpellMenuBind;
|
||||
tempStruct->origin = this;
|
||||
tempStruct->word = suggs[i];
|
||||
tempStruct->wordPositionEnd = wordStart + wordLen;
|
||||
tempStruct->wordPositionStart=wordStart;
|
||||
LLMenuItemCallGL * suggMenuItem = new LLMenuItemCallGL(
|
||||
tempStruct->word, spell_correct, NULL, tempStruct);
|
||||
//new LLMenuItemCallGL("Select All", context_selectall, NULL, this));
|
||||
tempStruct->menuItem = suggMenuItem;
|
||||
suggestionMenuItems.push_back(tempStruct);
|
||||
menu->append(suggMenuItem);
|
||||
}
|
||||
SpellMenuBind * tempStruct = new SpellMenuBind;
|
||||
tempStruct->origin = this;
|
||||
tempStruct->word = selectedWord;
|
||||
tempStruct->wordPositionEnd = wordStart + wordLen;
|
||||
tempStruct->wordPositionStart=wordStart;
|
||||
LLMenuItemCallGL * suggMenuItem = new LLMenuItemCallGL(
|
||||
"Add Word", spell_add, NULL, tempStruct);
|
||||
tempStruct->menuItem = suggMenuItem;
|
||||
suggestionMenuItems.push_back(tempStruct);
|
||||
menu->append(suggMenuItem);
|
||||
}
|
||||
}
|
||||
|
||||
SpellMenuBind * tempStruct = new SpellMenuBind;
|
||||
tempStruct->origin = this;
|
||||
if (glggHunSpell->getSpellCheckHighlight())
|
||||
{
|
||||
tempStruct->word = "Hide Misspellings";
|
||||
}
|
||||
else
|
||||
{
|
||||
tempStruct->word = "Show Misspellings";
|
||||
}
|
||||
LLMenuItemCallGL * suggMenuItem = new LLMenuItemCallGL(
|
||||
tempStruct->word, spell_show, NULL, tempStruct);
|
||||
tempStruct->menuItem = suggMenuItem;
|
||||
suggestionMenuItems.push_back(tempStruct);
|
||||
menu->append(suggMenuItem);
|
||||
}
|
||||
|
||||
mLastContextMenuX = x;
|
||||
menu->buildDrawLabels();
|
||||
menu->updateParent(LLMenuGL::sMenuContainer);
|
||||
LLMenuGL::showPopup(this, menu, x, y);
|
||||
@@ -892,6 +1053,26 @@ S32 LLLineEditor::nextWordPos(S32 cursorPos) const
|
||||
return cursorPos;
|
||||
}
|
||||
|
||||
BOOL LLLineEditor::getWordBoundriesAt(const S32 at, S32* word_begin, S32* word_length) const
|
||||
{
|
||||
const LLWString& wtext = mText.getWString();
|
||||
S32 pos = at;
|
||||
if (LLTextEditor::isPartOfWord(wtext[pos]))
|
||||
{
|
||||
while ( (pos > 0) && LLTextEditor::isPartOfWord(wtext[pos - 1]) )
|
||||
{
|
||||
pos--;
|
||||
}
|
||||
*word_begin = pos;
|
||||
while ( (pos < (S32)wtext.length()) && LLTextEditor::isPartOfWord(wtext[pos]) )
|
||||
{
|
||||
pos++;
|
||||
}
|
||||
*word_length = pos - *word_begin;
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
BOOL LLLineEditor::handleSelectionKey(KEY key, MASK mask)
|
||||
{
|
||||
@@ -1046,6 +1227,16 @@ void LLLineEditor::copy()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void LLLineEditor::spellReplace(SpellMenuBind* spellData)
|
||||
{
|
||||
mText.erase(spellData->wordPositionStart,
|
||||
spellData->wordPositionEnd - spellData->wordPositionStart);
|
||||
insert(spellData->word,spellData->wordPositionStart);
|
||||
mCursorPos+=spellData->word.length() - (spellData->wordPositionEnd-spellData->wordPositionStart);
|
||||
}
|
||||
|
||||
|
||||
void LLLineEditor::insert(std::string what, S32 wher)
|
||||
{
|
||||
LLLineEditorRollback rollback(this);
|
||||
@@ -1063,6 +1254,7 @@ void LLLineEditor::insert(std::string what, S32 wher)
|
||||
else if( mKeystrokeCallback )
|
||||
mKeystrokeCallback( this, mCallbackUserData );
|
||||
}
|
||||
|
||||
BOOL LLLineEditor::canPaste() const
|
||||
{
|
||||
return !mReadOnly && gClipboard.canPasteString();
|
||||
@@ -1588,6 +1780,57 @@ void LLLineEditor::doDelete()
|
||||
}
|
||||
|
||||
|
||||
void LLLineEditor::drawMisspelled(LLRect background)
|
||||
{
|
||||
if (!mReadOnly && mSpellCheckable)
|
||||
{
|
||||
S32 newStartSpellHere =mScrollHPos;
|
||||
S32 cursorloc =calculateCursorFromMouse(mMaxHPixels);
|
||||
S32 newStopSpellHere = ( ((S32)mText.length())>cursorloc)?cursorloc:(S32)mText.length();
|
||||
|
||||
F32 elapsed = mSpellTimer.getElapsedTimeF32();
|
||||
if(S32(elapsed / 1) & 1)
|
||||
{
|
||||
if(isSpellDirty()||(newStartSpellHere!=mStartSpellHere)||(newStopSpellHere!=mEndSpellHere))
|
||||
{
|
||||
mStartSpellHere=newStartSpellHere;
|
||||
mEndSpellHere= newStopSpellHere;
|
||||
resetSpellDirty();
|
||||
misspellLocations=getMisspelledWordsPositions();
|
||||
}
|
||||
}
|
||||
|
||||
if (glggHunSpell->getSpellCheckHighlight())
|
||||
{
|
||||
for (int i =0; i<(int)misspellLocations.size(); i++)
|
||||
{
|
||||
S32 wstart =findPixelNearestPos( misspellLocations[i]-getCursor());
|
||||
S32 wend = findPixelNearestPos(misspellLocations[++i]-getCursor());
|
||||
S32 maxw = getRect().getWidth();
|
||||
|
||||
if (wend > maxw)
|
||||
{
|
||||
wend = maxw;
|
||||
}
|
||||
if (wstart > maxw)
|
||||
{
|
||||
wstart = maxw;
|
||||
}
|
||||
gGL.color4ub(255,0,0,200);
|
||||
//3 line zig zags..
|
||||
while (wstart < wend)
|
||||
{
|
||||
gl_line_2d(wstart, background.mBottom-1, wstart+3, background.mBottom+2);
|
||||
gl_line_2d(wstart+3, background.mBottom+2, wstart+6, background.mBottom-1);
|
||||
wstart+=6;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
void LLLineEditor::draw()
|
||||
{
|
||||
S32 text_len = mText.length();
|
||||
@@ -1599,7 +1842,7 @@ void LLLineEditor::draw()
|
||||
std::string text;
|
||||
for (S32 i = 0; i < mText.length(); i++)
|
||||
{
|
||||
text += '*';
|
||||
text += "\xe2\x80\xa2";
|
||||
}
|
||||
mText = text;
|
||||
}
|
||||
@@ -1776,6 +2019,9 @@ void LLLineEditor::draw()
|
||||
mBorder->setVisible(FALSE); // no more programmatic art.
|
||||
#endif
|
||||
|
||||
drawMisspelled(background);
|
||||
resetSpellDirty();
|
||||
|
||||
// If we're editing...
|
||||
if( gFocusMgr.getKeyboardFocus() == this)
|
||||
{
|
||||
@@ -2455,6 +2701,11 @@ LLView* LLLineEditor::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory
|
||||
{
|
||||
line_editor->setCommitOnFocusLost(commit_on_focus_lost);
|
||||
}
|
||||
BOOL spell_checking = FALSE;
|
||||
if (node->getAttributeBOOL("spell_check", spell_checking))
|
||||
{
|
||||
line_editor->setSpellCheckable(spell_checking);
|
||||
}
|
||||
|
||||
line_editor->setColorParameters(node);
|
||||
|
||||
|
||||
@@ -96,6 +96,16 @@ public:
|
||||
/*virtual*/ BOOL handleUnicodeCharHere(llwchar uni_char);
|
||||
/*virtual*/ void onMouseCaptureLost();
|
||||
|
||||
struct SpellMenuBind
|
||||
{
|
||||
LLLineEditor* origin;
|
||||
void * menuItem;
|
||||
std::string word;
|
||||
S32 wordPositionStart;
|
||||
S32 wordPositionEnd;
|
||||
};
|
||||
|
||||
virtual void spellReplace(SpellMenuBind* spellData);
|
||||
virtual void insert(std::string what,S32 wher);
|
||||
|
||||
// LLEditMenuHandler overrides
|
||||
@@ -127,8 +137,14 @@ public:
|
||||
static void context_paste(void* data);
|
||||
static void context_delete(void* data);
|
||||
static void context_selectall(void* data);
|
||||
static void spell_correct(void* data);
|
||||
static void spell_show(void* data);
|
||||
static void spell_add(void* data);
|
||||
|
||||
std::vector<S32> getMisspelledWordsPositions();
|
||||
// view overrides
|
||||
virtual void draw();
|
||||
void drawMisspelled(LLRect background);
|
||||
virtual void reshape(S32 width,S32 height,BOOL called_from_parent=TRUE);
|
||||
virtual void onFocusReceived();
|
||||
virtual void onFocusLost();
|
||||
@@ -143,6 +159,8 @@ public:
|
||||
virtual void onCommit();
|
||||
virtual BOOL isDirty() const { return mText.getString() != mPrevText; } // Returns TRUE if user changed value at all
|
||||
virtual void resetDirty() { mPrevText = mText.getString(); } // Clear dirty state
|
||||
virtual BOOL isSpellDirty() const { return mText.getString() != mPrevSpelledText; } // Returns TRUE if user changed value at all
|
||||
virtual void resetSpellDirty() { mPrevSpelledText = mText.getString(); } // Clear dirty state
|
||||
|
||||
// assumes UTF8 text
|
||||
virtual void setValue(const LLSD& value ) { setText(value.asString()); }
|
||||
@@ -178,6 +196,7 @@ public:
|
||||
void setWriteableBgColor( const LLColor4& c ) { mWriteableBgColor = c; }
|
||||
void setReadOnlyBgColor( const LLColor4& c ) { mReadOnlyBgColor = c; }
|
||||
void setFocusBgColor(const LLColor4& c) { mFocusBgColor = c; }
|
||||
void setSpellCheckable(BOOL b) { mSpellCheckable = b; }
|
||||
|
||||
const LLColor4& getFgColor() const { return mFgColor; }
|
||||
const LLColor4& getReadOnlyFgColor() const { return mReadOnlyFgColor; }
|
||||
@@ -194,6 +213,7 @@ public:
|
||||
// get the cursor position of the beginning/end of the prev/next word in the text
|
||||
S32 prevWordPos(S32 cursorPos) const;
|
||||
S32 nextWordPos(S32 cursorPos) const;
|
||||
BOOL getWordBoundriesAt(const S32 at, S32* word_begin, S32* word_length) const;
|
||||
|
||||
BOOL hasSelection() const { return (mSelectionStart != mSelectionEnd); }
|
||||
void startSelection();
|
||||
@@ -268,6 +288,14 @@ protected:
|
||||
LLUIString mText; // The string being edited.
|
||||
std::string mPrevText; // Saved string for 'ESC' revert
|
||||
LLUIString mLabel; // text label that is visible when no user text provided
|
||||
std::string mPrevSpelledText; // saved string so we know whether to respell or not
|
||||
std::vector<S32> misspellLocations; // where all the misspelled words are
|
||||
S32 mStartSpellHere; // the position of the first char on the screen, stored so we know when to update
|
||||
S32 mEndSpellHere; // the location of the last char on the screen
|
||||
BOOL mSpellCheckable; // set in xui as "spell_check". Default value for a field
|
||||
LLFrameTimer mSpellTimer;
|
||||
std::vector<SpellMenuBind* > suggestionMenuItems;
|
||||
S32 mLastContextMenuX;
|
||||
|
||||
// line history support:
|
||||
BOOL mHaveHistory; // flag for enabled line history
|
||||
|
||||
@@ -2525,6 +2525,11 @@ BOOL LLMenuGL::handleJumpKey(KEY key)
|
||||
// Add the menu item to this menu.
|
||||
BOOL LLMenuGL::append( LLMenuItemGL* item )
|
||||
{
|
||||
if (mSpilloverMenu)
|
||||
{
|
||||
return mSpilloverMenu->append(item);
|
||||
}
|
||||
|
||||
mItems.push_back( item );
|
||||
addChild( item );
|
||||
arrange();
|
||||
@@ -2572,6 +2577,31 @@ BOOL LLMenuGL::appendMenu( LLMenuGL* menu )
|
||||
return success;
|
||||
}
|
||||
|
||||
// Remove a menu item from this menu.
|
||||
BOOL LLMenuGL::remove( LLMenuItemGL* item )
|
||||
{
|
||||
if (mSpilloverMenu)
|
||||
{
|
||||
cleanupSpilloverBranch();
|
||||
}
|
||||
|
||||
item_list_t::iterator found_iter = std::find(mItems.begin(), mItems.end(), item);
|
||||
if (found_iter != mItems.end())
|
||||
{
|
||||
mItems.erase(found_iter);
|
||||
}
|
||||
|
||||
removeChild( item );
|
||||
|
||||
// We keep it around in case someone is pointing at it.
|
||||
// The caller can delete it if it's safe.
|
||||
// Note that getMenu() will still not work since its parent isn't a menu.
|
||||
sMenuContainer->addChild( item );
|
||||
|
||||
arrange();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void LLMenuGL::setEnabledSubMenus(BOOL enable)
|
||||
{
|
||||
setEnabled(enable);
|
||||
@@ -2829,6 +2859,11 @@ void LLMenuGL::updateParent(LLView* parentp)
|
||||
{
|
||||
(*item_iter)->updateBranchParent(parentp);
|
||||
}
|
||||
|
||||
if (mSpilloverMenu)
|
||||
{
|
||||
mSpilloverMenu->updateParent(parentp);
|
||||
}
|
||||
}
|
||||
|
||||
BOOL LLMenuGL::handleAcceleratorKey(KEY key, MASK mask)
|
||||
|
||||
@@ -442,6 +442,9 @@ public:
|
||||
// Add the menu item to this menu.
|
||||
virtual BOOL append( LLMenuItemGL* item );
|
||||
|
||||
// Remove a menu item from this menu.
|
||||
virtual BOOL remove( LLMenuItemGL* item );
|
||||
|
||||
// *NOTE:Mani - appendNoArrange() should be removed when merging to skinning/viewer2.0
|
||||
// Its added as a fix to a viewer 1.23 bug that has already been address by skinning work.
|
||||
virtual BOOL appendNoArrange( LLMenuItemGL* item );
|
||||
|
||||
@@ -439,7 +439,7 @@ void LLMultiSlider::draw()
|
||||
F32 opacity = getEnabled() ? 1.f : 0.3f;
|
||||
|
||||
// Track
|
||||
LLUIImagePtr thumb_imagep = LLUI::sImageProvider->getUIImage("rounded_square.tga");
|
||||
LLUIImagePtr thumb_imagep = LLUI::getUIImage("rounded_square.tga");
|
||||
|
||||
S32 height_offset = (getRect().getHeight() - MULTI_TRACK_HEIGHT) / 2;
|
||||
LLRect track_rect(0, getRect().getHeight() - height_offset, getRect().getWidth(), height_offset );
|
||||
|
||||
@@ -734,7 +734,7 @@ void LLNotificationChannelBase::connectChanged(const LLStandardSignal::slot_type
|
||||
// only about new notifications
|
||||
for (LLNotificationSet::iterator it = mItems.begin(); it != mItems.end(); ++it)
|
||||
{
|
||||
slot.get_slot_function()(LLSD().insert("sigtype", "load").insert("id", (*it)->id()));
|
||||
slot.get_slot_function()(LLSD().with("sigtype", "load").with("id", (*it)->id()));
|
||||
}
|
||||
// and then connect the signal so that all future notifications will also be
|
||||
// forwarded.
|
||||
@@ -922,7 +922,7 @@ void LLNotificationChannel::setComparator(LLNotificationComparator comparator)
|
||||
mItems.swap(s2);
|
||||
|
||||
// notify clients that we've been resorted
|
||||
mChanged(LLSD().insert("sigtype", "sort"));
|
||||
mChanged(LLSD().with("sigtype", "sort"));
|
||||
}
|
||||
|
||||
bool LLNotificationChannel::isEmpty() const
|
||||
@@ -1432,7 +1432,7 @@ void LLNotifications::add(const LLNotificationPtr pNotif)
|
||||
llerrs << "Notification added a second time to the master notification channel." << llendl;
|
||||
}
|
||||
|
||||
updateItem(LLSD().insert("sigtype", "add").insert("id", pNotif->id()), pNotif);
|
||||
updateItem(LLSD().with("sigtype", "add").with("id", pNotif->id()), pNotif);
|
||||
}
|
||||
|
||||
void LLNotifications::cancel(LLNotificationPtr pNotif)
|
||||
@@ -1442,7 +1442,7 @@ void LLNotifications::cancel(LLNotificationPtr pNotif)
|
||||
{
|
||||
llerrs << "Attempted to delete nonexistent notification " << pNotif->getName() << llendl;
|
||||
}
|
||||
updateItem(LLSD().insert("sigtype", "delete").insert("id", pNotif->id()), pNotif);
|
||||
updateItem(LLSD().with("sigtype", "delete").with("id", pNotif->id()), pNotif);
|
||||
pNotif->cancel();
|
||||
}
|
||||
|
||||
@@ -1451,7 +1451,7 @@ void LLNotifications::update(const LLNotificationPtr pNotif)
|
||||
LLNotificationSet::iterator it=mItems.find(pNotif);
|
||||
if (it != mItems.end())
|
||||
{
|
||||
updateItem(LLSD().insert("sigtype", "change").insert("id", pNotif->id()), pNotif);
|
||||
updateItem(LLSD().with("sigtype", "change").with("id", pNotif->id()), pNotif);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -98,12 +98,12 @@ void LLProgressBar::setPercent(const F32 percent)
|
||||
|
||||
void LLProgressBar::setImageBar( const std::string &bar_name )
|
||||
{
|
||||
mImageBar = LLUI::sImageProvider->getUIImage(bar_name)->getImage();
|
||||
mImageBar = LLUI::getUIImage(bar_name)->getImage();
|
||||
}
|
||||
|
||||
void LLProgressBar::setImageShadow(const std::string &shadow_name)
|
||||
{
|
||||
mImageShadow = LLUI::sImageProvider->getUIImage(shadow_name)->getImage();
|
||||
mImageShadow = LLUI::getUIImage(shadow_name)->getImage();
|
||||
}
|
||||
|
||||
void LLProgressBar::setColorBar(const LLColor4 &c)
|
||||
|
||||
@@ -61,13 +61,13 @@ public:
|
||||
protected:
|
||||
F32 mPercentDone;
|
||||
|
||||
LLPointer<LLImageGL> mImageBar;
|
||||
LLPointer<LLTexture> mImageBar;
|
||||
//LLUUID mImageBarID;
|
||||
//LLString mImageBarName;
|
||||
LLColor4 mColorBar;
|
||||
LLColor4 mColorBar2;
|
||||
|
||||
LLPointer<LLImageGL> mImageShadow;
|
||||
LLPointer<LLTexture> mImageShadow;
|
||||
//LLUUID mImageShadowID;
|
||||
//LLString mImageShadowName;
|
||||
LLColor4 mColorShadow;
|
||||
|
||||
@@ -60,7 +60,7 @@ LLResizeHandle::LLResizeHandle( const std::string& name, const LLRect& rect, S32
|
||||
|
||||
if( RIGHT_BOTTOM == mCorner)
|
||||
{
|
||||
mImage = LLUI::sImageProvider->getUIImage("UIImgResizeBottomRightUUID");
|
||||
mImage = LLUI::getUIImage("UIImgResizeBottomRightUUID");
|
||||
}
|
||||
|
||||
switch( mCorner )
|
||||
|
||||
@@ -460,7 +460,7 @@ LLLocale::LLLocale(const std::string& locale_string)
|
||||
char* new_locale_string = setlocale( LC_ALL, locale_string.c_str());
|
||||
if ( new_locale_string == NULL)
|
||||
{
|
||||
llwarns << "Failed to set locale " << locale_string << llendl;
|
||||
llwarns << "Failed to set locale " << locale_string.c_str() << llendl;
|
||||
setlocale(LC_ALL, SYSTEM_LOCALE.c_str());
|
||||
}
|
||||
//else
|
||||
|
||||
@@ -509,7 +509,7 @@ void LLScrollbar::draw()
|
||||
|
||||
|
||||
// Draw background and thumb.
|
||||
LLUIImage* rounded_rect_imagep = LLUI::sImageProvider->getUIImage("rounded_square.tga");
|
||||
LLUIImage* rounded_rect_imagep = LLUI::getUIImage("rounded_square.tga");
|
||||
|
||||
if (!rounded_rect_imagep)
|
||||
{
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user