if we are resizing the mask, ensure the key gets changed from the static hash accordingly
svn path=/trunk/KDE/kdelibs/; revision=1182843
This commit is contained in:
parent
eb9af2fdf3
commit
906691e7ce
12
framesvg.cpp
12
framesvg.cpp
@ -161,6 +161,7 @@ void FrameSvg::setElementPrefix(const QString &prefix)
|
|||||||
// frame to be in the frames collection already
|
// frame to be in the frames collection already
|
||||||
const QString key = d->cacheId(oldFrameData, d->prefix);
|
const QString key = d->cacheId(oldFrameData, d->prefix);
|
||||||
//kDebug() << this << " 1. inserting as" << key;
|
//kDebug() << this << " 1. inserting as" << key;
|
||||||
|
|
||||||
FrameSvgPrivate::s_sharedFrames.insert(key, newFd);
|
FrameSvgPrivate::s_sharedFrames.insert(key, newFd);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -240,6 +241,7 @@ void FrameSvg::resizeFrame(const QSizeF &size)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const QString oldKey = d->cacheId(fd, d->prefix);
|
||||||
const QSize currentSize = fd->frameSize;
|
const QSize currentSize = fd->frameSize;
|
||||||
fd->frameSize = size.toSize();
|
fd->frameSize = size.toSize();
|
||||||
const QString newKey = d->cacheId(fd, d->prefix);
|
const QString newKey = d->cacheId(fd, d->prefix);
|
||||||
@ -257,7 +259,6 @@ void FrameSvg::resizeFrame(const QSizeF &size)
|
|||||||
if (fd->deref(this)) {
|
if (fd->deref(this)) {
|
||||||
//const QString oldKey = d->cacheId(fd, d->prefix);
|
//const QString oldKey = d->cacheId(fd, d->prefix);
|
||||||
//kDebug() << "1. Removing it" << oldKey << fd->refcount;
|
//kDebug() << "1. Removing it" << oldKey << fd->refcount;
|
||||||
const QString oldKey = d->cacheId(fd, d->prefix);
|
|
||||||
FrameSvgPrivate::s_sharedFrames.remove(oldKey);
|
FrameSvgPrivate::s_sharedFrames.remove(oldKey);
|
||||||
delete fd;
|
delete fd;
|
||||||
}
|
}
|
||||||
@ -268,7 +269,6 @@ void FrameSvg::resizeFrame(const QSizeF &size)
|
|||||||
if (fd->refcount() == 1) {
|
if (fd->refcount() == 1) {
|
||||||
// we're the only user of it, let's remove it from the shared keys
|
// we're the only user of it, let's remove it from the shared keys
|
||||||
// we don't want to deref it, however, as we'll still be using it
|
// we don't want to deref it, however, as we'll still be using it
|
||||||
const QString oldKey = d->cacheId(fd, d->prefix);
|
|
||||||
FrameSvgPrivate::s_sharedFrames.remove(oldKey);
|
FrameSvgPrivate::s_sharedFrames.remove(oldKey);
|
||||||
} else {
|
} else {
|
||||||
// others are using it, but we wish to change its size. so deref it,
|
// others are using it, but we wish to change its size. so deref it,
|
||||||
@ -530,6 +530,7 @@ QPixmap FrameSvgPrivate::alphaMask()
|
|||||||
// if successful, ref and insert, otherwise create a new one
|
// if successful, ref and insert, otherwise create a new one
|
||||||
// and insert that into both the shared frames and our frames.
|
// and insert that into both the shared frames and our frames.
|
||||||
FrameData *maskFrame = s_sharedFrames.value(key);
|
FrameData *maskFrame = s_sharedFrames.value(key);
|
||||||
|
|
||||||
if (maskFrame) {
|
if (maskFrame) {
|
||||||
maskFrame->ref(q);
|
maskFrame->ref(q);
|
||||||
} else {
|
} else {
|
||||||
@ -543,7 +544,14 @@ QPixmap FrameSvgPrivate::alphaMask()
|
|||||||
|
|
||||||
FrameData *maskFrame = frames[prefix];
|
FrameData *maskFrame = frames[prefix];
|
||||||
if (maskFrame->cachedBackground.isNull() || maskFrame->frameSize != frameSize(frame)) {
|
if (maskFrame->cachedBackground.isNull() || maskFrame->frameSize != frameSize(frame)) {
|
||||||
|
const QString oldKey = cacheId(maskFrame, prefix);
|
||||||
maskFrame->frameSize = frameSize(frame).toSize();
|
maskFrame->frameSize = frameSize(frame).toSize();
|
||||||
|
const QString newKey = cacheId(maskFrame, prefix);
|
||||||
|
if (s_sharedFrames.contains(oldKey)) {
|
||||||
|
s_sharedFrames.remove(oldKey);
|
||||||
|
s_sharedFrames.insert(newKey, maskFrame);
|
||||||
|
}
|
||||||
|
|
||||||
maskFrame->cachedBackground = QPixmap();
|
maskFrame->cachedBackground = QPixmap();
|
||||||
|
|
||||||
generateBackground(maskFrame);
|
generateBackground(maskFrame);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user