OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "ui/base/cursor/cursor_data.h" |
| 6 |
| 7 #include "third_party/skia/include/core/SkBitmap.h" |
| 8 #include "ui/base/cursor/cursor.h" |
| 9 |
| 10 namespace ui { |
| 11 |
| 12 CursorData::CursorData() : native_type_(0), frame_delay_ms_(0) {} |
| 13 |
| 14 CursorData::CursorData(int type) : native_type_(type), frame_delay_ms_(0) {} |
| 15 |
| 16 CursorData::CursorData(const gfx::Point& hotspot_point, |
| 17 const std::vector<SkBitmap>& cursor_frames, |
| 18 int frame_delay_ms) |
| 19 : native_type_(kCursorCustom), |
| 20 frame_delay_ms_(frame_delay_ms), |
| 21 hotspot_(hotspot_point), |
| 22 cursor_frames_(cursor_frames) { |
| 23 for (SkBitmap& bitmap : cursor_frames_) |
| 24 generator_ids_.push_back(bitmap.getGenerationID()); |
| 25 } |
| 26 |
| 27 CursorData::CursorData(const CursorData& cursor) = default; |
| 28 |
| 29 CursorData::~CursorData() {} |
| 30 |
| 31 CursorData& CursorData::operator=(const CursorData& cursor) = default; |
| 32 |
| 33 bool CursorData::IsType(int native_type) const { |
| 34 return native_type_ == native_type; |
| 35 } |
| 36 |
| 37 bool CursorData::IsSameAs(const CursorData& rhs) const { |
| 38 return native_type_ == rhs.native_type_ && |
| 39 frame_delay_ms_ == rhs.frame_delay_ms_ && hotspot_ == rhs.hotspot_ && |
| 40 generator_ids_ == rhs.generator_ids_; |
| 41 } |
| 42 |
| 43 } // namespace ui |
OLD | NEW |