#ifndef UI_OZONE_COMMON_BITMAP_CURSOR_H_
#define UI_OZONE_COMMON_BITMAP_CURSOR_H_
#include <vector>
#include "base/memory/raw_ptr.h"
#include "base/memory/scoped_refptr.h"
#include "base/time/time.h"
#include "third_party/skia/include/core/SkBitmap.h"
#include "ui/base/cursor/mojom/cursor_type.mojom-shared.h"
#include "ui/base/cursor/platform_cursor.h"
#include "ui/gfx/geometry/point.h"
namespace ui {
class BitmapCursor : public PlatformCursor {
public:
static scoped_refptr<BitmapCursor> FromPlatformCursor(
scoped_refptr<PlatformCursor> platform_cursor);
explicit BitmapCursor(mojom::CursorType type);
BitmapCursor(mojom::CursorType type,
const SkBitmap& bitmap,
const gfx::Point& hotspot,
float cursor_image_scale_factor);
BitmapCursor(mojom::CursorType type,
const std::vector<SkBitmap>& bitmaps,
const gfx::Point& hotspot,
base::TimeDelta frame_delay,
float cursor_image_scale_factor);
BitmapCursor(mojom::CursorType type,
void* platform_data,
float cursor_image_scale_factor);
BitmapCursor(const BitmapCursor&) = delete;
BitmapCursor& operator=(const BitmapCursor&) = delete;
mojom::CursorType type() const { return type_; }
const gfx::Point& hotspot();
const SkBitmap& bitmap();
const std::vector<SkBitmap>& bitmaps();
base::TimeDelta frame_delay();
void* platform_data() { return platform_data_; }
void clear_platform_data() { platform_data_ = nullptr; }
float cursor_image_scale_factor() const { return cursor_image_scale_factor_; }
private:
friend class base::RefCounted<PlatformCursor>;
~BitmapCursor() override;
const mojom::CursorType type_;
std::vector<SkBitmap> bitmaps_;
gfx::Point hotspot_;
base::TimeDelta frame_delay_;
raw_ptr<void> platform_data_ = nullptr;
float cursor_image_scale_factor_ = 1.f;
};
}
#endif