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 21 matching lines...) Expand all Loading... |
32 | 32 |
33 // The gap between the boundary and calibration arrows. | 33 // The gap between the boundary and calibration arrows. |
34 const int kArrowGapWidth = 0; | 34 const int kArrowGapWidth = 0; |
35 | 35 |
36 // Draw the arrow for the overscan calibration to |canvas|. | 36 // Draw the arrow for the overscan calibration to |canvas|. |
37 void DrawTriangle(int x_offset, | 37 void DrawTriangle(int x_offset, |
38 int y_offset, | 38 int y_offset, |
39 double rotation_degree, | 39 double rotation_degree, |
40 gfx::Canvas* canvas) { | 40 gfx::Canvas* canvas) { |
41 // Draw triangular arrows. | 41 // Draw triangular arrows. |
42 SkPaint content_paint; | 42 cc::PaintFlags content_flags; |
43 content_paint.setStyle(SkPaint::kFill_Style); | 43 content_flags.setStyle(cc::PaintFlags::kFill_Style); |
44 content_paint.setColor(SkColorSetA( | 44 content_flags.setColor(SkColorSetA( |
45 SK_ColorBLACK, std::numeric_limits<uint8_t>::max() * kArrowOpacity)); | 45 SK_ColorBLACK, std::numeric_limits<uint8_t>::max() * kArrowOpacity)); |
46 SkPaint border_paint; | 46 cc::PaintFlags border_flags; |
47 border_paint.setStyle(SkPaint::kStroke_Style); | 47 border_flags.setStyle(cc::PaintFlags::kStroke_Style); |
48 border_paint.setColor(SkColorSetA( | 48 border_flags.setColor(SkColorSetA( |
49 SK_ColorWHITE, std::numeric_limits<uint8_t>::max() * kArrowOpacity)); | 49 SK_ColorWHITE, std::numeric_limits<uint8_t>::max() * kArrowOpacity)); |
50 | 50 |
51 SkPath base_path; | 51 SkPath base_path; |
52 base_path.moveTo(0, 0); | 52 base_path.moveTo(0, 0); |
53 base_path.lineTo(SkIntToScalar(-kCalibrationArrowHeight), | 53 base_path.lineTo(SkIntToScalar(-kCalibrationArrowHeight), |
54 SkIntToScalar(-kCalibrationArrowHeight)); | 54 SkIntToScalar(-kCalibrationArrowHeight)); |
55 base_path.lineTo(SkIntToScalar(kCalibrationArrowHeight), | 55 base_path.lineTo(SkIntToScalar(kCalibrationArrowHeight), |
56 SkIntToScalar(-kCalibrationArrowHeight)); | 56 SkIntToScalar(-kCalibrationArrowHeight)); |
57 base_path.close(); | 57 base_path.close(); |
58 | 58 |
59 SkPath path; | 59 SkPath path; |
60 gfx::Transform rotate_transform; | 60 gfx::Transform rotate_transform; |
61 rotate_transform.Rotate(rotation_degree); | 61 rotate_transform.Rotate(rotation_degree); |
62 gfx::Transform move_transform; | 62 gfx::Transform move_transform; |
63 move_transform.Translate(x_offset, y_offset); | 63 move_transform.Translate(x_offset, y_offset); |
64 rotate_transform.ConcatTransform(move_transform); | 64 rotate_transform.ConcatTransform(move_transform); |
65 base_path.transform(rotate_transform.matrix(), &path); | 65 base_path.transform(rotate_transform.matrix(), &path); |
66 | 66 |
67 canvas->DrawPath(path, content_paint); | 67 canvas->DrawPath(path, content_flags); |
68 canvas->DrawPath(path, border_paint); | 68 canvas->DrawPath(path, border_flags); |
69 } | 69 } |
70 | 70 |
71 } // namespace | 71 } // namespace |
72 | 72 |
73 OverscanCalibrator::OverscanCalibrator(const display::Display& target_display, | 73 OverscanCalibrator::OverscanCalibrator(const display::Display& target_display, |
74 const gfx::Insets& initial_insets) | 74 const gfx::Insets& initial_insets) |
75 : display_(target_display), | 75 : display_(target_display), |
76 insets_(initial_insets), | 76 insets_(initial_insets), |
77 initial_insets_(initial_insets), | 77 initial_insets_(initial_insets), |
78 committed_(false) { | 78 committed_(false) { |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 const gfx::Rect& damage_rect_in_dip) { | 151 const gfx::Rect& damage_rect_in_dip) { |
152 } | 152 } |
153 | 153 |
154 void OverscanCalibrator::OnDeviceScaleFactorChanged( | 154 void OverscanCalibrator::OnDeviceScaleFactorChanged( |
155 float device_scale_factor) { | 155 float device_scale_factor) { |
156 // TODO(mukai): Cancel the overscan calibration when the device | 156 // TODO(mukai): Cancel the overscan calibration when the device |
157 // configuration has changed. | 157 // configuration has changed. |
158 } | 158 } |
159 | 159 |
160 } // namespace chromeos | 160 } // namespace chromeos |
OLD | NEW |