OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 "ui/base/cursor/cursor_data.h" | 5 #include "ui/base/cursor/cursor_data.h" |
6 | 6 |
7 #include "third_party/skia/include/core/SkBitmap.h" | 7 #include "third_party/skia/include/core/SkBitmap.h" |
8 #include "ui/base/cursor/cursor.h" | 8 #include "ui/base/cursor/cursor.h" |
9 | 9 |
10 namespace ui { | 10 namespace ui { |
11 | 11 |
12 CursorData::CursorData() : cursor_type_(0), scale_factor_(0.0f) {} | 12 CursorData::CursorData() |
| 13 : cursor_type_(CursorType::kNull), scale_factor_(0.0f) {} |
13 | 14 |
14 CursorData::CursorData(int type) : cursor_type_(type), scale_factor_(0.0f) {} | 15 CursorData::CursorData(CursorType type) |
| 16 : cursor_type_(type), scale_factor_(0.0f) {} |
15 | 17 |
16 CursorData::CursorData(const gfx::Point& hotspot_point, | 18 CursorData::CursorData(const gfx::Point& hotspot_point, |
17 const std::vector<SkBitmap>& cursor_frames, | 19 const std::vector<SkBitmap>& cursor_frames, |
18 float scale_factor, | 20 float scale_factor, |
19 const base::TimeDelta& frame_delay) | 21 const base::TimeDelta& frame_delay) |
20 : cursor_type_(kCursorCustom), | 22 : cursor_type_(CursorType::kCustom), |
21 frame_delay_(frame_delay), | 23 frame_delay_(frame_delay), |
22 scale_factor_(scale_factor), | 24 scale_factor_(scale_factor), |
23 hotspot_(hotspot_point), | 25 hotspot_(hotspot_point), |
24 cursor_frames_(cursor_frames) { | 26 cursor_frames_(cursor_frames) { |
25 for (SkBitmap& bitmap : cursor_frames_) | 27 for (SkBitmap& bitmap : cursor_frames_) |
26 generator_ids_.push_back(bitmap.getGenerationID()); | 28 generator_ids_.push_back(bitmap.getGenerationID()); |
27 } | 29 } |
28 | 30 |
29 CursorData::CursorData(const CursorData& cursor) = default; | 31 CursorData::CursorData(const CursorData& cursor) = default; |
30 | 32 |
31 CursorData::~CursorData() {} | 33 CursorData::~CursorData() {} |
32 | 34 |
33 CursorData& CursorData::operator=(const CursorData& cursor) = default; | 35 CursorData& CursorData::operator=(const CursorData& cursor) = default; |
34 | 36 |
35 bool CursorData::IsType(int cursor_type) const { | 37 bool CursorData::IsType(CursorType cursor_type) const { |
36 return cursor_type_ == cursor_type; | 38 return cursor_type_ == cursor_type; |
37 } | 39 } |
38 | 40 |
39 bool CursorData::IsSameAs(const CursorData& rhs) const { | 41 bool CursorData::IsSameAs(const CursorData& rhs) const { |
40 return cursor_type_ == rhs.cursor_type_ && frame_delay_ == rhs.frame_delay_ && | 42 return cursor_type_ == rhs.cursor_type_ && frame_delay_ == rhs.frame_delay_ && |
41 hotspot_ == rhs.hotspot_ && scale_factor_ == rhs.scale_factor_ && | 43 hotspot_ == rhs.hotspot_ && scale_factor_ == rhs.scale_factor_ && |
42 generator_ids_ == rhs.generator_ids_; | 44 generator_ids_ == rhs.generator_ids_; |
43 } | 45 } |
44 | 46 |
45 } // namespace ui | 47 } // namespace ui |
OLD | NEW |