Flutter Engine
android_surface_software.h
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 
5 #ifndef FLUTTER_SHELL_PLATFORM_ANDROID_ANDROID_SURFACE_SOFTWARE_H_
6 #define FLUTTER_SHELL_PLATFORM_ANDROID_ANDROID_SURFACE_SOFTWARE_H_
7 
8 #include "flutter/fml/macros.h"
9 #include "flutter/fml/platform/android/jni_weak_ref.h"
10 #include "flutter/fml/platform/android/scoped_java_ref.h"
11 #include "flutter/shell/gpu/gpu_surface_software.h"
12 #include "flutter/shell/platform/android/jni/platform_view_android_jni.h"
13 #include "flutter/shell/platform/android/surface/android_surface.h"
14 
15 namespace flutter {
16 
19  public:
20  AndroidSurfaceSoftware(const std::shared_ptr<AndroidContext>& android_context,
21  std::shared_ptr<PlatformViewAndroidJNI> jni_facade);
22 
23  ~AndroidSurfaceSoftware() override;
24 
25  // |AndroidSurface|
26  bool IsValid() const override;
27 
28  // |AndroidSurface|
29  bool ResourceContextMakeCurrent() override;
30 
31  // |AndroidSurface|
32  bool ResourceContextClearCurrent() override;
33 
34  // |AndroidSurface|
35  std::unique_ptr<Surface> CreateGPUSurface(
36  GrDirectContext* gr_context) override;
37 
38  // |AndroidSurface|
39  void TeardownOnScreenContext() override;
40 
41  // |AndroidSurface|
42  bool OnScreenSurfaceResize(const SkISize& size) override;
43 
44  // |AndroidSurface|
46 
47  // |GPUSurfaceSoftwareDelegate|
48  sk_sp<SkSurface> AcquireBackingStore(const SkISize& size) override;
49 
50  // |GPUSurfaceSoftwareDelegate|
51  bool PresentBackingStore(sk_sp<SkSurface> backing_store) override;
52 
53  private:
54  sk_sp<SkSurface> sk_surface_;
55  fml::RefPtr<AndroidNativeWindow> native_window_;
56  SkColorType target_color_type_;
57  SkAlphaType target_alpha_type_;
58 
59  FML_DISALLOW_COPY_AND_ASSIGN(AndroidSurfaceSoftware);
60 };
61 
62 } // namespace flutter
63 
64 #endif // FLUTTER_SHELL_PLATFORM_ANDROID_ANDROID_SURFACE_SOFTWARE_H_
bool OnScreenSurfaceResize(const SkISize &size) override
Interface implemented by all platform surfaces that can present a software backing store to the "scre...
sk_sp< SkSurface > AcquireBackingStore(const SkISize &size) override
Called when the GPU surface needs a new buffer to render a new frame into.
bool SetNativeWindow(fml::RefPtr< AndroidNativeWindow > window) override
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir Path to the cache directory This is different from the persistent_cache_path in embedder which is used for Skia shader cache icu native lib Path to the library file that exports the ICU data observatory The hostname IP address on which the Dart Observatory should be served If not defaults to or::depending on whether ipv6 is specified disable Disable the Dart Observatory The observatory is never available in release mode Bind to the IPv6 localhost address for the Dart Observatory Ignored if observatory host is set endless trace Enable an endless trace buffer The default is a ring buffer This is useful when very old events need to viewed For during application launch Memory usage will continue to grow indefinitely however Start app with an specific route defined on the framework flutter assets Path to the Flutter assets directory enable service port Allow the VM service to fallback to automatic port selection if binding to a specified port fails trace Trace early application lifecycle Automatically switches to an endless trace buffer trace skia Filters out all Skia trace event categories except those that are specified in this comma separated list dump skp on shader Automatically dump the skp that triggers new shader compilations This is useful for writing custom ShaderWarmUp to reduce jank By this is not enabled to reduce the overhead purge persistent Remove all existing persistent cache This is mainly for debugging purposes such as reproducing the shader compilation jank 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
Definition: switches.h:226
std::unique_ptr< Surface > CreateGPUSurface(GrDirectContext *gr_context) override
bool PresentBackingStore(sk_sp< SkSurface > backing_store) override
Called by the platform when a frame has been rendered into the backing store and the platform must di...
GLFWwindow * window
Definition: main.cc:43
AndroidSurfaceSoftware(const std::shared_ptr< AndroidContext > &android_context, std::shared_ptr< PlatformViewAndroidJNI > jni_facade)