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 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
396 base::Bind(&RootWindow::DispatchHeldMouseMove, | 396 base::Bind(&RootWindow::DispatchHeldMouseMove, |
397 held_mouse_event_factory_.GetWeakPtr())); | 397 held_mouse_event_factory_.GetWeakPtr())); |
398 } | 398 } |
399 TRACE_EVENT_ASYNC_END0("ui", "RootWindow::HoldMouseMoves", this); | 399 TRACE_EVENT_ASYNC_END0("ui", "RootWindow::HoldMouseMoves", this); |
400 } | 400 } |
401 | 401 |
402 void RootWindow::SetFocusWhenShown(bool focused) { | 402 void RootWindow::SetFocusWhenShown(bool focused) { |
403 host_->SetFocusWhenShown(focused); | 403 host_->SetFocusWhenShown(focused); |
404 } | 404 } |
405 | 405 |
| 406 bool RootWindow::CopyAreaToSkCanvas(const gfx::Rect& source_bounds, |
| 407 const gfx::Point& dest_offset, |
| 408 SkCanvas* canvas) { |
| 409 DCHECK(canvas); |
| 410 DCHECK(bounds().Contains(source_bounds)); |
| 411 gfx::Rect source_pixels = ui::ConvertRectToPixel(layer(), source_bounds); |
| 412 return host_->CopyAreaToSkCanvas(source_pixels, dest_offset, canvas); |
| 413 } |
| 414 |
406 bool RootWindow::GrabSnapshot(const gfx::Rect& snapshot_bounds, | 415 bool RootWindow::GrabSnapshot(const gfx::Rect& snapshot_bounds, |
407 std::vector<unsigned char>* png_representation) { | 416 std::vector<unsigned char>* png_representation) { |
| 417 DCHECK(png_representation); |
408 DCHECK(bounds().Contains(snapshot_bounds)); | 418 DCHECK(bounds().Contains(snapshot_bounds)); |
409 gfx::Rect snapshot_pixels = ui::ConvertRectToPixel(layer(), snapshot_bounds); | 419 gfx::Rect snapshot_pixels = ui::ConvertRectToPixel(layer(), snapshot_bounds); |
410 return host_->GrabSnapshot(snapshot_pixels, png_representation); | 420 return host_->GrabSnapshot(snapshot_pixels, png_representation); |
411 } | 421 } |
412 | 422 |
413 gfx::Point RootWindow::GetLastMouseLocationInRoot() const { | 423 gfx::Point RootWindow::GetLastMouseLocationInRoot() const { |
414 gfx::Point location = Env::GetInstance()->last_mouse_location(); | 424 gfx::Point location = Env::GetInstance()->last_mouse_location(); |
415 client::ScreenPositionClient* client = client::GetScreenPositionClient(this); | 425 client::ScreenPositionClient* client = client::GetScreenPositionClient(this); |
416 if (client) | 426 if (client) |
417 client->ConvertPointFromScreen(this, &location); | 427 client->ConvertPointFromScreen(this, &location); |
(...skipping 599 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1017 ui::MouseEvent event(ui::ET_MOUSE_MOVED, | 1027 ui::MouseEvent event(ui::ET_MOUSE_MOVED, |
1018 orig_mouse_location, | 1028 orig_mouse_location, |
1019 orig_mouse_location, | 1029 orig_mouse_location, |
1020 ui::EF_IS_SYNTHESIZED); | 1030 ui::EF_IS_SYNTHESIZED); |
1021 event.set_system_location(Env::GetInstance()->last_mouse_location()); | 1031 event.set_system_location(Env::GetInstance()->last_mouse_location()); |
1022 OnHostMouseEvent(&event); | 1032 OnHostMouseEvent(&event); |
1023 #endif | 1033 #endif |
1024 } | 1034 } |
1025 | 1035 |
1026 } // namespace aura | 1036 } // namespace aura |
OLD | NEW |