| Flutter Impeller |

checkerboard_contents.h
Go to the documentation of this file.
1 // Copyright 2013 The Flutter Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #pragma once
6
7 #include "flutter/fml/macros.h"
8 #include "impeller/entity/contents/contents.h"
9
10 namespace impeller {
11
12 /// A special Contents that renders a translucent checkerboard pattern with a
13 /// random color over the entire pass texture. This is useful for visualizing
14 /// offscreen textures.
15 class CheckerboardContents final : public Contents {
16 public:
17 CheckerboardContents();
18
19 // |Contents|
20 ~CheckerboardContents() override;
21
22 // |Contents|
23 bool Render(const ContentContext& renderer,
24 const Entity& entity,
25 RenderPass& pass) const override;
26
27 // |Contents|
28 std::optional<Rect> GetCoverage(const Entity& entity) const override;
29
30 void SetColor(Color color);
31
32 void SetSquareSize(Scalar square_size);
33
34 private:
35 Color color_ = Color::Red().WithAlpha(0.25);
36 Scalar square_size_ = 12;
37
38 FML_DISALLOW_COPY_AND_ASSIGN(CheckerboardContents);
39 };
40
41 } // namespace impeller
contents.h
impeller::Scalar
float Scalar
Definition: scalar.h:15
impeller::CheckerboardContents::~CheckerboardContents
~CheckerboardContents() override
impeller::Color::Red
static constexpr Color Red()
Definition: color.h:262
impeller::Color
Definition: color.h:122
impeller::Entity
Definition: entity.h:21
impeller::CheckerboardContents::SetSquareSize
void SetSquareSize(Scalar square_size)
Definition: checkerboard_contents.cc:66
impeller::Color::WithAlpha
constexpr Color WithAlpha(Scalar new_alpha) const
Definition: color.h:268
impeller::CheckerboardContents::Render
bool Render(const ContentContext &renderer, const Entity &entity, RenderPass &pass) const override
Definition: checkerboard_contents.cc:20
impeller::RenderPass
Render passes encode render commands directed as one specific render target into an underlying comman...
Definition: render_pass.h:27
impeller::CheckerboardContents::SetColor
void SetColor(Color color)
Definition: checkerboard_contents.cc:62
impeller::CheckerboardContents
Definition: checkerboard_contents.h:15
impeller::CheckerboardContents::GetCoverage
std::optional< Rect > GetCoverage(const Entity &entity) const override
Get the screen space bounding rectangle that this contents affects.
Definition: checkerboard_contents.cc:57
impeller::Contents
Definition: contents.h:33
impeller
Definition: aiks_context.cc:10
impeller::ContentContext
Definition: content_context.h:344
impeller::CheckerboardContents::CheckerboardContents
CheckerboardContents()