Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Unified Diff: pdf/out_of_process_instance.cc

Issue 2764353002: PDF Viewer pinch zoom: Compute the zoom needed for the paint offset. (Closed)
Patch Set: Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pdf/out_of_process_instance.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pdf/out_of_process_instance.cc
diff --git a/pdf/out_of_process_instance.cc b/pdf/out_of_process_instance.cc
index 5d90b39620b55a0d1834550f98e12d208eb1f3b6..2b271b5bf2f592d598a5de67dede7e76967cb101 100644
--- a/pdf/out_of_process_instance.cc
+++ b/pdf/out_of_process_instance.cc
@@ -283,7 +283,6 @@ OutOfProcessInstance::OutOfProcessInstance(PP_Instance instance)
zoom_(1.0),
needs_reraster_(true),
last_bitmap_smaller_(false),
- last_zoom_when_smaller_(1.0),
device_scale_(1.0),
full_(false),
paint_manager_(this, this, true),
@@ -466,13 +465,14 @@ void OutOfProcessInstance::HandleMessage(const pp::Var& message) {
starting_scroll_offset_.y() * zoom_ratio / initial_zoom_ratio_));
pinch_vector = pp::Point();
- last_zoom_when_smaller_ = zoom;
last_bitmap_smaller_ = true;
} else if (last_bitmap_smaller_) {
pinch_center = pp::Point((plugin_size_.width() / device_scale_) / 2,
(plugin_size_.height() / device_scale_) / 2);
+ const double zoom_when_doc_covers_plugin_width =
+ zoom_ * plugin_size_.width() / GetDocumentPixelWidth();
paint_offset = pp::Point(
- (1 - zoom / last_zoom_when_smaller_) * pinch_center.x(),
+ (1 - zoom / zoom_when_doc_covers_plugin_width) * pinch_center.x(),
(1 - zoom_ratio) * pinch_center.y());
pinch_vector = pp::Point();
scroll_delta = pp::Point(
« no previous file with comments | « pdf/out_of_process_instance.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698