blob: f5289192b1d8932e1f1d869889315e0cefc0a4d1 [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.h"
#include "impeller/geometry/matrix.h"
#include "impeller/geometry/path.h"
namespace impeller {
class ColorSourceContents : public Contents {
public:
ColorSourceContents();
~ColorSourceContents() override;
void SetGeometry(std::unique_ptr<Geometry> geometry);
void SetMatrix(Matrix matrix);
void SetAlpha(Scalar alpha);
// |Contents|
std::optional<Rect> GetCoverage(const Entity& entity) const override;
// |Contents|
bool ShouldRender(const Entity& entity,
const std::optional<Rect>& stencil_coverage) const override;
protected:
const std::unique_ptr<Geometry>& GetGeometry() const;
const Matrix& GetInverseMatrix() const;
Scalar GetAlpha() const;
private:
std::unique_ptr<Geometry> geometry_;
Matrix inverse_matrix_;
Scalar alpha_ = 1.0;
FML_DISALLOW_COPY_AND_ASSIGN(ColorSourceContents);
};
} // namespace impeller