Commit ac1759e6 authored by Jeremy Chinsen's avatar Jeremy Chinsen Committed by Commit Bot

Add bottom-side logic for two-up view to PDFiumEngine::FillPageSides().

Currently the logic in PDFiumEngine::FillPageSides() for drawing the
empty space below a page only handles single-up view. In two-up view,
a page may be shorter than the one adjacent to it. In this case, the
bottom gap must have height as tall as the difference in the adjacent
pages' height.

This CL changes FillPageSides() such that when |two_up_view_| is true,
it calls draw_utils::GetBottomGapBetweenRects() with the current page
and |dirty_in_screen|, computing the space of |dirty_in_screen| that
is below the page, and finally drawing it as empty space. This allows
FillPageSides() to properly draw the bottom empty space for a page in
two-up view.

Bug: 51472
Change-Id: Idd01fd959419fd8aebc2f70f514eb83ba61c160c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1720792Reviewed-by: default avatarLei Zhang <thestig@chromium.org>
Commit-Queue: Jeremy Chinsen <chinsenj@google.com>
Cr-Commit-Position: refs/heads/master@{#682548}
parent d6d555f7
......@@ -2830,13 +2830,29 @@ void PDFiumEngine::FillPageSides(int progressive_index) {
right.height(), client_->GetBackgroundColor());
}
pp::Rect bottom =
draw_utils::GetBottomFillRect(page_rect, inset_sizes, kBottomSeparator);
bottom = GetScreenRect(bottom).Intersect(dirty_in_screen);
pp::Rect bottom_in_screen;
if (two_up_view_) {
pp::Rect page_in_screen = GetScreenRect(page_rect);
bottom_in_screen = draw_utils::GetBottomGapBetweenRects(
page_in_screen.bottom(), dirty_in_screen);
if (page_index % 2 == 1) {
// Only draw over the right two-up view column with empty space.
bottom_in_screen.set_width(bottom_in_screen.width() / 2);
bottom_in_screen.set_x(page_in_screen.x());
}
bottom_in_screen = bottom_in_screen.Intersect(dirty_in_screen);
} else {
bottom_in_screen = GetScreenRect(draw_utils::GetBottomFillRect(
page_rect, inset_sizes, kBottomSeparator));
bottom_in_screen = bottom_in_screen.Intersect(dirty_in_screen);
}
FPDFBitmap_FillRect(bitmap, bottom.x() - dirty_in_screen.x(),
bottom.y() - dirty_in_screen.y(), bottom.width(),
bottom.height(), client_->GetBackgroundColor());
FPDFBitmap_FillRect(bitmap, bottom_in_screen.x() - dirty_in_screen.x(),
bottom_in_screen.y() - dirty_in_screen.y(),
bottom_in_screen.width(), bottom_in_screen.height(),
client_->GetBackgroundColor());
}
void PDFiumEngine::PaintPageShadow(int progressive_index,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment