tdf#168125 Black bar next to the color preview in the color picker dialog

regression from
  commit 088a7c7c45
  Author: Noel Grandin <noelgrandin@gmail.com>
  Date:   Tue Sep 24 16:18:11 2024 +0200
  remove alpha device from OutputDevice

Change-Id: I610a479c14f278718b801094dbe9ba1a2592e9f9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/191958
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
Noel Grandin
2025-10-06 14:23:26 +02:00
parent 7a6ebc8be8
commit ef45f4fcfb
+8 -2
View File
@@ -21,6 +21,7 @@
#include <vcl/ColorDialog.hxx>
#include <vcl/event.hxx>
#include <vcl/svapp.hxx>
#include <basegfx/color/bcolortools.hxx>
#include <cmath>
#include <o3tl/typed_flags_set.hxx>
@@ -89,8 +90,13 @@ static void RGBtoCMYK( double dR, double dG, double dB, double& fCyan, double& f
void ColorPreviewControl::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle&)
{
rRenderContext.SetFillColor(m_aColor);
rRenderContext.SetLineColor(m_aColor);
Color aCol = m_aColor;
// If the color has been set to transparent, we need to paint a block that matches the dialog
// background.
if (aCol.GetAlpha() == 0)
aCol = Application::GetSettings().GetStyleSettings().GetDialogColor();
rRenderContext.SetFillColor(aCol);
rRenderContext.SetLineColor(aCol);
rRenderContext.DrawRect(tools::Rectangle(Point(0, 0), GetOutputSizePixel()));
}