5#ifndef FLUTTER_FLOW_COMPOSITOR_CONTEXT_H_
6#define FLUTTER_FLOW_COMPOSITOR_CONTEXT_H_
11#include "flutter/common/graphics/texture.h"
12#include "flutter/common/macros.h"
13#include "flutter/flow/diff_context.h"
14#include "flutter/flow/embedded_views.h"
15#include "flutter/flow/layer_snapshot_store.h"
16#include "flutter/flow/raster_cache.h"
17#include "flutter/flow/stopwatch.h"
18#include "flutter/fml/macros.h"
19#include "flutter/fml/raster_thread_merger.h"
56 prev_layer_tree_ = prev_layer_tree;
62 additional_damage_.
join(damage);
67 horizontal_clip_alignment_ = horizontal;
68 vertical_clip_alignment_ = vertical;
77 bool has_raster_cache,
78 bool impeller_enabled);
82 return damage_ ? std::make_optional(damage_->frame_damage) : std::nullopt;
87 return (damage_ && !ignore_damage_)
88 ? std::make_optional(damage_->buffer_damage)
96 void Reset() { ignore_damage_ =
true; }
100 std::optional<Damage> damage_;
101 const LayerTree* prev_layer_tree_ =
nullptr;
102 int vertical_clip_alignment_ = 1;
103 int horizontal_clip_alignment_ = 1;
104 bool ignore_damage_ =
false;
116 bool instrumentation_enabled,
130 return root_surface_transformation_;
140 bool ignore_raster_cache,
145 std::optional<SkRect> clip_rect,
146 bool needs_save_layer,
147 bool ignore_raster_cache);
150 std::optional<SkRect> clip_rect,
151 bool ignore_raster_cache);
158 const SkMatrix& root_surface_transformation_;
159 const bool instrumentation_enabled_;
160 const bool surface_supports_readback_;
176 const SkMatrix& root_surface_transformation,
177 bool instrumentation_enabled,
178 bool surface_supports_readback,
191 return texture_registry_;
202 std::shared_ptr<TextureRegistry> texture_registry_;
210 void BeginFrame(ScopedFrame&
frame,
bool enable_instrumentation);
212 void EndFrame(ScopedFrame&
frame,
bool enable_instrumentation);
217 static bool ShouldPerformPartialRepaint(std::optional<SkRect> damage_rect,
ExternalViewEmbedder * view_embedder()
ScopedFrame(CompositorContext &context, GrDirectContext *gr_context, DlCanvas *canvas, ExternalViewEmbedder *view_embedder, const SkMatrix &root_surface_transformation, bool instrumentation_enabled, bool surface_supports_readback, fml::RefPtr< fml::RasterThreadMerger > raster_thread_merger, impeller::AiksContext *aiks_context)
GrDirectContext * gr_context() const
CompositorContext & context() const
virtual RasterStatus Raster(LayerTree &layer_tree, bool ignore_raster_cache, FrameDamage *frame_damage)
impeller::AiksContext * aiks_context() const
bool surface_supports_readback()
const SkMatrix & root_surface_transformation() const
const Stopwatch & raster_time() const
void OnGrContextCreated()
std::shared_ptr< TextureRegistry > texture_registry()
LayerSnapshotStore & snapshot_store()
virtual std::unique_ptr< ScopedFrame > AcquireFrame(GrDirectContext *gr_context, DlCanvas *canvas, ExternalViewEmbedder *view_embedder, const SkMatrix &root_surface_transformation, bool instrumentation_enabled, bool surface_supports_readback, fml::RefPtr< fml::RasterThreadMerger > raster_thread_merger, impeller::AiksContext *aiks_context)
void OnGrContextDestroyed()
RasterCache & raster_cache()
virtual ~CompositorContext()
Developer-facing API for rendering anything within the engine.
Used for fixed refresh rate query cases.
void SetPreviousLayerTree(const LayerTree *prev_layer_tree)
void SetClipAlignment(int horizontal, int vertical)
std::optional< SkIRect > GetFrameDamage() const
std::optional< SkRect > ComputeClipRect(flutter::LayerTree &layer_tree, bool has_raster_cache, bool impeller_enabled)
std::optional< SkIRect > GetBufferDamage()
void AddAdditionalDamage(const SkIRect &damage)
Collects snapshots of layers during frame rasterization.
The refresh rate interface for Stopwatch.
void join(const SkIRect &r)
static constexpr SkIRect MakeEmpty()