mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 15:57:35 +00:00
PDFViewer: Support a continuous page view mode
This commit is contained in:
parent
091c2cfdca
commit
3ecb41b7d9
5 changed files with 196 additions and 49 deletions
|
@ -23,6 +23,9 @@ struct Rectangle {
|
|||
float lower_left_y;
|
||||
float upper_right_x;
|
||||
float upper_right_y;
|
||||
|
||||
float width() const { return upper_right_x - lower_left_x; }
|
||||
float height() const { return upper_right_y - lower_left_y; }
|
||||
};
|
||||
|
||||
struct Page {
|
||||
|
|
|
@ -38,8 +38,8 @@ Renderer::Renderer(RefPtr<Document> document, Page const& page, RefPtr<Gfx::Bitm
|
|||
Gfx::AffineTransform userspace_matrix;
|
||||
userspace_matrix.translate(media_box.lower_left_x, media_box.lower_left_y);
|
||||
|
||||
float width = media_box.upper_right_x - media_box.lower_left_x;
|
||||
float height = media_box.upper_right_y - media_box.lower_left_y;
|
||||
float width = media_box.width();
|
||||
float height = media_box.height();
|
||||
float scale_x = static_cast<float>(bitmap->width()) / width;
|
||||
float scale_y = static_cast<float>(bitmap->height()) / height;
|
||||
userspace_matrix.scale(scale_x, scale_y);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue