mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 20:07:35 +00:00
PixelPaint: Use move semantics around Layer construction and accessors
This commit is contained in:
parent
a612c22278
commit
c7f7c1f7f0
3 changed files with 19 additions and 17 deletions
|
@ -10,7 +10,7 @@
|
|||
|
||||
namespace PixelPaint {
|
||||
|
||||
RefPtr<Layer> Layer::try_create_with_size(Image& image, Gfx::IntSize const& size, String const& name)
|
||||
RefPtr<Layer> Layer::try_create_with_size(Image& image, Gfx::IntSize const& size, String name)
|
||||
{
|
||||
if (size.is_empty())
|
||||
return nullptr;
|
||||
|
@ -18,10 +18,10 @@ RefPtr<Layer> Layer::try_create_with_size(Image& image, Gfx::IntSize const& size
|
|||
if (size.width() > 16384 || size.height() > 16384)
|
||||
return nullptr;
|
||||
|
||||
return adopt_ref(*new Layer(image, size, name));
|
||||
return adopt_ref(*new Layer(image, size, move(name)));
|
||||
}
|
||||
|
||||
RefPtr<Layer> Layer::try_create_with_bitmap(Image& image, Gfx::Bitmap const& bitmap, String const& name)
|
||||
RefPtr<Layer> Layer::try_create_with_bitmap(Image& image, Gfx::Bitmap const& bitmap, String name)
|
||||
{
|
||||
if (bitmap.size().is_empty())
|
||||
return nullptr;
|
||||
|
@ -29,7 +29,7 @@ RefPtr<Layer> Layer::try_create_with_bitmap(Image& image, Gfx::Bitmap const& bit
|
|||
if (bitmap.size().width() > 16384 || bitmap.size().height() > 16384)
|
||||
return nullptr;
|
||||
|
||||
return adopt_ref(*new Layer(image, bitmap, name));
|
||||
return adopt_ref(*new Layer(image, bitmap, move(name)));
|
||||
}
|
||||
|
||||
RefPtr<Layer> Layer::try_create_snapshot(Image& image, Layer const& layer)
|
||||
|
@ -49,16 +49,16 @@ RefPtr<Layer> Layer::try_create_snapshot(Image& image, Layer const& layer)
|
|||
return snapshot;
|
||||
}
|
||||
|
||||
Layer::Layer(Image& image, Gfx::IntSize const& size, String const& name)
|
||||
Layer::Layer(Image& image, Gfx::IntSize const& size, String name)
|
||||
: m_image(image)
|
||||
, m_name(name)
|
||||
, m_name(move(name))
|
||||
{
|
||||
m_bitmap = Gfx::Bitmap::create(Gfx::BitmapFormat::BGRA8888, size);
|
||||
}
|
||||
|
||||
Layer::Layer(Image& image, Gfx::Bitmap const& bitmap, String const& name)
|
||||
Layer::Layer(Image& image, Gfx::Bitmap const& bitmap, String name)
|
||||
: m_image(image)
|
||||
, m_name(name)
|
||||
, m_name(move(name))
|
||||
, m_bitmap(bitmap)
|
||||
{
|
||||
}
|
||||
|
@ -84,11 +84,11 @@ void Layer::set_opacity_percent(int opacity_percent)
|
|||
m_image.layer_did_modify_properties({}, *this);
|
||||
}
|
||||
|
||||
void Layer::set_name(String const& name)
|
||||
void Layer::set_name(String name)
|
||||
{
|
||||
if (m_name == name)
|
||||
return;
|
||||
m_name = name;
|
||||
m_name = move(name);
|
||||
m_image.layer_did_modify_properties({}, *this);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue