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

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

Issue 2786983003: [aura-mus] Add ui::CursorData, with mojo serialization. (Closed)
Patch Set: Enhance the test and comment mojom. 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
« ui/base/cursor/cursor_data.h ('K') | « 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() : 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
OLDNEW
« ui/base/cursor/cursor_data.h ('K') | « ui/base/cursor/cursor_data.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698