mirror of
https://github.com/RGBCube/serenity
synced 2025-07-24 23:07:34 +00:00
LibGfx: Rename 32-bit BitmapFormats to BGRA8888 and BGRx888x
The previous names (RGBA32 and RGB32) were misleading since that's not the actual byte order in memory. The new names reflect exactly how the color values get laid out in bitmap data.
This commit is contained in:
parent
0bfdf95af6
commit
e0f32626bc
31 changed files with 70 additions and 70 deletions
|
@ -116,7 +116,7 @@ void MonitorWidget::paint_event(GUI::PaintEvent& event)
|
||||||
// Render text label scaled with scale factor to hint at its effect.
|
// Render text label scaled with scale factor to hint at its effect.
|
||||||
// FIXME: Once bitmaps have intrinsic scale factors, we could create a bitmap with an intrinsic scale factor of m_desktop_scale_factor
|
// FIXME: Once bitmaps have intrinsic scale factors, we could create a bitmap with an intrinsic scale factor of m_desktop_scale_factor
|
||||||
// and that should give us the same effect with less code.
|
// and that should give us the same effect with less code.
|
||||||
auto text_bitmap = Gfx::Bitmap::create(Gfx::BitmapFormat::RGBA32, Gfx::IntSize { painter.font().width(displayed_resolution_string) + 1, painter.font().glyph_height() + 1 });
|
auto text_bitmap = Gfx::Bitmap::create(Gfx::BitmapFormat::BGRA8888, Gfx::IntSize { painter.font().width(displayed_resolution_string) + 1, painter.font().glyph_height() + 1 });
|
||||||
GUI::Painter text_painter(*text_bitmap);
|
GUI::Painter text_painter(*text_bitmap);
|
||||||
text_painter.set_font(painter.font());
|
text_painter.set_font(painter.font());
|
||||||
|
|
||||||
|
|
|
@ -141,7 +141,7 @@ void Image::save(const String& file_path) const
|
||||||
|
|
||||||
void Image::export_bmp(const String& file_path)
|
void Image::export_bmp(const String& file_path)
|
||||||
{
|
{
|
||||||
auto bitmap = Gfx::Bitmap::create(Gfx::BitmapFormat::RGB32, m_size);
|
auto bitmap = Gfx::Bitmap::create(Gfx::BitmapFormat::BGRx8888, m_size);
|
||||||
GUI::Painter painter(*bitmap);
|
GUI::Painter painter(*bitmap);
|
||||||
paint_into(painter, { 0, 0, m_size.width(), m_size.height() });
|
paint_into(painter, { 0, 0, m_size.width(), m_size.height() });
|
||||||
|
|
||||||
|
@ -154,7 +154,7 @@ void Image::export_bmp(const String& file_path)
|
||||||
|
|
||||||
void Image::export_png(const String& file_path)
|
void Image::export_png(const String& file_path)
|
||||||
{
|
{
|
||||||
auto bitmap = Gfx::Bitmap::create(Gfx::BitmapFormat::RGBA32, m_size);
|
auto bitmap = Gfx::Bitmap::create(Gfx::BitmapFormat::BGRA8888, m_size);
|
||||||
GUI::Painter painter(*bitmap);
|
GUI::Painter painter(*bitmap);
|
||||||
paint_into(painter, { 0, 0, m_size.width(), m_size.height() });
|
paint_into(painter, { 0, 0, m_size.width(), m_size.height() });
|
||||||
|
|
||||||
|
|
|
@ -66,7 +66,7 @@ Layer::Layer(Image& image, const Gfx::IntSize& size, const String& name)
|
||||||
: m_image(image)
|
: m_image(image)
|
||||||
, m_name(name)
|
, m_name(name)
|
||||||
{
|
{
|
||||||
m_bitmap = Gfx::Bitmap::create(Gfx::BitmapFormat::RGBA32, size);
|
m_bitmap = Gfx::Bitmap::create(Gfx::BitmapFormat::BGRA8888, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
Layer::Layer(Image& image, const Gfx::Bitmap& bitmap, const String& name)
|
Layer::Layer(Image& image, const Gfx::Bitmap& bitmap, const String& name)
|
||||||
|
|
|
@ -80,7 +80,7 @@ private:
|
||||||
|
|
||||||
Cube::Cube()
|
Cube::Cube()
|
||||||
{
|
{
|
||||||
m_bitmap = Gfx::Bitmap::create(Gfx::BitmapFormat::RGB32, { WIDTH, HEIGHT });
|
m_bitmap = Gfx::Bitmap::create(Gfx::BitmapFormat::BGRx8888, { WIDTH, HEIGHT });
|
||||||
|
|
||||||
m_accumulated_time = 0;
|
m_accumulated_time = 0;
|
||||||
m_cycles = 0;
|
m_cycles = 0;
|
||||||
|
|
|
@ -53,7 +53,7 @@ private:
|
||||||
|
|
||||||
Canvas::Canvas()
|
Canvas::Canvas()
|
||||||
{
|
{
|
||||||
m_bitmap = Gfx::Bitmap::create(Gfx::BitmapFormat::RGB32, { WIDTH, HEIGHT });
|
m_bitmap = Gfx::Bitmap::create(Gfx::BitmapFormat::BGRx8888, { WIDTH, HEIGHT });
|
||||||
draw();
|
draw();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -58,15 +58,15 @@ private:
|
||||||
|
|
||||||
Canvas::Canvas()
|
Canvas::Canvas()
|
||||||
{
|
{
|
||||||
m_bitmap_1x = Gfx::Bitmap::create(Gfx::BitmapFormat::RGB32, { WIDTH, HEIGHT }, 1);
|
m_bitmap_1x = Gfx::Bitmap::create(Gfx::BitmapFormat::BGRx8888, { WIDTH, HEIGHT }, 1);
|
||||||
m_bitmap_2x = Gfx::Bitmap::create(Gfx::BitmapFormat::RGB32, { WIDTH, HEIGHT }, 2);
|
m_bitmap_2x = Gfx::Bitmap::create(Gfx::BitmapFormat::BGRx8888, { WIDTH, HEIGHT }, 2);
|
||||||
|
|
||||||
// m_bitmap_1x and m_bitmap_2x have the same logical size, so LibGfx will try to draw them at the same physical size:
|
// m_bitmap_1x and m_bitmap_2x have the same logical size, so LibGfx will try to draw them at the same physical size:
|
||||||
// When drawing on a 2x backing store it'd scale m_bitmap_1x up 2x and paint m_bitmap_2x at its physical size.
|
// When drawing on a 2x backing store it'd scale m_bitmap_1x up 2x and paint m_bitmap_2x at its physical size.
|
||||||
// When drawing on a 1x backing store it'd draw m_bitmap_1x at its physical size, and it would have to scale down m_bitmap_2x to 0.5x its size.
|
// When drawing on a 1x backing store it'd draw m_bitmap_1x at its physical size, and it would have to scale down m_bitmap_2x to 0.5x its size.
|
||||||
// But the system can't current scale down, and we want to draw the 2x bitmap at twice the size of the 1x bitmap in this particular application,
|
// But the system can't current scale down, and we want to draw the 2x bitmap at twice the size of the 1x bitmap in this particular application,
|
||||||
// so make a 1x alias of the 2x bitmap to make LibGfx paint it without any scaling at paint time, mapping once pixel to one pixel.
|
// so make a 1x alias of the 2x bitmap to make LibGfx paint it without any scaling at paint time, mapping once pixel to one pixel.
|
||||||
m_bitmap_2x_as_1x = Gfx::Bitmap::create_wrapper(Gfx::BitmapFormat::RGB32, m_bitmap_2x->physical_size(), 1, m_bitmap_2x->pitch(), m_bitmap_2x->scanline(0));
|
m_bitmap_2x_as_1x = Gfx::Bitmap::create_wrapper(Gfx::BitmapFormat::BGRx8888, m_bitmap_2x->physical_size(), 1, m_bitmap_2x->pitch(), m_bitmap_2x->scanline(0));
|
||||||
|
|
||||||
Gfx::Painter painter_1x(*m_bitmap_1x);
|
Gfx::Painter painter_1x(*m_bitmap_1x);
|
||||||
draw(painter_1x);
|
draw(painter_1x);
|
||||||
|
|
|
@ -54,7 +54,7 @@ private:
|
||||||
|
|
||||||
Screensaver::Screensaver(int width, int height, int interval)
|
Screensaver::Screensaver(int width, int height, int interval)
|
||||||
{
|
{
|
||||||
m_bitmap = Gfx::Bitmap::create(Gfx::BitmapFormat::RGB32, { width, height });
|
m_bitmap = Gfx::Bitmap::create(Gfx::BitmapFormat::BGRx8888, { width, height });
|
||||||
srand(time(nullptr));
|
srand(time(nullptr));
|
||||||
stop_timer();
|
stop_timer();
|
||||||
start_timer(interval);
|
start_timer(interval);
|
||||||
|
|
|
@ -38,7 +38,7 @@ static const Gfx::Bitmap& heat_gradient()
|
||||||
{
|
{
|
||||||
static RefPtr<Gfx::Bitmap> bitmap;
|
static RefPtr<Gfx::Bitmap> bitmap;
|
||||||
if (!bitmap) {
|
if (!bitmap) {
|
||||||
bitmap = Gfx::Bitmap::create(Gfx::BitmapFormat::RGB32, { 101, 1 });
|
bitmap = Gfx::Bitmap::create(Gfx::BitmapFormat::BGRx8888, { 101, 1 });
|
||||||
GUI::Painter painter(*bitmap);
|
GUI::Painter painter(*bitmap);
|
||||||
painter.fill_rect_with_gradient(Orientation::Horizontal, bitmap->rect(), Color::from_rgb(0xffc080), Color::from_rgb(0xff3000));
|
painter.fill_rect_with_gradient(Orientation::Horizontal, bitmap->rect(), Color::from_rgb(0xffc080), Color::from_rgb(0xff3000));
|
||||||
}
|
}
|
||||||
|
|
|
@ -81,7 +81,7 @@ static RefPtr<Gfx::Bitmap> s_background;
|
||||||
|
|
||||||
Card::Card(Type type, uint8_t value)
|
Card::Card(Type type, uint8_t value)
|
||||||
: m_rect(Gfx::IntRect({}, { width, height }))
|
: m_rect(Gfx::IntRect({}, { width, height }))
|
||||||
, m_front(*Gfx::Bitmap::create(Gfx::BitmapFormat::RGB32, { width, height }))
|
, m_front(*Gfx::Bitmap::create(Gfx::BitmapFormat::BGRx8888, { width, height }))
|
||||||
, m_type(type)
|
, m_type(type)
|
||||||
, m_value(value)
|
, m_value(value)
|
||||||
{
|
{
|
||||||
|
@ -89,7 +89,7 @@ Card::Card(Type type, uint8_t value)
|
||||||
Gfx::IntRect paint_rect({ 0, 0 }, { width, height });
|
Gfx::IntRect paint_rect({ 0, 0 }, { width, height });
|
||||||
|
|
||||||
if (s_background.is_null()) {
|
if (s_background.is_null()) {
|
||||||
s_background = Gfx::Bitmap::create(Gfx::BitmapFormat::RGB32, { width, height });
|
s_background = Gfx::Bitmap::create(Gfx::BitmapFormat::BGRx8888, { width, height });
|
||||||
Gfx::Painter bg_painter(*s_background);
|
Gfx::Painter bg_painter(*s_background);
|
||||||
|
|
||||||
s_background->fill(Color::White);
|
s_background->fill(Color::White);
|
||||||
|
|
|
@ -133,7 +133,7 @@ RefPtr<Gfx::Bitmap> Clipboard::bitmap() const
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
auto clipping_bitmap = Gfx::Bitmap::create_wrapper((Gfx::BitmapFormat)format.value(), { (int)width.value(), (int)height.value() }, scale.value(), pitch.value(), clipping.data.data());
|
auto clipping_bitmap = Gfx::Bitmap::create_wrapper((Gfx::BitmapFormat)format.value(), { (int)width.value(), (int)height.value() }, scale.value(), pitch.value(), clipping.data.data());
|
||||||
auto bitmap = Gfx::Bitmap::create(Gfx::BitmapFormat::RGBA32, { (int)width.value(), (int)height.value() }, scale.value());
|
auto bitmap = Gfx::Bitmap::create(Gfx::BitmapFormat::BGRA8888, { (int)width.value(), (int)height.value() }, scale.value());
|
||||||
|
|
||||||
for (int y = 0; y < clipping_bitmap->physical_height(); ++y) {
|
for (int y = 0; y < clipping_bitmap->physical_height(); ++y) {
|
||||||
for (int x = 0; x < clipping_bitmap->physical_width(); ++x) {
|
for (int x = 0; x < clipping_bitmap->physical_width(); ++x) {
|
||||||
|
|
|
@ -479,7 +479,7 @@ ColorField::ColorField(Color color)
|
||||||
|
|
||||||
void ColorField::create_color_bitmap()
|
void ColorField::create_color_bitmap()
|
||||||
{
|
{
|
||||||
m_color_bitmap = Gfx::Bitmap::create(Gfx::BitmapFormat::RGB32, { 256, 256 });
|
m_color_bitmap = Gfx::Bitmap::create(Gfx::BitmapFormat::BGRx8888, { 256, 256 });
|
||||||
auto painter = Gfx::Painter(*m_color_bitmap);
|
auto painter = Gfx::Painter(*m_color_bitmap);
|
||||||
|
|
||||||
Gfx::HSV hsv;
|
Gfx::HSV hsv;
|
||||||
|
@ -605,7 +605,7 @@ void ColorField::resize_event(ResizeEvent&)
|
||||||
ColorSlider::ColorSlider(double value)
|
ColorSlider::ColorSlider(double value)
|
||||||
: m_value(value)
|
: m_value(value)
|
||||||
{
|
{
|
||||||
m_color_bitmap = Gfx::Bitmap::create(Gfx::BitmapFormat::RGB32, { 32, 360 });
|
m_color_bitmap = Gfx::Bitmap::create(Gfx::BitmapFormat::BGRx8888, { 32, 360 });
|
||||||
auto painter = Gfx::Painter(*m_color_bitmap);
|
auto painter = Gfx::Painter(*m_color_bitmap);
|
||||||
|
|
||||||
for (int h = 0; h < 360; h++) {
|
for (int h = 0; h < 360; h++) {
|
||||||
|
|
|
@ -497,7 +497,7 @@ static RefPtr<Gfx::Bitmap> render_thumbnail(const StringView& path)
|
||||||
|
|
||||||
double scale = min(32 / (double)png_bitmap->width(), 32 / (double)png_bitmap->height());
|
double scale = min(32 / (double)png_bitmap->width(), 32 / (double)png_bitmap->height());
|
||||||
|
|
||||||
auto thumbnail = Gfx::Bitmap::create(Gfx::BitmapFormat::RGBA32, { 32, 32 });
|
auto thumbnail = Gfx::Bitmap::create(Gfx::BitmapFormat::BGRA8888, { 32, 32 });
|
||||||
Gfx::IntRect destination = Gfx::IntRect(0, 0, (int)(png_bitmap->width() * scale), (int)(png_bitmap->height() * scale));
|
Gfx::IntRect destination = Gfx::IntRect(0, 0, (int)(png_bitmap->width() * scale), (int)(png_bitmap->height() * scale));
|
||||||
destination.center_within(thumbnail->rect());
|
destination.center_within(thumbnail->rect());
|
||||||
|
|
||||||
|
|
|
@ -757,7 +757,7 @@ void Window::flip(const Vector<Gfx::IntRect, 32>& dirty_rects)
|
||||||
|
|
||||||
OwnPtr<WindowBackingStore> Window::create_backing_store(const Gfx::IntSize& size)
|
OwnPtr<WindowBackingStore> Window::create_backing_store(const Gfx::IntSize& size)
|
||||||
{
|
{
|
||||||
auto format = m_has_alpha_channel ? Gfx::BitmapFormat::RGBA32 : Gfx::BitmapFormat::RGB32;
|
auto format = m_has_alpha_channel ? Gfx::BitmapFormat::BGRA8888 : Gfx::BitmapFormat::BGRx8888;
|
||||||
|
|
||||||
VERIFY(!size.is_empty());
|
VERIFY(!size.is_empty());
|
||||||
size_t pitch = Gfx::Bitmap::minimum_pitch(size.width(), format);
|
size_t pitch = Gfx::Bitmap::minimum_pitch(size.width(), format);
|
||||||
|
@ -793,7 +793,7 @@ void Window::set_icon(const Gfx::Bitmap* icon)
|
||||||
|
|
||||||
Gfx::IntSize icon_size = icon ? icon->size() : Gfx::IntSize(16, 16);
|
Gfx::IntSize icon_size = icon ? icon->size() : Gfx::IntSize(16, 16);
|
||||||
|
|
||||||
m_icon = Gfx::Bitmap::create(Gfx::BitmapFormat::RGBA32, icon_size);
|
m_icon = Gfx::Bitmap::create(Gfx::BitmapFormat::BGRA8888, icon_size);
|
||||||
VERIFY(m_icon);
|
VERIFY(m_icon);
|
||||||
if (icon) {
|
if (icon) {
|
||||||
Painter painter(*m_icon);
|
Painter painter(*m_icon);
|
||||||
|
|
|
@ -1186,12 +1186,12 @@ static bool decode_bmp_pixel_data(BMPLoadingContext& context)
|
||||||
return BitmapFormat::Indexed8;
|
return BitmapFormat::Indexed8;
|
||||||
case 16:
|
case 16:
|
||||||
if (context.dib.info.masks.size() == 4)
|
if (context.dib.info.masks.size() == 4)
|
||||||
return BitmapFormat::RGBA32;
|
return BitmapFormat::BGRA8888;
|
||||||
return BitmapFormat::RGB32;
|
return BitmapFormat::BGRx8888;
|
||||||
case 24:
|
case 24:
|
||||||
return BitmapFormat::RGB32;
|
return BitmapFormat::BGRx8888;
|
||||||
case 32:
|
case 32:
|
||||||
return BitmapFormat::RGBA32;
|
return BitmapFormat::BGRA8888;
|
||||||
default:
|
default:
|
||||||
return BitmapFormat::Invalid;
|
return BitmapFormat::Invalid;
|
||||||
}
|
}
|
||||||
|
|
|
@ -248,7 +248,7 @@ RefPtr<Bitmap> Bitmap::create_with_anon_fd(BitmapFormat format, int anon_fd, con
|
||||||
/// - scale_factor
|
/// - scale_factor
|
||||||
/// - format
|
/// - format
|
||||||
/// - palette count
|
/// - palette count
|
||||||
/// - palette data (= palette count * RGBA32)
|
/// - palette data (= palette count * BGRA8888)
|
||||||
/// - image data (= actual size * u8)
|
/// - image data (= actual size * u8)
|
||||||
RefPtr<Bitmap> Bitmap::create_from_serialized_byte_buffer(ByteBuffer&& buffer)
|
RefPtr<Bitmap> Bitmap::create_from_serialized_byte_buffer(ByteBuffer&& buffer)
|
||||||
{
|
{
|
||||||
|
@ -270,7 +270,7 @@ RefPtr<Bitmap> Bitmap::create_from_serialized_byte_buffer(ByteBuffer&& buffer)
|
||||||
if (!read(actual_size) || !read(width) || !read(height) || !read(scale_factor) || !read(format) || !read(palette_size))
|
if (!read(actual_size) || !read(width) || !read(height) || !read(scale_factor) || !read(format) || !read(palette_size))
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
if (format > BitmapFormat::RGBA32 || format < BitmapFormat::Indexed1)
|
if (format > BitmapFormat::BGRA8888 || format < BitmapFormat::Indexed1)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
if (!check_size({ width, height }, scale_factor, format, actual_size))
|
if (!check_size({ width, height }, scale_factor, format, actual_size))
|
||||||
|
|
|
@ -52,8 +52,8 @@ enum class BitmapFormat {
|
||||||
Indexed2,
|
Indexed2,
|
||||||
Indexed4,
|
Indexed4,
|
||||||
Indexed8,
|
Indexed8,
|
||||||
RGB32,
|
BGRx8888,
|
||||||
RGBA32,
|
BGRA8888,
|
||||||
};
|
};
|
||||||
|
|
||||||
inline bool is_valid_bitmap_format(unsigned format)
|
inline bool is_valid_bitmap_format(unsigned format)
|
||||||
|
@ -64,8 +64,8 @@ inline bool is_valid_bitmap_format(unsigned format)
|
||||||
case (unsigned)BitmapFormat::Indexed2:
|
case (unsigned)BitmapFormat::Indexed2:
|
||||||
case (unsigned)BitmapFormat::Indexed4:
|
case (unsigned)BitmapFormat::Indexed4:
|
||||||
case (unsigned)BitmapFormat::Indexed8:
|
case (unsigned)BitmapFormat::Indexed8:
|
||||||
case (unsigned)BitmapFormat::RGB32:
|
case (unsigned)BitmapFormat::BGRx8888:
|
||||||
case (unsigned)BitmapFormat::RGBA32:
|
case (unsigned)BitmapFormat::BGRA8888:
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -80,9 +80,9 @@ enum class StorageFormat {
|
||||||
static StorageFormat determine_storage_format(BitmapFormat format)
|
static StorageFormat determine_storage_format(BitmapFormat format)
|
||||||
{
|
{
|
||||||
switch (format) {
|
switch (format) {
|
||||||
case BitmapFormat::RGB32:
|
case BitmapFormat::BGRx8888:
|
||||||
return StorageFormat::RGB32;
|
return StorageFormat::RGB32;
|
||||||
case BitmapFormat::RGBA32:
|
case BitmapFormat::BGRA8888:
|
||||||
return StorageFormat::RGBA32;
|
return StorageFormat::RGBA32;
|
||||||
case BitmapFormat::Indexed1:
|
case BitmapFormat::Indexed1:
|
||||||
case BitmapFormat::Indexed2:
|
case BitmapFormat::Indexed2:
|
||||||
|
@ -194,8 +194,8 @@ public:
|
||||||
return 4;
|
return 4;
|
||||||
case BitmapFormat::Indexed8:
|
case BitmapFormat::Indexed8:
|
||||||
return 8;
|
return 8;
|
||||||
case BitmapFormat::RGB32:
|
case BitmapFormat::BGRx8888:
|
||||||
case BitmapFormat::RGBA32:
|
case BitmapFormat::BGRA8888:
|
||||||
return 32;
|
return 32;
|
||||||
default:
|
default:
|
||||||
VERIFY_NOT_REACHED();
|
VERIFY_NOT_REACHED();
|
||||||
|
@ -213,7 +213,7 @@ public:
|
||||||
|
|
||||||
void fill(Color);
|
void fill(Color);
|
||||||
|
|
||||||
bool has_alpha_channel() const { return m_format == BitmapFormat::RGBA32; }
|
bool has_alpha_channel() const { return m_format == BitmapFormat::BGRA8888; }
|
||||||
BitmapFormat format() const { return m_format; }
|
BitmapFormat format() const { return m_format; }
|
||||||
|
|
||||||
void set_mmap_name(const StringView&);
|
void set_mmap_name(const StringView&);
|
||||||
|
|
|
@ -318,10 +318,10 @@ static bool decode_frame(GIFLoadingContext& context, size_t frame_index)
|
||||||
size_t start_frame = context.current_frame + 1;
|
size_t start_frame = context.current_frame + 1;
|
||||||
if (context.state < GIFLoadingContext::State::FrameComplete) {
|
if (context.state < GIFLoadingContext::State::FrameComplete) {
|
||||||
start_frame = 0;
|
start_frame = 0;
|
||||||
context.frame_buffer = Bitmap::create_purgeable(BitmapFormat::RGBA32, { context.logical_screen.width, context.logical_screen.height });
|
context.frame_buffer = Bitmap::create_purgeable(BitmapFormat::BGRA8888, { context.logical_screen.width, context.logical_screen.height });
|
||||||
if (!context.frame_buffer)
|
if (!context.frame_buffer)
|
||||||
return false;
|
return false;
|
||||||
context.prev_frame_buffer = Bitmap::create_purgeable(BitmapFormat::RGBA32, { context.logical_screen.width, context.logical_screen.height });
|
context.prev_frame_buffer = Bitmap::create_purgeable(BitmapFormat::BGRA8888, { context.logical_screen.width, context.logical_screen.height });
|
||||||
if (!context.prev_frame_buffer)
|
if (!context.prev_frame_buffer)
|
||||||
return false;
|
return false;
|
||||||
} else if (frame_index < context.current_frame) {
|
} else if (frame_index < context.current_frame) {
|
||||||
|
|
|
@ -288,7 +288,7 @@ static bool load_ico_bmp(ICOLoadingContext& context, ImageDescriptor& desc)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
desc.bitmap = Bitmap::create_purgeable(BitmapFormat::RGBA32, { desc.width, desc.height });
|
desc.bitmap = Bitmap::create_purgeable(BitmapFormat::BGRA8888, { desc.width, desc.height });
|
||||||
if (!desc.bitmap)
|
if (!desc.bitmap)
|
||||||
return false;
|
return false;
|
||||||
Bitmap& bitmap = *desc.bitmap;
|
Bitmap& bitmap = *desc.bitmap;
|
||||||
|
|
|
@ -1083,7 +1083,7 @@ static void ycbcr_to_rgb(const JPGLoadingContext& context, Vector<Macroblock>& m
|
||||||
|
|
||||||
static bool compose_bitmap(JPGLoadingContext& context, const Vector<Macroblock>& macroblocks)
|
static bool compose_bitmap(JPGLoadingContext& context, const Vector<Macroblock>& macroblocks)
|
||||||
{
|
{
|
||||||
context.bitmap = Bitmap::create_purgeable(BitmapFormat::RGB32, { context.frame.width, context.frame.height });
|
context.bitmap = Bitmap::create_purgeable(BitmapFormat::BGRx8888, { context.frame.width, context.frame.height });
|
||||||
if (!context.bitmap)
|
if (!context.bitmap)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
|
|
@ -630,7 +630,7 @@ static bool decode_png_bitmap_simple(PNGLoadingContext& context)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
context.bitmap = Bitmap::create_purgeable(context.has_alpha() ? BitmapFormat::RGBA32 : BitmapFormat::RGB32, { context.width, context.height });
|
context.bitmap = Bitmap::create_purgeable(context.has_alpha() ? BitmapFormat::BGRA8888 : BitmapFormat::BGRx8888, { context.width, context.height });
|
||||||
|
|
||||||
if (!context.bitmap) {
|
if (!context.bitmap) {
|
||||||
context.state = PNGLoadingContext::State::Error;
|
context.state = PNGLoadingContext::State::Error;
|
||||||
|
@ -750,7 +750,7 @@ static bool decode_adam7_pass(PNGLoadingContext& context, Streamer& streamer, in
|
||||||
static bool decode_png_adam7(PNGLoadingContext& context)
|
static bool decode_png_adam7(PNGLoadingContext& context)
|
||||||
{
|
{
|
||||||
Streamer streamer(context.decompression_buffer.data(), context.decompression_buffer.size());
|
Streamer streamer(context.decompression_buffer.data(), context.decompression_buffer.size());
|
||||||
context.bitmap = Bitmap::create_purgeable(context.has_alpha() ? BitmapFormat::RGBA32 : BitmapFormat::RGB32, { context.width, context.height });
|
context.bitmap = Bitmap::create_purgeable(context.has_alpha() ? BitmapFormat::BGRA8888 : BitmapFormat::BGRx8888, { context.width, context.height });
|
||||||
if (!context.bitmap)
|
if (!context.bitmap)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
|
|
@ -62,9 +62,9 @@ ALWAYS_INLINE Color get_pixel(const Gfx::Bitmap& bitmap, int x, int y)
|
||||||
return bitmap.palette_color(bitmap.scanline_u8(y)[x]);
|
return bitmap.palette_color(bitmap.scanline_u8(y)[x]);
|
||||||
if constexpr (format == BitmapFormat::Indexed1)
|
if constexpr (format == BitmapFormat::Indexed1)
|
||||||
return bitmap.palette_color(bitmap.scanline_u8(y)[x]);
|
return bitmap.palette_color(bitmap.scanline_u8(y)[x]);
|
||||||
if constexpr (format == BitmapFormat::RGB32)
|
if constexpr (format == BitmapFormat::BGRx8888)
|
||||||
return Color::from_rgb(bitmap.scanline(y)[x]);
|
return Color::from_rgb(bitmap.scanline(y)[x]);
|
||||||
if constexpr (format == BitmapFormat::RGBA32)
|
if constexpr (format == BitmapFormat::BGRA8888)
|
||||||
return Color::from_rgba(bitmap.scanline(y)[x]);
|
return Color::from_rgba(bitmap.scanline(y)[x]);
|
||||||
return bitmap.get_pixel(x, y);
|
return bitmap.get_pixel(x, y);
|
||||||
}
|
}
|
||||||
|
@ -73,7 +73,7 @@ Painter::Painter(Gfx::Bitmap& bitmap)
|
||||||
: m_target(bitmap)
|
: m_target(bitmap)
|
||||||
{
|
{
|
||||||
int scale = bitmap.scale();
|
int scale = bitmap.scale();
|
||||||
VERIFY(bitmap.format() == Gfx::BitmapFormat::RGB32 || bitmap.format() == Gfx::BitmapFormat::RGBA32);
|
VERIFY(bitmap.format() == Gfx::BitmapFormat::BGRx8888 || bitmap.format() == Gfx::BitmapFormat::BGRA8888);
|
||||||
VERIFY(bitmap.physical_width() % scale == 0);
|
VERIFY(bitmap.physical_width() % scale == 0);
|
||||||
VERIFY(bitmap.physical_height() % scale == 0);
|
VERIFY(bitmap.physical_height() % scale == 0);
|
||||||
m_state_stack.append(State());
|
m_state_stack.append(State());
|
||||||
|
@ -687,7 +687,7 @@ void Painter::draw_tiled_bitmap(const IntRect& a_dst_rect, const Gfx::Bitmap& so
|
||||||
RGBA32* dst = m_target->scanline(clipped_rect.y()) + clipped_rect.x();
|
RGBA32* dst = m_target->scanline(clipped_rect.y()) + clipped_rect.x();
|
||||||
const size_t dst_skip = m_target->pitch() / sizeof(RGBA32);
|
const size_t dst_skip = m_target->pitch() / sizeof(RGBA32);
|
||||||
|
|
||||||
if (source.format() == BitmapFormat::RGB32 || source.format() == BitmapFormat::RGBA32) {
|
if (source.format() == BitmapFormat::BGRx8888 || source.format() == BitmapFormat::BGRA8888) {
|
||||||
int s = scale / source.scale();
|
int s = scale / source.scale();
|
||||||
if (s == 1) {
|
if (s == 1) {
|
||||||
int x_start = first_column + a_dst_rect.left() * scale;
|
int x_start = first_column + a_dst_rect.left() * scale;
|
||||||
|
@ -759,7 +759,7 @@ void Painter::blit(const IntPoint& position, const Gfx::Bitmap& source, const In
|
||||||
RGBA32* dst = m_target->scanline(clipped_rect.y()) + clipped_rect.x();
|
RGBA32* dst = m_target->scanline(clipped_rect.y()) + clipped_rect.x();
|
||||||
const size_t dst_skip = m_target->pitch() / sizeof(RGBA32);
|
const size_t dst_skip = m_target->pitch() / sizeof(RGBA32);
|
||||||
|
|
||||||
if (source.format() == BitmapFormat::RGB32 || source.format() == BitmapFormat::RGBA32) {
|
if (source.format() == BitmapFormat::BGRx8888 || source.format() == BitmapFormat::BGRA8888) {
|
||||||
const RGBA32* src = source.scanline(src_rect.top() + first_row) + src_rect.left() + first_column;
|
const RGBA32* src = source.scanline(src_rect.top() + first_row) + src_rect.left() + first_column;
|
||||||
const size_t src_skip = source.pitch() / sizeof(RGBA32);
|
const size_t src_skip = source.pitch() / sizeof(RGBA32);
|
||||||
for (int row = first_row; row <= last_row; ++row) {
|
for (int row = first_row; row <= last_row; ++row) {
|
||||||
|
@ -866,11 +866,11 @@ void Painter::draw_scaled_bitmap(const IntRect& a_dst_rect, const Gfx::Bitmap& s
|
||||||
|
|
||||||
if (source.has_alpha_channel() || opacity != 1.0f) {
|
if (source.has_alpha_channel() || opacity != 1.0f) {
|
||||||
switch (source.format()) {
|
switch (source.format()) {
|
||||||
case BitmapFormat::RGB32:
|
case BitmapFormat::BGRx8888:
|
||||||
do_draw_scaled_bitmap<true>(*m_target, dst_rect, clipped_rect, source, src_rect, get_pixel<BitmapFormat::RGB32>, opacity);
|
do_draw_scaled_bitmap<true>(*m_target, dst_rect, clipped_rect, source, src_rect, get_pixel<BitmapFormat::BGRx8888>, opacity);
|
||||||
break;
|
break;
|
||||||
case BitmapFormat::RGBA32:
|
case BitmapFormat::BGRA8888:
|
||||||
do_draw_scaled_bitmap<true>(*m_target, dst_rect, clipped_rect, source, src_rect, get_pixel<BitmapFormat::RGBA32>, opacity);
|
do_draw_scaled_bitmap<true>(*m_target, dst_rect, clipped_rect, source, src_rect, get_pixel<BitmapFormat::BGRA8888>, opacity);
|
||||||
break;
|
break;
|
||||||
case BitmapFormat::Indexed8:
|
case BitmapFormat::Indexed8:
|
||||||
do_draw_scaled_bitmap<true>(*m_target, dst_rect, clipped_rect, source, src_rect, get_pixel<BitmapFormat::Indexed8>, opacity);
|
do_draw_scaled_bitmap<true>(*m_target, dst_rect, clipped_rect, source, src_rect, get_pixel<BitmapFormat::Indexed8>, opacity);
|
||||||
|
@ -890,8 +890,8 @@ void Painter::draw_scaled_bitmap(const IntRect& a_dst_rect, const Gfx::Bitmap& s
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
switch (source.format()) {
|
switch (source.format()) {
|
||||||
case BitmapFormat::RGB32:
|
case BitmapFormat::BGRx8888:
|
||||||
do_draw_scaled_bitmap<false>(*m_target, dst_rect, clipped_rect, source, src_rect, get_pixel<BitmapFormat::RGB32>, opacity);
|
do_draw_scaled_bitmap<false>(*m_target, dst_rect, clipped_rect, source, src_rect, get_pixel<BitmapFormat::BGRx8888>, opacity);
|
||||||
break;
|
break;
|
||||||
case BitmapFormat::Indexed8:
|
case BitmapFormat::Indexed8:
|
||||||
do_draw_scaled_bitmap<false>(*m_target, dst_rect, clipped_rect, source, src_rect, get_pixel<BitmapFormat::Indexed8>, opacity);
|
do_draw_scaled_bitmap<false>(*m_target, dst_rect, clipped_rect, source, src_rect, get_pixel<BitmapFormat::Indexed8>, opacity);
|
||||||
|
|
|
@ -198,7 +198,7 @@ static bool read_max_val(TContext& context, Streamer& streamer)
|
||||||
template<typename TContext>
|
template<typename TContext>
|
||||||
static bool create_bitmap(TContext& context)
|
static bool create_bitmap(TContext& context)
|
||||||
{
|
{
|
||||||
context.bitmap = Bitmap::create_purgeable(BitmapFormat::RGB32, { context.width, context.height });
|
context.bitmap = Bitmap::create_purgeable(BitmapFormat::BGRx8888, { context.width, context.height });
|
||||||
if (!context.bitmap) {
|
if (!context.bitmap) {
|
||||||
context.state = TContext::State::Error;
|
context.state = TContext::State::Error;
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -227,7 +227,7 @@ void Rasterizer::draw_path(Gfx::Path& path)
|
||||||
|
|
||||||
RefPtr<Gfx::Bitmap> Rasterizer::accumulate()
|
RefPtr<Gfx::Bitmap> Rasterizer::accumulate()
|
||||||
{
|
{
|
||||||
auto bitmap = Gfx::Bitmap::create(Gfx::BitmapFormat::RGBA32, m_size);
|
auto bitmap = Gfx::Bitmap::create(Gfx::BitmapFormat::BGRA8888, m_size);
|
||||||
Color base_color = Color::from_rgb(0xffffff);
|
Color base_color = Color::from_rgb(0xffffff);
|
||||||
for (int y = 0; y < m_size.height(); y++) {
|
for (int y = 0; y < m_size.height(); y++) {
|
||||||
float accumulator = 0.0;
|
float accumulator = 0.0;
|
||||||
|
|
|
@ -98,7 +98,7 @@ bool HTMLCanvasElement::create_bitmap()
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!m_bitmap || m_bitmap->size() != size)
|
if (!m_bitmap || m_bitmap->size() != size)
|
||||||
m_bitmap = Gfx::Bitmap::create(Gfx::BitmapFormat::RGBA32, size);
|
m_bitmap = Gfx::Bitmap::create(Gfx::BitmapFormat::BGRA8888, size);
|
||||||
return m_bitmap;
|
return m_bitmap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -46,7 +46,7 @@ RefPtr<ImageData> ImageData::create_with_size(JS::GlobalObject& global_object, i
|
||||||
|
|
||||||
auto data_handle = JS::make_handle(data);
|
auto data_handle = JS::make_handle(data);
|
||||||
|
|
||||||
auto bitmap = Gfx::Bitmap::create_wrapper(Gfx::BitmapFormat::RGBA32, Gfx::IntSize(width, height), 1, width * sizeof(u32), (u32*)data->data());
|
auto bitmap = Gfx::Bitmap::create_wrapper(Gfx::BitmapFormat::BGRA8888, Gfx::IntSize(width, height), 1, width * sizeof(u32), (u32*)data->data());
|
||||||
if (!bitmap)
|
if (!bitmap)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
return adopt(*new ImageData(bitmap.release_nonnull(), move(data_handle)));
|
return adopt(*new ImageData(bitmap.release_nonnull(), move(data_handle)));
|
||||||
|
|
|
@ -160,13 +160,13 @@ void OutOfProcessWebView::handle_resize()
|
||||||
if (available_size().is_empty())
|
if (available_size().is_empty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (auto new_bitmap = Gfx::Bitmap::create_shareable(Gfx::BitmapFormat::RGB32, available_size())) {
|
if (auto new_bitmap = Gfx::Bitmap::create_shareable(Gfx::BitmapFormat::BGRx8888, available_size())) {
|
||||||
m_client_state.front_bitmap = move(new_bitmap);
|
m_client_state.front_bitmap = move(new_bitmap);
|
||||||
m_client_state.front_bitmap_id = m_client_state.next_bitmap_id++;
|
m_client_state.front_bitmap_id = m_client_state.next_bitmap_id++;
|
||||||
client().post_message(Messages::WebContentServer::AddBackingStore(m_client_state.front_bitmap_id, m_client_state.front_bitmap->to_shareable_bitmap()));
|
client().post_message(Messages::WebContentServer::AddBackingStore(m_client_state.front_bitmap_id, m_client_state.front_bitmap->to_shareable_bitmap()));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (auto new_bitmap = Gfx::Bitmap::create_shareable(Gfx::BitmapFormat::RGB32, available_size())) {
|
if (auto new_bitmap = Gfx::Bitmap::create_shareable(Gfx::BitmapFormat::BGRx8888, available_size())) {
|
||||||
m_client_state.back_bitmap = move(new_bitmap);
|
m_client_state.back_bitmap = move(new_bitmap);
|
||||||
m_client_state.back_bitmap_id = m_client_state.next_bitmap_id++;
|
m_client_state.back_bitmap_id = m_client_state.next_bitmap_id++;
|
||||||
client().post_message(Messages::WebContentServer::AddBackingStore(m_client_state.back_bitmap_id, m_client_state.back_bitmap->to_shareable_bitmap()));
|
client().post_message(Messages::WebContentServer::AddBackingStore(m_client_state.back_bitmap_id, m_client_state.back_bitmap->to_shareable_bitmap()));
|
||||||
|
|
|
@ -64,8 +64,8 @@ static const char* bpp_for_format_resilient(String format)
|
||||||
return "4";
|
return "4";
|
||||||
case Gfx::BitmapFormat::Indexed8:
|
case Gfx::BitmapFormat::Indexed8:
|
||||||
return "8";
|
return "8";
|
||||||
case Gfx::BitmapFormat::RGB32:
|
case Gfx::BitmapFormat::BGRx8888:
|
||||||
case Gfx::BitmapFormat::RGBA32:
|
case Gfx::BitmapFormat::BGRA8888:
|
||||||
return "32";
|
return "32";
|
||||||
case Gfx::BitmapFormat::Invalid:
|
case Gfx::BitmapFormat::Invalid:
|
||||||
/* fall-through */
|
/* fall-through */
|
||||||
|
|
|
@ -623,7 +623,7 @@ OwnPtr<Messages::WindowServer::SetWindowBackingStoreResponse> ClientConnection::
|
||||||
} else {
|
} else {
|
||||||
// FIXME: Plumb scale factor here eventually.
|
// FIXME: Plumb scale factor here eventually.
|
||||||
auto backing_store = Gfx::Bitmap::create_with_anon_fd(
|
auto backing_store = Gfx::Bitmap::create_with_anon_fd(
|
||||||
message.has_alpha_channel() ? Gfx::BitmapFormat::RGBA32 : Gfx::BitmapFormat::RGB32,
|
message.has_alpha_channel() ? Gfx::BitmapFormat::BGRA8888 : Gfx::BitmapFormat::BGRx8888,
|
||||||
message.anon_file().take_fd(),
|
message.anon_file().take_fd(),
|
||||||
message.size(),
|
message.size(),
|
||||||
1,
|
1,
|
||||||
|
|
|
@ -92,16 +92,16 @@ void Compositor::init_bitmaps()
|
||||||
auto& screen = Screen::the();
|
auto& screen = Screen::the();
|
||||||
auto size = screen.size();
|
auto size = screen.size();
|
||||||
|
|
||||||
m_front_bitmap = Gfx::Bitmap::create_wrapper(Gfx::BitmapFormat::RGB32, size, screen.scale_factor(), screen.pitch(), screen.scanline(0));
|
m_front_bitmap = Gfx::Bitmap::create_wrapper(Gfx::BitmapFormat::BGRx8888, size, screen.scale_factor(), screen.pitch(), screen.scanline(0));
|
||||||
m_front_painter = make<Gfx::Painter>(*m_front_bitmap);
|
m_front_painter = make<Gfx::Painter>(*m_front_bitmap);
|
||||||
|
|
||||||
if (m_screen_can_set_buffer)
|
if (m_screen_can_set_buffer)
|
||||||
m_back_bitmap = Gfx::Bitmap::create_wrapper(Gfx::BitmapFormat::RGB32, size, screen.scale_factor(), screen.pitch(), screen.scanline(screen.physical_height()));
|
m_back_bitmap = Gfx::Bitmap::create_wrapper(Gfx::BitmapFormat::BGRx8888, size, screen.scale_factor(), screen.pitch(), screen.scanline(screen.physical_height()));
|
||||||
else
|
else
|
||||||
m_back_bitmap = Gfx::Bitmap::create(Gfx::BitmapFormat::RGB32, size, screen.scale_factor());
|
m_back_bitmap = Gfx::Bitmap::create(Gfx::BitmapFormat::BGRx8888, size, screen.scale_factor());
|
||||||
m_back_painter = make<Gfx::Painter>(*m_back_bitmap);
|
m_back_painter = make<Gfx::Painter>(*m_back_bitmap);
|
||||||
|
|
||||||
m_temp_bitmap = Gfx::Bitmap::create(Gfx::BitmapFormat::RGB32, size, screen.scale_factor());
|
m_temp_bitmap = Gfx::Bitmap::create(Gfx::BitmapFormat::BGRx8888, size, screen.scale_factor());
|
||||||
m_temp_painter = make<Gfx::Painter>(*m_temp_bitmap);
|
m_temp_painter = make<Gfx::Painter>(*m_temp_bitmap);
|
||||||
|
|
||||||
m_buffers_are_flipped = false;
|
m_buffers_are_flipped = false;
|
||||||
|
@ -803,7 +803,7 @@ void Compositor::draw_cursor(const Gfx::IntRect& cursor_rect)
|
||||||
auto& wm = WindowManager::the();
|
auto& wm = WindowManager::the();
|
||||||
|
|
||||||
if (!m_cursor_back_bitmap || m_cursor_back_bitmap->size() != cursor_rect.size() || m_cursor_back_bitmap->scale() != Screen::the().scale_factor()) {
|
if (!m_cursor_back_bitmap || m_cursor_back_bitmap->size() != cursor_rect.size() || m_cursor_back_bitmap->scale() != Screen::the().scale_factor()) {
|
||||||
m_cursor_back_bitmap = Gfx::Bitmap::create(Gfx::BitmapFormat::RGB32, cursor_rect.size(), Screen::the().scale_factor());
|
m_cursor_back_bitmap = Gfx::Bitmap::create(Gfx::BitmapFormat::BGRx8888, cursor_rect.size(), Screen::the().scale_factor());
|
||||||
m_cursor_back_painter = make<Gfx::Painter>(*m_cursor_back_bitmap);
|
m_cursor_back_painter = make<Gfx::Painter>(*m_cursor_back_bitmap);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -159,7 +159,7 @@ void Window::set_rect(const Gfx::IntRect& rect)
|
||||||
auto old_rect = m_rect;
|
auto old_rect = m_rect;
|
||||||
m_rect = rect;
|
m_rect = rect;
|
||||||
if (!m_client && (!m_backing_store || old_rect.size() != rect.size())) {
|
if (!m_client && (!m_backing_store || old_rect.size() != rect.size())) {
|
||||||
m_backing_store = Gfx::Bitmap::create(Gfx::BitmapFormat::RGB32, m_rect.size());
|
m_backing_store = Gfx::Bitmap::create(Gfx::BitmapFormat::BGRx8888, m_rect.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
invalidate(true, old_rect.size() != rect.size());
|
invalidate(true, old_rect.size() != rect.size());
|
||||||
|
|
|
@ -227,7 +227,7 @@ bool WindowFrame::frame_has_alpha() const
|
||||||
{
|
{
|
||||||
if (m_has_alpha_channel)
|
if (m_has_alpha_channel)
|
||||||
return true;
|
return true;
|
||||||
if (auto* shadow_bitmap = window_shadow(); shadow_bitmap && shadow_bitmap->format() == Gfx::BitmapFormat::RGBA32)
|
if (auto* shadow_bitmap = window_shadow(); shadow_bitmap && shadow_bitmap->format() == Gfx::BitmapFormat::BGRA8888)
|
||||||
return true;
|
return true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -388,7 +388,7 @@ void WindowFrame::render_to_cache()
|
||||||
if (!s_tmp_bitmap || !s_tmp_bitmap->size().contains(total_frame_rect.size()) || s_tmp_bitmap->scale() != scale) {
|
if (!s_tmp_bitmap || !s_tmp_bitmap->size().contains(total_frame_rect.size()) || s_tmp_bitmap->scale() != scale) {
|
||||||
if (s_tmp_bitmap)
|
if (s_tmp_bitmap)
|
||||||
s_tmp_bitmap->unref();
|
s_tmp_bitmap->unref();
|
||||||
s_tmp_bitmap = Gfx::Bitmap::create(Gfx::BitmapFormat::RGBA32, total_frame_rect.size(), scale).leak_ref();
|
s_tmp_bitmap = Gfx::Bitmap::create(Gfx::BitmapFormat::BGRA8888, total_frame_rect.size(), scale).leak_ref();
|
||||||
}
|
}
|
||||||
|
|
||||||
auto top_bottom_height = total_frame_rect.height() - window_rect.height();
|
auto top_bottom_height = total_frame_rect.height() - window_rect.height();
|
||||||
|
@ -396,14 +396,14 @@ void WindowFrame::render_to_cache()
|
||||||
|
|
||||||
if (!m_top_bottom || m_top_bottom->width() != total_frame_rect.width() || m_top_bottom->height() != top_bottom_height || m_top_bottom->scale() != scale) {
|
if (!m_top_bottom || m_top_bottom->width() != total_frame_rect.width() || m_top_bottom->height() != top_bottom_height || m_top_bottom->scale() != scale) {
|
||||||
if (top_bottom_height > 0)
|
if (top_bottom_height > 0)
|
||||||
m_top_bottom = Gfx::Bitmap::create(Gfx::BitmapFormat::RGBA32, { total_frame_rect.width(), top_bottom_height }, scale);
|
m_top_bottom = Gfx::Bitmap::create(Gfx::BitmapFormat::BGRA8888, { total_frame_rect.width(), top_bottom_height }, scale);
|
||||||
else
|
else
|
||||||
m_top_bottom = nullptr;
|
m_top_bottom = nullptr;
|
||||||
m_shadow_dirty = true;
|
m_shadow_dirty = true;
|
||||||
}
|
}
|
||||||
if (!m_left_right || m_left_right->height() != total_frame_rect.height() || m_left_right->width() != left_right_width || m_left_right->scale() != scale) {
|
if (!m_left_right || m_left_right->height() != total_frame_rect.height() || m_left_right->width() != left_right_width || m_left_right->scale() != scale) {
|
||||||
if (left_right_width > 0)
|
if (left_right_width > 0)
|
||||||
m_left_right = Gfx::Bitmap::create(Gfx::BitmapFormat::RGBA32, { left_right_width, total_frame_rect.height() }, scale);
|
m_left_right = Gfx::Bitmap::create(Gfx::BitmapFormat::BGRA8888, { left_right_width, total_frame_rect.height() }, scale);
|
||||||
else
|
else
|
||||||
m_left_right = nullptr;
|
m_left_right = nullptr;
|
||||||
m_shadow_dirty = true;
|
m_shadow_dirty = true;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue