0

PDF pinch zoom: Update layer transform for a zoom out after a zoom in.

Currently, whenever we pinch zoom out, we clear any layer transform and
reraster at the new zoom level. However, during a pinch zoom in (and
especially when slowly panning), we may get occasional zoom out events
which cause us to clear the layer transform. As the zoom in continues
we will then set the layer transform again. This repeated setting and
clearing causes noticeable jumping back and forth of the PDF content.

In this patch, when we get a pinch zoom out, if a layer transform is
already set due to a previous zoom in, we update the layer transform
instead of clearing it.

BUG=664157

Review-Url: https://codereview.chromium.org/2541903002
Cr-Commit-Position: refs/heads/master@{#436640}
This commit is contained in:
mcnee
2016-12-06 10:00:21 -08:00
committed by Commit bot
parent 1755f5a427
commit a6e4fc5905

@ -428,7 +428,13 @@ void OutOfProcessInstance::HandleMessage(const pp::Var& message) {
return;
}
if (pinch_phase == PINCH_UPDATE_ZOOM_IN) {
// When zooming in, we set a layer transform to avoid unneeded rerasters.
// Also, if we're zooming out and the last time we rerastered was when
// we were even further zoomed out (i.e. we pinch zoomed in and are now
// pinch zooming back out in the same gesture), we update the layer
// transform instead of rerastering.
if (pinch_phase == PINCH_UPDATE_ZOOM_IN ||
(pinch_phase == PINCH_UPDATE_ZOOM_OUT && zoom_ratio > 1.0)) {
if (!(dict.Get(pp::Var(kJSPinchX)).is_number() &&
dict.Get(pp::Var(kJSPinchY)).is_number() &&
dict.Get(pp::Var(kJSPinchVectorX)).is_number() &&