[Libreoffice-commits] core.git: 2 commits - compilerplugins/clang connectivity/source cui/source dbaccess/source desktop/source framework/source oox/source package/source sd/source sw/source unoidl/source vcl/backendtest vcl/headless vcl/opengl vcl/qt5 vcl/skia vcl/source vcl/workben xmlscript/source
Noel Grandin (via logerrit)
logerrit at kemper.freedesktop.org
Tue Aug 4 09:22:05 UTC 2020
compilerplugins/clang/buriedassign.cxx | 8
compilerplugins/clang/compat.hxx | 9
compilerplugins/clang/simplifybool.cxx | 2
connectivity/source/drivers/dbase/DTable.cxx | 4
connectivity/source/drivers/firebird/Connection.cxx | 2
cui/source/customize/cfg.cxx | 2
dbaccess/source/core/dataaccess/definitioncontainer.cxx | 5
desktop/source/deployment/registry/package/dp_package.cxx | 2
framework/source/uielement/imagebuttontoolbarcontroller.cxx | 4
oox/source/core/filterdetect.cxx | 4
package/source/manifest/ManifestImport.cxx | 3
sd/source/filter/eppt/pptx-text.cxx | 4
sw/source/core/access/accpara.cxx | 4
sw/source/core/doc/docbm.cxx | 4
sw/source/core/doc/docedt.cxx | 4
sw/source/core/doc/docnum.cxx | 2
sw/source/core/unocore/unomap.cxx | 2
sw/source/filter/ww8/wrtw8nds.cxx | 2
sw/source/uibase/uno/unotxdoc.cxx | 4
unoidl/source/legacyprovider.cxx | 6
vcl/backendtest/VisualBackendTest.cxx | 22
vcl/headless/CustomWidgetDraw.cxx | 44
vcl/headless/svpframe.cxx | 42
vcl/headless/svpgdi.cxx | 48
vcl/opengl/RenderList.cxx | 112 -
vcl/opengl/gdiimpl.cxx | 102 -
vcl/opengl/texture.cxx | 54
vcl/opengl/x11/X11DeviceInfo.cxx | 32
vcl/opengl/x11/gdiimpl.cxx | 26
vcl/qt5/Qt5FilePicker.cxx | 50
vcl/qt5/Qt5Frame.cxx | 164 -
vcl/qt5/Qt5Menu.cxx | 84
vcl/skia/SkiaHelper.cxx | 78
vcl/skia/salbmp.cxx | 22
vcl/skia/zone.cxx | 30
vcl/source/animate/Animation.cxx | 95 -
vcl/source/app/help.cxx | 24
vcl/source/app/salvtables.cxx | 151 -
vcl/source/app/settings.cxx | 24
vcl/source/app/svapp.cxx | 26
vcl/source/app/svdata.cxx | 44
vcl/source/app/unohelp.cxx | 23
vcl/source/bitmap/Octree.cxx | 62
vcl/source/bitmap/bitmap.cxx | 94
vcl/source/control/button.cxx | 426 ++--
vcl/source/control/combobox.cxx | 54
vcl/source/control/edit.cxx | 237 +-
vcl/source/control/field.cxx | 94
vcl/source/control/field2.cxx | 292 +--
vcl/source/control/imp_listbox.cxx | 166 -
vcl/source/control/listbox.cxx | 120 -
vcl/source/control/prgsbar.cxx | 32
vcl/source/control/scrbar.cxx | 101 -
vcl/source/control/slider.cxx | 130 -
vcl/source/control/spinbtn.cxx | 23
vcl/source/control/spinfld.cxx | 142 -
vcl/source/control/tabctrl.cxx | 312 +--
vcl/source/edit/textdata.cxx | 48
vcl/source/edit/texteng.cxx | 102 -
vcl/source/edit/textundo.cxx | 34
vcl/source/edit/textview.cxx | 362 +--
vcl/source/edit/vclmedit.cxx | 64
vcl/source/filter/FilterConfigCache.cxx | 106 -
vcl/source/filter/FilterConfigItem.cxx | 148 -
vcl/source/filter/igif/gifread.cxx | 34
vcl/source/filter/jpeg/JpegReader.cxx | 22
vcl/source/filter/png/pngwrite.cxx | 232 +-
vcl/source/filter/wmf/emfwr.cxx | 186 -
vcl/source/filter/wmf/wmfwr.cxx | 1136 ++++++------
vcl/source/fontsubset/sft.cxx | 62
vcl/source/fontsubset/ttcr.cxx | 86
vcl/source/helper/canvasbitmap.cxx | 484 ++---
vcl/source/opengl/OpenGLHelper.cxx | 32
vcl/source/outdev/bitmap.cxx | 222 +-
vcl/source/outdev/font.cxx | 50
vcl/source/outdev/gradient.cxx | 164 -
vcl/source/outdev/hatch.cxx | 114 -
vcl/source/outdev/mask.cxx | 30
vcl/source/outdev/outdevstate.cxx | 54
vcl/source/outdev/rect.cxx | 58
vcl/source/outdev/textline.cxx | 340 +--
vcl/source/toolkit/group.cxx | 42
vcl/source/treelist/svimpbox.cxx | 78
vcl/workben/vcldemo.cxx | 30
xmlscript/source/xmldlg_imexp/xmldlg_export.cxx | 3
85 files changed, 3990 insertions(+), 3992 deletions(-)
New commits:
commit cda88ec7a43162df37098c4525c33451266a1575
Author: Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Tue Aug 4 08:45:36 2020 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Tue Aug 4 11:21:36 2020 +0200
loplugin:simplifybool a little more aggressive
with expressions like !(a && b)
Change-Id: Id2acec2a8d0eaaa8e5e37dbd2cae7281be36572e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100040
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/compilerplugins/clang/buriedassign.cxx b/compilerplugins/clang/buriedassign.cxx
index 1758a4fcbca8..658ad4789d87 100644
--- a/compilerplugins/clang/buriedassign.cxx
+++ b/compilerplugins/clang/buriedassign.cxx
@@ -255,12 +255,6 @@ static bool isAssignmentOp(clang::OverloadedOperatorKind Opc)
|| Opc == OO_AmpEqual || Opc == OO_CaretEqual || Opc == OO_PipeEqual;
}
-static bool isComparisonOp(clang::OverloadedOperatorKind op)
-{
- return op == OO_Less || op == OO_Greater || op == OO_LessEqual || op == OO_GreaterEqual
- || op == OO_EqualEqual || op == OO_ExclaimEqual;
-}
-
static const Expr* IgnoreImplicitAndConversionOperator(const Expr* expr)
{
expr = compat::IgnoreImplicit(expr);
@@ -570,7 +564,7 @@ void BuriedAssign::MarkConditionForControlLoops(Expr const* expr)
else if (auto cxxOper = dyn_cast<CXXOperatorCallExpr>(expr))
{
// handle: ((xxx = foo()) != error)
- if (isComparisonOp(cxxOper->getOperator()))
+ if (compat::isComparisonOp(cxxOper))
{
MarkIfAssignment(compat::IgnoreImplicit(cxxOper->getArg(0))->IgnoreParens());
MarkIfAssignment(compat::IgnoreImplicit(cxxOper->getArg(1))->IgnoreParens());
diff --git a/compilerplugins/clang/compat.hxx b/compilerplugins/clang/compat.hxx
index ed9d3ec942dc..fb8791f978b4 100644
--- a/compilerplugins/clang/compat.hxx
+++ b/compilerplugins/clang/compat.hxx
@@ -300,6 +300,15 @@ inline clang::QualType getDeclaredReturnType(clang::FunctionDecl const * decl) {
#endif
}
+// The isComparisonOp method on CXXOperatorCallExpr is not available yet for the clang we require
+inline bool isComparisonOp(clang::CXXOperatorCallExpr const * callExpr)
+{
+ using namespace clang;
+ auto op = callExpr->getOperator();
+ return op == OO_Less || op == OO_Greater || op == OO_LessEqual || op == OO_GreaterEqual
+ || op == OO_EqualEqual || op == OO_ExclaimEqual;
+}
+
}
#endif
diff --git a/compilerplugins/clang/simplifybool.cxx b/compilerplugins/clang/simplifybool.cxx
index ff50cb47f0c7..89c262f54c98 100644
--- a/compilerplugins/clang/simplifybool.cxx
+++ b/compilerplugins/clang/simplifybool.cxx
@@ -302,7 +302,7 @@ bool SimplifyBool::VisitUnaryOperator(UnaryOperator const * expr) {
if (binaryOp->isComparisonOp())
return expr;
if (auto cxxOpCall = dyn_cast<CXXOperatorCallExpr>(expr))
- if (cxxOpCall->getOperator() == OO_ExclaimEqual)
+ if (compat::isComparisonOp(cxxOpCall))
return expr;
return (Expr const*)nullptr;
};
diff --git a/connectivity/source/drivers/dbase/DTable.cxx b/connectivity/source/drivers/dbase/DTable.cxx
index ff01f3b6ba37..7ad53b04c97d 100644
--- a/connectivity/source/drivers/dbase/DTable.cxx
+++ b/connectivity/source/drivers/dbase/DTable.cxx
@@ -708,8 +708,8 @@ Sequence< Type > SAL_CALL ODbaseTable::getTypes( )
const Type* pEnd = pBegin + aTypes.getLength();
for(;pBegin != pEnd;++pBegin)
{
- if(!(*pBegin == cppu::UnoType<XKeysSupplier>::get()||
- *pBegin == cppu::UnoType<XDataDescriptorFactory>::get()))
+ if(*pBegin != cppu::UnoType<XKeysSupplier>::get() &&
+ *pBegin != cppu::UnoType<XDataDescriptorFactory>::get())
{
aOwnTypes.push_back(*pBegin);
}
diff --git a/connectivity/source/drivers/firebird/Connection.cxx b/connectivity/source/drivers/firebird/Connection.cxx
index 6e42831f21d5..7a41724f3bfa 100644
--- a/connectivity/source/drivers/firebird/Connection.cxx
+++ b/connectivity/source/drivers/firebird/Connection.cxx
@@ -791,7 +791,7 @@ void SAL_CALL Connection::documentEventOccured( const DocumentEvent& Event )
if (!m_bIsEmbedded)
return;
- if (!(Event.EventName == "OnSave" || Event.EventName == "OnSaveAs"))
+ if (Event.EventName != "OnSave" && Event.EventName != "OnSaveAs")
return;
commit(); // Commit and close transaction
diff --git a/cui/source/customize/cfg.cxx b/cui/source/customize/cfg.cxx
index 401f48f7a664..29f34e3f17a0 100644
--- a/cui/source/customize/cfg.cxx
+++ b/cui/source/customize/cfg.cxx
@@ -159,7 +159,7 @@ void printEntries(SvxEntries* entries)
bool
SvxConfigPage::CanConfig( const OUString& aModuleId )
{
- return !(aModuleId == "com.sun.star.script.BasicIDE" || aModuleId == "com.sun.star.frame.Bibliography");
+ return aModuleId != "com.sun.star.script.BasicIDE" && aModuleId != "com.sun.star.frame.Bibliography";
}
static std::unique_ptr<SfxTabPage> CreateSvxMenuConfigPage( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rSet )
diff --git a/dbaccess/source/core/dataaccess/definitioncontainer.cxx b/dbaccess/source/core/dataaccess/definitioncontainer.cxx
index dd099c81fa05..4788c4d03d7a 100644
--- a/dbaccess/source/core/dataaccess/definitioncontainer.cxx
+++ b/dbaccess/source/core/dataaccess/definitioncontainer.cxx
@@ -601,10 +601,11 @@ void ODefinitionContainer::approveNewObject(const OUString& _sName,const Referen
// XPropertyChangeListener
void SAL_CALL ODefinitionContainer::propertyChange( const PropertyChangeEvent& evt )
{
- MutexGuard aGuard(m_aMutex);
- if( !(evt.PropertyName == PROPERTY_NAME || evt.PropertyName == "Title") )
+ if( evt.PropertyName != PROPERTY_NAME && evt.PropertyName != "Title" )
return;
+ MutexGuard aGuard(m_aMutex);
+
m_bInPropertyChange = true;
try
{
diff --git a/desktop/source/deployment/registry/package/dp_package.cxx b/desktop/source/deployment/registry/package/dp_package.cxx
index 890fa3612a42..a6d099db9f5c 100644
--- a/desktop/source/deployment/registry/package/dp_package.cxx
+++ b/desktop/source/deployment/registry/package/dp_package.cxx
@@ -636,7 +636,7 @@ bool BackendImpl::PackageImpl::checkLicense(
OUString sLicense = getTextFromURL(xCmdEnv, sHref);
////determine who has to agree to the license
//check correct value for attribute
- if ( ! (simplLicAttr->acceptBy == "user" || simplLicAttr->acceptBy == "admin"))
+ if ( simplLicAttr->acceptBy != "user" && simplLicAttr->acceptBy != "admin")
throw css::deployment::DeploymentException(
"Could not obtain attribute simple-license at accept-by or it has no valid value", nullptr, Any());
diff --git a/framework/source/uielement/imagebuttontoolbarcontroller.cxx b/framework/source/uielement/imagebuttontoolbarcontroller.cxx
index c14606db0000..19107d374019 100644
--- a/framework/source/uielement/imagebuttontoolbarcontroller.cxx
+++ b/framework/source/uielement/imagebuttontoolbarcontroller.cxx
@@ -83,8 +83,8 @@ void ImageButtonToolbarController::executeControlCommand( const css::frame::Cont
{
SolarMutexGuard aSolarMutexGuard;
// i73486 to be downward compatible use old and "wrong" also!
- if( !(rControlCommand.Command == "SetImag" ||
- rControlCommand.Command == "SetImage") )
+ if( rControlCommand.Command != "SetImag" &&
+ rControlCommand.Command != "SetImage" )
return;
for ( const NamedValue& rArg : rControlCommand.Arguments )
diff --git a/oox/source/core/filterdetect.cxx b/oox/source/core/filterdetect.cxx
index 0ab68688c9be..b57c4696cb13 100644
--- a/oox/source/core/filterdetect.cxx
+++ b/oox/source/core/filterdetect.cxx
@@ -152,8 +152,8 @@ void FilterDetectDocHandler::parseRelationship( const AttributeList& rAttribs )
else if (aType.startsWithIgnoreAsciiCase("http://purl.oclc.org/ooxml/officeDocument"))
maOOXMLVariant = OOXMLVariant::ISO_Strict;
- if ( !(aType == "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" // OOXML Transitional
- || aType == "http://purl.oclc.org/ooxml/officeDocument/relationships/officeDocument") ) //OOXML strict
+ if ( aType != "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" // OOXML Transitional
+ && aType != "http://purl.oclc.org/ooxml/officeDocument/relationships/officeDocument" ) //OOXML strict
return;
Reference<XUriReferenceFactory> xFactory = UriReferenceFactory::create( mxContext );
diff --git a/package/source/manifest/ManifestImport.cxx b/package/source/manifest/ManifestImport.cxx
index 9e3508361b56..e6c7598a2901 100644
--- a/package/source/manifest/ManifestImport.cxx
+++ b/package/source/manifest/ManifestImport.cxx
@@ -452,7 +452,8 @@ void SAL_CALL ManifestImport::endElement( const OUString& aName )
assert(nLevel >= 1);
OUString aConvertedName = ConvertName( aName );
- if ( !(!aStack.empty() && aStack.rbegin()->m_aConvertedName == aConvertedName) ) return;
+ if ( aStack.empty() || aStack.rbegin()->m_aConvertedName != aConvertedName )
+ return;
if ( aConvertedName == gsFileEntryElement && aStack.back().m_bValid ) {
// root folder gets KeyInfo entry if any, for PGP encryption
diff --git a/sd/source/filter/eppt/pptx-text.cxx b/sd/source/filter/eppt/pptx-text.cxx
index 81b1df15356d..fba25161b2e7 100644
--- a/sd/source/filter/eppt/pptx-text.cxx
+++ b/sd/source/filter/eppt/pptx-text.cxx
@@ -864,9 +864,7 @@ void ParagraphObj::ImplGetNumberingLevel( PPTExBulletProvider* pBuProv, sal_Int1
else if ( aPropName == "Suffix" )
sSuffix = *o3tl::doAccess<OUString>(rPropValue.Value);
#ifdef DBG_UTIL
- else if ( ! (
- ( aPropName == "SymbolTextDistance" )
- || ( aPropName == "GraphicBitmap" ) ) )
+ else if ( aPropName != "SymbolTextDistance" && aPropName != "GraphicBitmap" )
{
OSL_FAIL( "Unknown Property" );
}
diff --git a/sw/source/core/access/accpara.cxx b/sw/source/core/access/accpara.cxx
index b39f4c9439ef..9da830b9b2b9 100644
--- a/sw/source/core/access/accpara.cxx
+++ b/sw/source/core/access/accpara.cxx
@@ -2921,8 +2921,8 @@ sal_Int32 SAL_CALL SwAccessibleParagraph::getHyperLinkIndex( sal_Int32 nCharInde
sal_Int32 nPos = 0;
SwTextNode const* pNode(nullptr);
const SwTextAttr *pHt = aHIter.next(&pNode);
- while (pHt && !(nIdx >= pTextFrame->MapModelToView(pNode, pHt->GetStart())
- && nIdx < pTextFrame->MapModelToView(pNode, pHt->GetAnyEnd())))
+ while (pHt && (nIdx < pTextFrame->MapModelToView(pNode, pHt->GetStart())
+ || nIdx >= pTextFrame->MapModelToView(pNode, pHt->GetAnyEnd())))
{
pHt = aHIter.next(&pNode);
nPos++;
diff --git a/sw/source/core/doc/docbm.cxx b/sw/source/core/doc/docbm.cxx
index 002582c6cb4a..a6ecd452e576 100644
--- a/sw/source/core/doc/docbm.cxx
+++ b/sw/source/core/doc/docbm.cxx
@@ -1016,8 +1016,8 @@ namespace sw::mark
bDeleteMark = rbIsOtherPosInRange
|| pMark->IsExpanded()
|| pSttIdx == nullptr
- || !( pMark->GetMarkPos().nNode == rStt
- && pMark->GetMarkPos().nContent == *pSttIdx );
+ || pMark->GetMarkPos().nNode != rStt
+ || pMark->GetMarkPos().nContent != *pSttIdx;
break;
default:
bDeleteMark = true;
diff --git a/sw/source/core/doc/docedt.cxx b/sw/source/core/doc/docedt.cxx
index ceb7ada2f865..5eadf937b53e 100644
--- a/sw/source/core/doc/docedt.cxx
+++ b/sw/source/core/doc/docedt.cxx
@@ -161,8 +161,8 @@ void SaveFlyInRange( const SwPaM& rPam, const SwPosition& rInsPos,
(RndStdIds::FLY_AT_CHAR == pAnchor->GetAnchorId())) &&
// do not move if the InsPos is in the ContentArea of the Fly
( nullptr == ( pContentIdx = pFormat->GetContent().GetContentIdx() ) ||
- !(*pContentIdx < rInsPos.nNode &&
- rInsPos.nNode < pContentIdx->GetNode().EndOfSectionIndex())))
+ (*pContentIdx >= rInsPos.nNode ||
+ rInsPos.nNode >= pContentIdx->GetNode().EndOfSectionIndex())))
{
bool bInsPos = false;
diff --git a/sw/source/core/doc/docnum.cxx b/sw/source/core/doc/docnum.cxx
index 477f83220f32..0f03a9265670 100644
--- a/sw/source/core/doc/docnum.cxx
+++ b/sw/source/core/doc/docnum.cxx
@@ -2119,7 +2119,7 @@ bool SwDoc::MoveParagraphImpl(SwPaM& rPam, long const nOffset,
}
if( pOwnRedl &&
- !( pRStt->nNode <= aIdx && aIdx <= pREnd->nNode ))
+ ( pRStt->nNode > aIdx || aIdx > pREnd->nNode ))
{
// it's not in itself, so don't move it
pOwnRedl = nullptr;
diff --git a/sw/source/core/unocore/unomap.cxx b/sw/source/core/unocore/unomap.cxx
index 8da991f62451..093f8972c749 100644
--- a/sw/source/core/unocore/unomap.cxx
+++ b/sw/source/core/unocore/unomap.cxx
@@ -700,7 +700,7 @@ const SfxItemPropertyMapEntry* SwUnoPropertyMapProvider::GetPropertyMapEntries(s
!pMap->aName.isEmpty(); ++pMap )
{
// OUString(UNO_NAME_PAGE_DESC_NAME) should keep its MAYBEVOID flag
- if (!(RES_PAGEDESC == pMap->nWID && MID_PAGEDESC_PAGEDESCNAME == pMap->nMemberId))
+ if (RES_PAGEDESC != pMap->nWID || MID_PAGEDESC_PAGEDESCNAME != pMap->nMemberId)
pMap->nFlags &= ~PropertyAttribute::MAYBEVOID;
}
}
diff --git a/sw/source/filter/ww8/wrtw8nds.cxx b/sw/source/filter/ww8/wrtw8nds.cxx
index 2e19f4e5bae6..85b215f790c8 100644
--- a/sw/source/filter/ww8/wrtw8nds.cxx
+++ b/sw/source/filter/ww8/wrtw8nds.cxx
@@ -1509,7 +1509,7 @@ const SwRedlineData* SwWW8AttrIter::GetRunLevelRedline( sal_Int32 nPos )
if( pCurRedline )
{
const SwPosition* pEnd = pCurRedline->End();
- if (!(pEnd->nNode == rNd && pEnd->nContent.GetIndex() <= nPos))
+ if (pEnd->nNode != rNd || pEnd->nContent.GetIndex() > nPos)
{
switch( pCurRedline->GetType() )
{
diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx
index 11ef3d90df17..00cefea1e109 100644
--- a/sw/source/uibase/uno/unotxdoc.cxx
+++ b/sw/source/uibase/uno/unotxdoc.cxx
@@ -3363,11 +3363,11 @@ void SwXTextDocument::getPostIts(tools::JsonWriter& rJsonWriter)
void SwXTextDocument::executeFromFieldEvent(const StringMap& aArguments)
{
auto aIter = aArguments.find("type");
- if (!(aIter != aArguments.end() && aIter->second == "drop-down"))
+ if (aIter == aArguments.end() || aIter->second != "drop-down")
return;
aIter = aArguments.find("cmd");
- if (!(aIter != aArguments.end() && aIter->second == "selected"))
+ if (aIter == aArguments.end() || aIter->second != "selected")
return;
aIter = aArguments.find("data");
diff --git a/unoidl/source/legacyprovider.cxx b/unoidl/source/legacyprovider.cxx
index 3b57ee5fdcdc..a5062cdeb8d0 100644
--- a/unoidl/source/legacyprovider.cxx
+++ b/unoidl/source/legacyprovider.cxx
@@ -628,10 +628,10 @@ rtl::Reference< Entity > readEntity(
+ sub.getName()));
}
if ((mode & RT_PARAM_REST) != 0
- && !(m == 1
- && ((reader.getMethodParameterTypeName(
+ && (m != 1
+ || ((reader.getMethodParameterTypeName(
j, 0))
- == "any")))
+ != "any")))
{
throw FileFormatException(
key.getRegistryName(),
diff --git a/xmlscript/source/xmldlg_imexp/xmldlg_export.cxx b/xmlscript/source/xmldlg_imexp/xmldlg_export.cxx
index 32c61ad72497..23dc6c0a90fc 100644
--- a/xmlscript/source/xmldlg_imexp/xmldlg_export.cxx
+++ b/xmlscript/source/xmldlg_imexp/xmldlg_export.cxx
@@ -984,7 +984,8 @@ void ElementDescriptor::readSelectionTypeAttr( OUString const & rPropName, OUStr
Any aSelectionType ( _xProps->getPropertyValue( rPropName ) );
- if (!(aSelectionType.getValueTypeClass() == TypeClass_ENUM && aSelectionType.getValueType() == cppu::UnoType<view::SelectionType>::get()))
+ if (aSelectionType.getValueTypeClass() != TypeClass_ENUM ||
+ aSelectionType.getValueType() != cppu::UnoType<view::SelectionType>::get())
return;
::view::SelectionType eSelectionType;
commit f45ff1a7147e6a9479c669f082dd74349c6bcb4b
Author: Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Tue Aug 4 09:22:10 2020 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Tue Aug 4 11:21:22 2020 +0200
loplugin:flatten in vcl
Change-Id: I271cc67ecf34acbf0edbda960e33315fb6a1f9dc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100041
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/vcl/backendtest/VisualBackendTest.cxx b/vcl/backendtest/VisualBackendTest.cxx
index b3e1b3eb144c..858ae7b996f1 100644
--- a/vcl/backendtest/VisualBackendTest.cxx
+++ b/vcl/backendtest/VisualBackendTest.cxx
@@ -127,18 +127,18 @@ public:
else if(nCode == KEY_SPACE)
mnTest++;
- if (nCode == KEY_BACKSPACE || nCode == KEY_SPACE)
+ if (nCode != KEY_BACKSPACE && nCode != KEY_SPACE)
+ return;
+
+ if (mnTest % gnNumberOfTests == gnNumberOfTests - 1)
{
- if (mnTest % gnNumberOfTests == gnNumberOfTests - 1)
- {
- mbAnimate = true;
- maUpdateTimer.Start();
- }
- else
- {
- mbAnimate = false;
- Invalidate();
- }
+ mbAnimate = true;
+ maUpdateTimer.Start();
+ }
+ else
+ {
+ mbAnimate = false;
+ Invalidate();
}
}
diff --git a/vcl/headless/CustomWidgetDraw.cxx b/vcl/headless/CustomWidgetDraw.cxx
index 600875d5c4ca..6a1346a4aaf6 100644
--- a/vcl/headless/CustomWidgetDraw.cxx
+++ b/vcl/headless/CustomWidgetDraw.cxx
@@ -25,30 +25,30 @@ CustomWidgetDraw::CustomWidgetDraw(SvpSalGraphics& rGraphics)
{
#ifndef DISABLE_DYNLOADING
static bool s_bMissingLibrary = false;
- if (!s_pWidgetImplementation && !s_bMissingLibrary)
+ if (s_pWidgetImplementation || s_bMissingLibrary)
+ return;
+
+ OUString aUrl("${LO_LIB_DIR}/" SVLIBRARY("vcl_widget_theme"));
+ rtl::Bootstrap::expandMacros(aUrl);
+ osl::Module aLibrary;
+ aLibrary.load(aUrl, SAL_LOADMODULE_GLOBAL);
+ auto fCreateWidgetThemeLibraryFunction
+ = reinterpret_cast<vcl::WidgetThemeLibrary*(SAL_CALL*)()>(
+ aLibrary.getFunctionSymbol("CreateWidgetThemeLibrary"));
+ aLibrary.release();
+
+ if (fCreateWidgetThemeLibraryFunction)
+ s_pWidgetImplementation = (*fCreateWidgetThemeLibraryFunction)();
+
+ // Init
+ if (s_pWidgetImplementation)
{
- OUString aUrl("${LO_LIB_DIR}/" SVLIBRARY("vcl_widget_theme"));
- rtl::Bootstrap::expandMacros(aUrl);
- osl::Module aLibrary;
- aLibrary.load(aUrl, SAL_LOADMODULE_GLOBAL);
- auto fCreateWidgetThemeLibraryFunction
- = reinterpret_cast<vcl::WidgetThemeLibrary*(SAL_CALL*)()>(
- aLibrary.getFunctionSymbol("CreateWidgetThemeLibrary"));
- aLibrary.release();
-
- if (fCreateWidgetThemeLibraryFunction)
- s_pWidgetImplementation = (*fCreateWidgetThemeLibraryFunction)();
-
- // Init
- if (s_pWidgetImplementation)
- {
- ImplSVData* pSVData = ImplGetSVData();
- pSVData->maNWFData.mbNoFocusRects = true;
- pSVData->maNWFData.mbNoFocusRectsForFlatButtons = true;
- }
- else
- s_bMissingLibrary = true;
+ ImplSVData* pSVData = ImplGetSVData();
+ pSVData->maNWFData.mbNoFocusRects = true;
+ pSVData->maNWFData.mbNoFocusRectsForFlatButtons = true;
}
+ else
+ s_bMissingLibrary = true;
#endif
}
diff --git a/vcl/headless/svpframe.cxx b/vcl/headless/svpframe.cxx
index e38e14e18d7e..89af9b272185 100644
--- a/vcl/headless/svpframe.cxx
+++ b/vcl/headless/svpframe.cxx
@@ -310,27 +310,27 @@ void SvpSalFrame::SetWindowState( const SalFrameState *pState )
return;
// Request for position or size change
- if (pState->mnMask & FRAMESTATE_MASK_GEOMETRY)
- {
- long nX = maGeometry.nX;
- long nY = maGeometry.nY;
- long nWidth = maGeometry.nWidth;
- long nHeight = maGeometry.nHeight;
-
- // change requested properties
- if (pState->mnMask & WindowStateMask::X)
- nX = pState->mnX;
- if (pState->mnMask & WindowStateMask::Y)
- nY = pState->mnY;
- if (pState->mnMask & WindowStateMask::Width)
- nWidth = pState->mnWidth;
- if (pState->mnMask & WindowStateMask::Height)
- nHeight = pState->mnHeight;
-
- SetPosSize( nX, nY, nWidth, nHeight,
- SAL_FRAME_POSSIZE_X | SAL_FRAME_POSSIZE_Y |
- SAL_FRAME_POSSIZE_WIDTH | SAL_FRAME_POSSIZE_HEIGHT );
- }
+ if (!(pState->mnMask & FRAMESTATE_MASK_GEOMETRY))
+ return;
+
+ long nX = maGeometry.nX;
+ long nY = maGeometry.nY;
+ long nWidth = maGeometry.nWidth;
+ long nHeight = maGeometry.nHeight;
+
+ // change requested properties
+ if (pState->mnMask & WindowStateMask::X)
+ nX = pState->mnX;
+ if (pState->mnMask & WindowStateMask::Y)
+ nY = pState->mnY;
+ if (pState->mnMask & WindowStateMask::Width)
+ nWidth = pState->mnWidth;
+ if (pState->mnMask & WindowStateMask::Height)
+ nHeight = pState->mnHeight;
+
+ SetPosSize( nX, nY, nWidth, nHeight,
+ SAL_FRAME_POSSIZE_X | SAL_FRAME_POSSIZE_Y |
+ SAL_FRAME_POSSIZE_WIDTH | SAL_FRAME_POSSIZE_HEIGHT );
}
bool SvpSalFrame::GetWindowState( SalFrameState* pState )
diff --git a/vcl/headless/svpgdi.cxx b/vcl/headless/svpgdi.cxx
index 9f1a56e18e8c..f8276b57c542 100644
--- a/vcl/headless/svpgdi.cxx
+++ b/vcl/headless/svpgdi.cxx
@@ -618,19 +618,19 @@ namespace
}
}
- if(!rSurface)
- {
- // create data on-demand
- rSurface = std::make_shared<BitmapHelper>(rSourceBitmap);
+ if(rSurface)
+ return;
- if(bBufferSource)
- {
- // add to buffering mechanism to potentially reuse next time
- const SvpSalBitmap& rSrcBmp(static_cast<const SvpSalBitmap&>(rSourceBitmap));
- rSrcBmp.addOrReplaceSystemDependentData<SystemDependentData_BitmapHelper>(
- ImplGetSystemDependentDataManager(),
- rSurface);
- }
+ // create data on-demand
+ rSurface = std::make_shared<BitmapHelper>(rSourceBitmap);
+
+ if(bBufferSource)
+ {
+ // add to buffering mechanism to potentially reuse next time
+ const SvpSalBitmap& rSrcBmp(static_cast<const SvpSalBitmap&>(rSourceBitmap));
+ rSrcBmp.addOrReplaceSystemDependentData<SystemDependentData_BitmapHelper>(
+ ImplGetSystemDependentDataManager(),
+ rSurface);
}
}
@@ -655,19 +655,19 @@ namespace
}
}
- if(!rMask)
- {
- // create data on-demand
- rMask = std::make_shared<MaskHelper>(rMaskBitmap);
+ if(rMask)
+ return;
- if(bBufferMask)
- {
- // add to buffering mechanism to potentially reuse next time
- const SvpSalBitmap& rSrcBmp(static_cast<const SvpSalBitmap&>(rMaskBitmap));
- rSrcBmp.addOrReplaceSystemDependentData<SystemDependentData_MaskHelper>(
- ImplGetSystemDependentDataManager(),
- rMask);
- }
+ // create data on-demand
+ rMask = std::make_shared<MaskHelper>(rMaskBitmap);
+
+ if(bBufferMask)
+ {
+ // add to buffering mechanism to potentially reuse next time
+ const SvpSalBitmap& rSrcBmp(static_cast<const SvpSalBitmap&>(rMaskBitmap));
+ rSrcBmp.addOrReplaceSystemDependentData<SystemDependentData_MaskHelper>(
+ ImplGetSystemDependentDataManager(),
+ rMask);
}
}
}
diff --git a/vcl/opengl/RenderList.cxx b/vcl/opengl/RenderList.cxx
index 4830f1040de9..e894bb67ce50 100644
--- a/vcl/opengl/RenderList.cxx
+++ b/vcl/opengl/RenderList.cxx
@@ -127,24 +127,24 @@ void appendPolyLine(vcl::LineBuilder& rBuilder, const basegfx::B2DPolygon& rPoly
}
}
- if (!bClosed && nPoints >= 2 && (eLineCap == css::drawing::LineCap_ROUND || eLineCap == css::drawing::LineCap_SQUARE))
- {
- glm::vec2 aBeginCapPoint1(rPolygon.getB2DPoint(0).getX(), rPolygon.getB2DPoint(0).getY());
- glm::vec2 aBeginCapPoint2(rPolygon.getB2DPoint(1).getX(), rPolygon.getB2DPoint(1).getY());
+ if (bClosed || nPoints < 2 || (eLineCap != css::drawing::LineCap_ROUND && eLineCap != css::drawing::LineCap_SQUARE))
+ return;
- glm::vec2 aEndCapPoint1(rPolygon.getB2DPoint(nPoints - 1).getX(), rPolygon.getB2DPoint(nPoints - 1).getY());
- glm::vec2 aEndCapPoint2(rPolygon.getB2DPoint(nPoints - 2).getX(), rPolygon.getB2DPoint(nPoints - 2).getY());
+ glm::vec2 aBeginCapPoint1(rPolygon.getB2DPoint(0).getX(), rPolygon.getB2DPoint(0).getY());
+ glm::vec2 aBeginCapPoint2(rPolygon.getB2DPoint(1).getX(), rPolygon.getB2DPoint(1).getY());
- if (eLineCap == css::drawing::LineCap_ROUND)
- {
- rBuilder.appendRoundLineCapVertices(aBeginCapPoint1, aBeginCapPoint2);
- rBuilder.appendRoundLineCapVertices(aEndCapPoint1, aEndCapPoint2);
- }
- else if (eLineCap == css::drawing::LineCap_SQUARE)
- {
- rBuilder.appendSquareLineCapVertices(aBeginCapPoint1, aBeginCapPoint2);
- rBuilder.appendSquareLineCapVertices(aEndCapPoint1, aEndCapPoint2);
- }
+ glm::vec2 aEndCapPoint1(rPolygon.getB2DPoint(nPoints - 1).getX(), rPolygon.getB2DPoint(nPoints - 1).getY());
+ glm::vec2 aEndCapPoint2(rPolygon.getB2DPoint(nPoints - 2).getX(), rPolygon.getB2DPoint(nPoints - 2).getY());
+
+ if (eLineCap == css::drawing::LineCap_ROUND)
+ {
+ rBuilder.appendRoundLineCapVertices(aBeginCapPoint1, aBeginCapPoint2);
+ rBuilder.appendRoundLineCapVertices(aEndCapPoint1, aEndCapPoint2);
+ }
+ else if (eLineCap == css::drawing::LineCap_SQUARE)
+ {
+ rBuilder.appendSquareLineCapVertices(aBeginCapPoint1, aBeginCapPoint2);
+ rBuilder.appendSquareLineCapVertices(aEndCapPoint1, aEndCapPoint2);
}
}
@@ -237,23 +237,23 @@ void RenderList::addDrawRectangle(long nX, long nY, long nWidth, long nHeight, d
fX1 - 0.5f, fY2 - 0.5f, fX2 + 0.5f, fY2 + 0.5f, nLineColor, fTransparency);
}
- if (nFillColor != SALCOLOR_NONE)
+ if (nFillColor == SALCOLOR_NONE)
+ return;
+
+ if (nLineColor == SALCOLOR_NONE)
{
- if (nLineColor == SALCOLOR_NONE)
- {
- appendRectangle(rRenderParameter.maVertices, rRenderParameter.maIndices,
- fX1 - 0.5f, fY1 - 0.5f, fX1 + 0.5f, fY2 + 0.5f, nFillColor, fTransparency);
- appendRectangle(rRenderParameter.maVertices, rRenderParameter.maIndices,
- fX1 - 0.5f, fY1 - 0.5f, fX2 + 0.5f, fY1 + 0.5f, nFillColor, fTransparency);
- appendRectangle(rRenderParameter.maVertices, rRenderParameter.maIndices,
- fX2 - 0.5f, fY1 - 0.5f, fX2 + 0.5f, fY2 + 0.5f, nFillColor, fTransparency);
- appendRectangle(rRenderParameter.maVertices, rRenderParameter.maIndices,
- fX1 - 0.5f, fY2 - 0.5f, fX2 + 0.5f, fY2 + 0.5f, nFillColor, fTransparency);
- }
- // Draw rectangle fill with fill color
appendRectangle(rRenderParameter.maVertices, rRenderParameter.maIndices,
- fX1 + 0.5f, fY1 + 0.5f, fX2 - 0.5f, fY2 - 0.5f, nFillColor, fTransparency);
+ fX1 - 0.5f, fY1 - 0.5f, fX1 + 0.5f, fY2 + 0.5f, nFillColor, fTransparency);
+ appendRectangle(rRenderParameter.maVertices, rRenderParameter.maIndices,
+ fX1 - 0.5f, fY1 - 0.5f, fX2 + 0.5f, fY1 + 0.5f, nFillColor, fTransparency);
+ appendRectangle(rRenderParameter.maVertices, rRenderParameter.maIndices,
+ fX2 - 0.5f, fY1 - 0.5f, fX2 + 0.5f, fY2 + 0.5f, nFillColor, fTransparency);
+ appendRectangle(rRenderParameter.maVertices, rRenderParameter.maIndices,
+ fX1 - 0.5f, fY2 - 0.5f, fX2 + 0.5f, fY2 + 0.5f, nFillColor, fTransparency);
}
+ // Draw rectangle fill with fill color
+ appendRectangle(rRenderParameter.maVertices, rRenderParameter.maIndices,
+ fX1 + 0.5f, fY1 + 0.5f, fX2 - 0.5f, fY2 - 0.5f, nFillColor, fTransparency);
}
void RenderList::addDrawLine(long nX1, long nY1, long nX2, long nY2, Color nLineColor, bool bUseAA)
@@ -311,39 +311,39 @@ void RenderList::addDrawPolyPolygon(const basegfx::B2DPolyPolygon& rPolyPolygon,
}
}
- if (nLineColor != SALCOLOR_NONE || bUseAA)
- {
- RenderParameters& rLineRenderParameter = maRenderEntries.back().maLineParameters;
- Color nColor = (nLineColor == SALCOLOR_NONE) ? nFillColor : nLineColor;
+ if (nLineColor == SALCOLOR_NONE && !bUseAA)
+ return;
- vcl::LineBuilder aBuilder(rLineRenderParameter.maVertices, rLineRenderParameter.maIndices,
- nColor, fTransparency, 1.0f, bUseAA);
+ RenderParameters& rLineRenderParameter = maRenderEntries.back().maLineParameters;
+ Color nColor = (nLineColor == SALCOLOR_NONE) ? nFillColor : nLineColor;
- for (const basegfx::B2DPolygon& rPolygon : rPolyPolygon)
- {
- basegfx::B2DPolygon aPolygon(rPolygon);
- if (rPolygon.areControlPointsUsed())
- aPolygon = rPolygon.getDefaultAdaptiveSubdivision();
+ vcl::LineBuilder aBuilder(rLineRenderParameter.maVertices, rLineRenderParameter.maIndices,
+ nColor, fTransparency, 1.0f, bUseAA);
- sal_uInt32 nPoints = aPolygon.count();
- if (nPoints <= 1)
- continue;
+ for (const basegfx::B2DPolygon& rPolygon : rPolyPolygon)
+ {
+ basegfx::B2DPolygon aPolygon(rPolygon);
+ if (rPolygon.areControlPointsUsed())
+ aPolygon = rPolygon.getDefaultAdaptiveSubdivision();
- GLfloat x1, y1, x2, y2;
- sal_uInt32 index1, index2;
+ sal_uInt32 nPoints = aPolygon.count();
+ if (nPoints <= 1)
+ continue;
- for (sal_uInt32 i = 0; i <= nPoints; ++i)
- {
- index1 = i % nPoints;
- index2 = (i + 1) % nPoints;
+ GLfloat x1, y1, x2, y2;
+ sal_uInt32 index1, index2;
- x1 = aPolygon.getB2DPoint(index1).getX();
- y1 = aPolygon.getB2DPoint(index1).getY();
- x2 = aPolygon.getB2DPoint(index2).getX();
- y2 = aPolygon.getB2DPoint(index2).getY();
+ for (sal_uInt32 i = 0; i <= nPoints; ++i)
+ {
+ index1 = i % nPoints;
+ index2 = (i + 1) % nPoints;
- aBuilder.appendLine(glm::vec2(x1, y1), glm::vec2(x2, y2));
- }
+ x1 = aPolygon.getB2DPoint(index1).getX();
+ y1 = aPolygon.getB2DPoint(index1).getY();
+ x2 = aPolygon.getB2DPoint(index2).getX();
+ y2 = aPolygon.getB2DPoint(index2).getY();
+
+ aBuilder.appendLine(glm::vec2(x1, y1), glm::vec2(x2, y2));
}
}
}
diff --git a/vcl/opengl/gdiimpl.cxx b/vcl/opengl/gdiimpl.cxx
index 6c76154ea498..3125642aa44e 100644
--- a/vcl/opengl/gdiimpl.cxx
+++ b/vcl/opengl/gdiimpl.cxx
@@ -731,27 +731,27 @@ void OpenGLSalGraphicsImpl::DrawConvexPolygon( sal_uInt32 nPoints, const SalPoin
mpProgram->DrawArrays(GL_TRIANGLE_FAN, aVertices);
CHECK_GL_ERROR();
- if( !blockAA && mrParent.getAntiAliasB2DDraw())
- {
- // Make the edges antialiased by drawing the edge lines again with AA.
- // TODO: If transparent drawing is set up, drawing the lines themselves twice
- // may be a problem, if that is a real problem, the polygon areas itself needs to be
- // masked out for this or something.
+ if( blockAA || !mrParent.getAntiAliasB2DDraw())
+ return;
+
+ // Make the edges antialiased by drawing the edge lines again with AA.
+ // TODO: If transparent drawing is set up, drawing the lines themselves twice
+ // may be a problem, if that is a real problem, the polygon areas itself needs to be
+ // masked out for this or something.
#ifdef DBG_UTIL
- assert( mProgramIsSolidColor );
+ assert( mProgramIsSolidColor );
#endif
- Color lastSolidColor = mProgramSolidColor;
- double lastSolidTransparency = mProgramSolidTransparency;
- if (UseLine(lastSolidColor, lastSolidTransparency, 1.0f, true))
+ Color lastSolidColor = mProgramSolidColor;
+ double lastSolidTransparency = mProgramSolidTransparency;
+ if (UseLine(lastSolidColor, lastSolidTransparency, 1.0f, true))
+ {
+ for( i = 0; i < nPoints; ++i )
{
- for( i = 0; i < nPoints; ++i )
- {
- const SalPoint& rPt1 = pPtAry[ i ];
- const SalPoint& rPt2 = pPtAry[ ( i + 1 ) % nPoints ];
- DrawLineSegment(rPt1.mnX, rPt1.mnY, rPt2.mnX, rPt2.mnY);
- }
- UseSolid( lastSolidColor, lastSolidTransparency );
+ const SalPoint& rPt1 = pPtAry[ i ];
+ const SalPoint& rPt2 = pPtAry[ ( i + 1 ) % nPoints ];
+ DrawLineSegment(rPt1.mnX, rPt1.mnY, rPt2.mnX, rPt2.mnY);
}
+ UseSolid( lastSolidColor, lastSolidTransparency );
}
}
@@ -776,27 +776,27 @@ void OpenGLSalGraphicsImpl::DrawConvexPolygon( const tools::Polygon& rPolygon, b
mpProgram->DrawArrays(GL_TRIANGLE_FAN, aVertices);
CHECK_GL_ERROR();
- if( !blockAA && mrParent.getAntiAliasB2DDraw())
- {
- // Make the edges antialiased by drawing the edge lines again with AA.
- // TODO: If transparent drawing is set up, drawing the lines themselves twice
- // may be a problem, if that is a real problem, the polygon areas itself needs to be
- // masked out for this or something.
+ if( blockAA || !mrParent.getAntiAliasB2DDraw())
+ return;
+
+ // Make the edges antialiased by drawing the edge lines again with AA.
+ // TODO: If transparent drawing is set up, drawing the lines themselves twice
+ // may be a problem, if that is a real problem, the polygon areas itself needs to be
+ // masked out for this or something.
#ifdef DBG_UTIL
- assert( mProgramIsSolidColor );
+ assert( mProgramIsSolidColor );
#endif
- Color lastSolidColor = mProgramSolidColor;
- double lastSolidTransparency = mProgramSolidTransparency;
- if (UseLine(lastSolidColor, lastSolidTransparency, 1.0f, true))
+ Color lastSolidColor = mProgramSolidColor;
+ double lastSolidTransparency = mProgramSolidTransparency;
+ if (UseLine(lastSolidColor, lastSolidTransparency, 1.0f, true))
+ {
+ for( i = 0; i < nPoints; ++i )
{
- for( i = 0; i < nPoints; ++i )
- {
- const Point& rPt1 = rPolygon.GetPoint( i );
- const Point& rPt2 = rPolygon.GetPoint(( i + 1 ) % nPoints );
- DrawLineSegment(rPt1.getX(), rPt1.getY(), rPt2.getX(), rPt2.getY());
- }
- UseSolid( lastSolidColor, lastSolidTransparency );
+ const Point& rPt1 = rPolygon.GetPoint( i );
+ const Point& rPt2 = rPolygon.GetPoint(( i + 1 ) % nPoints );
+ DrawLineSegment(rPt1.getX(), rPt1.getY(), rPt2.getX(), rPt2.getY());
}
+ UseSolid( lastSolidColor, lastSolidTransparency );
}
}
@@ -828,27 +828,27 @@ void OpenGLSalGraphicsImpl::DrawTrapezoid( const basegfx::B2DTrapezoid& trapezoi
mpProgram->DrawArrays(GL_TRIANGLE_FAN, aVertices);
CHECK_GL_ERROR();
- if( !blockAA && mrParent.getAntiAliasB2DDraw())
- {
- // Make the edges antialiased by drawing the edge lines again with AA.
- // TODO: If transparent drawing is set up, drawing the lines themselves twice
- // may be a problem, if that is a real problem, the polygon areas itself needs to be
- // masked out for this or something.
+ if( blockAA || !mrParent.getAntiAliasB2DDraw())
+ return;
+
+ // Make the edges antialiased by drawing the edge lines again with AA.
+ // TODO: If transparent drawing is set up, drawing the lines themselves twice
+ // may be a problem, if that is a real problem, the polygon areas itself needs to be
+ // masked out for this or something.
#ifdef DBG_UTIL
- assert( mProgramIsSolidColor );
+ assert( mProgramIsSolidColor );
#endif
- Color lastSolidColor = mProgramSolidColor;
- double lastSolidTransparency = mProgramSolidTransparency;
- if (UseLine(lastSolidColor, lastSolidTransparency, 1.0f, true))
+ Color lastSolidColor = mProgramSolidColor;
+ double lastSolidTransparency = mProgramSolidTransparency;
+ if (UseLine(lastSolidColor, lastSolidTransparency, 1.0f, true))
+ {
+ for( i = 0; i < nPoints; ++i )
{
- for( i = 0; i < nPoints; ++i )
- {
- const basegfx::B2DPoint& rPt1 = rPolygon.getB2DPoint( i );
- const basegfx::B2DPoint& rPt2 = rPolygon.getB2DPoint(( i + 1 ) % nPoints );
- DrawLineSegment(rPt1.getX(), rPt1.getY(), rPt2.getX(), rPt2.getY());
- }
- UseSolid( lastSolidColor, lastSolidTransparency );
+ const basegfx::B2DPoint& rPt1 = rPolygon.getB2DPoint( i );
+ const basegfx::B2DPoint& rPt2 = rPolygon.getB2DPoint(( i + 1 ) % nPoints );
+ DrawLineSegment(rPt1.getX(), rPt1.getY(), rPt2.getX(), rPt2.getY());
}
+ UseSolid( lastSolidColor, lastSolidTransparency );
}
}
diff --git a/vcl/opengl/texture.cxx b/vcl/opengl/texture.cxx
index 9f4acc0fc8eb..35e4098dafa2 100644
--- a/vcl/opengl/texture.cxx
+++ b/vcl/opengl/texture.cxx
@@ -169,39 +169,39 @@ GLuint ImplOpenGLTexture::AddStencil()
ImplOpenGLTexture::~ImplOpenGLTexture()
{
VCL_GL_INFO( "~OpenGLTexture " << mnTexture );
- if( mnTexture != 0 )
+ if( mnTexture == 0 )
+ return;
+
+ // During shutdown GL is already de-initialized, so we should not try to create a new context.
+ OpenGLZone aZone;
+ rtl::Reference<OpenGLContext> xContext = OpenGLContext::getVCLContext(false);
+ if( xContext.is() )
{
- // During shutdown GL is already de-initialized, so we should not try to create a new context.
- OpenGLZone aZone;
- rtl::Reference<OpenGLContext> xContext = OpenGLContext::getVCLContext(false);
- if( xContext.is() )
+ // FIXME: this is really not optimal performance-wise.
+
+ // Check we have been correctly un-bound from all framebuffers.
+ ImplSVData* pSVData = ImplGetSVData();
+ rtl::Reference<OpenGLContext> pContext = pSVData->maGDIData.mpLastContext;
+
+ if( pContext.is() )
{
- // FIXME: this is really not optimal performance-wise.
-
- // Check we have been correctly un-bound from all framebuffers.
- ImplSVData* pSVData = ImplGetSVData();
- rtl::Reference<OpenGLContext> pContext = pSVData->maGDIData.mpLastContext;
-
- if( pContext.is() )
- {
- pContext->makeCurrent();
- pContext->UnbindTextureFromFramebuffers( mnTexture );
- }
-
- if( mnOptStencil != 0 )
- {
- glDeleteRenderbuffers( 1, &mnOptStencil );
- mnOptStencil = 0;
- }
- auto& rState = pContext->state();
- rState.texture().unbindAndDelete(mnTexture);
- mnTexture = 0;
+ pContext->makeCurrent();
+ pContext->UnbindTextureFromFramebuffers( mnTexture );
}
- else
+
+ if( mnOptStencil != 0 )
{
+ glDeleteRenderbuffers( 1, &mnOptStencil );
mnOptStencil = 0;
- mnTexture = 0;
}
+ auto& rState = pContext->state();
+ rState.texture().unbindAndDelete(mnTexture);
+ mnTexture = 0;
+ }
+ else
+ {
+ mnOptStencil = 0;
+ mnTexture = 0;
}
}
diff --git a/vcl/opengl/x11/X11DeviceInfo.cxx b/vcl/opengl/x11/X11DeviceInfo.cxx
index b75c22012380..f7c979ef77e6 100644
--- a/vcl/opengl/x11/X11DeviceInfo.cxx
+++ b/vcl/opengl/x11/X11DeviceInfo.cxx
@@ -252,27 +252,27 @@ void X11OpenGLDeviceInfo::GetData()
}
// read major.minor version numbers of the driver (not to be confused with the OpenGL version)
- if (whereToReadVersionNumbers)
+ if (!whereToReadVersionNumbers)
+ return;
+
+ // copy into writable buffer, for tokenization
+ strncpy(buf, whereToReadVersionNumbers, buf_size-1);
+ buf[buf_size-1] = 0;
+ bufptr = buf;
+
+ // now try to read major.minor version numbers. In case of failure, gracefully exit: these numbers have
+ // been initialized as 0 anyways
+ char *token = strtok_wrapper(".", &bufptr);
+ if (token)
{
- // copy into writable buffer, for tokenization
- strncpy(buf, whereToReadVersionNumbers, buf_size-1);
- buf[buf_size-1] = 0;
- bufptr = buf;
-
- // now try to read major.minor version numbers. In case of failure, gracefully exit: these numbers have
- // been initialized as 0 anyways
- char *token = strtok_wrapper(".", &bufptr);
+ mnMajorVersion = strtol(token, nullptr, 10);
+ token = strtok_wrapper(".", &bufptr);
if (token)
{
- mnMajorVersion = strtol(token, nullptr, 10);
+ mnMinorVersion = strtol(token, nullptr, 10);
token = strtok_wrapper(".", &bufptr);
if (token)
- {
- mnMinorVersion = strtol(token, nullptr, 10);
- token = strtok_wrapper(".", &bufptr);
- if (token)
- mnRevisionVersion = strtol(token, nullptr, 10);
- }
+ mnRevisionVersion = strtol(token, nullptr, 10);
}
}
}
diff --git a/vcl/opengl/x11/gdiimpl.cxx b/vcl/opengl/x11/gdiimpl.cxx
index 0030a71a0544..81351e3beae3 100644
--- a/vcl/opengl/x11/gdiimpl.cxx
+++ b/vcl/opengl/x11/gdiimpl.cxx
@@ -431,21 +431,21 @@ void X11OpenGLContext::makeCurrent()
void X11OpenGLContext::destroyCurrentContext()
{
- if(m_aGLWin.ctx)
- {
- std::vector<GLXContext>::iterator itr = std::remove( g_vShareList.begin(), g_vShareList.end(), m_aGLWin.ctx );
- if (itr != g_vShareList.end())
- g_vShareList.erase(itr);
+ if(!m_aGLWin.ctx)
+ return;
- glXMakeCurrent(m_aGLWin.dpy, None, nullptr);
- g_bAnyCurrent = false;
- if( glGetError() != GL_NO_ERROR )
- {
- SAL_WARN("vcl.opengl", "glError: " << glGetError());
- }
- glXDestroyContext(m_aGLWin.dpy, m_aGLWin.ctx);
- m_aGLWin.ctx = nullptr;
+ std::vector<GLXContext>::iterator itr = std::remove( g_vShareList.begin(), g_vShareList.end(), m_aGLWin.ctx );
+ if (itr != g_vShareList.end())
+ g_vShareList.erase(itr);
+
+ glXMakeCurrent(m_aGLWin.dpy, None, nullptr);
+ g_bAnyCurrent = false;
+ if( glGetError() != GL_NO_ERROR )
+ {
+ SAL_WARN("vcl.opengl", "glError: " << glGetError());
}
+ glXDestroyContext(m_aGLWin.dpy, m_aGLWin.ctx);
+ m_aGLWin.ctx = nullptr;
}
void X11OpenGLContext::init(Display* dpy, Window win, int screen)
diff --git a/vcl/qt5/Qt5FilePicker.cxx b/vcl/qt5/Qt5FilePicker.cxx
index d648a5d94b75..5e0f88412056 100644
--- a/vcl/qt5/Qt5FilePicker.cxx
+++ b/vcl/qt5/Qt5FilePicker.cxx
@@ -823,31 +823,31 @@ void SAL_CALL Qt5FilePicker::initialize(const uno::Sequence<uno::Any>& args)
css::uno::Reference<css::awt::XWindow> xParentWindow;
if (args.getLength() > 1)
args[1] >>= xParentWindow;
- if (xParentWindow.is())
- {
- css::uno::Reference<css::awt::XSystemDependentWindowPeer> xSysWinPeer(xParentWindow,
- css::uno::UNO_QUERY);
- if (xSysWinPeer.is())
- {
- // the sal_*Int8 handling is strange, but it's public API - no way around
- css::uno::Sequence<sal_Int8> aProcessIdent(16);
- rtl_getGlobalProcessId(reinterpret_cast<sal_uInt8*>(aProcessIdent.getArray()));
- uno::Any aAny = xSysWinPeer->getWindowHandle(
- aProcessIdent, css::lang::SystemDependent::SYSTEM_XWINDOW);
- css::awt::SystemDependentXWindow xSysWin;
- aAny >>= xSysWin;
-
- const auto& pFrames = pSalInst->getFrames();
- const long aWindowHandle = xSysWin.WindowHandle;
- const auto it = std::find_if(pFrames.begin(), pFrames.end(),
- [&aWindowHandle](auto pFrame) -> bool {
- const SystemEnvData* pData = pFrame->GetSystemData();
- return pData && long(pData->aWindow) == aWindowHandle;
- });
- if (it != pFrames.end())
- m_pParentWidget = static_cast<Qt5Frame*>(*it)->asChild();
- }
- }
+ if (!xParentWindow.is())
+ return;
+
+ css::uno::Reference<css::awt::XSystemDependentWindowPeer> xSysWinPeer(xParentWindow,
+ css::uno::UNO_QUERY);
+ if (!xSysWinPeer.is())
+ return;
+
+ // the sal_*Int8 handling is strange, but it's public API - no way around
+ css::uno::Sequence<sal_Int8> aProcessIdent(16);
+ rtl_getGlobalProcessId(reinterpret_cast<sal_uInt8*>(aProcessIdent.getArray()));
+ uno::Any aAny
+ = xSysWinPeer->getWindowHandle(aProcessIdent, css::lang::SystemDependent::SYSTEM_XWINDOW);
+ css::awt::SystemDependentXWindow xSysWin;
+ aAny >>= xSysWin;
+
+ const auto& pFrames = pSalInst->getFrames();
+ const long aWindowHandle = xSysWin.WindowHandle;
+ const auto it
+ = std::find_if(pFrames.begin(), pFrames.end(), [&aWindowHandle](auto pFrame) -> bool {
+ const SystemEnvData* pData = pFrame->GetSystemData();
+ return pData && long(pData->aWindow) == aWindowHandle;
+ });
+ if (it != pFrames.end())
+ m_pParentWidget = static_cast<Qt5Frame*>(*it)->asChild();
}
void SAL_CALL Qt5FilePicker::cancel() { m_pFileDialog->reject(); }
diff --git a/vcl/qt5/Qt5Frame.cxx b/vcl/qt5/Qt5Frame.cxx
index ed3368ac3970..f008f4538bd7 100644
--- a/vcl/qt5/Qt5Frame.cxx
+++ b/vcl/qt5/Qt5Frame.cxx
@@ -547,35 +547,35 @@ void Qt5Frame::SetPosSize(long nX, long nY, long nWidth, long nHeight, sal_uInt1
}
}
- if (nFlags & (SAL_FRAME_POSSIZE_X | SAL_FRAME_POSSIZE_Y))
+ if (!(nFlags & (SAL_FRAME_POSSIZE_X | SAL_FRAME_POSSIZE_Y)))
+ return;
+
+ if (m_pParent)
{
- if (m_pParent)
- {
- const SalFrameGeometry& aParentGeometry = m_pParent->maGeometry;
- if (QGuiApplication::isRightToLeft())
- nX = aParentGeometry.nX + aParentGeometry.nWidth - nX - maGeometry.nWidth - 1;
- else
- nX += aParentGeometry.nX;
- nY += aParentGeometry.nY;
-
- Qt5MainWindow* pTopLevel = m_pParent->GetTopLevelWindow();
- if (pTopLevel && pTopLevel->menuBar() && pTopLevel->menuBar()->isVisible())
- nY += round(pTopLevel->menuBar()->geometry().height() * devicePixelRatioF());
- }
+ const SalFrameGeometry& aParentGeometry = m_pParent->maGeometry;
+ if (QGuiApplication::isRightToLeft())
+ nX = aParentGeometry.nX + aParentGeometry.nWidth - nX - maGeometry.nWidth - 1;
+ else
+ nX += aParentGeometry.nX;
+ nY += aParentGeometry.nY;
- if (!(nFlags & SAL_FRAME_POSSIZE_X))
- nX = maGeometry.nX;
- else if (!(nFlags & SAL_FRAME_POSSIZE_Y))
- nY = maGeometry.nY;
+ Qt5MainWindow* pTopLevel = m_pParent->GetTopLevelWindow();
+ if (pTopLevel && pTopLevel->menuBar() && pTopLevel->menuBar()->isVisible())
+ nY += round(pTopLevel->menuBar()->geometry().height() * devicePixelRatioF());
+ }
- // assume the reposition happened
- // needed for calculations and will eventually be corrected by events later
- maGeometry.nX = nX;
- maGeometry.nY = nY;
+ if (!(nFlags & SAL_FRAME_POSSIZE_X))
+ nX = maGeometry.nX;
+ else if (!(nFlags & SAL_FRAME_POSSIZE_Y))
+ nY = maGeometry.nY;
- m_bDefaultPos = false;
- asChild()->move(round(nX / devicePixelRatioF()), round(nY / devicePixelRatioF()));
- }
+ // assume the reposition happened
+ // needed for calculations and will eventually be corrected by events later
+ maGeometry.nX = nX;
+ maGeometry.nY = nY;
+
+ m_bDefaultPos = false;
+ asChild()->move(round(nX / devicePixelRatioF()), round(nY / devicePixelRatioF()));
}
void Qt5Frame::GetClientSize(long& rWidth, long& rHeight)
@@ -600,25 +600,25 @@ SalFrame* Qt5Frame::GetParent() const { return m_pParent; }
void Qt5Frame::SetModal(bool bModal)
{
- if (isWindow())
- {
- auto* pSalInst(static_cast<Qt5Instance*>(GetSalData()->m_pInstance));
- assert(pSalInst);
- pSalInst->RunInMainThread([this, bModal]() {
+ if (!isWindow())
+ return;
- QWidget* const pChild = asChild();
- const bool bWasVisible = pChild->isVisible();
+ auto* pSalInst(static_cast<Qt5Instance*>(GetSalData()->m_pInstance));
+ assert(pSalInst);
+ pSalInst->RunInMainThread([this, bModal]() {
- // modality change is only effective if the window is hidden
- if (bWasVisible)
- pChild->hide();
+ QWidget* const pChild = asChild();
+ const bool bWasVisible = pChild->isVisible();
- pChild->setWindowModality(bModal ? Qt::WindowModal : Qt::NonModal);
+ // modality change is only effective if the window is hidden
+ if (bWasVisible)
+ pChild->hide();
- if (bWasVisible)
- pChild->show();
- });
- }
+ pChild->setWindowModality(bModal ? Qt::WindowModal : Qt::NonModal);
+
+ if (bWasVisible)
+ pChild->show();
+ });
}
bool Qt5Frame::GetModal() const { return isWindow() && windowHandle()->isModal(); }
@@ -1189,52 +1189,52 @@ void Qt5Frame::EndSetClipRegion() { m_bNullRegion = false; }
void Qt5Frame::SetScreenNumber(unsigned int nScreen)
{
- if (isWindow())
+ if (!isWindow())
+ return;
+
+ QWindow* const pWindow = windowHandle();
+ if (!pWindow)
+ return;
+
+ QList<QScreen*> screens = QApplication::screens();
+ if (static_cast<int>(nScreen) < screens.size() || m_bFullScreenSpanAll)
{
- QWindow* const pWindow = windowHandle();
- if (pWindow)
- {
- QList<QScreen*> screens = QApplication::screens();
- if (static_cast<int>(nScreen) < screens.size() || m_bFullScreenSpanAll)
- {
- QRect screenGeo;
-
- if (!m_bFullScreenSpanAll)
- {
- SAL_WNODEPRECATED_DECLARATIONS_PUSH
- screenGeo = QApplication::desktop()->screenGeometry(nScreen);
- SAL_WNODEPRECATED_DECLARATIONS_POP
- pWindow->setScreen(QApplication::screens()[nScreen]);
- }
- else // special case: fullscreen over all available screens
- {
- assert(m_bFullScreen);
- // left-most screen
- SAL_WNODEPRECATED_DECLARATIONS_PUSH
- int nLeftScreen = QApplication::desktop()->screenNumber(QPoint(0, 0));
- SAL_WNODEPRECATED_DECLARATIONS_POP
- // entire virtual desktop
- screenGeo = QApplication::screens()[nLeftScreen]->availableVirtualGeometry();
- pWindow->setScreen(QApplication::screens()[nLeftScreen]);
- pWindow->setGeometry(screenGeo);
- nScreen = nLeftScreen;
- }
-
- // setScreen by itself has no effect, explicitly move the widget to
- // the new screen
- asChild()->move(screenGeo.topLeft());
- }
- else
- {
- // index outta bounds, use primary screen
- QScreen* primaryScreen = QApplication::primaryScreen();
- pWindow->setScreen(primaryScreen);
- nScreen = static_cast<sal_uInt32>(screenNumber(primaryScreen));
- }
+ QRect screenGeo;
- maGeometry.nDisplayScreenNumber = nScreen;
+ if (!m_bFullScreenSpanAll)
+ {
+ SAL_WNODEPRECATED_DECLARATIONS_PUSH
+ screenGeo = QApplication::desktop()->screenGeometry(nScreen);
+ SAL_WNODEPRECATED_DECLARATIONS_POP
+ pWindow->setScreen(QApplication::screens()[nScreen]);
+ }
+ else // special case: fullscreen over all available screens
+ {
+ assert(m_bFullScreen);
+ // left-most screen
+ SAL_WNODEPRECATED_DECLARATIONS_PUSH
+ int nLeftScreen = QApplication::desktop()->screenNumber(QPoint(0, 0));
+ SAL_WNODEPRECATED_DECLARATIONS_POP
+ // entire virtual desktop
+ screenGeo = QApplication::screens()[nLeftScreen]->availableVirtualGeometry();
+ pWindow->setScreen(QApplication::screens()[nLeftScreen]);
+ pWindow->setGeometry(screenGeo);
+ nScreen = nLeftScreen;
}
+
+ // setScreen by itself has no effect, explicitly move the widget to
+ // the new screen
+ asChild()->move(screenGeo.topLeft());
}
+ else
+ {
+ // index outta bounds, use primary screen
+ QScreen* primaryScreen = QApplication::primaryScreen();
+ pWindow->setScreen(primaryScreen);
+ nScreen = static_cast<sal_uInt32>(screenNumber(primaryScreen));
+ }
+
+ maGeometry.nDisplayScreenNumber = nScreen;
}
void Qt5Frame::SetApplicationID(const OUString& rWMClass)
diff --git a/vcl/qt5/Qt5Menu.cxx b/vcl/qt5/Qt5Menu.cxx
index 98615247035a..f7c2e480118c 100644
--- a/vcl/qt5/Qt5Menu.cxx
+++ b/vcl/qt5/Qt5Menu.cxx
@@ -356,21 +356,21 @@ void Qt5Menu::RemoveItem(unsigned nPos)
{
SolarMutexGuard aGuard;
- if (nPos < maItems.size())
- {
- Qt5MenuItem* pItem = maItems[nPos];
- pItem->mpAction.reset();
- pItem->mpMenu.reset();
+ if (nPos >= maItems.size())
+ return;
- maItems.erase(maItems.begin() + nPos);
+ Qt5MenuItem* pItem = maItems[nPos];
+ pItem->mpAction.reset();
+ pItem->mpMenu.reset();
- // Recalculate action groups if necessary:
- // if separator between two QActionGroups was removed,
- // it may be needed to merge them
- if (nPos > 0)
- {
- ReinitializeActionGroup(nPos - 1);
- }
+ maItems.erase(maItems.begin() + nPos);
+
+ // Recalculate action groups if necessary:
+ // if separator between two QActionGroups was removed,
+ // it may be needed to merge them
+ if (nPos > 0)
+ {
+ ReinitializeActionGroup(nPos - 1);
}
}
@@ -421,26 +421,26 @@ void Qt5Menu::SetFrame(const SalFrame* pFrame)
mpFrame->SetMenu(this);
Qt5MainWindow* pMainWindow = mpFrame->GetTopLevelWindow();
- if (pMainWindow)
+ if (!pMainWindow)
+ return;
+
+ mpQMenuBar = pMainWindow->menuBar();
+ if (mpQMenuBar)
{
- mpQMenuBar = pMainWindow->menuBar();
- if (mpQMenuBar)
+ mpQMenuBar->clear();
+ QPushButton* pButton
+ = static_cast<QPushButton*>(mpQMenuBar->cornerWidget(Qt::TopRightCorner));
+ if (pButton && ((mpCloseButton != pButton) || !maCloseButtonConnection))
{
- mpQMenuBar->clear();
- QPushButton* pButton
- = static_cast<QPushButton*>(mpQMenuBar->cornerWidget(Qt::TopRightCorner));
- if (pButton && ((mpCloseButton != pButton) || !maCloseButtonConnection))
- {
- maCloseButtonConnection
- = connect(pButton, &QPushButton::clicked, this, &Qt5Menu::slotCloseDocument);
- mpCloseButton = pButton;
- }
+ maCloseButtonConnection
+ = connect(pButton, &QPushButton::clicked, this, &Qt5Menu::slotCloseDocument);
+ mpCloseButton = pButton;
}
+ }
- mpQMenu = nullptr;
+ mpQMenu = nullptr;
- DoFullMenuUpdate(mpVCLMenu);
- }
+ DoFullMenuUpdate(mpVCLMenu);
}
void Qt5Menu::DoFullMenuUpdate(Menu* pMenuBar)
@@ -578,21 +578,21 @@ const Qt5Frame* Qt5Menu::GetFrame() const
void Qt5Menu::slotMenuTriggered(Qt5MenuItem* pQItem)
{
- if (pQItem)
- {
- Qt5Menu* pSalMenu = pQItem->mpParentMenu;
- Qt5Menu* pTopLevel = pSalMenu->GetTopLevel();
+ if (!pQItem)
+ return;
- Menu* pMenu = pSalMenu->GetMenu();
- auto mnId = pQItem->mnId;
-
- // HACK to allow HandleMenuCommandEvent to "not-set" the checked button
- // LO expects a signal before an item state change, so reset the check item
- if (pQItem->mpAction->isCheckable()
- && (!pQItem->mpActionGroup || pQItem->mpActionGroup->actions().size() <= 1))
- pQItem->mpAction->setChecked(!pQItem->mpAction->isChecked());
- pTopLevel->GetMenu()->HandleMenuCommandEvent(pMenu, mnId);
- }
+ Qt5Menu* pSalMenu = pQItem->mpParentMenu;
+ Qt5Menu* pTopLevel = pSalMenu->GetTopLevel();
+
+ Menu* pMenu = pSalMenu->GetMenu();
+ auto mnId = pQItem->mnId;
+
+ // HACK to allow HandleMenuCommandEvent to "not-set" the checked button
+ // LO expects a signal before an item state change, so reset the check item
+ if (pQItem->mpAction->isCheckable()
+ && (!pQItem->mpActionGroup || pQItem->mpActionGroup->actions().size() <= 1))
+ pQItem->mpAction->setChecked(!pQItem->mpAction->isChecked());
+ pTopLevel->GetMenu()->HandleMenuCommandEvent(pMenu, mnId);
}
void Qt5Menu::slotMenuAboutToShow(Qt5MenuItem* pQItem)
diff --git a/vcl/skia/SkiaHelper.cxx b/vcl/skia/SkiaHelper.cxx
index a3df4315b668..cd8fca063a7e 100644
--- a/vcl/skia/SkiaHelper.cxx
+++ b/vcl/skia/SkiaHelper.cxx
@@ -145,52 +145,52 @@ static sk_app::VulkanWindowContext::SharedGrContext getTemporaryGrContext();
static void checkDeviceDenylisted(bool blockDisable = false)
{
static bool done = false;
- if (!done)
- {
- SkiaZone zone;
+ if (done)
+ return;
- switch (renderMethodToUse())
+ SkiaZone zone;
+
+ switch (renderMethodToUse())
+ {
+ case RenderVulkan:
{
- case RenderVulkan:
+ // First try if a GrContext already exists.
+ sk_app::VulkanWindowContext::SharedGrContext grContext
+ = sk_app::VulkanWindowContext::getSharedGrContext();
+ if (!grContext.getGrContext())
{
- // First try if a GrContext already exists.
- sk_app::VulkanWindowContext::SharedGrContext grContext
- = sk_app::VulkanWindowContext::getSharedGrContext();
- if (!grContext.getGrContext())
- {
- // This function is called from isVclSkiaEnabled(), which
- // may be called when deciding which X11 visual to use,
- // and that visual is normally needed when creating
- // Skia's VulkanWindowContext, which is needed for the GrContext.
- // Avoid the loop by creating a temporary GrContext
- // that will use the default X11 visual (that shouldn't matter
- // for just finding out information about Vulkan) and destroying
- // the temporary context will clean up again.
- grContext = getTemporaryGrContext();
- }
- bool denylisted = true; // assume the worst
- if (grContext.getGrContext()) // Vulkan was initialized properly
- {
- denylisted = isVulkanDenylisted(
- sk_app::VulkanWindowContext::getPhysDeviceProperties());
- SAL_INFO("vcl.skia", "Vulkan denylisted: " << denylisted);
- }
- else
- SAL_INFO("vcl.skia", "Vulkan could not be initialized");
- if (denylisted && !blockDisable)
- {
- disableRenderMethod(RenderVulkan);
- writeSkiaRasterInfo();
- }
- break;
+ // This function is called from isVclSkiaEnabled(), which
+ // may be called when deciding which X11 visual to use,
+ // and that visual is normally needed when creating
+ // Skia's VulkanWindowContext, which is needed for the GrContext.
+ // Avoid the loop by creating a temporary GrContext
+ // that will use the default X11 visual (that shouldn't matter
+ // for just finding out information about Vulkan) and destroying
+ // the temporary context will clean up again.
+ grContext = getTemporaryGrContext();
}
- case RenderRaster:
- SAL_INFO("vcl.skia", "Using Skia raster mode");
+ bool denylisted = true; // assume the worst
+ if (grContext.getGrContext()) // Vulkan was initialized properly
+ {
+ denylisted
+ = isVulkanDenylisted(sk_app::VulkanWindowContext::getPhysDeviceProperties());
+ SAL_INFO("vcl.skia", "Vulkan denylisted: " << denylisted);
+ }
+ else
+ SAL_INFO("vcl.skia", "Vulkan could not be initialized");
+ if (denylisted && !blockDisable)
+ {
+ disableRenderMethod(RenderVulkan);
writeSkiaRasterInfo();
- return; // software, never denylisted
+ }
+ break;
}
- done = true;
+ case RenderRaster:
+ SAL_INFO("vcl.skia", "Using Skia raster mode");
+ writeSkiaRasterInfo();
+ return; // software, never denylisted
}
+ done = true;
}
static bool skiaSupportedByBackend = false;
diff --git a/vcl/skia/salbmp.cxx b/vcl/skia/salbmp.cxx
index 7f8fa50aced3..0da11b1c57d8 100644
--- a/vcl/skia/salbmp.cxx
+++ b/vcl/skia/salbmp.cxx
@@ -120,21 +120,21 @@ void SkiaSalBitmap::CreateBitmapData()
// and a VCL bitmap can change its grayscale status simply by changing the palette.
// Moreover creating SkImage from SkBitmap does a data copy unless the bitmap is immutable.
// So just always store pixels in our buffer and convert as necessary.
- if (mScanlineSize != 0 && mPixelsSize.Height() != 0)
- {
- size_t allocate = mScanlineSize * mPixelsSize.Height();
+ if (mScanlineSize == 0 || mPixelsSize.Height() == 0)
+ return;
+
+ size_t allocate = mScanlineSize * mPixelsSize.Height();
#ifdef DBG_UTIL
- allocate += sizeof(CANARY);
+ allocate += sizeof(CANARY);
#endif
- mBuffer = boost::make_shared_noinit<sal_uInt8[]>(allocate);
+ mBuffer = boost::make_shared_noinit<sal_uInt8[]>(allocate);
#ifdef DBG_UTIL
- // fill with random garbage
- sal_uInt8* buffer = mBuffer.get();
- for (size_t i = 0; i < allocate; i++)
- buffer[i] = (i & 0xFF);
- memcpy(buffer + allocate - sizeof(CANARY), CANARY, sizeof(CANARY));
+ // fill with random garbage
+ sal_uInt8* buffer = mBuffer.get();
+ for (size_t i = 0; i < allocate; i++)
+ buffer[i] = (i & 0xFF);
+ memcpy(buffer + allocate - sizeof(CANARY), CANARY, sizeof(CANARY));
#endif
- }
}
bool SkiaSalBitmap::Create(const SalBitmap& rSalBmp)
diff --git a/vcl/skia/zone.cxx b/vcl/skia/zone.cxx
index 50f5e1ea73a8..0271608f5ba4 100644
--- a/vcl/skia/zone.cxx
+++ b/vcl/skia/zone.cxx
@@ -26,23 +26,23 @@ void SkiaZone::hardDisable()
{
// protect ourselves from double calling etc.
static bool bDisabled = false;
- if (!bDisabled)
- {
- bDisabled = true;
+ if (bDisabled)
+ return;
- // Instead of disabling Skia as a whole, only force the CPU-based
- // raster mode, which should be safe as it does not use drivers.
- std::shared_ptr<comphelper::ConfigurationChanges> xChanges(
- comphelper::ConfigurationChanges::create());
- officecfg::Office::Common::VCL::ForceSkiaRaster::set(true, xChanges);
- xChanges->commit();
+ bDisabled = true;
- // Force synchronous config write
- css::uno::Reference<css::util::XFlushable>(
- css::configuration::theDefaultProvider::get(comphelper::getProcessComponentContext()),
- css::uno::UNO_QUERY_THROW)
- ->flush();
- }
+ // Instead of disabling Skia as a whole, only force the CPU-based
+ // raster mode, which should be safe as it does not use drivers.
+ std::shared_ptr<comphelper::ConfigurationChanges> xChanges(
+ comphelper::ConfigurationChanges::create());
+ officecfg::Office::Common::VCL::ForceSkiaRaster::set(true, xChanges);
+ xChanges->commit();
+
+ // Force synchronous config write
+ css::uno::Reference<css::util::XFlushable>(
+ css::configuration::theDefaultProvider::get(comphelper::getProcessComponentContext()),
+ css::uno::UNO_QUERY_THROW)
+ ->flush();
}
void SkiaZone::checkDebug(int nUnchanged, const CrashWatchdogTimingsValues& aTimingValues)
diff --git a/vcl/source/animate/Animation.cxx b/vcl/source/animate/Animation.cxx
index d9eaed56ce73..2b799dabf3af 100644
--- a/vcl/source/animate/Animation.cxx
+++ b/vcl/source/animate/Animation.cxx
@@ -239,26 +239,26 @@ void Animation::Draw(OutputDevice* pOut, const Point& rDestPt, const Size& rDest
{
const size_t nCount = maList.size();
- if (nCount)
- {
- AnimationBitmap* pObj = maList[std::min(mnPos, nCount - 1)].get();
+ if (!nCount)
+ return;
- if (pOut->GetConnectMetaFile() || (pOut->GetOutDevType() == OUTDEV_PRINTER))
- maList[0]->maBitmapEx.Draw(pOut, rDestPt, rDestSz);
- else if (ANIMATION_TIMEOUT_ON_CLICK == pObj->mnWait)
- pObj->maBitmapEx.Draw(pOut, rDestPt, rDestSz);
- else
- {
- const size_t nOldPos = mnPos;
- if (mbLoopTerminated)
- const_cast<Animation*>(this)->mnPos = nCount - 1;
+ AnimationBitmap* pObj = maList[std::min(mnPos, nCount - 1)].get();
- {
- ImplAnimView{ const_cast<Animation*>(this), pOut, rDestPt, rDestSz, 0 };
- }
+ if (pOut->GetConnectMetaFile() || (pOut->GetOutDevType() == OUTDEV_PRINTER))
+ maList[0]->maBitmapEx.Draw(pOut, rDestPt, rDestSz);
+ else if (ANIMATION_TIMEOUT_ON_CLICK == pObj->mnWait)
+ pObj->maBitmapEx.Draw(pOut, rDestPt, rDestSz);
+ else
+ {
+ const size_t nOldPos = mnPos;
+ if (mbLoopTerminated)
+ const_cast<Animation*>(this)->mnPos = nCount - 1;
- const_cast<Animation*>(this)->mnPos = nOldPos;
+ {
+ ImplAnimView{ const_cast<Animation*>(this), pOut, rDestPt, rDestSz, 0 };
}
+
+ const_cast<Animation*>(this)->mnPos = nOldPos;
}
}
@@ -499,33 +499,31 @@ void Animation::Mirror(BmpMirrorFlags nMirrorFlags)
bool bRet;
- if (!IsInAnimation() && !maList.empty())
- {
- bRet = true;
+ if (IsInAnimation() || maList.empty())
+ return;
+
+ bRet = true;
+
+ if (nMirrorFlags == BmpMirrorFlags::NONE)
+ return;
- if (nMirrorFlags != BmpMirrorFlags::NONE)
+ for (size_t i = 0, n = maList.size(); (i < n) && bRet; ++i)
+ {
+ AnimationBitmap* pStepBmp = maList[i].get();
+ bRet = pStepBmp->maBitmapEx.Mirror(nMirrorFlags);
+ if (bRet)
{
- for (size_t i = 0, n = maList.size(); (i < n) && bRet; ++i)
- {
- AnimationBitmap* pStepBmp = maList[i].get();
- bRet = pStepBmp->maBitmapEx.Mirror(nMirrorFlags);
- if (bRet)
- {
- if (nMirrorFlags & BmpMirrorFlags::Horizontal)
- pStepBmp->maPositionPixel.setX(maGlobalSize.Width()
- - pStepBmp->maPositionPixel.X()
- - pStepBmp->maSizePixel.Width());
-
- if (nMirrorFlags & BmpMirrorFlags::Vertical)
- pStepBmp->maPositionPixel.setY(maGlobalSize.Height()
- - pStepBmp->maPositionPixel.Y()
- - pStepBmp->maSizePixel.Height());
- }
- }
+ if (nMirrorFlags & BmpMirrorFlags::Horizontal)
+ pStepBmp->maPositionPixel.setX(maGlobalSize.Width() - pStepBmp->maPositionPixel.X()
+ - pStepBmp->maSizePixel.Width());
- maBitmapEx.Mirror(nMirrorFlags);
+ if (nMirrorFlags & BmpMirrorFlags::Vertical)
+ pStepBmp->maPositionPixel.setY(maGlobalSize.Height() - pStepBmp->maPositionPixel.Y()
+ - pStepBmp->maSizePixel.Height());
}
}
+
+ maBitmapEx.Mirror(nMirrorFlags);
}
void Animation::Adjust(short nLuminancePercent, short nContrastPercent, short nChannelRPercent,
@@ -535,20 +533,19 @@ void Animation::Adjust(short nLuminancePercent, short nContrastPercent, short nC
bool bRet;
- if (!IsInAnimation() && !maList.empty())
- {
- bRet = true;
+ if (IsInAnimation() || maList.empty())
+ return;
- for (size_t i = 0, n = maList.size(); (i < n) && bRet; ++i)
- {
- bRet = maList[i]->maBitmapEx.Adjust(nLuminancePercent, nContrastPercent,
- nChannelRPercent, nChannelGPercent,
- nChannelBPercent, fGamma, bInvert);
- }
+ bRet = true;
- maBitmapEx.Adjust(nLuminancePercent, nContrastPercent, nChannelRPercent, nChannelGPercent,
- nChannelBPercent, fGamma, bInvert);
+ for (size_t i = 0, n = maList.size(); (i < n) && bRet; ++i)
+ {
+ bRet = maList[i]->maBitmapEx.Adjust(nLuminancePercent, nContrastPercent, nChannelRPercent,
+ nChannelGPercent, nChannelBPercent, fGamma, bInvert);
}
+
+ maBitmapEx.Adjust(nLuminancePercent, nContrastPercent, nChannelRPercent, nChannelGPercent,
+ nChannelBPercent, fGamma, bInvert);
}
SvStream& WriteAnimation(SvStream& rOStm, const Animation& rAnimation)
diff --git a/vcl/source/app/help.cxx b/vcl/source/app/help.cxx
index ebe7588c562f..acbab4bb6b85 100644
--- a/vcl/source/app/help.cxx
+++ b/vcl/source/app/help.cxx
@@ -402,19 +402,19 @@ void HelpTextWindow::Paint( vcl::RenderContext& rRenderContext, const tools::Rec
}
// border
- if (!bNativeOK)
+ if (bNativeOK)
+ return;
+
+ Size aSz = GetOutputSizePixel();
+ rRenderContext.DrawRect(tools::Rectangle(Point(), aSz));
+ if (mnHelpWinStyle == HELPWINSTYLE_BALLOON)
{
- Size aSz = GetOutputSizePixel();
- rRenderContext.DrawRect(tools::Rectangle(Point(), aSz));
- if (mnHelpWinStyle == HELPWINSTYLE_BALLOON)
- {
- aSz.AdjustWidth( -2 );
- aSz.AdjustHeight( -2 );
- Color aColor(rRenderContext.GetLineColor());
- rRenderContext.SetLineColor(COL_GRAY);
- rRenderContext.DrawRect(tools::Rectangle(Point(1, 1), aSz));
- rRenderContext.SetLineColor(aColor);
- }
+ aSz.AdjustWidth( -2 );
+ aSz.AdjustHeight( -2 );
+ Color aColor(rRenderContext.GetLineColor());
+ rRenderContext.SetLineColor(COL_GRAY);
+ rRenderContext.DrawRect(tools::Rectangle(Point(1, 1), aSz));
+ rRenderContext.SetLineColor(aColor);
}
}
diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx
index 37b6f595e178..3c95b11eeb33 100644
--- a/vcl/source/app/salvtables.cxx
+++ b/vcl/source/app/salvtables.cxx
@@ -1205,28 +1205,28 @@ public:
void CollectChildren(const vcl::Window& rCurrent, const basegfx::B2IPoint& rTopLeft,
weld::ScreenShotCollection& rControlDataCollection)
{
- if (rCurrent.IsVisible())
+ if (!rCurrent.IsVisible())
+ return;
+
+ const Point aCurrentPos(rCurrent.GetPosPixel());
+ const Size aCurrentSize(rCurrent.GetSizePixel());
+ const basegfx::B2IPoint aCurrentTopLeft(rTopLeft.getX() + aCurrentPos.X(),
+ rTopLeft.getY() + aCurrentPos.Y());
+ const basegfx::B2IRange aCurrentRange(
+ aCurrentTopLeft,
+ aCurrentTopLeft + basegfx::B2IPoint(aCurrentSize.Width(), aCurrentSize.Height()));
+
+ if (!aCurrentRange.isEmpty())
{
- const Point aCurrentPos(rCurrent.GetPosPixel());
- const Size aCurrentSize(rCurrent.GetSizePixel());
- const basegfx::B2IPoint aCurrentTopLeft(rTopLeft.getX() + aCurrentPos.X(),
- rTopLeft.getY() + aCurrentPos.Y());
- const basegfx::B2IRange aCurrentRange(
- aCurrentTopLeft,
- aCurrentTopLeft + basegfx::B2IPoint(aCurrentSize.Width(), aCurrentSize.Height()));
+ rControlDataCollection.emplace_back(rCurrent.GetHelpId(), aCurrentRange);
+ }
- if (!aCurrentRange.isEmpty())
+ for (sal_uInt16 a(0); a < rCurrent.GetChildCount(); a++)
+ {
+ vcl::Window* pChild = rCurrent.GetChild(a);
+ if (nullptr != pChild)
{
- rControlDataCollection.emplace_back(rCurrent.GetHelpId(), aCurrentRange);
- }
-
- for (sal_uInt16 a(0); a < rCurrent.GetChildCount(); a++)
- {
- vcl::Window* pChild = rCurrent.GetChild(a);
- if (nullptr != pChild)
- {
- CollectChildren(*pChild, aCurrentTopLeft, rControlDataCollection);
- }
+ CollectChildren(*pChild, aCurrentTopLeft, rControlDataCollection);
}
}
}
@@ -4651,21 +4651,22 @@ public:
assert(col >= 0 && "cannot sort on expander column");
LclHeaderTabListBox* pHeaderBox = dynamic_cast<LclHeaderTabListBox*>(m_xTreeView.get());
- if (HeaderBar* pHeaderBar = pHeaderBox ? pHeaderBox->GetHeaderBar() : nullptr)
+ HeaderBar* pHeaderBar = pHeaderBox ? pHeaderBox->GetHeaderBar() : nullptr;
+ if (!pHeaderBar)
+ return;
+
+ sal_uInt16 nTextId = pHeaderBar->GetItemId(col);
+ HeaderBarItemBits nBits = pHeaderBar->GetItemBits(nTextId);
+ nBits &= ~HeaderBarItemBits::UPARROW;
+ nBits &= ~HeaderBarItemBits::DOWNARROW;
+ if (eState != TRISTATE_INDET)
{
- sal_uInt16 nTextId = pHeaderBar->GetItemId(col);
- HeaderBarItemBits nBits = pHeaderBar->GetItemBits(nTextId);
- nBits &= ~HeaderBarItemBits::UPARROW;
- nBits &= ~HeaderBarItemBits::DOWNARROW;
- if (eState != TRISTATE_INDET)
- {
- if (eState == TRISTATE_TRUE)
- nBits |= HeaderBarItemBits::DOWNARROW;
- else
- nBits |= HeaderBarItemBits::UPARROW;
- }
- pHeaderBar->SetItemBits(nTextId, nBits);
+ if (eState == TRISTATE_TRUE)
+ nBits |= HeaderBarItemBits::DOWNARROW;
+ else
+ nBits |= HeaderBarItemBits::UPARROW;
}
+ pHeaderBar->SetItemBits(nTextId, nBits);
}
virtual TriState get_sort_indicator(int col) const override
@@ -6381,25 +6382,25 @@ IMPL_LINK(SalInstanceEntryTreeView, KeyPressListener, VclWindowEvent&, rEvent, v
return;
const KeyEvent& rKeyEvent = *static_cast<KeyEvent*>(rEvent.GetData());
sal_uInt16 nKeyCode = rKeyEvent.GetKeyCode().GetCode();
- if (nKeyCode == KEY_UP || nKeyCode == KEY_DOWN || nKeyCode == KEY_PAGEUP
- || nKeyCode == KEY_PAGEDOWN)
+ if (!(nKeyCode == KEY_UP || nKeyCode == KEY_DOWN || nKeyCode == KEY_PAGEUP
+ || nKeyCode == KEY_PAGEDOWN))
+ return;
+
+ m_pTreeView->disable_notify_events();
+ auto& rListBox = m_pTreeView->getTreeView();
+ if (!rListBox.FirstSelected())
{
- m_pTreeView->disable_notify_events();
- auto& rListBox = m_pTreeView->getTreeView();
- if (!rListBox.FirstSelected())
- {
- if (SvTreeListEntry* pEntry = rListBox.First())
- rListBox.Select(pEntry, true);
- }
- else
- rListBox.KeyInput(rKeyEvent);
- m_xEntry->set_text(m_xTreeView->get_selected_text());
- m_xEntry->select_region(0, -1);
- m_pTreeView->enable_notify_events();
- m_bTreeChange = true;
- m_pEntry->fire_signal_changed();
- m_bTreeChange = false;
+ if (SvTreeListEntry* pEntry = rListBox.First())
+ rListBox.Select(pEntry, true);
}
+ else
+ rListBox.KeyInput(rKeyEvent);
+ m_xEntry->set_text(m_xTreeView->get_selected_text());
+ m_xEntry->select_region(0, -1);
+ m_pTreeView->enable_notify_events();
+ m_bTreeChange = true;
+ m_pEntry->fire_signal_changed();
+ m_bTreeChange = false;
}
IMPL_LINK(SalInstanceEntryTreeView, AutocompleteHdl, Edit&, rEdit, void)
@@ -6853,37 +6854,37 @@ void SalInstanceWindow::help()
weld::Widget* pSource = xTemp ? xTemp.get() : this;
bool bRunNormalHelpRequest = !m_aHelpRequestHdl.IsSet() || m_aHelpRequestHdl.Call(*pSource);
Help* pHelp = bRunNormalHelpRequest ? Application::GetHelp() : nullptr;
- if (pHelp)
- {
- // tdf#126007, there's a nice fallback route for offline help where
- // the current page of a notebook will get checked when the help
- // button is pressed and there was no help for the dialog found.
- //
- // But for online help that route doesn't get taken, so bodge this here
- // by using the page help id if available and if the help button itself
- // was the original id
- if (m_pBuilder && sHelpId.endsWith("/help"))
+ if (!pHelp)
+ return;
+
+ // tdf#126007, there's a nice fallback route for offline help where
+ // the current page of a notebook will get checked when the help
+ // button is pressed and there was no help for the dialog found.
+ //
+ // But for online help that route doesn't get taken, so bodge this here
+ // by using the page help id if available and if the help button itself
+ // was the original id
+ if (m_pBuilder && sHelpId.endsWith("/help"))
+ {
+ OString sPageId = m_pBuilder->get_current_page_help_id();
+ if (!sPageId.isEmpty())
+ sHelpId = sPageId;
+ else
{
- OString sPageId = m_pBuilder->get_current_page_help_id();
- if (!sPageId.isEmpty())
- sHelpId = sPageId;
- else
+ // tdf#129068 likewise the help for the wrapping dialog is less
+ // helpful than the help for the content area could be
+ vcl::Window* pContentArea = nullptr;
+ if (::Dialog* pDialog = dynamic_cast<::Dialog*>(m_xWindow.get()))
+ pContentArea = pDialog->get_content_area();
+ if (pContentArea)
{
- // tdf#129068 likewise the help for the wrapping dialog is less
- // helpful than the help for the content area could be
- vcl::Window* pContentArea = nullptr;
- if (::Dialog* pDialog = dynamic_cast<::Dialog*>(m_xWindow.get()))
- pContentArea = pDialog->get_content_area();
- if (pContentArea)
- {
- vcl::Window* pContentWidget = pContentArea->GetWindow(GetWindowType::LastChild);
- if (pContentWidget)
- sHelpId = pContentWidget->GetHelpId();
- }
+ vcl::Window* pContentWidget = pContentArea->GetWindow(GetWindowType::LastChild);
+ if (pContentWidget)
+ sHelpId = pContentWidget->GetHelpId();
}
}
- pHelp->Start(OStringToOUString(sHelpId, RTL_TEXTENCODING_UTF8), pSource);
}
+ pHelp->Start(OStringToOUString(sHelpId, RTL_TEXTENCODING_UTF8), pSource);
}
//iterate upwards through the hierarchy from this widgets through its parents
diff --git a/vcl/source/app/settings.cxx b/vcl/source/app/settings.cxx
index 8e18213f412a..340aebf92435 100644
--- a/vcl/source/app/settings.cxx
+++ b/vcl/source/app/settings.cxx
@@ -2864,20 +2864,20 @@ void AllSettings::SetLanguageTag(const OUString& rLanguage, bool bCanonicalize)
void AllSettings::SetLanguageTag( const LanguageTag& rLanguageTag )
{
- if (mxData->maLocale != rLanguageTag)
- {
- CopyData();
+ if (mxData->maLocale == rLanguageTag)
+ return;
- mxData->maLocale = rLanguageTag;
+ CopyData();
- if ( mxData->mpLocaleDataWrapper )
- {
- mxData->mpLocaleDataWrapper.reset();
- }
- if ( mxData->mpI18nHelper )
- {
- mxData->mpI18nHelper.reset();
- }
+ mxData->maLocale = rLanguageTag;
+
+ if ( mxData->mpLocaleDataWrapper )
+ {
+ mxData->mpLocaleDataWrapper.reset();
+ }
+ if ( mxData->mpI18nHelper )
+ {
+ mxData->mpI18nHelper.reset();
}
}
diff --git a/vcl/source/app/svapp.cxx b/vcl/source/app/svapp.cxx
index 60bc22d12c6a..80b92f34de5d 100644
--- a/vcl/source/app/svapp.cxx
+++ b/vcl/source/app/svapp.cxx
@@ -1686,19 +1686,19 @@ void registerPollCallbacks(
void unregisterPollCallbacks()
{
ImplSVData * pSVData = ImplGetSVData();
- if (pSVData)
- {
- // Not hyper-elegant - but in the case of Android & unipoll we need to detach
- // this thread from the JVM's clutches to avoid a crash closing document
- if (pSVData->mpPollClosure && pSVData->mpDefInst)
- pSVData->mpDefInst->releaseMainThread();
-
- // Just set mpPollClosure to null as that is what calling this means, that the callback data
- // points to an object that no longer exists. In particular, don't set
- // pSVData->mpPollCallback to nullptr as that is used to detect whether Unipoll is in use in
- // isUnipoll().
- pSVData->mpPollClosure = nullptr;
- }
+ if (!pSVData)
+ return;
+
+ // Not hyper-elegant - but in the case of Android & unipoll we need to detach
+ // this thread from the JVM's clutches to avoid a crash closing document
+ if (pSVData->mpPollClosure && pSVData->mpDefInst)
+ pSVData->mpDefInst->releaseMainThread();
+
+ // Just set mpPollClosure to null as that is what calling this means, that the callback data
+ // points to an object that no longer exists. In particular, don't set
+ // pSVData->mpPollCallback to nullptr as that is used to detect whether Unipoll is in use in
+ // isUnipoll().
+ pSVData->mpPollClosure = nullptr;
}
bool isUnipoll()
diff --git a/vcl/source/app/svdata.cxx b/vcl/source/app/svdata.cxx
index 16772724c782..41f9f1bd7af4 100644
--- a/vcl/source/app/svdata.cxx
+++ b/vcl/source/app/svdata.cxx
@@ -388,19 +388,19 @@ void SetSVWinData(ImplSVWinData* pSVWinData)
ImplSVData* pSVData = ImplGetSVData();
assert(pSVData != nullptr);
- if (pSVData->mpWinData != pSVWinData)
+ if (pSVData->mpWinData == pSVWinData)
+ return;
+
+ // If current one is the static, clean it up to avoid having lingering references.
+ if (pSVData->mpWinData == &private_aImplSVWinData::get())
{
- // If current one is the static, clean it up to avoid having lingering references.
- if (pSVData->mpWinData == &private_aImplSVWinData::get())
- {
- pSVData->mpWinData->mpFocusWin.reset();
- }
+ pSVData->mpWinData->mpFocusWin.reset();
+ }
- pSVData->mpWinData = pSVWinData;
- if (pSVData->mpWinData == nullptr)
- {
- pSVData->mpWinData = &private_aImplSVWinData::get(); // Never leave it null.
- }
+ pSVData->mpWinData = pSVWinData;
+ if (pSVData->mpWinData == nullptr)
+ {
+ pSVData->mpWinData = &private_aImplSVWinData::get(); // Never leave it null.
}
}
@@ -453,19 +453,19 @@ void SetSVHelpData(ImplSVHelpData* pSVHelpData)
return;
ImplSVData* pSVData = ImplGetSVData();
- if (pSVData->mpHelpData != pSVHelpData)
+ if (pSVData->mpHelpData == pSVHelpData)
+ return;
+
+ // If current one is the static, clean it up to avoid having lingering references.
+ if (pSVData->mpHelpData == &private_aImplSVHelpData::get())
{
- // If current one is the static, clean it up to avoid having lingering references.
- if (pSVData->mpHelpData == &private_aImplSVHelpData::get())
- {
- pSVData->mpHelpData->mpHelpWin.reset();
- }
+ pSVData->mpHelpData->mpHelpWin.reset();
+ }
- pSVData->mpHelpData = pSVHelpData;
- if (pSVData->mpHelpData == nullptr)
- {
- pSVData->mpHelpData = &private_aImplSVHelpData::get(); // Never leave it null.
- }
+ pSVData->mpHelpData = pSVHelpData;
+ if (pSVData->mpHelpData == nullptr)
+ {
+ pSVData->mpHelpData = &private_aImplSVHelpData::get(); // Never leave it null.
}
}
diff --git a/vcl/source/app/unohelp.cxx b/vcl/source/app/unohelp.cxx
index 6d9e6f31abe5..f08e54131259 100644
--- a/vcl/source/app/unohelp.cxx
+++ b/vcl/source/app/unohelp.cxx
@@ -48,20 +48,19 @@ uno::Reference < i18n::XCharacterClassification > vcl::unohelper::CreateCharacte
void vcl::unohelper::NotifyAccessibleStateEventGlobally( const css::accessibility::AccessibleEventObject& rEventObject )
{
css::uno::Reference< css::awt::XExtendedToolkit > xExtToolkit( Application::GetVCLToolkit(), uno::UNO_QUERY );
- if ( xExtToolkit.is() )
+ if ( !xExtToolkit.is() )
+ return;
+
+ // Only for focus events
+ sal_Int16 nType = css::accessibility::AccessibleStateType::INVALID;
+ rEventObject.NewValue >>= nType;
+ if ( nType == css::accessibility::AccessibleStateType::FOCUSED )
+ xExtToolkit->fireFocusGained( rEventObject.Source );
+ else
{
- // Only for focus events
- sal_Int16 nType = css::accessibility::AccessibleStateType::INVALID;
- rEventObject.NewValue >>= nType;
+ rEventObject.OldValue >>= nType;
if ( nType == css::accessibility::AccessibleStateType::FOCUSED )
- xExtToolkit->fireFocusGained( rEventObject.Source );
- else
- {
- rEventObject.OldValue >>= nType;
- if ( nType == css::accessibility::AccessibleStateType::FOCUSED )
- xExtToolkit->fireFocusLost( rEventObject.Source );
- }
-
+ xExtToolkit->fireFocusLost( rEventObject.Source );
}
}
diff --git a/vcl/source/bitmap/Octree.cxx b/vcl/source/bitmap/Octree.cxx
index 44f911ef0c92..b39e5a1673f2 100644
--- a/vcl/source/bitmap/Octree.cxx
+++ b/vcl/source/bitmap/Octree.cxx
@@ -40,45 +40,45 @@ Octree::Octree(const BitmapReadAccess& rReadAcc, sal_uLong nColors)
const BitmapReadAccess* pAccess = &rReadAcc;
sal_uLong nMax(nColors);
- if (!!*pAccess)
- {
- const long nWidth = pAccess->Width();
- const long nHeight = pAccess->Height();
+ if (!*pAccess)
+ return;
+
+ const long nWidth = pAccess->Width();
+ const long nHeight = pAccess->Height();
- if (pAccess->HasPalette())
+ if (pAccess->HasPalette())
+ {
+ for (long nY = 0; nY < nHeight; nY++)
{
- for (long nY = 0; nY < nHeight; nY++)
+ Scanline pScanline = pAccess->GetScanline(nY);
+ for (long nX = 0; nX < nWidth; nX++)
{
- Scanline pScanline = pAccess->GetScanline(nY);
- for (long nX = 0; nX < nWidth; nX++)
- {
- mpColor = &pAccess->GetPaletteColor(pAccess->GetIndexFromData(pScanline, nX));
- mnLevel = 0;
- add(pTree);
-
- while (mnLeafCount > nMax)
- reduce();
- }
+ mpColor = &pAccess->GetPaletteColor(pAccess->GetIndexFromData(pScanline, nX));
+ mnLevel = 0;
+ add(pTree);
+
+ while (mnLeafCount > nMax)
+ reduce();
}
}
- else
- {
- BitmapColor aColor;
+ }
+ else
+ {
+ BitmapColor aColor;
- mpColor = &aColor;
+ mpColor = &aColor;
- for (long nY = 0; nY < nHeight; nY++)
+ for (long nY = 0; nY < nHeight; nY++)
+ {
+ Scanline pScanline = pAccess->GetScanline(nY);
+ for (long nX = 0; nX < nWidth; nX++)
{
- Scanline pScanline = pAccess->GetScanline(nY);
- for (long nX = 0; nX < nWidth; nX++)
- {
- aColor = pAccess->GetPixelFromData(pScanline, nX);
- mnLevel = 0;
- add(pTree);
-
- while (mnLeafCount > nMax)
- reduce();
- }
+ aColor = pAccess->GetPixelFromData(pScanline, nX);
+ mnLevel = 0;
+ add(pTree);
+
+ while (mnLeafCount > nMax)
+ reduce();
}
}
}
diff --git a/vcl/source/bitmap/bitmap.cxx b/vcl/source/bitmap/bitmap.cxx
index 4da73a65d3cc..242f4a3a958c 100644
--- a/vcl/source/bitmap/bitmap.cxx
+++ b/vcl/source/bitmap/bitmap.cxx
@@ -57,63 +57,63 @@ Bitmap::Bitmap(std::shared_ptr<SalBitmap> const & pSalBitmap)
Bitmap::Bitmap( const Size& rSizePixel, sal_uInt16 nBitCount, const BitmapPalette* pPal )
{
- if (rSizePixel.Width() && rSizePixel.Height())
- {
- BitmapPalette aPal;
- BitmapPalette* pRealPal = nullptr;
+ if (!(rSizePixel.Width() && rSizePixel.Height()))
+ return;
+
+ BitmapPalette aPal;
+ BitmapPalette* pRealPal = nullptr;
- if( nBitCount <= 8 )
+ if( nBitCount <= 8 )
+ {
+ if( !pPal )
{
- if( !pPal )
+ if( 1 == nBitCount )
{
- if( 1 == nBitCount )
- {
- aPal.SetEntryCount( 2 );
- aPal[ 0 ] = COL_BLACK;
- aPal[ 1 ] = COL_WHITE;
- }
- else if( ( 4 == nBitCount ) || ( 8 == nBitCount ) )
+ aPal.SetEntryCount( 2 );
+ aPal[ 0 ] = COL_BLACK;
+ aPal[ 1 ] = COL_WHITE;
+ }
+ else if( ( 4 == nBitCount ) || ( 8 == nBitCount ) )
+ {
+ aPal.SetEntryCount( 1 << nBitCount );
+ aPal[ 0 ] = COL_BLACK;
+ aPal[ 1 ] = COL_BLUE;
+ aPal[ 2 ] = COL_GREEN;
+ aPal[ 3 ] = COL_CYAN;
+ aPal[ 4 ] = COL_RED;
+ aPal[ 5 ] = COL_MAGENTA;
+ aPal[ 6 ] = COL_BROWN;
+ aPal[ 7 ] = COL_GRAY;
+ aPal[ 8 ] = COL_LIGHTGRAY;
+ aPal[ 9 ] = COL_LIGHTBLUE;
+ aPal[ 10 ] = COL_LIGHTGREEN;
+ aPal[ 11 ] = COL_LIGHTCYAN;
+ aPal[ 12 ] = COL_LIGHTRED;
+ aPal[ 13 ] = COL_LIGHTMAGENTA;
+ aPal[ 14 ] = COL_YELLOW;
+ aPal[ 15 ] = COL_WHITE;
+
+ // Create dither palette
+ if( 8 == nBitCount )
{
- aPal.SetEntryCount( 1 << nBitCount );
- aPal[ 0 ] = COL_BLACK;
- aPal[ 1 ] = COL_BLUE;
- aPal[ 2 ] = COL_GREEN;
- aPal[ 3 ] = COL_CYAN;
- aPal[ 4 ] = COL_RED;
- aPal[ 5 ] = COL_MAGENTA;
- aPal[ 6 ] = COL_BROWN;
- aPal[ 7 ] = COL_GRAY;
- aPal[ 8 ] = COL_LIGHTGRAY;
- aPal[ 9 ] = COL_LIGHTBLUE;
- aPal[ 10 ] = COL_LIGHTGREEN;
- aPal[ 11 ] = COL_LIGHTCYAN;
- aPal[ 12 ] = COL_LIGHTRED;
- aPal[ 13 ] = COL_LIGHTMAGENTA;
- aPal[ 14 ] = COL_YELLOW;
- aPal[ 15 ] = COL_WHITE;
-
- // Create dither palette
- if( 8 == nBitCount )
- {
- sal_uInt16 nActCol = 16;
+ sal_uInt16 nActCol = 16;
- for( sal_uInt16 nB = 0; nB < 256; nB += 51 )
- for( sal_uInt16 nG = 0; nG < 256; nG += 51 )
- for( sal_uInt16 nR = 0; nR < 256; nR += 51 )
- aPal[ nActCol++ ] = BitmapColor( static_cast<sal_uInt8>(nR), static_cast<sal_uInt8>(nG), static_cast<sal_uInt8>(nB) );
+ for( sal_uInt16 nB = 0; nB < 256; nB += 51 )
+ for( sal_uInt16 nG = 0; nG < 256; nG += 51 )
+ for( sal_uInt16 nR = 0; nR < 256; nR += 51 )
+ aPal[ nActCol++ ] = BitmapColor( static_cast<sal_uInt8>(nR), static_cast<sal_uInt8>(nG), static_cast<sal_uInt8>(nB) );
- // Set standard Office colors
- aPal[ nActCol++ ] = BitmapColor( 0, 184, 255 );
- }
+ // Set standard Office colors
+ aPal[ nActCol++ ] = BitmapColor( 0, 184, 255 );
}
}
- else
- pRealPal = const_cast<BitmapPalette*>(pPal);
}
-
- mxSalBmp = ImplGetSVData()->mpDefInst->CreateSalBitmap();
- mxSalBmp->Create( rSizePixel, nBitCount, pRealPal ? *pRealPal : aPal );
+ else
+ pRealPal = const_cast<BitmapPalette*>(pPal);
}
+
+ mxSalBmp = ImplGetSVData()->mpDefInst->CreateSalBitmap();
+ mxSalBmp->Create( rSizePixel, nBitCount, pRealPal ? *pRealPal : aPal );
}
#ifdef DBG_UTIL
diff --git a/vcl/source/control/button.cxx b/vcl/source/control/button.cxx
index b58b8d9fe019..3015c65f1b0c 100644
--- a/vcl/source/control/button.cxx
+++ b/vcl/source/control/button.cxx
@@ -633,30 +633,30 @@ void PushButton::ImplInitSettings( bool bBackground )
{
Button::ImplInitSettings();
- if ( bBackground )
+ if ( !bBackground )
+ return;
+
+ SetBackground();
+ // #i38498#: do not check for GetParent()->IsChildTransparentModeEnabled()
+ // otherwise the formcontrol button will be overdrawn due to ParentClipMode::NoClip
+ // for radio and checkbox this is ok as they should appear transparent in documents
+ if ( IsNativeControlSupported( ControlType::Pushbutton, ControlPart::Entire ) ||
+ (GetStyle() & WB_FLATBUTTON) != 0 )
{
- SetBackground();
- // #i38498#: do not check for GetParent()->IsChildTransparentModeEnabled()
- // otherwise the formcontrol button will be overdrawn due to ParentClipMode::NoClip
- // for radio and checkbox this is ok as they should appear transparent in documents
- if ( IsNativeControlSupported( ControlType::Pushbutton, ControlPart::Entire ) ||
- (GetStyle() & WB_FLATBUTTON) != 0 )
- {
- EnableChildTransparentMode();
- SetParentClipMode( ParentClipMode::NoClip );
- SetPaintTransparent( true );
-
- if ((GetStyle() & WB_FLATBUTTON) == 0)
- mpWindowImpl->mbUseNativeFocus = ImplGetSVData()->maNWFData.mbNoFocusRects;
- else
- mpWindowImpl->mbUseNativeFocus = ImplGetSVData()->maNWFData.mbNoFocusRectsForFlatButtons;
- }
+ EnableChildTransparentMode();
+ SetParentClipMode( ParentClipMode::NoClip );
+ SetPaintTransparent( true );
+
+ if ((GetStyle() & WB_FLATBUTTON) == 0)
+ mpWindowImpl->mbUseNativeFocus = ImplGetSVData()->maNWFData.mbNoFocusRects;
else
- {
- EnableChildTransparentMode( false );
- SetParentClipMode();
- SetPaintTransparent( false );
- }
+ mpWindowImpl->mbUseNativeFocus = ImplGetSVData()->maNWFData.mbNoFocusRectsForFlatButtons;
+ }
+ else
+ {
+ EnableChildTransparentMode( false );
+ SetParentClipMode();
+ SetPaintTransparent( false );
}
}
@@ -1032,31 +1032,31 @@ void PushButton::ImplDrawPushButton(vcl::RenderContext& rRenderContext)
ShowFocus(ImplGetFocusRect());
}
- if (!bNativeOK)
+ if (bNativeOK)
+ return;
+
+ // draw PushButtonFrame, aInRect has content size afterwards
+ if (GetStyle() & WB_FLATBUTTON)
{
- // draw PushButtonFrame, aInRect has content size afterwards
- if (GetStyle() & WB_FLATBUTTON)
- {
- tools::Rectangle aTempRect(aInRect);
- if (bRollOver)
- ImplDrawPushButtonFrame(rRenderContext, aTempRect, nButtonStyle);
- aInRect.AdjustLeft(2 );
- aInRect.AdjustTop(2 );
- aInRect.AdjustRight( -2 );
- aInRect.AdjustBottom( -2 );
- }
- else
- {
- ImplDrawPushButtonFrame(rRenderContext, aInRect, nButtonStyle);
- }
+ tools::Rectangle aTempRect(aInRect);
+ if (bRollOver)
+ ImplDrawPushButtonFrame(rRenderContext, aTempRect, nButtonStyle);
+ aInRect.AdjustLeft(2 );
+ aInRect.AdjustTop(2 );
+ aInRect.AdjustRight( -2 );
+ aInRect.AdjustBottom( -2 );
+ }
+ else
+ {
+ ImplDrawPushButtonFrame(rRenderContext, aInRect, nButtonStyle);
+ }
- // draw content
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list