48 const std::optional<Rect>& current_clip_coverage)
const {
49 if (!current_clip_coverage.has_value()) {
50 return {.
type = ClipCoverage::Type::kAppend, .coverage = std::nullopt};
56 return {.type = ClipCoverage::Type::kAppend,
57 .coverage = current_clip_coverage};
60 return {.type = ClipCoverage::Type::kAppend, .coverage = std::nullopt};
63 if (!
coverage.has_value() || !current_clip_coverage.has_value()) {
64 return {.type = ClipCoverage::Type::kAppend, .coverage = std::nullopt};
67 .type = ClipCoverage::Type::kAppend,
68 .coverage = current_clip_coverage->Intersection(
coverage.value()),
75 const std::optional<Rect> clip_coverage)
const {
95 geometry_->IsAxisAlignedRect() &&
110 auto geometry_result = geometry_->GetPositionBuffer(
renderer, entity, pass);
118 options.depth_write_enabled =
false;
119 options.primitive_type = geometry_result.type;
121 switch (geometry_result.mode) {
141 info.mvp = geometry_result.transform;
142 VS::BindFrameInfo(pass,
renderer.GetTransientsBuffer().EmplaceUniform(
info));
150 options.depth_write_enabled =
true;
163 std::optional<Rect> maybe_cover_area =
165 if (!maybe_cover_area.has_value()) {
168 cover_area = maybe_cover_area.value();
175 .CreateVertexBuffer(
renderer.GetTransientsBuffer());
181 VS::BindFrameInfo(pass,
renderer.GetTransientsBuffer().EmplaceUniform(
info));
195 restore_height_ = clip_height;
199 return restore_height_;
203 std::optional<Rect> restore_coverage) {
204 restore_coverage_ = restore_coverage;
208 const Entity& entity)
const {
214 const std::optional<Rect>& current_clip_coverage)
const {
215 return {.
type = ClipCoverage::Type::kRestore, .coverage = std::nullopt};
220 const std::optional<Rect> clip_coverage)
const {
251 {
Point(ltrb[0], ltrb[1])},
252 {
Point(ltrb[2], ltrb[1])},
253 {
Point(ltrb[0], ltrb[3])},
254 {
Point(ltrb[2], ltrb[3])},
262 VS::BindFrameInfo(pass,
renderer.GetTransientsBuffer().EmplaceUniform(
info));
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
static const int points[]
std::optional< Rect > GetCoverage(const Entity &entity) const override
Get the area of the render pass that will be affected when this contents is rendered.
ClipCoverage GetClipCoverage(const Entity &entity, const std::optional< Rect > ¤t_clip_coverage) const override
Given the current pass space bounding rectangle of the clip buffer, return the expected clip coverage...
void SetInheritedOpacity(Scalar opacity) override
Inherit the provided opacity.
void SetClipOperation(Entity::ClipOperation clip_op)
bool ShouldRender(const Entity &entity, const std::optional< Rect > clip_coverage) const override
bool CanInheritOpacity(const Entity &entity) const override
Whether or not this contents can accept the opacity peephole optimization.
void SetGeometry(const std::shared_ptr< Geometry > &geometry)
bool Render(const ContentContext &renderer, const Entity &entity, RenderPass &pass) const override
bool CanInheritOpacity(const Entity &entity) const override
Whether or not this contents can accept the opacity peephole optimization.
bool Render(const ContentContext &renderer, const Entity &entity, RenderPass &pass) const override
void SetInheritedOpacity(Scalar opacity) override
Inherit the provided opacity.
void SetRestoreCoverage(std::optional< Rect > coverage)
The area on the pass texture where this clip restore will be applied. If unset, the entire pass textu...
ClipCoverage GetClipCoverage(const Entity &entity, const std::optional< Rect > ¤t_clip_coverage) const override
Given the current pass space bounding rectangle of the clip buffer, return the expected clip coverage...
std::optional< Rect > GetCoverage(const Entity &entity) const override
Get the area of the render pass that will be affected when this contents is rendered.
bool ShouldRender(const Entity &entity, const std::optional< Rect > clip_coverage) const override
void SetRestoreHeight(size_t clip_height)
size_t GetRestoreHeight() const
const Matrix & GetTransform() const
Get the global transform matrix for this Entity.
uint32_t GetClipDepth() const
float GetShaderClipDepth() const
Render passes encode render commands directed as one specific render target into an underlying comman...
virtual bool SetVertexBuffer(VertexBuffer buffer)
Specify the vertex and index buffer to use for this command.
virtual void SetStencilReference(uint32_t value)
virtual void SetPipeline(const std::shared_ptr< Pipeline< PipelineDescriptor > > &pipeline)
The pipeline to use for this command.
const Matrix & GetOrthographicTransform() const
ISize GetRenderTargetSize() const
virtual fml::Status Draw()
Record the currently pending command.
virtual void SetCommandLabel(std::string_view label)
The debugging label to use for the command.
VertexShader_ VertexShader
VertexBuffer CreateVertexBuffer(HostBuffer &host_buffer) const
VertexBufferBuilder & AddVertices(std::initializer_list< VertexType_ > vertices)
#define FML_UNREACHABLE()
static Scalar GetShaderClipDepth(const Entity &entity)
ContentContextOptions OptionsFromPass(const RenderPass &pass)
@ kOverdrawPreventionRestore
@ kOverdrawPreventionIncrement
@ kNormal
The geometry has no overlapping triangles.
constexpr bool IsTranslationScaleOnly() const
Returns true if the matrix has a scale-only basis and is non-projective. Note that an identity matrix...
constexpr std::array< TPoint< T >, 4 > GetPoints() const
Get the points that represent the 4 corners of this rectangle in a Z order that is compatible with tr...
static constexpr TRect MakeSize(const TSize< U > &size)