Flutter Engine
The Flutter Engine
clip_contents_unittests.cc
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#include <memory>
6#include <optional>
7
8#include "gtest/gtest.h"
9
17
18namespace impeller {
19namespace testing {
20
22
23TEST_P(EntityTest, ClipContentsOptimizesFullScreenIntersectClips) {
24 // Set up mock environment.
25
26 auto content_context = GetContentContext();
27 auto buffer = content_context->GetContext()->CreateCommandBuffer();
28 auto render_target =
29 GetContentContext()->GetRenderTargetCache()->CreateOffscreenMSAA(
30 *content_context->GetContext(), {100, 100},
31 /*mip_count=*/1);
32 auto render_pass = buffer->CreateRenderPass(render_target);
33 auto recording_pass = std::make_shared<RecordingRenderPass>(
34 render_pass, GetContext(), render_target);
35
36 // Set up clip contents.
37
38 auto contents = std::make_shared<ClipContents>();
39 contents->SetClipOperation(Entity::ClipOperation::kIntersect);
40 contents->SetGeometry(Geometry::MakeCover());
41
42 Entity entity;
43 entity.SetContents(std::move(contents));
44
45 // Render the clip contents.
46
47 ASSERT_TRUE(recording_pass->GetCommands().empty());
48 ASSERT_TRUE(entity.Render(*content_context, *recording_pass));
49 ASSERT_FALSE(recording_pass->GetCommands().empty());
50}
51
52} // namespace testing
53} // namespace impeller
void SetContents(std::shared_ptr< Contents > contents)
Definition: entity.cc:90
bool Render(const ContentContext &renderer, RenderPass &parent_pass) const
Definition: entity.cc:173
static std::shared_ptr< Geometry > MakeCover()
Definition: geometry.cc:85
SK_API GrDirectContext * GetContext(const SkImage *src)
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir Path to the cache directory This is different from the persistent_cache_path in embedder which is used for Skia shader cache icu native lib Path to the library file that exports the ICU data vm service The hostname IP address on which the Dart VM Service should be served If not defaults to or::depending on whether ipv6 is specified vm service A custom Dart VM Service port The default is to pick a randomly available open port disable vm Disable the Dart VM Service The Dart VM Service is never available in release mode disable vm service Disable mDNS Dart VM Service publication Bind to the IPv6 localhost address for the Dart VM Service Ignored if vm service host is set endless trace buffer
Definition: switches.h:126
TEST_P(AiksTest, CanRenderAdvancedBlendColorFilterWithSaveLayer)