cache on disk the natural svg size
svn path=/trunk/KDE/kdelibs/; revision=912132
This commit is contained in:
parent
bfb771ddd8
commit
22b6670f00
20
svg.cpp
20
svg.cpp
@ -139,6 +139,17 @@ class SvgPrivate
|
|||||||
QObject::connect(KGlobalSettings::self(), SIGNAL(kdisplayPaletteChanged()),
|
QObject::connect(KGlobalSettings::self(), SIGNAL(kdisplayPaletteChanged()),
|
||||||
q, SLOT(colorsChanged()));
|
q, SLOT(colorsChanged()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QRectF rect;
|
||||||
|
bool found = Theme::defaultTheme()->findInRectsCache(path, "_Natural", rect);
|
||||||
|
|
||||||
|
if (found && !rect.isValid()) {
|
||||||
|
createRenderer();
|
||||||
|
naturalSize = renderer->defaultSize();
|
||||||
|
Theme::defaultTheme()->insertIntoRectsCache(path, "_Natural", QRectF(QPointF(0,0), naturalSize));
|
||||||
|
} else {
|
||||||
|
naturalSize = rect.size();
|
||||||
|
}
|
||||||
} else if (QFile::exists(imagePath)) {
|
} else if (QFile::exists(imagePath)) {
|
||||||
path = imagePath;
|
path = imagePath;
|
||||||
} else {
|
} else {
|
||||||
@ -455,8 +466,7 @@ void Svg::paint(QPainter *painter, int x, int y, int width, int height, const QS
|
|||||||
QSize Svg::size() const
|
QSize Svg::size() const
|
||||||
{
|
{
|
||||||
if (d->size.isEmpty()) {
|
if (d->size.isEmpty()) {
|
||||||
d->createRenderer();
|
d->size = d->naturalSize;
|
||||||
d->size = d->renderer->defaultSize();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return d->size.toSize();
|
return d->size.toSize();
|
||||||
@ -480,12 +490,6 @@ void Svg::resize(const QSizeF &size)
|
|||||||
|
|
||||||
void Svg::resize()
|
void Svg::resize()
|
||||||
{
|
{
|
||||||
if (d->naturalSize.isEmpty()) {
|
|
||||||
d->createRenderer();
|
|
||||||
d->naturalSize = d->renderer->defaultSize();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (qFuzzyCompare(d->naturalSize.width(), d->size.width()) &&
|
if (qFuzzyCompare(d->naturalSize.width(), d->size.width()) &&
|
||||||
qFuzzyCompare(d->naturalSize.height(), d->size.height())) {
|
qFuzzyCompare(d->naturalSize.height(), d->size.height())) {
|
||||||
return;
|
return;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user