Changeset View
Changeset View
Standalone View
Standalone View
libs/image/kis_paint_device_cache.h
Context not available. | |||||
82 | return m_regionCache.getValue(); | 82 | return m_regionCache.getValue(); | ||
---|---|---|---|---|---|
83 | } | 83 | } | ||
84 | 84 | | |||
85 | QImage createThumbnail(qint32 w, qint32 h, KoColorConversionTransformation::Intent renderingIntent, KoColorConversionTransformation::ConversionFlags conversionFlags) { | 85 | QImage createThumbnail(qint32 w, qint32 h, qreal oversample, KoColorConversionTransformation::Intent renderingIntent, KoColorConversionTransformation::ConversionFlags conversionFlags) { | ||
86 | QImage thumbnail; | 86 | QImage thumbnail; | ||
87 | 87 | | |||
88 | if(m_thumbnailsValid) { | 88 | if(m_thumbnailsValid) { | ||
89 | thumbnail = findThumbnail(w, h); | 89 | thumbnail = findThumbnail(w, h, oversample); | ||
90 | } | 90 | } | ||
91 | else { | 91 | else { | ||
92 | m_thumbnails.clear(); | 92 | m_thumbnails.clear(); | ||
Context not available. | |||||
94 | } | 94 | } | ||
95 | 95 | | |||
96 | if(thumbnail.isNull()) { | 96 | if(thumbnail.isNull()) { | ||
97 | thumbnail = m_paintDevice->createThumbnail(w, h, QRect(), renderingIntent, conversionFlags); | 97 | thumbnail = m_paintDevice->createThumbnail(w, h, QRect(), oversample, renderingIntent, conversionFlags); | ||
98 | cacheThumbnail(w, h, thumbnail); | 98 | cacheThumbnail(w, h, oversample, thumbnail); | ||
99 | } | 99 | } | ||
100 | 100 | | |||
101 | Q_ASSERT(!thumbnail.isNull() || m_paintDevice->extent().isEmpty()); | 101 | Q_ASSERT(!thumbnail.isNull() || m_paintDevice->extent().isEmpty()); | ||
Context not available. | |||||
103 | } | 103 | } | ||
104 | 104 | | |||
105 | private: | 105 | private: | ||
106 | inline QImage findThumbnail(qint32 w, qint32 h) { | 106 | inline QImage findThumbnail(qint32 w, qint32 h, qreal oversample) { | ||
107 | QImage resultImage; | 107 | QImage resultImage; | ||
108 | if (m_thumbnails.contains(w) && m_thumbnails[w].contains(h)) { | 108 | if (m_thumbnails.contains(w) && m_thumbnails[w].contains(h) && m_thumbnails[w][h].contains(oversample)) { | ||
109 | resultImage = m_thumbnails[w][h]; | 109 | resultImage = m_thumbnails[w][h][oversample]; | ||
110 | } | 110 | } | ||
111 | return resultImage; | 111 | return resultImage; | ||
112 | } | 112 | } | ||
113 | 113 | | |||
114 | inline void cacheThumbnail(qint32 w, qint32 h, QImage image) { | 114 | inline void cacheThumbnail(qint32 w, qint32 h, qreal oversample, QImage image) { | ||
115 | m_thumbnails[w][h] = image; | 115 | m_thumbnails[w][h][oversample] = image; | ||
116 | } | 116 | } | ||
117 | 117 | | |||
118 | private: | 118 | private: | ||
Context not available. | |||||
153 | RegionCache m_regionCache; | 153 | RegionCache m_regionCache; | ||
154 | 154 | | |||
155 | bool m_thumbnailsValid; | 155 | bool m_thumbnailsValid; | ||
156 | QMap<int, QMap<int, QImage> > m_thumbnails; | 156 | QMap<int, QMap<int, QMap<qreal,QImage> > > m_thumbnails; | ||
157 | }; | 157 | }; | ||
158 | 158 | | |||
159 | #endif /* __KIS_PAINT_DEVICE_CACHE_H */ | 159 | #endif /* __KIS_PAINT_DEVICE_CACHE_H */ | ||
Context not available. |