mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 22:27:35 +00:00
Everywhere: Rename ASSERT => VERIFY
(...and ASSERT_NOT_REACHED => VERIFY_NOT_REACHED) Since all of these checks are done in release builds as well, let's rename them to VERIFY to prevent confusion, as everyone is used to assertions being compiled out in release. We can introduce a new ASSERT macro that is specifically for debug checks, but I'm doing this wholesale conversion first since we've accumulated thousands of these already, and it's not immediately obvious which ones are suitable for ASSERT.
This commit is contained in:
parent
b33a6a443e
commit
5d180d1f99
725 changed files with 3448 additions and 3448 deletions
|
@ -180,7 +180,7 @@ struct BMPLoadingContext {
|
|||
return 124;
|
||||
}
|
||||
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -215,7 +215,7 @@ public:
|
|||
|
||||
u8 read_u8()
|
||||
{
|
||||
ASSERT(m_size_remaining >= 1);
|
||||
VERIFY(m_size_remaining >= 1);
|
||||
m_size_remaining--;
|
||||
return *(m_data_ptr++);
|
||||
}
|
||||
|
@ -242,7 +242,7 @@ public:
|
|||
|
||||
void drop_bytes(u8 num_bytes)
|
||||
{
|
||||
ASSERT(m_size_remaining >= num_bytes);
|
||||
VERIFY(m_size_remaining >= num_bytes);
|
||||
m_size_remaining -= num_bytes;
|
||||
m_data_ptr += num_bytes;
|
||||
}
|
||||
|
@ -355,7 +355,7 @@ static void populate_dib_mask_info_if_needed(BMPLoadingContext& context)
|
|||
if (!mask_shifts.is_empty() && !mask_sizes.is_empty())
|
||||
return;
|
||||
|
||||
ASSERT(mask_shifts.is_empty() && mask_sizes.is_empty());
|
||||
VERIFY(mask_shifts.is_empty() && mask_sizes.is_empty());
|
||||
|
||||
mask_shifts.ensure_capacity(masks.size());
|
||||
mask_sizes.ensure_capacity(masks.size());
|
||||
|
@ -896,7 +896,7 @@ static bool decode_bmp_color_table(BMPLoadingContext& context)
|
|||
|
||||
auto bytes_per_color = context.dib_type == DIBType::Core ? 3 : 4;
|
||||
u32 max_colors = 1 << context.dib.core.bpp;
|
||||
ASSERT(context.data_offset >= bmp_header_size + context.dib_size());
|
||||
VERIFY(context.data_offset >= bmp_header_size + context.dib_size());
|
||||
auto size_of_color_table = context.data_offset - bmp_header_size - context.dib_size();
|
||||
|
||||
if (context.dib_type <= DIBType::OSV2) {
|
||||
|
@ -1161,7 +1161,7 @@ static bool uncompress_bmp_rle_data(BMPLoadingContext& context, ByteBuffer& buff
|
|||
}
|
||||
}
|
||||
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
static bool decode_bmp_pixel_data(BMPLoadingContext& context)
|
||||
|
@ -1302,7 +1302,7 @@ static bool decode_bmp_pixel_data(BMPLoadingContext& context)
|
|||
case 3:
|
||||
return 1;
|
||||
}
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
}();
|
||||
if (streamer.remaining() < bytes_to_drop)
|
||||
return false;
|
||||
|
@ -1377,7 +1377,7 @@ RefPtr<Gfx::Bitmap> BMPImageDecoderPlugin::bitmap()
|
|||
if (m_context->state < BMPLoadingContext::State::PixelDataDecoded && !decode_bmp_pixel_data(*m_context))
|
||||
return nullptr;
|
||||
|
||||
ASSERT(m_context->bitmap);
|
||||
VERIFY(m_context->bitmap);
|
||||
return m_context->bitmap;
|
||||
}
|
||||
|
||||
|
|
|
@ -95,7 +95,7 @@ static ByteBuffer compress_pixel_data(const ByteBuffer& pixel_data, BMPWriter::C
|
|||
return pixel_data;
|
||||
}
|
||||
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
ByteBuffer BMPWriter::dump(const RefPtr<Bitmap> bitmap)
|
||||
|
|
|
@ -69,7 +69,7 @@ size_t Bitmap::minimum_pitch(size_t physical_width, BitmapFormat format)
|
|||
element_size = 4;
|
||||
break;
|
||||
default:
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
return physical_width * element_size;
|
||||
|
@ -127,10 +127,10 @@ Bitmap::Bitmap(BitmapFormat format, const IntSize& size, int scale_factor, Purge
|
|||
, m_format(format)
|
||||
, m_purgeable(purgeable == Purgeable::Yes)
|
||||
{
|
||||
ASSERT(!m_size.is_empty());
|
||||
ASSERT(!size_would_overflow(format, size, scale_factor));
|
||||
ASSERT(m_data);
|
||||
ASSERT(backing_store.size_in_bytes == size_in_bytes());
|
||||
VERIFY(!m_size.is_empty());
|
||||
VERIFY(!size_would_overflow(format, size, scale_factor));
|
||||
VERIFY(m_data);
|
||||
VERIFY(backing_store.size_in_bytes == size_in_bytes());
|
||||
allocate_palette_from_format(format, {});
|
||||
m_needs_munmap = true;
|
||||
}
|
||||
|
@ -160,8 +160,8 @@ RefPtr<Bitmap> Bitmap::load_from_file(const StringView& path, int scale_factor)
|
|||
ENUMERATE_IMAGE_FORMATS
|
||||
#undef __ENUMERATE_IMAGE_FORMAT
|
||||
if (bmp) {
|
||||
ASSERT(bmp->width() % scale_factor == 0);
|
||||
ASSERT(bmp->height() % scale_factor == 0);
|
||||
VERIFY(bmp->width() % scale_factor == 0);
|
||||
VERIFY(bmp->height() % scale_factor == 0);
|
||||
bmp->m_size.set_width(bmp->width() / scale_factor);
|
||||
bmp->m_size.set_height(bmp->height() / scale_factor);
|
||||
bmp->m_scale = scale_factor;
|
||||
|
@ -185,8 +185,8 @@ Bitmap::Bitmap(BitmapFormat format, const IntSize& size, int scale_factor, size_
|
|||
, m_pitch(pitch)
|
||||
, m_format(format)
|
||||
{
|
||||
ASSERT(pitch >= minimum_pitch(size.width() * scale_factor, format));
|
||||
ASSERT(!size_would_overflow(format, size, scale_factor));
|
||||
VERIFY(pitch >= minimum_pitch(size.width() * scale_factor, format));
|
||||
VERIFY(!size_would_overflow(format, size, scale_factor));
|
||||
// FIXME: assert that `data` is actually long enough!
|
||||
|
||||
allocate_palette_from_format(format, {});
|
||||
|
@ -220,7 +220,7 @@ RefPtr<Bitmap> Bitmap::create_with_anon_fd(BitmapFormat format, int anon_fd, con
|
|||
ScopeGuard close_guard = [&] {
|
||||
if (should_close_anon_fd == ShouldCloseAnonymousFile::Yes) {
|
||||
int rc = close(anon_fd);
|
||||
ASSERT(rc == 0);
|
||||
VERIFY(rc == 0);
|
||||
anon_fd = -1;
|
||||
}
|
||||
};
|
||||
|
@ -321,7 +321,7 @@ ByteBuffer Bitmap::serialize_to_byte_buffer() const
|
|||
}
|
||||
|
||||
auto size = size_in_bytes();
|
||||
ASSERT(stream.remaining() == size);
|
||||
VERIFY(stream.remaining() == size);
|
||||
if (stream.write({ scanline(0), size }) != size)
|
||||
return {};
|
||||
|
||||
|
@ -338,8 +338,8 @@ Bitmap::Bitmap(BitmapFormat format, int anon_fd, const IntSize& size, int scale_
|
|||
, m_purgeable(true)
|
||||
, m_anon_fd(anon_fd)
|
||||
{
|
||||
ASSERT(!is_indexed() || !palette.is_empty());
|
||||
ASSERT(!size_would_overflow(format, size, scale_factor));
|
||||
VERIFY(!is_indexed() || !palette.is_empty());
|
||||
VERIFY(!size_would_overflow(format, size, scale_factor));
|
||||
|
||||
if (is_indexed(m_format))
|
||||
allocate_palette_from_format(m_format, palette);
|
||||
|
@ -358,7 +358,7 @@ RefPtr<Gfx::Bitmap> Bitmap::clone() const
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
ASSERT(size_in_bytes() == new_bitmap->size_in_bytes());
|
||||
VERIFY(size_in_bytes() == new_bitmap->size_in_bytes());
|
||||
memcpy(new_bitmap->scanline(0), scanline(0), size_in_bytes());
|
||||
|
||||
return new_bitmap;
|
||||
|
@ -428,11 +428,11 @@ Bitmap::~Bitmap()
|
|||
{
|
||||
if (m_needs_munmap) {
|
||||
int rc = munmap(m_data, size_in_bytes());
|
||||
ASSERT(rc == 0);
|
||||
VERIFY(rc == 0);
|
||||
}
|
||||
if (m_anon_fd != -1) {
|
||||
int rc = close(m_anon_fd);
|
||||
ASSERT(rc == 0);
|
||||
VERIFY(rc == 0);
|
||||
}
|
||||
m_data = nullptr;
|
||||
delete[] m_palette;
|
||||
|
@ -440,7 +440,7 @@ Bitmap::~Bitmap()
|
|||
|
||||
void Bitmap::set_mmap_name([[maybe_unused]] const StringView& name)
|
||||
{
|
||||
ASSERT(m_needs_munmap);
|
||||
VERIFY(m_needs_munmap);
|
||||
#ifdef __serenity__
|
||||
::set_mmap_name(m_data, size_in_bytes(), name.to_string().characters());
|
||||
#endif
|
||||
|
@ -448,7 +448,7 @@ void Bitmap::set_mmap_name([[maybe_unused]] const StringView& name)
|
|||
|
||||
void Bitmap::fill(Color color)
|
||||
{
|
||||
ASSERT(!is_indexed(m_format));
|
||||
VERIFY(!is_indexed(m_format));
|
||||
for (int y = 0; y < physical_height(); ++y) {
|
||||
auto* scanline = this->scanline(y);
|
||||
fast_u32_fill(scanline, color.value(), physical_width());
|
||||
|
@ -457,14 +457,14 @@ void Bitmap::fill(Color color)
|
|||
|
||||
void Bitmap::set_volatile()
|
||||
{
|
||||
ASSERT(m_purgeable);
|
||||
VERIFY(m_purgeable);
|
||||
if (m_volatile)
|
||||
return;
|
||||
#ifdef __serenity__
|
||||
int rc = madvise(m_data, size_in_bytes(), MADV_SET_VOLATILE);
|
||||
if (rc < 0) {
|
||||
perror("madvise(MADV_SET_VOLATILE)");
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
#endif
|
||||
m_volatile = true;
|
||||
|
@ -472,14 +472,14 @@ void Bitmap::set_volatile()
|
|||
|
||||
[[nodiscard]] bool Bitmap::set_nonvolatile()
|
||||
{
|
||||
ASSERT(m_purgeable);
|
||||
VERIFY(m_purgeable);
|
||||
if (!m_volatile)
|
||||
return true;
|
||||
#ifdef __serenity__
|
||||
int rc = madvise(m_data, size_in_bytes(), MADV_SET_NONVOLATILE);
|
||||
if (rc < 0) {
|
||||
perror("madvise(MADV_SET_NONVOLATILE)");
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
#else
|
||||
int rc = 0;
|
||||
|
@ -528,7 +528,7 @@ void Bitmap::allocate_palette_from_format(BitmapFormat format, const Vector<RGBA
|
|||
return;
|
||||
m_palette = new RGBA32[size];
|
||||
if (!source_palette.is_empty()) {
|
||||
ASSERT(source_palette.size() == size);
|
||||
VERIFY(source_palette.size() == size);
|
||||
memcpy(m_palette, source_palette.data(), size * sizeof(RGBA32));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -90,7 +90,7 @@ static StorageFormat determine_storage_format(BitmapFormat format)
|
|||
case BitmapFormat::Indexed8:
|
||||
return StorageFormat::Indexed8;
|
||||
default:
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -198,7 +198,7 @@ public:
|
|||
case BitmapFormat::RGBA32:
|
||||
return 32;
|
||||
default:
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
case BitmapFormat::Invalid:
|
||||
return 0;
|
||||
}
|
||||
|
@ -274,13 +274,13 @@ private:
|
|||
|
||||
inline u8* Bitmap::scanline_u8(int y)
|
||||
{
|
||||
ASSERT(y >= 0 && y < physical_height());
|
||||
VERIFY(y >= 0 && y < physical_height());
|
||||
return reinterpret_cast<u8*>(m_data) + (y * m_pitch);
|
||||
}
|
||||
|
||||
inline const u8* Bitmap::scanline_u8(int y) const
|
||||
{
|
||||
ASSERT(y >= 0 && y < physical_height());
|
||||
VERIFY(y >= 0 && y < physical_height());
|
||||
return reinterpret_cast<const u8*>(m_data) + (y * m_pitch);
|
||||
}
|
||||
|
||||
|
@ -297,21 +297,21 @@ inline const RGBA32* Bitmap::scanline(int y) const
|
|||
template<>
|
||||
inline Color Bitmap::get_pixel<StorageFormat::RGB32>(int x, int y) const
|
||||
{
|
||||
ASSERT(x >= 0 && x < physical_width());
|
||||
VERIFY(x >= 0 && x < physical_width());
|
||||
return Color::from_rgb(scanline(y)[x]);
|
||||
}
|
||||
|
||||
template<>
|
||||
inline Color Bitmap::get_pixel<StorageFormat::RGBA32>(int x, int y) const
|
||||
{
|
||||
ASSERT(x >= 0 && x < physical_width());
|
||||
VERIFY(x >= 0 && x < physical_width());
|
||||
return Color::from_rgba(scanline(y)[x]);
|
||||
}
|
||||
|
||||
template<>
|
||||
inline Color Bitmap::get_pixel<StorageFormat::Indexed8>(int x, int y) const
|
||||
{
|
||||
ASSERT(x >= 0 && x < physical_width());
|
||||
VERIFY(x >= 0 && x < physical_width());
|
||||
return Color::from_rgb(m_palette[scanline_u8(y)[x]]);
|
||||
}
|
||||
|
||||
|
@ -325,20 +325,20 @@ inline Color Bitmap::get_pixel(int x, int y) const
|
|||
case StorageFormat::Indexed8:
|
||||
return get_pixel<StorageFormat::Indexed8>(x, y);
|
||||
default:
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
}
|
||||
|
||||
template<>
|
||||
inline void Bitmap::set_pixel<StorageFormat::RGB32>(int x, int y, Color color)
|
||||
{
|
||||
ASSERT(x >= 0 && x < physical_width());
|
||||
VERIFY(x >= 0 && x < physical_width());
|
||||
scanline(y)[x] = color.value();
|
||||
}
|
||||
template<>
|
||||
inline void Bitmap::set_pixel<StorageFormat::RGBA32>(int x, int y, Color color)
|
||||
{
|
||||
ASSERT(x >= 0 && x < physical_width());
|
||||
VERIFY(x >= 0 && x < physical_width());
|
||||
scanline(y)[x] = color.value(); // drop alpha
|
||||
}
|
||||
inline void Bitmap::set_pixel(int x, int y, Color color)
|
||||
|
@ -351,9 +351,9 @@ inline void Bitmap::set_pixel(int x, int y, Color color)
|
|||
set_pixel<StorageFormat::RGBA32>(x, y, color);
|
||||
break;
|
||||
case StorageFormat::Indexed8:
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
default:
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -147,7 +147,7 @@ RefPtr<BitmapFont> BitmapFont::load_from_memory(const u8* data)
|
|||
else if (header.type == 1)
|
||||
type = FontTypes::LatinExtendedA;
|
||||
else
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
|
||||
size_t count = glyph_count_by_type(type);
|
||||
size_t bytes_per_glyph = sizeof(unsigned) * header.glyph_height;
|
||||
|
@ -168,7 +168,7 @@ size_t BitmapFont::glyph_count_by_type(FontTypes type)
|
|||
return 384;
|
||||
|
||||
dbgln("Unknown font type: {}", (int)type);
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
RefPtr<BitmapFont> BitmapFont::load_from_file(const StringView& path)
|
||||
|
|
|
@ -98,7 +98,7 @@ public:
|
|||
|
||||
void set_glyph_width(size_t ch, u8 width)
|
||||
{
|
||||
ASSERT(m_glyph_widths);
|
||||
VERIFY(m_glyph_widths);
|
||||
m_glyph_widths[ch] = width;
|
||||
}
|
||||
|
||||
|
|
|
@ -167,7 +167,7 @@ ClassicWindowTheme::FrameColors ClassicWindowTheme::compute_frame_colors(WindowS
|
|||
case WindowState::Inactive:
|
||||
return { palette.inactive_window_title(), palette.inactive_window_border1(), palette.inactive_window_border2(), palette.inactive_window_title_stripes(), palette.inactive_window_title_shadow() };
|
||||
default:
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -50,8 +50,8 @@ String Color::to_string_without_alpha() const
|
|||
|
||||
static Optional<Color> parse_rgb_color(const StringView& string)
|
||||
{
|
||||
ASSERT(string.starts_with("rgb("));
|
||||
ASSERT(string.ends_with(")"));
|
||||
VERIFY(string.starts_with("rgb("));
|
||||
VERIFY(string.ends_with(")"));
|
||||
|
||||
auto substring = string.substring_view(4, string.length() - 5);
|
||||
auto parts = substring.split_view(',');
|
||||
|
@ -71,8 +71,8 @@ static Optional<Color> parse_rgb_color(const StringView& string)
|
|||
|
||||
static Optional<Color> parse_rgba_color(const StringView& string)
|
||||
{
|
||||
ASSERT(string.starts_with("rgba("));
|
||||
ASSERT(string.ends_with(")"));
|
||||
VERIFY(string.starts_with("rgba("));
|
||||
VERIFY(string.ends_with(")"));
|
||||
|
||||
auto substring = string.substring_view(5, string.length() - 6);
|
||||
auto parts = substring.split_view(',');
|
||||
|
|
|
@ -239,9 +239,9 @@ public:
|
|||
|
||||
hsv.value = max;
|
||||
|
||||
ASSERT(hsv.hue >= 0.0 && hsv.hue < 360.0);
|
||||
ASSERT(hsv.saturation >= 0.0 && hsv.saturation <= 1.0);
|
||||
ASSERT(hsv.value >= 0.0 && hsv.value <= 1.0);
|
||||
VERIFY(hsv.hue >= 0.0 && hsv.hue < 360.0);
|
||||
VERIFY(hsv.saturation >= 0.0 && hsv.saturation <= 1.0);
|
||||
VERIFY(hsv.value >= 0.0 && hsv.value <= 1.0);
|
||||
|
||||
return hsv;
|
||||
}
|
||||
|
@ -253,9 +253,9 @@ public:
|
|||
|
||||
static Color from_hsv(const HSV& hsv)
|
||||
{
|
||||
ASSERT(hsv.hue >= 0.0 && hsv.hue < 360.0);
|
||||
ASSERT(hsv.saturation >= 0.0 && hsv.saturation <= 1.0);
|
||||
ASSERT(hsv.value >= 0.0 && hsv.value <= 1.0);
|
||||
VERIFY(hsv.hue >= 0.0 && hsv.hue < 360.0);
|
||||
VERIFY(hsv.saturation >= 0.0 && hsv.saturation <= 1.0);
|
||||
VERIFY(hsv.value >= 0.0 && hsv.value <= 1.0);
|
||||
|
||||
double hue = hsv.hue;
|
||||
double saturation = hsv.saturation;
|
||||
|
@ -397,7 +397,7 @@ inline constexpr Color::Color(NamedColor named)
|
|||
rgb = { 212, 208, 200 };
|
||||
break;
|
||||
default:
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -85,7 +85,7 @@ public:
|
|||
|
||||
virtual void apply(Bitmap& target_bitmap, const IntRect& target_rect, const Bitmap& source_bitmap, const IntRect& source_rect, const Filter::Parameters& parameters) override
|
||||
{
|
||||
ASSERT(parameters.is_generic_convolution_filter());
|
||||
VERIFY(parameters.is_generic_convolution_filter());
|
||||
auto& gcf_params = static_cast<const GenericConvolutionFilter::Parameters&>(parameters);
|
||||
|
||||
ApplyCache apply_cache;
|
||||
|
@ -98,10 +98,10 @@ public:
|
|||
// contained by the source area. source_rect should be describing
|
||||
// the pixels that can be accessed to apply this filter, while
|
||||
// target_rect should describe the area where to apply the filter on.
|
||||
ASSERT(source_rect.contains(target_rect));
|
||||
ASSERT(source.size().contains(target.size()));
|
||||
ASSERT(target.rect().contains(target_rect));
|
||||
ASSERT(source.rect().contains(source_rect));
|
||||
VERIFY(source_rect.contains(target_rect));
|
||||
VERIFY(source.size().contains(target.size()));
|
||||
VERIFY(target.rect().contains(target_rect));
|
||||
VERIFY(source.rect().contains(source_rect));
|
||||
|
||||
// If source is different from target, it should still be describing
|
||||
// essentially the same bitmap. But it allows us to modify target
|
||||
|
|
|
@ -50,7 +50,7 @@ Font& FontDatabase::default_font()
|
|||
static Font* font;
|
||||
if (!font) {
|
||||
font = FontDatabase::the().get_by_name("Katica 10 400");
|
||||
ASSERT(font);
|
||||
VERIFY(font);
|
||||
}
|
||||
return *font;
|
||||
}
|
||||
|
@ -60,7 +60,7 @@ Font& FontDatabase::default_fixed_width_font()
|
|||
static Font* font;
|
||||
if (!font) {
|
||||
font = FontDatabase::the().get_by_name("Csilla 10 400");
|
||||
ASSERT(font);
|
||||
VERIFY(font);
|
||||
}
|
||||
return *font;
|
||||
}
|
||||
|
@ -70,7 +70,7 @@ Font& FontDatabase::default_bold_fixed_width_font()
|
|||
static Font* font;
|
||||
if (!font) {
|
||||
font = FontDatabase::the().get_by_name("Csilla 10 700");
|
||||
ASSERT(font);
|
||||
VERIFY(font);
|
||||
}
|
||||
return *font;
|
||||
}
|
||||
|
@ -80,7 +80,7 @@ Font& FontDatabase::default_bold_font()
|
|||
static Font* font;
|
||||
if (!font) {
|
||||
font = FontDatabase::the().get_by_name("Katica 10 700");
|
||||
ASSERT(font);
|
||||
VERIFY(font);
|
||||
}
|
||||
return *font;
|
||||
}
|
||||
|
|
|
@ -232,14 +232,14 @@ public:
|
|||
|
||||
Vector<u8>& get_output()
|
||||
{
|
||||
ASSERT(m_current_code <= m_code_table.size());
|
||||
VERIFY(m_current_code <= m_code_table.size());
|
||||
if (m_current_code < m_code_table.size()) {
|
||||
Vector<u8> new_entry = m_output;
|
||||
m_output = m_code_table.at(m_current_code);
|
||||
new_entry.append(m_output[0]);
|
||||
extend_code_table(new_entry);
|
||||
} else if (m_current_code == m_code_table.size()) {
|
||||
ASSERT(!m_output.is_empty());
|
||||
VERIFY(!m_output.is_empty());
|
||||
m_output.append(m_output[0]);
|
||||
extend_code_table(m_output);
|
||||
}
|
||||
|
@ -285,7 +285,7 @@ private:
|
|||
|
||||
static void copy_frame_buffer(Bitmap& dest, const Bitmap& src)
|
||||
{
|
||||
ASSERT(dest.size_in_bytes() == src.size_in_bytes());
|
||||
VERIFY(dest.size_in_bytes() == src.size_in_bytes());
|
||||
memcpy(dest.scanline(0), src.scanline(0), dest.size_in_bytes());
|
||||
}
|
||||
|
||||
|
@ -294,7 +294,7 @@ static void clear_rect(Bitmap& bitmap, const IntRect& rect, Color color)
|
|||
if (rect.is_empty())
|
||||
return;
|
||||
|
||||
ASSERT(bitmap.rect().contains(rect));
|
||||
VERIFY(bitmap.rect().contains(rect));
|
||||
|
||||
RGBA32* dst = bitmap.scanline(rect.top()) + rect.left();
|
||||
const size_t dst_skip = bitmap.pitch() / sizeof(RGBA32);
|
||||
|
|
|
@ -388,7 +388,7 @@ RefPtr<Gfx::Bitmap> ICOImageDecoderPlugin::bitmap()
|
|||
m_context->state = ICOLoadingContext::State::BitmapDecoded;
|
||||
}
|
||||
|
||||
ASSERT(m_context->images[m_context->largest_index].bitmap);
|
||||
VERIFY(m_context->images[m_context->largest_index].bitmap);
|
||||
return m_context->images[m_context->largest_index].bitmap;
|
||||
}
|
||||
|
||||
|
|
|
@ -661,7 +661,7 @@ static bool read_huffman_table(InputMemoryStream& stream, JPGLoadingContext& con
|
|||
|
||||
auto& huffman_table = table.type == 0 ? context.dc_tables : context.ac_tables;
|
||||
huffman_table.set(table.destination_id, table);
|
||||
ASSERT(huffman_table.size() <= 2);
|
||||
VERIFY(huffman_table.size() <= 2);
|
||||
|
||||
bytes_to_read -= 1 + 16 + total_codes;
|
||||
}
|
||||
|
@ -1167,7 +1167,7 @@ static bool parse_header(InputMemoryStream& stream, JPGLoadingContext& context)
|
|||
}
|
||||
}
|
||||
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
static bool scan_huffman_stream(InputMemoryStream& stream, JPGLoadingContext& context)
|
||||
|
@ -1213,7 +1213,7 @@ static bool scan_huffman_stream(InputMemoryStream& stream, JPGLoadingContext& co
|
|||
}
|
||||
}
|
||||
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
static bool decode_jpg(JPGLoadingContext& context)
|
||||
|
|
|
@ -39,7 +39,7 @@ public:
|
|||
Matrix() = default;
|
||||
Matrix(std::initializer_list<T> elements)
|
||||
{
|
||||
ASSERT(elements.size() == N * N);
|
||||
VERIFY(elements.size() == N * N);
|
||||
size_t i = 0;
|
||||
for (auto& element : elements) {
|
||||
m_elements[i / N][i % N] = element;
|
||||
|
|
|
@ -166,7 +166,7 @@ RefPtr<Gfx::Bitmap> PBMImageDecoderPlugin::bitmap()
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
ASSERT(m_context->bitmap);
|
||||
VERIFY(m_context->bitmap);
|
||||
return m_context->bitmap;
|
||||
}
|
||||
|
||||
|
|
|
@ -169,7 +169,7 @@ RefPtr<Gfx::Bitmap> PGMImageDecoderPlugin::bitmap()
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
ASSERT(m_context->bitmap);
|
||||
VERIFY(m_context->bitmap);
|
||||
return m_context->bitmap;
|
||||
}
|
||||
|
||||
|
|
|
@ -387,7 +387,7 @@ NEVER_INLINE FLATTEN static bool unfilter(PNGLoadingContext& context)
|
|||
}
|
||||
}
|
||||
} else {
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
|
@ -396,7 +396,7 @@ NEVER_INLINE FLATTEN static bool unfilter(PNGLoadingContext& context)
|
|||
} else if (context.bit_depth == 16) {
|
||||
unpack_grayscale_with_alpha<u16>(context);
|
||||
} else {
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
|
@ -405,7 +405,7 @@ NEVER_INLINE FLATTEN static bool unfilter(PNGLoadingContext& context)
|
|||
} else if (context.bit_depth == 16) {
|
||||
unpack_triplets_without_alpha<u16>(context);
|
||||
} else {
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
break;
|
||||
case 6:
|
||||
|
@ -425,7 +425,7 @@ NEVER_INLINE FLATTEN static bool unfilter(PNGLoadingContext& context)
|
|||
}
|
||||
}
|
||||
} else {
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
|
@ -468,11 +468,11 @@ NEVER_INLINE FLATTEN static bool unfilter(PNGLoadingContext& context)
|
|||
}
|
||||
}
|
||||
} else {
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
break;
|
||||
default:
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -658,7 +658,7 @@ static int adam7_height(PNGLoadingContext& context, int pass)
|
|||
case 7:
|
||||
return context.height / 2;
|
||||
default:
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -680,7 +680,7 @@ static int adam7_width(PNGLoadingContext& context, int pass)
|
|||
case 7:
|
||||
return context.width;
|
||||
default:
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -809,7 +809,7 @@ static bool decode_png_bitmap(PNGLoadingContext& context)
|
|||
return false;
|
||||
break;
|
||||
default:
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
munmap(context.decompression_buffer, context.decompression_buffer_size);
|
||||
|
@ -1026,7 +1026,7 @@ RefPtr<Gfx::Bitmap> PNGImageDecoderPlugin::bitmap()
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
ASSERT(m_context->bitmap);
|
||||
VERIFY(m_context->bitmap);
|
||||
return m_context->bitmap;
|
||||
}
|
||||
|
||||
|
|
|
@ -171,7 +171,7 @@ RefPtr<Gfx::Bitmap> PPMImageDecoderPlugin::bitmap()
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
ASSERT(m_context->bitmap);
|
||||
VERIFY(m_context->bitmap);
|
||||
return m_context->bitmap;
|
||||
}
|
||||
|
||||
|
|
|
@ -73,9 +73,9 @@ Painter::Painter(Gfx::Bitmap& bitmap)
|
|||
: m_target(bitmap)
|
||||
{
|
||||
int scale = bitmap.scale();
|
||||
ASSERT(bitmap.format() == Gfx::BitmapFormat::RGB32 || bitmap.format() == Gfx::BitmapFormat::RGBA32);
|
||||
ASSERT(bitmap.physical_width() % scale == 0);
|
||||
ASSERT(bitmap.physical_height() % scale == 0);
|
||||
VERIFY(bitmap.format() == Gfx::BitmapFormat::RGB32 || bitmap.format() == Gfx::BitmapFormat::RGBA32);
|
||||
VERIFY(bitmap.physical_width() % scale == 0);
|
||||
VERIFY(bitmap.physical_height() % scale == 0);
|
||||
m_state_stack.append(State());
|
||||
state().font = &FontDatabase::default_font();
|
||||
state().clip_rect = { { 0, 0 }, bitmap.size() };
|
||||
|
@ -89,7 +89,7 @@ Painter::~Painter()
|
|||
|
||||
void Painter::fill_rect_with_draw_op(const IntRect& a_rect, Color color)
|
||||
{
|
||||
ASSERT(scale() == 1); // FIXME: Add scaling support.
|
||||
VERIFY(scale() == 1); // FIXME: Add scaling support.
|
||||
|
||||
auto rect = a_rect.translated(translation()).intersected(clip_rect());
|
||||
if (rect.is_empty())
|
||||
|
@ -111,7 +111,7 @@ void Painter::clear_rect(const IntRect& a_rect, Color color)
|
|||
if (rect.is_empty())
|
||||
return;
|
||||
|
||||
ASSERT(m_target->rect().contains(rect));
|
||||
VERIFY(m_target->rect().contains(rect));
|
||||
rect *= scale();
|
||||
|
||||
RGBA32* dst = m_target->scanline(rect.top()) + rect.left();
|
||||
|
@ -154,14 +154,14 @@ void Painter::fill_rect(const IntRect& a_rect, Color color)
|
|||
auto rect = a_rect.translated(translation()).intersected(clip_rect());
|
||||
if (rect.is_empty())
|
||||
return;
|
||||
ASSERT(m_target->rect().contains(rect));
|
||||
VERIFY(m_target->rect().contains(rect));
|
||||
|
||||
fill_physical_rect(rect * scale(), color);
|
||||
}
|
||||
|
||||
void Painter::fill_rect_with_dither_pattern(const IntRect& a_rect, Color color_a, Color color_b)
|
||||
{
|
||||
ASSERT(scale() == 1); // FIXME: Add scaling support.
|
||||
VERIFY(scale() == 1); // FIXME: Add scaling support.
|
||||
|
||||
auto rect = a_rect.translated(translation()).intersected(clip_rect());
|
||||
if (rect.is_empty())
|
||||
|
@ -185,7 +185,7 @@ void Painter::fill_rect_with_dither_pattern(const IntRect& a_rect, Color color_a
|
|||
|
||||
void Painter::fill_rect_with_checkerboard(const IntRect& a_rect, const IntSize& cell_size, Color color_dark, Color color_light)
|
||||
{
|
||||
ASSERT(scale() == 1); // FIXME: Add scaling support.
|
||||
VERIFY(scale() == 1); // FIXME: Add scaling support.
|
||||
|
||||
auto rect = a_rect.translated(translation()).intersected(clip_rect());
|
||||
if (rect.is_empty())
|
||||
|
@ -264,13 +264,13 @@ void Painter::fill_rect_with_gradient(const IntRect& a_rect, Color gradient_star
|
|||
|
||||
void Painter::fill_ellipse(const IntRect& a_rect, Color color)
|
||||
{
|
||||
ASSERT(scale() == 1); // FIXME: Add scaling support.
|
||||
VERIFY(scale() == 1); // FIXME: Add scaling support.
|
||||
|
||||
auto rect = a_rect.translated(translation()).intersected(clip_rect());
|
||||
if (rect.is_empty())
|
||||
return;
|
||||
|
||||
ASSERT(m_target->rect().contains(rect));
|
||||
VERIFY(m_target->rect().contains(rect));
|
||||
|
||||
RGBA32* dst = m_target->scanline(rect.top()) + rect.left() + rect.width() / 2;
|
||||
const size_t dst_skip = m_target->pitch() / sizeof(RGBA32);
|
||||
|
@ -285,7 +285,7 @@ void Painter::fill_ellipse(const IntRect& a_rect, Color color)
|
|||
|
||||
void Painter::draw_ellipse_intersecting(const IntRect& rect, Color color, int thickness)
|
||||
{
|
||||
ASSERT(scale() == 1); // FIXME: Add scaling support.
|
||||
VERIFY(scale() == 1); // FIXME: Add scaling support.
|
||||
|
||||
constexpr int number_samples = 100; // FIXME: dynamically work out the number of samples based upon the rect size
|
||||
double increment = M_PI / number_samples;
|
||||
|
@ -324,7 +324,7 @@ static void for_each_pixel_around_rect_clockwise(const RectType& rect, Callback
|
|||
|
||||
void Painter::draw_focus_rect(const IntRect& rect, Color color)
|
||||
{
|
||||
ASSERT(scale() == 1); // FIXME: Add scaling support.
|
||||
VERIFY(scale() == 1); // FIXME: Add scaling support.
|
||||
|
||||
if (rect.is_empty())
|
||||
return;
|
||||
|
@ -389,7 +389,7 @@ void Painter::draw_rect(const IntRect& a_rect, Color color, bool rough)
|
|||
|
||||
void Painter::draw_bitmap(const IntPoint& p, const CharacterBitmap& bitmap, Color color)
|
||||
{
|
||||
ASSERT(scale() == 1); // FIXME: Add scaling support.
|
||||
VERIFY(scale() == 1); // FIXME: Add scaling support.
|
||||
|
||||
auto rect = IntRect(p, bitmap.size()).translated(translation());
|
||||
auto clipped_rect = rect.intersected(clip_rect());
|
||||
|
@ -454,7 +454,7 @@ void Painter::draw_bitmap(const IntPoint& p, const GlyphBitmap& bitmap, Color co
|
|||
|
||||
void Painter::draw_triangle(const IntPoint& a, const IntPoint& b, const IntPoint& c, Color color)
|
||||
{
|
||||
ASSERT(scale() == 1); // FIXME: Add scaling support.
|
||||
VERIFY(scale() == 1); // FIXME: Add scaling support.
|
||||
|
||||
RGBA32 rgba = color.value();
|
||||
|
||||
|
@ -524,7 +524,7 @@ void Painter::draw_triangle(const IntPoint& a, const IntPoint& b, const IntPoint
|
|||
|
||||
void Painter::blit_with_opacity(const IntPoint& position, const Gfx::Bitmap& source, const IntRect& a_src_rect, float opacity, bool apply_alpha)
|
||||
{
|
||||
ASSERT(scale() >= source.scale() && "painter doesn't support downsampling scale factors");
|
||||
VERIFY(scale() >= source.scale() && "painter doesn't support downsampling scale factors");
|
||||
|
||||
if (opacity >= 1.0f && !(source.has_alpha_channel() && apply_alpha))
|
||||
return blit(position, source, a_src_rect);
|
||||
|
@ -581,7 +581,7 @@ void Painter::blit_with_opacity(const IntPoint& position, const Gfx::Bitmap& sou
|
|||
|
||||
void Painter::blit_filtered(const IntPoint& position, const Gfx::Bitmap& source, const IntRect& src_rect, Function<Color(Color)> filter)
|
||||
{
|
||||
ASSERT((source.scale() == 1 || source.scale() == scale()) && "blit_filtered only supports integer upsampling");
|
||||
VERIFY((source.scale() == 1 || source.scale() == scale()) && "blit_filtered only supports integer upsampling");
|
||||
|
||||
IntRect safe_src_rect = src_rect.intersected(source.rect());
|
||||
auto dst_rect = IntRect(position, safe_src_rect.size()).translated(translation());
|
||||
|
@ -660,7 +660,7 @@ void Painter::blit_dimmed(const IntPoint& position, const Gfx::Bitmap& source, c
|
|||
|
||||
void Painter::draw_tiled_bitmap(const IntRect& a_dst_rect, const Gfx::Bitmap& source)
|
||||
{
|
||||
ASSERT((source.scale() == 1 || source.scale() == scale()) && "draw_tiled_bitmap only supports integer upsampling");
|
||||
VERIFY((source.scale() == 1 || source.scale() == scale()) && "draw_tiled_bitmap only supports integer upsampling");
|
||||
|
||||
auto dst_rect = a_dst_rect.translated(translation());
|
||||
auto clipped_rect = dst_rect.intersected(clip_rect());
|
||||
|
@ -701,7 +701,7 @@ void Painter::draw_tiled_bitmap(const IntRect& a_dst_rect, const Gfx::Bitmap& so
|
|||
return;
|
||||
}
|
||||
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
void Painter::blit_offset(const IntPoint& a_position, const Gfx::Bitmap& source, const IntRect& a_src_rect, const IntPoint& offset)
|
||||
|
@ -721,7 +721,7 @@ void Painter::blit_offset(const IntPoint& a_position, const Gfx::Bitmap& source,
|
|||
|
||||
void Painter::blit(const IntPoint& position, const Gfx::Bitmap& source, const IntRect& a_src_rect, float opacity, bool apply_alpha)
|
||||
{
|
||||
ASSERT(scale() >= source.scale() && "painter doesn't support downsampling scale factors");
|
||||
VERIFY(scale() >= source.scale() && "painter doesn't support downsampling scale factors");
|
||||
|
||||
if (opacity < 1.0f || (source.has_alpha_channel() && apply_alpha))
|
||||
return blit_with_opacity(position, source, a_src_rect, opacity, apply_alpha);
|
||||
|
@ -772,7 +772,7 @@ void Painter::blit(const IntPoint& position, const Gfx::Bitmap& source, const In
|
|||
return;
|
||||
}
|
||||
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
template<bool has_alpha_channel, typename GetPixel>
|
||||
|
@ -1024,7 +1024,7 @@ void draw_text_line(const IntRect& a_rect, const TextType& text, const Font& fon
|
|||
break;
|
||||
}
|
||||
default:
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
if (is_vertically_centered_text_alignment(alignment)) {
|
||||
|
@ -1117,7 +1117,7 @@ void do_draw_text(const IntRect& rect, const TextType& text, const Font& font, T
|
|||
bounding_rect.set_location({ (rect.right() + 1) - bounding_rect.width(), (rect.bottom() + 1) - bounding_rect.height() });
|
||||
break;
|
||||
default:
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < lines.size(); ++i) {
|
||||
|
@ -1155,7 +1155,7 @@ void Painter::draw_text(const IntRect& rect, const Utf32View& text, const Font&
|
|||
|
||||
void Painter::draw_text(Function<void(const IntRect&, u32)> draw_one_glyph, const IntRect& rect, const StringView& raw_text, const Font& font, TextAlignment alignment, TextElision elision)
|
||||
{
|
||||
ASSERT(scale() == 1); // FIXME: Add scaling support.
|
||||
VERIFY(scale() == 1); // FIXME: Add scaling support.
|
||||
|
||||
Utf8View text { raw_text };
|
||||
do_draw_text(rect, text, font, alignment, elision, [&](const IntRect& r, u32 code_point) {
|
||||
|
@ -1165,7 +1165,7 @@ void Painter::draw_text(Function<void(const IntRect&, u32)> draw_one_glyph, cons
|
|||
|
||||
void Painter::draw_text(Function<void(const IntRect&, u32)> draw_one_glyph, const IntRect& rect, const Utf8View& text, const Font& font, TextAlignment alignment, TextElision elision)
|
||||
{
|
||||
ASSERT(scale() == 1); // FIXME: Add scaling support.
|
||||
VERIFY(scale() == 1); // FIXME: Add scaling support.
|
||||
|
||||
do_draw_text(rect, text, font, alignment, elision, [&](const IntRect& r, u32 code_point) {
|
||||
draw_one_glyph(r, code_point);
|
||||
|
@ -1174,7 +1174,7 @@ void Painter::draw_text(Function<void(const IntRect&, u32)> draw_one_glyph, cons
|
|||
|
||||
void Painter::draw_text(Function<void(const IntRect&, u32)> draw_one_glyph, const IntRect& rect, const Utf32View& text, const Font& font, TextAlignment alignment, TextElision elision)
|
||||
{
|
||||
ASSERT(scale() == 1); // FIXME: Add scaling support.
|
||||
VERIFY(scale() == 1); // FIXME: Add scaling support.
|
||||
|
||||
do_draw_text(rect, text, font, alignment, elision, [&](const IntRect& r, u32 code_point) {
|
||||
draw_one_glyph(r, code_point);
|
||||
|
@ -1183,7 +1183,7 @@ void Painter::draw_text(Function<void(const IntRect&, u32)> draw_one_glyph, cons
|
|||
|
||||
void Painter::set_pixel(const IntPoint& p, Color color)
|
||||
{
|
||||
ASSERT(scale() == 1); // FIXME: Add scaling support.
|
||||
VERIFY(scale() == 1); // FIXME: Add scaling support.
|
||||
|
||||
auto point = p;
|
||||
point.move_by(state().translation);
|
||||
|
@ -1245,7 +1245,7 @@ void Painter::draw_physical_pixel(const IntPoint& physical_position, Color color
|
|||
// This always draws a single physical pixel, independent of scale().
|
||||
// This should only be called by routines that already handle scale
|
||||
// (including scaling thickness).
|
||||
ASSERT(draw_op() == DrawOp::Copy);
|
||||
VERIFY(draw_op() == DrawOp::Copy);
|
||||
|
||||
if (thickness == 1) { // Implies scale() == 1.
|
||||
auto& pixel = m_target->scanline(physical_position.y())[physical_position.x()];
|
||||
|
@ -1327,7 +1327,7 @@ void Painter::draw_line(const IntPoint& p1, const IntPoint& p2, Color color, int
|
|||
}
|
||||
|
||||
// FIXME: Implement dotted/dashed diagonal lines.
|
||||
ASSERT(style == LineStyle::Solid);
|
||||
VERIFY(style == LineStyle::Solid);
|
||||
|
||||
const double adx = abs(point2.x() - point1.x());
|
||||
const double ady = abs(point2.y() - point1.y());
|
||||
|
@ -1462,7 +1462,7 @@ static bool can_approximate_elliptical_arc(const FloatPoint& p1, const FloatPoin
|
|||
|
||||
void Painter::draw_quadratic_bezier_curve(const IntPoint& control_point, const IntPoint& p1, const IntPoint& p2, Color color, int thickness, LineStyle style)
|
||||
{
|
||||
ASSERT(scale() == 1); // FIXME: Add scaling support.
|
||||
VERIFY(scale() == 1); // FIXME: Add scaling support.
|
||||
|
||||
for_each_line_segment_on_bezier_curve(FloatPoint(control_point), FloatPoint(p1), FloatPoint(p2), [&](const FloatPoint& fp1, const FloatPoint& fp2) {
|
||||
draw_line(IntPoint(fp1.x(), fp1.y()), IntPoint(fp2.x(), fp2.y()), color, thickness, style);
|
||||
|
@ -1487,7 +1487,7 @@ void Painter::for_each_line_segment_on_elliptical_arc(const FloatPoint& p1, cons
|
|||
|
||||
void Painter::draw_elliptical_arc(const IntPoint& p1, const IntPoint& p2, const IntPoint& center, const FloatPoint& radii, float x_axis_rotation, float theta_1, float theta_delta, Color color, int thickness, LineStyle style)
|
||||
{
|
||||
ASSERT(scale() == 1); // FIXME: Add scaling support.
|
||||
VERIFY(scale() == 1); // FIXME: Add scaling support.
|
||||
|
||||
for_each_line_segment_on_elliptical_arc(FloatPoint(p1), FloatPoint(p2), FloatPoint(center), radii, x_axis_rotation, theta_1, theta_delta, [&](const FloatPoint& fp1, const FloatPoint& fp2) {
|
||||
draw_line(IntPoint(fp1.x(), fp1.y()), IntPoint(fp2.x(), fp2.y()), color, thickness, style);
|
||||
|
@ -1518,14 +1518,14 @@ PainterStateSaver::~PainterStateSaver()
|
|||
|
||||
void Painter::stroke_path(const Path& path, Color color, int thickness)
|
||||
{
|
||||
ASSERT(scale() == 1); // FIXME: Add scaling support.
|
||||
VERIFY(scale() == 1); // FIXME: Add scaling support.
|
||||
|
||||
FloatPoint cursor;
|
||||
|
||||
for (auto& segment : path.segments()) {
|
||||
switch (segment.type()) {
|
||||
case Segment::Type::Invalid:
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
break;
|
||||
case Segment::Type::MoveTo:
|
||||
cursor = segment.point();
|
||||
|
@ -1573,7 +1573,7 @@ void Painter::stroke_path(const Path& path, Color color, int thickness)
|
|||
|
||||
void Painter::fill_path(Path& path, Color color, WindingRule winding_rule)
|
||||
{
|
||||
ASSERT(scale() == 1); // FIXME: Add scaling support.
|
||||
VERIFY(scale() == 1); // FIXME: Add scaling support.
|
||||
|
||||
const auto& segments = path.split_lines();
|
||||
|
||||
|
@ -1604,7 +1604,7 @@ void Painter::fill_path(Path& path, Color color, WindingRule winding_rule)
|
|||
if (winding_rule == WindingRule::EvenOdd)
|
||||
return winding_number % 2 == 0;
|
||||
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
};
|
||||
|
||||
auto increment_winding = [winding_rule](int& winding_number, const IntPoint& from, const IntPoint& to) {
|
||||
|
@ -1621,7 +1621,7 @@ void Painter::fill_path(Path& path, Color color, WindingRule winding_rule)
|
|||
return;
|
||||
}
|
||||
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
};
|
||||
|
||||
while (scanline >= last_y) {
|
||||
|
|
|
@ -125,7 +125,7 @@ public:
|
|||
void save() { m_state_stack.append(m_state_stack.last()); }
|
||||
void restore()
|
||||
{
|
||||
ASSERT(m_state_stack.size() > 1);
|
||||
VERIFY(m_state_stack.size() > 1);
|
||||
m_state_stack.take_last();
|
||||
}
|
||||
|
||||
|
|
|
@ -51,13 +51,13 @@ Palette::~Palette()
|
|||
|
||||
int PaletteImpl::metric(MetricRole role) const
|
||||
{
|
||||
ASSERT((int)role < (int)MetricRole::__Count);
|
||||
VERIFY((int)role < (int)MetricRole::__Count);
|
||||
return theme().metric[(int)role];
|
||||
}
|
||||
|
||||
String PaletteImpl::path(PathRole role) const
|
||||
{
|
||||
ASSERT((int)role < (int)PathRole::__Count);
|
||||
VERIFY((int)role < (int)PathRole::__Count);
|
||||
return theme().path[(int)role];
|
||||
}
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ public:
|
|||
|
||||
Color color(ColorRole role) const
|
||||
{
|
||||
ASSERT((int)role < (int)ColorRole::__Count);
|
||||
VERIFY((int)role < (int)ColorRole::__Count);
|
||||
return Color::from_rgba(theme().color[(int)role]);
|
||||
}
|
||||
|
||||
|
|
|
@ -70,7 +70,7 @@ void Path::close_all_subpaths()
|
|||
// This is a move from a subpath to another
|
||||
// connect the two ends of this subpath before
|
||||
// moving on to the next one
|
||||
ASSERT(start_of_subpath.has_value());
|
||||
VERIFY(start_of_subpath.has_value());
|
||||
|
||||
append_segment<MoveSegment>(cursor.value());
|
||||
append_segment<LineSegment>(start_of_subpath.value());
|
||||
|
@ -89,7 +89,7 @@ void Path::close_all_subpaths()
|
|||
cursor = segment.point();
|
||||
break;
|
||||
case Segment::Type::Invalid:
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -216,7 +216,7 @@ void Path::segmentize_path()
|
|||
break;
|
||||
}
|
||||
case Segment::Type::Invalid:
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
first = false;
|
||||
|
|
|
@ -177,7 +177,7 @@ public:
|
|||
{
|
||||
if (!m_split_lines.has_value()) {
|
||||
segmentize_path();
|
||||
ASSERT(m_split_lines.has_value());
|
||||
VERIFY(m_split_lines.has_value());
|
||||
}
|
||||
return m_split_lines.value();
|
||||
}
|
||||
|
@ -186,7 +186,7 @@ public:
|
|||
{
|
||||
if (!m_bounding_box.has_value()) {
|
||||
segmentize_path();
|
||||
ASSERT(m_bounding_box.has_value());
|
||||
VERIFY(m_bounding_box.has_value());
|
||||
}
|
||||
return m_bounding_box.value();
|
||||
}
|
||||
|
|
|
@ -36,13 +36,13 @@ static Core::AnonymousBuffer theme_buffer;
|
|||
|
||||
const SystemTheme& current_system_theme()
|
||||
{
|
||||
ASSERT(theme_page);
|
||||
VERIFY(theme_page);
|
||||
return *theme_page;
|
||||
}
|
||||
|
||||
Core::AnonymousBuffer& current_system_theme_buffer()
|
||||
{
|
||||
ASSERT(theme_buffer.is_valid());
|
||||
VERIFY(theme_buffer.is_valid());
|
||||
return theme_buffer;
|
||||
}
|
||||
|
||||
|
|
|
@ -129,7 +129,7 @@ inline const char* to_string(ColorRole role)
|
|||
ENUMERATE_COLOR_ROLES(__ENUMERATE_COLOR_ROLE)
|
||||
#undef __ENUMERATE_COLOR_ROLE
|
||||
default:
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ namespace Gfx {
|
|||
|
||||
unsigned Typeface::weight() const
|
||||
{
|
||||
ASSERT(m_ttf_font || m_bitmap_fonts.size() > 0);
|
||||
VERIFY(m_ttf_font || m_bitmap_fonts.size() > 0);
|
||||
|
||||
if (is_fixed_size())
|
||||
return m_bitmap_fonts[0]->weight();
|
||||
|
@ -40,7 +40,7 @@ unsigned Typeface::weight() const
|
|||
|
||||
bool Typeface::is_fixed_width() const
|
||||
{
|
||||
ASSERT(m_ttf_font || m_bitmap_fonts.size() > 0);
|
||||
VERIFY(m_ttf_font || m_bitmap_fonts.size() > 0);
|
||||
|
||||
if (is_fixed_size())
|
||||
return m_bitmap_fonts[0]->is_fixed_width();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue