7#include "flutter/shell/common/snapshot_controller_skia.h"
10#include "flutter/flow/surface.h"
11#include "flutter/fml/trace_event.h"
12#include "flutter/shell/common/snapshot_controller.h"
27 draw_callback(
surface->getCanvas());
30 dContext->flushAndSubmit();
36 device_snapshot =
surface->makeImageSnapshot();
39 if (device_snapshot ==
nullptr) {
69 std::unique_ptr<Surface> pbuffer_surface;
70 Surface* snapshot_surface =
nullptr;
72 if (delegate.GetSurface() && delegate.GetSurface()->GetContext()) {
73 snapshot_surface = delegate.GetSurface().get();
74 }
else if (delegate.GetSnapshotSurfaceProducer()) {
76 delegate.GetSnapshotSurfaceProducer()->CreateSnapshotSurface();
77 if (pbuffer_surface && pbuffer_surface->GetContext()) {
78 snapshot_surface = pbuffer_surface.get();
82 if (!snapshot_surface) {
86 result = DrawSnapshot(sk_surface, draw_callback);
88 delegate.GetIsGpuDisabledSyncSwitch()->Execute(
98 if (!context_switch->GetResult()) {
105 1.0,
static_cast<double>(max_size) /
112 if (scale_factor < 1.0) {
113 image_info = image_info.
makeWH(
114 static_cast<double>(image_info.
width()) * scale_factor,
115 static_cast<double>(image_info.
height()) * scale_factor);
127 <<
"DoMakeRasterSnapshot can not create GPU render target";
132 result = DrawSnapshot(sk_surface, draw_callback);
144 return DoMakeRasterSnapshot(
size, [display_list](
SkCanvas* canvas) {
159 if (
image ==
nullptr) {
165 auto result = DoMakeRasterSnapshot(
169 return result->skia_image();
173 const std::shared_ptr<impeller::RuntimeStage>& runtime_stage) {}
static GrDirectContext * GrAsDirectContext(GrContext_Base *base)
SK_API int maxRenderTargetSize() const
void scale(SkScalar sx, SkScalar sy)
void drawImage(const SkImage *image, SkScalar left, SkScalar top)
static sk_sp< SkColorSpace > MakeSRGB()
sk_sp< SkImage > makeRasterImage(GrDirectContext *, CachingHint cachingHint=kDisallow_CachingHint) const
SkISize dimensions() const
static sk_sp< DlImage > Make(const SkImage *image)
Backend implementation of |DlCanvas| for |SkCanvas|.
void DrawDisplayList(const sk_sp< DisplayList > display_list, SkScalar opacity=SK_Scalar1) override
void CacheRuntimeStage(const std::shared_ptr< impeller::RuntimeStage > &runtime_stage) override
void MakeRasterSnapshot(sk_sp< DisplayList > display_list, SkISize picture_size, std::function< void(const sk_sp< DlImage > &)> callback) override
virtual sk_sp< SkImage > ConvertToRasterImage(sk_sp< SkImage > image) override
sk_sp< DlImage > MakeRasterSnapshotSync(sk_sp< DisplayList > display_list, SkISize size) override
const Delegate & GetDelegate()
Abstract Base Class that represents where we will be rendering content.
virtual GrDirectContext * GetContext()=0
virtual std::unique_ptr< GLContextResult > MakeRenderContextCurrent()
FlKeyEvent uint64_t FlKeyResponderAsyncCallback callback
#define FML_LOG(severity)
#define FML_DCHECK(condition)
Dart_NativeFunction function
static float max(float r, float g, float b)
static float min(float r, float g, float b)
SK_API GrDirectContext * GetContext(const SkImage *src)
sk_sp< const SkImage > image
SK_API sk_sp< SkSurface > Raster(const SkImageInfo &imageInfo, size_t rowBytes, const SkSurfaceProps *surfaceProps)
SK_API sk_sp< SkSurface > RenderTarget(GrRecordingContext *context, skgpu::Budgeted budgeted, const SkImageInfo &imageInfo, int sampleCount, GrSurfaceOrigin surfaceOrigin, const SkSurfaceProps *surfaceProps, bool shouldCreateWithMips=false, bool isProtected=false)
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
SkImageInfo makeWH(int newWidth, int newHeight) const
static SkImageInfo MakeN32Premul(int width, int height)
Represents the 2 code paths available when calling |SyncSwitch::Execute|.
#define TRACE_EVENT0(category_group, name)