summaryrefslogtreecommitdiffstats
path: root/chrome/browser/ui/window_snapshot
diff options
context:
space:
mode:
authorvollick@chromium.org <vollick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-02-21 16:53:37 +0000
committervollick@chromium.org <vollick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-02-21 16:53:37 +0000
commit080f4e7daed8ab3a71bb32ed90c0edfd1845f848 (patch)
tree4a13f03816cfaffa17938f550e2b6684880bdf22 /chrome/browser/ui/window_snapshot
parentafd762f6459a6a1b73ead023cb4aa22eddc89f9b (diff)
downloadchromium_src-080f4e7daed8ab3a71bb32ed90c0edfd1845f848.zip
chromium_src-080f4e7daed8ab3a71bb32ed90c0edfd1845f848.tar.gz
chromium_src-080f4e7daed8ab3a71bb32ed90c0edfd1845f848.tar.bz2
Don't tell the compositor that the widget has resized in compact WM
If the compositor is told that the widget has resized to something quite large, the ui is scaled down to fit. It looks like this is no longer necessary. BUG=113729 TEST=start chrome with --aura-window-mode=compact and notice that the ui does not shrink when you open many windows. Review URL: http://codereview.chromium.org/9420030 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@122832 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/ui/window_snapshot')
-rw-r--r--chrome/browser/ui/window_snapshot/window_snapshot_aura.cc21
1 files changed, 11 insertions, 10 deletions
diff --git a/chrome/browser/ui/window_snapshot/window_snapshot_aura.cc b/chrome/browser/ui/window_snapshot/window_snapshot_aura.cc
index 7c8377e..7636c8a 100644
--- a/chrome/browser/ui/window_snapshot/window_snapshot_aura.cc
+++ b/chrome/browser/ui/window_snapshot/window_snapshot_aura.cc
@@ -19,20 +19,21 @@ bool GrabWindowSnapshot(gfx::NativeWindow window,
const gfx::Rect& snapshot_bounds) {
ui::Compositor* compositor = window->layer()->GetCompositor();
- gfx::Rect desktop_snapshot_bounds = gfx::Rect(
- snapshot_bounds.origin().Add(window->bounds().origin()),
- snapshot_bounds.size());
+ gfx::Rect read_pixels_bounds = snapshot_bounds;
- DCHECK_LE(desktop_snapshot_bounds.right() , compositor->size().width());
- DCHECK_LE(desktop_snapshot_bounds.bottom(), compositor->size().height());
+ // When not in compact mode we must take into account the window's position on
+ // the desktop.
+ if (!ash::Shell::GetInstance()->IsWindowModeCompact())
+ read_pixels_bounds.set_origin(
+ snapshot_bounds.origin().Add(window->bounds().origin()));
- // When in compact mode, only take the snapshot for one window.
- bool is_compact = ash::Shell::GetInstance()->IsWindowModeCompact();
+ DCHECK_GE(compositor->size().width(), read_pixels_bounds.right());
+ DCHECK_GE(compositor->size().height(), read_pixels_bounds.bottom());
+ DCHECK_LE(0, read_pixels_bounds.x());
+ DCHECK_LE(0, read_pixels_bounds.y());
SkBitmap bitmap;
- if (!compositor->ReadPixels(
- &bitmap,
- is_compact ? snapshot_bounds : desktop_snapshot_bounds))
+ if (!compositor->ReadPixels(&bitmap, read_pixels_bounds))
return false;
unsigned char* pixels = reinterpret_cast<unsigned char*>(bitmap.getPixels());