drawinglayer/source/processor2d/cairopixelprocessor2d.cxx | 19 ++------ drawinglayer/source/processor2d/vclprocessor2d.cxx | 12 ----- include/vcl/rendercontext/DrawModeFlags.hxx | 4 - vcl/qa/cppunit/drawmode.cxx | 21 -------- vcl/qa/cppunit/outdev.cxx | 33 -------------- vcl/source/outdev/gradient.cxx | 8 +-- vcl/source/rendercontext/drawmode.cxx | 17 +------ 7 files changed, 14 insertions(+), 100 deletions(-)
New commits: commit b3c7eaf9d3b194f2f134261004fc9e0723fd529c Author: Noel Grandin <[email protected]> AuthorDate: Mon Sep 15 20:25:39 2025 +0200 Commit: Noel Grandin <[email protected]> CommitDate: Tue Sep 16 08:05:28 2025 +0200 removed unused DrawModeFlags DrawModeFlags::BlackGradient is dead since commit e7b460f9197a57360dd017481dc747170e6a729f Author: Noel Grandin <[email protected]> Date: Sat Aug 30 15:23:11 2025 +0200 BitmapEx->Bitmap in canvas DrawModeFlags::WhiteText is dead since commit 81994cb2b8b32453a92bcb011830fcb884f22ff3 Author: Noel Grandin <[email protected]> Date: Fri Apr 16 20:33:10 2021 +0200 Convert internal vcl bitmap formats transparency->alpha (II) Change-Id: I3405962f1293f0f2ea9619e009bf048fc2c35c95 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/190999 Tested-by: Jenkins Reviewed-by: Noel Grandin <[email protected]> diff --git a/drawinglayer/source/processor2d/cairopixelprocessor2d.cxx b/drawinglayer/source/processor2d/cairopixelprocessor2d.cxx index a96c627e6f25..ea59f769068c 100644 --- a/drawinglayer/source/processor2d/cairopixelprocessor2d.cxx +++ b/drawinglayer/source/processor2d/cairopixelprocessor2d.cxx @@ -3326,8 +3326,7 @@ void CairoPixelProcessor2D::processFillGradientPrimitive2D( return; } - constexpr DrawModeFlags SIMPLE_GRADIENT(DrawModeFlags::BlackGradient - | DrawModeFlags::WhiteGradient + constexpr DrawModeFlags SIMPLE_GRADIENT(DrawModeFlags::WhiteGradient | DrawModeFlags::SettingsGradient); const DrawModeFlags aDrawModeFlags(getViewInformation2D().getDrawModeFlags()); if (aDrawModeFlags & SIMPLE_GRADIENT) @@ -3887,8 +3886,7 @@ bool CairoPixelProcessor2D::handleSvgGradientHelper( primitive2d::SvgGradientEntryVector::const_reference aEntry( rCandidate.getGradientEntries().back()); - constexpr DrawModeFlags SIMPLE_GRADIENT(DrawModeFlags::BlackGradient - | DrawModeFlags::WhiteGradient + constexpr DrawModeFlags SIMPLE_GRADIENT(DrawModeFlags::WhiteGradient | DrawModeFlags::SettingsGradient); if (getViewInformation2D().getDrawModeFlags() & SIMPLE_GRADIENT) { @@ -4272,8 +4270,8 @@ basegfx::BColor CairoPixelProcessor2D::getFillColor(const basegfx::BColor& rColo basegfx::BColor CairoPixelProcessor2D::getTextColor(const basegfx::BColor& rColor) const { - constexpr DrawModeFlags TEXT(DrawModeFlags::BlackText | DrawModeFlags::WhiteText - | DrawModeFlags::GrayText | DrawModeFlags::SettingsText); + constexpr DrawModeFlags TEXT(DrawModeFlags::BlackText | DrawModeFlags::GrayText + | DrawModeFlags::SettingsText); const DrawModeFlags aDrawModeFlags(getViewInformation2D().getDrawModeFlags()); if (!(aDrawModeFlags & TEXT)) @@ -4282,9 +4280,6 @@ basegfx::BColor CairoPixelProcessor2D::getTextColor(const basegfx::BColor& rColo if (aDrawModeFlags & DrawModeFlags::BlackText) return basegfx::BColor(0, 0, 0); - if (aDrawModeFlags & DrawModeFlags::WhiteText) - return basegfx::BColor(1, 1, 1); - if (aDrawModeFlags & DrawModeFlags::GrayText) { const double fLuminance(rColor.luminance()); @@ -4300,17 +4295,13 @@ basegfx::BColor CairoPixelProcessor2D::getTextColor(const basegfx::BColor& rColo basegfx::BColor CairoPixelProcessor2D::getGradientColor(const basegfx::BColor& rColor) const { - constexpr DrawModeFlags GRADIENT(DrawModeFlags::BlackGradient | DrawModeFlags::GrayGradient - | DrawModeFlags::WhiteGradient + constexpr DrawModeFlags GRADIENT(DrawModeFlags::GrayGradient | DrawModeFlags::WhiteGradient | DrawModeFlags::SettingsGradient); const DrawModeFlags aDrawModeFlags(getViewInformation2D().getDrawModeFlags()); if (!(aDrawModeFlags & GRADIENT)) return rColor; - if (aDrawModeFlags & DrawModeFlags::BlackGradient) - return basegfx::BColor(0, 0, 0); - if (aDrawModeFlags & DrawModeFlags::WhiteGradient) return basegfx::BColor(1, 1, 1); diff --git a/drawinglayer/source/processor2d/vclprocessor2d.cxx b/drawinglayer/source/processor2d/vclprocessor2d.cxx index b3f319f51d8f..851afffeca1d 100644 --- a/drawinglayer/source/processor2d/vclprocessor2d.cxx +++ b/drawinglayer/source/processor2d/vclprocessor2d.cxx @@ -1553,8 +1553,7 @@ void VclProcessor2D::adaptTextToFillDrawMode() const { const DrawModeFlags nOriginalDrawMode(mpOutputDevice->GetDrawMode()); if (!(nOriginalDrawMode - & (DrawModeFlags::BlackText | DrawModeFlags::GrayText | DrawModeFlags::WhiteText - | DrawModeFlags::SettingsText))) + & (DrawModeFlags::BlackText | DrawModeFlags::GrayText | DrawModeFlags::SettingsText))) return; DrawModeFlags nAdaptedDrawMode(nOriginalDrawMode); @@ -1577,15 +1576,6 @@ void VclProcessor2D::adaptTextToFillDrawMode() const nAdaptedDrawMode &= ~DrawModeFlags::GrayFill; } - if (nOriginalDrawMode & DrawModeFlags::WhiteText) - { - nAdaptedDrawMode |= DrawModeFlags::WhiteFill; - } - else - { - nAdaptedDrawMode &= ~DrawModeFlags::WhiteFill; - } - if (nOriginalDrawMode & DrawModeFlags::SettingsText) { nAdaptedDrawMode |= DrawModeFlags::SettingsFill; diff --git a/include/vcl/rendercontext/DrawModeFlags.hxx b/include/vcl/rendercontext/DrawModeFlags.hxx index 509b3f340f59..e3e42703a2d6 100644 --- a/include/vcl/rendercontext/DrawModeFlags.hxx +++ b/include/vcl/rendercontext/DrawModeFlags.hxx @@ -28,7 +28,6 @@ enum class DrawModeFlags : sal_uInt32 BlackLine = 0x00000001, BlackFill = 0x00000002, BlackText = 0x00000004, - BlackGradient = 0x00000010, GrayLine = 0x00000020, GrayFill = 0x00000040, GrayText = 0x00000080, @@ -37,7 +36,6 @@ enum class DrawModeFlags : sal_uInt32 NoFill = 0x00000400, WhiteLine = 0x00000800, WhiteFill = 0x00001000, - WhiteText = 0x00002000, WhiteGradient = 0x00008000, SettingsLine = 0x00010000, SettingsFill = 0x00020000, @@ -48,7 +46,7 @@ enum class DrawModeFlags : sal_uInt32 }; namespace o3tl { -template <> struct typed_flags<DrawModeFlags> : is_typed_flags<DrawModeFlags, 0x3fbff7> +template <> struct typed_flags<DrawModeFlags> : is_typed_flags<DrawModeFlags, 0x3f9fe7> { }; } diff --git a/vcl/qa/cppunit/drawmode.cxx b/vcl/qa/cppunit/drawmode.cxx index 24a25c7e9422..14369db5c776 100644 --- a/vcl/qa/cppunit/drawmode.cxx +++ b/vcl/qa/cppunit/drawmode.cxx @@ -91,8 +91,6 @@ void VclDrawModeTest::testDrawModeLineColor() aColor, vcl::drawmode::GetLineColor(aColor, DrawModeFlags::SettingsFill, aStyleSettings)); CPPUNIT_ASSERT_EQUAL( aColor, vcl::drawmode::GetLineColor(aColor, DrawModeFlags::BlackText, aStyleSettings)); - CPPUNIT_ASSERT_EQUAL( - aColor, vcl::drawmode::GetLineColor(aColor, DrawModeFlags::WhiteText, aStyleSettings)); CPPUNIT_ASSERT_EQUAL( aColor, vcl::drawmode::GetLineColor(aColor, DrawModeFlags::GrayText, aStyleSettings)); CPPUNIT_ASSERT_EQUAL( @@ -147,8 +145,6 @@ void VclDrawModeTest::testDrawModeFillColor() aColor, vcl::drawmode::GetFillColor(aColor, DrawModeFlags::SettingsLine, aStyleSettings)); CPPUNIT_ASSERT_EQUAL( aColor, vcl::drawmode::GetFillColor(aColor, DrawModeFlags::BlackText, aStyleSettings)); - CPPUNIT_ASSERT_EQUAL( - aColor, vcl::drawmode::GetFillColor(aColor, DrawModeFlags::WhiteText, aStyleSettings)); CPPUNIT_ASSERT_EQUAL( aColor, vcl::drawmode::GetFillColor(aColor, DrawModeFlags::GrayText, aStyleSettings)); CPPUNIT_ASSERT_EQUAL( @@ -187,8 +183,6 @@ void VclDrawModeTest::testDrawModeHatchColor() aColor, vcl::drawmode::GetHatchColor(aColor, DrawModeFlags::SettingsFill, aStyleSettings)); CPPUNIT_ASSERT_EQUAL( aColor, vcl::drawmode::GetHatchColor(aColor, DrawModeFlags::BlackText, aStyleSettings)); - CPPUNIT_ASSERT_EQUAL( - aColor, vcl::drawmode::GetHatchColor(aColor, DrawModeFlags::WhiteText, aStyleSettings)); CPPUNIT_ASSERT_EQUAL( aColor, vcl::drawmode::GetHatchColor(aColor, DrawModeFlags::GrayText, aStyleSettings)); CPPUNIT_ASSERT_EQUAL( @@ -205,8 +199,6 @@ void VclDrawModeTest::testDrawModeTextColor() CPPUNIT_ASSERT_EQUAL( COL_BLACK, vcl::drawmode::GetTextColor(aColor, DrawModeFlags::BlackText, aStyleSettings)); - CPPUNIT_ASSERT_EQUAL( - COL_WHITE, vcl::drawmode::GetTextColor(aColor, DrawModeFlags::WhiteText, aStyleSettings)); CPPUNIT_ASSERT_EQUAL( Color(cLum, cLum, cLum), vcl::drawmode::GetTextColor(aColor, DrawModeFlags::GrayText, aStyleSettings)); @@ -257,19 +249,6 @@ void VclDrawModeTest::testDrawModeFontColor() CPPUNIT_ASSERT_EQUAL(COL_BLACK, aTestFont.GetColor()); CPPUNIT_ASSERT_EQUAL(COL_RED, aTestFont.GetFillColor()); - // white text and fill - aFont.SetTransparent(false); - aTestFont = vcl::drawmode::GetFont(aFont, DrawModeFlags::WhiteText | DrawModeFlags::WhiteFill, - aStyleSettings); - CPPUNIT_ASSERT_EQUAL(COL_WHITE, aTestFont.GetColor()); - CPPUNIT_ASSERT_EQUAL(COL_WHITE, aTestFont.GetFillColor()); - - aFont.SetTransparent(true); - aTestFont = vcl::drawmode::GetFont(aFont, DrawModeFlags::WhiteText | DrawModeFlags::WhiteFill, - aStyleSettings); - CPPUNIT_ASSERT_EQUAL(COL_WHITE, aTestFont.GetColor()); - CPPUNIT_ASSERT_EQUAL(COL_RED, aTestFont.GetFillColor()); - // gray text and fill const sal_uInt8 cTextLum = aFont.GetColor().GetLuminance(); const Color aTextGray(cTextLum, cTextLum, cTextLum); diff --git a/vcl/qa/cppunit/outdev.cxx b/vcl/qa/cppunit/outdev.cxx index dcb757c86301..cc138155b601 100644 --- a/vcl/qa/cppunit/outdev.cxx +++ b/vcl/qa/cppunit/outdev.cxx @@ -1856,39 +1856,6 @@ static size_t ClipGradientTest(GDIMetaFile& rMtf, size_t nIndex) return nIndex; } -CPPUNIT_TEST_FIXTURE(VclOutdevTest, testDrawGradient_drawmode) -{ - ScopedVclPtrInstance<VirtualDevice> pVDev; - GDIMetaFile aMtf; - aMtf.Record(pVDev.get()); - - pVDev->SetOutputSizePixel(Size(100, 100)); - pVDev->SetDrawMode(DrawModeFlags::BlackGradient); - - tools::Rectangle aRect(Point(10, 10), Size(40, 40)); - pVDev->DrawGradient(aRect, Gradient()); - MetaAction* pAction = aMtf.GetAction(INITIAL_SETUP_ACTION_COUNT); - CPPUNIT_ASSERT_EQUAL_MESSAGE("Not a push action (drawmode is black gradient)", - MetaActionType::PUSH, pAction->GetType()); - MetaPushAction* pPushAction = dynamic_cast<MetaPushAction*>(pAction); - vcl::PushFlags eFlags = vcl::PushFlags::LINECOLOR | vcl::PushFlags::FILLCOLOR; - CPPUNIT_ASSERT_EQUAL_MESSAGE("Push flags wrong (drawmode is black gradient)", eFlags, - pPushAction->GetFlags()); - - pAction = aMtf.GetAction(INITIAL_SETUP_ACTION_COUNT + 1); - CPPUNIT_ASSERT_EQUAL_MESSAGE("Not a line color action (drawmode is black gradient)", - MetaActionType::LINECOLOR, pAction->GetType()); - pAction = aMtf.GetAction(INITIAL_SETUP_ACTION_COUNT + 2); - CPPUNIT_ASSERT_EQUAL_MESSAGE("Not a fill color action (drawmode is black gradient)", - MetaActionType::FILLCOLOR, pAction->GetType()); - pAction = aMtf.GetAction(INITIAL_SETUP_ACTION_COUNT + 3); - CPPUNIT_ASSERT_EQUAL_MESSAGE("Not a polypolygon action (drawmode is black gradient)", - MetaActionType::POLYPOLYGON, pAction->GetType()); - pAction = aMtf.GetAction(INITIAL_SETUP_ACTION_COUNT + 4); - CPPUNIT_ASSERT_EQUAL_MESSAGE("Not a pop action (drawmode is black gradient)", - MetaActionType::POP, pAction->GetType()); -} - CPPUNIT_TEST_FIXTURE(VclOutdevTest, testDrawGradient_rect_linear) { ScopedVclPtrInstance<VirtualDevice> pVDev; diff --git a/vcl/source/outdev/gradient.cxx b/vcl/source/outdev/gradient.cxx index 1a0ad2d0d1b8..60fb5fc5ad1a 100644 --- a/vcl/source/outdev/gradient.cxx +++ b/vcl/source/outdev/gradient.cxx @@ -56,7 +56,7 @@ void OutputDevice::DrawGradient( const tools::PolyPolygon& rPolyPoly, if (!rPolyPoly.Count() || !rPolyPoly[0].GetSize()) return; - if ( mnDrawMode & ( DrawModeFlags::BlackGradient | DrawModeFlags::WhiteGradient | DrawModeFlags::SettingsGradient) ) + if ( mnDrawMode & ( DrawModeFlags::WhiteGradient | DrawModeFlags::SettingsGradient) ) { Color aColor = GetSingleColorGradientFill(); @@ -593,11 +593,9 @@ Color OutputDevice::GetSingleColorGradientFill() Color aColor; // we should never call on this function if any of these aren't set! - assert( mnDrawMode & ( DrawModeFlags::BlackGradient | DrawModeFlags::WhiteGradient | DrawModeFlags::SettingsGradient) ); + assert( mnDrawMode & ( DrawModeFlags::WhiteGradient | DrawModeFlags::SettingsGradient) ); - if ( mnDrawMode & DrawModeFlags::BlackGradient ) - aColor = COL_BLACK; - else if ( mnDrawMode & DrawModeFlags::WhiteGradient ) + if ( mnDrawMode & DrawModeFlags::WhiteGradient ) aColor = COL_WHITE; else if ( mnDrawMode & DrawModeFlags::SettingsGradient ) { diff --git a/vcl/source/rendercontext/drawmode.cxx b/vcl/source/rendercontext/drawmode.cxx index 2b98b28b25ee..459b86d479d4 100644 --- a/vcl/source/rendercontext/drawmode.cxx +++ b/vcl/source/rendercontext/drawmode.cxx @@ -141,17 +141,12 @@ Color GetTextColor(Color const& rColor, DrawModeFlags nDrawMode, Color aColor(rColor); if (nDrawMode - & (DrawModeFlags::BlackText | DrawModeFlags::WhiteText | DrawModeFlags::GrayText - | DrawModeFlags::SettingsText)) + & (DrawModeFlags::BlackText | DrawModeFlags::GrayText | DrawModeFlags::SettingsText)) { if (nDrawMode & DrawModeFlags::BlackText) { aColor = COL_BLACK; } - else if (nDrawMode & DrawModeFlags::WhiteText) - { - aColor = COL_WHITE; - } else if (nDrawMode & DrawModeFlags::GrayText) { const sal_uInt8 cLum = aColor.GetLuminance(); @@ -175,9 +170,9 @@ vcl::Font GetFont(vcl::Font const& rFont, DrawModeFlags nDrawMode, vcl::Font aFont(rFont); if (nDrawMode - & (DrawModeFlags::BlackText | DrawModeFlags::WhiteText | DrawModeFlags::GrayText - | DrawModeFlags::SettingsText | DrawModeFlags::BlackFill | DrawModeFlags::WhiteFill - | DrawModeFlags::GrayFill | DrawModeFlags::NoFill | DrawModeFlags::SettingsFill)) + & (DrawModeFlags::BlackText | DrawModeFlags::GrayText | DrawModeFlags::SettingsText + | DrawModeFlags::BlackFill | DrawModeFlags::WhiteFill | DrawModeFlags::GrayFill + | DrawModeFlags::NoFill | DrawModeFlags::SettingsFill)) { Color aTextColor(aFont.GetColor()); @@ -185,10 +180,6 @@ vcl::Font GetFont(vcl::Font const& rFont, DrawModeFlags nDrawMode, { aTextColor = COL_BLACK; } - else if (nDrawMode & DrawModeFlags::WhiteText) - { - aTextColor = COL_WHITE; - } else if (nDrawMode & DrawModeFlags::GrayText) { const sal_uInt8 cLum = aTextColor.GetLuminance();
