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

Unified Diff: ui/snapshot/snapshot_aura.cc

Issue 127103002: Make WindowReachedScreen support async readback (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Mac /o\ Created 6 years, 11 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 | « ui/snapshot/snapshot_android.cc ('k') | ui/snapshot/snapshot_aura_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/snapshot/snapshot_aura.cc
diff --git a/ui/snapshot/snapshot_aura.cc b/ui/snapshot/snapshot_aura.cc
index 25eb73ee1701457462b2648b9d8e6a00692e8ad1..94963f3602a8402288310efef7b230011af1397a 100644
--- a/ui/snapshot/snapshot_aura.cc
+++ b/ui/snapshot/snapshot_aura.cc
@@ -177,26 +177,8 @@ bool GrabViewSnapshot(gfx::NativeView view,
bool GrabWindowSnapshot(gfx::NativeWindow window,
std::vector<unsigned char>* png_representation,
const gfx::Rect& snapshot_bounds) {
- gfx::Rect read_pixels_bounds_in_pixel =
- GetTargetBoundsFromWindow(window, snapshot_bounds);
-
- ui::Compositor* compositor = window->layer()->GetCompositor();
- SkBitmap bitmap;
- if (!compositor->ReadPixels(&bitmap, read_pixels_bounds_in_pixel))
- return false;
-
- gfx::Display display =
- gfx::Screen::GetScreenFor(window)->GetDisplayNearestWindow(window);
- RotateBitmap(&bitmap, display.rotation());
-
- unsigned char* pixels = reinterpret_cast<unsigned char*>(
- bitmap.pixelRef()->pixels());
- return gfx::PNGCodec::Encode(
- pixels, gfx::PNGCodec::FORMAT_BGRA,
- gfx::Size(bitmap.width(), bitmap.height()),
- base::checked_numeric_cast<int>(bitmap.rowBytes()),
- true, std::vector<gfx::PNGCodec::Comment>(),
- png_representation);
+ // Not supported in Aura. Callers should fall back to the async version.
+ return false;
}
void MakeAsyncCopyRequest(
@@ -261,4 +243,13 @@ void GrabWindowSnapshotAsync(
background_task_runner));
}
+void GrabViewSnapshotAsync(
+ gfx::NativeView view,
+ const gfx::Rect& source_rect,
+ scoped_refptr<base::TaskRunner> background_task_runner,
+ const GrabWindowSnapshotAsyncPNGCallback& callback) {
+ GrabWindowSnapshotAsync(view, source_rect, background_task_runner, callback);
+}
+
+
} // namespace ui
« no previous file with comments | « ui/snapshot/snapshot_android.cc ('k') | ui/snapshot/snapshot_aura_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698