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

Unified Diff: ui/base/cursor/ozone/bitmap_cursor_factory_ozone.cc

Issue 543643003: ozone: Plumb animated cursors from BitmapCursorFactoryOzone to DriSurfaceFactory (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 side-by-side diff with in-line comments
Download patch
Index: ui/base/cursor/ozone/bitmap_cursor_factory_ozone.cc
diff --git a/ui/base/cursor/ozone/bitmap_cursor_factory_ozone.cc b/ui/base/cursor/ozone/bitmap_cursor_factory_ozone.cc
index 097d67118be87b99aacfa4dd796d738eaa26c0d4..14dab5617e09978548d63c955c78688982ef25b2 100644
--- a/ui/base/cursor/ozone/bitmap_cursor_factory_ozone.cc
+++ b/ui/base/cursor/ozone/bitmap_cursor_factory_ozone.cc
@@ -30,6 +30,36 @@ scoped_refptr<BitmapCursorOzone> CreateDefaultBitmapCursor(int type) {
} // namespace
+BitmapCursorOzone::BitmapCursorOzone(const SkBitmap& bitmap,
+ const gfx::Point& hotspot)
+ : hotspot_(hotspot), frame_delay_ms_(0) {
+ bitmaps_.push_back(bitmap);
+}
+
+BitmapCursorOzone::BitmapCursorOzone(const std::vector<SkBitmap>& bitmaps,
+ const gfx::Point& hotspot,
+ int frame_delay_ms)
+ : bitmaps_(bitmaps), hotspot_(hotspot), frame_delay_ms_(frame_delay_ms) {
+ DCHECK_LT(0, bitmaps.size());
+ DCHECK_LE(0, frame_delay_ms);
+}
+
+const gfx::Point& BitmapCursorOzone::hotspot() {
+ return hotspot_;
+}
+
+const SkBitmap& BitmapCursorOzone::bitmap() {
+ return bitmaps_[0];
+}
+
+const std::vector<SkBitmap>& BitmapCursorOzone::bitmaps() {
+ return bitmaps_;
+}
+
+int BitmapCursorOzone::frame_delay_ms() {
+ return frame_delay_ms_;
+}
+
BitmapCursorFactoryOzone::BitmapCursorFactoryOzone() {}
BitmapCursorFactoryOzone::~BitmapCursorFactoryOzone() {}
@@ -57,8 +87,10 @@ PlatformCursor BitmapCursorFactoryOzone::CreateAnimatedCursor(
const gfx::Point& hotspot,
int frame_delay_ms) {
DCHECK_LT(0, bitmaps.size());
- NOTIMPLEMENTED();
- return CreateImageCursor(bitmaps[0], hotspot);
+ BitmapCursorOzone* cursor =
+ new BitmapCursorOzone(bitmaps, hotspot, frame_delay_ms);
+ cursor->AddRef(); // Balanced by UnrefImageCursor.
+ return ToPlatformCursor(cursor);
}
void BitmapCursorFactoryOzone::RefImageCursor(PlatformCursor cursor) {

Powered by Google App Engine
This is Rietveld 408576698