| 1 | /* |
| 2 | SPDX-FileCopyrightText: 2006-2010 Aaron Seigo <[email protected]> |
| 3 | |
| 4 | SPDX-License-Identifier: LGPL-2.0-or-later |
| 5 | */ |
| 6 | |
| 7 | #ifndef KSVG_SVG_P_H |
| 8 | #define KSVG_SVG_P_Hcxx . . $ `src/ksvg/private/svg_p.h:8:9`! |
| 9 | |
| 10 | #include "svg.h"cxx . . $ `<file>/src/ksvg/svg.h`/ |
| 11 | |
| 12 | #include <shared_mutex> |
| 13 | |
| 14 | #include <KColorScheme> |
| 15 | |
| 16 | #include <QExplicitlySharedDataPointer> |
| 17 | #include <QHash> |
| 18 | #include <QObject> |
| 19 | #include <QPalette> |
| 20 | #include <QPointer> |
| 21 | #include <QSharedData> |
| 22 | #include <QSvgRenderer> |
| 23 | |
| 24 | namespace KSvgcxx . . $ KSvg/ |
| 25 | { |
| 26 | class SharedSvgRenderercxx . . $ KSvg/SharedSvgRenderer# : public QSvgRenderercxx . . $ QSvgRenderer#, public QSharedDatacxx . . $ QSharedData# |
| 27 | { |
| 28 | Q_OBJECTcxx . . $ KSvg/SharedSvgRenderer#QPrivateSignal#QPrivateSignal(49f6e7a06ebc5aa8). |
| 29 | public: |
| 30 | typedef QExplicitlySharedDataPointercxx . . $ QExplicitlySharedDataPointer#<SharedSvgRenderercxx . . $ KSvg/SharedSvgRenderer#> Ptrcxx . . $ KSvg/SharedSvgRenderer#Ptr#; |
| 31 | |
| 32 | explicit SharedSvgRenderercxx . . $ KSvg/SharedSvgRenderer#SharedSvgRenderer(749de1b6ae65bddd).(QObjectcxx . . $ QObject# *parent = nullptr); |
| 33 | SharedSvgRenderercxx . . $ KSvg/SharedSvgRenderer#SharedSvgRenderer(2d656b8c3708a8ad).(const QStringcxx . . $ QString# &filename, const QStringcxx . . $ QString# &styleSheet, QHashcxx . . $ QHash#<QStringcxx . . $ QString#, QRectFcxx . . $ QRectF#> &interestingElements, QObjectcxx . . $ QObject# *parent = nullptr); |
| 34 | |
| 35 | SharedSvgRenderercxx . . $ KSvg/SharedSvgRenderer#SharedSvgRenderer(33f0aa5d50c45656).(const QByteArraycxx . . $ QByteArray# &contents, const QStringcxx . . $ QString# &styleSheet, QHashcxx . . $ QHash#<QStringcxx . . $ QString#, QRectFcxx . . $ QRectF#> &interestingElements, QObjectcxx . . $ QObject# *parent = nullptr); |
| 36 | |
| 37 | void reloadcxx . . $ KSvg/SharedSvgRenderer#reload(49f6e7a06ebc5aa8).(); |
| 38 | |
| 39 | privatecxx . . $ `autotests/svgtest.cpp:15:9`!: |
| 40 | bool loadcxx . . $ KSvg/SharedSvgRenderer#load(2f053ab63e688175).(const QByteArraycxx . . $ QByteArray# &contents, const QStringcxx . . $ QString# &styleSheet, QHashcxx . . $ QHash#<QStringcxx . . $ QString#, QRectFcxx . . $ QRectF#> &interestingElements); |
| 41 | |
| 42 | QStringcxx . . $ QString# m_filenamecxx . . $ KSvg/SharedSvgRenderer#m_filename.; |
| 43 | QStringcxx . . $ QString# m_styleSheetcxx . . $ KSvg/SharedSvgRenderer#m_styleSheet.; |
| 44 | QHashcxx . . $ QHash#<QStringcxx . . $ QString#, QRectFcxx . . $ QRectF#> m_interestingElementscxx . . $ KSvg/SharedSvgRenderer#m_interestingElements.; |
| 45 | }; |
| 46 | |
| 47 | class SvgPrivatecxx . . $ KSvg/SvgPrivate# |
| 48 | { |
| 49 | public: |
| 50 | struct CacheIdcxx . . $ KSvg/SvgPrivate#CacheId# { |
| 51 | double widthcxx . . $ KSvg/SvgPrivate#CacheId#width.; |
| 52 | double heightcxx . . $ KSvg/SvgPrivate#CacheId#height.; |
| 53 | QStringcxx . . $ QString# filePathcxx . . $ KSvg/SvgPrivate#CacheId#filePath.; |
| 54 | QStringcxx . . $ QString# elementNamecxx . . $ KSvg/SvgPrivate#CacheId#elementName.; |
| 55 | int statuscxx . . $ KSvg/SvgPrivate#CacheId#status.; |
| 56 | double scaleFactorcxx . . $ KSvg/SvgPrivate#CacheId#scaleFactor.; |
| 57 | int colorSetcxx . . $ KSvg/SvgPrivate#CacheId#colorSet.; |
| 58 | size_t styleSheetcxx . . $ KSvg/SvgPrivate#CacheId#styleSheet.; // TODO: use that |
| 59 | uintcxx . . $ uint# extraFlagscxx . . $ KSvg/SvgPrivate#CacheId#extraFlags.; // Not used here, used for enabledborders in FrameSvg |
| 60 | uintcxx . . $ uint# lastModifiedcxx . . $ KSvg/SvgPrivate#CacheId#lastModified.; |
| 61 | }; |
| 62 | |
| 63 | SvgPrivatecxx . . $ KSvg/SvgPrivate#SvgPrivate(400b6ff3eab0ce4f).(Svgcxx . . $ KSvg/Svg# *svg); |
| 64 | ~cxx . . $ KSvg/SvgPrivate#`~SvgPrivate`(49f6e7a06ebc5aa8).SvgPrivatecxx . . $ KSvg/SvgPrivate#(); |
| 65 | |
| 66 | size_t paletteIdcxx . . $ KSvg/SvgPrivate#paletteId(68755190fe51a7b1).(const QPalettecxx . . $ QPalette# &palette, const QColorcxx . . $ QColor# &positive, const QColorcxx . . $ QColor# &neutral, const QColorcxx . . $ QColor# &negative) const; |
| 67 | |
| 68 | // This function is meant for the rects cache |
| 69 | CacheIdcxx . . $ KSvg/SvgPrivate#CacheId# cacheIdcxx . . $ KSvg/SvgPrivate#cacheId(d3b8a0cfbc9e9edf).(QStringViewcxx . . $ QStringView# elementId) const; |
| 70 | |
| 71 | // This function is meant for the pixmap cache |
| 72 | QStringcxx . . $ QString# cachePathcxx . . $ KSvg/SvgPrivate#cachePath(2e8b5b342e3a016e).(const QStringcxx . . $ QString# &path, const QSizecxx . . $ QSize# &size) const; |
| 73 | |
| 74 | bool setImagePathcxx . . $ KSvg/SvgPrivate#setImagePath(e1defb592416720d).(const QStringcxx . . $ QString# &imagePath); |
| 75 | |
| 76 | ImageSetcxx . . $ KSvg/ImageSet# *actualImageSetcxx . . $ KSvg/SvgPrivate#actualImageSet(c40433dd4a437fd6).(); |
| 77 | |
| 78 | QPixmapcxx . . $ QPixmap# findInCachecxx . . $ KSvg/SvgPrivate#findInCache(ac6b6ab1c5a6137a).(const QStringcxx . . $ QString# &elementId, qrealcxx . . $ qreal# ratio, const QSizeFcxx . . $ QSizeF# &s = QSizeFcxx . . $ QSizeF#QSizeF(ced63f7c635d850d).()); |
| 79 | |
| 80 | void createRenderercxx . . $ KSvg/SvgPrivate#createRenderer(49f6e7a06ebc5aa8).(); |
| 81 | void eraseRenderercxx . . $ KSvg/SvgPrivate#eraseRenderer(49f6e7a06ebc5aa8).(); |
| 82 | |
| 83 | QRectFcxx . . $ QRectF# elementRectcxx . . $ KSvg/SvgPrivate#elementRect(12c3aff75f7519f4).(QStringViewcxx . . $ QStringView# elementId); |
| 84 | QRectFcxx . . $ QRectF# findAndCacheElementRectcxx . . $ KSvg/SvgPrivate#findAndCacheElementRect(12c3aff75f7519f4).(QStringViewcxx . . $ QStringView# elementId); |
| 85 | |
| 86 | // Following two are utility functions to snap rendered elements to the pixel grid |
| 87 | // to and from are always 0 <= val <= 1 |
| 88 | qrealcxx . . $ qreal# closestDistancecxx . . $ KSvg/SvgPrivate#closestDistance(d8e7e0733fa41c87).(qrealcxx . . $ qreal# to, qrealcxx . . $ qreal# from); |
| 89 | |
| 90 | QRectFcxx . . $ QRectF# makeUniformcxx . . $ KSvg/SvgPrivate#makeUniform(3615144b933e7999).(const QRectFcxx . . $ QRectF# &orig, const QRectFcxx . . $ QRectF# &dst); |
| 91 | |
| 92 | // Slots |
| 93 | void imageSetChangedcxx . . $ KSvg/SvgPrivate#imageSetChanged(49f6e7a06ebc5aa8).(); |
| 94 | void colorsChangedcxx . . $ KSvg/SvgPrivate#colorsChanged(49f6e7a06ebc5aa8).(); |
| 95 | |
| 96 | static stdcxx . . $ std/::shared_mutexcxx . . $ std/shared_mutex# s_renderersLockcxx . . $ KSvg/SvgPrivate#s_renderersLock.; |
| 97 | static QHashcxx . . $ QHash#<QStringcxx . . $ QString#, SharedSvgRenderercxx . . $ KSvg/SharedSvgRenderer#::Ptrcxx . . $ KSvg/SharedSvgRenderer#Ptr#> s_rendererscxx . . $ KSvg/SvgPrivate#s_renderers.; |
| 98 | static QPointercxx . . $ QPointer#<ImageSetcxx . . $ KSvg/ImageSet#> s_systemColorsCachecxx . . $ KSvg/SvgPrivate#s_systemColorsCache.; |
| 99 | |
| 100 | Svgcxx . . $ KSvg/Svg# *qcxx . . $ KSvg/SvgPrivate#q.; |
| 101 | QPointercxx . . $ QPointer#<ImageSetcxx . . $ KSvg/ImageSet#> themecxx . . $ KSvg/SvgPrivate#theme.; |
| 102 | SharedSvgRenderercxx . . $ KSvg/SharedSvgRenderer#::Ptrcxx . . $ KSvg/SharedSvgRenderer#Ptr# renderercxx . . $ KSvg/SvgPrivate#renderer.; |
| 103 | QStringcxx . . $ QString# themePathcxx . . $ KSvg/SvgPrivate#themePath.; |
| 104 | QStringcxx . . $ QString# pathcxx . . $ KSvg/SvgPrivate#path.; |
| 105 | QSizeFcxx . . $ QSizeF# sizecxx . . $ KSvg/SvgPrivate#size.; |
| 106 | QSizeFcxx . . $ QSizeF# naturalSizecxx . . $ KSvg/SvgPrivate#naturalSize.; |
| 107 | QCharcxx . . $ QChar# styleCrccxx . . $ KSvg/SvgPrivate#styleCrc.; |
| 108 | // We need colorOverrides.values() to have a stable order |
| 109 | QMapcxx . . $ QMap#<Svgcxx . . $ KSvg/Svg#::StyleSheetColorcxx . . $ KSvg/Svg#StyleSheetColor#, QColorcxx . . $ QColor#> colorOverridescxx . . $ KSvg/SvgPrivate#colorOverrides.; |
| 110 | QStringcxx . . $ QString# stylesheetOverridecxx . . $ KSvg/SvgPrivate#stylesheetOverride.; |
| 111 | KColorSchemecxx . . $ KColorScheme#::ColorSetcxx . . $ KColorScheme#ColorSet# colorSetcxx . . $ KSvg/SvgPrivate#colorSet. = KColorSchemecxx . . $ KColorScheme#::Windowcxx . . $ KColorScheme#Window.; |
| 112 | unsigned int lastModifiedcxx . . $ KSvg/SvgPrivate#lastModified.; |
| 113 | qrealcxx . . $ qreal# devicePixelRatiocxx . . $ KSvg/SvgPrivate#devicePixelRatio.; |
| 114 | Svgcxx . . $ KSvg/Svg#::Statuscxx . . $ KSvg/Svg#Status# statuscxx . . $ KSvg/SvgPrivate#status.; |
| 115 | QMetaObjectcxx . . $ QMetaObject#::Connectioncxx . . $ QMetaObject#Connection# imageSetChangedConnectioncxx . . $ KSvg/SvgPrivate#imageSetChangedConnection.; |
| 116 | |
| 117 | bool multipleImagescxx . . $ KSvg/SvgPrivate#multipleImages. : 1; |
| 118 | bool themedcxx . . $ KSvg/SvgPrivate#themed. : 1; |
| 119 | bool fromCurrentImageSetcxx . . $ KSvg/SvgPrivate#fromCurrentImageSet. : 1; |
| 120 | bool cacheRenderingcxx . . $ KSvg/SvgPrivate#cacheRendering. : 1; |
| 121 | bool themeFailedcxx . . $ KSvg/SvgPrivate#themeFailed. : 1; |
| 122 | }; |
| 123 | |
| 124 | class SvgRectsCachecxx . . $ KSvg/SvgRectsCache# : public QObjectcxx . . $ QObject# |
| 125 | { |
| 126 | Q_OBJECTcxx . . $ KSvg/SvgRectsCache#qt_staticMetaObjectContent. |
| 127 | public: |
| 128 | SvgRectsCachecxx . . $ KSvg/SvgRectsCache#SvgRectsCache(749de1b6ae65bddd).(QObjectcxx . . $ QObject# *parent = nullptr); |
| 129 | |
| 130 | static SvgRectsCachecxx . . $ KSvg/SvgRectsCache# *instancecxx . . $ KSvg/SvgRectsCache#instance(5cbad4219c1fb005).(); |
| 131 | |
| 132 | void insertcxx . . $ KSvg/SvgRectsCache#insert(24ec5fbf23ebb253).(SvgPrivatecxx . . $ KSvg/SvgPrivate#::CacheIdcxx . . $ KSvg/SvgPrivate#CacheId# cacheId, const QRectFcxx . . $ QRectF# &rect, unsigned int lastModified); |
| 133 | void insertcxx . . $ KSvg/SvgRectsCache#insert(5f84713bf3b3dc96).(size_t id, const QStringcxx . . $ QString# &filePath, const QRectFcxx . . $ QRectF# &rect, unsigned int lastModified); |
| 134 | // Those 2 methods are the same, the second uses the integer id produced by hashed CacheId |
| 135 | bool findElementRectcxx . . $ KSvg/SvgRectsCache#findElementRect(f05b003186c2c04c).(SvgPrivatecxx . . $ KSvg/SvgPrivate#::CacheIdcxx . . $ KSvg/SvgPrivate#CacheId# cacheId, QRectFcxx . . $ QRectF# &rect); |
| 136 | bool findElementRectcxx . . $ KSvg/SvgRectsCache#findElementRect(c7ac5a519d98c01e).(size_t id, QStringViewcxx . . $ QStringView# filePath, QRectFcxx . . $ QRectF# &rect); |
| 137 | |
| 138 | bool loadImageFromCachecxx . . $ KSvg/SvgRectsCache#loadImageFromCache(ba319f3035cc12a4).(const QStringcxx . . $ QString# &path, uintcxx . . $ uint# lastModified); |
| 139 | void dropImageFromCachecxx . . $ KSvg/SvgRectsCache#dropImageFromCache(3520e46b33348bf6).(const QStringcxx . . $ QString# &path); |
| 140 | |
| 141 | void setNaturalSizecxx . . $ KSvg/SvgRectsCache#setNaturalSize(9ce17422af73659f).(const QStringcxx . . $ QString# &path, const QSizeFcxx . . $ QSizeF# &size); |
| 142 | QSizeFcxx . . $ QSizeF# naturalSizecxx . . $ KSvg/SvgRectsCache#naturalSize(1e47a7ebea05eaa2).(const QStringcxx . . $ QString# &path); |
| 143 | |
| 144 | QListcxx . . $ QList#<QSizeFcxx . . $ QSizeF#> sizeHintsForIdcxx . . $ KSvg/SvgRectsCache#sizeHintsForId(3a57d4de2978cc5c).(const QStringcxx . . $ QString# &path, const QStringcxx . . $ QString# &id); |
| 145 | void insertSizeHintForIdcxx . . $ KSvg/SvgRectsCache#insertSizeHintForId(88be1cfae3202cf8).(const QStringcxx . . $ QString# &path, const QStringcxx . . $ QString# &id, const QSizeFcxx . . $ QSizeF# &size); |
| 146 | |
| 147 | QStringcxx . . $ QString# iconThemePathcxx . . $ KSvg/SvgRectsCache#iconThemePath(4365c3963150523e).(); |
| 148 | void setIconThemePathcxx . . $ KSvg/SvgRectsCache#setIconThemePath(3520e46b33348bf6).(const QStringcxx . . $ QString# &path); |
| 149 | |
| 150 | QStringListcxx . . $ QStringList# cachedKeysForPathcxx . . $ KSvg/SvgRectsCache#cachedKeysForPath(4b00015d79d0eb1).(const QStringcxx . . $ QString# &path) const; |
| 151 | |
| 152 | unsigned int lastModifiedTimeFromCachecxx . . $ KSvg/SvgRectsCache#lastModifiedTimeFromCache(e8ec7545014d605d).(const QStringcxx . . $ QString# &filePath); |
| 153 | |
| 154 | void updateLastModifiedcxx . . $ KSvg/SvgRectsCache#updateLastModified(3b82dea2bbfde5fa).(const QStringcxx . . $ QString# &filePath, unsigned int lastModified); |
| 155 | |
| 156 | static const size_t s_seedcxx . . $ KSvg/SvgRectsCache#s_seed.; |
| 157 | |
| 158 | Q_SIGNALScxx . . $ `<external>/4830994369567095248/qtmetamacros.h:47:10`!: |
| 159 | void lastModifiedChangedcxx . . $ KSvg/SvgRectsCache#lastModifiedChanged(3b82dea2bbfde5fa).(const QStringcxx . . $ QString# &filePath, unsigned int lastModified); |
| 160 | |
| 161 | privatecxx . . $ `autotests/svgtest.cpp:15:9`!: |
| 162 | QTimercxx . . $ QTimer# *m_configSyncTimercxx . . $ KSvg/SvgRectsCache#m_configSyncTimer. = nullptr; |
| 163 | QStringcxx . . $ QString# m_iconThemePathcxx . . $ KSvg/SvgRectsCache#m_iconThemePath.; |
| 164 | KSharedConfigPtrcxx . . $ KSharedConfigPtr# m_svgElementsCachecxx . . $ KSvg/SvgRectsCache#m_svgElementsCache.; |
| 165 | /* |
| 166 | * We are indexing in the hash cache ids by their "digested" size_t out of qHash(CacheId) |
| 167 | * because we need to serialize it and unserialize it to a config file, |
| 168 | * which is more efficient to do that with the size_t directly rather than a CacheId struct serialization |
| 169 | */ |
| 170 | QHashcxx . . $ QHash#<size_t, QRectFcxx . . $ QRectF#> m_localRectCachecxx . . $ KSvg/SvgRectsCache#m_localRectCache.; |
| 171 | QHashcxx . . $ QHash#<QStringcxx . . $ QString#, QSetcxx . . $ QSet#<unsigned int>> m_invalidElementscxx . . $ KSvg/SvgRectsCache#m_invalidElements.; |
| 172 | QHashcxx . . $ QHash#<QStringcxx . . $ QString#, QListcxx . . $ QList#<QSizeFcxx . . $ QSizeF#>> m_sizeHintsForIdcxx . . $ KSvg/SvgRectsCache#m_sizeHintsForId.; |
| 173 | QHashcxx . . $ QHash#<QStringcxx . . $ QString#, unsigned int> m_lastModifiedTimescxx . . $ KSvg/SvgRectsCache#m_lastModifiedTimes.; |
| 174 | }; |
| 175 | } |
| 176 | |
| 177 | size_t qHashcxx . . $ qHash(b3224e6ba65ae4db).(const KSvgcxx . . $ KSvg/::SvgPrivatecxx . . $ KSvg/SvgPrivate#::CacheIdcxx . . $ KSvg/SvgPrivate#CacheId# &id, size_t seed = 0); |
| 178 | |
| 179 | #endif |