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() : cursor_type_(0), scale_factor_(0.0f) {} |
| 13 |
| 14 CursorData::CursorData(int type) : cursor_type_(type), scale_factor_(0.0f) {} |
| 15 |
| 16 CursorData::CursorData(const gfx::Point& hotspot_point, |
| 17 const std::vector<SkBitmap>& cursor_frames, |
| 18 float scale_factor, |
| 19 const base::TimeDelta& frame_delay) |
| 20 : cursor_type_(kCursorCustom), |
| 21 frame_delay_(frame_delay), |
| 22 scale_factor_(scale_factor), |
| 23 hotspot_(hotspot_point), |
| 24 cursor_frames_(cursor_frames) { |
| 25 for (SkBitmap& bitmap : cursor_frames_) |
| 26 generator_ids_.push_back(bitmap.getGenerationID()); |
| 27 } |
| 28 |
| 29 CursorData::CursorData(const CursorData& cursor) = default; |
| 30 |
| 31 CursorData::~CursorData() {} |
| 32 |
| 33 CursorData& CursorData::operator=(const CursorData& cursor) = default; |
| 34 |
| 35 bool CursorData::IsType(int cursor_type) const { |
| 36 return cursor_type_ == cursor_type; |
| 37 } |
| 38 |
| 39 bool CursorData::IsSameAs(const CursorData& rhs) const { |
| 40 return cursor_type_ == rhs.cursor_type_ && frame_delay_ == rhs.frame_delay_ && |
| 41 hotspot_ == rhs.hotspot_ && scale_factor_ == rhs.scale_factor_ && |
| 42 generator_ids_ == rhs.generator_ids_; |
| 43 } |
| 44 |
| 45 } // namespace ui |
OLD | NEW |