mirror of
https://github.com/RGBCube/serenity
synced 2025-07-13 18:47:35 +00:00
LibGfx+PDFViewer: Add RotationDirection::Flip and use it in PDFViewer
No behavior change.
This commit is contained in:
parent
5b223080ae
commit
29f5182e51
3 changed files with 22 additions and 10 deletions
|
@ -350,15 +350,13 @@ PDF::PDFErrorOr<NonnullRefPtr<Gfx::Bitmap>> PDFViewer::render_page(u32 page_inde
|
|||
return bitmap;
|
||||
}
|
||||
|
||||
if (page.rotate + m_rotations != 0) {
|
||||
int rotation_count = ((page.rotate + m_rotations) / 90) % 4;
|
||||
if (rotation_count == 3) {
|
||||
bitmap = TRY(bitmap->rotated(Gfx::RotationDirection::CounterClockwise));
|
||||
} else {
|
||||
for (int i = 0; i < rotation_count; i++)
|
||||
bitmap = TRY(bitmap->rotated(Gfx::RotationDirection::Clockwise));
|
||||
}
|
||||
}
|
||||
int rotation_count = ((page.rotate + m_rotations) / 90) % 4;
|
||||
if (rotation_count == 1)
|
||||
bitmap = TRY(bitmap->rotated(Gfx::RotationDirection::Clockwise));
|
||||
else if (rotation_count == 2)
|
||||
bitmap = TRY(bitmap->rotated(Gfx::RotationDirection::Flip));
|
||||
else if (rotation_count == 3)
|
||||
bitmap = TRY(bitmap->rotated(Gfx::RotationDirection::CounterClockwise));
|
||||
|
||||
return bitmap;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue