mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 06:47:35 +00:00
WindowServer: Clang-Format
This commit is contained in:
parent
29a9430246
commit
c72953cf06
3 changed files with 61 additions and 37 deletions
|
@ -248,7 +248,8 @@ bool WSCompositor::set_wallpaper(const String& path, Function<void(bool)>&& call
|
|||
});
|
||||
exit_thread(0);
|
||||
return 0;
|
||||
}, context.leak_ptr());
|
||||
},
|
||||
context.leak_ptr());
|
||||
ASSERT(rc == 0);
|
||||
|
||||
return true;
|
||||
|
@ -351,8 +352,7 @@ void WSCompositor::draw_menubar()
|
|||
menu.name(),
|
||||
index == 1 ? wm.app_menu_font() : wm.menu_font(),
|
||||
TextAlignment::CenterLeft,
|
||||
text_color
|
||||
);
|
||||
text_color);
|
||||
++index;
|
||||
return true;
|
||||
});
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
#include "Painter.h"
|
||||
#include "Font.h"
|
||||
#include "GraphicsBitmap.h"
|
||||
#include <SharedGraphics/CharacterBitmap.h>
|
||||
#include <AK/Assertions.h>
|
||||
#include <AK/StdLibExtras.h>
|
||||
#include <AK/StringBuilder.h>
|
||||
#include <unistd.h>
|
||||
#include <stdio.h>
|
||||
#include <SharedGraphics/CharacterBitmap.h>
|
||||
#include <math.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#pragma GCC optimize("O3")
|
||||
|
||||
|
@ -104,8 +104,8 @@ void Painter::fill_rect_with_gradient(const Rect& a_rect, Color gradient_start,
|
|||
dst[j] = Color(
|
||||
r1 / 255.0 * c + r2 / 255.0 * (255 - c),
|
||||
g1 / 255.0 * c + g2 / 255.0 * (255 - c),
|
||||
b1 / 255.0 * c + b2 / 255.0 * (255 - c)
|
||||
).value();
|
||||
b1 / 255.0 * c + b2 / 255.0 * (255 - c))
|
||||
.value();
|
||||
c += increment;
|
||||
}
|
||||
dst += dst_skip;
|
||||
|
@ -483,17 +483,33 @@ void Painter::draw_scaled_bitmap(const Rect& a_dst_rect, const GraphicsBitmap& s
|
|||
|
||||
if (source.has_alpha_channel()) {
|
||||
switch (source.format()) {
|
||||
case GraphicsBitmap::Format::RGB32: do_draw_scaled_bitmap<true>(*m_target, dst_rect, clipped_rect, source, src_rect, hscale, vscale, get_pixel<GraphicsBitmap::Format::RGB32>); break;
|
||||
case GraphicsBitmap::Format::RGBA32: do_draw_scaled_bitmap<true>(*m_target, dst_rect, clipped_rect, source, src_rect, hscale, vscale, get_pixel<GraphicsBitmap::Format::RGB32>); break;
|
||||
case GraphicsBitmap::Format::Indexed8: do_draw_scaled_bitmap<true>(*m_target, dst_rect, clipped_rect, source, src_rect, hscale, vscale, get_pixel<GraphicsBitmap::Format::Indexed8>); break;
|
||||
default: do_draw_scaled_bitmap<true>(*m_target, dst_rect, clipped_rect, source, src_rect, hscale, vscale, get_pixel<GraphicsBitmap::Format::Invalid>); break;
|
||||
case GraphicsBitmap::Format::RGB32:
|
||||
do_draw_scaled_bitmap<true>(*m_target, dst_rect, clipped_rect, source, src_rect, hscale, vscale, get_pixel<GraphicsBitmap::Format::RGB32>);
|
||||
break;
|
||||
case GraphicsBitmap::Format::RGBA32:
|
||||
do_draw_scaled_bitmap<true>(*m_target, dst_rect, clipped_rect, source, src_rect, hscale, vscale, get_pixel<GraphicsBitmap::Format::RGB32>);
|
||||
break;
|
||||
case GraphicsBitmap::Format::Indexed8:
|
||||
do_draw_scaled_bitmap<true>(*m_target, dst_rect, clipped_rect, source, src_rect, hscale, vscale, get_pixel<GraphicsBitmap::Format::Indexed8>);
|
||||
break;
|
||||
default:
|
||||
do_draw_scaled_bitmap<true>(*m_target, dst_rect, clipped_rect, source, src_rect, hscale, vscale, get_pixel<GraphicsBitmap::Format::Invalid>);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
switch (source.format()) {
|
||||
case GraphicsBitmap::Format::RGB32: do_draw_scaled_bitmap<false>(*m_target, dst_rect, clipped_rect, source, src_rect, hscale, vscale, get_pixel<GraphicsBitmap::Format::RGB32>); break;
|
||||
case GraphicsBitmap::Format::RGBA32: do_draw_scaled_bitmap<false>(*m_target, dst_rect, clipped_rect, source, src_rect, hscale, vscale, get_pixel<GraphicsBitmap::Format::RGB32>); break;
|
||||
case GraphicsBitmap::Format::Indexed8: do_draw_scaled_bitmap<false>(*m_target, dst_rect, clipped_rect, source, src_rect, hscale, vscale, get_pixel<GraphicsBitmap::Format::Indexed8>); break;
|
||||
default: do_draw_scaled_bitmap<false>(*m_target, dst_rect, clipped_rect, source, src_rect, hscale, vscale, get_pixel<GraphicsBitmap::Format::Invalid>); break;
|
||||
case GraphicsBitmap::Format::RGB32:
|
||||
do_draw_scaled_bitmap<false>(*m_target, dst_rect, clipped_rect, source, src_rect, hscale, vscale, get_pixel<GraphicsBitmap::Format::RGB32>);
|
||||
break;
|
||||
case GraphicsBitmap::Format::RGBA32:
|
||||
do_draw_scaled_bitmap<false>(*m_target, dst_rect, clipped_rect, source, src_rect, hscale, vscale, get_pixel<GraphicsBitmap::Format::RGB32>);
|
||||
break;
|
||||
case GraphicsBitmap::Format::Indexed8:
|
||||
do_draw_scaled_bitmap<false>(*m_target, dst_rect, clipped_rect, source, src_rect, hscale, vscale, get_pixel<GraphicsBitmap::Format::Indexed8>);
|
||||
break;
|
||||
default:
|
||||
do_draw_scaled_bitmap<false>(*m_target, dst_rect, clipped_rect, source, src_rect, hscale, vscale, get_pixel<GraphicsBitmap::Format::Invalid>);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,9 +4,9 @@
|
|||
#include "Point.h"
|
||||
#include "Rect.h"
|
||||
#include "Size.h"
|
||||
#include <AK/AKString.h>
|
||||
#include <SharedGraphics/TextAlignment.h>
|
||||
#include <SharedGraphics/TextElision.h>
|
||||
#include <AK/AKString.h>
|
||||
|
||||
class CharacterBitmap;
|
||||
class GlyphBitmap;
|
||||
|
@ -38,7 +38,11 @@ public:
|
|||
const Font& font() const { return *state().font; }
|
||||
void set_font(const Font& font) { state().font = &font; }
|
||||
|
||||
enum class DrawOp { Copy, Xor };
|
||||
enum class DrawOp
|
||||
{
|
||||
Copy,
|
||||
Xor
|
||||
};
|
||||
void set_draw_op(DrawOp op) { state().draw_op = op; }
|
||||
DrawOp draw_op() const { return state().draw_op; }
|
||||
|
||||
|
@ -54,7 +58,11 @@ public:
|
|||
GraphicsBitmap* target() { return m_target.ptr(); }
|
||||
|
||||
void save() { m_state_stack.append(m_state_stack.last()); }
|
||||
void restore() { ASSERT(m_state_stack.size() > 1); m_state_stack.take_last(); }
|
||||
void restore()
|
||||
{
|
||||
ASSERT(m_state_stack.size() > 1);
|
||||
m_state_stack.take_last();
|
||||
}
|
||||
|
||||
protected:
|
||||
void set_pixel_with_draw_op(dword& pixel, const Color&);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue