mirror of
https://github.com/RGBCube/serenity
synced 2025-07-24 14:27:35 +00:00
LibGfx: Minor changes to adhere to code style guidelines
This commit is contained in:
parent
e159370ccb
commit
76cbfe1c38
1 changed files with 11 additions and 11 deletions
|
@ -161,8 +161,8 @@ public:
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
// Read code bits using a 32-bit mask. If current code size > 9 bits
|
// Extract the code bits using a 32-bit mask to cover the possibility that if
|
||||||
// then it's possible the code spans 3 bytes.
|
// the current code size > 9 bits then the code can span 3 bytes.
|
||||||
u8 current_bit_offset = m_current_bit_index % 8;
|
u8 current_bit_offset = m_current_bit_index % 8;
|
||||||
u32 mask = (u32)(pow(2, m_code_size) - 1) << current_bit_offset;
|
u32 mask = (u32)(pow(2, m_code_size) - 1) << current_bit_offset;
|
||||||
|
|
||||||
|
@ -410,12 +410,12 @@ bool load_gif_impl(GIFLoadingContext& context)
|
||||||
LZWDecoder decoder(image.lzw_encoded_bytes, image.lzw_min_code_size);
|
LZWDecoder decoder(image.lzw_encoded_bytes, image.lzw_min_code_size);
|
||||||
|
|
||||||
// Add GIF-specific control codes
|
// Add GIF-specific control codes
|
||||||
const int CLEAR_CODE = decoder.add_control_code();
|
const int clear_code = decoder.add_control_code();
|
||||||
const int END_OF_INFORMATION_CODE = decoder.add_control_code();
|
const int end_of_information_code = decoder.add_control_code();
|
||||||
|
|
||||||
auto bitmap = Bitmap::create_purgeable(BitmapFormat::RGBA32, { image.width, image.height });
|
auto bitmap = Bitmap::create_purgeable(BitmapFormat::RGBA32, { image.width, image.height });
|
||||||
|
|
||||||
int pixel_idx = 0;
|
int pixel_index = 0;
|
||||||
while (true) {
|
while (true) {
|
||||||
Optional<u16> code = decoder.next_code();
|
Optional<u16> code = decoder.next_code();
|
||||||
if (!code.has_value()) {
|
if (!code.has_value()) {
|
||||||
|
@ -423,24 +423,24 @@ bool load_gif_impl(GIFLoadingContext& context)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (code.value() == CLEAR_CODE) {
|
if (code.value() == clear_code) {
|
||||||
decoder.reset();
|
decoder.reset();
|
||||||
continue;
|
continue;
|
||||||
} else if (code.value() == END_OF_INFORMATION_CODE) {
|
} else if (code.value() == end_of_information_code) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto colors = decoder.get_output();
|
auto colors = decoder.get_output();
|
||||||
|
|
||||||
for (size_t i = 0; i < colors.size(); ++i, ++pixel_idx) {
|
for (const auto& color : colors) {
|
||||||
auto color = colors.at(i);
|
|
||||||
auto rgb = logical_screen.color_map[color];
|
auto rgb = logical_screen.color_map[color];
|
||||||
|
|
||||||
int x = pixel_idx % image.width;
|
int x = pixel_index % image.width;
|
||||||
int y = pixel_idx / image.width;
|
int y = pixel_index / image.width;
|
||||||
|
|
||||||
Color c = Color(rgb.r, rgb.g, rgb.b);
|
Color c = Color(rgb.r, rgb.g, rgb.b);
|
||||||
bitmap->set_pixel(x, y, c);
|
bitmap->set_pixel(x, y, c);
|
||||||
|
++pixel_index;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue