[Libreoffice-commits] core.git: Branch 'feature/drawinglayercore' - 15 commits - emfio/source filter/CppunitTest_filter_tiff_test.mk filter/Library_gie.mk filter/Module_filter.mk filter/qa filter/source include/vcl offapi/com offapi/UnoApi_offapi.mk sd/qa sd/source sfx2/source solenv/clang-format svx/source vcl/CppunitTest_vcl_filters_test.mk vcl/CppunitTest_vcl_graphic_test.mk vcl/inc vcl/Library_vcl.mk vcl/qa vcl/source
Tomaž Vajngerl (via logerrit)
logerrit at kemper.freedesktop.org
Thu Dec 31 10:40:52 UTC 2020
Rebased ref, commits from common ancestor:
commit 812931cee980defa6197934a63196744f5ed76de
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Thu Dec 31 19:38:25 2020 +0900
Commit: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
CommitDate: Thu Dec 31 19:40:03 2020 +0900
BinaryDataContainer UNO improvement
Change-Id: I44afd52d39bcb3d11bbd6676f54118b4161786cb
diff --git a/include/vcl/BinaryDataContainerTools.hxx b/include/vcl/BinaryDataContainerTools.hxx
new file mode 100644
index 000000000000..d3d2cbe1f73e
--- /dev/null
+++ b/include/vcl/BinaryDataContainerTools.hxx
@@ -0,0 +1,23 @@
+/* -*- 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/.
+ *
+ */
+
+#pragma once
+
+#include <vcl/dllapi.h>
+#include <vcl/BinaryDataContainer.hxx>
+#include <com/sun/star/util/XBinaryDataContainer.hpp>
+
+namespace vcl
+{
+VCL_DLLPUBLIC BinaryDataContainer convertUnoBinaryDataContainer(
+ const css::uno::Reference<css::util::XBinaryDataContainer>& rxBinaryDataContainer);
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/Library_vcl.mk b/vcl/Library_vcl.mk
index b7b47ac463ec..478638da2220 100644
--- a/vcl/Library_vcl.mk
+++ b/vcl/Library_vcl.mk
@@ -322,6 +322,7 @@ $(eval $(call gb_Library_add_exception_objects,vcl,\
vcl/source/pdf/PDFiumLibrary \
vcl/source/pdf/ExternalPDFStreams \
vcl/source/graphic/BinaryDataContainer \
+ vcl/source/graphic/BinaryDataContainerTools \
vcl/source/graphic/GraphicID \
vcl/source/graphic/GraphicLoader \
vcl/source/graphic/GraphicObject \
diff --git a/vcl/inc/graphic/UnoBinaryDataContainer.hxx b/vcl/inc/graphic/UnoBinaryDataContainer.hxx
new file mode 100644
index 000000000000..f722d8966b62
--- /dev/null
+++ b/vcl/inc/graphic/UnoBinaryDataContainer.hxx
@@ -0,0 +1,53 @@
+/* -*- 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:
+ *
+ */
+
+#pragma once
+
+#include <cppuhelper/implbase.hxx>
+#include <cppuhelper/supportsservice.hxx>
+#include <comphelper/servicehelper.hxx>
+
+#include <com/sun/star/util/XBinaryDataContainer.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/lang/XUnoTunnel.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+
+#include <vcl/BinaryDataContainer.hxx>
+
+class UnoBinaryDataContainer final
+ : public cppu::WeakImplHelper<css::util::XBinaryDataContainer, css::lang::XUnoTunnel>
+{
+private:
+ BinaryDataContainer maBinaryDataContainer;
+
+public:
+ UnoBinaryDataContainer() {}
+
+ UnoBinaryDataContainer(BinaryDataContainer const& rBinaryDataContainer)
+ : maBinaryDataContainer(rBinaryDataContainer)
+ {
+ }
+
+ BinaryDataContainer const& getBinaryDataContainer() const { return maBinaryDataContainer; }
+
+ void setBinaryDataContainer(BinaryDataContainer const& rBinaryDataContainer)
+ {
+ maBinaryDataContainer = rBinaryDataContainer;
+ }
+
+ // XBinaryDataContainer
+ css::uno::Sequence<sal_Int8> SAL_CALL getCopyAsByteSequence() override;
+
+ UNO3_GETIMPLEMENTATION_DECL(UnoBinaryDataContainer)
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/graphic/BinaryDataContainerTools.cxx b/vcl/source/graphic/BinaryDataContainerTools.cxx
new file mode 100644
index 000000000000..3921e075cea2
--- /dev/null
+++ b/vcl/source/graphic/BinaryDataContainerTools.cxx
@@ -0,0 +1,28 @@
+/* -*- 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/.
+ *
+ */
+
+#include <vcl/BinaryDataContainerTools.hxx>
+#include <graphic/UnoBinaryDataContainer.hxx>
+
+namespace vcl
+{
+BinaryDataContainer convertUnoBinaryDataContainer(
+ const css::uno::Reference<css::util::XBinaryDataContainer>& rxBinaryDataContainer)
+{
+ BinaryDataContainer aBinaryDataContainer;
+ UnoBinaryDataContainer* pUnoBinaryDataContainer
+ = comphelper::getUnoTunnelImplementation<UnoBinaryDataContainer>(rxBinaryDataContainer);
+ if (pUnoBinaryDataContainer)
+ aBinaryDataContainer = pUnoBinaryDataContainer->getBinaryDataContainer();
+ return aBinaryDataContainer;
+}
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/graphic/UnoBinaryDataContainer.cxx b/vcl/source/graphic/UnoBinaryDataContainer.cxx
index cd6ce99d4a39..8ee3660be416 100644
--- a/vcl/source/graphic/UnoBinaryDataContainer.cxx
+++ b/vcl/source/graphic/UnoBinaryDataContainer.cxx
@@ -8,77 +8,27 @@
*
*/
-#include <cppuhelper/implbase.hxx>
-#include <cppuhelper/supportsservice.hxx>
+#include <graphic/UnoBinaryDataContainer.hxx>
-#include <com/sun/star/util/XBinaryDataContainer.hpp>
-#include <com/sun/star/lang/XServiceInfo.hpp>
-#include <com/sun/star/uno/XComponentContext.hpp>
-
-#include <vcl/BinaryDataContainer.hxx>
+#include <cppuhelper/queryinterface.hxx>
using namespace css;
-namespace
-{
-typedef ::cppu::WeakImplHelper<util::XBinaryDataContainer, css::lang::XServiceInfo>
- BinaryDataContainer_BASE;
+// css::lang::XUnoTunnel
+UNO3_GETIMPLEMENTATION_IMPL(UnoBinaryDataContainer);
-class UnoBinaryDataContainer : public BinaryDataContainer_BASE
+css::uno::Sequence<sal_Int8> SAL_CALL UnoBinaryDataContainer::getCopyAsByteSequence()
{
-private:
- BinaryDataContainer maBinaryDataContainer;
-
-public:
- explicit UnoBinaryDataContainer() {}
-
- BinaryDataContainer const& getBinaryDataContainer() { return maBinaryDataContainer; }
-
- void setBinaryDataContainer(BinaryDataContainer const& rBinaryDataContainer)
- {
- maBinaryDataContainer = rBinaryDataContainer;
- }
-
- // XBinaryDataContainer
- css::uno::Sequence<sal_Int8> SAL_CALL getCopyAsByteSequence() override
- {
- if (maBinaryDataContainer.isEmpty())
- return css::uno::Sequence<sal_Int8>();
+ if (maBinaryDataContainer.isEmpty())
+ return css::uno::Sequence<sal_Int8>();
- size_t nSize = maBinaryDataContainer.getSize();
+ size_t nSize = maBinaryDataContainer.getSize();
- css::uno::Sequence<sal_Int8> aData(nSize);
+ css::uno::Sequence<sal_Int8> aData(nSize);
- std::copy(maBinaryDataContainer.cbegin(), maBinaryDataContainer.cend(), aData.getArray());
+ std::copy(maBinaryDataContainer.cbegin(), maBinaryDataContainer.cend(), aData.getArray());
- return aData;
- }
-
- // XServiceInfo
- virtual OUString SAL_CALL getImplementationName() override
- {
- return "com.sun.star.util.BinaryDataContainer";
- }
-
- virtual sal_Bool SAL_CALL supportsService(OUString const& rServiceName) override
- {
- return cppu::supportsService(this, rServiceName);
- }
-
- virtual css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override
- {
- return uno::Sequence<OUString>{ "com.sun.star.util.BinaryDataContainer" };
- }
-};
-
-} // end anonymous namespace
-
-extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
-com_sun_star_comp_util_BinaryDataContainer_get_implementation(
- SAL_UNUSED_PARAMETER uno::XComponentContext*,
- SAL_UNUSED_PARAMETER uno::Sequence<uno::Any> const&)
-{
- return cppu::acquire(new UnoBinaryDataContainer());
+ return aData;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/vcl.common.component b/vcl/vcl.common.component
index abf5da9c10dd..2665a136afcc 100644
--- a/vcl/vcl.common.component
+++ b/vcl/vcl.common.component
@@ -35,8 +35,4 @@
constructor="dtrans_CMimeContentTypeFactory_get_implementation">
<service name="com.sun.star.datatransfer.MimeContentTypeFactory"/>
</implementation>
- <implementation name="com.sun.star.util.BinaryDataContainer"
- constructor="com_sun_star_comp_util_BinaryDataContainer_get_implementation">
- <service name="com.sun.star.util.BinaryDataContainer"/>
- </implementation>
</component>
commit bef085c8588b01b0fe94e5f1aa100d0cd6c14f2b
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Fri Dec 25 20:10:44 2020 +0900
Commit: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
CommitDate: Thu Dec 31 19:40:03 2020 +0900
vcl: add an UNO interface and impl. for BinaryDataContainer
Change-Id: Icbc384892bee8c31eb7f3a39ff9a64f1199b23b1
diff --git a/offapi/UnoApi_offapi.mk b/offapi/UnoApi_offapi.mk
index eabb1272588a..5e7fa60ebc34 100644
--- a/offapi/UnoApi_offapi.mk
+++ b/offapi/UnoApi_offapi.mk
@@ -446,6 +446,7 @@ $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,com/sun/star/ui/test,\
UITest \
))
$(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,com/sun/star/util,\
+ BinaryDataContainer \
JobManager \
NumberFormatter \
NumberFormatsSupplier \
@@ -4143,6 +4144,7 @@ $(eval $(call gb_UnoApi_add_idlfiles,offapi,com/sun/star/util,\
VetoException \
XAccounting \
XAtomServer \
+ XBinaryDataContainer \
XBroadcaster \
XCancellable \
XChainable \
diff --git a/offapi/com/sun/star/util/BinaryDataContainer.idl b/offapi/com/sun/star/util/BinaryDataContainer.idl
new file mode 100644
index 000000000000..be4102a20b1c
--- /dev/null
+++ b/offapi/com/sun/star/util/BinaryDataContainer.idl
@@ -0,0 +1,30 @@
+/* -*- 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/.
+ */
+
+#ifndef com_sun_star_util_BinaryDataContainer_idl
+#define com_sun_star_util_BinaryDataContainer_idl
+
+
+module com { module sun { module star { module util
+{
+
+/** Implementation of a container for binary data.
+
+ @since LibreOffice 7.2
+ */
+
+service BinaryDataContainer : XBinaryDataContainer
+{
+};
+
+}; }; }; };
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/offapi/com/sun/star/util/XBinaryDataContainer.idl b/offapi/com/sun/star/util/XBinaryDataContainer.idl
new file mode 100644
index 000000000000..563ac4db7e00
--- /dev/null
+++ b/offapi/com/sun/star/util/XBinaryDataContainer.idl
@@ -0,0 +1,29 @@
+/* -*- 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/.
+ */
+
+#ifndef com_sun_star_util_XBinaryDataContainer_idl
+#define com_sun_star_util_XBinaryDataContainer_idl
+
+module com { module sun { module star { module util
+{
+
+/** Container for binary data, typically an in-memory content of files.
+
+ @since LibreOffice 7.2
+ */
+interface XBinaryDataContainer
+{
+ sequence<byte> getCopyAsByteSequence();
+};
+
+}; }; }; };
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/Library_vcl.mk b/vcl/Library_vcl.mk
index 1a93ab808208..b7b47ac463ec 100644
--- a/vcl/Library_vcl.mk
+++ b/vcl/Library_vcl.mk
@@ -328,6 +328,7 @@ $(eval $(call gb_Library_add_exception_objects,vcl,\
vcl/source/graphic/GraphicObject2 \
vcl/source/graphic/GraphicReader \
vcl/source/graphic/Manager \
+ vcl/source/graphic/UnoBinaryDataContainer \
vcl/source/graphic/UnoGraphic \
vcl/source/graphic/UnoGraphicMapper \
vcl/source/graphic/UnoGraphicDescriptor \
diff --git a/vcl/source/graphic/UnoBinaryDataContainer.cxx b/vcl/source/graphic/UnoBinaryDataContainer.cxx
new file mode 100644
index 000000000000..cd6ce99d4a39
--- /dev/null
+++ b/vcl/source/graphic/UnoBinaryDataContainer.cxx
@@ -0,0 +1,84 @@
+/* -*- 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/.
+ *
+ */
+
+#include <cppuhelper/implbase.hxx>
+#include <cppuhelper/supportsservice.hxx>
+
+#include <com/sun/star/util/XBinaryDataContainer.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+
+#include <vcl/BinaryDataContainer.hxx>
+
+using namespace css;
+
+namespace
+{
+typedef ::cppu::WeakImplHelper<util::XBinaryDataContainer, css::lang::XServiceInfo>
+ BinaryDataContainer_BASE;
+
+class UnoBinaryDataContainer : public BinaryDataContainer_BASE
+{
+private:
+ BinaryDataContainer maBinaryDataContainer;
+
+public:
+ explicit UnoBinaryDataContainer() {}
+
+ BinaryDataContainer const& getBinaryDataContainer() { return maBinaryDataContainer; }
+
+ void setBinaryDataContainer(BinaryDataContainer const& rBinaryDataContainer)
+ {
+ maBinaryDataContainer = rBinaryDataContainer;
+ }
+
+ // XBinaryDataContainer
+ css::uno::Sequence<sal_Int8> SAL_CALL getCopyAsByteSequence() override
+ {
+ if (maBinaryDataContainer.isEmpty())
+ return css::uno::Sequence<sal_Int8>();
+
+ size_t nSize = maBinaryDataContainer.getSize();
+
+ css::uno::Sequence<sal_Int8> aData(nSize);
+
+ std::copy(maBinaryDataContainer.cbegin(), maBinaryDataContainer.cend(), aData.getArray());
+
+ return aData;
+ }
+
+ // XServiceInfo
+ virtual OUString SAL_CALL getImplementationName() override
+ {
+ return "com.sun.star.util.BinaryDataContainer";
+ }
+
+ virtual sal_Bool SAL_CALL supportsService(OUString const& rServiceName) override
+ {
+ return cppu::supportsService(this, rServiceName);
+ }
+
+ virtual css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override
+ {
+ return uno::Sequence<OUString>{ "com.sun.star.util.BinaryDataContainer" };
+ }
+};
+
+} // end anonymous namespace
+
+extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
+com_sun_star_comp_util_BinaryDataContainer_get_implementation(
+ SAL_UNUSED_PARAMETER uno::XComponentContext*,
+ SAL_UNUSED_PARAMETER uno::Sequence<uno::Any> const&)
+{
+ return cppu::acquire(new UnoBinaryDataContainer());
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/vcl.common.component b/vcl/vcl.common.component
index 2665a136afcc..abf5da9c10dd 100644
--- a/vcl/vcl.common.component
+++ b/vcl/vcl.common.component
@@ -35,4 +35,8 @@
constructor="dtrans_CMimeContentTypeFactory_get_implementation">
<service name="com.sun.star.datatransfer.MimeContentTypeFactory"/>
</implementation>
+ <implementation name="com.sun.star.util.BinaryDataContainer"
+ constructor="com_sun_star_comp_util_BinaryDataContainer_get_implementation">
+ <service name="com.sun.star.util.BinaryDataContainer"/>
+ </implementation>
</component>
commit 50a5efae6c7a11047082426be439f2d5fd3bfc8d
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Wed Dec 30 17:13:35 2020 +0900
Commit: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
CommitDate: Thu Dec 31 19:40:03 2020 +0900
vcl: Improve graphic manager swapping allocation
This improves the counting of the used space by graphics and
makes the manager loop faster.
Change-Id: Ifebe5fe52722d0f22dae0d1bdef02f65afb036ae
diff --git a/vcl/inc/graphic/Manager.hxx b/vcl/inc/graphic/Manager.hxx
index bff72780cbd7..098c8644ac61 100644
--- a/vcl/inc/graphic/Manager.hxx
+++ b/vcl/inc/graphic/Manager.hxx
@@ -41,6 +41,7 @@ private:
Manager();
void registerGraphic(const std::shared_ptr<ImpGraphic>& rImpGraphic);
+ void loopGraphicsAndSwapOut();
DECL_LINK(SwapOutTimerHandler, Timer*, void);
@@ -49,8 +50,8 @@ private:
public:
static Manager& get();
- void swappedIn(const ImpGraphic* pImpGraphic);
- void swappedOut(const ImpGraphic* pImpGraphic);
+ void swappedIn(const ImpGraphic* pImpGraphic, sal_Int64 nSizeBytes);
+ void swappedOut(const ImpGraphic* pImpGraphic, sal_Int64 nSizeBytes);
void reduceGraphicMemory();
void changeExisting(const ImpGraphic* pImpGraphic, sal_Int64 nOldSize);
diff --git a/vcl/source/gdi/impgraph.cxx b/vcl/source/gdi/impgraph.cxx
index 778d05c951b0..d98875dc7c98 100644
--- a/vcl/source/gdi/impgraph.cxx
+++ b/vcl/source/gdi/impgraph.cxx
@@ -1269,6 +1269,8 @@ bool ImpGraphic::swapOut()
bool bResult = false;
+ sal_Int64 nByteSize = getSizeBytes();
+
// We have GfxLink so we have the source available
if (mpGfxLink && mpGfxLink->IsNative())
{
@@ -1282,9 +1284,6 @@ bool ImpGraphic::swapOut()
// mark as swapped out
mbSwapOut = true;
- // Signal to manager that we have swapped out
- vcl::graphic::Manager::get().swappedOut(this);
-
bResult = true;
}
else
@@ -1324,12 +1323,15 @@ bool ImpGraphic::swapOut()
mpSwapFile = std::move(pSwapFile);
mbSwapOut = true;
-
- // Signal to manager that we have swapped out
- vcl::graphic::Manager::get().swappedOut(this);
}
}
+ if (bResult)
+ {
+ // Signal to manager that we have swapped out
+ vcl::graphic::Manager::get().swappedOut(this, nByteSize);
+ }
+
return bResult;
}
@@ -1465,7 +1467,9 @@ bool ImpGraphic::swapIn()
}
if (bReturn)
- vcl::graphic::Manager::get().swappedIn(this);
+ {
+ vcl::graphic::Manager::get().swappedIn(this, getSizeBytes());
+ }
return bReturn;
}
diff --git a/vcl/source/graphic/Manager.cxx b/vcl/source/graphic/Manager.cxx
index 5d535e446955..b6bf8bef610b 100644
--- a/vcl/source/graphic/Manager.cxx
+++ b/vcl/source/graphic/Manager.cxx
@@ -75,25 +75,23 @@ Manager::Manager()
}
}
-void Manager::reduceGraphicMemory()
+void Manager::loopGraphicsAndSwapOut()
{
- if (!mbSwapEnabled)
- return;
-
- std::scoped_lock<std::recursive_mutex> aGuard(maMutex);
-
// make a copy of m_pImpGraphicList because if we swap out a svg, the svg
// filter may create more temp Graphics which are auto-added to
// m_pImpGraphicList invalidating a loop over m_pImpGraphicList, e.g.
// reexport of tdf118346-1.odg
o3tl::sorted_vector<ImpGraphic*> aImpGraphicList = m_pImpGraphicList;
+
for (ImpGraphic* pEachImpGraphic : aImpGraphicList)
{
- if (mnUsedSize < mnMemoryLimit * 0.7)
+ if (double(mnUsedSize) < sal_Int64(mnMemoryLimit * 0.7))
return;
+ if (pEachImpGraphic->isSwappedOut())
+ continue;
sal_Int64 nCurrentGraphicSize = getGraphicSizeBytes(pEachImpGraphic);
- if (!pEachImpGraphic->isSwappedOut() && nCurrentGraphicSize > 1000000)
+ if (nCurrentGraphicSize > 100000)
{
if (!pEachImpGraphic->mpContext)
{
@@ -108,6 +106,33 @@ void Manager::reduceGraphicMemory()
}
}
+void Manager::reduceGraphicMemory()
+{
+ if (!mbSwapEnabled)
+ return;
+
+ if (mnUsedSize < mnMemoryLimit)
+ return;
+
+ std::scoped_lock<std::recursive_mutex> aGuard(maMutex);
+
+ loopGraphicsAndSwapOut();
+
+ sal_Int64 calculatedSize = 0;
+ for (ImpGraphic* pEachImpGraphic : m_pImpGraphicList)
+ {
+ if (!pEachImpGraphic->isSwappedOut())
+ {
+ calculatedSize += getGraphicSizeBytes(pEachImpGraphic);
+ }
+ }
+
+ if (calculatedSize != mnUsedSize)
+ {
+ mnUsedSize = calculatedSize;
+ }
+}
+
sal_Int64 Manager::getGraphicSizeBytes(const ImpGraphic* pImpGraphic)
{
if (!pImpGraphic->isAvailable())
@@ -213,18 +238,22 @@ std::shared_ptr<ImpGraphic> Manager::newInstance(const GraphicExternalLink& rGra
return pReturn;
}
-void Manager::swappedIn(const ImpGraphic* pImpGraphic)
+void Manager::swappedIn(const ImpGraphic* pImpGraphic, sal_Int64 nSizeBytes)
{
std::scoped_lock<std::recursive_mutex> aGuard(maMutex);
-
- mnUsedSize += getGraphicSizeBytes(pImpGraphic);
+ if (pImpGraphic)
+ {
+ mnUsedSize += nSizeBytes;
+ }
}
-void Manager::swappedOut(const ImpGraphic* pImpGraphic)
+void Manager::swappedOut(const ImpGraphic* pImpGraphic, sal_Int64 nSizeBytes)
{
std::scoped_lock<std::recursive_mutex> aGuard(maMutex);
-
- mnUsedSize -= getGraphicSizeBytes(pImpGraphic);
+ if (pImpGraphic)
+ {
+ mnUsedSize -= nSizeBytes;
+ }
}
void Manager::changeExisting(const ImpGraphic* pImpGraphic, sal_Int64 nOldSizeBytes)
commit d0909946336b2c74519884f40e80430286f88d23
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Tue Dec 29 23:11:04 2020 +0900
Commit: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
CommitDate: Thu Dec 31 19:40:03 2020 +0900
improve JpegWriterTest - detect type is correct during roundtrip
Change-Id: I4560be2dd1627caf8126142930c3479668689273
diff --git a/vcl/qa/cppunit/graphicfilter/filters-test.cxx b/vcl/qa/cppunit/graphicfilter/filters-test.cxx
index fe7485e3944a..2de865e77a85 100644
--- a/vcl/qa/cppunit/graphicfilter/filters-test.cxx
+++ b/vcl/qa/cppunit/graphicfilter/filters-test.cxx
@@ -144,6 +144,8 @@ void VclFiltersTest::testExportImport()
checkExportImport(u"png");
fprintf(stderr, "Check ExportImport BMP\n");
checkExportImport(u"bmp");
+ fprintf(stderr, "Check ExportImport TIF\n");
+ checkExportImport(u"tif");
}
void VclFiltersTest::testCVEs()
diff --git a/vcl/qa/cppunit/jpeg/JpegWriterTest.cxx b/vcl/qa/cppunit/jpeg/JpegWriterTest.cxx
index 234b2ea14514..38d46c0fe487 100644
--- a/vcl/qa/cppunit/jpeg/JpegWriterTest.cxx
+++ b/vcl/qa/cppunit/jpeg/JpegWriterTest.cxx
@@ -12,6 +12,7 @@
#include <vcl/graphicfilter.hxx>
#include <vcl/BitmapReadAccess.hxx>
#include <tools/stream.hxx>
+#include <graphic/GraphicFormatDetector.hxx>
constexpr OUStringLiteral gaDataUrl(u"/vcl/qa/cppunit/jpeg/data/");
@@ -50,16 +51,23 @@ BitmapEx JpegWriterTest::roundtripJPG(const OUString& aURL) { return roundtripJP
BitmapEx JpegWriterTest::roundtripJPG(const BitmapEx& bitmap)
{
- SvMemoryStream stream;
+ // EXPORT JPEG
+ SvMemoryStream aStream;
GraphicFilter& rFilter = GraphicFilter::GetGraphicFilter();
sal_uInt16 exportFormatJPG = rFilter.GetExportFormatNumberForShortName(JPG_SHORTNAME);
Graphic aExportGraphic(bitmap);
- ErrCode bResult = rFilter.ExportGraphic(aExportGraphic, "memory", stream, exportFormatJPG);
+ ErrCode bResult = rFilter.ExportGraphic(aExportGraphic, "memory", aStream, exportFormatJPG);
CPPUNIT_ASSERT_EQUAL(ERRCODE_NONE, bResult);
- stream.Seek(0);
+ //Detect the magic bytes - we need to be sure the file is actually a JPEG
+ aStream.Seek(0);
+ vcl::GraphicFormatDetector aDetector(aStream, "");
+ CPPUNIT_ASSERT(aDetector.detect());
+ CPPUNIT_ASSERT(aDetector.checkJPG());
+ // IMPORT JPEG
+ aStream.Seek(0);
Graphic aImportGraphic;
sal_uInt16 importFormatJPG = rFilter.GetImportFormatNumberForShortName(JPG_SHORTNAME);
- bResult = rFilter.ImportGraphic(aImportGraphic, "memory", stream, importFormatJPG);
+ bResult = rFilter.ImportGraphic(aImportGraphic, "memory", aStream, importFormatJPG);
CPPUNIT_ASSERT_EQUAL(ERRCODE_NONE, bResult);
return aImportGraphic.GetBitmapEx();
}
diff --git a/vcl/source/filter/graphicfilter.cxx b/vcl/source/filter/graphicfilter.cxx
index 418563fcb604..10954031427c 100644
--- a/vcl/source/filter/graphicfilter.cxx
+++ b/vcl/source/filter/graphicfilter.cxx
@@ -649,7 +649,6 @@ extern "C" bool iptGraphicImport( SvStream& rStream, Graphic& rGraphic, FilterCo
extern "C" bool ipxGraphicImport( SvStream& rStream, Graphic& rGraphic, FilterConfigItem* pConfigItem );
extern "C" bool iraGraphicImport( SvStream& rStream, Graphic& rGraphic, FilterConfigItem* pConfigItem );
extern "C" bool itgGraphicImport( SvStream& rStream, Graphic& rGraphic, FilterConfigItem* pConfigItem );
-extern "C" bool itiGraphicImport( SvStream& rStream, Graphic& rGraphic, FilterConfigItem* pConfigItem );
#endif
commit 36b1dbe3894d473211fd0d3d58ec205d80cb98a7
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Tue Dec 29 22:32:01 2020 +0900
Commit: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
CommitDate: Thu Dec 31 19:40:02 2020 +0900
Move TIFF reader and writer from filter module into VCL
Moving graphicfilter one by one into VCL to get rid of filter_gio
module and all the nonsense of dynamic/static library loading in
"GraphicFilter".
Change-Id: I21ebc0334ee07d36553a88557d33e01d9caec9ee
diff --git a/filter/CppunitTest_filter_tiff_test.mk b/filter/CppunitTest_filter_tiff_test.mk
deleted file mode 100644
index 23a7bbf9ccac..000000000000
--- a/filter/CppunitTest_filter_tiff_test.mk
+++ /dev/null
@@ -1,38 +0,0 @@
-# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
-#
-# 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/.
-#
-
-$(eval $(call gb_CppunitTest_CppunitTest,filter_tiff_test))
-
-$(eval $(call gb_CppunitTest_use_external,filter_tiff_test,boost_headers))
-
-$(eval $(call gb_CppunitTest_add_exception_objects,filter_tiff_test, \
- filter/qa/cppunit/filters-tiff-test \
-))
-
-$(eval $(call gb_CppunitTest_use_libraries,filter_tiff_test, \
- gie \
- sal \
- test \
- tl \
- unotest \
- vcl \
-))
-
-$(eval $(call gb_CppunitTest_use_sdk_api,filter_tiff_test))
-
-$(eval $(call gb_CppunitTest_use_ure,filter_tiff_test))
-$(eval $(call gb_CppunitTest_use_vcl,filter_tiff_test))
-
-$(eval $(call gb_CppunitTest_use_components,filter_tiff_test,\
- configmgr/source/configmgr \
-))
-
-$(eval $(call gb_CppunitTest_use_configuration,filter_tiff_test))
-
-# vim: set noet sw=4 ts=4:
diff --git a/filter/Library_gie.mk b/filter/Library_gie.mk
index 2dcab32717b6..8c0cbd46b9b9 100644
--- a/filter/Library_gie.mk
+++ b/filter/Library_gie.mk
@@ -50,12 +50,8 @@ $(eval $(call gb_Library_use_libraries,gie,\
$(eval $(call gb_Library_add_exception_objects,gie,\
filter/source/graphicfilter/egif/egif \
- filter/source/graphicfilter/etiff/etiff \
filter/source/graphicfilter/eps/eps \
filter/source/graphicfilter/egif/giflzwc \
- filter/source/graphicfilter/itiff/ccidecom \
- filter/source/graphicfilter/itiff/itiff \
- filter/source/graphicfilter/itiff/lzwdecom \
filter/source/graphicfilter/ipict/ipict \
filter/source/graphicfilter/ipict/shape \
filter/source/graphicfilter/ipcx/ipcx \
diff --git a/filter/Module_filter.mk b/filter/Module_filter.mk
index 6ac173e45859..898ac710db8a 100644
--- a/filter/Module_filter.mk
+++ b/filter/Module_filter.mk
@@ -64,7 +64,6 @@ $(eval $(call gb_Module_add_check_targets,filter,\
CppunitTest_filter_ppm_test \
CppunitTest_filter_psd_test \
CppunitTest_filter_ras_test \
- CppunitTest_filter_tiff_test \
CppunitTest_filter_tga_test \
CppunitTest_filter_svg \
))
diff --git a/include/vcl/graphicfilter.hxx b/include/vcl/graphicfilter.hxx
index 35728237dc7a..5b18654cb81b 100644
--- a/include/vcl/graphicfilter.hxx
+++ b/include/vcl/graphicfilter.hxx
@@ -77,6 +77,7 @@ namespace o3tl
#define IMP_XPM "SVIXPM"
#define IMP_SVG "SVISVG"
#define IMP_PDF "SVIPDF"
+#define IMP_TIFF "SVTIFF"
#define EXP_BMP "SVBMP"
#define EXP_SVMETAFILE "SVMETAFILE"
#define EXP_WMF "SVWMF"
@@ -85,6 +86,8 @@ namespace o3tl
#define EXP_SVG "SVESVG"
#define EXP_PDF "SVEPDF"
#define EXP_PNG "SVEPNG"
+#define EXP_TIFF "SVTIFF"
+
#define BMP_SHORTNAME u"BMP"
#define GIF_SHORTNAME u"GIF"
diff --git a/solenv/clang-format/excludelist b/solenv/clang-format/excludelist
index 6d9404c26b93..45e0a06c300a 100644
--- a/solenv/clang-format/excludelist
+++ b/solenv/clang-format/excludelist
@@ -3900,7 +3900,6 @@ filter/qa/cppunit/filters-ppm-test.cxx
filter/qa/cppunit/filters-psd-test.cxx
filter/qa/cppunit/filters-ras-test.cxx
filter/qa/cppunit/filters-tga-test.cxx
-filter/qa/cppunit/filters-tiff-test.cxx
filter/qa/cppunit/msfilter-test.cxx
filter/qa/cppunit/priority-test.cxx
filter/qa/cppunit/xslt-test.cxx
@@ -3931,7 +3930,6 @@ filter/source/graphicfilter/egif/egif.cxx
filter/source/graphicfilter/egif/giflzwc.cxx
filter/source/graphicfilter/egif/giflzwc.hxx
filter/source/graphicfilter/eps/eps.cxx
-filter/source/graphicfilter/etiff/etiff.cxx
filter/source/graphicfilter/icgm/actimpr.cxx
filter/source/graphicfilter/icgm/bitmap.cxx
filter/source/graphicfilter/icgm/bitmap.hxx
@@ -3979,10 +3977,6 @@ filter/source/graphicfilter/ipict/shape.hxx
filter/source/graphicfilter/ipsd/ipsd.cxx
filter/source/graphicfilter/iras/iras.cxx
filter/source/graphicfilter/itga/itga.cxx
-filter/source/graphicfilter/itiff/ccidecom.cxx
-filter/source/graphicfilter/itiff/ccidecom.hxx
-filter/source/graphicfilter/itiff/itiff.cxx
-filter/source/graphicfilter/itiff/lzwdecom.cxx
filter/source/msfilter/countryid.cxx
filter/source/msfilter/dffpropset.cxx
filter/source/msfilter/escherex.cxx
@@ -14939,12 +14933,17 @@ vcl/source/filter/FilterConfigCache.hxx
vcl/source/filter/FilterConfigItem.cxx
vcl/source/filter/graphicfilter.cxx
vcl/source/filter/graphicfilter2.cxx
+vcl/source/filter/etiff/etiff.cxx
vcl/source/filter/igif/decode.cxx
vcl/source/filter/igif/decode.hxx
vcl/source/filter/igif/gifread.cxx
vcl/source/filter/ixbm/xbmread.cxx
vcl/source/filter/ixpm/rgbtable.hxx
vcl/source/filter/ixpm/xpmread.cxx
+vcl/source/filter/itiff/ccidecom.cxx
+vcl/source/filter/itiff/ccidecom.hxx
+vcl/source/filter/itiff/itiff.cxx
+vcl/source/filter/itiff/lzwdecom.cxx
vcl/source/filter/jpeg/Exif.cxx
vcl/source/filter/jpeg/Exif.hxx
vcl/source/filter/jpeg/JpegReader.cxx
diff --git a/vcl/CppunitTest_vcl_filters_test.mk b/vcl/CppunitTest_vcl_filters_test.mk
index 03a423233c9e..70667a04417b 100644
--- a/vcl/CppunitTest_vcl_filters_test.mk
+++ b/vcl/CppunitTest_vcl_filters_test.mk
@@ -11,6 +11,12 @@ $(eval $(call gb_CppunitTest_CppunitTest,vcl_filters_test))
$(eval $(call gb_CppunitTest_add_exception_objects,vcl_filters_test, \
vcl/qa/cppunit/graphicfilter/filters-test \
+ vcl/qa/cppunit/graphicfilter/filters-tiff-test \
+))
+
+$(eval $(call gb_CppunitTest_set_include,vcl_filters_test,\
+ $$(INCLUDE) \
+ -I$(SRCDIR)/vcl/inc \
))
ifeq ($(DISABLE_CVE_TESTS),TRUE)
diff --git a/vcl/Library_vcl.mk b/vcl/Library_vcl.mk
index 751a0104d46a..1a93ab808208 100644
--- a/vcl/Library_vcl.mk
+++ b/vcl/Library_vcl.mk
@@ -423,6 +423,7 @@ $(eval $(call gb_Library_add_exception_objects,vcl,\
vcl/source/components/dtranscomp \
vcl/source/components/factory \
vcl/source/components/fontident \
+ vcl/source/filter/etiff/etiff \
vcl/source/filter/FilterConfigCache \
vcl/source/filter/FilterConfigItem \
vcl/source/filter/graphicfilter \
@@ -434,6 +435,9 @@ $(eval $(call gb_Library_add_exception_objects,vcl,\
vcl/source/filter/igif/gifread \
vcl/source/filter/ipdf/pdfread \
vcl/source/filter/ipdf/pdfdocument \
+ vcl/source/filter/itiff/ccidecom \
+ vcl/source/filter/itiff/itiff \
+ vcl/source/filter/itiff/lzwdecom \
vcl/source/filter/ixbm/xbmread \
vcl/source/filter/ixpm/xpmread \
vcl/source/filter/jpeg/Exif \
diff --git a/vcl/inc/filter/TiffReader.hxx b/vcl/inc/filter/TiffReader.hxx
new file mode 100644
index 000000000000..3c9922895a4f
--- /dev/null
+++ b/vcl/inc/filter/TiffReader.hxx
@@ -0,0 +1,26 @@
+/* -*- 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 .
+ */
+
+#pragma once
+
+#include <vcl/graph.hxx>
+
+VCL_DLLPUBLIC bool ImportTiffGraphicImport(SvStream& rStream, Graphic& rGraphic);
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/filter/TiffWriter.hxx b/vcl/inc/filter/TiffWriter.hxx
new file mode 100644
index 000000000000..a2219a687915
--- /dev/null
+++ b/vcl/inc/filter/TiffWriter.hxx
@@ -0,0 +1,28 @@
+/* -*- 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 .
+ */
+
+#pragma once
+
+#include <vcl/graph.hxx>
+#include <vcl/FilterConfigItem.hxx>
+
+VCL_DLLPUBLIC bool ExportTiffGraphicImport(SvStream& rStream, Graphic& rGraphic,
+ FilterConfigItem* pFilterConfigItem);
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/filter/qa/cppunit/data/tiff/fail/.gitignore b/vcl/qa/cppunit/graphicfilter/data/tiff/fail/.gitignore
similarity index 100%
rename from filter/qa/cppunit/data/tiff/fail/.gitignore
rename to vcl/qa/cppunit/graphicfilter/data/tiff/fail/.gitignore
diff --git a/filter/qa/cppunit/data/tiff/fail/BID-51132-1.tiff b/vcl/qa/cppunit/graphicfilter/data/tiff/fail/BID-51132-1.tiff
similarity index 100%
rename from filter/qa/cppunit/data/tiff/fail/BID-51132-1.tiff
rename to vcl/qa/cppunit/graphicfilter/data/tiff/fail/BID-51132-1.tiff
diff --git a/filter/qa/cppunit/data/tiff/fail/CVE-2006-3459-1.tiff b/vcl/qa/cppunit/graphicfilter/data/tiff/fail/CVE-2006-3459-1.tiff
similarity index 100%
rename from filter/qa/cppunit/data/tiff/fail/CVE-2006-3459-1.tiff
rename to vcl/qa/cppunit/graphicfilter/data/tiff/fail/CVE-2006-3459-1.tiff
diff --git a/filter/qa/cppunit/data/tiff/fail/CVE-2009-2285-1.tiff b/vcl/qa/cppunit/graphicfilter/data/tiff/fail/CVE-2009-2285-1.tiff
similarity index 100%
rename from filter/qa/cppunit/data/tiff/fail/CVE-2009-2285-1.tiff
rename to vcl/qa/cppunit/graphicfilter/data/tiff/fail/CVE-2009-2285-1.tiff
diff --git a/filter/qa/cppunit/data/tiff/fail/CVE-2010-2482-1.tiff b/vcl/qa/cppunit/graphicfilter/data/tiff/fail/CVE-2010-2482-1.tiff
similarity index 100%
rename from filter/qa/cppunit/data/tiff/fail/CVE-2010-2482-1.tiff
rename to vcl/qa/cppunit/graphicfilter/data/tiff/fail/CVE-2010-2482-1.tiff
diff --git a/filter/qa/cppunit/data/tiff/fail/CVE-2012-0276-1.tiff b/vcl/qa/cppunit/graphicfilter/data/tiff/fail/CVE-2012-0276-1.tiff
similarity index 100%
rename from filter/qa/cppunit/data/tiff/fail/CVE-2012-0276-1.tiff
rename to vcl/qa/cppunit/graphicfilter/data/tiff/fail/CVE-2012-0276-1.tiff
diff --git a/filter/qa/cppunit/data/tiff/fail/CVE-2012-0276-2.tiff b/vcl/qa/cppunit/graphicfilter/data/tiff/fail/CVE-2012-0276-2.tiff
similarity index 100%
rename from filter/qa/cppunit/data/tiff/fail/CVE-2012-0276-2.tiff
rename to vcl/qa/cppunit/graphicfilter/data/tiff/fail/CVE-2012-0276-2.tiff
diff --git a/filter/qa/cppunit/data/tiff/fail/CVE-2012-2027-1.tiff b/vcl/qa/cppunit/graphicfilter/data/tiff/fail/CVE-2012-2027-1.tiff
similarity index 100%
rename from filter/qa/cppunit/data/tiff/fail/CVE-2012-2027-1.tiff
rename to vcl/qa/cppunit/graphicfilter/data/tiff/fail/CVE-2012-2027-1.tiff
diff --git a/filter/qa/cppunit/data/tiff/fail/CVE-2013-3906-1.tiff b/vcl/qa/cppunit/graphicfilter/data/tiff/fail/CVE-2013-3906-1.tiff
similarity index 100%
rename from filter/qa/cppunit/data/tiff/fail/CVE-2013-3906-1.tiff
rename to vcl/qa/cppunit/graphicfilter/data/tiff/fail/CVE-2013-3906-1.tiff
diff --git a/filter/qa/cppunit/data/tiff/fail/CVE-2017-10688-1.tiff b/vcl/qa/cppunit/graphicfilter/data/tiff/fail/CVE-2017-10688-1.tiff
similarity index 100%
rename from filter/qa/cppunit/data/tiff/fail/CVE-2017-10688-1.tiff
rename to vcl/qa/cppunit/graphicfilter/data/tiff/fail/CVE-2017-10688-1.tiff
diff --git a/filter/qa/cppunit/data/tiff/fail/CVE-2017-9147-1.tiff b/vcl/qa/cppunit/graphicfilter/data/tiff/fail/CVE-2017-9147-1.tiff
similarity index 100%
rename from filter/qa/cppunit/data/tiff/fail/CVE-2017-9147-1.tiff
rename to vcl/qa/cppunit/graphicfilter/data/tiff/fail/CVE-2017-9147-1.tiff
diff --git a/filter/qa/cppunit/data/tiff/fail/CVE-2017-9936-1.tiff b/vcl/qa/cppunit/graphicfilter/data/tiff/fail/CVE-2017-9936-1.tiff
similarity index 100%
rename from filter/qa/cppunit/data/tiff/fail/CVE-2017-9936-1.tiff
rename to vcl/qa/cppunit/graphicfilter/data/tiff/fail/CVE-2017-9936-1.tiff
diff --git a/filter/qa/cppunit/data/tiff/fail/EBD-22681-1.tiff b/vcl/qa/cppunit/graphicfilter/data/tiff/fail/EBD-22681-1.tiff
similarity index 100%
rename from filter/qa/cppunit/data/tiff/fail/EBD-22681-1.tiff
rename to vcl/qa/cppunit/graphicfilter/data/tiff/fail/EBD-22681-1.tiff
diff --git a/filter/qa/cppunit/data/tiff/fail/EDB-24743-5.tiff b/vcl/qa/cppunit/graphicfilter/data/tiff/fail/EDB-24743-5.tiff
similarity index 100%
rename from filter/qa/cppunit/data/tiff/fail/EDB-24743-5.tiff
rename to vcl/qa/cppunit/graphicfilter/data/tiff/fail/EDB-24743-5.tiff
diff --git a/filter/qa/cppunit/data/tiff/fail/RC4-crash-1.tiff b/vcl/qa/cppunit/graphicfilter/data/tiff/fail/RC4-crash-1.tiff
similarity index 100%
rename from filter/qa/cppunit/data/tiff/fail/RC4-crash-1.tiff
rename to vcl/qa/cppunit/graphicfilter/data/tiff/fail/RC4-crash-1.tiff
diff --git a/filter/qa/cppunit/data/tiff/fail/RC4-crash-2.tiff b/vcl/qa/cppunit/graphicfilter/data/tiff/fail/RC4-crash-2.tiff
similarity index 100%
rename from filter/qa/cppunit/data/tiff/fail/RC4-crash-2.tiff
rename to vcl/qa/cppunit/graphicfilter/data/tiff/fail/RC4-crash-2.tiff
diff --git a/filter/qa/cppunit/data/tiff/fail/RC4-crash-3.tiff b/vcl/qa/cppunit/graphicfilter/data/tiff/fail/RC4-crash-3.tiff
similarity index 100%
rename from filter/qa/cppunit/data/tiff/fail/RC4-crash-3.tiff
rename to vcl/qa/cppunit/graphicfilter/data/tiff/fail/RC4-crash-3.tiff
diff --git a/filter/qa/cppunit/data/tiff/fail/RC4-crash-4.tiff b/vcl/qa/cppunit/graphicfilter/data/tiff/fail/RC4-crash-4.tiff
similarity index 100%
rename from filter/qa/cppunit/data/tiff/fail/RC4-crash-4.tiff
rename to vcl/qa/cppunit/graphicfilter/data/tiff/fail/RC4-crash-4.tiff
diff --git a/filter/qa/cppunit/data/tiff/fail/RC4-crash-5.tiff b/vcl/qa/cppunit/graphicfilter/data/tiff/fail/RC4-crash-5.tiff
similarity index 100%
rename from filter/qa/cppunit/data/tiff/fail/RC4-crash-5.tiff
rename to vcl/qa/cppunit/graphicfilter/data/tiff/fail/RC4-crash-5.tiff
diff --git a/filter/qa/cppunit/data/tiff/fail/RC4-crash-6.tiff b/vcl/qa/cppunit/graphicfilter/data/tiff/fail/RC4-crash-6.tiff
similarity index 100%
rename from filter/qa/cppunit/data/tiff/fail/RC4-crash-6.tiff
rename to vcl/qa/cppunit/graphicfilter/data/tiff/fail/RC4-crash-6.tiff
diff --git a/filter/qa/cppunit/data/tiff/fail/RC4-crash-7.tiff b/vcl/qa/cppunit/graphicfilter/data/tiff/fail/RC4-crash-7.tiff
similarity index 100%
rename from filter/qa/cppunit/data/tiff/fail/RC4-crash-7.tiff
rename to vcl/qa/cppunit/graphicfilter/data/tiff/fail/RC4-crash-7.tiff
diff --git a/filter/qa/cppunit/data/tiff/fail/RC4-hang-1.tiff b/vcl/qa/cppunit/graphicfilter/data/tiff/fail/RC4-hang-1.tiff
similarity index 100%
rename from filter/qa/cppunit/data/tiff/fail/RC4-hang-1.tiff
rename to vcl/qa/cppunit/graphicfilter/data/tiff/fail/RC4-hang-1.tiff
diff --git a/filter/qa/cppunit/data/tiff/fail/RC4-hang-10.tiff b/vcl/qa/cppunit/graphicfilter/data/tiff/fail/RC4-hang-10.tiff
similarity index 100%
rename from filter/qa/cppunit/data/tiff/fail/RC4-hang-10.tiff
rename to vcl/qa/cppunit/graphicfilter/data/tiff/fail/RC4-hang-10.tiff
diff --git a/filter/qa/cppunit/data/tiff/fail/RC4-hang-2.tiff b/vcl/qa/cppunit/graphicfilter/data/tiff/fail/RC4-hang-2.tiff
similarity index 100%
rename from filter/qa/cppunit/data/tiff/fail/RC4-hang-2.tiff
rename to vcl/qa/cppunit/graphicfilter/data/tiff/fail/RC4-hang-2.tiff
diff --git a/filter/qa/cppunit/data/tiff/fail/RC4-hang-3.tiff b/vcl/qa/cppunit/graphicfilter/data/tiff/fail/RC4-hang-3.tiff
similarity index 100%
rename from filter/qa/cppunit/data/tiff/fail/RC4-hang-3.tiff
rename to vcl/qa/cppunit/graphicfilter/data/tiff/fail/RC4-hang-3.tiff
diff --git a/filter/qa/cppunit/data/tiff/fail/RC4-hang-4.tiff b/vcl/qa/cppunit/graphicfilter/data/tiff/fail/RC4-hang-4.tiff
similarity index 100%
rename from filter/qa/cppunit/data/tiff/fail/RC4-hang-4.tiff
rename to vcl/qa/cppunit/graphicfilter/data/tiff/fail/RC4-hang-4.tiff
diff --git a/filter/qa/cppunit/data/tiff/fail/RC4-hang-5.tiff b/vcl/qa/cppunit/graphicfilter/data/tiff/fail/RC4-hang-5.tiff
similarity index 100%
rename from filter/qa/cppunit/data/tiff/fail/RC4-hang-5.tiff
rename to vcl/qa/cppunit/graphicfilter/data/tiff/fail/RC4-hang-5.tiff
diff --git a/filter/qa/cppunit/data/tiff/fail/RC4-hang-6.tiff b/vcl/qa/cppunit/graphicfilter/data/tiff/fail/RC4-hang-6.tiff
similarity index 100%
rename from filter/qa/cppunit/data/tiff/fail/RC4-hang-6.tiff
rename to vcl/qa/cppunit/graphicfilter/data/tiff/fail/RC4-hang-6.tiff
diff --git a/filter/qa/cppunit/data/tiff/fail/RC4-hang-7.tiff b/vcl/qa/cppunit/graphicfilter/data/tiff/fail/RC4-hang-7.tiff
similarity index 100%
rename from filter/qa/cppunit/data/tiff/fail/RC4-hang-7.tiff
rename to vcl/qa/cppunit/graphicfilter/data/tiff/fail/RC4-hang-7.tiff
diff --git a/filter/qa/cppunit/data/tiff/fail/RC4-hang-8.tiff b/vcl/qa/cppunit/graphicfilter/data/tiff/fail/RC4-hang-8.tiff
similarity index 100%
rename from filter/qa/cppunit/data/tiff/fail/RC4-hang-8.tiff
rename to vcl/qa/cppunit/graphicfilter/data/tiff/fail/RC4-hang-8.tiff
diff --git a/filter/qa/cppunit/data/tiff/fail/RC4-hang-9.tiff b/vcl/qa/cppunit/graphicfilter/data/tiff/fail/RC4-hang-9.tiff
similarity index 100%
rename from filter/qa/cppunit/data/tiff/fail/RC4-hang-9.tiff
rename to vcl/qa/cppunit/graphicfilter/data/tiff/fail/RC4-hang-9.tiff
diff --git a/filter/qa/cppunit/data/tiff/indeterminate/.gitignore b/vcl/qa/cppunit/graphicfilter/data/tiff/indeterminate/.gitignore
similarity index 100%
rename from filter/qa/cppunit/data/tiff/indeterminate/.gitignore
rename to vcl/qa/cppunit/graphicfilter/data/tiff/indeterminate/.gitignore
diff --git a/filter/qa/cppunit/data/tiff/pass/.gitignore b/vcl/qa/cppunit/graphicfilter/data/tiff/pass/.gitignore
similarity index 100%
rename from filter/qa/cppunit/data/tiff/pass/.gitignore
rename to vcl/qa/cppunit/graphicfilter/data/tiff/pass/.gitignore
diff --git a/filter/qa/cppunit/data/tiff/pass/CVE-2005-1544-1.tiff b/vcl/qa/cppunit/graphicfilter/data/tiff/pass/CVE-2005-1544-1.tiff
similarity index 100%
rename from filter/qa/cppunit/data/tiff/pass/CVE-2005-1544-1.tiff
rename to vcl/qa/cppunit/graphicfilter/data/tiff/pass/CVE-2005-1544-1.tiff
diff --git a/filter/qa/cppunit/data/tiff/pass/CVE-2006-2656-1.tiff b/vcl/qa/cppunit/graphicfilter/data/tiff/pass/CVE-2006-2656-1.tiff
similarity index 100%
rename from filter/qa/cppunit/data/tiff/pass/CVE-2006-2656-1.tiff
rename to vcl/qa/cppunit/graphicfilter/data/tiff/pass/CVE-2006-2656-1.tiff
diff --git a/filter/qa/cppunit/data/tiff/pass/CVE-2007-2217-1.tiff b/vcl/qa/cppunit/graphicfilter/data/tiff/pass/CVE-2007-2217-1.tiff
similarity index 100%
rename from filter/qa/cppunit/data/tiff/pass/CVE-2007-2217-1.tiff
rename to vcl/qa/cppunit/graphicfilter/data/tiff/pass/CVE-2007-2217-1.tiff
diff --git a/filter/qa/cppunit/data/tiff/pass/CVE-2013-5575-1.tiff b/vcl/qa/cppunit/graphicfilter/data/tiff/pass/CVE-2013-5575-1.tiff
similarity index 100%
rename from filter/qa/cppunit/data/tiff/pass/CVE-2013-5575-1.tiff
rename to vcl/qa/cppunit/graphicfilter/data/tiff/pass/CVE-2013-5575-1.tiff
diff --git a/filter/qa/cppunit/data/tiff/pass/multi-page-1.tiff b/vcl/qa/cppunit/graphicfilter/data/tiff/pass/multi-page-1.tiff
similarity index 100%
rename from filter/qa/cppunit/data/tiff/pass/multi-page-1.tiff
rename to vcl/qa/cppunit/graphicfilter/data/tiff/pass/multi-page-1.tiff
diff --git a/filter/qa/cppunit/data/tiff/tdf115863.tif b/vcl/qa/cppunit/graphicfilter/data/tiff/tdf115863.tif
similarity index 100%
rename from filter/qa/cppunit/data/tiff/tdf115863.tif
rename to vcl/qa/cppunit/graphicfilter/data/tiff/tdf115863.tif
diff --git a/filter/qa/cppunit/data/tiff/tdf126460.tif b/vcl/qa/cppunit/graphicfilter/data/tiff/tdf126460.tif
similarity index 100%
rename from filter/qa/cppunit/data/tiff/tdf126460.tif
rename to vcl/qa/cppunit/graphicfilter/data/tiff/tdf126460.tif
diff --git a/filter/qa/cppunit/data/tiff/tdf138818.tif b/vcl/qa/cppunit/graphicfilter/data/tiff/tdf138818.tif
similarity index 100%
rename from filter/qa/cppunit/data/tiff/tdf138818.tif
rename to vcl/qa/cppunit/graphicfilter/data/tiff/tdf138818.tif
diff --git a/filter/qa/cppunit/filters-tiff-test.cxx b/vcl/qa/cppunit/graphicfilter/filters-tiff-test.cxx
similarity index 78%
rename from filter/qa/cppunit/filters-tiff-test.cxx
rename to vcl/qa/cppunit/graphicfilter/filters-tiff-test.cxx
index 93968e9be9b7..cc45e77467b5 100644
--- a/filter/qa/cppunit/filters-tiff-test.cxx
+++ b/vcl/qa/cppunit/graphicfilter/filters-tiff-test.cxx
@@ -14,31 +14,26 @@
#include <vcl/graph.hxx>
#include <vcl/graphicfilter.hxx>
-extern "C"
-{
- SAL_DLLPUBLIC_EXPORT bool SAL_CALL
- itiGraphicImport(SvStream & rStream, Graphic & rGraphic,
- FilterConfigItem*);
-}
+#include <filter/TiffReader.hxx>
using namespace ::com::sun::star;
/* Implementation of Filters test */
-class TiffFilterTest
- : public test::FiltersTest
- , public test::BootstrapFixture
+class TiffFilterTest : public test::FiltersTest, public test::BootstrapFixture
{
public:
- TiffFilterTest() : BootstrapFixture(true, false) {}
+ TiffFilterTest()
+ : BootstrapFixture(true, false)
+ {
+ }
- virtual bool load(const OUString &,
- const OUString &rURL, const OUString &,
- SfxFilterFlags, SotClipboardFormatId, unsigned int) override;
+ virtual bool load(const OUString&, const OUString& rURL, const OUString&, SfxFilterFlags,
+ SotClipboardFormatId, unsigned int) override;
OUString getUrl()
{
- return m_directories.getURLFromSrc("/filter/qa/cppunit/data/tiff/");
+ return m_directories.getURLFromSrc("/vcl/qa/cppunit/graphicfilter/data/tiff/");
}
/**
@@ -57,20 +52,15 @@ public:
CPPUNIT_TEST_SUITE_END();
};
-bool TiffFilterTest::load(const OUString &,
- const OUString &rURL, const OUString &,
- SfxFilterFlags, SotClipboardFormatId, unsigned int)
+bool TiffFilterTest::load(const OUString&, const OUString& rURL, const OUString&, SfxFilterFlags,
+ SotClipboardFormatId, unsigned int)
{
SvFileStream aFileStream(rURL, StreamMode::READ);
Graphic aGraphic;
- return itiGraphicImport(aFileStream, aGraphic, nullptr);
+ return ImportTiffGraphicImport(aFileStream, aGraphic);
}
-void TiffFilterTest::testCVEs()
-{
- testDir(OUString(),
- getUrl());
-}
+void TiffFilterTest::testCVEs() { testDir(OUString(), getUrl()); }
void TiffFilterTest::testTdf126460()
{
@@ -106,7 +96,6 @@ void TiffFilterTest::testTdf115863()
Size aSize = aBitmap.GetSizePixel();
CPPUNIT_ASSERT_EQUAL(tools::Long(528), aSize.Width());
CPPUNIT_ASSERT_EQUAL(tools::Long(618), aSize.Height());
-
}
void TiffFilterTest::testTdf138818()
@@ -124,11 +113,8 @@ void TiffFilterTest::testTdf138818()
// - Expected: 46428
// - Actual : 45951
CPPUNIT_ASSERT_EQUAL(sal_uInt32(46428), aGraphic.GetGfxLink().GetDataSize());
-
}
CPPUNIT_TEST_SUITE_REGISTRATION(TiffFilterTest);
-CPPUNIT_PLUGIN_IMPLEMENT();
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/filter/FilterConfigCache.cxx b/vcl/source/filter/FilterConfigCache.cxx
index a315c0279b69..69126cf216fb 100644
--- a/vcl/source/filter/FilterConfigCache.cxx
+++ b/vcl/source/filter/FilterConfigCache.cxx
@@ -42,7 +42,7 @@ using namespace ::com::sun::star::configuration ;
const char* FilterConfigCache::FilterConfigCacheEntry::InternalPixelFilterNameList[] =
{
IMP_BMP, IMP_GIF, IMP_PNG,IMP_JPEG, IMP_XBM, IMP_XPM,
- EXP_BMP, EXP_JPEG, EXP_PNG, IMP_MOV, nullptr
+ EXP_BMP, EXP_JPEG, EXP_PNG, IMP_MOV, IMP_TIFF, EXP_TIFF, nullptr
};
const char* FilterConfigCache::FilterConfigCacheEntry::InternalVectorFilterNameList[] =
@@ -54,7 +54,7 @@ const char* FilterConfigCache::FilterConfigCacheEntry::InternalVectorFilterNameL
const char* FilterConfigCache::FilterConfigCacheEntry::ExternalPixelFilterNameList[] =
{
"egi", "icd", "ipd", "ipx", "ipb", "epb", "epg",
- "epp", "ira", "era", "itg", "iti", "eti", "exp", nullptr
+ "epp", "ira", "era", "itg", "exp", nullptr
};
void FilterConfigCache::FilterConfigCacheEntry::CreateFilterName( const OUString& rUserDataEntry )
@@ -244,8 +244,8 @@ const char* FilterConfigCache::InternalFilterListForSvxLight[] =
"svm","1","SVMETAFILE",
"svm","2","SVMETAFILE",
"tga","1","itg",
- "tif","1","iti",
- "tif","2","eti",
+ "tif","1","SVTIFF",
+ "tif","2","SVTIFF",
"emf","1","SVEMF",
"emf","2","SVEMF",
"wmf","1","SVWMF",
diff --git a/filter/source/graphicfilter/etiff/etiff.cxx b/vcl/source/filter/etiff/etiff.cxx
similarity index 99%
rename from filter/source/graphicfilter/etiff/etiff.cxx
rename to vcl/source/filter/etiff/etiff.cxx
index 80c185e1ea5b..fbac404563e7 100644
--- a/filter/source/graphicfilter/etiff/etiff.cxx
+++ b/vcl/source/filter/etiff/etiff.cxx
@@ -576,9 +576,7 @@ void TIFFWriter::EndCompression()
pTable.reset();
}
-
-extern "C" SAL_DLLPUBLIC_EXPORT bool
-etiGraphicExport( SvStream& rStream, Graphic& rGraphic, FilterConfigItem* pFilterConfigItem )
+bool ExportTiffGraphicImport(SvStream & rStream, Graphic & rGraphic, FilterConfigItem* pFilterConfigItem)
{
TIFFWriter aWriter(rStream);
return aWriter.WriteTIFF( rGraphic, pFilterConfigItem );
diff --git a/vcl/source/filter/graphicfilter.cxx b/vcl/source/filter/graphicfilter.cxx
index 6173288e6d20..418563fcb604 100644
--- a/vcl/source/filter/graphicfilter.cxx
+++ b/vcl/source/filter/graphicfilter.cxx
@@ -47,6 +47,8 @@
#include "jpeg/jpeg.hxx"
#include "ixbm/xbmread.hxx"
#include "ixpm/xpmread.hxx"
+#include <filter/TiffReader.hxx>
+#include <filter/TiffWriter.hxx>
#include <osl/module.hxx>
#include <com/sun/star/uno/Reference.h>
#include <com/sun/star/awt/Size.hpp>
@@ -676,8 +678,6 @@ PFilterCall ImpFilterLibCacheEntry::GetImportFunction()
mpfnImport = reinterpret_cast<PFilterCall>(maLibrary.getFunctionSymbol("iraGraphicImport"));
else if (maFormatName == "itg")
mpfnImport = reinterpret_cast<PFilterCall>(maLibrary.getFunctionSymbol("itgGraphicImport"));
- else if (maFormatName == "iti")
- mpfnImport = reinterpret_cast<PFilterCall>(maLibrary.getFunctionSymbol("itiGraphicImport"));
#else
if (maFormatName == "icd")
mpfnImport = icdGraphicImport;
@@ -699,8 +699,6 @@ PFilterCall ImpFilterLibCacheEntry::GetImportFunction()
mpfnImport = iraGraphicImport;
else if (maFormatName == "itg")
mpfnImport = itgGraphicImport;
- else if (maFormatName == "iti")
- mpfnImport = itiGraphicImport;
#endif
}
@@ -1333,6 +1331,10 @@ Graphic GraphicFilter::ImportUnloadedGraphic(SvStream& rIStream, sal_uInt64 size
{
eLinkType = GfxLinkType::NativePdf;
}
+ else if (aFilterName == IMP_TIFF)
+ {
+ eLinkType = GfxLinkType::NativeTif;
+ }
else
{
nStatus = ERRCODE_GRFILTER_FILTERERROR;
@@ -1366,9 +1368,7 @@ Graphic GraphicFilter::ImportUnloadedGraphic(SvStream& rIStream, sal_uInt64 size
if (nFormat != GRFILTER_FORMAT_DONTKNOW)
aShortName = GetImportFormatShortName(nFormat).toAsciiUpperCase();
- if (aShortName.startsWith(TIF_SHORTNAME))
- eLinkType = GfxLinkType::NativeTif;
- else if( aShortName.startsWith(MET_SHORTNAME))
+ if( aShortName.startsWith(MET_SHORTNAME))
eLinkType = GfxLinkType::NativeMet;
else if( aShortName.startsWith(PCT_SHORTNAME))
eLinkType = GfxLinkType::NativePct;
@@ -1433,7 +1433,7 @@ void GraphicFilter::preload()
sal_Int32 nTokenCount = comphelper::string::getTokenCount(aFilterPath, ';');
ImpFilterLibCache& rCache = Cache::get();
static const std::initializer_list<std::u16string_view> aFilterNames = {
- u"icd", u"idx", u"ime", u"ipb", u"ipd", u"ips", u"ipt", u"ipx", u"ira", u"itg", u"iti",
+ u"icd", u"idx", u"ime", u"ipb", u"ipd", u"ips", u"ipt", u"ipx", u"ira", u"itg",
};
// Load library for each filter.
@@ -1740,6 +1740,13 @@ ErrCode GraphicFilter::ImportGraphic( Graphic& rGraphic, const OUString& rPath,
else
nStatus = ERRCODE_GRFILTER_FILTERERROR;
}
+ else if (aFilterName.equalsIgnoreAsciiCase(IMP_TIFF) )
+ {
+ if (!ImportTiffGraphicImport(rIStream, rGraphic))
+ nStatus = ERRCODE_GRFILTER_FILTERERROR;
+ else
+ eLinkType = GfxLinkType::NativeTif;
+ }
else
nStatus = ERRCODE_GRFILTER_FILTERERROR;
}
@@ -1865,7 +1872,6 @@ ErrCode GraphicFilter::ExportGraphic( const Graphic& rGraphic, const INetURLObje
extern "C" bool egiGraphicExport( SvStream& rStream, Graphic& rGraphic, FilterConfigItem* pConfigItem );
extern "C" bool epsGraphicExport( SvStream& rStream, Graphic& rGraphic, FilterConfigItem* pConfigItem );
-extern "C" bool etiGraphicExport( SvStream& rStream, Graphic& rGraphic, FilterConfigItem* pConfigItem );
#endif
@@ -1958,6 +1964,14 @@ ErrCode GraphicFilter::ExportGraphic( const Graphic& rGraphic, const OUString& r
if( rOStm.GetError() )
nStatus = ERRCODE_GRFILTER_IOERROR;
}
+ if (aFilterName.equalsIgnoreAsciiCase(EXP_TIFF))
+ {
+ if (!ExportTiffGraphicImport(rOStm, aGraphic, &aConfigItem))
+ nStatus = ERRCODE_GRFILTER_FORMATERROR;
+
+ if( rOStm.GetError() )
+ nStatus = ERRCODE_GRFILTER_IOERROR;
+ }
else if( aFilterName.equalsIgnoreAsciiCase( EXP_SVMETAFILE ) )
{
sal_Int32 nVersion = aConfigItem.ReadInt32( "Version", 0 ) ;
@@ -2189,8 +2203,6 @@ ErrCode GraphicFilter::ExportGraphic( const Graphic& rGraphic, const OUString& r
pFunc = reinterpret_cast<PFilterCall>(aLibrary.getFunctionSymbol("egiGraphicExport"));
else if (aExternalFilterName == "eps")
pFunc = reinterpret_cast<PFilterCall>(aLibrary.getFunctionSymbol("epsGraphicExport"));
- else if (aExternalFilterName == "eti")
- pFunc = reinterpret_cast<PFilterCall>(aLibrary.getFunctionSymbol("etiGraphicExport"));
// Execute dialog in DLL
#else
--nIdx; // Just one iteration
@@ -2199,8 +2211,6 @@ ErrCode GraphicFilter::ExportGraphic( const Graphic& rGraphic, const OUString& r
pFunc = egiGraphicExport;
else if (aExternalFilterName == "eps")
pFunc = epsGraphicExport;
- else if (aExternalFilterName == "eti")
- pFunc = etiGraphicExport;
#endif
if( pFunc )
{
diff --git a/filter/source/graphicfilter/itiff/ccidecom.cxx b/vcl/source/filter/itiff/ccidecom.cxx
similarity index 100%
rename from filter/source/graphicfilter/itiff/ccidecom.cxx
rename to vcl/source/filter/itiff/ccidecom.cxx
diff --git a/filter/source/graphicfilter/itiff/ccidecom.hxx b/vcl/source/filter/itiff/ccidecom.hxx
similarity index 100%
rename from filter/source/graphicfilter/itiff/ccidecom.hxx
rename to vcl/source/filter/itiff/ccidecom.hxx
diff --git a/filter/source/graphicfilter/itiff/itiff.cxx b/vcl/source/filter/itiff/itiff.cxx
similarity index 99%
rename from filter/source/graphicfilter/itiff/itiff.cxx
rename to vcl/source/filter/itiff/itiff.cxx
index f07e496bc347..674b5f3656dd 100644
--- a/filter/source/graphicfilter/itiff/itiff.cxx
+++ b/vcl/source/filter/itiff/itiff.cxx
@@ -30,6 +30,8 @@
#include "lzwdecom.hxx"
#include "ccidecom.hxx"
+#include <filter/TiffReader.hxx>
+
namespace {
template< typename T > T BYTESWAP(T nByte) {
@@ -1710,11 +1712,7 @@ bool TIFFReader::ReadTIFF(SvStream & rTIFF, Graphic & rGraphic )
return false;
}
-
-//================== GraphicImport - the exported function ================
-
-extern "C" SAL_DLLPUBLIC_EXPORT bool
-itiGraphicImport( SvStream & rStream, Graphic & rGraphic, FilterConfigItem* )
+bool ImportTiffGraphicImport(SvStream & rStream, Graphic & rGraphic)
{
TIFFReader aTIFFReader;
try
diff --git a/filter/source/graphicfilter/itiff/lzwdecom.cxx b/vcl/source/filter/itiff/lzwdecom.cxx
similarity index 100%
rename from filter/source/graphicfilter/itiff/lzwdecom.cxx
rename to vcl/source/filter/itiff/lzwdecom.cxx
diff --git a/filter/source/graphicfilter/itiff/lzwdecom.hxx b/vcl/source/filter/itiff/lzwdecom.hxx
similarity index 100%
rename from filter/source/graphicfilter/itiff/lzwdecom.hxx
rename to vcl/source/filter/itiff/lzwdecom.hxx
commit 1cc93eb16b4f93e0d9454fa2a70ff2c69fe4e685
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Tue Dec 29 18:54:21 2020 +0900
Commit: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
CommitDate: Thu Dec 31 19:40:02 2020 +0900
vcl: Fix isEmpty method in BinaryDataContainer
Change-Id: I638473841be92d46f4a6ab2bac1b6f63ef7982ae
diff --git a/include/vcl/BinaryDataContainer.hxx b/include/vcl/BinaryDataContainer.hxx
index d8a20a94aa3f..a7dc963ddb71 100644
--- a/include/vcl/BinaryDataContainer.hxx
+++ b/include/vcl/BinaryDataContainer.hxx
@@ -53,7 +53,7 @@ public:
}
size_t getSize() const { return mpData ? mpData->size() : 0; }
- bool isEmpty() const { return mpData && mpData->empty(); }
+ bool isEmpty() const { return !mpData || mpData->empty(); }
const sal_uInt8* getData() const { return mpData ? mpData->data() : nullptr; }
size_t calculateHash() const;
commit b507c86d30c1cf9b95bec3609ba5cd44abfc3ea2
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Tue Dec 29 19:40:29 2020 +0900
Commit: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
CommitDate: Thu Dec 31 19:40:02 2020 +0900
vcl: remove "Impl" prefix for method names in ImpGraphic
Change-Id: I86b63815d30100395181e5a6e9d343d2b7228c13
diff --git a/vcl/inc/impgraph.hxx b/vcl/inc/impgraph.hxx
index 1b80f0f452f1..2ee0e9ef61ec 100644
--- a/vcl/inc/impgraph.hxx
+++ b/vcl/inc/impgraph.hxx
@@ -96,7 +96,7 @@ public:
ImpGraphic( const GDIMetaFile& rMtf );
~ImpGraphic();
- void ImplSetPrepared(bool bAnimated, const Size* pSizeHint);
+ void setPrepared(bool bAnimated, const Size* pSizeHint);
private:
@@ -125,56 +125,56 @@ private:
void createSwapInfo();
void restoreFromSwapInfo();
- void ImplClearGraphics();
- void ImplClear();
+ void clearGraphics();
+ void clear();
- GraphicType ImplGetType() const { return meType;}
- void ImplSetDefaultType();
- bool ImplIsSupportedGraphic() const;
+ GraphicType getType() const { return meType;}
+ void setDefaultType();
+ bool isSupportedGraphic() const;
- bool ImplIsTransparent() const;
- bool ImplIsAlpha() const;
- bool ImplIsAnimated() const;
- bool ImplIsEPS() const;
+ bool isTransparent() const;
+ bool isAlpha() const;
+ bool isAnimated() const;
+ bool isEPS() const;
bool isAvailable() const;
bool makeAvailable();
- Bitmap ImplGetBitmap(const GraphicConversionParameters& rParameters) const;
- BitmapEx ImplGetBitmapEx(const GraphicConversionParameters& rParameters) const;
+ Bitmap getBitmap(const GraphicConversionParameters& rParameters) const;
+ BitmapEx getBitmapEx(const GraphicConversionParameters& rParameters) const;
/// Gives direct access to the contained BitmapEx.
- const BitmapEx& ImplGetBitmapExRef() const;
- Animation ImplGetAnimation() const;
- const GDIMetaFile& ImplGetGDIMetaFile() const;
+ const BitmapEx& getBitmapExRef() const;
+ Animation getAnimation() const;
+ const GDIMetaFile& getGDIMetaFile() const;
- Size ImplGetSizePixel() const;
+ Size getSizePixel() const;
- Size ImplGetPrefSize() const;
- void ImplSetPrefSize( const Size& rPrefSize );
+ Size getPrefSize() const;
+ void setPrefSize( const Size& rPrefSize );
- MapMode ImplGetPrefMapMode() const;
- void ImplSetPrefMapMode( const MapMode& rPrefMapMode );
+ MapMode getPrefMapMode() const;
+ void setPrefMapMode( const MapMode& rPrefMapMode );
- sal_uLong ImplGetSizeBytes() const;
+ sal_uLong getSizeBytes() const;
- void ImplDraw( OutputDevice* pOutDev,
+ void draw( OutputDevice* pOutDev,
const Point& rDestPt ) const;
- void ImplDraw( OutputDevice* pOutDev,
+ void draw( OutputDevice* pOutDev,
const Point& rDestPt,
const Size& rDestSize ) const;
- void ImplStartAnimation( OutputDevice* pOutDev,
+ void startAnimation( OutputDevice* pOutDev,
const Point& rDestPt,
const Size& rDestSize,
tools::Long nExtraData,
OutputDevice* pFirstFrameOutDev );
- void ImplStopAnimation( const OutputDevice* pOutputDevice,
+ void stopAnimation( const OutputDevice* pOutputDevice,
tools::Long nExtraData );
- void ImplSetAnimationNotifyHdl( const Link<Animation*,void>& rLink );
- Link<Animation*,void> ImplGetAnimationNotifyHdl() const;
+ void setAnimationNotifyHdl( const Link<Animation*,void>& rLink );
+ Link<Animation*,void> getAnimationNotifyHdl() const;
- sal_uInt32 ImplGetAnimationLoopCount() const;
+ sal_uInt32 getAnimationLoopCount() const;
private:
// swapping methods
@@ -186,16 +186,16 @@ private:
bool swapOutGraphic(SvStream& rStream);
// end swapping
- std::shared_ptr<GraphicReader>& ImplGetContext() { return mpContext;}
- void ImplSetContext( const std::shared_ptr<GraphicReader>& pReader );
- void ImplSetDummyContext( bool value ) { mbDummyContext = value; }
- bool ImplIsDummyContext() const { return mbDummyContext; }
- void ImplSetLink( const std::shared_ptr<GfxLink>& );
- std::shared_ptr<GfxLink> ImplGetSharedGfxLink() const;
- GfxLink ImplGetLink();
- bool ImplIsLink() const;
+ std::shared_ptr<GraphicReader>& getContext() { return mpContext;}
+ void setContext( const std::shared_ptr<GraphicReader>& pReader );
+ void setDummyContext( bool value ) { mbDummyContext = value; }
+ bool isDummyContext() const { return mbDummyContext; }
+ void setGfxLink( const std::shared_ptr<GfxLink>& );
+ std::shared_ptr<GfxLink> getSharedGfxLink() const;
+ GfxLink getGfxLink();
+ bool isGfxLink() const;
- BitmapChecksum ImplGetChecksum() const;
+ BitmapChecksum getChecksum() const;
const std::shared_ptr<VectorGraphicData>& getVectorGraphicData() const;
diff --git a/vcl/source/filter/graphicfilter.cxx b/vcl/source/filter/graphicfilter.cxx
index 0aeb54fb5b85..6173288e6d20 100644
--- a/vcl/source/filter/graphicfilter.cxx
+++ b/vcl/source/filter/graphicfilter.cxx
@@ -1415,7 +1415,7 @@ Graphic GraphicFilter::ImportUnloadedGraphic(SvStream& rIStream, sal_uInt64 size
}
}
aGraphic.SetGfxLink(std::make_shared<GfxLink>(std::move(pGraphicContent), nGraphicContentSize, eLinkType));
- aGraphic.ImplGetImpGraphic()->ImplSetPrepared(bAnimated, pSizeHint);
+ aGraphic.ImplGetImpGraphic()->setPrepared(bAnimated, pSizeHint);
}
}
diff --git a/vcl/source/gdi/graph.cxx b/vcl/source/gdi/graph.cxx
index bd59be143d5a..033e5576ce20 100644
--- a/vcl/source/gdi/graph.cxx
+++ b/vcl/source/gdi/graph.cxx
@@ -277,69 +277,69 @@ bool Graphic::operator!=( const Graphic& rGraphic ) const
bool Graphic::IsNone() const
{
- return GraphicType::NONE == mxImpGraphic->ImplGetType();
+ return GraphicType::NONE == mxImpGraphic->getType();
}
void Graphic::Clear()
{
ImplTestRefCount();
- mxImpGraphic->ImplClear();
+ mxImpGraphic->clear();
}
GraphicType Graphic::GetType() const
{
- return mxImpGraphic->ImplGetType();
+ return mxImpGraphic->getType();
}
void Graphic::SetDefaultType()
{
ImplTestRefCount();
- mxImpGraphic->ImplSetDefaultType();
+ mxImpGraphic->setDefaultType();
}
bool Graphic::IsSupportedGraphic() const
{
- return mxImpGraphic->ImplIsSupportedGraphic();
+ return mxImpGraphic->isSupportedGraphic();
}
bool Graphic::IsTransparent() const
{
- return mxImpGraphic->ImplIsTransparent();
+ return mxImpGraphic->isTransparent();
}
bool Graphic::IsAlpha() const
{
- return mxImpGraphic->ImplIsAlpha();
+ return mxImpGraphic->isAlpha();
}
bool Graphic::IsAnimated() const
{
- return mxImpGraphic->ImplIsAnimated();
+ return mxImpGraphic->isAnimated();
}
bool Graphic::IsEPS() const
{
- return mxImpGraphic->ImplIsEPS();
+ return mxImpGraphic->isEPS();
}
BitmapEx Graphic::GetBitmapEx(const GraphicConversionParameters& rParameters) const
{
- return mxImpGraphic->ImplGetBitmapEx(rParameters);
+ return mxImpGraphic->getBitmapEx(rParameters);
}
Animation Graphic::GetAnimation() const
{
- return mxImpGraphic->ImplGetAnimation();
+ return mxImpGraphic->getAnimation();
}
const GDIMetaFile& Graphic::GetGDIMetaFile() const
{
- return mxImpGraphic->ImplGetGDIMetaFile();
+ return mxImpGraphic->getGDIMetaFile();
}
const BitmapEx& Graphic::GetBitmapExRef() const
{
- return mxImpGraphic->ImplGetBitmapExRef();
+ return mxImpGraphic->getBitmapExRef();
}
uno::Reference<graphic::XGraphic> Graphic::GetXGraphic() const
@@ -358,24 +358,24 @@ uno::Reference<graphic::XGraphic> Graphic::GetXGraphic() const
Size Graphic::GetPrefSize() const
{
- return mxImpGraphic->ImplGetPrefSize();
+ return mxImpGraphic->getPrefSize();
}
void Graphic::SetPrefSize( const Size& rPrefSize )
{
ImplTestRefCount();
- mxImpGraphic->ImplSetPrefSize( rPrefSize );
+ mxImpGraphic->setPrefSize( rPrefSize );
}
MapMode Graphic::GetPrefMapMode() const
{
- return mxImpGraphic->ImplGetPrefMapMode();
+ return mxImpGraphic->getPrefMapMode();
}
void Graphic::SetPrefMapMode( const MapMode& rPrefMapMode )
{
ImplTestRefCount();
- mxImpGraphic->ImplSetPrefMapMode( rPrefMapMode );
+ mxImpGraphic->setPrefMapMode( rPrefMapMode );
}
basegfx::B2DSize Graphic::GetPPI() const
@@ -406,8 +406,8 @@ Size Graphic::GetSizePixel( const OutputDevice* pRefDevice ) const
{
Size aRet;
- if( GraphicType::Bitmap == mxImpGraphic->ImplGetType() )
- aRet = mxImpGraphic->ImplGetSizePixel();
+ if( GraphicType::Bitmap == mxImpGraphic->getType() )
+ aRet = mxImpGraphic->getSizePixel();
else
aRet = ( pRefDevice ? pRefDevice : Application::GetDefaultDevice() )->LogicToPixel( GetPrefSize(), GetPrefMapMode() );
@@ -416,21 +416,21 @@ Size Graphic::GetSizePixel( const OutputDevice* pRefDevice ) const
sal_uLong Graphic::GetSizeBytes() const
{
- return mxImpGraphic->ImplGetSizeBytes();
+ return mxImpGraphic->getSizeBytes();
}
void Graphic::Draw( OutputDevice* pOutDev, const Point& rDestPt ) const
{
- mxImpGraphic->ImplDraw( pOutDev, rDestPt );
+ mxImpGraphic->draw( pOutDev, rDestPt );
}
void Graphic::Draw( OutputDevice* pOutDev,
const Point& rDestPt, const Size& rDestSz ) const
{
- if( GraphicType::Default == mxImpGraphic->ImplGetType() )
+ if( GraphicType::Default == mxImpGraphic->getType() )
ImplDrawDefault( pOutDev, nullptr, nullptr, nullptr, rDestPt, rDestSz );
else
- mxImpGraphic->ImplDraw( pOutDev, rDestPt, rDestSz );
+ mxImpGraphic->draw( pOutDev, rDestPt, rDestSz );
}
void Graphic::DrawEx( OutputDevice* pOutDev, const OUString& rText,
@@ -445,74 +445,74 @@ void Graphic::StartAnimation( OutputDevice* pOutDev, const Point& rDestPt,
OutputDevice* pFirstFrameOutDev )
{
ImplTestRefCount();
- mxImpGraphic->ImplStartAnimation( pOutDev, rDestPt, rDestSz, nExtraData, pFirstFrameOutDev );
+ mxImpGraphic->startAnimation( pOutDev, rDestPt, rDestSz, nExtraData, pFirstFrameOutDev );
}
void Graphic::StopAnimation( const OutputDevice* pOutDev, tools::Long nExtraData )
{
ImplTestRefCount();
- mxImpGraphic->ImplStopAnimation( pOutDev, nExtraData );
+ mxImpGraphic->stopAnimation( pOutDev, nExtraData );
}
void Graphic::SetAnimationNotifyHdl( const Link<Animation*,void>& rLink )
{
- mxImpGraphic->ImplSetAnimationNotifyHdl( rLink );
+ mxImpGraphic->setAnimationNotifyHdl( rLink );
}
Link<Animation*,void> Graphic::GetAnimationNotifyHdl() const
{
- return mxImpGraphic->ImplGetAnimationNotifyHdl();
+ return mxImpGraphic->getAnimationNotifyHdl();
}
sal_uInt32 Graphic::GetAnimationLoopCount() const
{
- return mxImpGraphic->ImplGetAnimationLoopCount();
+ return mxImpGraphic->getAnimationLoopCount();
}
std::shared_ptr<GraphicReader>& Graphic::GetReaderContext()
{
- return mxImpGraphic->ImplGetContext();
+ return mxImpGraphic->getContext();
}
void Graphic::SetReaderContext( const std::shared_ptr<GraphicReader> &pReader )
{
- mxImpGraphic->ImplSetContext( pReader );
+ mxImpGraphic->setContext( pReader );
}
void Graphic::SetDummyContext( bool value )
{
- mxImpGraphic->ImplSetDummyContext( value );
+ mxImpGraphic->setDummyContext( value );
}
bool Graphic::IsDummyContext() const
{
- return mxImpGraphic->ImplIsDummyContext();
+ return mxImpGraphic->isDummyContext();
}
void Graphic::SetGfxLink( const std::shared_ptr<GfxLink>& rGfxLink )
{
ImplTestRefCount();
- mxImpGraphic->ImplSetLink( rGfxLink );
+ mxImpGraphic->setGfxLink(rGfxLink);
}
std::shared_ptr<GfxLink> Graphic::GetSharedGfxLink() const
{
- return mxImpGraphic->ImplGetSharedGfxLink();
+ return mxImpGraphic->getSharedGfxLink();
}
GfxLink Graphic::GetGfxLink() const
{
- return mxImpGraphic->ImplGetLink();
+ return mxImpGraphic->getGfxLink();
}
bool Graphic::IsGfxLink() const
{
- return mxImpGraphic->ImplIsLink();
+ return mxImpGraphic->isGfxLink();
}
BitmapChecksum Graphic::GetChecksum() const
{
- return mxImpGraphic->ImplGetChecksum();
+ return mxImpGraphic->getChecksum();
}
const std::shared_ptr<VectorGraphicData>& Graphic::getVectorGraphicData() const
diff --git a/vcl/source/gdi/impgraph.cxx b/vcl/source/gdi/impgraph.cxx
index f6e9e74ad80e..778d05c951b0 100644
--- a/vcl/source/gdi/impgraph.cxx
+++ b/vcl/source/gdi/impgraph.cxx
@@ -126,7 +126,7 @@ ImpGraphic::ImpGraphic(ImpGraphic&& rImpGraphic) noexcept
, maLastUsed (std::chrono::high_resolution_clock::now())
, mbPrepared (rImpGraphic.mbPrepared)
{
- rImpGraphic.ImplClear();
+ rImpGraphic.clear();
rImpGraphic.mbDummyContext = false;
}
@@ -252,7 +252,7 @@ ImpGraphic& ImpGraphic::operator=(ImpGraphic&& rImpGraphic)
maGraphicExternalLink = rImpGraphic.maGraphicExternalLink;
mbPrepared = rImpGraphic.mbPrepared;
- rImpGraphic.ImplClear();
+ rImpGraphic.clear();
rImpGraphic.mbDummyContext = false;
maLastUsed = std::chrono::high_resolution_clock::now();
@@ -333,18 +333,18 @@ void ImpGraphic::createSwapInfo()
if (isSwappedOut())
return;
- maSwapInfo.maSizePixel = ImplGetSizePixel();
- maSwapInfo.maPrefMapMode = ImplGetPrefMapMode();
- maSwapInfo.maPrefSize = ImplGetPrefSize();
- maSwapInfo.mbIsAnimated = ImplIsAnimated();
- maSwapInfo.mbIsEPS = ImplIsEPS();
- maSwapInfo.mbIsTransparent = ImplIsTransparent();
- maSwapInfo.mbIsAlpha = ImplIsAlpha();
- maSwapInfo.mnAnimationLoopCount = ImplGetAnimationLoopCount();
+ maSwapInfo.maSizePixel = getSizePixel();
+ maSwapInfo.maPrefMapMode = getPrefMapMode();
+ maSwapInfo.maPrefSize = getPrefSize();
+ maSwapInfo.mbIsAnimated = isAnimated();
+ maSwapInfo.mbIsEPS = isEPS();
+ maSwapInfo.mbIsTransparent = isTransparent();
+ maSwapInfo.mbIsAlpha = isAlpha();
+ maSwapInfo.mnAnimationLoopCount = getAnimationLoopCount();
maSwapInfo.mnPageIndex = getPageNumber();
}
-void ImpGraphic::ImplClearGraphics()
+void ImpGraphic::clearGraphics()
{
maBitmapEx.Clear();
maMetaFile.Clear();
@@ -352,7 +352,7 @@ void ImpGraphic::ImplClearGraphics()
maVectorGraphicData.reset();
}
-void ImpGraphic::ImplSetPrepared(bool bAnimated, const Size* pSizeHint)
+void ImpGraphic::setPrepared(bool bAnimated, const Size* pSizeHint)
{
mbPrepared = true;
mbSwapOut = true;
@@ -403,14 +403,14 @@ void ImpGraphic::ImplSetPrepared(bool bAnimated, const Size* pSizeHint)
maSwapInfo.mnPageIndex = maVectorGraphicData->getPageIndex();
}
-void ImpGraphic::ImplClear()
+void ImpGraphic::clear()
{
mpSwapFile.reset();
mbSwapOut = false;
mbPrepared = false;
// cleanup
- ImplClearGraphics();
+ clearGraphics();
meType = GraphicType::NONE;
sal_Int64 nOldSize = mnSizeBytes;
mnSizeBytes = 0;
@@ -418,18 +418,18 @@ void ImpGraphic::ImplClear()
maGraphicExternalLink.msURL.clear();
}
-void ImpGraphic::ImplSetDefaultType()
+void ImpGraphic::setDefaultType()
{
- ImplClear();
+ clear();
meType = GraphicType::Default;
}
-bool ImpGraphic::ImplIsSupportedGraphic() const
+bool ImpGraphic::isSupportedGraphic() const
{
return( meType != GraphicType::NONE );
}
-bool ImpGraphic::ImplIsTransparent() const
+bool ImpGraphic::isTransparent() const
{
bool bRet(true);
@@ -445,7 +445,7 @@ bool ImpGraphic::ImplIsTransparent() const
return bRet;
}
-bool ImpGraphic::ImplIsAlpha() const
+bool ImpGraphic::isAlpha() const
{
bool bRet(false);
@@ -465,12 +465,12 @@ bool ImpGraphic::ImplIsAlpha() const
return bRet;
}
-bool ImpGraphic::ImplIsAnimated() const
+bool ImpGraphic::isAnimated() const
{
return mbSwapOut ? maSwapInfo.mbIsAnimated : mpAnimation != nullptr;
}
-bool ImpGraphic::ImplIsEPS() const
+bool ImpGraphic::isEPS() const
{
if (mbSwapOut)
return maSwapInfo.mbIsEPS;
@@ -502,7 +502,7 @@ BitmapEx ImpGraphic::getVectorGraphicReplacement() const
return aRet;
}
-Bitmap ImpGraphic::ImplGetBitmap(const GraphicConversionParameters& rParameters) const
+Bitmap ImpGraphic::getBitmap(const GraphicConversionParameters& rParameters) const
{
Bitmap aRetBmp;
@@ -523,7 +523,7 @@ Bitmap ImpGraphic::ImplGetBitmap(const GraphicConversionParameters& rParameters)
if(rParameters.getSizePixel().Width() || rParameters.getSizePixel().Height())
aRetBmp.Scale(rParameters.getSizePixel());
}
- else if( ( meType != GraphicType::Default ) && ImplIsSupportedGraphic() )
+ else if( ( meType != GraphicType::Default ) && isSupportedGraphic() )
{
if(maBitmapEx.IsEmpty())
{
@@ -559,7 +559,7 @@ Bitmap ImpGraphic::ImplGetBitmap(const GraphicConversionParameters& rParameters)
// need to be extended when hairlines are on the right or bottom edge
Size aPixelSize(aDrawSize);
- if(GraphicType::GdiMetafile == ImplGetType())
+ if(GraphicType::GdiMetafile == getType())
{
// get hairline and full bound rect
tools::Rectangle aHairlineRect;
@@ -592,7 +592,7 @@ Bitmap ImpGraphic::ImplGetBitmap(const GraphicConversionParameters& rParameters)
aVDev->SetAntialiasing(aVDev->GetAntialiasing() | AntialiasingFlags::PixelSnapHairline);
}
- ImplDraw( aVDev.get(), Point(), aDrawSize );
+ draw( aVDev.get(), Point(), aDrawSize );
// use maBitmapEx as local buffer for rendered metafile
const_cast< ImpGraphic* >(this)->maBitmapEx = aVDev->GetBitmapEx( Point(), aVDev->GetOutputSizePixel() );
@@ -604,14 +604,14 @@ Bitmap ImpGraphic::ImplGetBitmap(const GraphicConversionParameters& rParameters)
if( !!aRetBmp )
{
- aRetBmp.SetPrefMapMode( ImplGetPrefMapMode() );
- aRetBmp.SetPrefSize( ImplGetPrefSize() );
+ aRetBmp.SetPrefMapMode(getPrefMapMode());
+ aRetBmp.SetPrefSize(getPrefSize());
}
return aRetBmp;
}
-BitmapEx ImpGraphic::ImplGetBitmapEx(const GraphicConversionParameters& rParameters) const
+BitmapEx ImpGraphic::getBitmapEx(const GraphicConversionParameters& rParameters) const
{
BitmapEx aRetBmpEx;
@@ -634,14 +634,14 @@ BitmapEx ImpGraphic::ImplGetBitmapEx(const GraphicConversionParameters& rParamet
BmpScaleFlag::Fast);
}
}
- else if( ( meType != GraphicType::Default ) && ImplIsSupportedGraphic() )
+ else if( ( meType != GraphicType::Default ) && isSupportedGraphic() )
{
if(maBitmapEx.IsEmpty())
{
const ImpGraphic aMonoMask( maMetaFile.GetMonochromeMtf( COL_BLACK ) );
// use maBitmapEx as local buffer for rendered metafile
- const_cast< ImpGraphic* >(this)->maBitmapEx = BitmapEx(ImplGetBitmap(rParameters), aMonoMask.ImplGetBitmap(rParameters));
+ const_cast< ImpGraphic* >(this)->maBitmapEx = BitmapEx(getBitmap(rParameters), aMonoMask.getBitmap(rParameters));
}
aRetBmpEx = maBitmapEx;
@@ -650,7 +650,7 @@ BitmapEx ImpGraphic::ImplGetBitmapEx(const GraphicConversionParameters& rParamet
return aRetBmpEx;
}
-Animation ImpGraphic::ImplGetAnimation() const
+Animation ImpGraphic::getAnimation() const
{
Animation aAnimation;
@@ -661,13 +661,13 @@ Animation ImpGraphic::ImplGetAnimation() const
return aAnimation;
}
-const BitmapEx& ImpGraphic::ImplGetBitmapExRef() const
+const BitmapEx& ImpGraphic::getBitmapExRef() const
{
ensureAvailable();
return maBitmapEx;
}
-const GDIMetaFile& ImpGraphic::ImplGetGDIMetaFile() const
+const GDIMetaFile& ImpGraphic::getGDIMetaFile() const
{
ensureAvailable();
if (!maMetaFile.GetActionSize()
@@ -732,19 +732,19 @@ const GDIMetaFile& ImpGraphic::ImplGetGDIMetaFile() const
return maMetaFile;
}
-Size ImpGraphic::ImplGetSizePixel() const
+Size ImpGraphic::getSizePixel() const
{
Size aSize;
if (isSwappedOut())
aSize = maSwapInfo.maSizePixel;
else
- aSize = ImplGetBitmapEx(GraphicConversionParameters()).GetSizePixel();
+ aSize = getBitmapEx(GraphicConversionParameters()).GetSizePixel();
return aSize;
}
-Size ImpGraphic::ImplGetPrefSize() const
+Size ImpGraphic::getPrefSize() const
{
Size aSize;
@@ -814,7 +814,7 @@ void ImpGraphic::setValuesForPrefSize(const Size& rPrefSize)
// #108077# Push through pref size to animation object,
// will be lost on copy otherwise
- if (ImplIsAnimated())
+ if (isAnimated())
{
const_cast< BitmapEx& >(mpAnimation->GetBitmapEx()).SetPrefSize(rPrefSize);
}
@@ -828,7 +828,7 @@ void ImpGraphic::setValuesForPrefSize(const Size& rPrefSize)
case GraphicType::GdiMetafile:
{
- if (ImplIsSupportedGraphic())
+ if (isSupportedGraphic())
maMetaFile.SetPrefSize(rPrefSize);
}
break;
@@ -839,13 +839,13 @@ void ImpGraphic::setValuesForPrefSize(const Size& rPrefSize)
}
}
-void ImpGraphic::ImplSetPrefSize(const Size& rPrefSize)
+void ImpGraphic::setPrefSize(const Size& rPrefSize)
{
ensureAvailable();
setValuesForPrefSize(rPrefSize);
}
-MapMode ImpGraphic::ImplGetPrefMapMode() const
+MapMode ImpGraphic::getPrefMapMode() const
{
MapMode aMapMode;
@@ -904,7 +904,7 @@ void ImpGraphic::setValuesForPrefMapMod(const MapMode& rPrefMapMode)
{
// #108077# Push through pref mapmode to animation object,
// will be lost on copy otherwise
- if (ImplIsAnimated())
+ if (isAnimated())
{
const_cast<BitmapEx&>(mpAnimation->GetBitmapEx()).SetPrefMapMode(rPrefMapMode);
}
@@ -926,13 +926,13 @@ void ImpGraphic::setValuesForPrefMapMod(const MapMode& rPrefMapMode)
}
}
-void ImpGraphic::ImplSetPrefMapMode(const MapMode& rPrefMapMode)
+void ImpGraphic::setPrefMapMode(const MapMode& rPrefMapMode)
{
ensureAvailable();
setValuesForPrefMapMod(rPrefMapMode);
}
-sal_uLong ImpGraphic::ImplGetSizeBytes() const
+sal_uLong ImpGraphic::getSizeBytes() const
{
if (mnSizeBytes > 0)
return mnSizeBytes;
@@ -974,7 +974,7 @@ sal_uLong ImpGraphic::ImplGetSizeBytes() const
return mnSizeBytes;
}
-void ImpGraphic::ImplDraw(OutputDevice* pOutDev, const Point& rDestPt) const
+void ImpGraphic::draw(OutputDevice* pOutDev, const Point& rDestPt) const
{
ensureAvailable();
@@ -1004,7 +1004,7 @@ void ImpGraphic::ImplDraw(OutputDevice* pOutDev, const Point& rDestPt) const
case GraphicType::GdiMetafile:
{
- ImplDraw(pOutDev, rDestPt, maMetaFile.GetPrefSize());
+ draw(pOutDev, rDestPt, maMetaFile.GetPrefSize());
}
break;
@@ -1014,7 +1014,7 @@ void ImpGraphic::ImplDraw(OutputDevice* pOutDev, const Point& rDestPt) const
}
}
-void ImpGraphic::ImplDraw(OutputDevice* pOutDev,
+void ImpGraphic::draw(OutputDevice* pOutDev,
const Point& rDestPt, const Size& rDestSize) const
{
ensureAvailable();
@@ -1057,25 +1057,25 @@ void ImpGraphic::ImplDraw(OutputDevice* pOutDev,
}
}
-void ImpGraphic::ImplStartAnimation( OutputDevice* pOutDev, const Point& rDestPt,
+void ImpGraphic::startAnimation( OutputDevice* pOutDev, const Point& rDestPt,
const Size& rDestSize, tools::Long nExtraData,
OutputDevice* pFirstFrameOutDev )
{
ensureAvailable();
- if( ImplIsSupportedGraphic() && !isSwappedOut() && mpAnimation )
+ if( isSupportedGraphic() && !isSwappedOut() && mpAnimation )
mpAnimation->Start( pOutDev, rDestPt, rDestSize, nExtraData, pFirstFrameOutDev );
}
-void ImpGraphic::ImplStopAnimation( const OutputDevice* pOutDev, tools::Long nExtraData )
+void ImpGraphic::stopAnimation( const OutputDevice* pOutDev, tools::Long nExtraData )
{
ensureAvailable();
- if( ImplIsSupportedGraphic() && !isSwappedOut() && mpAnimation )
+ if( isSupportedGraphic() && !isSwappedOut() && mpAnimation )
mpAnimation->Stop( pOutDev, nExtraData );
}
-void ImpGraphic::ImplSetAnimationNotifyHdl( const Link<Animation*,void>& rLink )
+void ImpGraphic::setAnimationNotifyHdl( const Link<Animation*,void>& rLink )
{
ensureAvailable();
@@ -1083,7 +1083,7 @@ void ImpGraphic::ImplSetAnimationNotifyHdl( const Link<Animation*,void>& rLink )
mpAnimation->SetNotifyHdl( rLink );
}
-Link<Animation*,void> ImpGraphic::ImplGetAnimationNotifyHdl() const
+Link<Animation*,void> ImpGraphic::getAnimationNotifyHdl() const
{
Link<Animation*,void> aLink;
@@ -1095,7 +1095,7 @@ Link<Animation*,void> ImpGraphic::ImplGetAnimationNotifyHdl() const
return aLink;
}
-sal_uInt32 ImpGraphic::ImplGetAnimationLoopCount() const
+sal_uInt32 ImpGraphic::getAnimationLoopCount() const
{
if (mbSwapOut)
return maSwapInfo.mnAnimationLoopCount;
@@ -1103,7 +1103,7 @@ sal_uInt32 ImpGraphic::ImplGetAnimationLoopCount() const
return mpAnimation ? mpAnimation->GetLoopCount() : 0;
}
-void ImpGraphic::ImplSetContext( const std::shared_ptr<GraphicReader>& pReader )
+void ImpGraphic::setContext( const std::shared_ptr<GraphicReader>& pReader )
{
mpContext = pReader;
mbDummyContext = false;
@@ -1203,7 +1203,7 @@ bool ImpGraphic::swapOutGraphic(SvStream& rStream)
maVectorGraphicData->getBinaryDataContainer().getData(),
maVectorGraphicData->getBinaryDataContainer().getSize());
}
- else if (ImplIsAnimated())
+ else if (isAnimated())
{
rStream.WriteInt32(sal_Int32(GraphicContentType::Animation));
WriteAnimation(rStream, *mpAnimation);
@@ -1274,7 +1274,7 @@ bool ImpGraphic::swapOut()
{
createSwapInfo();
- ImplClearGraphics();
+ clearGraphics();
// reset the swap file
mpSwapFile.reset();
@@ -1320,7 +1320,7 @@ bool ImpGraphic::swapOut()
{
// We have swapped out, so can clean memory and prepare swap info
createSwapInfo();
- ImplClearGraphics();
+ clearGraphics();
mpSwapFile = std::move(pSwapFile);
mbSwapOut = true;
@@ -1352,11 +1352,11 @@ void ImpGraphic::updateFromLoadedGraphic(ImpGraphic* graphic)
Size aPrefSize = maSwapInfo.maPrefSize;
MapMode aPrefMapMode = maSwapInfo.maPrefMapMode;
*this = *graphic;
- if (aPrefSize.getWidth() && aPrefSize.getHeight() && aPrefMapMode == ImplGetPrefMapMode())
+ if (aPrefSize.getWidth() && aPrefSize.getHeight() && aPrefMapMode == getPrefMapMode())
{
// Use custom preferred size if it was set when the graphic was still unloaded.
// Only set the size in case the unloaded and loaded unit matches.
- ImplSetPrefSize(aPrefSize);
+ setPrefSize(aPrefSize);
}
maGraphicExternalLink = aLink;
}
@@ -1477,7 +1477,7 @@ bool ImpGraphic::swapInFromStream(SvStream& rStream)
if (rStream.GetError())
return false;
- ImplClearGraphics();
+ clearGraphics();
mnSizeBytes = 0;
mnChecksum = 0;
@@ -1486,7 +1486,7 @@ bool ImpGraphic::swapInFromStream(SvStream& rStream)
if (!bRet)
{
//throw away swapfile, etc.
- ImplClear();
+ clear();
}
mbSwapOut = false;
@@ -1604,31 +1604,31 @@ bool ImpGraphic::swapInGraphic(SvStream& rStream)
return bReturn;
}
-void ImpGraphic::ImplSetLink(const std::shared_ptr<GfxLink>& rGfxLink)
+void ImpGraphic::setGfxLink(const std::shared_ptr<GfxLink>& rGfxLink)
{
ensureAvailable();
mpGfxLink = rGfxLink;
}
-std::shared_ptr<GfxLink> ImpGraphic::ImplGetSharedGfxLink() const
+std::shared_ptr<GfxLink> ImpGraphic::getSharedGfxLink() const
{
return mpGfxLink;
}
-GfxLink ImpGraphic::ImplGetLink()
+GfxLink ImpGraphic::getGfxLink()
{
ensureAvailable();
return( mpGfxLink ? *mpGfxLink : GfxLink() );
}
-bool ImpGraphic::ImplIsLink() const
+bool ImpGraphic::isGfxLink() const
{
return ( bool(mpGfxLink) );
}
-BitmapChecksum ImpGraphic::ImplGetChecksum() const
+BitmapChecksum ImpGraphic::getChecksum() const
{
if (mnChecksum != 0)
return mnChecksum;
diff --git a/vcl/source/graphic/GraphicID.cxx b/vcl/source/graphic/GraphicID.cxx
index f2a9afa60dbe..a27485da29aa 100644
--- a/vcl/source/graphic/GraphicID.cxx
+++ b/vcl/source/graphic/GraphicID.cxx
@@ -26,10 +26,10 @@ GraphicID::GraphicID(ImpGraphic const& rGraphic)
{
rGraphic.ensureAvailable();
- mnID1 = static_cast<sal_uLong>(rGraphic.ImplGetType()) << 28;
+ mnID1 = static_cast<sal_uLong>(rGraphic.getType()) << 28;
mnID2 = mnID3 = mnID4 = 0;
- if (rGraphic.ImplGetType() == GraphicType::Bitmap)
+ if (rGraphic.getType() == GraphicType::Bitmap)
{
auto const& rVectorGraphicDataPtr = rGraphic.getVectorGraphicData();
if (rVectorGraphicDataPtr)
@@ -42,35 +42,35 @@ GraphicID::GraphicID(ImpGraphic const& rGraphic)
mnID4 = vcl_get_checksum(0, rVectorGraphicDataPtr->getBinaryDataContainer().getData(),
rVectorGraphicDataPtr->getBinaryDataContainer().getSize());
}
- else if (rGraphic.ImplIsAnimated())
+ else if (rGraphic.isAnimated())
{
- const Animation aAnimation(rGraphic.ImplGetAnimation());
+ const Animation aAnimation(rGraphic.getAnimation());
mnID1 |= (aAnimation.Count() & 0x0fffffff);
mnID2 = aAnimation.GetDisplaySizePixel().Width();
mnID3 = aAnimation.GetDisplaySizePixel().Height();
- mnID4 = rGraphic.ImplGetChecksum();
+ mnID4 = rGraphic.getChecksum();
}
else
{
- const BitmapEx aBmpEx(rGraphic.ImplGetBitmapEx(GraphicConversionParameters()));
+ const BitmapEx aBmpEx(rGraphic.getBitmapEx(GraphicConversionParameters()));
mnID1 |= (((static_cast<sal_uLong>(aBmpEx.GetTransparentType()) << 8)
| (aBmpEx.IsAlpha() ? 1 : 0))
& 0x0fffffff);
mnID2 = aBmpEx.GetSizePixel().Width();
mnID3 = aBmpEx.GetSizePixel().Height();
- mnID4 = rGraphic.ImplGetChecksum();
+ mnID4 = rGraphic.getChecksum();
}
}
- else if (rGraphic.ImplGetType() == GraphicType::GdiMetafile)
+ else if (rGraphic.getType() == GraphicType::GdiMetafile)
{
- const GDIMetaFile& rMtf = rGraphic.ImplGetGDIMetaFile();
+ const GDIMetaFile& rMtf = rGraphic.getGDIMetaFile();
mnID1 |= (rMtf.GetActionSize() & 0x0fffffff);
mnID2 = rMtf.GetPrefSize().Width();
mnID3 = rMtf.GetPrefSize().Height();
- mnID4 = rGraphic.ImplGetChecksum();
+ mnID4 = rGraphic.getChecksum();
}
}
diff --git a/vcl/source/graphic/Manager.cxx b/vcl/source/graphic/Manager.cxx
index 88e1f6e622df..5d535e446955 100644
--- a/vcl/source/graphic/Manager.cxx
+++ b/vcl/source/graphic/Manager.cxx
@@ -112,7 +112,7 @@ sal_Int64 Manager::getGraphicSizeBytes(const ImpGraphic* pImpGraphic)
{
if (!pImpGraphic->isAvailable())
return 0;
- return pImpGraphic->ImplGetSizeBytes();
+ return pImpGraphic->getSizeBytes();
}
IMPL_LINK(Manager, SwapOutTimerHandler, Timer*, pTimer, void)
commit 00ab96241e5eb0b9186fe22dcc0e9d7a5f9c873c
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Tue Dec 29 10:42:17 2020 +0900
Commit: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
CommitDate: Thu Dec 31 19:40:01 2020 +0900
vcl: remove or rename too long methods names in VectorGraphicData
Change-Id: I8a64d27927b608afdc7996e0b0bbc59a58fde90f
diff --git a/emfio/source/reader/emfreader.cxx b/emfio/source/reader/emfreader.cxx
index ae00508380e1..c2240ed612e5 100644
--- a/emfio/source/reader/emfreader.cxx
+++ b/emfio/source/reader/emfreader.cxx
@@ -517,7 +517,7 @@ namespace emfio
return;
}
- if (pVectorGraphicData->getVectorGraphicDataType() != VectorGraphicDataType::Pdf)
+ if (pVectorGraphicData->getType() != VectorGraphicDataType::Pdf)
{
return;
}
diff --git a/filter/source/svg/svgfilter.cxx b/filter/source/svg/svgfilter.cxx
index a15dc12f53e6..2d930f897359 100644
--- a/filter/source/svg/svgfilter.cxx
+++ b/filter/source/svg/svgfilter.cxx
@@ -256,7 +256,7 @@ bool SVGFilter::filterImpressOrDraw( const Sequence< PropertyValue >& rDescripto
auto const & rVectorGraphicData(aGraphic.getVectorGraphicData());
bool bContainsNoGeometry(false);
- if(bool(rVectorGraphicData) && VectorGraphicDataType::Svg == rVectorGraphicData->getVectorGraphicDataType())
+ if(bool(rVectorGraphicData) && VectorGraphicDataType::Svg == rVectorGraphicData->getType())
{
const drawinglayer::primitive2d::Primitive2DContainer aContainer(rVectorGraphicData->getPrimitive2DSequence());
diff --git a/include/vcl/vectorgraphicdata.hxx b/include/vcl/vectorgraphicdata.hxx
index 02511dd7909c..18800bac04d9 100644
--- a/include/vcl/vectorgraphicdata.hxx
+++ b/include/vcl/vectorgraphicdata.hxx
@@ -64,12 +64,12 @@ private:
std::deque< css::uno::Reference< css::graphic::XPrimitive2D > > maSequence;
BitmapEx maReplacement;
size_t mNestedBitmapSize;
- VectorGraphicDataType meVectorGraphicDataType;
+ VectorGraphicDataType meType;
// extra:
std::unique_ptr<WmfExternal> mpExternalHeader;
- // If the vector format has more pages this denotes which page to render
+ /// If the vector format has more pages this denotes which page to render
sal_Int32 mnPageIndex;
/// Useful for PDF, which is vector-based, but still rendered to a bitmap.
@@ -104,23 +104,21 @@ public:
return maDataContainer;
}
- sal_uInt32 getVectorGraphicDataArrayLength() const
- {
- return maDataContainer.getSize();
- }
-
enum class State { UNPARSED, PARSED };
std::pair<State, size_t> getSizeBytes() const;
- const VectorGraphicDataType& getVectorGraphicDataType() const { return meVectorGraphicDataType; }
+ const VectorGraphicDataType& getType() const { return meType; }
/// data read and evtl. on demand creation
const basegfx::B2DRange& getRange() const;
- const std::deque< css::uno::Reference< css::graphic::XPrimitive2D > >& getPrimitive2DSequence() const;
+ const std::deque<css::uno::Reference<css::graphic::XPrimitive2D>>& getPrimitive2DSequence() const;
const BitmapEx& getReplacement() const;
BitmapChecksum GetChecksum() const;
- sal_Int32 getPageIndex() const { return std::max(sal_Int32(0), mnPageIndex); }
+ sal_Int32 getPageIndex() const
+ {
+ return std::max(sal_Int32(0), mnPageIndex);
+ }
void setPageIndex(sal_Int32 nPageIndex)
{
diff --git a/sd/qa/unit/SdrPdfImportTest.cxx b/sd/qa/unit/SdrPdfImportTest.cxx
index 85fb33d8243c..243699c99743 100644
--- a/sd/qa/unit/SdrPdfImportTest.cxx
+++ b/sd/qa/unit/SdrPdfImportTest.cxx
@@ -107,8 +107,7 @@ CPPUNIT_TEST_FIXTURE(SdrPdfImportTest, testImportSimpleText)
Graphic aGraphic = pGraphicObject->GetGraphic();
auto const& pVectorGraphicData = aGraphic.getVectorGraphicData();
CPPUNIT_ASSERT(pVectorGraphicData);
- CPPUNIT_ASSERT_EQUAL(VectorGraphicDataType::Pdf,
- pVectorGraphicData->getVectorGraphicDataType());
+ CPPUNIT_ASSERT_EQUAL(VectorGraphicDataType::Pdf, pVectorGraphicData->getType());
// Mark the object
SdrView* pView = pViewShell->GetView();
@@ -197,8 +196,7 @@ CPPUNIT_TEST_FIXTURE(SdrPdfImportTest, testAnnotationsImportExport)
Graphic aGraphic = pGraphicObject->GetGraphic();
auto const& pVectorGraphicData = aGraphic.getVectorGraphicData();
CPPUNIT_ASSERT(pVectorGraphicData);
- CPPUNIT_ASSERT_EQUAL(VectorGraphicDataType::Pdf,
- pVectorGraphicData->getVectorGraphicDataType());
+ CPPUNIT_ASSERT_EQUAL(VectorGraphicDataType::Pdf, pVectorGraphicData->getType());
// Write the PDF
aContainer = pVectorGraphicData->getBinaryDataContainer();
diff --git a/sd/qa/unit/tiledrendering/LOKitSearchTest.cxx b/sd/qa/unit/tiledrendering/LOKitSearchTest.cxx
index 6397f8c25acc..9b898119a47c 100644
--- a/sd/qa/unit/tiledrendering/LOKitSearchTest.cxx
+++ b/sd/qa/unit/tiledrendering/LOKitSearchTest.cxx
@@ -303,8 +303,7 @@ void LOKitSearchTest::testSearchInPDFNonExisting()
Graphic aGraphic = pGraphicObject->GetGraphic();
auto const& pVectorGraphicData = aGraphic.getVectorGraphicData();
CPPUNIT_ASSERT(pVectorGraphicData);
- CPPUNIT_ASSERT_EQUAL(VectorGraphicDataType::Pdf,
- pVectorGraphicData->getVectorGraphicDataType());
+ CPPUNIT_ASSERT_EQUAL(VectorGraphicDataType::Pdf, pVectorGraphicData->getType());
lcl_search("NonExisting");
@@ -332,8 +331,7 @@ void LOKitSearchTest::testSearchInPDF()
Graphic aGraphic = pGraphicObject->GetGraphic();
auto const& pVectorGraphicData = aGraphic.getVectorGraphicData();
CPPUNIT_ASSERT(pVectorGraphicData);
- CPPUNIT_ASSERT_EQUAL(VectorGraphicDataType::Pdf,
- pVectorGraphicData->getVectorGraphicDataType());
+ CPPUNIT_ASSERT_EQUAL(VectorGraphicDataType::Pdf, pVectorGraphicData->getType());
// Search
lcl_search("ABC");
@@ -381,8 +379,7 @@ void LOKitSearchTest::testSearchInPDFOnePDFObject()
Graphic aGraphic = pGraphicObject->GetGraphic();
auto const& pVectorGraphicData = aGraphic.getVectorGraphicData();
CPPUNIT_ASSERT(pVectorGraphicData);
- CPPUNIT_ASSERT_EQUAL(VectorGraphicDataType::Pdf,
- pVectorGraphicData->getVectorGraphicDataType());
+ CPPUNIT_ASSERT_EQUAL(VectorGraphicDataType::Pdf, pVectorGraphicData->getType());
// Search down
lcl_search("ABC", false, false);
@@ -419,8 +416,7 @@ void LOKitSearchTest::testSearchInPDFInMultiplePages()
Graphic aGraphic = pGraphicObject->GetGraphic();
auto const& pVectorGraphicData = aGraphic.getVectorGraphicData();
CPPUNIT_ASSERT(pVectorGraphicData);
- CPPUNIT_ASSERT_EQUAL(VectorGraphicDataType::Pdf,
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list