mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 19:47:44 +00:00
PixelPaint: BrushTool performance optimization
This patch optimizes how the Brush-Tool modifies the pixels. The new logic generates a "reference brush" with the required size, falloff and color only once and uses that for the rawing operations. If no editing mask is used the reference brush is writen via a blit operation to the content or mask image. This increases the drawing speed and therefore also allows bigger brush sizes.
This commit is contained in:
parent
31ee20e179
commit
b9b4ca064f
3 changed files with 62 additions and 8 deletions
|
@ -91,7 +91,10 @@ void Tool::set_pixel_with_possible_mask<Gfx::StorageFormat::BGRA8888>(int x, int
|
|||
|
||||
switch (m_editor->active_layer()->edit_mode()) {
|
||||
case Layer::EditMode::Content:
|
||||
bitmap.set_pixel<Gfx::StorageFormat::BGRA8888>(x, y, m_editor->active_layer()->modify_pixel_with_editing_mask(x, y, color, bitmap.get_pixel(x, y)));
|
||||
if (m_editor->active_layer()->mask_type() == Layer::MaskType::EditingMask)
|
||||
bitmap.set_pixel<Gfx::StorageFormat::BGRA8888>(x, y, m_editor->active_layer()->modify_pixel_with_editing_mask(x, y, color, bitmap.get_pixel(x, y)));
|
||||
else
|
||||
bitmap.set_pixel(x, y, color);
|
||||
break;
|
||||
case Layer::EditMode::Mask:
|
||||
bitmap.set_pixel<Gfx::StorageFormat::BGRA8888>(x, y, color);
|
||||
|
@ -106,7 +109,10 @@ void Tool::set_pixel_with_possible_mask(int x, int y, Gfx::Color color, Gfx::Bit
|
|||
|
||||
switch (m_editor->active_layer()->edit_mode()) {
|
||||
case Layer::EditMode::Content:
|
||||
bitmap.set_pixel(x, y, m_editor->active_layer()->modify_pixel_with_editing_mask(x, y, color, bitmap.get_pixel(x, y)));
|
||||
if (m_editor->active_layer()->mask_type() == Layer::MaskType::EditingMask)
|
||||
bitmap.set_pixel(x, y, m_editor->active_layer()->modify_pixel_with_editing_mask(x, y, color, bitmap.get_pixel(x, y)));
|
||||
else
|
||||
bitmap.set_pixel(x, y, color);
|
||||
break;
|
||||
case Layer::EditMode::Mask:
|
||||
bitmap.set_pixel(x, y, color);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue