Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(90)

Side by Side Diff: ui/base/cursor/cursor_data.cc

Issue 2786983003: [aura-mus] Add ui::CursorData, with mojo serialization. (Closed)
Patch Set: everybody comments Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ui/base/cursor/cursor_data.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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
OLDNEW
« no previous file with comments | « ui/base/cursor/cursor_data.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698