Flutter Impeller
impeller::testing::VulkanScreenshotter Class Reference

#include <vulkan_screenshotter.h>

Inheritance diagram for impeller::testing::VulkanScreenshotter:
impeller::testing::Screenshotter

Public Member Functions

 VulkanScreenshotter (const std::unique_ptr< PlaygroundImpl > &playground)
 
std::unique_ptr< ScreenshotMakeScreenshot (AiksContext &aiks_context, const Picture &picture, const ISize &size={300, 300}, bool scale_content=true) override
 
PlaygroundImplGetPlayground () override
 
- Public Member Functions inherited from impeller::testing::Screenshotter
virtual ~Screenshotter ()=default
 

Detailed Description

Converts Pictures and DisplayLists to MetalScreenshots with the playground backend.

Definition at line 19 of file vulkan_screenshotter.h.

Constructor & Destructor Documentation

◆ VulkanScreenshotter()

impeller::testing::VulkanScreenshotter::VulkanScreenshotter ( const std::unique_ptr< PlaygroundImpl > &  playground)
explicit

Definition at line 103 of file vulkan_screenshotter.mm.

105  : playground_(playground) {
106  FML_CHECK(playground_);
107 }

Member Function Documentation

◆ GetPlayground()

PlaygroundImpl& impeller::testing::VulkanScreenshotter::GetPlayground ( )
inlineoverridevirtual

Implements impeller::testing::Screenshotter.

Definition at line 30 of file vulkan_screenshotter.h.

30 { return *playground_; }

◆ MakeScreenshot()

std::unique_ptr< Screenshot > impeller::testing::VulkanScreenshotter::MakeScreenshot ( AiksContext aiks_context,
const Picture picture,
const ISize size = {300, 300},
bool  scale_content = true 
)
overridevirtual

Implements impeller::testing::Screenshotter.

Definition at line 109 of file vulkan_screenshotter.mm.

113  {
114  Vector2 content_scale =
115  scale_content ? playground_->GetContentScale() : Vector2{1, 1};
116  std::shared_ptr<Image> image = picture.ToImage(
117  aiks_context,
118  ISize(size.width * content_scale.x, size.height * content_scale.y));
119  std::shared_ptr<Texture> texture = image->GetTexture();
120  return ReadTexture(aiks_context.GetContext(), texture);
121 }

References impeller::AiksContext::GetContext(), impeller::TSize< T >::height, impeller::Picture::ToImage(), impeller::TSize< T >::width, impeller::TPoint< T >::x, and impeller::TPoint< T >::y.


The documentation for this class was generated from the following files:
impeller::Vector2
Point Vector2
Definition: point.h:320
impeller::ISize
TSize< int64_t > ISize
Definition: size.h:138