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

Unified Diff: ui/snapshot/snapshot_android.cc

Issue 462173002: Fix set_area sizes for RequestCopyOfOutput, and related tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: RWHVBrowserTest changes, per danakj's comments. Disabled tests on Windows. Created 6 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 aec755516c87e029bd495bc165412b0636f17435..ccf2a20dda1aaab180d7aef0bcee21916691b332 100644
--- a/ui/snapshot/snapshot_android.cc
+++ b/ui/snapshot/snapshot_android.cc
@@ -10,10 +10,7 @@
#include "ui/base/android/view_android.h"
#include "ui/base/android/window_android.h"
#include "ui/base/android/window_android_compositor.h"
-#include "ui/gfx/display.h"
#include "ui/gfx/geometry/point_conversions.h"
-#include "ui/gfx/geometry/rect_conversions.h"
-#include "ui/gfx/screen.h"
#include "ui/snapshot/snapshot_async.h"
namespace ui {
@@ -39,18 +36,12 @@ static void MakeAsyncCopyRequest(
scoped_ptr<cc::CopyOutputRequest> request =
cc::CopyOutputRequest::CreateBitmapRequest(callback);
- const gfx::Display& display =
- gfx::Screen::GetNativeScreen()->GetPrimaryDisplay();
- float device_scale_factor = display.device_scale_factor();
- gfx::Rect source_rect_in_pixel =
- gfx::ToEnclosingRect(gfx::ScaleRect(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())),
- source_rect_in_pixel.size());
+ gfx::Rect adjusted_source_rect(
+ gfx::ToRoundedPoint(gfx::PointF(source_rect.x() + offset.x(),
+ source_rect.y() + offset.y())),
+ source_rect.size());
request->set_area(adjusted_source_rect);
window->GetCompositor()->RequestCopyOfOutputOnRootLayer(request.Pass());

Powered by Google App Engine
This is Rietveld 408576698