Flutter Engine
flutter::TextureLayer Class Reference

#include <texture_layer.h>

Inheritance diagram for flutter::TextureLayer:
flutter::Layer

Public Member Functions

 TextureLayer (const SkPoint &offset, const SkSize &size, int64_t texture_id, bool freeze, const SkSamplingOptions &sampling)
 
void Preroll (PrerollContext *context, const SkMatrix &matrix) override
 
void Paint (PaintContext &context) const override
 
- Public Member Functions inherited from flutter::Layer
 Layer ()
 
virtual ~Layer ()
 
void AssignOldLayer (Layer *old_layer)
 
bool subtree_has_platform_view () const
 
void set_subtree_has_platform_view (bool value)
 
const SkRect & paint_bounds () const
 
void set_paint_bounds (const SkRect &paint_bounds)
 
bool is_empty () const
 
bool needs_painting (PaintContext &context) const
 
uint64_t original_layer_id () const
 
uint64_t unique_id () const
 

Detailed Description

Definition at line 14 of file texture_layer.h.

Constructor & Destructor Documentation

◆ TextureLayer()

flutter::TextureLayer::TextureLayer ( const SkPoint &  offset,
const SkSize &  size,
int64_t  texture_id,
bool  freeze,
const SkSamplingOptions &  sampling 
)

Definition at line 11 of file texture_layer.cc.

16  : offset_(offset),
17  size_(size),
18  texture_id_(texture_id),
19  freeze_(freeze),
20  sampling_(sampling) {}
int64_t texture_id
constexpr std::size_t size(T(&array)[N])
Definition: size.h:13

Member Function Documentation

◆ Paint()

void flutter::TextureLayer::Paint ( PaintContext context) const
overridevirtual

Implements flutter::Layer.

Definition at line 48 of file texture_layer.cc.

References FML_DCHECK, flutter::TextureRegistry::GetTexture(), flutter::Layer::PaintContext::gr_context, flutter::Layer::PaintContext::leaf_nodes_canvas, flutter::Layer::needs_painting(), flutter::Layer::paint_bounds(), texture, flutter::Layer::PaintContext::texture_registry, TRACE_EVENT0, and TRACE_EVENT_INSTANT0.

48  {
49  TRACE_EVENT0("flutter", "TextureLayer::Paint");
50  FML_DCHECK(needs_painting(context));
51 
52  std::shared_ptr<Texture> texture =
53  context.texture_registry.GetTexture(texture_id_);
54  if (!texture) {
55  TRACE_EVENT_INSTANT0("flutter", "null texture");
56  return;
57  }
58  texture->Paint(*context.leaf_nodes_canvas, paint_bounds(), freeze_,
59  context.gr_context, sampling_);
60 }
G_BEGIN_DECLS FlTexture * texture
#define TRACE_EVENT0(category_group, name)
Definition: trace_event.h:90
#define FML_DCHECK(condition)
Definition: logging.h:86
#define TRACE_EVENT_INSTANT0(category_group, name)
Definition: trace_event.h:119
bool needs_painting(PaintContext &context) const
Definition: layer.h:249
const SkRect & paint_bounds() const
Definition: layer.h:227

◆ Preroll()

void flutter::TextureLayer::Preroll ( PrerollContext context,
const SkMatrix &  matrix 
)
overridevirtual

Reimplemented from flutter::Layer.

Definition at line 40 of file texture_layer.cc.

References flutter::PrerollContext::has_texture_layer, flutter::Layer::set_paint_bounds(), and TRACE_EVENT0.

40  {
41  TRACE_EVENT0("flutter", "TextureLayer::Preroll");
42 
43  set_paint_bounds(SkRect::MakeXYWH(offset_.x(), offset_.y(), size_.width(),
44  size_.height()));
45  context->has_texture_layer = true;
46 }
#define TRACE_EVENT0(category_group, name)
Definition: trace_event.h:90
void set_paint_bounds(const SkRect &paint_bounds)
Definition: layer.h:240

The documentation for this class was generated from the following files: