Flutter Engine
 
Loading...
Searching...
No Matches
gpu_surface_noop.mm
Go to the documentation of this file.
1// Copyright 2013 The Flutter Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
6
7#import <Metal/Metal.h>
8#import <QuartzCore/QuartzCore.h>
9
10#include "flow/surface.h"
11#include "flow/surface_frame.h"
13#include "flutter/fml/mapping.h"
15
16static_assert(__has_feature(objc_arc), "ARC must be enabled.");
17
18namespace flutter {
19
21
23
24// |Surface|
26 return true;
27}
28
32
33// |Surface|
34std::unique_ptr<SurfaceFrame> GPUSurfaceNoop::AcquireFrame(const DlISize& frame_size) {
35 auto callback = [](const SurfaceFrame&, DlCanvas*) { return true; };
36 auto submit_callback = [](const SurfaceFrame&) { return true; };
37 SurfaceFrame::FramebufferInfo framebuffer_info;
38
39 return std::make_unique<SurfaceFrame>(
40 /*surface=*/nullptr,
41 /*framebuffer_info=*/framebuffer_info,
42 /*encode_callback=*/callback,
43 /*submit_callback=*/submit_callback,
44 /*frame_size=*/frame_size,
45 /*context_result=*/nullptr,
46 /*display_list_fallback=*/true);
47}
48
49std::unique_ptr<SurfaceFrame> GPUSurfaceNoop::AcquireFrameFromMTLTexture(
50 const DlISize& frame_size) {
51 auto callback = [](const SurfaceFrame&, DlCanvas*) { return true; };
52 auto submit_callback = [](const SurfaceFrame&) { return true; };
53 SurfaceFrame::FramebufferInfo framebuffer_info;
54
55 return std::make_unique<SurfaceFrame>(
56 /*surface=*/nullptr,
57 /*framebuffer_info=*/framebuffer_info,
58 /*encode_callback=*/callback,
59 /*submit_callback=*/submit_callback,
60 /*frame_size=*/frame_size,
61 /*context_result=*/nullptr,
62 /*display_list_fallback=*/true);
63}
64
65// |Surface|
66DlMatrix GPUSurfaceNoop::GetRootTransformation() const {
67 // This backend does not currently support root surface transformations. Just
68 // return identity.
69 return {};
70}
71
72// |Surface|
73GrDirectContext* GPUSurfaceNoop::GetContext() {
74 return nullptr;
75}
76
77// |Surface|
78std::unique_ptr<GLContextResult> GPUSurfaceNoop::MakeRenderContextCurrent() {
79 // This backend has no such concept.
80 return std::make_unique<GLContextDefaultResult>(true);
81}
82
83bool GPUSurfaceNoop::AllowsDrawingWhenGpuDisabled() const {
84 return true;
85}
86
87// |Surface|
88bool GPUSurfaceNoop::EnableRasterCache() const {
89 return false;
90}
91
92// |Surface|
93std::shared_ptr<impeller::AiksContext> GPUSurfaceNoop::GetAiksContext() const {
94 return nullptr;
95}
96
97} // namespace flutter
Developer-facing API for rendering anything within the engine.
Definition dl_canvas.h:32
Surface::SurfaceData GetSurfaceData() const override
FlutterDesktopBinaryReply callback
impeller::Matrix DlMatrix
impeller::ISize32 DlISize
flutter::DlCanvas DlCanvas
A screenshot of the surface's raw data.
Definition surface.h:29