blob: 0d0392d6e7ccb8b7383eedae1b4cc5b4c4571cd1 [file] [log] [blame]
// 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.
#pragma once
#include "flutter/fml/macros.h"
#include "impeller/entity/contents/contents.h"
#include "impeller/entity/geometry/geometry.h"
#include "impeller/geometry/matrix.h"
#include "impeller/geometry/path.h"
namespace impeller {
class ColorSourceContents : public Contents {
public:
ColorSourceContents();
~ColorSourceContents() override;
void SetGeometry(std::shared_ptr<Geometry> geometry);
void SetEffectTransform(Matrix matrix);
const Matrix& GetInverseMatrix() const;
void SetOpacity(Scalar opacity);
// |Contents|
std::optional<Rect> GetCoverage(const Entity& entity) const override;
// |Contents|
bool ShouldRender(const Entity& entity,
const std::optional<Rect>& stencil_coverage) const override;
// |Contents|
bool CanInheritOpacity(const Entity& entity) const override;
// |Contents|
void SetInheritedOpacity(Scalar opacity) override;
Scalar GetOpacity() const;
const std::shared_ptr<Geometry>& GetGeometry() const;
private:
std::shared_ptr<Geometry> geometry_;
Matrix inverse_matrix_;
Scalar opacity_ = 1.0;
Scalar inherited_opacity_ = 1.0;
FML_DISALLOW_COPY_AND_ASSIGN(ColorSourceContents);
};
} // namespace impeller