drawinglayer/source/processor2d/vclhelperbufferdevice.cxx |   24 ++++----------
 vcl/source/bitmap/bitmap.cxx                              |    4 +-
 2 files changed, 10 insertions(+), 18 deletions(-)

New commits:
commit 28223ab9198e693a1cb4e344f14f8f5d5fbf127a
Author:     Mike Kaganski <mike.kagan...@collabora.com>
AuthorDate: Tue Aug 30 14:14:50 2022 +0300
Commit:     Mike Kaganski <mike.kagan...@collabora.com>
CommitDate: Tue Aug 30 15:26:55 2022 +0200

    Unify the two places dumping bimaps for debugging
    
    Using the environment variable allows me to use a directory
    where no "access denied" happens on write access.
    
    Change-Id: Iffdd9b8566f2d794a6741b71d736d14d4643576c
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139033
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com>

diff --git a/drawinglayer/source/processor2d/vclhelperbufferdevice.cxx 
b/drawinglayer/source/processor2d/vclhelperbufferdevice.cxx
index 4a29344023b1..a0807e83f72b 100644
--- a/drawinglayer/source/processor2d/vclhelperbufferdevice.cxx
+++ b/drawinglayer/source/processor2d/vclhelperbufferdevice.cxx
@@ -359,15 +359,12 @@ void impBufferDevice::paint(double fTrans)
     mpContent->EnableMapMode(false);
 
 #ifdef DBG_UTIL
-    if (bDoSaveForVisualControl)
+    // VCL_DUMP_BMP_PATH should be like C:/path/ or ~/path/
+    static const OUString 
sDumpPath(OUString::createFromAscii(std::getenv("VCL_DUMP_BMP_PATH")));
+
+    if (!sDumpPath.isEmpty() && bDoSaveForVisualControl)
     {
-        SvFileStream aNew(
-#ifdef _WIN32
-            "c:\\content.bmp",
-#else
-            "~/content.bmp",
-#endif
-            StreamMode::WRITE | StreamMode::TRUNC);
+        SvFileStream aNew(sDumpPath + "content.bmp", StreamMode::WRITE | 
StreamMode::TRUNC);
         Bitmap aContent(mpContent->GetBitmap(aEmptyPoint, aSizePixel));
         WriteDIB(aContent, aNew, false, true);
     }
@@ -383,15 +380,10 @@ void impBufferDevice::paint(double fTrans)
         AlphaMask aAlphaMask(mpAlpha->GetBitmap(aEmptyPoint, aSizePixel));
 
 #ifdef DBG_UTIL
-        if (bDoSaveForVisualControl)
+        if (!sDumpPath.isEmpty() && bDoSaveForVisualControl)
         {
-            SvFileStream aNew(
-#ifdef _WIN32
-                "c:\\transparence.bmp",
-#else
-                "~/transparence.bmp",
-#endif
-                StreamMode::WRITE | StreamMode::TRUNC);
+            SvFileStream aNew(sDumpPath + "transparence.bmp",
+                              StreamMode::WRITE | StreamMode::TRUNC);
             WriteDIB(aAlphaMask.GetBitmap(), aNew, false, true);
         }
 #endif
diff --git a/vcl/source/bitmap/bitmap.cxx b/vcl/source/bitmap/bitmap.cxx
index 2a9f949ac1fe..5abd79c70fcc 100644
--- a/vcl/source/bitmap/bitmap.cxx
+++ b/vcl/source/bitmap/bitmap.cxx
@@ -156,7 +156,7 @@ void savePNG(const OUString& sWhere, const Bitmap& rBmp)
 Bitmap::~Bitmap()
 {
 #ifdef DBG_UTIL
-    // VCL_DUMP_BMP_PATH should be like C:/bmpDump.png or ~/bmpDump.png
+    // VCL_DUMP_BMP_PATH should be like C:/path/ or ~/path/
     static const OUString 
sDumpPath(OUString::createFromAscii(std::getenv("VCL_DUMP_BMP_PATH")));
     // Stepping into the dtor of a bitmap you need, and setting the volatile 
variable to true in
     // debugger, would dump the bitmap in question
@@ -164,7 +164,7 @@ Bitmap::~Bitmap()
     if (!sDumpPath.isEmpty() && save)
     {
         save = false;
-        savePNG(sDumpPath, *this);
+        savePNG(sDumpPath + "BitmapDump.png", *this);
     }
 #endif
 }

Reply via email to