New debug channel dc::snapshot.

This commit is contained in:
Aleric Inglewood
2013-01-09 00:54:53 +01:00
parent 63ae33eca7
commit 136e6dd389
4 changed files with 42 additions and 40 deletions

View File

@@ -239,6 +239,7 @@ void stop_recording_backtraces(void)
channel_ct curl DDCN("CURL"); //!< This debug channel is used for output related to AICurl.
channel_ct curlio DDCN("CURLIO"); //!< This debug channel is used to print debug output of libcurl. This includes all HTTP network traffic.
channel_ct curltr DDCN("CURLTR"); //!< This debug channel is used to print libcurl API calls.
channel_ct snapshot DDCN("SNAPSHOT"); //!< This debug channel is used for output related to snapshots.
} // namespace dc
} // namespace DEBUGCHANNELS

View File

@@ -208,6 +208,7 @@ extern CWD_API channel_ct caps;
extern CWD_API channel_ct curl;
extern CWD_API channel_ct curlio;
extern CWD_API channel_ct curltr;
extern CWD_API channel_ct snapshot;
#endif

View File

@@ -383,7 +383,7 @@ LLSnapshotLivePreview::LLSnapshotLivePreview (const LLRect& rect) :
mColor(1.f, 0.f, 0.f, 0.5f),
mRawSnapshot(NULL),
mRawSnapshotWidth(0),
mRawSnapshotHeight(0),
mRawSnapshotHeight(1),
mRawSnapshotAspectRatio(1.0),
mRawSnapshotRenderUI(FALSE),
mRawSnapshotRenderHUD(FALSE),
@@ -409,7 +409,7 @@ LLSnapshotLivePreview::LLSnapshotLivePreview (const LLRect& rect) :
mSnapshotBufferType(LLViewerWindow::SNAPSHOT_TYPE_COLOR),
mCloseCalled(NULL)
{
DoutEntering(dc::notice, "LLSnapshotLivePreview() [" << (void*)this << "]");
DoutEntering(dc::snapshot, "LLSnapshotLivePreview() [" << (void*)this << "]");
setSnapshotQuality(gSavedSettings.getS32("SnapshotQuality"));
mSnapshotDelayTimer.start();
sList.insert(this);
@@ -430,7 +430,7 @@ LLSnapshotLivePreview::LLSnapshotLivePreview (const LLRect& rect) :
LLSnapshotLivePreview::~LLSnapshotLivePreview()
{
DoutEntering(dc::notice, "~LLSnapshotLivePreview() [" << (void*)this << "]");
DoutEntering(dc::snapshot, "~LLSnapshotLivePreview() [" << (void*)this << "]");
sList.erase(this);
// Stop callbacks from using this object.
++sSnapshotIndex;
@@ -455,7 +455,7 @@ LLViewerTexture* LLSnapshotLivePreview::getCurrentImage()
void LLSnapshotLivePreview::showFreezeFrameSnapshot(bool show)
{
DoutEntering(dc::notice, "LLSnapshotLivePreview::showFreezeFrameSnapshot(" << show << ")");
DoutEntering(dc::snapshot, "LLSnapshotLivePreview::showFreezeFrameSnapshot(" << show << ")");
// If we stop to show the fullscreen "freeze frame" snapshot, play the "fall away" animation.
if (mShowFreezeFrameSnapshot && !show)
{
@@ -471,7 +471,7 @@ void LLSnapshotLivePreview::showFreezeFrameSnapshot(bool show)
void LLSnapshotLivePreview::updateSnapshot(BOOL new_snapshot, BOOL new_thumbnail, F32 delay)
{
DoutEntering(dc::notice, "LLSnapshotLivePreview::updateSnapshot(" << new_snapshot << ", " << new_thumbnail << ", " << delay << ")");
DoutEntering(dc::snapshot, "LLSnapshotLivePreview::updateSnapshot(" << new_snapshot << ", " << new_thumbnail << ", " << delay << ")");
LLRect& rect = mFullScreenImageRect;
rect.set(0, getRect().getHeight(), getRect().getWidth(), 0);
@@ -820,7 +820,7 @@ void LLSnapshotLivePreview::generateThumbnailImage(void)
return ;
}
Dout(dc::notice, "LLSnapshotLivePreview::generateThumbnailImage: Actually making a new thumbnail!");
Dout(dc::snapshot, "LLSnapshotLivePreview::generateThumbnailImage: Actually making a new thumbnail!");
mThumbnailImage = NULL;
@@ -843,7 +843,7 @@ void LLSnapshotLivePreview::generateThumbnailImage(void)
{
mThumbnailImage = LLViewerTextureManager::getLocalTexture(raw.get(), FALSE);
mThumbnailUpToDate = TRUE ;
Dout(dc::notice, "thumbnailSnapshot(" << w << ", " << h << ", ...) returns " << raw->getWidth() << ", " << raw->getHeight());
Dout(dc::snapshot, "thumbnailSnapshot(" << w << ", " << h << ", ...) returns " << raw->getWidth() << ", " << raw->getHeight());
}
//unlock updating
@@ -903,7 +903,7 @@ BOOL LLSnapshotLivePreview::onIdle(LLSnapshotLivePreview* previewp)
previewp->getWindow()->incBusyCount();
// Grab the raw image and encode it into desired format.
Dout(dc::notice, "LLSnapshotLivePreview::onIdle: Actually making a new snapshot!");
Dout(dc::snapshot, "LLSnapshotLivePreview::onIdle: Actually making a new snapshot!");
// This should never happen, but well. If it's true then that means that the
// snapshot floater is disabled. Incrementing sSnapshotIndex will cause the
@@ -913,7 +913,7 @@ BOOL LLSnapshotLivePreview::onIdle(LLSnapshotLivePreview* previewp)
previewp->mCloseCalled->setEnabled(TRUE);
}
previewp->sSnapshotIndex++;
Dout(dc::notice, "sSnapshotIndex is now " << previewp->sSnapshotIndex << "; mOutstandingCallbacks reset to 0.");
Dout(dc::snapshot, "sSnapshotIndex is now " << previewp->sSnapshotIndex << "; mOutstandingCallbacks reset to 0.");
previewp->mOutstandingCallbacks = 0; // There are no outstanding callbacks for THIS snapshot.
previewp->mSaveFailures = 0; // There were no upload failures (or attempts for that matter) for this snapshot.
@@ -930,7 +930,7 @@ BOOL LLSnapshotLivePreview::onIdle(LLSnapshotLivePreview* previewp)
previewp->mRawSnapshotAspectRatio = previewp->mAspectRatio;
// Mark that the those values do not represent the current snapshot (yet).
previewp->mRawSnapshotWidth = 0;
previewp->mRawSnapshotHeight = 0;
previewp->mRawSnapshotHeight = 1; // Avoid division by zero when calculation an aspect in LLSnapshotLivePreview::getAspectSizeProblem.
if (gViewerWindow->rawRawSnapshot(
previewp->mRawSnapshot,
@@ -945,7 +945,7 @@ BOOL LLSnapshotLivePreview::onIdle(LLSnapshotLivePreview* previewp)
// On success, cache the size of the raw snapshot.
previewp->mRawSnapshotWidth = previewp->mRawSnapshot->getWidth();
previewp->mRawSnapshotHeight = previewp->mRawSnapshot->getHeight();
Dout(dc::notice, "Created a new raw snapshot of size " << previewp->mRawSnapshotWidth << "x" << previewp->mRawSnapshotHeight);
Dout(dc::snapshot, "Created a new raw snapshot of size " << previewp->mRawSnapshotWidth << "x" << previewp->mRawSnapshotHeight);
previewp->mPosTakenGlobal = gAgentCamera.getCameraPositionGlobal();
EAspectSizeProblem ret = previewp->generateFormattedAndFullscreenPreview();
@@ -1011,7 +1011,7 @@ LLSnapshotLivePreview::EAspectSizeProblem LLSnapshotLivePreview::getAspectSizePr
crop_vertically_out = false;
if (!allow_horizontal_crop)
{
Dout(dc::notice, "NOT up to date: required aspect " << mAspectRatio <<
Dout(dc::snapshot, "NOT up to date: required aspect " << mAspectRatio <<
" is less than the (lower) raw aspect " << lower_raw_aspect << " which is already vertically cropped.");
return CANNOT_CROP_HORIZONTALLY;
}
@@ -1025,7 +1025,7 @@ LLSnapshotLivePreview::EAspectSizeProblem LLSnapshotLivePreview::getAspectSizePr
{
if (!allow_vertical_crop)
{
Dout(dc::notice, "NOT up to date: required aspect " << mAspectRatio <<
Dout(dc::snapshot, "NOT up to date: required aspect " << mAspectRatio <<
" is larger than the (upper) raw aspect " << upper_raw_aspect << " which is already horizontally cropped.");
return CANNOT_CROP_VERTICALLY;
}
@@ -1035,7 +1035,7 @@ LLSnapshotLivePreview::EAspectSizeProblem LLSnapshotLivePreview::getAspectSizePr
// Never allow upscaling of the existing snapshot, of course.
if (mWidth > width_out || mHeight > height_out)
{
Dout(dc::notice, "NOT up to date: required target size " << mWidth << "x" << mHeight <<
Dout(dc::snapshot, "NOT up to date: required target size " << mWidth << "x" << mHeight <<
" is larger than (cropped) raw snapshot with size " << width_out << "x" << height_out << "!");
return SIZE_TOO_LARGE;
}
@@ -1044,7 +1044,7 @@ LLSnapshotLivePreview::EAspectSizeProblem LLSnapshotLivePreview::getAspectSizePr
// unless the aspect is different in which case we have to allow resizing in one direction.
if (mSnapshotType == SNAPSHOT_LOCAL && (mWidth >= window_width || mHeight >= window_height) && mWidth != width_out && mHeight != height_out)
{
Dout(dc::notice, "NOT up to date: required target size " << mWidth << "x" << mHeight <<
Dout(dc::snapshot, "NOT up to date: required target size " << mWidth << "x" << mHeight <<
" is larger or equal the window size (" << window_width << "x" << window_height << ")"
" but unequal the (cropped) raw snapshot size (" << width_out << "x" << height_out << ")"
" and target is disk!");
@@ -1055,7 +1055,7 @@ LLSnapshotLivePreview::EAspectSizeProblem LLSnapshotLivePreview::getAspectSizePr
LLSnapshotLivePreview::EAspectSizeProblem LLSnapshotLivePreview::generateFormattedAndFullscreenPreview(bool delayed)
{
DoutEntering(dc::notice, "LLSnapshotLivePreview::generateFormattedAndFullscreenPreview(" << delayed << ")");
DoutEntering(dc::snapshot, "LLSnapshotLivePreview::generateFormattedAndFullscreenPreview(" << delayed << ")");
mFormattedUpToDate = false;
S32 w, h, crop_offset;
@@ -1101,7 +1101,7 @@ LLSnapshotLivePreview::EAspectSizeProblem LLSnapshotLivePreview::generateFormatt
(mFormattedSnapshotQuality == mSnapshotQuality ||
format != LLFloaterSnapshot::SNAPSHOT_FORMAT_JPEG))
{
Dout(dc::notice, "Already up to date.");
Dout(dc::snapshot, "Already up to date.");
mFormattedUpToDate = true;
return ret;
}
@@ -1109,43 +1109,43 @@ LLSnapshotLivePreview::EAspectSizeProblem LLSnapshotLivePreview::generateFormatt
#ifdef CWDEBUG
if (!mFormattedImage)
{
Dout(dc::notice, "mFormattedImage == NULL!");
Dout(dc::snapshot, "mFormattedImage == NULL!");
}
else
{
if (mFormattedWidth != mWidth)
Dout(dc::notice, "Target width changed from " << mFormattedWidth << " to " << mWidth);
Dout(dc::snapshot, "Target width changed from " << mFormattedWidth << " to " << mWidth);
if (mFormattedHeight != mHeight)
Dout(dc::notice, "Target height changed from " << mFormattedHeight << " to " << mHeight);
Dout(dc::snapshot, "Target height changed from " << mFormattedHeight << " to " << mHeight);
if (mFormattedRawWidth != w)
Dout(dc::notice, "Cropped (raw) width changed from " << mFormattedRawWidth << " to " << w);
Dout(dc::snapshot, "Cropped (raw) width changed from " << mFormattedRawWidth << " to " << w);
if (mFormattedRawHeight != h)
Dout(dc::notice, "Cropped (raw) height changed from " << mFormattedRawHeight << " to " << h);
Dout(dc::snapshot, "Cropped (raw) height changed from " << mFormattedRawHeight << " to " << h);
if (mFormattedCropOffset != crop_offset)
Dout(dc::notice, "Crop offset changed from " << mFormattedCropOffset << " to " << crop_offset);
Dout(dc::snapshot, "Crop offset changed from " << mFormattedCropOffset << " to " << crop_offset);
if (mFormattedCropVertically != crop_vertically)
Dout(dc::notice, "Crop direction changed from " << (mFormattedCropVertically ? "vertical" : "horizontal") << " to " << (crop_vertically ? "vertical" : "horizontal"));
Dout(dc::snapshot, "Crop direction changed from " << (mFormattedCropVertically ? "vertical" : "horizontal") << " to " << (crop_vertically ? "vertical" : "horizontal"));
if (mFormattedSnapshotFormat != format)
Dout(dc::notice, "Format changed from " << mFormattedSnapshotFormat << " to " << format);
Dout(dc::snapshot, "Format changed from " << mFormattedSnapshotFormat << " to " << format);
if (!(mFormattedSnapshotQuality == mSnapshotQuality || format != LLFloaterSnapshot::SNAPSHOT_FORMAT_JPEG))
Dout(dc::notice, "Format is JPEG and quality changed from " << mFormattedSnapshotQuality << " to " << mSnapshotQuality);
Dout(dc::snapshot, "Format is JPEG and quality changed from " << mFormattedSnapshotQuality << " to " << mSnapshotQuality);
}
#endif
if (delayed)
{
// Just set mFormattedUpToDate.
Dout(dc::notice, "NOT up to date, but delayed. Returning.");
Dout(dc::snapshot, "NOT up to date, but delayed. Returning.");
return DELAYED;
}
if (!mRawSnapshot)
{
Dout(dc::notice, "No raw snapshot exists.");
Dout(dc::snapshot, "No raw snapshot exists.");
return NO_RAW_IMAGE;
}
Dout(dc::notice, "Generating a new formatted image!");
Dout(dc::snapshot, "Generating a new formatted image!");
mFormattedWidth = mWidth;
mFormattedHeight = mHeight;
@@ -1313,7 +1313,7 @@ LLFloaterFeed* LLSnapshotLivePreview::getCaptionAndSaveFeed()
++mOutstandingCallbacks;
mSaveFailures = 0;
addUsedBy(SNAPSHOT_FEED);
Dout(dc::notice, "LLSnapshotLivePreview::getCaptionAndSaveFeed: sSnapshotIndex = " << sSnapshotIndex << "; mOutstandingCallbacks = " << mOutstandingCallbacks << ".");
Dout(dc::snapshot, "LLSnapshotLivePreview::getCaptionAndSaveFeed: sSnapshotIndex = " << sSnapshotIndex << "; mOutstandingCallbacks = " << mOutstandingCallbacks << ".");
if (mFullScreenPreviewTexture.isNull())
{
@@ -1351,7 +1351,7 @@ LLFloaterPostcard* LLSnapshotLivePreview::savePostcard()
++mOutstandingCallbacks;
mSaveFailures = 0;
addUsedBy(SNAPSHOT_POSTCARD);
Dout(dc::notice, "LLSnapshotLivePreview::savePostcard: sSnapshotIndex = " << sSnapshotIndex << "; mOutstandingCallbacks = " << mOutstandingCallbacks << ".");
Dout(dc::snapshot, "LLSnapshotLivePreview::savePostcard: sSnapshotIndex = " << sSnapshotIndex << "; mOutstandingCallbacks = " << mOutstandingCallbacks << ".");
if(mFullScreenPreviewTexture.isNull())
{
@@ -1397,7 +1397,7 @@ void LLSnapshotLivePreview::saveTexture()
++mOutstandingCallbacks;
mSaveFailures = 0;
addUsedBy(SNAPSHOT_TEXTURE);
Dout(dc::notice, "LLSnapshotLivePreview::saveTexture: sSnapshotIndex = " << sSnapshotIndex << "; mOutstandingCallbacks = " << mOutstandingCallbacks << ".");
Dout(dc::snapshot, "LLSnapshotLivePreview::saveTexture: sSnapshotIndex = " << sSnapshotIndex << "; mOutstandingCallbacks = " << mOutstandingCallbacks << ".");
saveStart(sSnapshotIndex);
// gen a new uuid for this asset
@@ -1438,7 +1438,7 @@ void LLSnapshotLivePreview::saveLocal()
++mOutstandingCallbacks;
mSaveFailures = 0;
addUsedBy(SNAPSHOT_LOCAL);
Dout(dc::notice, "LLSnapshotLivePreview::saveLocal: sSnapshotIndex = " << sSnapshotIndex << "; mOutstandingCallbacks = " << mOutstandingCallbacks << ".");
Dout(dc::snapshot, "LLSnapshotLivePreview::saveLocal: sSnapshotIndex = " << sSnapshotIndex << "; mOutstandingCallbacks = " << mOutstandingCallbacks << ".");
saveStart(sSnapshotIndex);
gViewerWindow->saveImageNumbered(mFormattedImage, sSnapshotIndex); // This calls saveDone() immediately, or later.
@@ -1446,7 +1446,7 @@ void LLSnapshotLivePreview::saveLocal()
void LLSnapshotLivePreview::close(LLFloaterSnapshot* view)
{
DoutEntering(dc::notice, "LLSnapshotLivePreview::close(" << (void*)view << ") [mOutstandingCallbacks = " << mOutstandingCallbacks << "]");
DoutEntering(dc::snapshot, "LLSnapshotLivePreview::close(" << (void*)view << ") [mOutstandingCallbacks = " << mOutstandingCallbacks << "]");
mCloseCalled = view;
if (!mOutstandingCallbacks)
{
@@ -1479,11 +1479,11 @@ void LLSnapshotLivePreview::saveStart(int index)
void LLSnapshotLivePreview::saveDone(ESnapshotType type, bool success, int index)
{
DoutEntering(dc::notice, "LLSnapshotLivePreview::saveDone(" << type << ", " << success << ", " << index << ")");
DoutEntering(dc::snapshot, "LLSnapshotLivePreview::saveDone(" << type << ", " << success << ", " << index << ")");
if (sSnapshotIndex != index)
{
Dout(dc::notice, "sSnapshotIndex (" << sSnapshotIndex << ") != index (" << index << ")");
Dout(dc::snapshot, "sSnapshotIndex (" << sSnapshotIndex << ") != index (" << index << ")");
// The snapshot was already replaced, so this callback has nothing to do with us anymore.
if (!success)
@@ -1494,7 +1494,7 @@ void LLSnapshotLivePreview::saveDone(ESnapshotType type, bool success, int index
}
--mOutstandingCallbacks;
Dout(dc::notice, "sSnapshotIndex = " << sSnapshotIndex << "; mOutstandingCallbacks = " << mOutstandingCallbacks << ".");
Dout(dc::snapshot, "sSnapshotIndex = " << sSnapshotIndex << "; mOutstandingCallbacks = " << mOutstandingCallbacks << ".");
if (!success)
{
++mSaveFailures;
@@ -1717,7 +1717,7 @@ void LLFloaterSnapshot::Impl::freezeTime(bool on)
// static
void LLFloaterSnapshot::Impl::updateControls(LLFloaterSnapshot* floater, bool delayed_formatted)
{
DoutEntering(dc::notice, "LLFloaterSnapshot::Impl::updateControls()");
DoutEntering(dc::snapshot, "LLFloaterSnapshot::Impl::updateControls()");
std::string fee = gHippoGridManager->getConnectedGrid()->getUploadFee();
if (gSavedSettings.getBOOL("TemporaryUpload"))
{
@@ -2223,7 +2223,7 @@ void LLFloaterSnapshot::Impl::onCommitQuality(LLUICtrl* ctrl, void* data)
//static
void LLFloaterSnapshot::Impl::onQualityMouseUp(void* data)
{
Dout(dc::notice, "Calling LLFloaterSnapshot::Impl::QualityMouseUp()");
Dout(dc::snapshot, "Calling LLFloaterSnapshot::Impl::QualityMouseUp()");
LLFloaterSnapshot* view = (LLFloaterSnapshot *)data;
updateControls(view);
}

View File

@@ -4420,7 +4420,7 @@ bool LLViewerWindow::rawRawSnapshot(LLImageRaw *raw,
// Center the buffer.
buffer_x_offset = llfloor(((window_width - snapshot_width) * scale_factor) / 2.f);
buffer_y_offset = llfloor(((window_height - snapshot_height) * scale_factor) / 2.f);
Dout(dc::notice, "rawSnapshot(" << image_width << ", " << image_height << ", " << snapshot_aspect << "): image_buffer_x = " << image_buffer_x << "; image_buffer_y = " << image_buffer_y);
Dout(dc::snapshot, "rawRawSnapshot(" << image_width << ", " << image_height << ", " << snapshot_aspect << "): image_buffer_x = " << image_buffer_x << "; image_buffer_y = " << image_buffer_y);
bool error = !(image_buffer_x > 0 && image_buffer_y > 0);
if (!error)