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

Side by Side Diff: ui/ozone/platform/dri/dri_cursor.cc

Issue 543643003: ozone: Plumb animated cursors from BitmapCursorFactoryOzone to DriSurfaceFactory (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix dri_surface_factory_unittest Created 6 years, 3 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/ozone/platform/dri/dri_cursor.h ('k') | ui/ozone/platform/dri/dri_surface_factory.h » ('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 "ui/ozone/platform/dri/dri_cursor.h" 5 #include "ui/ozone/platform/dri/dri_cursor.h"
6 6
7 #include "ui/base/cursor/ozone/bitmap_cursor_factory_ozone.h" 7 #include "ui/base/cursor/ozone/bitmap_cursor_factory_ozone.h"
8 #include "ui/gfx/geometry/point.h" 8 #include "ui/gfx/geometry/point.h"
9 #include "ui/gfx/geometry/point_conversions.h" 9 #include "ui/gfx/geometry/point_conversions.h"
10 #include "ui/gfx/geometry/point_f.h" 10 #include "ui/gfx/geometry/point_f.h"
(...skipping 14 matching lines...) Expand all
25 25
26 void DriCursor::SetCursor(gfx::AcceleratedWidget widget, 26 void DriCursor::SetCursor(gfx::AcceleratedWidget widget,
27 PlatformCursor platform_cursor) { 27 PlatformCursor platform_cursor) {
28 scoped_refptr<BitmapCursorOzone> cursor = 28 scoped_refptr<BitmapCursorOzone> cursor =
29 BitmapCursorFactoryOzone::GetBitmapCursor(platform_cursor); 29 BitmapCursorFactoryOzone::GetBitmapCursor(platform_cursor);
30 if (cursor_ == cursor) 30 if (cursor_ == cursor)
31 return; 31 return;
32 32
33 cursor_ = cursor; 33 cursor_ = cursor;
34 if (cursor_.get()) 34 if (cursor_.get())
35 hardware_->SetHardwareCursor( 35 hardware_->SetHardwareCursor(cursor_window_,
36 cursor_window_, cursor_->bitmap(), bitmap_location()); 36 cursor_->bitmaps(),
37 bitmap_location(),
38 cursor_->frame_delay_ms());
37 else 39 else
38 hardware_->SetHardwareCursor(cursor_window_, SkBitmap(), gfx::Point()); 40 UnsetCursor(cursor_window_);
39 } 41 }
40 42
41 void DriCursor::MoveCursorTo(gfx::AcceleratedWidget widget, 43 void DriCursor::MoveCursorTo(gfx::AcceleratedWidget widget,
42 const gfx::PointF& location) { 44 const gfx::PointF& location) {
43 if (widget != cursor_window_) 45 if (widget != cursor_window_)
44 hardware_->SetHardwareCursor(cursor_window_, SkBitmap(), gfx::Point()); 46 UnsetCursor(cursor_window_);
45 47
46 cursor_window_ = widget; 48 cursor_window_ = widget;
47 cursor_location_ = location; 49 cursor_location_ = location;
48 50
49 gfx::Size size = gfx::Size(2560, 1700); // TODO(spang): Fix. 51 gfx::Size size = gfx::Size(2560, 1700); // TODO(spang): Fix.
50 cursor_location_.SetToMax(gfx::PointF(0, 0)); 52 cursor_location_.SetToMax(gfx::PointF(0, 0));
51 cursor_location_.SetToMin(gfx::PointF(size.width(), size.height())); 53 cursor_location_.SetToMin(gfx::PointF(size.width(), size.height()));
52 54
53 if (cursor_.get()) 55 if (cursor_.get())
54 hardware_->MoveHardwareCursor(cursor_window_, bitmap_location()); 56 hardware_->MoveHardwareCursor(cursor_window_, bitmap_location());
(...skipping 13 matching lines...) Expand all
68 70
69 gfx::PointF DriCursor::location() { 71 gfx::PointF DriCursor::location() {
70 return cursor_location_; 72 return cursor_location_;
71 } 73 }
72 74
73 gfx::Point DriCursor::bitmap_location() { 75 gfx::Point DriCursor::bitmap_location() {
74 return gfx::ToFlooredPoint(cursor_location_) - 76 return gfx::ToFlooredPoint(cursor_location_) -
75 cursor_->hotspot().OffsetFromOrigin(); 77 cursor_->hotspot().OffsetFromOrigin();
76 } 78 }
77 79
80 void DriCursor::UnsetCursor(gfx::AcceleratedWidget widget) {
81 hardware_->SetHardwareCursor(
82 widget, std::vector<SkBitmap>(), gfx::Point(), 0);
83 }
84
78 } // namespace ui 85 } // namespace ui
OLDNEW
« no previous file with comments | « ui/ozone/platform/dri/dri_cursor.h ('k') | ui/ozone/platform/dri/dri_surface_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698