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 "ui/aura/root_window.h" | 5 #include "ui/aura/root_window.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
439 scoped_refptr<CompositorLock> RootWindow::GetCompositorLock() { | 439 scoped_refptr<CompositorLock> RootWindow::GetCompositorLock() { |
440 if (!compositor_lock_) | 440 if (!compositor_lock_) |
441 compositor_lock_ = new CompositorLock(this); | 441 compositor_lock_ = new CompositorLock(this); |
442 return compositor_lock_; | 442 return compositor_lock_; |
443 } | 443 } |
444 | 444 |
445 void RootWindow::SetFocusWhenShown(bool focused) { | 445 void RootWindow::SetFocusWhenShown(bool focused) { |
446 host_->SetFocusWhenShown(focused); | 446 host_->SetFocusWhenShown(focused); |
447 } | 447 } |
448 | 448 |
| 449 bool RootWindow::CopyAreaToSkCanvas(const gfx::Rect& source_bounds, |
| 450 const gfx::Point& dest_offset, |
| 451 SkCanvas* canvas) { |
| 452 DCHECK(canvas); |
| 453 DCHECK(bounds().Contains(source_bounds)); |
| 454 gfx::Rect source_pixels = ui::ConvertRectToPixel(layer(), source_bounds); |
| 455 return host_->CopyAreaToSkCanvas(source_pixels, dest_offset, canvas); |
| 456 } |
| 457 |
449 bool RootWindow::GrabSnapshot(const gfx::Rect& snapshot_bounds, | 458 bool RootWindow::GrabSnapshot(const gfx::Rect& snapshot_bounds, |
450 std::vector<unsigned char>* png_representation) { | 459 std::vector<unsigned char>* png_representation) { |
| 460 DCHECK(png_representation); |
451 DCHECK(bounds().Contains(snapshot_bounds)); | 461 DCHECK(bounds().Contains(snapshot_bounds)); |
452 gfx::Rect snapshot_pixels = ui::ConvertRectToPixel(layer(), snapshot_bounds); | 462 gfx::Rect snapshot_pixels = ui::ConvertRectToPixel(layer(), snapshot_bounds); |
453 return host_->GrabSnapshot(snapshot_pixels, png_representation); | 463 return host_->GrabSnapshot(snapshot_pixels, png_representation); |
454 } | 464 } |
455 | 465 |
456 gfx::Point RootWindow::GetLastMouseLocationInRoot() const { | 466 gfx::Point RootWindow::GetLastMouseLocationInRoot() const { |
457 gfx::Point location = Env::GetInstance()->last_mouse_location(); | 467 gfx::Point location = Env::GetInstance()->last_mouse_location(); |
458 client::ScreenPositionClient* client = client::GetScreenPositionClient(this); | 468 client::ScreenPositionClient* client = client::GetScreenPositionClient(this); |
459 if (client) | 469 if (client) |
460 client->ConvertPointFromScreen(this, &location); | 470 client->ConvertPointFromScreen(this, &location); |
(...skipping 610 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1071 void RootWindow::UnlockCompositor() { | 1081 void RootWindow::UnlockCompositor() { |
1072 DCHECK(compositor_lock_); | 1082 DCHECK(compositor_lock_); |
1073 compositor_lock_ = NULL; | 1083 compositor_lock_ = NULL; |
1074 if (draw_on_compositor_unlock_) { | 1084 if (draw_on_compositor_unlock_) { |
1075 draw_on_compositor_unlock_ = false; | 1085 draw_on_compositor_unlock_ = false; |
1076 ScheduleDraw(); | 1086 ScheduleDraw(); |
1077 } | 1087 } |
1078 } | 1088 } |
1079 | 1089 |
1080 } // namespace aura | 1090 } // namespace aura |
OLD | NEW |