mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
77 lines
1.6 KiB
C++
77 lines
1.6 KiB
C++
// Copyright 2013 The Flutter Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
// found in the LICENSE file.
|
|
|
|
#include "impeller/entity/entity.h"
|
|
|
|
#include "impeller/entity/content_context.h"
|
|
#include "impeller/renderer/render_pass.h"
|
|
|
|
namespace impeller {
|
|
|
|
Entity::Entity() = default;
|
|
|
|
Entity::~Entity() = default;
|
|
|
|
const Matrix& Entity::GetTransformation() const {
|
|
return transformation_;
|
|
}
|
|
|
|
void Entity::SetTransformation(const Matrix& transformation) {
|
|
transformation_ = transformation;
|
|
}
|
|
|
|
const Path& Entity::GetPath() const {
|
|
return path_;
|
|
}
|
|
|
|
void Entity::SetPath(Path path) {
|
|
path_ = std::move(path);
|
|
}
|
|
|
|
void Entity::SetAddsToCoverage(bool adds) {
|
|
adds_to_coverage_ = adds;
|
|
}
|
|
|
|
bool Entity::AddsToCoverage() const {
|
|
return adds_to_coverage_;
|
|
}
|
|
|
|
std::optional<Rect> Entity::GetCoverage() const {
|
|
if (!adds_to_coverage_) {
|
|
return std::nullopt;
|
|
}
|
|
|
|
return path_.GetBoundingBox();
|
|
}
|
|
|
|
void Entity::SetContents(std::shared_ptr<Contents> contents) {
|
|
contents_ = std::move(contents);
|
|
}
|
|
|
|
const std::shared_ptr<Contents>& Entity::GetContents() const {
|
|
return contents_;
|
|
}
|
|
|
|
void Entity::SetStencilDepth(uint32_t depth) {
|
|
stencil_depth_ = depth;
|
|
}
|
|
|
|
uint32_t Entity::GetStencilDepth() const {
|
|
return stencil_depth_;
|
|
}
|
|
|
|
void Entity::IncrementStencilDepth(uint32_t increment) {
|
|
stencil_depth_ += increment;
|
|
}
|
|
|
|
bool Entity::Render(ContentContext& renderer, RenderPass& parent_pass) const {
|
|
if (!contents_) {
|
|
return true;
|
|
}
|
|
|
|
return contents_->Render(renderer, *this, parent_pass);
|
|
}
|
|
|
|
} // namespace impeller
|