Commit e57bcfc2 authored by Dmitry Kazakov's avatar Dmitry Kazakov

Implement KisDefaultBounds::sourceCookie()

It is needed for debugging/sanity-check purposes only. It returns an
abstract pointer to the source object, where default bounds takes its
data from. One can ckeck if the pointer is null or compare two pointers
of different default bounds objects.

CCBUG:412361
parent 62bdc048
......@@ -80,6 +80,11 @@ bool KisDefaultBounds::externalFrameActive() const
return interface ? interface->externalFrameActive() : false;
}
void *KisDefaultBounds::sourceCookie() const
{
return m_d->image.data();
}
/******************************************************************/
/* KisSelectionDefaultBounds */
/******************************************************************/
......@@ -127,7 +132,12 @@ int KisSelectionDefaultBounds::currentTime() const
bool KisSelectionDefaultBounds::externalFrameActive() const
{
return m_d->parentDevice ?
m_d->parentDevice->defaultBounds()->externalFrameActive() : false;
m_d->parentDevice->defaultBounds()->externalFrameActive() : false;
}
void *KisSelectionDefaultBounds::sourceCookie() const
{
return m_d->parentDevice.data();
}
/******************************************************************/
......
......@@ -41,6 +41,7 @@ public:
int currentLevelOfDetail() const override;
int currentTime() const override;
bool externalFrameActive() const override;
void * sourceCookie() const override;
protected:
friend class KisPaintDeviceTest;
......@@ -64,6 +65,7 @@ public:
int currentLevelOfDetail() const override;
int currentTime() const override;
bool externalFrameActive() const override;
void * sourceCookie() const override;
private:
Q_DISABLE_COPY(KisSelectionDefaultBounds)
......
......@@ -37,6 +37,19 @@ public:
virtual int currentLevelOfDetail() const = 0;
virtual int currentTime() const = 0;
virtual bool externalFrameActive() const = 0;
/**
* Return an abstract pointer to the source object,
* where default bounds takes its data from. It the
* cookie is nullptr, then the default bounds is not
* connected to anything. One can also compare if two
* default bounds are connected to the same source by
* comparing two pointers.
*
* NOTE: It is intended to be used for debugging
* purposes only!
*/
virtual void* sourceCookie() const = 0;
};
......
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