OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/ui/window_snapshot/window_snapshot.h" | 5 #include "chrome/browser/ui/window_snapshot/window_snapshot.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "third_party/skia/include/core/SkBitmap.h" | 8 #include "third_party/skia/include/core/SkBitmap.h" |
9 #include "ui/aura/window.h" | 9 #include "ui/aura/window.h" |
| 10 #include "ui/compositor/compositor.h" |
| 11 #include "ui/compositor/layer.h" |
10 #include "ui/gfx/codec/png_codec.h" | 12 #include "ui/gfx/codec/png_codec.h" |
11 #include "ui/gfx/compositor/compositor.h" | |
12 #include "ui/gfx/compositor/layer.h" | |
13 #include "ui/gfx/rect.h" | 13 #include "ui/gfx/rect.h" |
14 | 14 |
15 namespace browser { | 15 namespace browser { |
16 | 16 |
17 bool GrabWindowSnapshot(gfx::NativeWindow window, | 17 bool GrabWindowSnapshot(gfx::NativeWindow window, |
18 std::vector<unsigned char>* png_representation, | 18 std::vector<unsigned char>* png_representation, |
19 const gfx::Rect& snapshot_bounds) { | 19 const gfx::Rect& snapshot_bounds) { |
20 ui::Compositor* compositor = window->layer()->GetCompositor(); | 20 ui::Compositor* compositor = window->layer()->GetCompositor(); |
21 | 21 |
22 gfx::Rect read_pixels_bounds = snapshot_bounds; | 22 gfx::Rect read_pixels_bounds = snapshot_bounds; |
(...skipping 16 matching lines...) Expand all Loading... |
39 | 39 |
40 gfx::PNGCodec::Encode(pixels, gfx::PNGCodec::FORMAT_BGRA, | 40 gfx::PNGCodec::Encode(pixels, gfx::PNGCodec::FORMAT_BGRA, |
41 snapshot_bounds.size(), | 41 snapshot_bounds.size(), |
42 bitmap.rowBytes(), true, | 42 bitmap.rowBytes(), true, |
43 std::vector<gfx::PNGCodec::Comment>(), | 43 std::vector<gfx::PNGCodec::Comment>(), |
44 png_representation); | 44 png_representation); |
45 return true; | 45 return true; |
46 } | 46 } |
47 | 47 |
48 } // namespace browser | 48 } // namespace browser |
OLD | NEW |