mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 15:27:34 +00:00
Everywhere: Remove the AK::
qualifier from Stream usages
This commit is contained in:
parent
874c7bba28
commit
43f98ac6e1
73 changed files with 275 additions and 278 deletions
|
@ -202,7 +202,7 @@ static DXGIFormat get_format(DDSPixelFormat format)
|
|||
return DXGI_FORMAT_UNKNOWN;
|
||||
}
|
||||
|
||||
static ErrorOr<void> decode_dx5_alpha_block(AK::Stream& stream, DDSLoadingContext& context, u64 bitmap_x, u64 bitmap_y)
|
||||
static ErrorOr<void> decode_dx5_alpha_block(Stream& stream, DDSLoadingContext& context, u64 bitmap_x, u64 bitmap_y)
|
||||
{
|
||||
auto color0 = TRY(stream.read_value<LittleEndian<u8>>());
|
||||
auto color1 = TRY(stream.read_value<LittleEndian<u8>>());
|
||||
|
@ -265,7 +265,7 @@ static ErrorOr<void> decode_dx5_alpha_block(AK::Stream& stream, DDSLoadingContex
|
|||
return {};
|
||||
}
|
||||
|
||||
static ErrorOr<void> decode_dx3_alpha_block(AK::Stream& stream, DDSLoadingContext& context, u64 bitmap_x, u64 bitmap_y)
|
||||
static ErrorOr<void> decode_dx3_alpha_block(Stream& stream, DDSLoadingContext& context, u64 bitmap_x, u64 bitmap_y)
|
||||
{
|
||||
auto a0 = TRY(stream.read_value<LittleEndian<u8>>());
|
||||
auto a1 = TRY(stream.read_value<LittleEndian<u8>>());
|
||||
|
@ -313,7 +313,7 @@ static void unpack_rbg_565(u32 rgb, u8* output)
|
|||
output[3] = 255;
|
||||
}
|
||||
|
||||
static ErrorOr<void> decode_color_block(AK::Stream& stream, DDSLoadingContext& context, bool dxt1, u64 bitmap_x, u64 bitmap_y)
|
||||
static ErrorOr<void> decode_color_block(Stream& stream, DDSLoadingContext& context, bool dxt1, u64 bitmap_x, u64 bitmap_y)
|
||||
{
|
||||
auto c0_low = TRY(stream.read_value<LittleEndian<u8>>());
|
||||
auto c0_high = TRY(stream.read_value<LittleEndian<u8>>());
|
||||
|
@ -369,7 +369,7 @@ static ErrorOr<void> decode_color_block(AK::Stream& stream, DDSLoadingContext& c
|
|||
return {};
|
||||
}
|
||||
|
||||
static ErrorOr<void> decode_dxt(AK::Stream& stream, DDSLoadingContext& context, DXGIFormat format, u64 width, u64 y)
|
||||
static ErrorOr<void> decode_dxt(Stream& stream, DDSLoadingContext& context, DXGIFormat format, u64 width, u64 y)
|
||||
{
|
||||
if (format == DXGI_FORMAT_BC1_UNORM) {
|
||||
for (size_t x = 0; x < width; x += 4) {
|
||||
|
@ -393,7 +393,7 @@ static ErrorOr<void> decode_dxt(AK::Stream& stream, DDSLoadingContext& context,
|
|||
|
||||
return {};
|
||||
}
|
||||
static ErrorOr<void> decode_bitmap(AK::Stream& stream, DDSLoadingContext& context, DXGIFormat format, u64 width, u64 height)
|
||||
static ErrorOr<void> decode_bitmap(Stream& stream, DDSLoadingContext& context, DXGIFormat format, u64 width, u64 height)
|
||||
{
|
||||
Vector<u32> dxt_formats = { DXGI_FORMAT_BC1_UNORM, DXGI_FORMAT_BC2_UNORM, DXGI_FORMAT_BC3_UNORM };
|
||||
if (dxt_formats.contains_slow(format)) {
|
||||
|
|
|
@ -89,7 +89,7 @@ enum class GIFFormat {
|
|||
GIF89a,
|
||||
};
|
||||
|
||||
static ErrorOr<GIFFormat> decode_gif_header(AK::Stream& stream)
|
||||
static ErrorOr<GIFFormat> decode_gif_header(Stream& stream)
|
||||
{
|
||||
static auto valid_header_87 = "GIF87a"sv;
|
||||
static auto valid_header_89 = "GIF89a"sv;
|
||||
|
|
|
@ -75,7 +75,7 @@ struct ICOLoadingContext {
|
|||
size_t largest_index;
|
||||
};
|
||||
|
||||
static ErrorOr<size_t> decode_ico_header(AK::Stream& stream)
|
||||
static ErrorOr<size_t> decode_ico_header(Stream& stream)
|
||||
{
|
||||
auto header = TRY(stream.read_value<ICONDIR>());
|
||||
if (header.must_be_0 != 0 || header.must_be_1 != 1)
|
||||
|
@ -83,7 +83,7 @@ static ErrorOr<size_t> decode_ico_header(AK::Stream& stream)
|
|||
return { header.image_count };
|
||||
}
|
||||
|
||||
static ErrorOr<ICOImageDescriptor> decode_ico_direntry(AK::Stream& stream)
|
||||
static ErrorOr<ICOImageDescriptor> decode_ico_direntry(Stream& stream)
|
||||
{
|
||||
auto entry = TRY(stream.read_value<ICONDIRENTRY>());
|
||||
ICOImageDescriptor desc = { entry.width, entry.height, entry.bits_per_pixel, entry.offset, entry.size, nullptr };
|
||||
|
|
|
@ -460,7 +460,7 @@ static inline bool is_valid_marker(const Marker marker)
|
|||
return false;
|
||||
}
|
||||
|
||||
static inline ErrorOr<Marker> read_marker_at_cursor(AK::Stream& stream)
|
||||
static inline ErrorOr<Marker> read_marker_at_cursor(Stream& stream)
|
||||
{
|
||||
u16 marker = TRY(stream.read_value<BigEndian<u16>>());
|
||||
if (is_valid_marker(marker))
|
||||
|
@ -839,7 +839,7 @@ static ErrorOr<void> read_quantization_table(AK::SeekableStream& stream, JPGLoad
|
|||
return {};
|
||||
}
|
||||
|
||||
static ErrorOr<void> skip_marker_with_length(AK::Stream& stream)
|
||||
static ErrorOr<void> skip_marker_with_length(Stream& stream)
|
||||
{
|
||||
u16 bytes_to_skip = TRY(stream.read_value<BigEndian<u16>>()) - 2;
|
||||
TRY(stream.discard(bytes_to_skip));
|
||||
|
|
|
@ -21,7 +21,7 @@ static constexpr u8 QOI_OP_RUN = 0b11000000;
|
|||
static constexpr u8 QOI_MASK_2 = 0b11000000;
|
||||
static constexpr u8 END_MARKER[] = { 0, 0, 0, 0, 0, 0, 0, 1 };
|
||||
|
||||
static ErrorOr<QOIHeader> decode_qoi_header(AK::Stream& stream)
|
||||
static ErrorOr<QOIHeader> decode_qoi_header(Stream& stream)
|
||||
{
|
||||
auto header = TRY(stream.read_value<QOIHeader>());
|
||||
if (StringView { header.magic, array_size(header.magic) } != QOI_MAGIC)
|
||||
|
@ -31,7 +31,7 @@ static ErrorOr<QOIHeader> decode_qoi_header(AK::Stream& stream)
|
|||
return header;
|
||||
}
|
||||
|
||||
static ErrorOr<Color> decode_qoi_op_rgb(AK::Stream& stream, u8 first_byte, Color pixel)
|
||||
static ErrorOr<Color> decode_qoi_op_rgb(Stream& stream, u8 first_byte, Color pixel)
|
||||
{
|
||||
VERIFY(first_byte == QOI_OP_RGB);
|
||||
u8 bytes[3];
|
||||
|
@ -41,7 +41,7 @@ static ErrorOr<Color> decode_qoi_op_rgb(AK::Stream& stream, u8 first_byte, Color
|
|||
return Color { bytes[0], bytes[1], bytes[2], pixel.alpha() };
|
||||
}
|
||||
|
||||
static ErrorOr<Color> decode_qoi_op_rgba(AK::Stream& stream, u8 first_byte)
|
||||
static ErrorOr<Color> decode_qoi_op_rgba(Stream& stream, u8 first_byte)
|
||||
{
|
||||
VERIFY(first_byte == QOI_OP_RGBA);
|
||||
u8 bytes[4];
|
||||
|
@ -49,7 +49,7 @@ static ErrorOr<Color> decode_qoi_op_rgba(AK::Stream& stream, u8 first_byte)
|
|||
return Color { bytes[0], bytes[1], bytes[2], bytes[3] };
|
||||
}
|
||||
|
||||
static ErrorOr<u8> decode_qoi_op_index(AK::Stream&, u8 first_byte)
|
||||
static ErrorOr<u8> decode_qoi_op_index(Stream&, u8 first_byte)
|
||||
{
|
||||
VERIFY((first_byte & QOI_MASK_2) == QOI_OP_INDEX);
|
||||
u8 index = first_byte & ~QOI_MASK_2;
|
||||
|
@ -57,7 +57,7 @@ static ErrorOr<u8> decode_qoi_op_index(AK::Stream&, u8 first_byte)
|
|||
return index;
|
||||
}
|
||||
|
||||
static ErrorOr<Color> decode_qoi_op_diff(AK::Stream&, u8 first_byte, Color pixel)
|
||||
static ErrorOr<Color> decode_qoi_op_diff(Stream&, u8 first_byte, Color pixel)
|
||||
{
|
||||
VERIFY((first_byte & QOI_MASK_2) == QOI_OP_DIFF);
|
||||
u8 dr = (first_byte & 0b00110000) >> 4;
|
||||
|
@ -74,7 +74,7 @@ static ErrorOr<Color> decode_qoi_op_diff(AK::Stream&, u8 first_byte, Color pixel
|
|||
};
|
||||
}
|
||||
|
||||
static ErrorOr<Color> decode_qoi_op_luma(AK::Stream& stream, u8 first_byte, Color pixel)
|
||||
static ErrorOr<Color> decode_qoi_op_luma(Stream& stream, u8 first_byte, Color pixel)
|
||||
{
|
||||
VERIFY((first_byte & QOI_MASK_2) == QOI_OP_LUMA);
|
||||
auto byte = TRY(stream.read_value<u8>());
|
||||
|
@ -91,7 +91,7 @@ static ErrorOr<Color> decode_qoi_op_luma(AK::Stream& stream, u8 first_byte, Colo
|
|||
};
|
||||
}
|
||||
|
||||
static ErrorOr<u8> decode_qoi_op_run(AK::Stream&, u8 first_byte)
|
||||
static ErrorOr<u8> decode_qoi_op_run(Stream&, u8 first_byte)
|
||||
{
|
||||
VERIFY((first_byte & QOI_MASK_2) == QOI_OP_RUN);
|
||||
u8 run = first_byte & ~QOI_MASK_2;
|
||||
|
@ -107,7 +107,7 @@ static ErrorOr<u8> decode_qoi_op_run(AK::Stream&, u8 first_byte)
|
|||
return run;
|
||||
}
|
||||
|
||||
static ErrorOr<void> decode_qoi_end_marker(AK::Stream& stream)
|
||||
static ErrorOr<void> decode_qoi_end_marker(Stream& stream)
|
||||
{
|
||||
u8 bytes[array_size(END_MARKER)];
|
||||
TRY(stream.read_entire_buffer({ &bytes, array_size(bytes) }));
|
||||
|
@ -118,7 +118,7 @@ static ErrorOr<void> decode_qoi_end_marker(AK::Stream& stream)
|
|||
return {};
|
||||
}
|
||||
|
||||
static ErrorOr<NonnullRefPtr<Bitmap>> decode_qoi_image(AK::Stream& stream, u32 width, u32 height)
|
||||
static ErrorOr<NonnullRefPtr<Bitmap>> decode_qoi_image(Stream& stream, u32 width, u32 height)
|
||||
{
|
||||
// FIXME: Why is Gfx::Bitmap's size signed? Makes no sense whatsoever.
|
||||
if (width > NumericLimits<int>::max())
|
||||
|
@ -162,7 +162,7 @@ static ErrorOr<NonnullRefPtr<Bitmap>> decode_qoi_image(AK::Stream& stream, u32 w
|
|||
return { move(bitmap) };
|
||||
}
|
||||
|
||||
QOIImageDecoderPlugin::QOIImageDecoderPlugin(NonnullOwnPtr<AK::Stream> stream)
|
||||
QOIImageDecoderPlugin::QOIImageDecoderPlugin(NonnullOwnPtr<Stream> stream)
|
||||
{
|
||||
m_context = make<QOILoadingContext>();
|
||||
m_context->stream = move(stream);
|
||||
|
@ -232,7 +232,7 @@ ErrorOr<ImageFrameDescriptor> QOIImageDecoderPlugin::frame(size_t index)
|
|||
return ImageFrameDescriptor { m_context->bitmap, 0 };
|
||||
}
|
||||
|
||||
ErrorOr<void> QOIImageDecoderPlugin::decode_header_and_update_context(AK::Stream& stream)
|
||||
ErrorOr<void> QOIImageDecoderPlugin::decode_header_and_update_context(Stream& stream)
|
||||
{
|
||||
VERIFY(m_context->state < QOILoadingContext::State::HeaderDecoded);
|
||||
auto error_or_header = decode_qoi_header(stream);
|
||||
|
@ -245,7 +245,7 @@ ErrorOr<void> QOIImageDecoderPlugin::decode_header_and_update_context(AK::Stream
|
|||
return {};
|
||||
}
|
||||
|
||||
ErrorOr<void> QOIImageDecoderPlugin::decode_image_and_update_context(AK::Stream& stream)
|
||||
ErrorOr<void> QOIImageDecoderPlugin::decode_image_and_update_context(Stream& stream)
|
||||
{
|
||||
VERIFY(m_context->state < QOILoadingContext::State::ImageDecoded);
|
||||
auto error_or_bitmap = decode_qoi_image(stream, m_context->header.width, m_context->header.height);
|
||||
|
|
|
@ -31,7 +31,7 @@ struct QOILoadingContext {
|
|||
Error,
|
||||
};
|
||||
State state { State::NotDecoded };
|
||||
OwnPtr<AK::Stream> stream {};
|
||||
OwnPtr<Stream> stream {};
|
||||
QOIHeader header {};
|
||||
RefPtr<Bitmap> bitmap;
|
||||
};
|
||||
|
@ -54,10 +54,10 @@ public:
|
|||
virtual ErrorOr<Optional<ReadonlyBytes>> icc_data() override;
|
||||
|
||||
private:
|
||||
ErrorOr<void> decode_header_and_update_context(AK::Stream&);
|
||||
ErrorOr<void> decode_image_and_update_context(AK::Stream&);
|
||||
ErrorOr<void> decode_header_and_update_context(Stream&);
|
||||
ErrorOr<void> decode_image_and_update_context(Stream&);
|
||||
|
||||
QOIImageDecoderPlugin(NonnullOwnPtr<AK::Stream>);
|
||||
QOIImageDecoderPlugin(NonnullOwnPtr<Stream>);
|
||||
|
||||
OwnPtr<QOILoadingContext> m_context;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue