| 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 <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <limits> | 9 #include <limits> |
| 10 | 10 |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 calibration_layer_->SchedulePaint(calibration_layer_->bounds()); | 127 calibration_layer_->SchedulePaint(calibration_layer_->bounds()); |
| 128 } | 128 } |
| 129 | 129 |
| 130 void OverscanCalibrator::OnPaintLayer(const ui::PaintContext& context) { | 130 void OverscanCalibrator::OnPaintLayer(const ui::PaintContext& context) { |
| 131 ui::PaintRecorder recorder(context, calibration_layer_->size()); | 131 ui::PaintRecorder recorder(context, calibration_layer_->size()); |
| 132 static const SkColor kTransparent = SkColorSetARGB(0, 0, 0, 0); | 132 static const SkColor kTransparent = SkColorSetARGB(0, 0, 0, 0); |
| 133 gfx::Rect full_bounds = calibration_layer_->bounds(); | 133 gfx::Rect full_bounds = calibration_layer_->bounds(); |
| 134 gfx::Rect inner_bounds = full_bounds; | 134 gfx::Rect inner_bounds = full_bounds; |
| 135 inner_bounds.Inset(insets_); | 135 inner_bounds.Inset(insets_); |
| 136 recorder.canvas()->FillRect(full_bounds, SK_ColorBLACK); | 136 recorder.canvas()->FillRect(full_bounds, SK_ColorBLACK); |
| 137 recorder.canvas()->FillRect(inner_bounds, kTransparent, | 137 recorder.canvas()->FillRect(inner_bounds, kTransparent, SkBlendMode::kClear); |
| 138 SkXfermode::kClear_Mode); | |
| 139 | 138 |
| 140 gfx::Point center = inner_bounds.CenterPoint(); | 139 gfx::Point center = inner_bounds.CenterPoint(); |
| 141 int vertical_offset = inner_bounds.height() / 2 - kArrowGapWidth; | 140 int vertical_offset = inner_bounds.height() / 2 - kArrowGapWidth; |
| 142 int horizontal_offset = inner_bounds.width() / 2 - kArrowGapWidth; | 141 int horizontal_offset = inner_bounds.width() / 2 - kArrowGapWidth; |
| 143 | 142 |
| 144 gfx::Canvas* canvas = recorder.canvas(); | 143 gfx::Canvas* canvas = recorder.canvas(); |
| 145 DrawTriangle(center.x(), center.y() + vertical_offset, 0, canvas); | 144 DrawTriangle(center.x(), center.y() + vertical_offset, 0, canvas); |
| 146 DrawTriangle(center.x(), center.y() - vertical_offset, 180, canvas); | 145 DrawTriangle(center.x(), center.y() - vertical_offset, 180, canvas); |
| 147 DrawTriangle(center.x() - horizontal_offset, center.y(), 90, canvas); | 146 DrawTriangle(center.x() - horizontal_offset, center.y(), 90, canvas); |
| 148 DrawTriangle(center.x() + horizontal_offset, center.y(), -90, canvas); | 147 DrawTriangle(center.x() + horizontal_offset, center.y(), -90, canvas); |
| 149 } | 148 } |
| 150 | 149 |
| 151 void OverscanCalibrator::OnDelegatedFrameDamage( | 150 void OverscanCalibrator::OnDelegatedFrameDamage( |
| 152 const gfx::Rect& damage_rect_in_dip) { | 151 const gfx::Rect& damage_rect_in_dip) { |
| 153 } | 152 } |
| 154 | 153 |
| 155 void OverscanCalibrator::OnDeviceScaleFactorChanged( | 154 void OverscanCalibrator::OnDeviceScaleFactorChanged( |
| 156 float device_scale_factor) { | 155 float device_scale_factor) { |
| 157 // TODO(mukai): Cancel the overscan calibration when the device | 156 // TODO(mukai): Cancel the overscan calibration when the device |
| 158 // configuration has changed. | 157 // configuration has changed. |
| 159 } | 158 } |
| 160 | 159 |
| 161 } // namespace chromeos | 160 } // namespace chromeos |
| OLD | NEW |