Flutter Engine
The Flutter Engine
Public Member Functions | List of all members
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, DlImageSampling sampling)
 
bool IsReplacing (DiffContext *context, const Layer *layer) const override
 
void Diff (DiffContext *context, const Layer *old_layer) override
 
const TextureLayeras_texture_layer () const override
 
void Preroll (PrerollContext *context) override
 
void Paint (PaintContext &context) const override
 
- Public Member Functions inherited from flutter::Layer
 Layer ()
 
virtual ~Layer ()
 
void AssignOldLayer (Layer *old_layer)
 
virtual bool IsReplacing (DiffContext *context, const Layer *old_layer) const
 
virtual void Diff (DiffContext *context, const Layer *old_layer)
 
virtual void PreservePaintRegion (DiffContext *context)
 
virtual void Preroll (PrerollContext *context)=0
 
virtual void Paint (PaintContext &context) const =0
 
virtual void PaintChildren (PaintContext &context) const
 
bool subtree_has_platform_view () const
 
void set_subtree_has_platform_view (bool value)
 
const SkRectpaint_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
 
virtual RasterCacheKeyID caching_key_id () const
 
virtual const ContainerLayeras_container_layer () const
 
virtual const DisplayListLayeras_display_list_layer () const
 
virtual const TextureLayeras_texture_layer () const
 
virtual const PerformanceOverlayLayeras_performance_overlay_layer () const
 
virtual const testing::MockLayeras_mock_layer () const
 

Additional Inherited Members

- Static Public Attributes inherited from flutter::Layer
static constexpr int kSaveLayerRenderFlags
 
static constexpr int kRasterCacheRenderFlags
 

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,
DlImageSampling  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) {}
SkSamplingOptions sampling
Definition: SkRecords.h:337
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
Definition: switches.h:259
SeparatedVector2 offset
int64_t texture_id

Member Function Documentation

◆ as_texture_layer()

const TextureLayer * flutter::TextureLayer::as_texture_layer ( ) const
inlineoverridevirtual

Reimplemented from flutter::Layer.

Definition at line 28 of file texture_layer.h.

28{ return this; }

◆ Diff()

void flutter::TextureLayer::Diff ( DiffContext context,
const Layer old_layer 
)
overridevirtual

Reimplemented from flutter::Layer.

Definition at line 22 of file texture_layer.cc.

22 {
23 DiffContext::AutoSubtreeRestore subtree(context);
24 if (!context->IsSubtreeDirty()) {
25 FML_DCHECK(old_layer);
26 auto prev = old_layer->as_texture_layer();
27 // TODO(knopp) It would be nice to be able to determine that a texture is
28 // dirty
29 context->MarkSubtreeDirty(context->GetOldLayerPaintRegion(prev));
30 }
31
32 // Make sure DiffContext knows there is a TextureLayer in this subtree.
33 // This prevents ContainerLayer from skipping TextureLayer diffing when
34 // TextureLayer is inside retained layer.
35 // See ContainerLayer::DiffChildren
36 // https://github.com/flutter/flutter/issues/92925
37 context->MarkSubtreeHasTextureLayer();
38 context->AddLayerBounds(SkRect::MakeXYWH(offset_.x(), offset_.y(),
39 size_.width(), size_.height()));
40 context->SetLayerPaintRegion(this, context->CurrentSubtreeRegion());
41}
static float prev(float f)
#define FML_DCHECK(condition)
Definition: logging.h:103
constexpr float y() const
Definition: SkPoint_impl.h:187
constexpr float x() const
Definition: SkPoint_impl.h:181
static constexpr SkRect MakeXYWH(float x, float y, float w, float h)
Definition: SkRect.h:659
SkScalar width() const
Definition: SkSize.h:76
SkScalar height() const
Definition: SkSize.h:77

◆ IsReplacing()

bool flutter::TextureLayer::IsReplacing ( DiffContext context,
const Layer layer 
) const
inlineoverridevirtual

Reimplemented from flutter::Layer.

Definition at line 22 of file texture_layer.h.

22 {
23 return layer->as_texture_layer() != nullptr;
24 }

◆ Paint()

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

Implements flutter::Layer.

Definition at line 50 of file texture_layer.cc.

50 {
51 FML_DCHECK(needs_painting(context));
52
53 std::shared_ptr<Texture> texture =
54 context.texture_registry
55 ? context.texture_registry->GetTexture(texture_id_)
56 : nullptr;
57 if (!texture) {
58 TRACE_EVENT_INSTANT0("flutter", "null texture");
59 return;
60 }
62 Texture::PaintContext ctx{
63 .canvas = context.canvas,
64 .gr_context = context.gr_context,
65 .aiks_context = context.aiks_context,
66 .paint = context.state_stack.fill(paint),
67 };
68 texture->Paint(ctx, paint_bounds(), freeze_, sampling_);
69}
const SkRect & paint_bounds() const
Definition: layer.h:210
bool needs_painting(PaintContext &context) const
Definition: layer.h:232
const Paint & paint
Definition: color_source.cc:38
FlTexture * texture
flutter::DlPaint DlPaint
#define TRACE_EVENT_INSTANT0(category_group, name)
Definition: trace_event.h:175

◆ Preroll()

void flutter::TextureLayer::Preroll ( PrerollContext context)
overridevirtual

Implements flutter::Layer.

Definition at line 43 of file texture_layer.cc.

43 {
44 set_paint_bounds(SkRect::MakeXYWH(offset_.x(), offset_.y(), size_.width(),
45 size_.height()));
46 context->has_texture_layer = true;
47 context->renderable_state_flags = LayerStateStack::kCallerCanApplyOpacity;
48}
static constexpr int kCallerCanApplyOpacity
void set_paint_bounds(const SkRect &paint_bounds)
Definition: layer.h:223

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