Flutter Engine
 
Loading...
Searching...
No Matches
flutter::TextureLayer Class Reference

#include <texture_layer.h>

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

Public Member Functions

 TextureLayer (const DlPoint &offset, const DlSize &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 void PreservePaintRegion (DiffContext *context)
 
virtual void PaintChildren (PaintContext &context) const
 
bool subtree_has_platform_view () const
 
void set_subtree_has_platform_view (bool value)
 
const DlRectpaint_bounds () const
 
void set_paint_bounds (const DlRect &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 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 12 of file texture_layer.h.

Constructor & Destructor Documentation

◆ TextureLayer()

flutter::TextureLayer::TextureLayer ( const DlPoint offset,
const DlSize 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) {}
it will be possible to load the file into Perfetto s trace viewer use test Running tests that layout and measure text will not yield consistent results across various platforms Enabling this option will make font resolution default to the Ahem test font on all 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
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 26 of file texture_layer.h.

26{ 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(DlRect::MakeOriginSize(offset_, size_));
39 context->SetLayerPaintRegion(this, context->CurrentSubtreeRegion());
40}
#define FML_DCHECK(condition)
Definition logging.h:122
static constexpr TRect MakeOriginSize(const TPoint< Type > &origin, const TSize< Type > &size)
Definition rect.h:144

References flutter::DiffContext::AddLayerBounds(), flutter::Layer::as_texture_layer(), flutter::DiffContext::CurrentSubtreeRegion(), FML_DCHECK, flutter::DiffContext::GetOldLayerPaintRegion(), flutter::DiffContext::IsSubtreeDirty(), impeller::TRect< Scalar >::MakeOriginSize(), flutter::DiffContext::MarkSubtreeDirty(), flutter::DiffContext::MarkSubtreeHasTextureLayer(), and flutter::DiffContext::SetLayerPaintRegion().

◆ IsReplacing()

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

Reimplemented from flutter::Layer.

Definition at line 20 of file texture_layer.h.

20 {
21 return layer->as_texture_layer() != nullptr;
22 }

References flutter::Layer::as_texture_layer().

◆ Paint()

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

Implements flutter::Layer.

Definition at line 48 of file texture_layer.cc.

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

References flutter::PaintContext::aiks_context, flutter::Texture::PaintContext::canvas, flutter::PaintContext::canvas, flutter::LayerStateStack::fill(), FML_DCHECK, flutter::PaintContext::gr_context, flutter::Layer::needs_painting(), flutter::Layer::paint_bounds(), flutter::PaintContext::state_stack, texture, flutter::PaintContext::texture_registry, and TRACE_EVENT_INSTANT0.

◆ Preroll()

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

Implements flutter::Layer.

Definition at line 42 of file texture_layer.cc.

42 {
44 context->has_texture_layer = true;
45 context->renderable_state_flags = LayerStateStack::kCallerCanApplyOpacity;
46}
void set_paint_bounds(const DlRect &paint_bounds)
Definition layer.h:209
static constexpr int kCallerCanApplyOpacity

References flutter::PrerollContext::has_texture_layer, flutter::LayerStateStack::kCallerCanApplyOpacity, impeller::TRect< Scalar >::MakeOriginSize(), flutter::PrerollContext::renderable_state_flags, and flutter::Layer::set_paint_bounds().


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