diff options
Diffstat (limited to 'indra/newview/llvovolume.cpp')
-rw-r--r-- | indra/newview/llvovolume.cpp | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index e7dbf0bfb8..a440ae2957 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -762,16 +762,30 @@ void LLVOVolume::sculpt() return; LLPointer<LLImageRaw> raw_image = new LLImageRaw(); - mSculptTexture->readBackRaw(discard_level, raw_image, FALSE); + BOOL is_valid = mSculptTexture->readBackRaw(discard_level, raw_image, FALSE); sculpt_height = raw_image->getHeight(); sculpt_width = raw_image->getWidth(); + sculpt_components = raw_image->getComponents(); - sculpt_components = raw_image->getComponents(); - sculpt_data = raw_image->getData(); - - llassert_always(raw_image->getDataSize() >= sculpt_height * sculpt_width * sculpt_components); - + if(is_valid) + { + is_valid = mSculptTexture->isValidForSculpt(discard_level, sculpt_width, sculpt_height, sculpt_components) ; + } + if(!is_valid) + { + sculpt_width = 0; + sculpt_height = 0; + sculpt_data = NULL ; + } + else + { + if (raw_image->getDataSize() < sculpt_height * sculpt_width * sculpt_components) + llerrs << "Sculpt: image data size = " << raw_image->getDataSize() + << " < " << sculpt_height << " x " << sculpt_width << " x " <<sculpt_components << llendl; + + sculpt_data = raw_image->getData(); + } getVolume()->sculpt(sculpt_width, sculpt_height, sculpt_components, sculpt_data, discard_level); } } |