Commit 1f4e3218 authored by Jeremy Chinsen's avatar Jeremy Chinsen Committed by Commit Bot

Add handling for two-up view in PDFiumEngine::Paint().

Currently PDFiumEngine::Paint() takes a region of space, |leftover|,
that needs to be redrawn and iterates through the visible pages, drawing
them. A part of this process is recomputing the region of space that
needs to be redrawn. In two-up view, a page does not span the whole
width of the document so subtracting the page's area from |leftover|
does not result in a rectangle.

This CL makes PDFiumEngine::Paint() only recompute |leftover| if
|two_up_view_| is false, allowing PDFiumEngine to properly draw two-up
view layouts.

Bug: 51472
Change-Id: Ia7175d3182bd208e1b20c6ffe0a7f510ba2cff26
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1731925Reviewed-by: default avatarLei Zhang <thestig@chromium.org>
Commit-Queue: Jeremy Chinsen <chinsenj@google.com>
Cr-Commit-Position: refs/heads/master@{#684146}
parent 2f126759
...@@ -501,13 +501,19 @@ void PDFiumEngine::Paint(const pp::Rect& rect, ...@@ -501,13 +501,19 @@ void PDFiumEngine::Paint(const pp::Rect& rect,
// Compute the leftover dirty region. The first page may have blank space // Compute the leftover dirty region. The first page may have blank space
// above it, in which case we also need to subtract that space from the // above it, in which case we also need to subtract that space from the
// dirty region. // dirty region.
if (i == 0) { // If |two_up_view_|, we don't need to recompute |leftover| since
pp::Rect blank_space_in_screen = dirty_in_screen; // subtracting |leftover| with a two-up view page won't result in a
blank_space_in_screen.set_y(0); // rectangle.
blank_space_in_screen.set_height(dirty_in_screen.y()); if (!two_up_view_) {
leftover = leftover.Subtract(blank_space_in_screen); if (i == 0) {
pp::Rect blank_space_in_screen = dirty_in_screen;
blank_space_in_screen.set_y(0);
blank_space_in_screen.set_height(dirty_in_screen.y());
leftover = leftover.Subtract(blank_space_in_screen);
}
leftover = leftover.Subtract(dirty_in_screen);
} }
leftover = leftover.Subtract(dirty_in_screen);
if (pages_[index]->available()) { if (pages_[index]->available()) {
int progressive = GetProgressiveIndex(index); int progressive = GetProgressiveIndex(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