Flutter Impeller
impeller::BlitCopyTextureToTextureCommandMTL Struct Reference

#include <blit_command_mtl.h>

Inheritance diagram for impeller::BlitCopyTextureToTextureCommandMTL:
impeller::BlitCopyTextureToTextureCommand impeller::BlitEncodeMTL impeller::BlitCommand impeller::BackendCast< BlitEncodeMTL, BlitCommand >

Public Member Functions

 ~BlitCopyTextureToTextureCommandMTL () override
 
std::string GetLabel () const override
 
bool Encode (id< MTLBlitCommandEncoder > encoder) const override
 
- Public Member Functions inherited from impeller::BlitEncodeMTL
virtual ~BlitEncodeMTL ()
 

Additional Inherited Members

- Static Public Member Functions inherited from impeller::BackendCast< BlitEncodeMTL, BlitCommand >
static BlitEncodeMTLCast (BlitCommand &base)
 
static const BlitEncodeMTLCast (const BlitCommand &base)
 
static BlitEncodeMTLCast (BlitCommand *base)
 
static const BlitEncodeMTLCast (const BlitCommand *base)
 
- Public Attributes inherited from impeller::BlitCopyTextureToTextureCommand
std::shared_ptr< Texturesource
 
std::shared_ptr< Texturedestination
 
IRect source_region
 
IPoint destination_origin
 
- Public Attributes inherited from impeller::BlitCommand
std::string label
 

Detailed Description

Definition at line 25 of file blit_command_mtl.h.

Constructor & Destructor Documentation

◆ ~BlitCopyTextureToTextureCommandMTL()

impeller::BlitCopyTextureToTextureCommandMTL::~BlitCopyTextureToTextureCommandMTL ( )
overridedefault

Member Function Documentation

◆ Encode()

bool impeller::BlitCopyTextureToTextureCommandMTL::Encode ( id< MTLBlitCommandEncoder >  encoder) const
overridevirtual

Implements impeller::BlitEncodeMTL.

Definition at line 21 of file blit_command_mtl.mm.

22  {
23  auto source_mtl = TextureMTL::Cast(*source).GetMTLTexture();
24  if (!source_mtl) {
25  return false;
26  }
27 
28  auto destination_mtl = TextureMTL::Cast(*destination).GetMTLTexture();
29  if (!destination_mtl) {
30  return false;
31  }
32 
33  auto source_origin_mtl =
34  MTLOriginMake(source_region.GetX(), source_region.GetY(), 0);
35  auto source_size_mtl =
36  MTLSizeMake(source_region.GetWidth(), source_region.GetHeight(), 1);
37  auto destination_origin_mtl =
38  MTLOriginMake(destination_origin.x, destination_origin.y, 0);
39 
40  [encoder copyFromTexture:source_mtl
41  sourceSlice:0
42  sourceLevel:0
43  sourceOrigin:source_origin_mtl
44  sourceSize:source_size_mtl
45  toTexture:destination_mtl
46  destinationSlice:0
47  destinationLevel:0
48  destinationOrigin:destination_origin_mtl];
49 
50  return true;
51 };

References impeller::BackendCast< TextureMTL, Texture >::Cast(), impeller::BlitCopyTextureToTextureCommand::destination_origin, impeller::TRect< T >::GetHeight(), impeller::TextureMTL::GetMTLTexture(), impeller::TRect< T >::GetWidth(), impeller::TRect< T >::GetX(), impeller::TRect< T >::GetY(), impeller::BlitCopyTextureToTextureCommand::source_region, impeller::TPoint< T >::x, and impeller::TPoint< T >::y.

◆ GetLabel()

std::string impeller::BlitCopyTextureToTextureCommandMTL::GetLabel ( ) const
overridevirtual

Implements impeller::BlitEncodeMTL.

Definition at line 17 of file blit_command_mtl.mm.

17  {
18  return label;
19 }

References impeller::BlitCommand::label.


The documentation for this struct was generated from the following files:
impeller::TPoint::y
Type y
Definition: point.h:31
impeller::TextureMTL::GetMTLTexture
id< MTLTexture > GetMTLTexture() const
Definition: texture_mtl.mm:116
impeller::TRect::GetX
constexpr Type GetX() const
Returns the X coordinate of the upper left corner, equivalent to |GetOrigin().x|.
Definition: rect.h:300
impeller::TRect::GetHeight
constexpr Type GetHeight() const
Returns the height of the rectangle, equivalent to |GetSize().height|.
Definition: rect.h:314
impeller::BlitCopyTextureToTextureCommand::destination_origin
IPoint destination_origin
Definition: blit_command.h:22
impeller::BlitCommand::label
std::string label
Definition: blit_command.h:15
impeller::TRect::GetWidth
constexpr Type GetWidth() const
Returns the width of the rectangle, equivalent to |GetSize().width|.
Definition: rect.h:308
impeller::TPoint::x
Type x
Definition: point.h:30
impeller::BackendCast< TextureMTL, Texture >::Cast
static TextureMTL & Cast(Texture &base)
Definition: backend_cast.h:13
impeller::BlitCopyTextureToTextureCommand::source_region
IRect source_region
Definition: blit_command.h:21
impeller::TRect::GetY
constexpr Type GetY() const
Returns the Y coordinate of the upper left corner, equivalent to |GetOrigin().y|.
Definition: rect.h:304