From cda7a0f8cf03b7a99e077043daa2d99ac16ace81 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Wed, 9 Feb 2011 23:32:46 -0800 Subject: STORM-987 : Create initial files for llimage_libtest (doesn't build) --- indra/integration_tests/CMakeLists.txt | 1 + .../llimage_libtest/CMakeLists.txt | 114 +++++++++++++++++++++ .../llimage_libtest/llimage_libtest.cpp | 47 +++++++++ .../llimage_libtest/llimage_libtest.h | 29 ++++++ 4 files changed, 191 insertions(+) create mode 100644 indra/integration_tests/llimage_libtest/CMakeLists.txt create mode 100644 indra/integration_tests/llimage_libtest/llimage_libtest.cpp create mode 100644 indra/integration_tests/llimage_libtest/llimage_libtest.h (limited to 'indra') diff --git a/indra/integration_tests/CMakeLists.txt b/indra/integration_tests/CMakeLists.txt index 67e8fbf1f2..5935f23fe9 100644 --- a/indra/integration_tests/CMakeLists.txt +++ b/indra/integration_tests/CMakeLists.txt @@ -1,3 +1,4 @@ # -*- cmake -*- add_subdirectory(llui_libtest) +add_subdirectory(llimage_libtest) diff --git a/indra/integration_tests/llimage_libtest/CMakeLists.txt b/indra/integration_tests/llimage_libtest/CMakeLists.txt new file mode 100644 index 0000000000..e3c508659b --- /dev/null +++ b/indra/integration_tests/llimage_libtest/CMakeLists.txt @@ -0,0 +1,114 @@ +# -*- cmake -*- + +# Integration tests of the llimage library (JPEG2000 images reading and writing) + +if (VIEWER) + +project (llimage_libtest) + +include(00-Common) +include(LLCommon) +include(LLImage) +include(LLImageJ2COJ) +include(LLKDU) +include(LLMath) +#include(LLVFS) # ugh, needed for LLDir +#include(LLXML) +#include(LLXUIXML) +include(Linking) +# include(Tut) + +include_directories( + ${LLCOMMON_INCLUDE_DIRS} + ${LLIMAGE_INCLUDE_DIRS} + ${LLMATH_INCLUDE_DIRS} + ) + +set(llimage_libtest_SOURCE_FILES + llimage_libtest.cpp + ) + +set(llimage_libtest_HEADER_FILES + CMakeLists.txt + llimage_libtest.h + ) + +set_source_files_properties(${llimage_libtest_HEADER_FILES} + PROPERTIES HEADER_FILE_ONLY TRUE) + +list(APPEND llimage_libtest_SOURCE_FILES ${llimage_libtest_HEADER_FILES}) + +add_executable(llimage_libtest ${llimage_libtest_SOURCE_FILES}) + +# Link with OS-specific libraries +if (DARWIN) + find_library(COCOA_LIBRARY Cocoa) + set(OS_LIBRARIES ${COCOA_LIBRARY}) +elseif (WINDOWS) + #ll_stack_trace needs this now... + list(APPEND WINDOWS_LIBRARIES dbghelp) + set(OS_LIBRARIES ${WINDOWS_LIBRARIES}) +elseif (LINUX) + set(OS_LIBRARIES) +else (DARWIN) + message(FATAL_ERROR "unknown platform") +endif (DARWIN) + +# Libraries on which this library depends, needed for Linux builds +# Sort by high-level to low-level +target_link_libraries(llimage_libtest + ${LLIMAGE_LIBRARIES} + ${LLKDU_LIBRARIES} + ${KDU_LIBRARY} + ${LLIMAGEJ2COJ_LIBRARIES} + ${OS_LIBRARIES} + ${GOOGLE_PERFTOOLS_LIBRARIES} + ) + +if (DARWIN) + set_target_properties(llimage_libtest + PROPERTIES + OUTPUT_NAME "llimage_libtest" + MACOSX_BUNDLE_INFO_STRING "llimage test utility" + MACOSX_BUNDLE_GUI_IDENTIFIER "llimage_libtest" + MACOSX_BUNDLE_LONG_VERSION_STRING "0.5" + MACOSX_BUNDLE_BUNDLE_NAME "llimage_libtest" + MACOSX_BUNDLE_SHORT_VERSION_STRING "v0.5" + MACOSX_BUNDLE_BUNDLE_VERSION "v0.5" + MACOSX_BUNDLE_COPYRIGHT "Copyright Linden Lab 2011" + ) + # TODO : Copy over libs in the bundle +elseif (WINDOWS) + set_target_properties(llimage_libtest + PROPERTIES + LINK_FLAGS "/NODEFAULTLIB:LIBCMT" + LINK_FLAGS_DEBUG "/NODEFAULTLIB:MSVCRT /NODEFAULTLIB:LIBCMTD" + ) + + # Copy over OpenJPEG.dll + # *NOTE: On Windows with VS2005, only the first comment prints + set(OPENJPEG_RELEASE + "${CMAKE_SOURCE_DIR}/../libraries/i686-win32/lib/release/openjpeg.dll") + add_custom_command( TARGET llimage_libtest POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${OPENJPEG_RELEASE} ${CMAKE_CURRENT_BINARY_DIR} + COMMENT "Copying OpenJPEG DLLs to binary directory" + ) + set(OPENJPEG_DEBUG + "${CMAKE_SOURCE_DIR}/../libraries/i686-win32/lib/debug/openjpegd.dll") + add_custom_command( TARGET llimage_libtest POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${OPENJPEG_DEBUG} ${CMAKE_CURRENT_BINARY_DIR} + ) +elseif (LINUX) + # TODO : please help me get this to build and run for Linux! +else (DARWIN) + message(FATAL_ERROR "unknown platform") +endif (DARWIN) + +# Ensure people working on the viewer don't break this library +# *NOTE: This could be removed, or only built by TeamCity, if the build +# and link times become too long. +add_dependencies(viewer llimage_libtest) + +endif (VIEWER) diff --git a/indra/integration_tests/llimage_libtest/llimage_libtest.cpp b/indra/integration_tests/llimage_libtest/llimage_libtest.cpp new file mode 100644 index 0000000000..a4a4d10bcb --- /dev/null +++ b/indra/integration_tests/llimage_libtest/llimage_libtest.cpp @@ -0,0 +1,47 @@ +/** + * @file llimage_libtest.cpp + * @author Merov Linden + * @brief Integration test for the llimage library + * + * $LicenseInfo:firstyear=2011&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2011, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ +#include "linden_common.h" + +#include "llimage_libtest.h" + +// linden library includes + +#include + +// *TODO: switch to using TUT +// *TODO: teach TeamCity about this program, run automatically after full builds + +void init_llimage() +{ +} + +int main(int argc, char** argv) +{ + init_llimage(); + + return 0; +} diff --git a/indra/integration_tests/llimage_libtest/llimage_libtest.h b/indra/integration_tests/llimage_libtest/llimage_libtest.h new file mode 100644 index 0000000000..63f3d46b50 --- /dev/null +++ b/indra/integration_tests/llimage_libtest/llimage_libtest.h @@ -0,0 +1,29 @@ +/** + * @file llimage_libtest.h + * + * $LicenseInfo:firstyear=2011&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2011, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ +#ifndef LLIMAGE_LIBTEST_H +#define LLIMAGE_LIBTEST_H + + +#endif -- cgit v1.2.3 From b430cf7524d91e27aadcf8a37b03af9b6b4d3e42 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Tue, 15 Feb 2011 18:13:44 -0800 Subject: STORM-987 : Clean-up very silly cmake issues prior to making Windows build --- indra/integration_tests/llimage_libtest/CMakeLists.txt | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'indra') diff --git a/indra/integration_tests/llimage_libtest/CMakeLists.txt b/indra/integration_tests/llimage_libtest/CMakeLists.txt index 0733e5e283..f59440be6b 100644 --- a/indra/integration_tests/llimage_libtest/CMakeLists.txt +++ b/indra/integration_tests/llimage_libtest/CMakeLists.txt @@ -53,11 +53,9 @@ if (DARWIN) find_library(COREFOUNDATION_LIBRARY CoreFoundation) set(OS_LIBRARIES ${COREFOUNDATION_LIBRARY}) elseif (WINDOWS) - #ll_stack_trace needs this now... - list(APPEND WINDOWS_LIBRARIES dbghelp) - set(OS_LIBRARIES ${WINDOWS_LIBRARIES}) +# set(OS_LIBRARIES) elseif (LINUX) - set(OS_LIBRARIES) +# set(OS_LIBRARIES) else (DARWIN) message(FATAL_ERROR "Unknown platform") endif (DARWIN) @@ -106,12 +104,15 @@ if (DARWIN) add_custom_command(TARGET llimage_libtest POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/../libraries/universal-darwin/lib_release/libapr-1.0.3.7.dylib ${LLIMAGE_LIBTEST_DESTINATION_DIR} DEPENDS ${CMAKE_SOURCE_DIR}/../libraries/universal-darwin/lib_release/libapr-1.0.3.7.dylib - add_custom_command(TARGET llimage_libtest POST_BUILD + ) + add_custom_command(TARGET llimage_libtest POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/../libraries/universal-darwin/lib_release/libaprutil-1.0.3.8.dylib ${LLIMAGE_LIBTEST_DESTINATION_DIR} DEPENDS ${CMAKE_SOURCE_DIR}/../libraries/universal-darwin/lib_release/libaprutil-1.0.3.8.dylib + ) add_custom_command(TARGET llimage_libtest POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/../libraries/universal-darwin/lib_release/libexception_handler.dylib ${LLIMAGE_LIBTEST_DESTINATION_DIR} DEPENDS ${CMAKE_SOURCE_DIR}/../libraries/universal-darwin/lib_release/libexception_handler.dylib + ) add_custom_command(TARGET llimage_libtest POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/../libraries/universal-darwin/lib_release/libexpat.0.5.0.dylib ${LLIMAGE_LIBTEST_DESTINATION_DIR} DEPENDS ${CMAKE_SOURCE_DIR}/../libraries/universal-darwin/lib_release/libexpat.0.5.0.dylib -- cgit v1.2.3 From 0ca7011b3154fd5db0a125f7d90de1c1e460105f Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Tue, 15 Feb 2011 22:43:54 -0800 Subject: STORM-987 : Add in and out command line arguments, builds and runs on Windows and Mac --- .../llimage_libtest/llimage_libtest.cpp | 123 +++++++++++++-------- 1 file changed, 78 insertions(+), 45 deletions(-) (limited to 'indra') diff --git a/indra/integration_tests/llimage_libtest/llimage_libtest.cpp b/indra/integration_tests/llimage_libtest/llimage_libtest.cpp index e8fe4864fb..6549aa0207 100644 --- a/indra/integration_tests/llimage_libtest/llimage_libtest.cpp +++ b/indra/integration_tests/llimage_libtest/llimage_libtest.cpp @@ -41,15 +41,19 @@ // system libraries #include +// doc string provided when invoking the program with --help static const char USAGE[] = "\n" "usage:\tllimage_libtest [options]\n" "\n" " --help print this help\n" +" --in ... list of image files to load and convert\n" +" --out ... list of image files to create (assumes same order as --in files)\n" "\n"; -LLPointer load_image(const std::string &src_filename) +// Create an empty formatted image instance of the correct type from the filename +LLPointer create_image(const std::string &filename) { - std::string exten = gDirUtilp->getExtension(src_filename); + std::string exten = gDirUtilp->getExtension(filename); U32 codec = LLImageBase::getCodecFromExtension(exten); LLPointer image; @@ -73,6 +77,14 @@ LLPointer load_image(const std::string &src_filename) default: return NULL; } + + return image; +} + +// Load an image from file and return a raw (decompressed) instance of its data +LLPointer load_image(const std::string &src_filename) +{ + LLPointer image = create_image(src_filename); if (!image->load(src_filename)) { @@ -94,79 +106,100 @@ LLPointer load_image(const std::string &src_filename) return raw_image; } -bool save_image(const std::string &filepath, LLPointer raw_image) +// Save a raw image instance into a file +bool save_image(const std::string &dest_filename, LLPointer raw_image) { - std::string exten = gDirUtilp->getExtension(filepath); - U32 codec = LLImageBase::getCodecFromExtension(exten); - - LLPointer image; - switch (codec) - { - case IMG_CODEC_BMP: - image = new LLImageBMP(); - break; - case IMG_CODEC_TGA: - image = new LLImageTGA(); - break; - case IMG_CODEC_JPEG: - image = new LLImageJPEG(); - break; - case IMG_CODEC_J2C: - image = new LLImageJ2C(); - break; - case IMG_CODEC_PNG: - image = new LLImagePNG(); - break; - default: - return NULL; - } + LLPointer image = create_image(dest_filename); if (!image->encode(raw_image, 0.0f)) { return false; } - return image->save(filepath); + return image->save(dest_filename); } int main(int argc, char** argv) { + // List of input and output files + std::list input_filenames; + std::list output_filenames; + // Init whatever is necessary ll_init_apr(); LLImage::initClass(); // Analyze command line arguments - for (int arg=1; arg raw_image = load_image("lolcat-monorail.jpg"); - if (raw_image) + // Analyze the list of (input,output) files + if (input_filenames.size() == 0) { - std::cout << "Image loaded\n" << std::endl; + std::cout << "No input file, nothing to do -> exit" << std::endl; + return 0; } - else + // TODO: For the moment, we simply convert each input file to something. This needs to evolve... + if (input_filenames.size() != output_filenames.size()) { - std::cout << "Image not found\n" << std::endl; + std::cout << "Number of output and input files different -> exit" << std::endl; + return 0; } - - // Save file - if (raw_image) + + std::list::iterator in_file = input_filenames.begin(); + std::list::iterator out_file = output_filenames.begin(); + std::list::iterator end = input_filenames.end(); + for (; in_file != end; ++in_file, ++out_file) { - save_image("monorail.png",raw_image); + // Load file + LLPointer raw_image = load_image(*in_file); + if (!raw_image) + { + std::cout << "Error: Image " << *in_file << " could not be loaded" << std::endl; + continue; + } + + // Save file + if (!save_image(*out_file, raw_image)) + { + std::cout << "Error: Image " << *out_file << " could not be saved" << std::endl; + continue; + } + std::cout << *in_file << " -> " << *out_file << std::endl; + + // Output stats on each file } - - // Output stats on each file // Cleanup and exit LLImage::cleanupClass(); -- cgit v1.2.3 From 0dbc5a40cb83919187fed961de835726e044906d Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Wed, 16 Feb 2011 17:29:32 -0800 Subject: STORM-987 : Implement in and out list of files and pattern matching --- .../llimage_libtest/llimage_libtest.cpp | 117 ++++++++++++++++++--- 1 file changed, 105 insertions(+), 12 deletions(-) (limited to 'indra') diff --git a/indra/integration_tests/llimage_libtest/llimage_libtest.cpp b/indra/integration_tests/llimage_libtest/llimage_libtest.cpp index 6549aa0207..37e979b260 100644 --- a/indra/integration_tests/llimage_libtest/llimage_libtest.cpp +++ b/indra/integration_tests/llimage_libtest/llimage_libtest.cpp @@ -45,9 +45,10 @@ static const char USAGE[] = "\n" "usage:\tllimage_libtest [options]\n" "\n" -" --help print this help\n" -" --in ... list of image files to load and convert\n" -" --out ... list of image files to create (assumes same order as --in files)\n" +" --help print this help\n" +" --in list of image files to load and convert, patterns can be used\n" +" --out OR list of image files to create (assumes same order as --in files)\n" +" OR 3 letters file type extension to convert each input file into\n" "\n"; // Create an empty formatted image instance of the correct type from the filename @@ -119,6 +120,88 @@ bool save_image(const std::string &dest_filename, LLPointer raw_imag return image->save(dest_filename); } +void store_input_file(std::list &input_filenames, const std::string &path) +{ + // Break the incoming path in its components + std::string dir = gDirUtilp->getDirName(path); + std::string name = gDirUtilp->getBaseFileName(path); + std::string exten = gDirUtilp->getExtension(path); + + // std::cout << "store_input_file : " << path << ", dir : " << dir << ", name : " << name << ", exten : " << exten << std::endl; + + // If extension is not an image type or "*", exit + // Note: we don't support complex patterns for the extension like "j??" + // Note: on most shells, the pattern expansion is done by the shell so that pattern matching limitation is actually not a problem + if ((exten.compare("*") != 0) && (LLImageBase::getCodecFromExtension(exten) == IMG_CODEC_INVALID)) + { + return; + } + + if ((name.find('*') != -1) || ((name.find('?') != -1))) + { + // If file name is a pattern, iterate to get each file name and store + std::string next_name; + while (gDirUtilp->getNextFileInDir(dir,name,next_name)) + { + std::string file_name = dir + gDirUtilp->getDirDelimiter() + next_name; + input_filenames.push_back(file_name); + } + } + else + { + // Verify that the file does exist before storing + if (gDirUtilp->fileExists(path)) + { + input_filenames.push_back(path); + } + else + { + std::cout << "store_input_file : the file " << path << " could not be found" << std::endl; + } + } +} + +void store_output_file(std::list &output_filenames, std::list &input_filenames, const std::string &path) +{ + // Break the incoming path in its components + std::string dir = gDirUtilp->getDirName(path); + std::string name = gDirUtilp->getBaseFileName(path); + std::string exten = gDirUtilp->getExtension(path); + + // std::cout << "store_output_file : " << path << ", dir : " << dir << ", name : " << name << ", exten : " << exten << std::endl; + + if (dir.empty() && exten.empty()) + { + // If dir and exten are empty, we interpret the name as a file extension type name and will iterate through input list to populate the output list + exten = name; + // Make sure the extension is an image type + if (LLImageBase::getCodecFromExtension(exten) == IMG_CODEC_INVALID) + { + return; + } + std::string delim = gDirUtilp->getDirDelimiter(); + std::list::iterator in_file = input_filenames.begin(); + std::list::iterator end = input_filenames.end(); + for (; in_file != end; ++in_file) + { + dir = gDirUtilp->getDirName(*in_file); + name = gDirUtilp->getBaseFileName(*in_file,true); + std::string file_name = dir + delim + name + "." + exten; + output_filenames.push_back(file_name); + } + } + else + { + // Make sure the extension is an image type + if (LLImageBase::getCodecFromExtension(exten) == IMG_CODEC_INVALID) + { + return; + } + // Store the path + output_filenames.push_back(path); + } +} + int main(int argc, char** argv) { // List of input and output files @@ -143,24 +226,40 @@ int main(int argc, char** argv) std::string file_name = argv[arg+1]; while (file_name[0] != '-') // if arg starts with '-', we consider it's not a file name but some other argument { - input_filenames.push_back(file_name); // Add file name to the list + // std::cout << "input file name : " << file_name << std::endl; + store_input_file(input_filenames, file_name); arg += 1; // Skip that arg now we know it's a file name if ((arg + 1) == argc) // Break out of the loop if we reach the end of the arg list break; file_name = argv[arg+1]; // Next argument and loop over } - } + // DEBUG output + std::list::iterator in_file = input_filenames.begin(); + std::list::iterator end = input_filenames.end(); + for (; in_file != end; ++in_file) + { + std::cout << "input file : " << *in_file << std::endl; + } + } else if (!strcmp(argv[arg], "--out") && arg < argc-1) { std::string file_name = argv[arg+1]; while (file_name[0] != '-') // if arg starts with '-', we consider it's not a file name but some other argument { - output_filenames.push_back(file_name); // Add file name to the list + // std::cout << "output file name : " << file_name << std::endl; + store_output_file(output_filenames, input_filenames, file_name); arg += 1; // Skip that arg now we know it's a file name if ((arg + 1) == argc) // Break out of the loop if we reach the end of the arg list break; file_name = argv[arg+1]; // Next argument and loop over } + // DEBUG output + std::list::iterator out_file = output_filenames.begin(); + std::list::iterator end = output_filenames.end(); + for (; out_file != end; ++out_file) + { + std::cout << "output file : " << *out_file << std::endl; + } } } @@ -170,12 +269,6 @@ int main(int argc, char** argv) std::cout << "No input file, nothing to do -> exit" << std::endl; return 0; } - // TODO: For the moment, we simply convert each input file to something. This needs to evolve... - if (input_filenames.size() != output_filenames.size()) - { - std::cout << "Number of output and input files different -> exit" << std::endl; - return 0; - } std::list::iterator in_file = input_filenames.begin(); std::list::iterator out_file = output_filenames.begin(); -- cgit v1.2.3 From 7d47ea1ab254e13cbff476fee317042f81d84b25 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Wed, 16 Feb 2011 21:50:32 -0800 Subject: STORM-987 : Allow more flexibility around input and output lists --- .../llimage_libtest/llimage_libtest.cpp | 36 ++++++++++------------ 1 file changed, 16 insertions(+), 20 deletions(-) (limited to 'indra') diff --git a/indra/integration_tests/llimage_libtest/llimage_libtest.cpp b/indra/integration_tests/llimage_libtest/llimage_libtest.cpp index 37e979b260..4104527f83 100644 --- a/indra/integration_tests/llimage_libtest/llimage_libtest.cpp +++ b/indra/integration_tests/llimage_libtest/llimage_libtest.cpp @@ -233,13 +233,6 @@ int main(int argc, char** argv) break; file_name = argv[arg+1]; // Next argument and loop over } - // DEBUG output - std::list::iterator in_file = input_filenames.begin(); - std::list::iterator end = input_filenames.end(); - for (; in_file != end; ++in_file) - { - std::cout << "input file : " << *in_file << std::endl; - } } else if (!strcmp(argv[arg], "--out") && arg < argc-1) { @@ -253,13 +246,6 @@ int main(int argc, char** argv) break; file_name = argv[arg+1]; // Next argument and loop over } - // DEBUG output - std::list::iterator out_file = output_filenames.begin(); - std::list::iterator end = output_filenames.end(); - for (; out_file != end; ++out_file) - { - std::cout << "output file : " << *out_file << std::endl; - } } } @@ -270,10 +256,12 @@ int main(int argc, char** argv) return 0; } + // Perform action on each input file std::list::iterator in_file = input_filenames.begin(); std::list::iterator out_file = output_filenames.begin(); - std::list::iterator end = input_filenames.end(); - for (; in_file != end; ++in_file, ++out_file) + std::list::iterator in_end = input_filenames.end(); + std::list::iterator out_end = output_filenames.end(); + for (; in_file != in_end; ++in_file) { // Load file LLPointer raw_image = load_image(*in_file); @@ -284,16 +272,24 @@ int main(int argc, char** argv) } // Save file - if (!save_image(*out_file, raw_image)) + if (out_file != out_end) { - std::cout << "Error: Image " << *out_file << " could not be saved" << std::endl; - continue; + if (!save_image(*out_file, raw_image)) + { + std::cout << "Error: Image " << *out_file << " could not be saved" << std::endl; + } + else + { + std::cout << *in_file << " -> " << *out_file << std::endl; + } + ++out_file; } - std::cout << *in_file << " -> " << *out_file << std::endl; // Output stats on each file } + // Output perf data if required by user + // Cleanup and exit LLImage::cleanupClass(); -- cgit v1.2.3 From f5b3d13b7f3a0aafb0848e76fda190698fe0815b Mon Sep 17 00:00:00 2001 From: Seth ProductEngine Date: Thu, 3 Mar 2011 19:06:39 +0200 Subject: STORM-1036 FIXED The unused "How to create a new Classified ad" notification removed from XUI ("en" locale only). --- indra/newview/skins/default/xui/en/notifications.xml | 15 --------------- 1 file changed, 15 deletions(-) (limited to 'indra') diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml index f008042a81..44bfff81f4 100644 --- a/indra/newview/skins/default/xui/en/notifications.xml +++ b/indra/newview/skins/default/xui/en/notifications.xml @@ -751,21 +751,6 @@ You need to enter either the Username or both the First and Last name of your av - -Classified ads appear in the 'Classified' section of the Search directory and on [http://secondlife.com/community/classifieds secondlife.com] for one week. -Fill out your ad, then click 'Publish...' to add it to the directory. -You'll be asked for a price to pay when clicking Publish. -Paying more makes your ad appear higher in the list, and also appear higher when people search for keywords. - - - Date: Tue, 8 Mar 2011 23:44:00 -0800 Subject: STORM-987 : Add --logmetrics and --analyzeperformance arguments, moved analyzeMetricPerformanceLog() and doAnalysisMetrics() from LLFastTimerView to LLMetricPerformanceTesterBasic --- .../llimage_libtest/llimage_libtest.cpp | 89 +++++++++++++++++++++- indra/llcommon/llmetricperformancetester.cpp | 71 +++++++++++++++++ indra/llcommon/llmetricperformancetester.h | 3 + indra/newview/llfasttimerview.cpp | 74 +----------------- indra/newview/llfasttimerview.h | 2 - 5 files changed, 162 insertions(+), 77 deletions(-) (limited to 'indra') diff --git a/indra/integration_tests/llimage_libtest/llimage_libtest.cpp b/indra/integration_tests/llimage_libtest/llimage_libtest.cpp index 4104527f83..2442313ef2 100644 --- a/indra/integration_tests/llimage_libtest/llimage_libtest.cpp +++ b/indra/integration_tests/llimage_libtest/llimage_libtest.cpp @@ -26,6 +26,7 @@ */ #include "linden_common.h" #include "llpointer.h" +#include "lltimer.h" #include "llimage_libtest.h" @@ -49,8 +50,13 @@ static const char USAGE[] = "\n" " --in list of image files to load and convert, patterns can be used\n" " --out OR list of image files to create (assumes same order as --in files)\n" " OR 3 letters file type extension to convert each input file into\n" +" --logmetrics log performance metric and data for \n" +" --analyzeperformance create report comparing baseline with current for provided in --logmetrics\n" "\n"; +// true when all image loading is done. Used by metric logging thread to know when to stop the thread. +static bool sAllDone = false; + // Create an empty formatted image instance of the correct type from the filename LLPointer create_image(const std::string &filename) { @@ -202,15 +208,43 @@ void store_output_file(std::list &output_filenames, std::list input_filenames; std::list output_filenames; + bool analyze_performance = false; // Init whatever is necessary ll_init_apr(); LLImage::initClass(); + LogThread* fast_timer_log_thread = NULL; // For performance and metric gathering // Analyze command line arguments for (int arg = 1; arg < argc; ++arg) @@ -246,7 +280,34 @@ int main(int argc, char** argv) break; file_name = argv[arg+1]; // Next argument and loop over } - } + } + else if (!strcmp(argv[arg], "--logmetrics")) + { + // '--logmetrics' needs to be specified with a named test metric argument + // Note: for the moment, only ImageCompressionTester has been tested + std::string test_name; + if ((arg + 1) < argc) + { + test_name = argv[arg+1]; + } + if (((arg + 1) >= argc) || (test_name[0] == '-')) + { + // We don't have an argument left in the arg list or the next argument is another option + std::cout << "No --logmetrics argument given, no perf data will be gathered" << std::endl; + } + else + { + LLFastTimer::sMetricLog = TRUE; + LLFastTimer::sLogName = test_name; + arg += 1; // Skip that arg now we know it's a valid test name + if ((arg + 1) == argc) // Break out of the loop if we reach the end of the arg list + break; + } + } + else if (!strcmp(argv[arg], "--analyzeperformance")) + { + analyze_performance = true; + } } // Analyze the list of (input,output) files @@ -256,6 +317,14 @@ int main(int argc, char** argv) return 0; } + // Create the logging thread if required + if (LLFastTimer::sMetricLog) + { + LLFastTimer::sLogLock = new LLMutex(NULL); + fast_timer_log_thread = new LogThread(LLFastTimer::sLogName); + fast_timer_log_thread->start(); + } + // Perform action on each input file std::list::iterator in_file = input_filenames.begin(); std::list::iterator out_file = output_filenames.begin(); @@ -288,10 +357,26 @@ int main(int argc, char** argv) // Output stats on each file } - // Output perf data if required by user + sAllDone = true; + + // Output perf data if requested by user + if (analyze_performance) + { + std::cout << "Analyzing performance" << std::endl; + + std::string baseline_name = LLFastTimer::sLogName + "_baseline.slp"; + std::string current_name = LLFastTimer::sLogName + ".slp"; + std::string report_name = LLFastTimer::sLogName + "_report.csv"; + + LLMetricPerformanceTesterBasic::doAnalysisMetrics(baseline_name, current_name, report_name); + } // Cleanup and exit LLImage::cleanupClass(); + if (fast_timer_log_thread) + { + fast_timer_log_thread->shutdown(); + } return 0; } diff --git a/indra/llcommon/llmetricperformancetester.cpp b/indra/llcommon/llmetricperformancetester.cpp index 5fa3a5ea07..1f1c633909 100644 --- a/indra/llcommon/llmetricperformancetester.cpp +++ b/indra/llcommon/llmetricperformancetester.cpp @@ -83,7 +83,78 @@ BOOL LLMetricPerformanceTesterBasic::isMetricLogRequested(std::string name) return (LLFastTimer::sMetricLog && ((LLFastTimer::sLogName == name) || (LLFastTimer::sLogName == DEFAULT_METRIC_NAME))); } +/*static*/ +LLSD LLMetricPerformanceTesterBasic::analyzeMetricPerformanceLog(std::istream& is) +{ + LLSD ret; + LLSD cur; + + while (!is.eof() && LLSDSerialize::fromXML(cur, is)) + { + for (LLSD::map_iterator iter = cur.beginMap(); iter != cur.endMap(); ++iter) + { + std::string label = iter->first; + + LLMetricPerformanceTesterBasic* tester = LLMetricPerformanceTesterBasic::getTester(iter->second["Name"].asString()) ; + if(tester) + { + ret[label]["Name"] = iter->second["Name"] ; + + S32 num_of_metrics = tester->getNumberOfMetrics() ; + for(S32 index = 0 ; index < num_of_metrics ; index++) + { + ret[label][ tester->getMetricName(index) ] = iter->second[ tester->getMetricName(index) ] ; + } + } + } + } + + return ret; +} + +/*static*/ +void LLMetricPerformanceTesterBasic::doAnalysisMetrics(std::string baseline, std::string target, std::string output) +{ + if(!LLMetricPerformanceTesterBasic::hasMetricPerformanceTesters()) + { + return ; + } + + // Open baseline and current target, exit if one is inexistent + std::ifstream base_is(baseline.c_str()); + std::ifstream target_is(target.c_str()); + if (!base_is.is_open() || !target_is.is_open()) + { + llwarns << "'-analyzeperformance' error : baseline or current target file inexistent" << llendl; + base_is.close(); + target_is.close(); + return; + } + + //analyze baseline + LLSD base = analyzeMetricPerformanceLog(base_is); + base_is.close(); + + //analyze current + LLSD current = analyzeMetricPerformanceLog(target_is); + target_is.close(); + //output comparision + std::ofstream os(output.c_str()); + + os << "Label, Metric, Base(B), Target(T), Diff(T-B), Percentage(100*T/B)\n"; + for(LLMetricPerformanceTesterBasic::name_tester_map_t::iterator iter = LLMetricPerformanceTesterBasic::sTesterMap.begin() ; + iter != LLMetricPerformanceTesterBasic::sTesterMap.end() ; ++iter) + { + LLMetricPerformanceTesterBasic* tester = ((LLMetricPerformanceTesterBasic*)iter->second) ; + tester->analyzePerformance(&os, &base, ¤t) ; + } + + os.flush(); + os.close(); +} + + //---------------------------------------------------------------------------------------------- // LLMetricPerformanceTesterBasic : Tester instance methods //---------------------------------------------------------------------------------------------- diff --git a/indra/llcommon/llmetricperformancetester.h b/indra/llcommon/llmetricperformancetester.h index 1372f48dcf..b790b636a7 100644 --- a/indra/llcommon/llmetricperformancetester.h +++ b/indra/llcommon/llmetricperformancetester.h @@ -62,6 +62,8 @@ public: */ virtual void analyzePerformance(std::ofstream* os, LLSD* base, LLSD* current) ; + static void doAnalysisMetrics(std::string baseline, std::string target, std::string output) ; + /** * @return Returns the number of the test metrics in this tester instance. */ @@ -116,6 +118,7 @@ protected: private: void preOutputTestResults(LLSD* sd) ; void postOutputTestResults(LLSD* sd) ; + static LLSD analyzeMetricPerformanceLog(std::istream& is) ; std::string mName ; // Name of this tester instance S32 mCount ; // Current record count diff --git a/indra/newview/llfasttimerview.cpp b/indra/newview/llfasttimerview.cpp index 92a3b9b2f5..279904b740 100644 --- a/indra/newview/llfasttimerview.cpp +++ b/indra/newview/llfasttimerview.cpp @@ -1149,36 +1149,6 @@ void LLFastTimerView::doAnalysisDefault(std::string baseline, std::string target os.close(); } -//------------------------- -//static -LLSD LLFastTimerView::analyzeMetricPerformanceLog(std::istream& is) -{ - LLSD ret; - LLSD cur; - - while (!is.eof() && LLSDSerialize::fromXML(cur, is)) - { - for (LLSD::map_iterator iter = cur.beginMap(); iter != cur.endMap(); ++iter) - { - std::string label = iter->first; - - LLMetricPerformanceTesterBasic* tester = LLMetricPerformanceTesterBasic::getTester(iter->second["Name"].asString()) ; - if(tester) - { - ret[label]["Name"] = iter->second["Name"] ; - - S32 num_of_metrics = tester->getNumberOfMetrics() ; - for(S32 index = 0 ; index < num_of_metrics ; index++) - { - ret[label][ tester->getMetricName(index) ] = iter->second[ tester->getMetricName(index) ] ; - } - } - } - } - - return ret; -} - //static void LLFastTimerView::outputAllMetrics() { @@ -1193,48 +1163,6 @@ void LLFastTimerView::outputAllMetrics() } } -//static -void LLFastTimerView::doAnalysisMetrics(std::string baseline, std::string target, std::string output) -{ - if(!LLMetricPerformanceTesterBasic::hasMetricPerformanceTesters()) - { - return ; - } - - // Open baseline and current target, exit if one is inexistent - std::ifstream base_is(baseline.c_str()); - std::ifstream target_is(target.c_str()); - if (!base_is.is_open() || !target_is.is_open()) - { - llwarns << "'-analyzeperformance' error : baseline or current target file inexistent" << llendl; - base_is.close(); - target_is.close(); - return; - } - - //analyze baseline - LLSD base = analyzeMetricPerformanceLog(base_is); - base_is.close(); - - //analyze current - LLSD current = analyzeMetricPerformanceLog(target_is); - target_is.close(); - - //output comparision - std::ofstream os(output.c_str()); - - os << "Label, Metric, Base(B), Target(T), Diff(T-B), Percentage(100*T/B)\n"; - for(LLMetricPerformanceTesterBasic::name_tester_map_t::iterator iter = LLMetricPerformanceTesterBasic::sTesterMap.begin() ; - iter != LLMetricPerformanceTesterBasic::sTesterMap.end() ; ++iter) - { - LLMetricPerformanceTesterBasic* tester = ((LLMetricPerformanceTesterBasic*)iter->second) ; - tester->analyzePerformance(&os, &base, ¤t) ; - } - - os.flush(); - os.close(); -} - //static void LLFastTimerView::doAnalysis(std::string baseline, std::string target, std::string output) { @@ -1246,7 +1174,7 @@ void LLFastTimerView::doAnalysis(std::string baseline, std::string target, std:: if(LLFastTimer::sMetricLog) { - doAnalysisMetrics(baseline, target, output) ; + LLMetricPerformanceTesterBasic::doAnalysisMetrics(baseline, target, output) ; return ; } } diff --git a/indra/newview/llfasttimerview.h b/indra/newview/llfasttimerview.h index 1a54a53f09..b40d7ffc1a 100644 --- a/indra/newview/llfasttimerview.h +++ b/indra/newview/llfasttimerview.h @@ -42,8 +42,6 @@ public: private: static void doAnalysisDefault(std::string baseline, std::string target, std::string output) ; - static void doAnalysisMetrics(std::string baseline, std::string target, std::string output) ; - static LLSD analyzeMetricPerformanceLog(std::istream& is) ; static LLSD analyzePerformanceLogDefault(std::istream& is) ; public: -- cgit v1.2.3 From 7f42c02cad9dbd068bc49bed4b6cd18fd8fff606 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Wed, 9 Mar 2011 20:54:59 -0800 Subject: STORM-987 : Add the --image-stats argument, make argument passing more consistent, fix typos in comments in llimage header --- .../llimage_libtest/llimage_libtest.cpp | 66 ++++++++++++++++------ indra/llimage/llimage.h | 4 +- 2 files changed, 51 insertions(+), 19 deletions(-) (limited to 'indra') diff --git a/indra/integration_tests/llimage_libtest/llimage_libtest.cpp b/indra/integration_tests/llimage_libtest/llimage_libtest.cpp index 2442313ef2..e4376dd745 100644 --- a/indra/integration_tests/llimage_libtest/llimage_libtest.cpp +++ b/indra/integration_tests/llimage_libtest/llimage_libtest.cpp @@ -46,12 +46,19 @@ static const char USAGE[] = "\n" "usage:\tllimage_libtest [options]\n" "\n" -" --help print this help\n" -" --in list of image files to load and convert, patterns can be used\n" -" --out OR list of image files to create (assumes same order as --in files)\n" -" OR 3 letters file type extension to convert each input file into\n" -" --logmetrics log performance metric and data for \n" -" --analyzeperformance create report comparing baseline with current for provided in --logmetrics\n" +" -h, --help\n" +" Print this help\n" +" -i, --input \n" +" List of image files to load and convert, patterns can be used\n" +" -o, --output OR \n" +" List of image files to create (assumes same order as for input files)\n" +" OR 3 letters file type extension to convert each input file into\n" +" -log, --logmetrics \n" +" Log performance metric and data for \n" +" -r, --analyzeperformance\n" +" Create report comparing baseline with current for provided in --logmetrics\n" +" -s, --image-stats\n" +" Output stats for each input and output image\n" "\n"; // true when all image loading is done. Used by metric logging thread to know when to stop the thread. @@ -88,8 +95,20 @@ LLPointer create_image(const std::string &filename) return image; } +void output_image_stats(LLPointer image, const std::string &filename) +{ + // Print out some statistical data on the image + std::cout << "Image stats for : " << filename << ", extension : " << image->getExtension() << std::endl; + + std::cout << " with : " << (int)(image->getWidth()) << ", height : " << (int)(image->getHeight()) << std::endl; + std::cout << " comp : " << (int)(image->getComponents()) << ", levels : " << (int)(image->getDiscardLevel()) << std::endl; + std::cout << " head : " << (int)(image->calcHeaderSize()) << ", data : " << (int)(image->getDataSize()) << std::endl; + + return; +} + // Load an image from file and return a raw (decompressed) instance of its data -LLPointer load_image(const std::string &src_filename) +LLPointer load_image(const std::string &src_filename, bool output_stats) { LLPointer image = create_image(src_filename); @@ -104,6 +123,11 @@ LLPointer load_image(const std::string &src_filename) return NULL; } + if (output_stats) + { + output_image_stats(image, src_filename); + } + LLPointer raw_image = new LLImageRaw; if (!image->decode(raw_image, 0.0f)) { @@ -114,7 +138,7 @@ LLPointer load_image(const std::string &src_filename) } // Save a raw image instance into a file -bool save_image(const std::string &dest_filename, LLPointer raw_image) +bool save_image(const std::string &dest_filename, LLPointer raw_image, bool output_stats) { LLPointer image = create_image(dest_filename); @@ -123,6 +147,11 @@ bool save_image(const std::string &dest_filename, LLPointer raw_imag return false; } + if (output_stats) + { + output_image_stats(image, dest_filename); + } + return image->save(dest_filename); } @@ -240,6 +269,7 @@ int main(int argc, char** argv) std::list input_filenames; std::list output_filenames; bool analyze_performance = false; + bool image_stats = false; // Init whatever is necessary ll_init_apr(); @@ -249,13 +279,13 @@ int main(int argc, char** argv) // Analyze command line arguments for (int arg = 1; arg < argc; ++arg) { - if (!strcmp(argv[arg], "--help")) + if (!strcmp(argv[arg], "--help") || !strcmp(argv[arg], "-h")) { // Send the usage to standard out std::cout << USAGE << std::endl; return 0; } - else if (!strcmp(argv[arg], "--in") && arg < argc-1) + else if ((!strcmp(argv[arg], "--input") || !strcmp(argv[arg], "-i")) && arg < argc-1) { std::string file_name = argv[arg+1]; while (file_name[0] != '-') // if arg starts with '-', we consider it's not a file name but some other argument @@ -268,7 +298,7 @@ int main(int argc, char** argv) file_name = argv[arg+1]; // Next argument and loop over } } - else if (!strcmp(argv[arg], "--out") && arg < argc-1) + else if ((!strcmp(argv[arg], "--output") || !strcmp(argv[arg], "-o")) && arg < argc-1) { std::string file_name = argv[arg+1]; while (file_name[0] != '-') // if arg starts with '-', we consider it's not a file name but some other argument @@ -281,7 +311,7 @@ int main(int argc, char** argv) file_name = argv[arg+1]; // Next argument and loop over } } - else if (!strcmp(argv[arg], "--logmetrics")) + else if (!strcmp(argv[arg], "--logmetrics") || !strcmp(argv[arg], "-log")) { // '--logmetrics' needs to be specified with a named test metric argument // Note: for the moment, only ImageCompressionTester has been tested @@ -304,10 +334,14 @@ int main(int argc, char** argv) break; } } - else if (!strcmp(argv[arg], "--analyzeperformance")) + else if (!strcmp(argv[arg], "--analyzeperformance") || !strcmp(argv[arg], "-r")) { analyze_performance = true; } + else if (!strcmp(argv[arg], "--image-stats") || !strcmp(argv[arg], "-s")) + { + image_stats = true; + } } // Analyze the list of (input,output) files @@ -333,7 +367,7 @@ int main(int argc, char** argv) for (; in_file != in_end; ++in_file) { // Load file - LLPointer raw_image = load_image(*in_file); + LLPointer raw_image = load_image(*in_file, image_stats); if (!raw_image) { std::cout << "Error: Image " << *in_file << " could not be loaded" << std::endl; @@ -343,7 +377,7 @@ int main(int argc, char** argv) // Save file if (out_file != out_end) { - if (!save_image(*out_file, raw_image)) + if (!save_image(*out_file, raw_image, image_stats)) { std::cout << "Error: Image " << *out_file << " could not be saved" << std::endl; } @@ -353,8 +387,6 @@ int main(int argc, char** argv) } ++out_file; } - - // Output stats on each file } sAllDone = true; diff --git a/indra/llimage/llimage.h b/indra/llimage/llimage.h index 825b9aab1a..18444f3934 100644 --- a/indra/llimage/llimage.h +++ b/indra/llimage/llimage.h @@ -266,13 +266,13 @@ public: // subclasses must return a prefered file extension (lowercase without a leading dot) virtual std::string getExtension() = 0; // calcHeaderSize() returns the maximum size of header; - // 0 indicates we don't know have a header and have to lead the entire file + // 0 indicates we don't have a header and have to read the entire file virtual S32 calcHeaderSize() { return 0; }; // calcDataSize() returns how many bytes to read to load discard_level (including header) virtual S32 calcDataSize(S32 discard_level); // calcDiscardLevelBytes() returns the smallest valid discard level based on the number of input bytes virtual S32 calcDiscardLevelBytes(S32 bytes); - // getRawDiscardLevel()by default returns mDiscardLevel, but may be overridden (LLImageJ2C) + // getRawDiscardLevel() by default returns mDiscardLevel, but may be overridden (LLImageJ2C) virtual S8 getRawDiscardLevel() { return mDiscardLevel; } BOOL load(const std::string& filename); -- cgit v1.2.3 From c2e88db89a8ba111efd0c1b61cc8dec400a007cb Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Thu, 10 Mar 2011 22:02:49 -0800 Subject: STORM-987 : Took Vadim's comment into account: check arguments consistency, make sure remaining perf data are flushed on exit. --- .../llimage_libtest/llimage_libtest.cpp | 31 ++++++++++++++++------ indra/llcommon/llmetricperformancetester.cpp | 13 ++++++++- indra/llcommon/llmetricperformancetester.h | 6 +++++ indra/llimage/llimagej2c.cpp | 1 + 4 files changed, 42 insertions(+), 9 deletions(-) (limited to 'indra') diff --git a/indra/integration_tests/llimage_libtest/llimage_libtest.cpp b/indra/integration_tests/llimage_libtest/llimage_libtest.cpp index e4376dd745..2a1a2ae843 100644 --- a/indra/integration_tests/llimage_libtest/llimage_libtest.cpp +++ b/indra/integration_tests/llimage_libtest/llimage_libtest.cpp @@ -49,16 +49,18 @@ static const char USAGE[] = "\n" " -h, --help\n" " Print this help\n" " -i, --input \n" -" List of image files to load and convert, patterns can be used\n" +" List of image files to load and convert. Patterns with wild cards can be used.\n" " -o, --output OR \n" " List of image files to create (assumes same order as for input files)\n" -" OR 3 letters file type extension to convert each input file into\n" +" OR 3 letters file type extension to convert each input file into.\n" " -log, --logmetrics \n" -" Log performance metric and data for \n" +" Log performance data for . Results in .slp\n" +" Note: so far, only ImageCompressionTester has been tested.\n" " -r, --analyzeperformance\n" -" Create report comparing baseline with current for provided in --logmetrics\n" +" Create a report comparing _baseline.slp with current .slp\n" +" Results in _report.csv" " -s, --image-stats\n" -" Output stats for each input and output image\n" +" Output stats for each input and output image.\n" "\n"; // true when all image loading is done. Used by metric logging thread to know when to stop the thread. @@ -259,6 +261,8 @@ public: os.flush(); ms_sleep(32); } + LLFastTimer::writeLog(os); + os.flush(); os.close(); } }; @@ -344,12 +348,18 @@ int main(int argc, char** argv) } } - // Analyze the list of (input,output) files + // Check arguments consistency. Exit with proper message if inconsistent. if (input_filenames.size() == 0) { std::cout << "No input file, nothing to do -> exit" << std::endl; return 0; } + if (analyze_performance && !LLFastTimer::sMetricLog) + { + std::cout << "Cannot create perf report if no perf gathered (i.e. use argument -log with -r) -> exit" << std::endl; + return 0; + } + // Create the logging thread if required if (LLFastTimer::sMetricLog) @@ -388,8 +398,13 @@ int main(int argc, char** argv) ++out_file; } } - - sAllDone = true; + + // Stop the perf gathering system if needed + if (LLFastTimer::sMetricLog) + { + LLMetricPerformanceTesterBasic::deleteTester(LLFastTimer::sLogName); + sAllDone = true; + } // Output perf data if requested by user if (analyze_performance) diff --git a/indra/llcommon/llmetricperformancetester.cpp b/indra/llcommon/llmetricperformancetester.cpp index 1f1c633909..41d3eb0bf3 100644 --- a/indra/llcommon/llmetricperformancetester.cpp +++ b/indra/llcommon/llmetricperformancetester.cpp @@ -63,7 +63,18 @@ BOOL LLMetricPerformanceTesterBasic::addTester(LLMetricPerformanceTesterBasic* t sTesterMap.insert(std::make_pair(name, tester)); return TRUE; } - + +/*static*/ +void LLMetricPerformanceTesterBasic::deleteTester(std::string name) +{ + name_tester_map_t::iterator tester = sTesterMap.find(name); + if (tester != sTesterMap.end()) + { + delete tester->second; + sTesterMap.erase(tester); + } +} + /*static*/ LLMetricPerformanceTesterBasic* LLMetricPerformanceTesterBasic::getTester(std::string name) { diff --git a/indra/llcommon/llmetricperformancetester.h b/indra/llcommon/llmetricperformancetester.h index b790b636a7..1a18cdf36f 100644 --- a/indra/llcommon/llmetricperformancetester.h +++ b/indra/llcommon/llmetricperformancetester.h @@ -137,6 +137,12 @@ public: */ static LLMetricPerformanceTesterBasic* getTester(std::string name) ; + /** + * @return Delete the named tester from the list + * @param[in] name - Name of the tester instance to delete. + */ + static void deleteTester(std::string name); + /** * @return Returns TRUE if that metric *or* the default catch all metric has been requested to be logged * @param[in] name - Name of the tester queried. diff --git a/indra/llimage/llimagej2c.cpp b/indra/llimage/llimagej2c.cpp index cb2a85fa91..80fec7f8a0 100644 --- a/indra/llimage/llimagej2c.cpp +++ b/indra/llimage/llimagej2c.cpp @@ -474,6 +474,7 @@ LLImageCompressionTester::LLImageCompressionTester() : LLMetricPerformanceTester LLImageCompressionTester::~LLImageCompressionTester() { + outputTestResults(); LLImageJ2C::sTesterp = NULL; } -- cgit v1.2.3 From 2de6061d55e1802cc2a9aa8b00d6b0d08771c9a9 Mon Sep 17 00:00:00 2001 From: Paul ProductEngine Date: Tue, 22 Mar 2011 19:42:58 +0200 Subject: STORM-1030 FIXED Main menu change: 'Me->Change Outfit' to 'Me->My Appearance' Changed label in: - Main menu - Self avatar menu - Self avatar attachment menu --- indra/newview/skins/default/xui/en/menu_attachment_self.xml | 2 +- indra/newview/skins/default/xui/en/menu_avatar_self.xml | 2 +- indra/newview/skins/default/xui/en/menu_viewer.xml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'indra') diff --git a/indra/newview/skins/default/xui/en/menu_attachment_self.xml b/indra/newview/skins/default/xui/en/menu_attachment_self.xml index 84e81397be..b8128da358 100644 --- a/indra/newview/skins/default/xui/en/menu_attachment_self.xml +++ b/indra/newview/skins/default/xui/en/menu_attachment_self.xml @@ -68,7 +68,7 @@ name="Stand Up"> function="Self.EnableStandUp" /> diff --git a/indra/newview/skins/default/xui/en/menu_avatar_self.xml b/indra/newview/skins/default/xui/en/menu_avatar_self.xml index 2afa29ec10..d727294cc8 100644 --- a/indra/newview/skins/default/xui/en/menu_avatar_self.xml +++ b/indra/newview/skins/default/xui/en/menu_avatar_self.xml @@ -193,7 +193,7 @@ -- cgit v1.2.3 From df450ff17b7a6bb27049f6f462e75fe0763644c3 Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Wed, 23 Mar 2011 22:58:49 +0200 Subject: STORM-1021 ADDITIONAL_FIX Replaced usual object inspector with the remote one in nearby chat toasts. --- indra/newview/llchathistory.cpp | 16 +----------- indra/newview/llchatitemscontainerctrl.cpp | 13 +-------- indra/newview/llnearbychathandler.cpp | 5 ++++ indra/newview/llviewerchat.cpp | 42 ++++++++++++++++++++++++++++++ indra/newview/llviewerchat.h | 4 +++ 5 files changed, 53 insertions(+), 27 deletions(-) (limited to 'indra') diff --git a/indra/newview/llchathistory.cpp b/indra/newview/llchathistory.cpp index d4ec377e03..c0c9ea1451 100644 --- a/indra/newview/llchathistory.cpp +++ b/indra/newview/llchathistory.cpp @@ -793,21 +793,7 @@ void LLChatHistory::appendMessage(const LLChat& chat, const LLSD &args, const LL if ( chat.mSourceType == CHAT_SOURCE_OBJECT && chat.mFromID.notNull()) { // for object IMs, create a secondlife:///app/objectim SLapp - std::string url = LLSLURL("objectim", chat.mFromID, "").getSLURLString(); - url += "?name=" + chat.mFromName; - url += "&owner=" + chat.mOwnerID.asString(); - - std::string slurl = args["slurl"].asString(); - if (slurl.empty()) - { - LLViewerRegion *region = LLWorld::getInstance()->getRegionFromPosAgent(chat.mPosAgent); - if(region) - { - LLSLURL region_slurl(region->getName(), chat.mPosAgent); - slurl = region_slurl.getLocationString(); - } - } - url += "&slurl=" + LLURI::escape(slurl); + std::string url = LLViewerChat::getSenderSLURL(chat, args); // set the link for the object name to be the objectim SLapp // (don't let object names with hyperlinks override our objectim Url) diff --git a/indra/newview/llchatitemscontainerctrl.cpp b/indra/newview/llchatitemscontainerctrl.cpp index 899e0431e7..8584885bc9 100644 --- a/indra/newview/llchatitemscontainerctrl.cpp +++ b/indra/newview/llchatitemscontainerctrl.cpp @@ -213,17 +213,6 @@ void LLNearbyChatToastPanel::init(LLSD& notification) { LLStyle::Params style_params_name; - std::string href; - - if (mSourceType == CHAT_SOURCE_AGENT) - { - href = LLSLURL("agent", mFromID, "about").getSLURLString(); - } - else - { - href = LLSLURL("object", mFromID, "inspect").getSLURLString(); - } - LLColor4 user_name_color = LLUIColorTable::instance().getColor("HTMLLinkColor"); style_params_name.color(user_name_color); @@ -232,7 +221,7 @@ void LLNearbyChatToastPanel::init(LLSD& notification) style_params_name.font.name(font_name); style_params_name.font.size(font_style_size); - style_params_name.link_href = href; + style_params_name.link_href = notification["sender_slurl"].asString(); style_params_name.is_link = true; msg_text->appendText(str_sender, FALSE, style_params_name); diff --git a/indra/newview/llnearbychathandler.cpp b/indra/newview/llnearbychathandler.cpp index de5439e4e0..0d9daeb44e 100644 --- a/indra/newview/llnearbychathandler.cpp +++ b/indra/newview/llnearbychathandler.cpp @@ -558,6 +558,7 @@ void LLNearbyChatHandler::processChat(const LLChat& chat_msg, const LLSD &args) } */ + // Add a nearby chat toast. LLUUID id; id.generate(); @@ -583,6 +584,10 @@ void LLNearbyChatHandler::processChat(const LLChat& chat_msg, const LLSD &args) notification["text_color"] = r_color_name; notification["color_alpha"] = r_color_alpha; notification["font_size"] = (S32)LLViewerChat::getChatFontSize() ; + + // Pass sender info so that it can be rendered properly (STORM-1021). + notification["sender_slurl"] = LLViewerChat::getSenderSLURL(chat_msg, args); + channel->addNotification(notification); } diff --git a/indra/newview/llviewerchat.cpp b/indra/newview/llviewerchat.cpp index 0af850a46b..286b16bab2 100644 --- a/indra/newview/llviewerchat.cpp +++ b/indra/newview/llviewerchat.cpp @@ -31,6 +31,8 @@ #include "llagent.h" // gAgent #include "lluicolortable.h" #include "llviewercontrol.h" // gSavedSettings +#include "llviewerregion.h" +#include "llworld.h" #include "llinstantmessage.h" //SYSTEM_FROM // LLViewerChat @@ -214,3 +216,43 @@ void LLViewerChat::formatChatMsg(const LLChat& chat, std::string& formated_msg) } +//static +std::string LLViewerChat::getSenderSLURL(const LLChat& chat, const LLSD& args) +{ + switch (chat.mSourceType) + { + case CHAT_SOURCE_AGENT: + return LLSLURL("agent", chat.mFromID, "about").getSLURLString(); + + case CHAT_SOURCE_OBJECT: + return getObjectImSLURL(chat, args); + + default: + llwarns << "Getting SLURL for an unsupported sender type: " << chat.mSourceType << llendl; + } + + return LLStringUtil::null; +} + +//static +std::string LLViewerChat::getObjectImSLURL(const LLChat& chat, const LLSD& args) +{ + std::string url = LLSLURL("objectim", chat.mFromID, "").getSLURLString(); + url += "?name=" + chat.mFromName; + url += "&owner=" + chat.mOwnerID.asString(); + + std::string slurl = args["slurl"].asString(); + if (slurl.empty()) + { + LLViewerRegion *region = LLWorld::getInstance()->getRegionFromPosAgent(chat.mPosAgent); + if(region) + { + LLSLURL region_slurl(region->getName(), chat.mPosAgent); + slurl = region_slurl.getLocationString(); + } + } + + url += "&slurl=" + LLURI::escape(slurl); + + return url; +} diff --git a/indra/newview/llviewerchat.h b/indra/newview/llviewerchat.h index a9f9a98960..0f15d29f04 100644 --- a/indra/newview/llviewerchat.h +++ b/indra/newview/llviewerchat.h @@ -40,6 +40,10 @@ public: static LLFontGL* getChatFont(); static S32 getChatFontSize(); static void formatChatMsg(const LLChat& chat, std::string& formated_msg); + static std::string getSenderSLURL(const LLChat& chat, const LLSD& args); + +private: + static std::string getObjectImSLURL(const LLChat& chat, const LLSD& args); }; -- cgit v1.2.3 From 29bcedaf0256968ec48ed3c5791da4b4a23e42d1 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Fri, 25 Mar 2011 17:18:28 -0700 Subject: STORM-987 : Fix the creation of images in local dir --- indra/integration_tests/llimage_libtest/llimage_libtest.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'indra') diff --git a/indra/integration_tests/llimage_libtest/llimage_libtest.cpp b/indra/integration_tests/llimage_libtest/llimage_libtest.cpp index 2a1a2ae843..365f5f758c 100644 --- a/indra/integration_tests/llimage_libtest/llimage_libtest.cpp +++ b/indra/integration_tests/llimage_libtest/llimage_libtest.cpp @@ -223,7 +223,15 @@ void store_output_file(std::list &output_filenames, std::listgetDirName(*in_file); name = gDirUtilp->getBaseFileName(*in_file,true); - std::string file_name = dir + delim + name + "." + exten; + std::string file_name; + if (!dir.empty()) + { + file_name = dir + delim + name + "." + exten; + } + else + { + file_name = name + "." + exten; + } output_filenames.push_back(file_name); } } -- cgit v1.2.3 From 68a7f7c24168f03d72e6b20ff1dcfbd843879b5d Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Mon, 28 Mar 2011 08:56:07 -0400 Subject: increment viewer version to 2.6.3 --- indra/llcommon/llversionviewer.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra') diff --git a/indra/llcommon/llversionviewer.h b/indra/llcommon/llversionviewer.h index d22c879243..488ec5b239 100644 --- a/indra/llcommon/llversionviewer.h +++ b/indra/llcommon/llversionviewer.h @@ -29,7 +29,7 @@ const S32 LL_VERSION_MAJOR = 2; const S32 LL_VERSION_MINOR = 6; -const S32 LL_VERSION_PATCH = 2; +const S32 LL_VERSION_PATCH = 3; const S32 LL_VERSION_BUILD = 0; const char * const LL_CHANNEL = "Second Life Developer"; -- cgit v1.2.3