Update color profiles from image sprites in Sprite::setColorSpace()

This is needed for cmd::AssignColorProfile() to change the color space
of all images when we update the color space of the sprite.
This commit is contained in:
David Capello 2018-10-25 17:28:03 -03:00
parent 81965b904f
commit 43a603cea9
2 changed files with 3 additions and 0 deletions

View File

@ -51,6 +51,7 @@ namespace doc {
gfx::Rect bounds() const { return m_spec.bounds(); }
color_t maskColor() const { return m_spec.maskColor(); }
void setMaskColor(color_t c) { m_spec.setMaskColor(c); }
void setColorSpace(const gfx::ColorSpacePtr& cs) { m_spec.setColorSpace(cs); }
virtual int getMemSize() const override;
int getRowStrideSize() const;

View File

@ -145,6 +145,8 @@ void Sprite::setSize(int width, int height)
void Sprite::setColorSpace(const gfx::ColorSpacePtr& colorSpace)
{
m_spec.setColorSpace(colorSpace);
for (auto cel : uniqueCels())
cel->image()->setColorSpace(colorSpace);
}
bool Sprite::needAlpha() const