diff options
Diffstat (limited to 'indra/llimage')
23 files changed, 60 insertions, 8 deletions
diff --git a/indra/llimage/CMakeLists.txt b/indra/llimage/CMakeLists.txt index ea8c1a1107..e837b0cac2 100644..100755 --- a/indra/llimage/CMakeLists.txt +++ b/indra/llimage/CMakeLists.txt @@ -7,12 +7,15 @@ include(LLCommon) include(LLImage) include(LLMath) include(LLVFS) +include(LLKDU) +include(LLImageJ2COJ) include(ZLIB) include(LLAddBuildTest) include(Tut) include_directories( ${LLCOMMON_INCLUDE_DIRS} + ${LLCOMMON_SYSTEM_INCLUDE_DIRS} ${LLMATH_INCLUDE_DIRS} ${LLVFS_INCLUDE_DIRS} ${PNG_INCLUDE_DIRS} @@ -56,8 +59,16 @@ list(APPEND llimage_SOURCE_FILES ${llimage_HEADER_FILES}) add_library (llimage ${llimage_SOURCE_FILES}) # Libraries on which this library depends, needed for Linux builds # Sort by high-level to low-level +if (USE_KDU) + target_link_libraries(llimage ${LLKDU_LIBRARIES}) +else (USE_KDU) + target_link_libraries(llimage ${LLIMAGEJ2COJ_LIBRARIES}) +endif (USE_KDU) + target_link_libraries(llimage - llcommon + ${LLVFS_LIBRARIES} + ${LLMATH_LIBRARIES} + ${LLCOMMON_LIBRARIES} ${JPEG_LIBRARIES} ${PNG_LIBRARIES} ${ZLIB_LIBRARIES} diff --git a/indra/llimage/llimage.cpp b/indra/llimage/llimage.cpp index a88ac148ef..c8a05e1fae 100644..100755 --- a/indra/llimage/llimage.cpp +++ b/indra/llimage/llimage.cpp @@ -640,6 +640,29 @@ void LLImageRaw::compositeUnscaled4onto3( LLImageRaw* src ) } } +void LLImageRaw::copyUnscaledAlphaMask( LLImageRaw* src, const LLColor4U& fill) +{ + LLImageRaw* dst = this; // Just for clarity. + + llassert( 1 == src->getComponents() ); + llassert( 4 == dst->getComponents() ); + llassert( (src->getWidth() == dst->getWidth()) && (src->getHeight() == dst->getHeight()) ); + + S32 pixels = getWidth() * getHeight(); + U8* src_data = src->getData(); + U8* dst_data = dst->getData(); + for ( S32 i = 0; i < pixels; i++ ) + { + dst_data[0] = fill.mV[0]; + dst_data[1] = fill.mV[1]; + dst_data[2] = fill.mV[2]; + dst_data[3] = src_data[0]; + src_data += 1; + dst_data += 4; + } +} + + // Fill the buffer with a constant color void LLImageRaw::fill( const LLColor4U& color ) { @@ -666,8 +689,17 @@ void LLImageRaw::fill( const LLColor4U& color ) } } +LLPointer<LLImageRaw> LLImageRaw::duplicate() +{ + if(getNumRefs() < 2) + { + return this; //nobody else refences to this image, no need to duplicate. + } - + //make a duplicate + LLPointer<LLImageRaw> dup = new LLImageRaw(getData(), getWidth(), getHeight(), getComponents()); + return dup; +} // Src and dst can be any size. Src and dst can each have 3 or 4 components. void LLImageRaw::copy(LLImageRaw* src) diff --git a/indra/llimage/llimage.h b/indra/llimage/llimage.h index 6cb1226da0..2277afc585 100644..100755 --- a/indra/llimage/llimage.h +++ b/indra/llimage/llimage.h @@ -30,6 +30,7 @@ #include "lluuid.h" #include "llstring.h" #include "llthread.h" +#include "llpointer.h" const S32 MIN_IMAGE_MIP = 2; // 4x4, only used for expand/contract power of 2 const S32 MAX_IMAGE_MIP = 11; // 2048x2048 @@ -214,6 +215,9 @@ public: // Copy operations + //duplicate this raw image if refCount > 1. + LLPointer<LLImageRaw> duplicate(); + // Src and dst can be any size. Src and dst can each have 3 or 4 components. void copy( LLImageRaw* src ); @@ -226,6 +230,11 @@ public: // Src and dst are same size. Src has 3 components. Dst has 4 components. void copyUnscaled3onto4( LLImageRaw* src ); + // Src and dst are same size. Src has 1 component. Dst has 4 components. + // Alpha component is set to source alpha mask component. + // RGB components are set to fill color. + void copyUnscaledAlphaMask( LLImageRaw* src, const LLColor4U& fill); + // Src and dst can be any size. Src and dst have same number of components. void copyScaled( LLImageRaw* src ); diff --git a/indra/llimage/llimagebmp.cpp b/indra/llimage/llimagebmp.cpp index 60b1c628d7..60b1c628d7 100644..100755 --- a/indra/llimage/llimagebmp.cpp +++ b/indra/llimage/llimagebmp.cpp diff --git a/indra/llimage/llimagebmp.h b/indra/llimage/llimagebmp.h index db0b45def0..db0b45def0 100644..100755 --- a/indra/llimage/llimagebmp.h +++ b/indra/llimage/llimagebmp.h diff --git a/indra/llimage/llimagedimensionsinfo.cpp b/indra/llimage/llimagedimensionsinfo.cpp index c6bfa50b40..c6bfa50b40 100644..100755 --- a/indra/llimage/llimagedimensionsinfo.cpp +++ b/indra/llimage/llimagedimensionsinfo.cpp diff --git a/indra/llimage/llimagedimensionsinfo.h b/indra/llimage/llimagedimensionsinfo.h index 382fdb2a0e..382fdb2a0e 100644..100755 --- a/indra/llimage/llimagedimensionsinfo.h +++ b/indra/llimage/llimagedimensionsinfo.h diff --git a/indra/llimage/llimagedxt.cpp b/indra/llimage/llimagedxt.cpp index 34c6793522..34c6793522 100644..100755 --- a/indra/llimage/llimagedxt.cpp +++ b/indra/llimage/llimagedxt.cpp diff --git a/indra/llimage/llimagedxt.h b/indra/llimage/llimagedxt.h index a8756ba8ed..a8756ba8ed 100644..100755 --- a/indra/llimage/llimagedxt.h +++ b/indra/llimage/llimagedxt.h diff --git a/indra/llimage/llimagej2c.cpp b/indra/llimage/llimagej2c.cpp index 5412f98ee5..5412f98ee5 100644..100755 --- a/indra/llimage/llimagej2c.cpp +++ b/indra/llimage/llimagej2c.cpp diff --git a/indra/llimage/llimagej2c.h b/indra/llimage/llimagej2c.h index ce8195940d..ce8195940d 100644..100755 --- a/indra/llimage/llimagej2c.h +++ b/indra/llimage/llimagej2c.h diff --git a/indra/llimage/llimagejpeg.cpp b/indra/llimage/llimagejpeg.cpp index b70f84efc8..b70f84efc8 100644..100755 --- a/indra/llimage/llimagejpeg.cpp +++ b/indra/llimage/llimagejpeg.cpp diff --git a/indra/llimage/llimagejpeg.h b/indra/llimage/llimagejpeg.h index 7ac7f5d2e0..7ac7f5d2e0 100644..100755 --- a/indra/llimage/llimagejpeg.h +++ b/indra/llimage/llimagejpeg.h diff --git a/indra/llimage/llimagepng.cpp b/indra/llimage/llimagepng.cpp index 294f68b122..294f68b122 100644..100755 --- a/indra/llimage/llimagepng.cpp +++ b/indra/llimage/llimagepng.cpp diff --git a/indra/llimage/llimagepng.h b/indra/llimage/llimagepng.h index 1fbd850a2e..1fbd850a2e 100644..100755 --- a/indra/llimage/llimagepng.h +++ b/indra/llimage/llimagepng.h diff --git a/indra/llimage/llimagetga.cpp b/indra/llimage/llimagetga.cpp index 58426d31fa..920ae2891f 100644..100755 --- a/indra/llimage/llimagetga.cpp +++ b/indra/llimage/llimagetga.cpp @@ -132,12 +132,12 @@ BOOL LLImageTGA::updateData() ** FIELD 2 : COLOR MAP TYPE (1 BYTES) ** FIELD 3 : IMAGE TYPE CODE (1 BYTES) ** = 0 NO IMAGE DATA INCLUDED - ** = 1 UNCOMPRESSED, COLOR-MAPPED IMAGE - ** = 2 UNCOMPRESSED, TRUE-COLOR IMAGE - ** = 3 UNCOMPRESSED, BLACK AND WHITE IMAGE - ** = 9 RUN-LENGTH ENCODED COLOR-MAPPED IMAGE - ** = 10 RUN-LENGTH ENCODED TRUE-COLOR IMAGE - ** = 11 RUN-LENGTH ENCODED BLACK AND WHITE IMAGE + ** = (0001) 1 UNCOMPRESSED, COLOR-MAPPED IMAGE + ** = (0010) 2 UNCOMPRESSED, TRUE-COLOR IMAGE + ** = (0011) 3 UNCOMPRESSED, BLACK AND WHITE IMAGE + ** = (1001) 9 RUN-LENGTH ENCODED COLOR-MAPPED IMAGE + ** = (1010) 10 RUN-LENGTH ENCODED TRUE-COLOR IMAGE + ** = (1011) 11 RUN-LENGTH ENCODED BLACK AND WHITE IMAGE ** FIELD 4 : COLOR MAP SPECIFICATION (5 BYTES) ** 4.1 : COLOR MAP ORIGIN (2 BYTES) ** 4.2 : COLOR MAP LENGTH (2 BYTES) diff --git a/indra/llimage/llimagetga.h b/indra/llimage/llimagetga.h index 5da3525149..5da3525149 100644..100755 --- a/indra/llimage/llimagetga.h +++ b/indra/llimage/llimagetga.h diff --git a/indra/llimage/llimageworker.cpp b/indra/llimage/llimageworker.cpp index ad2eb0f69c..ad2eb0f69c 100644..100755 --- a/indra/llimage/llimageworker.cpp +++ b/indra/llimage/llimageworker.cpp diff --git a/indra/llimage/llimageworker.h b/indra/llimage/llimageworker.h index 1bfb0ddfd3..1bfb0ddfd3 100644..100755 --- a/indra/llimage/llimageworker.h +++ b/indra/llimage/llimageworker.h diff --git a/indra/llimage/llmapimagetype.h b/indra/llimage/llmapimagetype.h index 0a040d3db9..0a040d3db9 100644..100755 --- a/indra/llimage/llmapimagetype.h +++ b/indra/llimage/llmapimagetype.h diff --git a/indra/llimage/llpngwrapper.cpp b/indra/llimage/llpngwrapper.cpp index 2cc7d3c460..2cc7d3c460 100644..100755 --- a/indra/llimage/llpngwrapper.cpp +++ b/indra/llimage/llpngwrapper.cpp diff --git a/indra/llimage/llpngwrapper.h b/indra/llimage/llpngwrapper.h index 739f435996..739f435996 100644..100755 --- a/indra/llimage/llpngwrapper.h +++ b/indra/llimage/llpngwrapper.h diff --git a/indra/llimage/tests/llimageworker_test.cpp b/indra/llimage/tests/llimageworker_test.cpp index e255d65b43..e255d65b43 100644..100755 --- a/indra/llimage/tests/llimageworker_test.cpp +++ b/indra/llimage/tests/llimageworker_test.cpp |