mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 11:08:11 +00:00
Introduce LibCore and move GElapsedTimer => CElapsedTimer.
I need a layer somewhere between AK (usable both by userspace and kernel) and LibGUI (usable by userspace except WindowServer.) So here's LibCore.
This commit is contained in:
parent
a74f3615ac
commit
5e0577a042
21 changed files with 98 additions and 37 deletions
|
@ -238,6 +238,33 @@ void Painter::blit_with_opacity(const Point& position, const GraphicsBitmap& sou
|
|||
}
|
||||
}
|
||||
|
||||
void Painter::blit_dimmed(const Point& position, const GraphicsBitmap& source, const Rect& src_rect)
|
||||
{
|
||||
Rect safe_src_rect = Rect::intersection(src_rect, source.rect());
|
||||
Rect dst_rect(position, safe_src_rect.size());
|
||||
dst_rect.move_by(state().translation);
|
||||
auto clipped_rect = Rect::intersection(dst_rect, clip_rect());
|
||||
if (clipped_rect.is_empty())
|
||||
return;
|
||||
const int first_row = clipped_rect.top() - dst_rect.top();
|
||||
const int last_row = clipped_rect.bottom() - dst_rect.top();
|
||||
const int first_column = clipped_rect.left() - dst_rect.left();
|
||||
const int last_column = clipped_rect.right() - dst_rect.left();
|
||||
RGBA32* dst = m_target->scanline(clipped_rect.y()) + clipped_rect.x();
|
||||
const RGBA32* src = source.scanline(src_rect.top() + first_row) + src_rect.left() + first_column;
|
||||
const size_t dst_skip = m_target->width();
|
||||
const unsigned src_skip = source.width();
|
||||
|
||||
for (int row = first_row; row <= last_row; ++row) {
|
||||
for (int x = 0; x <= (last_column - first_column); ++x) {
|
||||
dst[x] = Color::from_rgba(src[x]).to_grayscale().darkened().value();
|
||||
}
|
||||
dst += dst_skip;
|
||||
src += src_skip;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Painter::blit_with_alpha(const Point& position, const GraphicsBitmap& source, const Rect& src_rect)
|
||||
{
|
||||
ASSERT(source.has_alpha_channel());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue