diff options
Diffstat (limited to 'indra/newview/llpreviewtexture.cpp')
-rwxr-xr-x[-rw-r--r--] | indra/newview/llpreviewtexture.cpp | 502 |
1 files changed, 321 insertions, 181 deletions
diff --git a/indra/newview/llpreviewtexture.cpp b/indra/newview/llpreviewtexture.cpp index 9d7338c111..f91a18d8d3 100644..100755 --- a/indra/newview/llpreviewtexture.cpp +++ b/indra/newview/llpreviewtexture.cpp @@ -2,31 +2,25 @@ * @file llpreviewtexture.cpp * @brief LLPreviewTexture class implementation * - * $LicenseInfo:firstyear=2002&license=viewergpl$ - * - * Copyright (c) 2002-2009, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2002&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. + * + * 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. * - * 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 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. * - * 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. + * 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 * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -38,15 +32,19 @@ #include "llagent.h" #include "llbutton.h" +#include "llcombobox.h" #include "llfilepicker.h" #include "llfloaterreg.h" #include "llimagetga.h" +#include "llimagepng.h" #include "llinventory.h" +#include "llnotificationsutil.h" #include "llresmgr.h" #include "lltrans.h" #include "lltextbox.h" #include "lltextureview.h" #include "llui.h" +#include "llviewerinventory.h" #include "llviewertexture.h" #include "llviewertexturelist.h" #include "lluictrlfactory.h" @@ -57,58 +55,41 @@ const S32 CLIENT_RECT_VPAD = 4; const F32 SECONDS_TO_SHOW_FILE_SAVED_MSG = 8.f; +const F32 PREVIEW_TEXTURE_MAX_ASPECT = 200.f; +const F32 PREVIEW_TEXTURE_MIN_ASPECT = 0.005f; + + LLPreviewTexture::LLPreviewTexture(const LLSD& key) - : LLPreview( key ), + : LLPreview(key), mLoadingFullImage( FALSE ), mShowKeepDiscard(FALSE), mCopyToInv(FALSE), mIsCopyable(FALSE), + mIsFullPerm(FALSE), mUpdateDimensions(TRUE), mLastHeight(0), - mLastWidth(0) + mLastWidth(0), + mAspectRatio(0.f), + mPreviewToSave(FALSE), + mImage(NULL), + mImageOldBoostLevel(LLGLTexture::BOOST_NONE) { - const LLInventoryItem *item = getItem(); - if(item) + updateImageID(); + if (key.has("save_as")) { - mShowKeepDiscard = item->getPermissions().getCreator() != gAgent.getID(); - mImageID = item->getAssetUUID(); - const LLPermissions& perm = item->getPermissions(); - U32 mask = PERM_NONE; - if(perm.getOwner() == gAgent.getID()) - { - mask = perm.getMaskBase(); - } - else if(gAgent.isInGroup(perm.getGroup())) - { - mask = perm.getMaskGroup(); - } - else - { - mask = perm.getMaskEveryone(); - } - if((mask & PERM_ITEM_UNRESTRICTED) == PERM_ITEM_UNRESTRICTED) - { - mIsCopyable = TRUE; - } - } - else // not an item, assume it's an asset id - { - mImageID = mItemUUID; - mCopyToInv = TRUE; - mIsCopyable = TRUE; + mPreviewToSave = TRUE; } - - //Called from floater reg: LLUICtrlFactory::getInstance()->buildFloater(this, "floater_preview_texture.xml", FALSE); } - LLPreviewTexture::~LLPreviewTexture() { + LLLoadedCallbackEntry::cleanUpCallbackList(&mCallbackTextureList) ; + if( mLoadingFullImage ) { getWindow()->decBusyCount(); } - + mImage->setBoostLevel(mImageOldBoostLevel); mImage = NULL; } @@ -119,7 +100,7 @@ BOOL LLPreviewTexture::postBuild() { getChild<LLButton>("Keep")->setLabel(getString("Copy")); childSetAction("Keep",LLPreview::onBtnCopyToInv,this); - childSetVisible("Discard", false); + getChildView("Discard")->setVisible( false); } else if (mShowKeepDiscard) { @@ -128,10 +109,14 @@ BOOL LLPreviewTexture::postBuild() } else { - childSetVisible("Keep", false); - childSetVisible("Discard", false); + getChildView("Keep")->setVisible( false); + getChildView("Discard")->setVisible( false); } + childSetAction("save_tex_btn", LLPreviewTexture::onSaveAsBtn, this); + getChildView("save_tex_btn")->setVisible( true); + getChildView("save_tex_btn")->setEnabled(canSaveAs()); + if (!mCopyToInv) { const LLInventoryItem* item = getItem(); @@ -139,20 +124,47 @@ BOOL LLPreviewTexture::postBuild() if (item) { childSetCommitCallback("desc", LLPreview::onText, this); - childSetText("desc", item->getDescription()); - childSetPrevalidate("desc", &LLLineEditor::prevalidatePrintableNotPipe); + getChild<LLUICtrl>("desc")->setValue(item->getDescription()); + getChild<LLLineEditor>("desc")->setPrevalidate(&LLTextValidate::validateASCIIPrintableNoPipe); } } + + // Fill in ratios list with common aspect ratio values + mRatiosList.clear(); + mRatiosList.push_back(LLTrans::getString("Unconstrained")); + mRatiosList.push_back("1:1"); + mRatiosList.push_back("4:3"); + mRatiosList.push_back("10:7"); + mRatiosList.push_back("3:2"); + mRatiosList.push_back("16:10"); + mRatiosList.push_back("16:9"); + mRatiosList.push_back("2:1"); + + // Now fill combo box with provided list + LLComboBox* combo = getChild<LLComboBox>("combo_aspect_ratio"); + combo->removeall(); + + for (std::vector<std::string>::const_iterator it = mRatiosList.begin(); it != mRatiosList.end(); ++it) + { + combo->add(*it); + } + + childSetCommitCallback("combo_aspect_ratio", onAspectRatioCommit, this); + combo->setCurrentByIndex(0); return LLPreview::postBuild(); } +// static +void LLPreviewTexture::onSaveAsBtn(void* data) +{ + LLPreviewTexture* self = (LLPreviewTexture*)data; + self->saveAs(); +} + void LLPreviewTexture::draw() { - if (mUpdateDimensions) - { - updateDimensions(); - } + updateDimensions(); LLPreview::draw(); @@ -172,7 +184,7 @@ void LLPreviewTexture::draw() if ( mImage.notNull() ) { // Draw the texture - glColor3f( 1.f, 1.f, 1.f ); + gGL.diffuseColor3f( 1.f, 1.f, 1.f ); gl_draw_scaled_image(interior.mLeft, interior.mBottom, interior.getWidth(), @@ -199,7 +211,7 @@ void LLPreviewTexture::draw() if( mLoadingFullImage ) { - LLFontGL::getFontSansSerif()->renderUTF8(LLTrans::getString("Receiving:"), 0, + LLFontGL::getFontSansSerif()->renderUTF8(LLTrans::getString("Receiving"), 0, interior.mLeft + 4, interior.mBottom + 4, LLColor4::white, LLFontGL::LEFT, LLFontGL::BOTTOM, @@ -245,13 +257,14 @@ void LLPreviewTexture::draw() } } } + } // virtual BOOL LLPreviewTexture::canSaveAs() const { - return mIsCopyable && !mLoadingFullImage && mImage.notNull() && !mImage->isMissingAsset(); + return mIsFullPerm && !mLoadingFullImage && mImage.notNull() && !mImage->isMissingAsset(); } @@ -263,45 +276,91 @@ void LLPreviewTexture::saveAs() LLFilePicker& file_picker = LLFilePicker::instance(); const LLInventoryItem* item = getItem() ; - if( !file_picker.getSaveFile( LLFilePicker::FFSAVE_TGA, item ? LLDir::getScrubbedFileName(item->getName()) : LLStringUtil::null) ) + if( !file_picker.getSaveFile( LLFilePicker::FFSAVE_TGAPNG, item ? LLDir::getScrubbedFileName(item->getName()) : LLStringUtil::null) ) { // User canceled or we failed to acquire save file. return; } + if(mPreviewToSave) + { + mPreviewToSave = FALSE; + LLFloaterReg::showTypedInstance<LLPreviewTexture>("preview_texture", item->getUUID()); + } + // remember the user-approved/edited file name. mSaveFileName = file_picker.getFirstFile(); mLoadingFullImage = TRUE; getWindow()->incBusyCount(); + + mImage->forceToSaveRawImage(0) ;//re-fetch the raw image if the old one is removed. mImage->setLoadedCallback( LLPreviewTexture::onFileLoadedForSave, - 0, TRUE, FALSE, new LLUUID( mItemUUID ) ); + 0, TRUE, FALSE, new LLUUID( mItemUUID ), &mCallbackTextureList ); } // virtual void LLPreviewTexture::reshape(S32 width, S32 height, BOOL called_from_parent) { -// mLastHeight = 0; -// mLastWidth = 0; - mUpdateDimensions = TRUE; LLPreview::reshape(width, height, called_from_parent); + + LLRect dim_rect(getChildView("dimensions")->getRect()); + + S32 horiz_pad = 2 * (LLPANEL_BORDER_WIDTH + PREVIEW_PAD) + PREVIEW_RESIZE_HANDLE_SIZE; + + // add space for dimensions and aspect ratio + S32 info_height = dim_rect.mTop + CLIENT_RECT_VPAD; + + LLRect client_rect(horiz_pad, getRect().getHeight(), getRect().getWidth() - horiz_pad, 0); + client_rect.mTop -= (PREVIEW_HEADER_SIZE + CLIENT_RECT_VPAD); + client_rect.mBottom += PREVIEW_BORDER + CLIENT_RECT_VPAD + info_height ; + + S32 client_width = client_rect.getWidth(); + S32 client_height = client_rect.getHeight(); + + if (mAspectRatio > 0.f) + { + if(mAspectRatio > 1.f) + { + client_height = llceil((F32)client_width / mAspectRatio); + if(client_height > client_rect.getHeight()) + { + client_height = client_rect.getHeight(); + client_width = llceil((F32)client_height * mAspectRatio); + } + } + else//mAspectRatio < 1.f + { + client_width = llceil((F32)client_height * mAspectRatio); + if(client_width > client_rect.getWidth()) + { + client_width = client_rect.getWidth(); + client_height = llceil((F32)client_width / mAspectRatio); + } + } + } + + mClientRect.setLeftTopAndSize(client_rect.getCenterX() - (client_width / 2), client_rect.getCenterY() + (client_height / 2), client_width, client_height); + } // virtual void LLPreviewTexture::onFocusReceived() { - mLastHeight = 0; - mLastWidth = 0; - mUpdateDimensions = TRUE; LLPreview::onFocusReceived(); } +void LLPreviewTexture::openToSave() +{ + mPreviewToSave = TRUE; +} + // static void LLPreviewTexture::onFileLoadedForSave(BOOL success, - LLViewerFetchedTexture *src_vi, - LLImageRaw* src, - LLImageRaw* aux_src, - S32 discard_level, - BOOL final, - void* userdata) + LLViewerFetchedTexture *src_vi, + LLImageRaw* src, + LLImageRaw* aux_src, + S32 discard_level, + BOOL final, + void* userdata) { LLUUID* item_uuid = (LLUUID*) userdata; @@ -320,18 +379,31 @@ void LLPreviewTexture::onFileLoadedForSave(BOOL success, if( self && final && success ) { - LLPointer<LLImageTGA> image_tga = new LLImageTGA; - if( !image_tga->encode( src ) ) + const U32 ext_length = 3; + std::string extension = self->mSaveFileName.substr( self->mSaveFileName.length() - ext_length); + + // We only support saving in PNG or TGA format + LLPointer<LLImageFormatted> image; + if(extension == "png") + { + image = new LLImagePNG; + } + else if(extension == "tga") + { + image = new LLImageTGA; + } + + if( image && !image->encode( src, 0 ) ) { LLSD args; args["FILE"] = self->mSaveFileName; - LLNotifications::instance().add("CannotEncodeFile", args); + LLNotificationsUtil::add("CannotEncodeFile", args); } - else if( !image_tga->save( self->mSaveFileName ) ) + else if( image && !image->save( self->mSaveFileName ) ) { LLSD args; args["FILE"] = self->mSaveFileName; - LLNotifications::instance().add("CannotWriteFile", args); + LLNotificationsUtil::add("CannotWriteFile", args); } else { @@ -344,8 +416,9 @@ void LLPreviewTexture::onFileLoadedForSave(BOOL success, if( self && !success ) { - LLNotifications::instance().add("CannotDownloadFile"); + LLNotificationsUtil::add("CannotDownloadFile"); } + } @@ -354,121 +427,101 @@ void LLPreviewTexture::onFileLoadedForSave(BOOL success, void LLPreviewTexture::updateDimensions() { if (!mImage) - return; - - mUpdateDimensions = FALSE; - - S32 image_height = llmax(1, mImage->getFullHeight()); - S32 image_width = llmax(1, mImage->getFullWidth()); - // Attempt to make the image 1:1 on screen. - // If that fails, cut width by half. - S32 client_width = image_width; - S32 client_height = image_height; - S32 horiz_pad = 2 * (LLPANEL_BORDER_WIDTH + PREVIEW_PAD) + PREVIEW_RESIZE_HANDLE_SIZE; - S32 vert_pad = PREVIEW_HEADER_SIZE + 2 * CLIENT_RECT_VPAD + LLPANEL_BORDER_WIDTH; - S32 max_client_width = gViewerWindow->getWindowWidth() - horiz_pad; - S32 max_client_height = gViewerWindow->getWindowHeight() - vert_pad; - - while ((client_width > max_client_width) || - (client_height > max_client_height ) ) { - client_width /= 2; - client_height /= 2; + return; } - - S32 view_width = client_width + horiz_pad; - S32 view_height = client_height + vert_pad; - - // set text on dimensions display (should be moved out of here and into a callback of some sort) - childSetTextArg("dimensions", "[WIDTH]", llformat("%d", mImage->getFullWidth())); - childSetTextArg("dimensions", "[HEIGHT]", llformat("%d", mImage->getFullHeight())); - - // add space for dimensions - S32 info_height = 0; - LLRect dim_rect; - childGetRect("dimensions", dim_rect); - S32 dim_height = dim_rect.getHeight(); - info_height += dim_height + CLIENT_RECT_VPAD; - view_height += info_height; - - S32 button_height = 0; - if (mShowKeepDiscard || mCopyToInv) { //mCopyToInvBtn - - // add space for buttons - view_height += BTN_HEIGHT + CLIENT_RECT_VPAD; - button_height = BTN_HEIGHT + PREVIEW_PAD; + if ((mImage->getFullWidth() * mImage->getFullHeight()) == 0) + { + return; } - view_width = llmax(view_width, getMinWidth()); - view_height = llmax(view_height, getMinHeight()); - - if (view_height != mLastHeight || view_width != mLastWidth) + if (mAssetStatus != PREVIEW_ASSET_LOADED) { - if (getHost()) - { - getHost()->growToFit(view_width, view_height); - reshape( view_width, view_height ); - setOrigin( 0, getHost()->getRect().getHeight() - (view_height + PREVIEW_HEADER_SIZE) ); - } - else - { - S32 old_top = getRect().mTop; - S32 old_left = getRect().mLeft; - reshape( view_width, view_height ); - S32 new_bottom = old_top - getRect().getHeight(); - setOrigin( old_left, new_bottom ); - } - - // Try to keep whole view onscreen, don't allow partial offscreen. - if (getHost()) - gFloaterView->adjustToFitScreen(getHost(), FALSE); - else - gFloaterView->adjustToFitScreen(this, FALSE); - - if (image_height > 1 && image_width > 1) - { - // Resize until we know the image's height - mLastWidth = view_width; - mLastHeight = view_height; - } + mAssetStatus = PREVIEW_ASSET_LOADED; + // Asset has been fully loaded, adjust aspect ratio + adjustAspectRatio(); } - if (!mUserResized) - { - // clamp texture size to fit within actual size of floater after attempting resize - client_width = llmin(client_width, getRect().getWidth() - horiz_pad); - client_height = llmin(client_height, getRect().getHeight() - PREVIEW_HEADER_SIZE - - (2 * CLIENT_RECT_VPAD) - LLPANEL_BORDER_WIDTH - info_height); + // Update the width/height display every time + getChild<LLUICtrl>("dimensions")->setTextArg("[WIDTH]", llformat("%d", mImage->getFullWidth())); + getChild<LLUICtrl>("dimensions")->setTextArg("[HEIGHT]", llformat("%d", mImage->getFullHeight())); + // Reshape the floater only when required + if (mUpdateDimensions) + { + mUpdateDimensions = FALSE; + //reshape floater + reshape(getRect().getWidth(), getRect().getHeight()); + + gFloaterView->adjustToFitScreen(this, FALSE); + + LLRect dim_rect(getChildView("dimensions")->getRect()); + LLRect aspect_label_rect(getChildView("aspect_ratio")->getRect()); + getChildView("aspect_ratio")->setVisible( dim_rect.mRight < aspect_label_rect.mLeft); } - else +} + + +// Return true if everything went fine, false if we somewhat modified the ratio as we bumped on border values +bool LLPreviewTexture::setAspectRatio(const F32 width, const F32 height) +{ + mUpdateDimensions = TRUE; + + // We don't allow negative width or height. Also, if height is positive but too small, we reset to default + // A default 0.f value for mAspectRatio means "unconstrained" in the rest of the code + if ((width <= 0.f) || (height <= F_APPROXIMATELY_ZERO)) { - client_width = getRect().getWidth() - horiz_pad; - client_height = getRect().getHeight() - vert_pad; + mAspectRatio = 0.f; + return false; } + + // Compute and store the ratio + F32 ratio = width / height; + mAspectRatio = llclamp(ratio, PREVIEW_TEXTURE_MIN_ASPECT, PREVIEW_TEXTURE_MAX_ASPECT); + + // Return false if we clamped the value, true otherwise + return (ratio == mAspectRatio); +} - S32 max_height = getRect().getHeight() - PREVIEW_BORDER - button_height - - CLIENT_RECT_VPAD - info_height - CLIENT_RECT_VPAD - PREVIEW_HEADER_SIZE; - S32 max_width = getRect().getWidth() - horiz_pad; - client_height = llclamp(client_height, 1, max_height); - client_width = llclamp(client_width, 1, max_width); +void LLPreviewTexture::onAspectRatioCommit(LLUICtrl* ctrl, void* userdata) +{ + LLPreviewTexture* self = (LLPreviewTexture*) userdata; - LLRect window_rect(0, getRect().getHeight(), getRect().getWidth(), 0); - window_rect.mTop -= (PREVIEW_HEADER_SIZE + CLIENT_RECT_VPAD); - window_rect.mBottom += PREVIEW_BORDER + button_height + CLIENT_RECT_VPAD + info_height + CLIENT_RECT_VPAD; - - mClientRect.setLeftTopAndSize(window_rect.getCenterX() - (client_width / 2), window_rect.mTop, client_width, client_height); + std::string ratio(ctrl->getValue().asString()); + std::string::size_type separator(ratio.find_first_of(":/\\")); + + if (std::string::npos == separator) { + // If there's no separator assume we want an unconstrained ratio + self->setAspectRatio( 0.f, 0.f ); + return; + } + + F32 width, height; + std::istringstream numerator(ratio.substr(0, separator)); + std::istringstream denominator(ratio.substr(separator + 1)); + numerator >> width; + denominator >> height; + + self->setAspectRatio( width, height ); } - void LLPreviewTexture::loadAsset() { - mImage = LLViewerTextureManager::getFetchedTexture(mImageID, MIPMAP_TRUE, FALSE, LLViewerTexture::LOD_TEXTURE); - mImage->setBoostLevel(LLViewerTexture::BOOST_PREVIEW); + mImage = LLViewerTextureManager::getFetchedTexture(mImageID, FTT_DEFAULT, MIPMAP_TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE); + mImageOldBoostLevel = mImage->getBoostLevel(); + mImage->setBoostLevel(LLGLTexture::BOOST_PREVIEW); + mImage->forceToSaveRawImage(0) ; mAssetStatus = PREVIEW_ASSET_LOADING; + mUpdateDimensions = TRUE; updateDimensions(); + getChildView("save_tex_btn")->setEnabled(canSaveAs()); + if (mObjectUUID.notNull()) + { + // check that we can copy inworld items into inventory + getChildView("Keep")->setEnabled(mIsCopyable); + } } LLPreview::EAssetStatus LLPreviewTexture::getAssetStatus() @@ -479,3 +532,90 @@ LLPreview::EAssetStatus LLPreviewTexture::getAssetStatus() } return mAssetStatus; } + +void LLPreviewTexture::adjustAspectRatio() +{ + S32 w = mImage->getFullWidth(); + S32 h = mImage->getFullHeight(); + + // Determine aspect ratio of the image + S32 tmp; + while (h != 0) + { + tmp = w % h; + w = h; + h = tmp; + } + S32 divisor = w; + S32 num = mImage->getFullWidth() / divisor; + S32 denom = mImage->getFullHeight() / divisor; + + if (setAspectRatio(num, denom)) + { + // Select corresponding ratio entry in the combo list + LLComboBox* combo = getChild<LLComboBox>("combo_aspect_ratio"); + if (combo) + { + std::ostringstream ratio; + ratio << num << ":" << denom; + std::vector<std::string>::const_iterator found = std::find(mRatiosList.begin(), mRatiosList.end(), ratio.str()); + if (found == mRatiosList.end()) + { + combo->setCurrentByIndex(0); + } + else + { + combo->setCurrentByIndex(found - mRatiosList.begin()); + } + } + } + + mUpdateDimensions = TRUE; +} + +void LLPreviewTexture::updateImageID() +{ + const LLViewerInventoryItem *item = static_cast<const LLViewerInventoryItem*>(getItem()); + if(item) + { + mImageID = item->getAssetUUID(); + + // here's the old logic... + //mShowKeepDiscard = item->getPermissions().getCreator() != gAgent.getID(); + // here's the new logic... 'cos we hate disappearing buttons. + mShowKeepDiscard = TRUE; + + mCopyToInv = FALSE; + LLPermissions perm(item->getPermissions()); + mIsCopyable = perm.allowCopyBy(gAgent.getID(), gAgent.getGroupID()) && perm.allowTransferTo(gAgent.getID()); + mIsFullPerm = item->checkPermissionsSet(PERM_ITEM_UNRESTRICTED); + } + else // not an item, assume it's an asset id + { + mImageID = mItemUUID; + mShowKeepDiscard = FALSE; + mCopyToInv = TRUE; + mIsCopyable = TRUE; + mIsFullPerm = TRUE; + } + +} + +/* virtual */ +void LLPreviewTexture::setObjectID(const LLUUID& object_id) +{ + mObjectUUID = object_id; + + const LLUUID old_image_id = mImageID; + + // Update what image we're pointing to, such as if we just specified the mObjectID + // that this mItemID is part of. + updateImageID(); + + // If the imageID has changed, start over and reload the new image. + if (mImageID != old_image_id) + { + mAssetStatus = PREVIEW_ASSET_UNLOADED; + loadAsset(); + } +} |