Commit a918a7cb authored by Dmitry Kazakov's avatar Dmitry Kazakov

Fix KisDecorationsWrapperLayer to set up default bounds correctly

Hopefully, fake paint device will never be used, but we cannot
guarantee it.
parent d2fed946
......@@ -24,6 +24,7 @@
#include "kis_grid_config.h"
#include "kis_guides_config.h"
#include "kis_painting_assistant.h"
#include "kis_default_bounds.h"
struct KisDecorationsWrapperLayer::Private
{
......@@ -37,6 +38,7 @@ KisDecorationsWrapperLayer::KisDecorationsWrapperLayer(KisDocument *document)
{
m_d->document = document;
m_d->fakeOriginalDevice = new KisPaintDevice(KoColorSpaceRegistry::instance()->rgb8());
m_d->fakeOriginalDevice->setDefaultBounds(new KisDefaultBounds(document->image()));
}
......@@ -45,7 +47,7 @@ KisDecorationsWrapperLayer::KisDecorationsWrapperLayer(const KisDecorationsWrapp
m_d(new Private)
{
m_d->document = rhs.m_d->document;
m_d->fakeOriginalDevice = new KisPaintDevice(KoColorSpaceRegistry::instance()->rgb8());
m_d->fakeOriginalDevice = new KisPaintDevice(*rhs.m_d->fakeOriginalDevice);
}
KisDecorationsWrapperLayer::~KisDecorationsWrapperLayer()
......@@ -104,6 +106,12 @@ bool KisDecorationsWrapperLayer::supportsPerspectiveTransform() const
return false;
}
void KisDecorationsWrapperLayer::setImage(KisImageWSP image)
{
m_d->fakeOriginalDevice->setDefaultBounds(new KisDefaultBounds(image));
KisExternalLayer::setImage(image);
}
KUndo2Command *KisDecorationsWrapperLayer::crop(const QRect &rect)
{
return transform(QTransform::fromTranslate(-rect.x(), -rect.y()));
......
......@@ -62,6 +62,8 @@ public:
bool supportsPerspectiveTransform() const override;
void setImage(KisImageWSP image) override;
private:
struct Private;
const QScopedPointer<Private> m_d;
......
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