Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
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#ifndef FLUTTER_IMPELLER_ENTITY_CONTENTS_CHECKERBOARD_CONTENTS_H_
6#define FLUTTER_IMPELLER_ENTITY_CONTENTS_CHECKERBOARD_CONTENTS_H_
7
9
10namespace 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.
15class CheckerboardContents final : public Contents {
16 public:
18
19 // |Contents|
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
39
40 CheckerboardContents& operator=(const CheckerboardContents&) = delete;
41};
42
43} // namespace impeller
44
45#endif // FLUTTER_IMPELLER_ENTITY_CONTENTS_CHECKERBOARD_CONTENTS_H_
SkColor4f color
bool Render(const ContentContext &renderer, const Entity &entity, RenderPass &pass) const override
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.
void SetSquareSize(Scalar square_size)
Render passes encode render commands directed as one specific render target into an underlying comman...
Definition render_pass.h:33
float Scalar
Definition scalar.h:18
constexpr Color WithAlpha(Scalar new_alpha) const
Definition color.h:270
static constexpr Color Red()
Definition color.h:264