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

Unified Diff: ui/snapshot/snapshot_android.cc

Issue 2219823002: Move content offset to ViewAndroid (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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
Index: ui/snapshot/snapshot_android.cc
diff --git a/ui/snapshot/snapshot_android.cc b/ui/snapshot/snapshot_android.cc
index e56ab7399f61f9981393bbdf91306a7ee7bfda1d..cd0af62f45ac131690facc80166dd10d128d6d4f 100644
--- a/ui/snapshot/snapshot_android.cc
+++ b/ui/snapshot/snapshot_android.cc
@@ -37,6 +37,7 @@ bool GrabWindowSnapshot(gfx::NativeWindow window,
static void MakeAsyncCopyRequest(
gfx::NativeWindow window,
+ const gfx::Vector2dF& offset,
const gfx::Rect& source_rect,
const cc::CopyOutputRequest::CopyOutputRequestCallback& callback) {
std::unique_ptr<cc::CopyOutputRequest> request =
@@ -49,7 +50,6 @@ static void MakeAsyncCopyRequest(
gfx::ScaleToEnclosingRect(source_rect, device_scale_factor);
// Account for the toolbar offset.
- gfx::Vector2dF offset = window->content_offset();
gfx::Rect adjusted_source_rect(gfx::ToRoundedPoint(
gfx::PointF(source_rect_in_pixel.x() + offset.x(),
source_rect_in_pixel.y() + offset.y())),
no sievers 2016/08/05 19:32:12 Argh, this code makes no sense. The caller passes
no sievers 2016/08/05 19:38:26 Ah sorry, I was slightly off: gfx::Rect RenderWid
@@ -66,6 +66,7 @@ void GrabWindowSnapshotAndScaleAsync(
scoped_refptr<base::TaskRunner> background_task_runner,
const GrabWindowSnapshotAsyncCallback& callback) {
MakeAsyncCopyRequest(window,
+ window->content_offset(),
source_rect,
base::Bind(&SnapshotAsync::ScaleCopyOutputResult,
callback,
@@ -79,6 +80,7 @@ void GrabWindowSnapshotAsync(
scoped_refptr<base::TaskRunner> background_task_runner,
const GrabWindowSnapshotAsyncPNGCallback& callback) {
MakeAsyncCopyRequest(window,
+ window->content_offset(),
source_rect,
base::Bind(&SnapshotAsync::EncodeCopyOutputResult,
callback,
@@ -90,8 +92,12 @@ void GrabViewSnapshotAsync(
const gfx::Rect& source_rect,
scoped_refptr<base::TaskRunner> background_task_runner,
const GrabWindowSnapshotAsyncPNGCallback& callback) {
- GrabWindowSnapshotAsync(
- view->GetWindowAndroid(), source_rect, background_task_runner, callback);
+ MakeAsyncCopyRequest(view->GetWindowAndroid(),
+ view->content_offset(),
+ source_rect,
+ base::Bind(&SnapshotAsync::EncodeCopyOutputResult,
+ callback,
+ background_task_runner));
}
} // namespace ui
« content/browser/android/content_view_core_impl.cc ('K') | « ui/android/window_android.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698