#ifndef ASH_ROUNDED_DISPLAY_ROUNDED_DISPLAY_GUTTER_H_
#define ASH_ROUNDED_DISPLAY_ROUNDED_DISPLAY_GUTTER_H_
#include <memory>
#include <vector>
#include "ash/ash_export.h"
#include "ash/frame_sink/ui_resource.h"
#include "ui/gfx/geometry/point.h"
#include "ui/gfx/geometry/rect.h"
namespace gfx {
class Canvas;
}
namespace ash {
class ASH_EXPORT RoundedDisplayGutter {
public:
class RoundedCorner {
public:
enum Position {
kUpperLeft = 1u << 0,
kUpperRight = 1u << 1,
kLowerLeft = 1u << 2,
kLowerRight = 1u << 3
};
RoundedCorner(Position position, int radius, const gfx::Point& origin);
RoundedCorner(const RoundedCorner&) = delete;
RoundedCorner& operator=(const RoundedCorner&) = delete;
RoundedCorner(RoundedCorner&&);
RoundedCorner& operator=(RoundedCorner&&);
~RoundedCorner();
int radius() const { return radius_; }
Position position() const { return position_; }
const gfx::Rect& bounds() const { return bounds_in_pixels_; }
bool DoesPaint() const;
void Paint(gfx::Canvas* canvas) const;
private:
void PaintCornerHelper(gfx::Canvas* canvas) const;
Position position_;
int radius_;
gfx::Rect bounds_in_pixels_;
};
static std::unique_ptr<RoundedDisplayGutter> CreateGutter(
std::vector<RoundedCorner>&& corners,
bool is_overlay);
RoundedDisplayGutter(std::vector<RoundedCorner>&& corners, bool is_overlay);
RoundedDisplayGutter(const RoundedDisplayGutter&) = delete;
RoundedDisplayGutter& operator=(const RoundedDisplayGutter&) = delete;
~RoundedDisplayGutter();
const gfx::Rect& bounds() const;
const std::vector<RoundedCorner>& GetGutterCorners() const {
return corners_;
}
bool NeedsOverlays() const { return is_overlay_; }
UiSourceId ui_source_id() const;
void Paint(gfx::Canvas* canvas) const;
private:
gfx::Rect CalculateGutterBounds() const;
UiSourceId CalculateUiSourceId() const;
UiSourceId ui_source_id_ = kInvalidUiSourceId;
const std::vector<RoundedCorner> corners_;
bool is_overlay_ = true;
gfx::Rect bounds_in_pixels_;
};
}
#endif