[Libreoffice-commits] core.git: include/vcl vcl/source
Tomaž Vajngerl (via logerrit)
logerrit at kemper.freedesktop.org
Thu Mar 5 07:38:56 UTC 2020
include/vcl/gfxlink.hxx | 33 ++++++++++++++++++++-------------
vcl/source/gdi/gfxlink.cxx | 2 +-
2 files changed, 21 insertions(+), 14 deletions(-)
New commits:
commit b677a4cc3eeb6eea8bb34aff0b06afe987931e6f
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Wed Mar 4 13:19:26 2020 +0100
Commit: Tomaž Vajngerl <quikee at gmail.com>
CommitDate: Thu Mar 5 08:38:23 2020 +0100
vcl: put first and last native type into GfxLinkType enum
Until now we had define GFX_LINK_FIRST_NATIVE_ID and define
GFX_LINK_LAST_NATIVE_ID which pointed to the first and last type
n the GfxLinkType which represented the native type. A more
elegant way to solve this is to assign an alias to the first and
last value. So now we have "NativeFirst" and "NativeLast" defined
in the GfxLinkType enum instead.
Change-Id: I5613a1b544fc7ae4f8b884df94c6fa4e2fb322d8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89982
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee at gmail.com>
diff --git a/include/vcl/gfxlink.hxx b/include/vcl/gfxlink.hxx
index fc21aa296aae..33f1321b6953 100644
--- a/include/vcl/gfxlink.hxx
+++ b/include/vcl/gfxlink.hxx
@@ -28,25 +28,32 @@
class SvStream;
+/** GfxLink graphic types that are supported by GfxLink.
+ *
+ * It is important that the numbers for native types stay the same, because
+ * they are used in serialization to MTF.
+ */
enum class GfxLinkType
{
NONE = 0,
EpsBuffer = 1,
- NativeGif = 2, // Don't forget to update the following defines
- NativeJpg = 3, // Don't forget to update the following defines
- NativePng = 4, // Don't forget to update the following defines
- NativeTif = 5, // Don't forget to update the following defines
- NativeWmf = 6, // Don't forget to update the following defines
- NativeMet = 7, // Don't forget to update the following defines
- NativePct = 8, // Don't forget to update the following defines
- NativeSvg = 9, // Don't forget to update the following defines
- NativeMov = 10, // Don't forget to update the following defines
+ NativeGif = 2,
+ NativeJpg = 3,
+ NativePng = 4,
+ NativeTif = 5,
+ NativeWmf = 6,
+ NativeMet = 7,
+ NativePct = 8,
+ NativeSvg = 9,
+ NativeMov = 10,
NativeBmp = 11,
- NativePdf = 12 // Don't forget to update the following defines
-};
+ NativePdf = 12, // If a new type is added, make sure to change NativeLast too
-#define GFX_LINK_FIRST_NATIVE_ID GfxLinkType::NativeGif
-#define GFX_LINK_LAST_NATIVE_ID GfxLinkType::NativePdf
+ // Alias for when the first native type starts and last native
+ // type ends.
+ NativeFirst = NativeGif,
+ NativeLast = NativePdf,
+};
class Graphic;
diff --git a/vcl/source/gdi/gfxlink.cxx b/vcl/source/gdi/gfxlink.cxx
index 1a383de72ccc..186961c2ac7d 100644
--- a/vcl/source/gdi/gfxlink.cxx
+++ b/vcl/source/gdi/gfxlink.cxx
@@ -71,7 +71,7 @@ bool GfxLink::operator==( const GfxLink& rGfxLink ) const
bool GfxLink::IsNative() const
{
- return( meType >= GFX_LINK_FIRST_NATIVE_ID && meType <= GFX_LINK_LAST_NATIVE_ID );
+ return meType >= GfxLinkType::NativeFirst && meType <= GfxLinkType::NativeLast;
}
More information about the Libreoffice-commits
mailing list