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

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: 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/base/cursor/ozone/bitmap_cursor_factory_ozone.h ('k') | ui/ozone/common/gpu/ozone_gpu_messages.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 7350ce42579f393815d527bc8d31a544a37d26b2..f96d98fbeedc7baa4165cbbcbffe173a57fd0ced 100644
--- a/ui/base/cursor/ozone/bitmap_cursor_factory_ozone.cc
+++ b/ui/base/cursor/ozone/bitmap_cursor_factory_ozone.cc
@@ -30,6 +30,39 @@ 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(0U, bitmaps.size());
+ DCHECK_LE(0, frame_delay_ms);
+}
+
+BitmapCursorOzone::~BitmapCursorOzone() {
+}
+
+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 +90,10 @@ PlatformCursor BitmapCursorFactoryOzone::CreateAnimatedCursor(
const gfx::Point& hotspot,
int frame_delay_ms) {
DCHECK_LT(0U, 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) {
« no previous file with comments | « ui/base/cursor/ozone/bitmap_cursor_factory_ozone.h ('k') | ui/ozone/common/gpu/ozone_gpu_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698