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

Side by Side Diff: ui/base/cursor/ozone/bitmap_cursor_factory_ozone.h

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 | « no previous file | ui/base/cursor/ozone/bitmap_cursor_factory_ozone.cc » ('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 #ifndef UI_BASE_CURSOR_OZONE_BITMAP_CURSOR_FACTORY_OZONE_H_ 5 #ifndef UI_BASE_CURSOR_OZONE_BITMAP_CURSOR_FACTORY_OZONE_H_
6 #define UI_BASE_CURSOR_OZONE_BITMAP_CURSOR_FACTORY_OZONE_H_ 6 #define UI_BASE_CURSOR_OZONE_BITMAP_CURSOR_FACTORY_OZONE_H_
7 7
8 #include <map> 8 #include <map>
9 9
10 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
11 #include "third_party/skia/include/core/SkBitmap.h" 11 #include "third_party/skia/include/core/SkBitmap.h"
12 #include "ui/base/cursor/cursor.h" 12 #include "ui/base/cursor/cursor.h"
13 #include "ui/base/ui_base_export.h" 13 #include "ui/base/ui_base_export.h"
14 #include "ui/gfx/geometry/point.h" 14 #include "ui/gfx/geometry/point.h"
15 #include "ui/ozone/public/cursor_factory_ozone.h" 15 #include "ui/ozone/public/cursor_factory_ozone.h"
16 16
17 namespace ui { 17 namespace ui {
18 18
19 // A cursor that is an SkBitmap combined with a gfx::Point hotspot. 19 // A cursor that is an SkBitmap combined with a gfx::Point hotspot.
20 class UI_BASE_EXPORT BitmapCursorOzone 20 class UI_BASE_EXPORT BitmapCursorOzone
21 : public base::RefCounted<BitmapCursorOzone> { 21 : public base::RefCounted<BitmapCursorOzone> {
22 public: 22 public:
23 BitmapCursorOzone(const SkBitmap& bitmap, const gfx::Point& hotspot) 23 BitmapCursorOzone(const SkBitmap& bitmap, const gfx::Point& hotspot);
24 : bitmap_(bitmap), hotspot_(hotspot) {} 24 BitmapCursorOzone(const std::vector<SkBitmap>& bitmaps,
25 const gfx::Point& hotspot,
26 int frame_delay_ms);
25 27
26 const gfx::Point& hotspot() { return hotspot_; } 28 const gfx::Point& hotspot();
27 const SkBitmap& bitmap() { return bitmap_; } 29 const SkBitmap& bitmap();
30
31 // For animated cursors.
32 const std::vector<SkBitmap>& bitmaps();
33 int frame_delay_ms();
28 34
29 private: 35 private:
30 friend class base::RefCounted<BitmapCursorOzone>; 36 friend class base::RefCounted<BitmapCursorOzone>;
31 ~BitmapCursorOzone() {} 37 ~BitmapCursorOzone();
32 38
33 SkBitmap bitmap_; 39 std::vector<SkBitmap> bitmaps_;
34 gfx::Point hotspot_; 40 gfx::Point hotspot_;
41 int frame_delay_ms_;
35 42
36 DISALLOW_COPY_AND_ASSIGN(BitmapCursorOzone); 43 DISALLOW_COPY_AND_ASSIGN(BitmapCursorOzone);
37 }; 44 };
38 45
39 // CursorFactoryOzone implementation for bitmapped cursors. 46 // CursorFactoryOzone implementation for bitmapped cursors.
40 // 47 //
41 // This is a base class for platforms where PlatformCursor is an SkBitmap 48 // This is a base class for platforms where PlatformCursor is an SkBitmap
42 // combined with a gfx::Point for the hotspot. 49 // combined with a gfx::Point for the hotspot.
43 // 50 //
44 // Subclasses need only implement SetBitmapCursor() as everything else is 51 // Subclasses need only implement SetBitmapCursor() as everything else is
(...skipping 25 matching lines...) Expand all
70 // Default cursors are cached & owned by the factory. 77 // Default cursors are cached & owned by the factory.
71 typedef std::map<int, scoped_refptr<BitmapCursorOzone> > DefaultCursorMap; 78 typedef std::map<int, scoped_refptr<BitmapCursorOzone> > DefaultCursorMap;
72 DefaultCursorMap default_cursors_; 79 DefaultCursorMap default_cursors_;
73 80
74 DISALLOW_COPY_AND_ASSIGN(BitmapCursorFactoryOzone); 81 DISALLOW_COPY_AND_ASSIGN(BitmapCursorFactoryOzone);
75 }; 82 };
76 83
77 } // namespace ui 84 } // namespace ui
78 85
79 #endif // UI_BASE_CURSOR_OZONE_BITMAP_CURSOR_FACTORY_OZONE_H_ 86 #endif // UI_BASE_CURSOR_OZONE_BITMAP_CURSOR_FACTORY_OZONE_H_
OLDNEW
« no previous file with comments | « no previous file | ui/base/cursor/ozone/bitmap_cursor_factory_ozone.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698