summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2024-09-26 12:05:42 +0500
committerMike Kaganski <mike.kaganski@collabora.com>2024-09-26 14:48:13 +0200
commite5b18c7d00bd0e60919c1f6f3d63d6dd24c8e0a4 (patch)
tree16c971f854d5524f0bdbd7b8282dffcbe61f39f7
parent8e1f8e9b701839ff141bebb715de5eeee6772a85 (diff)
Make slideshow objects' debugging semi-transparency and shift conditional
It was introduced in commit cfd7bf7f6eeede43027dd72f923b2a8b2920a376 (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 912e36e911201742633e7c0a0a56f247735ee09c (Remove VERBOSE part 3, 2012-04-10); and then, it was completely dropped in commit e5ec6304149cdcad0d6495b5187c245748b408b5 (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
-rw-r--r--slideshow/source/engine/slideview.cxx20
-rw-r--r--slideshow/source/engine/tools.cxx8
-rw-r--r--slideshow/source/inc/tools.hxx4
3 files changed, 22 insertions, 10 deletions
diff --git a/slideshow/source/engine/slideview.cxx b/slideshow/source/engine/slideview.cxx
index 8582918b2c4b..dd6a28423f36 100644
--- a/slideshow/source/engine/slideview.cxx
+++ b/slideshow/source/engine/slideview.cxx
@@ -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();
}
diff --git a/slideshow/source/engine/tools.cxx b/slideshow/source/engine/tools.cxx
index 1234b8bae27d..6f19dad8a405 100644
--- a/slideshow/source/engine/tools.cxx
+++ b/slideshow/source/engine/tools.cxx
@@ -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: */
diff --git a/slideshow/source/inc/tools.hxx b/slideshow/source/inc/tools.hxx
index b3081d9fff37..fe8cc7d6911b 100644
--- a/slideshow/source/inc/tools.hxx
+++ b/slideshow/source/inc/tools.hxx
@@ -77,6 +77,10 @@ namespace slideshow
return hash_value(val);
}
};
+
+#if defined(DBG_UTIL)
+ bool isShowingMoreDebugInfo();
+#endif
}
}