mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 08:17:35 +00:00
PixelPaint: Only update the layer thumbnail on layer bitmap changes
When a layer bitmap is modified, we don't have to repaint the whole layer gadget in the layer list, only the little thumbnail. :^)
This commit is contained in:
parent
285f0383d4
commit
fd898be51a
4 changed files with 16 additions and 5 deletions
|
@ -434,7 +434,7 @@ void Image::layer_did_modify_bitmap(Badge<Layer>, Layer const& layer, Gfx::IntRe
|
|||
{
|
||||
auto layer_index = index_of(layer);
|
||||
for (auto* client : m_clients)
|
||||
client->image_did_modify_layer(layer_index);
|
||||
client->image_did_modify_layer_bitmap(layer_index);
|
||||
|
||||
did_change(modified_layer_rect.translated(layer.location()));
|
||||
}
|
||||
|
@ -443,7 +443,7 @@ void Image::layer_did_modify_properties(Badge<Layer>, Layer const& layer)
|
|||
{
|
||||
auto layer_index = index_of(layer);
|
||||
for (auto* client : m_clients)
|
||||
client->image_did_modify_layer(layer_index);
|
||||
client->image_did_modify_layer_properties(layer_index);
|
||||
|
||||
did_change();
|
||||
}
|
||||
|
|
|
@ -26,7 +26,8 @@ class ImageClient {
|
|||
public:
|
||||
virtual void image_did_add_layer(size_t) { }
|
||||
virtual void image_did_remove_layer(size_t) { }
|
||||
virtual void image_did_modify_layer(size_t) { }
|
||||
virtual void image_did_modify_layer_properties(size_t) { }
|
||||
virtual void image_did_modify_layer_bitmap(size_t) { }
|
||||
virtual void image_did_modify_layer_stack() { }
|
||||
virtual void image_did_change(Gfx::IntRect const&) { }
|
||||
virtual void image_select_layer(Layer*) { }
|
||||
|
|
|
@ -231,11 +231,20 @@ void LayerListWidget::image_did_remove_layer(size_t layer_index)
|
|||
relayout_gadgets();
|
||||
}
|
||||
|
||||
void LayerListWidget::image_did_modify_layer(size_t layer_index)
|
||||
void LayerListWidget::image_did_modify_layer_properties(size_t layer_index)
|
||||
{
|
||||
update(m_gadgets[layer_index].rect);
|
||||
}
|
||||
|
||||
void LayerListWidget::image_did_modify_layer_bitmap(size_t layer_index)
|
||||
{
|
||||
Gfx::IntRect adjusted_rect;
|
||||
Gfx::IntRect thumbnail_rect;
|
||||
Gfx::IntRect text_rect;
|
||||
get_gadget_rects(m_gadgets[layer_index], adjusted_rect, thumbnail_rect, text_rect);
|
||||
update(thumbnail_rect);
|
||||
}
|
||||
|
||||
void LayerListWidget::image_did_modify_layer_stack()
|
||||
{
|
||||
rebuild_gadgets();
|
||||
|
|
|
@ -41,7 +41,8 @@ private:
|
|||
|
||||
virtual void image_did_add_layer(size_t) override;
|
||||
virtual void image_did_remove_layer(size_t) override;
|
||||
virtual void image_did_modify_layer(size_t) override;
|
||||
virtual void image_did_modify_layer_properties(size_t) override;
|
||||
virtual void image_did_modify_layer_bitmap(size_t) override;
|
||||
virtual void image_did_modify_layer_stack() override;
|
||||
|
||||
void rebuild_gadgets();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue