14#include "third_party/skia/include/core/SkSurface.h"
23 std::unique_ptr<GLContextResult> context_result,
24 bool display_list_fallback)
26 framebuffer_info_(framebuffer_info),
27 encode_callback_(encode_callback),
28 submit_callback_(submit_callback),
29 context_result_(
std::move(context_result)) {
36 FML_LOG(FATAL) <<
"Impeller opt-out unavailable.";
39 }
else if (display_list_fallback) {
48 canvas_ = dl_builder_.get();
58 encoded_ = PerformEncode();
65 if (!encoded_ && !
Encode()) {
73 submitted_ = PerformSubmit();
90bool SurfaceFrame::PerformEncode() {
91 if (encode_callback_ ==
nullptr) {
95 if (encode_callback_(*
this,
Canvas())) {
102bool SurfaceFrame::PerformSubmit() {
103 if (submit_callback_ ==
nullptr) {
107 if (submit_callback_(*
this)) {
115 TRACE_EVENT0(
"impeller",
"SurfaceFrame::BuildDisplayList");
116 return dl_builder_ ? dl_builder_->Build() :
nullptr;
Developer-facing API for rendering anything within the engine.
void set_canvas(SkCanvas *canvas)
sk_sp< DisplayList > BuildDisplayList()
sk_sp< SkSurface > SkiaSurface() const
std::function< bool(SurfaceFrame &surface_frame, DlCanvas *canvas)> EncodeCallback
std::function< bool(SurfaceFrame &surface_frame)> SubmitCallback
SurfaceFrame(sk_sp< SkSurface > surface, FramebufferInfo framebuffer_info, const EncodeCallback &encode_callback, const SubmitCallback &submit_callback, DlISize frame_size, std::unique_ptr< GLContextResult > context_result=nullptr, bool display_list_fallback=false)
#define FML_LOG(severity)
#define FML_DCHECK(condition)
static constexpr TRect MakeSize(const TSize< U > &size)
constexpr bool IsEmpty() const
Returns true if either of the width or height are 0, negative, or NaN.
#define TRACE_EVENT0(category_group, name)