| 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/chromeos/display/overscan_calibrator.h" | 5 #include "chrome/browser/chromeos/display/overscan_calibrator.h" |
| 6 | 6 |
| 7 #include "ash/display/display_controller.h" | 7 #include "ash/display/display_controller.h" |
| 8 #include "ash/display/display_info.h" | 8 #include "ash/display/display_info.h" |
| 9 #include "ash/display/display_manager.h" | 9 #include "ash/display/display_manager.h" |
| 10 #include "ash/shell.h" | 10 #include "ash/shell.h" |
| 11 #include "ash/shell_window_ids.h" | 11 #include "ash/shell_window_ids.h" |
| 12 #include "base/callback.h" | 12 #include "base/callback.h" |
| 13 #include "ui/aura/window.h" | 13 #include "ui/aura/window.h" |
| 14 #include "ui/compositor/layer.h" | 14 #include "ui/compositor/layer.h" |
| 15 #include "ui/compositor/paint_context.h" |
| 15 #include "ui/gfx/canvas.h" | 16 #include "ui/gfx/canvas.h" |
| 16 | 17 |
| 17 namespace chromeos { | 18 namespace chromeos { |
| 18 namespace { | 19 namespace { |
| 19 | 20 |
| 20 // The opacity for the arrows of the overscan calibration. | 21 // The opacity for the arrows of the overscan calibration. |
| 21 const float kArrowOpacity = 0.8; | 22 const float kArrowOpacity = 0.8; |
| 22 | 23 |
| 23 // The height in pixel for the arrows to show the overscan calibration. | 24 // The height in pixel for the arrows to show the overscan calibration. |
| 24 const int kCalibrationArrowHeight = 50; | 25 const int kCalibrationArrowHeight = 50; |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 } | 109 } |
| 109 | 110 |
| 110 void OverscanCalibrator::UpdateInsets(const gfx::Insets& insets) { | 111 void OverscanCalibrator::UpdateInsets(const gfx::Insets& insets) { |
| 111 insets_.Set(std::max(insets.top(), 0), | 112 insets_.Set(std::max(insets.top(), 0), |
| 112 std::max(insets.left(), 0), | 113 std::max(insets.left(), 0), |
| 113 std::max(insets.bottom(), 0), | 114 std::max(insets.bottom(), 0), |
| 114 std::max(insets.right(), 0)); | 115 std::max(insets.right(), 0)); |
| 115 calibration_layer_->SchedulePaint(calibration_layer_->bounds()); | 116 calibration_layer_->SchedulePaint(calibration_layer_->bounds()); |
| 116 } | 117 } |
| 117 | 118 |
| 118 void OverscanCalibrator::OnPaintLayer(gfx::Canvas* canvas) { | 119 void OverscanCalibrator::OnPaintLayer(const ui::PaintContext& context) { |
| 120 gfx::Canvas* canvas = context.canvas(); |
| 119 static const SkColor kTransparent = SkColorSetARGB(0, 0, 0, 0); | 121 static const SkColor kTransparent = SkColorSetARGB(0, 0, 0, 0); |
| 120 gfx::Rect full_bounds = calibration_layer_->bounds(); | 122 gfx::Rect full_bounds = calibration_layer_->bounds(); |
| 121 gfx::Rect inner_bounds = full_bounds; | 123 gfx::Rect inner_bounds = full_bounds; |
| 122 inner_bounds.Inset(insets_); | 124 inner_bounds.Inset(insets_); |
| 123 canvas->FillRect(full_bounds, SK_ColorBLACK); | 125 canvas->FillRect(full_bounds, SK_ColorBLACK); |
| 124 canvas->FillRect(inner_bounds, kTransparent, SkXfermode::kClear_Mode); | 126 canvas->FillRect(inner_bounds, kTransparent, SkXfermode::kClear_Mode); |
| 125 | 127 |
| 126 gfx::Point center = inner_bounds.CenterPoint(); | 128 gfx::Point center = inner_bounds.CenterPoint(); |
| 127 int vertical_offset = inner_bounds.height() / 2 - kArrowGapWidth; | 129 int vertical_offset = inner_bounds.height() / 2 - kArrowGapWidth; |
| 128 int horizontal_offset = inner_bounds.width() / 2 - kArrowGapWidth; | 130 int horizontal_offset = inner_bounds.width() / 2 - kArrowGapWidth; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 141 float device_scale_factor) { | 143 float device_scale_factor) { |
| 142 // TODO(mukai): Cancel the overscan calibration when the device | 144 // TODO(mukai): Cancel the overscan calibration when the device |
| 143 // configuration has changed. | 145 // configuration has changed. |
| 144 } | 146 } |
| 145 | 147 |
| 146 base::Closure OverscanCalibrator::PrepareForLayerBoundsChange() { | 148 base::Closure OverscanCalibrator::PrepareForLayerBoundsChange() { |
| 147 return base::Closure(); | 149 return base::Closure(); |
| 148 } | 150 } |
| 149 | 151 |
| 150 } // namespace chromeos | 152 } // namespace chromeos |
| OLD | NEW |