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

Side by Side Diff: content/common/cursors/webcursor_ozone.cc

Issue 2798883003: [ozone,views-mus] Build CursorDataFactoryOzone. (Closed)
Patch Set: sadrul 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 | « components/exo/pointer.cc ('k') | ui/base/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "content/common/cursors/webcursor.h" 5 #include "content/common/cursors/webcursor.h"
6 6
7 #include "third_party/WebKit/public/platform/WebCursorInfo.h" 7 #include "third_party/WebKit/public/platform/WebCursorInfo.h"
8 #include "ui/base/cursor/cursor.h" 8 #include "ui/base/cursor/cursor.h"
9 #include "ui/base/cursor/cursor_util.h" 9 #include "ui/base/cursor/cursor_util.h"
10 #include "ui/ozone/public/cursor_factory_ozone.h" 10 #include "ui/ozone/public/cursor_factory_ozone.h"
(...skipping 17 matching lines...) Expand all
28 DCHECK_LT(0, maximum_cursor_size_.width()); 28 DCHECK_LT(0, maximum_cursor_size_.width());
29 DCHECK_LT(0, maximum_cursor_size_.height()); 29 DCHECK_LT(0, maximum_cursor_size_.height());
30 scale = std::min( 30 scale = std::min(
31 scale, static_cast<float>(maximum_cursor_size_.width()) / bitmap.width()); 31 scale, static_cast<float>(maximum_cursor_size_.width()) / bitmap.width());
32 scale = std::min(scale, static_cast<float>(maximum_cursor_size_.height()) / 32 scale = std::min(scale, static_cast<float>(maximum_cursor_size_.height()) /
33 bitmap.height()); 33 bitmap.height());
34 34
35 ui::ScaleAndRotateCursorBitmapAndHotpoint(scale, rotation_, &bitmap, 35 ui::ScaleAndRotateCursorBitmapAndHotpoint(scale, rotation_, &bitmap,
36 &hotspot); 36 &hotspot);
37 37
38 platform_cursor_ = 38 platform_cursor_ = ui::CursorFactoryOzone::GetInstance()->CreateImageCursor(
39 ui::CursorFactoryOzone::GetInstance()->CreateImageCursor(bitmap, hotspot); 39 bitmap, hotspot, scale);
40 return platform_cursor_; 40 return platform_cursor_;
41 } 41 }
42 42
43 void WebCursor::SetDisplayInfo(const display::Display& display) { 43 void WebCursor::SetDisplayInfo(const display::Display& display) {
44 if (rotation_ == display.rotation() && 44 if (rotation_ == display.rotation() &&
45 device_scale_factor_ == display.device_scale_factor() && 45 device_scale_factor_ == display.device_scale_factor() &&
46 maximum_cursor_size_ == display.maximum_cursor_size()) 46 maximum_cursor_size_ == display.maximum_cursor_size())
47 return; 47 return;
48 device_scale_factor_ = display.device_scale_factor(); 48 device_scale_factor_ = display.device_scale_factor();
49 rotation_ = display.rotation(); 49 rotation_ = display.rotation();
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 ui::CursorFactoryOzone::GetInstance()->UnrefImageCursor(platform_cursor_); 93 ui::CursorFactoryOzone::GetInstance()->UnrefImageCursor(platform_cursor_);
94 platform_cursor_ = other.platform_cursor_; 94 platform_cursor_ = other.platform_cursor_;
95 if (platform_cursor_) 95 if (platform_cursor_)
96 ui::CursorFactoryOzone::GetInstance()->RefImageCursor(platform_cursor_); 96 ui::CursorFactoryOzone::GetInstance()->RefImageCursor(platform_cursor_);
97 97
98 device_scale_factor_ = other.device_scale_factor_; 98 device_scale_factor_ = other.device_scale_factor_;
99 maximum_cursor_size_ = other.maximum_cursor_size_; 99 maximum_cursor_size_ = other.maximum_cursor_size_;
100 } 100 }
101 101
102 } // namespace content 102 } // namespace content
OLDNEW
« no previous file with comments | « components/exo/pointer.cc ('k') | ui/base/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698