look ma, no FAILs!
use the suffix normal for natural for sizes in the cache, makes not nevessary the svg size to be initialized svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=872706
This commit is contained in:
parent
84f23dd033
commit
027957f2e5
21
svg.cpp
21
svg.cpp
@ -79,9 +79,14 @@ class SvgPrivate
|
|||||||
|
|
||||||
QString cacheId(const QString &elementId)
|
QString cacheId(const QString &elementId)
|
||||||
{
|
{
|
||||||
return QString("%3_%2_%1").arg(int(size.height()))
|
if (size.isValid() && size != naturalSize) {
|
||||||
.arg(int(size.width()))
|
return QString("%3_%2_%1").arg(int(size.height()))
|
||||||
.arg(elementId);
|
.arg(int(size.width()))
|
||||||
|
.arg(elementId);
|
||||||
|
} else {
|
||||||
|
return QString("%2_%1").arg("Natural")
|
||||||
|
.arg(elementId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool setImagePath(const QString &imagePath, Svg *q)
|
bool setImagePath(const QString &imagePath, Svg *q)
|
||||||
@ -233,7 +238,12 @@ class SvgPrivate
|
|||||||
QRectF elementRect(const QString &elementId)
|
QRectF elementRect(const QString &elementId)
|
||||||
{
|
{
|
||||||
QRectF rect;
|
QRectF rect;
|
||||||
bool found = Theme::defaultTheme()->findInRectsCache(themePath, cacheId(elementId), rect);
|
|
||||||
|
if (themed && path.isEmpty()) {
|
||||||
|
path = Plasma::Theme::defaultTheme()->imagePath(themePath);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool found = Theme::defaultTheme()->findInRectsCache(path, cacheId(elementId), rect);
|
||||||
|
|
||||||
if (found) {
|
if (found) {
|
||||||
return rect;
|
return rect;
|
||||||
@ -247,7 +257,7 @@ class SvgPrivate
|
|||||||
createRenderer();
|
createRenderer();
|
||||||
QRectF elementRect = renderer->elementExists(elementId) ?
|
QRectF elementRect = renderer->elementExists(elementId) ?
|
||||||
renderer->boundsOnElement(elementId) : QRectF();
|
renderer->boundsOnElement(elementId) : QRectF();
|
||||||
QSizeF naturalSize = renderer->defaultSize();
|
naturalSize = renderer->defaultSize();
|
||||||
qreal dx = size.width() / naturalSize.width();
|
qreal dx = size.width() / naturalSize.width();
|
||||||
qreal dy = size.height() / naturalSize.height();
|
qreal dy = size.height() / naturalSize.height();
|
||||||
|
|
||||||
@ -326,6 +336,7 @@ class SvgPrivate
|
|||||||
QString themePath;
|
QString themePath;
|
||||||
QString path;
|
QString path;
|
||||||
QSizeF size;
|
QSizeF size;
|
||||||
|
QSizeF naturalSize;
|
||||||
bool multipleImages;
|
bool multipleImages;
|
||||||
bool themed;
|
bool themed;
|
||||||
bool applyColors;
|
bool applyColors;
|
||||||
|
Loading…
Reference in New Issue
Block a user