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

Side by Side Diff: ui/ozone/platform/x11/x11_cursor_factory_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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "ui/ozone/platform/x11/x11_cursor_factory_ozone.h" 5 #include "ui/ozone/platform/x11/x11_cursor_factory_ozone.h"
6 6
7 #include "third_party/skia/include/core/SkBitmap.h" 7 #include "third_party/skia/include/core/SkBitmap.h"
8 #include "ui/base/cursor/cursors_aura.h" 8 #include "ui/base/cursor/cursors_aura.h"
9 #include "ui/gfx/geometry/point.h" 9 #include "ui/gfx/geometry/point.h"
10 10
(...skipping 25 matching lines...) Expand all
36 : invisible_cursor_(X11CursorOzone::CreateInvisible()) {} 36 : invisible_cursor_(X11CursorOzone::CreateInvisible()) {}
37 37
38 X11CursorFactoryOzone::~X11CursorFactoryOzone() {} 38 X11CursorFactoryOzone::~X11CursorFactoryOzone() {}
39 39
40 PlatformCursor X11CursorFactoryOzone::GetDefaultCursor(int type) { 40 PlatformCursor X11CursorFactoryOzone::GetDefaultCursor(int type) {
41 return ToPlatformCursor(GetDefaultCursorInternal(type).get()); 41 return ToPlatformCursor(GetDefaultCursorInternal(type).get());
42 } 42 }
43 43
44 PlatformCursor X11CursorFactoryOzone::CreateImageCursor( 44 PlatformCursor X11CursorFactoryOzone::CreateImageCursor(
45 const SkBitmap& bitmap, 45 const SkBitmap& bitmap,
46 const gfx::Point& hotspot) { 46 const gfx::Point& hotspot,
47 float bitmap_dpi) {
47 // There is a problem with custom cursors that have no custom data. The 48 // There is a problem with custom cursors that have no custom data. The
48 // resulting SkBitmap is empty and X crashes when creating a zero size cursor 49 // resulting SkBitmap is empty and X crashes when creating a zero size cursor
49 // image. Return invisible cursor here instead. 50 // image. Return invisible cursor here instead.
50 if (bitmap.drawsNothing()) { 51 if (bitmap.drawsNothing()) {
51 return ToPlatformCursor(invisible_cursor_.get()); 52 return ToPlatformCursor(invisible_cursor_.get());
52 } 53 }
53 54
54 X11CursorOzone* cursor = new X11CursorOzone(bitmap, hotspot); 55 X11CursorOzone* cursor = new X11CursorOzone(bitmap, hotspot);
55 cursor->AddRef(); 56 cursor->AddRef();
56 return ToPlatformCursor(cursor); 57 return ToPlatformCursor(cursor);
57 } 58 }
58 59
59 PlatformCursor X11CursorFactoryOzone::CreateAnimatedCursor( 60 PlatformCursor X11CursorFactoryOzone::CreateAnimatedCursor(
60 const std::vector<SkBitmap>& bitmaps, 61 const std::vector<SkBitmap>& bitmaps,
61 const gfx::Point& hotspot, 62 const gfx::Point& hotspot,
62 int frame_delay_ms) { 63 int frame_delay_ms,
64 float bitmap_dpi) {
63 X11CursorOzone* cursor = new X11CursorOzone(bitmaps, hotspot, frame_delay_ms); 65 X11CursorOzone* cursor = new X11CursorOzone(bitmaps, hotspot, frame_delay_ms);
64 cursor->AddRef(); 66 cursor->AddRef();
65 return ToPlatformCursor(cursor); 67 return ToPlatformCursor(cursor);
66 } 68 }
67 69
68 void X11CursorFactoryOzone::RefImageCursor(PlatformCursor cursor) { 70 void X11CursorFactoryOzone::RefImageCursor(PlatformCursor cursor) {
69 ToX11CursorOzone(cursor)->AddRef(); 71 ToX11CursorOzone(cursor)->AddRef();
70 } 72 }
71 73
72 void X11CursorFactoryOzone::UnrefImageCursor(PlatformCursor cursor) { 74 void X11CursorFactoryOzone::UnrefImageCursor(PlatformCursor cursor) {
(...skipping 18 matching lines...) Expand all
91 } 93 }
92 } 94 }
93 default_cursors_[type] = cursor; 95 default_cursors_[type] = cursor;
94 } 96 }
95 97
96 // Returns owned default cursor for this type. 98 // Returns owned default cursor for this type.
97 return default_cursors_[type]; 99 return default_cursors_[type];
98 } 100 }
99 101
100 } // namespace ui 102 } // namespace ui
OLDNEW
« no previous file with comments | « ui/ozone/platform/x11/x11_cursor_factory_ozone.h ('k') | ui/ozone/public/cursor_factory_ozone.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698