Make slideshow objects' debugging semi-transparency and shift conditional

It was introduced in commit cfd7bf7f6e
(INTEGRATION: CWS presfixes12 (1.1.2); FILE ADDED, 2007-07-17); and
back then, it was guarded by VERBOSE define. The VERBOSE condition
was replaced by OSL_DEBUG_LEVEL >= 2 condition later in commit
912e36e911 (Remove VERBOSE part 3,
2012-04-10); and then, it was completely dropped in commit
e5ec630414 (stop inclduing
canvas/verbosetraces.hxx and canvas/debug.hxx, 2015-08-11).

But this code is definitely harmful by default, when an unaware
developer (like myself) tries to debug an animation problem, and
suddenly sees a very different problem in the debug build (the shift
and transparency of objects), which obviously is a new regression in
master, but it can't be bisected using bibisect repos, which makes
you to question your sanity, until you realize that it must be some
debug-only feature.

Thorsten wrote on IRC:
> the semi-transparency & shifting is needed for actually noticing
> what's behind (shapes get moved to sprites, then erased from the
> static canvas, then moved around)
> so I believe it's useful debugging tools, but of course should not
> randomly enable for normal dev builds

So use environment variable to control this behavior-changing code.

Change-Id: I493cdde26c95fdde4a5d542a0bdad8e329fdfda8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173965
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Tested-by: Jenkins
This commit is contained in:
Mike Kaganski
2024-09-26 12:05:42 +05:00
parent 8e1f8e9b70
commit e5b18c7d00
3 changed files with 22 additions and 10 deletions

View File

@@ -23,6 +23,7 @@
#include <eventqueue.hxx>
#include <eventmultiplexer.hxx>
#include <slideview.hxx>
#include <tools.hxx>
#include <delayevent.hxx>
#include <unoview.hxx>
@@ -591,18 +592,17 @@ private:
mpSprite->setPriority(
maSpriteContainer.getLayerPriority().getMinimum() );
basegfx::B2DPoint pos(maLayerBoundsPixel.getMinimum());
double alpha = 1.0;
#if defined(DBG_UTIL)
mpSprite->movePixel(
basegfx::B2DPoint(maLayerBoundsPixel.getMinimum()) +
basegfx::B2DPoint(10,10) );
mpSprite->setAlpha(0.5);
#else
mpSprite->movePixel(
basegfx::B2DPoint(maLayerBoundsPixel.getMinimum()) );
mpSprite->setAlpha(1.0);
if (isShowingMoreDebugInfo())
{
pos += basegfx::B2DPoint(10, 10);
alpha = 0.5;
}
#endif
mpSprite->movePixel(pos);
mpSprite->setAlpha(alpha);
mpSprite->show();
}

View File

@@ -776,6 +776,14 @@ namespace slideshow::internal
basegfx::fround( aTmpRect.getRange().getX() ) + 1,
basegfx::fround( aTmpRect.getRange().getY() ) + 1 );
}
#if defined(DBG_UTIL)
bool isShowingMoreDebugInfo()
{
static const bool bMoreInfo = getenv("SLIDESHOW_MORE_DEBUG_INFO") != nullptr;
return bMoreInfo;
}
#endif
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */

View File

@@ -77,6 +77,10 @@ namespace slideshow
return hash_value(val);
}
};
#if defined(DBG_UTIL)
bool isShowingMoreDebugInfo();
#endif
}
}