mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 08:37:45 +00:00
LibGfx/TIFF: Rename ImageHeight
=> ImageLength
This is the name used in the TIFF specification. No behavior change.
This commit is contained in:
parent
f5e7ee8d4a
commit
c4e8e5c4a6
2 changed files with 7 additions and 7 deletions
|
@ -102,7 +102,7 @@ public:
|
||||||
|
|
||||||
IntSize size() const
|
IntSize size() const
|
||||||
{
|
{
|
||||||
return ExifOrientedBitmap::oriented_size({ *m_metadata.image_width(), *m_metadata.image_height() }, *m_metadata.orientation());
|
return ExifOrientedBitmap::oriented_size({ *m_metadata.image_width(), *m_metadata.image_length() }, *m_metadata.orientation());
|
||||||
}
|
}
|
||||||
|
|
||||||
ExifMetadata const& metadata() const
|
ExifMetadata const& metadata() const
|
||||||
|
@ -267,25 +267,25 @@ private:
|
||||||
{
|
{
|
||||||
auto const strips_offset = *m_metadata.strip_offsets();
|
auto const strips_offset = *m_metadata.strip_offsets();
|
||||||
auto const strip_byte_counts = *m_metadata.strip_byte_counts();
|
auto const strip_byte_counts = *m_metadata.strip_byte_counts();
|
||||||
auto const rows_per_strip = m_metadata.rows_per_strip().value_or(*m_metadata.image_height());
|
auto const rows_per_strip = m_metadata.rows_per_strip().value_or(*m_metadata.image_length());
|
||||||
|
|
||||||
Variant<ExifOrientedBitmap, ExifOrientedCMYKBitmap> oriented_bitmap = TRY(([&]() -> ErrorOr<Variant<ExifOrientedBitmap, ExifOrientedCMYKBitmap>> {
|
Variant<ExifOrientedBitmap, ExifOrientedCMYKBitmap> oriented_bitmap = TRY(([&]() -> ErrorOr<Variant<ExifOrientedBitmap, ExifOrientedCMYKBitmap>> {
|
||||||
if (metadata().photometric_interpretation() == PhotometricInterpretation::CMYK)
|
if (metadata().photometric_interpretation() == PhotometricInterpretation::CMYK)
|
||||||
return ExifOrientedCMYKBitmap::create(*metadata().orientation(), { *metadata().image_width(), *metadata().image_height() });
|
return ExifOrientedCMYKBitmap::create(*metadata().orientation(), { *metadata().image_width(), *metadata().image_length() });
|
||||||
return ExifOrientedBitmap::create(*metadata().orientation(), { *metadata().image_width(), *metadata().image_height() }, BitmapFormat::BGRA8888);
|
return ExifOrientedBitmap::create(*metadata().orientation(), { *metadata().image_width(), *metadata().image_length() }, BitmapFormat::BGRA8888);
|
||||||
}()));
|
}()));
|
||||||
|
|
||||||
for (u32 strip_index = 0; strip_index < strips_offset.size(); ++strip_index) {
|
for (u32 strip_index = 0; strip_index < strips_offset.size(); ++strip_index) {
|
||||||
TRY(m_stream->seek(strips_offset[strip_index]));
|
TRY(m_stream->seek(strips_offset[strip_index]));
|
||||||
|
|
||||||
auto const rows_in_strip = strip_index < strips_offset.size() - 1 ? rows_per_strip : *m_metadata.image_height() - rows_per_strip * strip_index;
|
auto const rows_in_strip = strip_index < strips_offset.size() - 1 ? rows_per_strip : *m_metadata.image_length() - rows_per_strip * strip_index;
|
||||||
auto const decoded_bytes = TRY(strip_decoder(strip_byte_counts[strip_index], rows_in_strip));
|
auto const decoded_bytes = TRY(strip_decoder(strip_byte_counts[strip_index], rows_in_strip));
|
||||||
auto decoded_strip = make<FixedMemoryStream>(decoded_bytes);
|
auto decoded_strip = make<FixedMemoryStream>(decoded_bytes);
|
||||||
auto decoded_stream = make<BigEndianInputBitStream>(move(decoded_strip));
|
auto decoded_stream = make<BigEndianInputBitStream>(move(decoded_strip));
|
||||||
|
|
||||||
for (u32 row = 0; row < rows_per_strip; row++) {
|
for (u32 row = 0; row < rows_per_strip; row++) {
|
||||||
auto const scanline = row + rows_per_strip * strip_index;
|
auto const scanline = row + rows_per_strip * strip_index;
|
||||||
if (scanline >= *m_metadata.image_height())
|
if (scanline >= *m_metadata.image_length())
|
||||||
break;
|
break;
|
||||||
|
|
||||||
Optional<Color> last_color {};
|
Optional<Color> last_color {};
|
||||||
|
|
|
@ -124,7 +124,7 @@ Tag = namedtuple(
|
||||||
# FIXME: Some tag have only a few allowed values, we should ensure that
|
# FIXME: Some tag have only a few allowed values, we should ensure that
|
||||||
known_tags: List[Tag] = [
|
known_tags: List[Tag] = [
|
||||||
Tag('256', [TIFFType.UnsignedShort, TIFFType.UnsignedLong], [1], None, "ImageWidth", is_required=True),
|
Tag('256', [TIFFType.UnsignedShort, TIFFType.UnsignedLong], [1], None, "ImageWidth", is_required=True),
|
||||||
Tag('257', [TIFFType.UnsignedShort, TIFFType.UnsignedLong], [1], None, "ImageHeight", is_required=True),
|
Tag('257', [TIFFType.UnsignedShort, TIFFType.UnsignedLong], [1], None, "ImageLength", is_required=True),
|
||||||
Tag('258', [TIFFType.UnsignedShort], [], None, "BitsPerSample", is_required=True),
|
Tag('258', [TIFFType.UnsignedShort], [], None, "BitsPerSample", is_required=True),
|
||||||
Tag('259', [TIFFType.UnsignedShort], [1], None, "Compression", Compression, is_required=True),
|
Tag('259', [TIFFType.UnsignedShort], [1], None, "Compression", Compression, is_required=True),
|
||||||
Tag('262', [TIFFType.UnsignedShort], [1], None, "PhotometricInterpretation",
|
Tag('262', [TIFFType.UnsignedShort], [1], None, "PhotometricInterpretation",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue