diff options
author | Chris Sherlock <chris.sherlock79@gmail.com> | 2020-12-24 10:13:09 +1100 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-12-26 19:23:42 +0100 |
commit | 43978d8f25a41c20c72d93cc3cb972c93c52674a (patch) | |
tree | 27dff744dc494a4ca500de87a2d1ede886e08090 | |
parent | a5c1a64555ed0aebc2610ae874bff4713be366a7 (diff) |
tools: add Color::IsTransparent()
This removes the need for OutputDevice::ImplIsColorTransparent().
Change-Id: I8f98199c5ce1c171c453b6897f27eacbd53f1eea
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108248
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r-- | include/tools/color.hxx | 8 | ||||
-rw-r--r-- | solenv/clang-format/excludelist | 1 | ||||
-rw-r--r-- | vcl/inc/outdata.hxx | 32 | ||||
-rw-r--r-- | vcl/source/gdi/pdfwriter_impl.hxx | 7 | ||||
-rw-r--r-- | vcl/source/outdev/outdevstate.cxx | 7 | ||||
-rw-r--r-- | vcl/source/outdev/text.cxx | 3 | ||||
-rw-r--r-- | vcl/source/outdev/transparent.cxx | 3 | ||||
-rw-r--r-- | vcl/win/gdi/gdiimpl.cxx | 1 | ||||
-rw-r--r-- | vcl/win/gdi/salgdi2.cxx | 1 |
9 files changed, 16 insertions, 47 deletions
diff --git a/include/tools/color.hxx b/include/tools/color.hxx index 99966c65d779..964e8ca8d157 100644 --- a/include/tools/color.hxx +++ b/include/tools/color.hxx @@ -142,6 +142,14 @@ public: return A; } + /** Is the color transparent? + * @returns true or false + */ + bool IsTransparent() const + { + return (GetTransparency() != 0); + } + /** Sets the red value. * @param nRed */ diff --git a/solenv/clang-format/excludelist b/solenv/clang-format/excludelist index 2fdd3d6ac821..841d6ba8690e 100644 --- a/solenv/clang-format/excludelist +++ b/solenv/clang-format/excludelist @@ -14559,7 +14559,6 @@ vcl/inc/osx/salprn.h vcl/inc/osx/salsys.h vcl/inc/osx/saltimer.h vcl/inc/osx/vclnsapp.h -vcl/inc/outdata.hxx vcl/inc/outdev.h vcl/inc/ppdparser.hxx vcl/inc/print.h diff --git a/vcl/inc/outdata.hxx b/vcl/inc/outdata.hxx deleted file mode 100644 index 9764a6cda33d..000000000000 --- a/vcl/inc/outdata.hxx +++ /dev/null @@ -1,32 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#ifndef INCLUDED_VCL_INC_OUTDATA_HXX -#define INCLUDED_VCL_INC_OUTDATA_HXX - -#include <tools/color.hxx> - -inline bool ImplIsColorTransparent( Color aColor ) -{ - return aColor.GetTransparency() != 0; -} - -#endif // INCLUDED_VCL_INC_OUTDATA_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/gdi/pdfwriter_impl.hxx b/vcl/source/gdi/pdfwriter_impl.hxx index 00d016ace285..25a2774f7ab7 100644 --- a/vcl/source/gdi/pdfwriter_impl.hxx +++ b/vcl/source/gdi/pdfwriter_impl.hxx @@ -51,7 +51,6 @@ #include <comphelper/hash.hxx> #include <tools/stream.hxx> -#include <outdata.hxx> #include <vcl/filter/pdfobjectcontainer.hxx> #include <pdf/ExternalPDFStreams.hxx> #include "pdffontcache.hxx" @@ -1094,13 +1093,13 @@ public: void setLineColor( const Color& rColor ) { - m_aGraphicsStack.front().m_aLineColor = ImplIsColorTransparent(rColor) ? COL_TRANSPARENT : rColor; + m_aGraphicsStack.front().m_aLineColor = rColor.IsTransparent() ? COL_TRANSPARENT : rColor; m_aGraphicsStack.front().m_nUpdateFlags |= GraphicsStateUpdateFlags::LineColor; } void setFillColor( const Color& rColor ) { - m_aGraphicsStack.front().m_aFillColor = ImplIsColorTransparent(rColor) ? COL_TRANSPARENT : rColor; + m_aGraphicsStack.front().m_aFillColor = rColor.IsTransparent() ? COL_TRANSPARENT : rColor; m_aGraphicsStack.front().m_nUpdateFlags |= GraphicsStateUpdateFlags::FillColor; } @@ -1127,7 +1126,7 @@ public: void setTextFillColor( const Color& rColor ) { m_aGraphicsStack.front().m_aFont.SetFillColor( rColor ); - m_aGraphicsStack.front().m_aFont.SetTransparent( ImplIsColorTransparent( rColor ) ); + m_aGraphicsStack.front().m_aFont.SetTransparent( rColor.IsTransparent() ); m_aGraphicsStack.front().m_nUpdateFlags |= GraphicsStateUpdateFlags::Font; } void setTextFillColor() diff --git a/vcl/source/outdev/outdevstate.cxx b/vcl/source/outdev/outdevstate.cxx index 7b1a22a9ce54..9760e309dad8 100644 --- a/vcl/source/outdev/outdevstate.cxx +++ b/vcl/source/outdev/outdevstate.cxx @@ -28,7 +28,6 @@ #include <vcl/settings.hxx> #include <outdev.h> -#include <outdata.hxx> #include <salgdi.hxx> OutDevState::OutDevState() @@ -334,7 +333,7 @@ void OutputDevice::SetFillColor( const Color& rColor ) DrawModeFlags::GrayFill | DrawModeFlags::NoFill | DrawModeFlags::SettingsFill ) ) { - if( !ImplIsColorTransparent( aColor ) ) + if( !aColor.IsTransparent() ) { if( mnDrawMode & DrawModeFlags::BlackFill ) { @@ -363,7 +362,7 @@ void OutputDevice::SetFillColor( const Color& rColor ) if ( mpMetaFile ) mpMetaFile->AddAction( new MetaFillColorAction( aColor, true ) ); - if ( ImplIsColorTransparent( aColor ) ) + if ( aColor.IsTransparent() ) { if ( mbFillColor ) { @@ -411,7 +410,7 @@ void OutputDevice::SetLineColor( const Color& rColor ) if( mpMetaFile ) mpMetaFile->AddAction( new MetaLineColorAction( aColor, true ) ); - if( ImplIsColorTransparent( aColor ) ) + if( aColor.IsTransparent() ) { if ( mbLineColor ) { diff --git a/vcl/source/outdev/text.cxx b/vcl/source/outdev/text.cxx index c23f93b5ddfb..8b8c5363a2cc 100644 --- a/vcl/source/outdev/text.cxx +++ b/vcl/source/outdev/text.cxx @@ -40,7 +40,6 @@ #include <vcl/toolkit/controllayout.hxx> #include <config_fuzzers.h> -#include <outdata.hxx> #include <outdev.h> #include <salgdi.hxx> #include <svdata.hxx> @@ -714,7 +713,7 @@ void OutputDevice::SetTextFillColor() void OutputDevice::SetTextFillColor( const Color& rColor ) { Color aColor( rColor ); - bool bTransFill = ImplIsColorTransparent( aColor ); + bool bTransFill = aColor.IsTransparent(); if ( !bTransFill ) { diff --git a/vcl/source/outdev/transparent.cxx b/vcl/source/outdev/transparent.cxx index 1fc443511270..5944c9777299 100644 --- a/vcl/source/outdev/transparent.cxx +++ b/vcl/source/outdev/transparent.cxx @@ -31,7 +31,6 @@ #include <vcl/settings.hxx> #include <vcl/virdev.hxx> -#include <outdata.hxx> #include <salgdi.hxx> #include <bitmapwriteaccess.hxx> @@ -84,7 +83,7 @@ Color OutputDevice::ImplDrawModeToColor( const Color& rColor ) const DrawModeFlags::GrayLine | DrawModeFlags::SettingsLine ) ) { - if( !ImplIsColorTransparent( aColor ) ) + if( !aColor.IsTransparent() ) { if( nDrawMode & DrawModeFlags::BlackLine ) { diff --git a/vcl/win/gdi/gdiimpl.cxx b/vcl/win/gdi/gdiimpl.cxx index 4d0638035190..7e524fd5f9ac 100644 --- a/vcl/win/gdi/gdiimpl.cxx +++ b/vcl/win/gdi/gdiimpl.cxx @@ -46,7 +46,6 @@ #include <basegfx/matrix/b2dhommatrixtools.hxx> #include <basegfx/utils/systemdependentdata.hxx> -#include <outdata.hxx> #include <win/salids.hrc> #include <ControlCacheKey.hxx> diff --git a/vcl/win/gdi/salgdi2.cxx b/vcl/win/gdi/salgdi2.cxx index 65c47d0a6a0f..1d2c03526dbc 100644 --- a/vcl/win/gdi/salgdi2.cxx +++ b/vcl/win/gdi/salgdi2.cxx @@ -35,7 +35,6 @@ #include <vcl/BitmapPalette.hxx> #include <vcl/BitmapReadAccess.hxx> #include <vcl/Scanline.hxx> -#include <outdata.hxx> #include <salgdiimpl.hxx> #include <config_features.h> |