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

Unified Diff: chrome/browser/ui/views/ash/screenshot_taker.cc

Issue 10694003: Use capturing with XGetImage() only in screenshot_taker. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 6 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 | « no previous file | chrome/browser/ui/window_snapshot/window_snapshot_aura.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/views/ash/screenshot_taker.cc
diff --git a/chrome/browser/ui/views/ash/screenshot_taker.cc b/chrome/browser/ui/views/ash/screenshot_taker.cc
index e7659ec23dd08b66fd53ec8e6e80fef909f707e9..a0bda9ecae7e74d68beceaae063a8853b7a111e5 100644
--- a/chrome/browser/ui/views/ash/screenshot_taker.cc
+++ b/chrome/browser/ui/views/ash/screenshot_taker.cc
@@ -24,6 +24,7 @@
#include "chrome/browser/ui/window_snapshot/window_snapshot.h"
#include "chrome/common/pref_names.h"
#include "content/public/browser/browser_thread.h"
+#include "ui/aura/root_window.h"
#include "ui/aura/window.h"
#if defined(OS_CHROMEOS)
@@ -117,6 +118,20 @@ void SaveScreenshot(bool is_logged_in,
}
}
+bool GrabWindowSnapshot(aura::Window* window,
+ const gfx::Rect& snapshot_bounds,
+ std::vector<unsigned char>* png_data) {
+#if defined(OS_LINUX)
+ // We use XGetImage() for Linux/ChromeOS for performance reasons.
+ // See crbug.com/119492
+ // TODO(mukai): remove this when the performance issue has been fixed.
+ if (window->GetRootWindow()->GrabSnapshot(snapshot_bounds, png_data))
+ return true;
+#endif // OS_LINUX
+
+ return browser::GrabWindowSnapshot(window, png_data, snapshot_bounds);
+}
+
// How opaque should the layer that we flash onscreen to provide visual
// feedback after the screenshot is taken be?
const float kVisualFeedbackLayerOpacity = 0.25f;
@@ -145,7 +160,7 @@ void ScreenshotTaker::HandleTakePartialScreenshot(
bool use_24hour_clock = ShouldUse24HourClock();
- if (browser::GrabWindowSnapshot(window, &png_data->data(), rect)) {
+ if (GrabWindowSnapshot(window, rect, &png_data->data())) {
DisplayVisualFeedback(rect);
content::BrowserThread::PostTask(
content::BrowserThread::FILE, FROM_HERE,
« no previous file with comments | « no previous file | chrome/browser/ui/window_snapshot/window_snapshot_aura.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698