| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "ash/laser/laser_pointer_view.h" | 5 #include "ash/laser/laser_pointer_view.h" |
| 6 | 6 |
| 7 #include <GLES2/gl2.h> | 7 #include <GLES2/gl2.h> |
| 8 #include <GLES2/gl2ext.h> | 8 #include <GLES2/gl2ext.h> |
| 9 #include <GLES2/gl2extchromium.h> | 9 #include <GLES2/gl2extchromium.h> |
| 10 | 10 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 #include "cc/resources/transferable_resource.h" | 27 #include "cc/resources/transferable_resource.h" |
| 28 #include "cc/surfaces/surface.h" | 28 #include "cc/surfaces/surface.h" |
| 29 #include "cc/surfaces/surface_manager.h" | 29 #include "cc/surfaces/surface_manager.h" |
| 30 #include "gpu/command_buffer/client/context_support.h" | 30 #include "gpu/command_buffer/client/context_support.h" |
| 31 #include "gpu/command_buffer/client/gles2_interface.h" | 31 #include "gpu/command_buffer/client/gles2_interface.h" |
| 32 #include "gpu/command_buffer/client/gpu_memory_buffer_manager.h" | 32 #include "gpu/command_buffer/client/gpu_memory_buffer_manager.h" |
| 33 #include "third_party/skia/include/core/SkColor.h" | 33 #include "third_party/skia/include/core/SkColor.h" |
| 34 #include "third_party/skia/include/core/SkTypes.h" | 34 #include "third_party/skia/include/core/SkTypes.h" |
| 35 #include "ui/aura/env.h" | 35 #include "ui/aura/env.h" |
| 36 #include "ui/aura/window.h" | 36 #include "ui/aura/window.h" |
| 37 #include "ui/display/display.h" | 37 #include "ui/base/layout.h" |
| 38 #include "ui/display/screen.h" | |
| 39 #include "ui/events/base_event_utils.h" | 38 #include "ui/events/base_event_utils.h" |
| 40 #include "ui/events/event.h" | 39 #include "ui/events/event.h" |
| 41 #include "ui/gfx/canvas.h" | 40 #include "ui/gfx/canvas.h" |
| 42 #include "ui/gfx/gpu_memory_buffer.h" | 41 #include "ui/gfx/gpu_memory_buffer.h" |
| 43 #include "ui/views/widget/widget.h" | 42 #include "ui/views/widget/widget.h" |
| 44 | 43 |
| 45 namespace ash { | 44 namespace ash { |
| 46 namespace { | 45 namespace { |
| 47 | 46 |
| 48 // Variables for rendering the laser. Radius in DIP. | 47 // Variables for rendering the laser. Radius in DIP. |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 params.parent = | 231 params.parent = |
| 233 Shell::GetContainer(root_window, kShellWindowId_OverlayContainer); | 232 Shell::GetContainer(root_window, kShellWindowId_OverlayContainer); |
| 234 params.layer_type = ui::LAYER_SOLID_COLOR; | 233 params.layer_type = ui::LAYER_SOLID_COLOR; |
| 235 | 234 |
| 236 widget_->Init(params); | 235 widget_->Init(params); |
| 237 widget_->Show(); | 236 widget_->Show(); |
| 238 widget_->SetContentsView(this); | 237 widget_->SetContentsView(this); |
| 239 widget_->SetBounds(root_window->GetBoundsInScreen()); | 238 widget_->SetBounds(root_window->GetBoundsInScreen()); |
| 240 set_owned_by_client(); | 239 set_owned_by_client(); |
| 241 | 240 |
| 242 scale_factor_ = display::Screen::GetScreen() | 241 scale_factor_ = ui::GetScaleFactorForNativeView(widget_->GetNativeView()); |
| 243 ->GetDisplayNearestWindow(widget_->GetNativeView()) | |
| 244 .device_scale_factor(); | |
| 245 } | 242 } |
| 246 | 243 |
| 247 LaserPointerView::~LaserPointerView() {} | 244 LaserPointerView::~LaserPointerView() {} |
| 248 | 245 |
| 249 void LaserPointerView::Stop() { | 246 void LaserPointerView::Stop() { |
| 250 buffer_damage_rect_.Union(GetBoundingBox()); | 247 buffer_damage_rect_.Union(GetBoundingBox()); |
| 251 laser_points_.Clear(); | 248 laser_points_.Clear(); |
| 252 predicted_laser_points_.Clear(); | 249 predicted_laser_points_.Clear(); |
| 253 OnPointsUpdated(); | 250 OnPointsUpdated(); |
| 254 } | 251 } |
| (...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 723 pending_draw_surface_ = true; | 720 pending_draw_surface_ = true; |
| 724 } | 721 } |
| 725 | 722 |
| 726 void LaserPointerView::OnDidDrawSurface() { | 723 void LaserPointerView::OnDidDrawSurface() { |
| 727 pending_draw_surface_ = false; | 724 pending_draw_surface_ = false; |
| 728 if (needs_update_surface_) | 725 if (needs_update_surface_) |
| 729 UpdateSurface(); | 726 UpdateSurface(); |
| 730 } | 727 } |
| 731 | 728 |
| 732 } // namespace ash | 729 } // namespace ash |
| OLD | NEW |