OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/utility/partial_screenshot_controller.h" | 5 #include "ash/utility/partial_screenshot_controller.h" |
6 | 6 |
7 #include <cmath> | 7 #include <cmath> |
8 | 8 |
9 #include "ash/screenshot_delegate.h" | 9 #include "ash/screenshot_delegate.h" |
10 #include "ash/shell.h" | 10 #include "ash/shell.h" |
(...skipping 22 matching lines...) Expand all Loading... |
33 public: | 33 public: |
34 PartialScreenshotLayer(ui::Layer* parent) { | 34 PartialScreenshotLayer(ui::Layer* parent) { |
35 SetLayer(new ui::Layer(ui::LAYER_TEXTURED)); | 35 SetLayer(new ui::Layer(ui::LAYER_TEXTURED)); |
36 layer()->SetFillsBoundsOpaquely(false); | 36 layer()->SetFillsBoundsOpaquely(false); |
37 layer()->SetBounds(parent->bounds()); | 37 layer()->SetBounds(parent->bounds()); |
38 parent->Add(layer()); | 38 parent->Add(layer()); |
39 parent->StackAtTop(layer()); | 39 parent->StackAtTop(layer()); |
40 layer()->SetVisible(true); | 40 layer()->SetVisible(true); |
41 layer()->set_delegate(this); | 41 layer()->set_delegate(this); |
42 } | 42 } |
43 ~PartialScreenshotLayer() {} | 43 ~PartialScreenshotLayer() override {} |
44 | 44 |
45 const gfx::Rect& region() const { return region_; } | 45 const gfx::Rect& region() const { return region_; } |
46 | 46 |
47 void SetRegion(const gfx::Rect& region) { | 47 void SetRegion(const gfx::Rect& region) { |
48 // Invalidates the region which covers the current and new region. | 48 // Invalidates the region which covers the current and new region. |
49 gfx::Rect union_rect(region_); | 49 gfx::Rect union_rect(region_); |
50 union_rect.Union(region); | 50 union_rect.Union(region); |
51 union_rect.Inset(-kInvalidateRegionAdditionalSize, | 51 union_rect.Inset(-kInvalidateRegionAdditionalSize, |
52 -kInvalidateRegionAdditionalSize); | 52 -kInvalidateRegionAdditionalSize); |
53 union_rect.Intersects(layer()->bounds()); | 53 union_rect.Intersects(layer()->bounds()); |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 const gfx::Display& old_display) { | 257 const gfx::Display& old_display) { |
258 Cancel(); | 258 Cancel(); |
259 } | 259 } |
260 | 260 |
261 void PartialScreenshotController::OnDisplayMetricsChanged( | 261 void PartialScreenshotController::OnDisplayMetricsChanged( |
262 const gfx::Display& display, | 262 const gfx::Display& display, |
263 uint32_t changed_metrics) { | 263 uint32_t changed_metrics) { |
264 } | 264 } |
265 | 265 |
266 } // namespace ash | 266 } // namespace ash |
OLD | NEW |