Commit b18e3df3 authored by Dmitry Kazakov's avatar Dmitry Kazakov

Fix crash when opening image with a Clone Layer and IP active

All paint devices owned by layers should have default bounds set
correctly. Otherwise, LoD generation will not work (and some other
things, like wraparound and animation).

BUG:412278
parent a8c0351c
......@@ -63,7 +63,9 @@ KisCloneLayer::KisCloneLayer(KisLayerSP from, KisImageWSP image, const QString &
if (!imageSP) {
return;
}
m_d->fallback = new KisPaintDevice(imageSP->colorSpace());
m_d->fallback = new KisPaintDevice(this,
imageSP->colorSpace(),
new KisDefaultBounds(imageSP));
m_d->copyFrom = from;
m_d->type = COPY_PROJECTION;
......@@ -77,7 +79,9 @@ KisCloneLayer::KisCloneLayer(const KisCloneLayer& rhs)
: KisLayer(rhs)
, m_d(new Private(new KisDefaultBounds(rhs.image())))
{
m_d->fallback = new KisPaintDevice(rhs.m_d->fallback->colorSpace());
m_d->fallback = new KisPaintDevice(this,
rhs.m_d->fallback->colorSpace(),
new KisDefaultBounds(rhs.image()));
m_d->copyFrom = rhs.copyFrom();
m_d->type = rhs.copyType();
m_d->offset = rhs.m_d->offset;
......@@ -107,6 +111,12 @@ KisLayerSP KisCloneLayer::reincarnateAsPaintLayer() const
return newLayer;
}
void KisCloneLayer::setImage(KisImageWSP image)
{
m_d->fallback->setDefaultBounds(new KisDefaultBounds(image));
KisLayer::setImage(image);
}
bool KisCloneLayer::allowAsChild(KisNodeSP node) const
{
return node->inherits("KisMask");
......
......@@ -65,6 +65,8 @@ public:
*/
KisLayerSP reincarnateAsPaintLayer() const;
void setImage(KisImageWSP image) override;
bool allowAsChild(KisNodeSP) const override;
KisPaintDeviceSP original() const override;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment