mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
* Initialize AndroidSurfaceGL and its associated resource context before ANativeWindow acquisition. This allows us to create the IO thread context way earlier and service load requests on the same. Before this patch, early lifecycle loads would use the default Skia texture loader instead of the Async texture loader we provide. Fixes https://github.com/flutter/flutter/issues/6581 * Don't destroy surface_gl_ PlatformViewAndroid::ReleaseSurface.
53 lines
1.4 KiB
C++
53 lines
1.4 KiB
C++
// Copyright 2016 The Chromium Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
// found in the LICENSE file.
|
|
|
|
#ifndef FLUTTER_SHELL_PLATFORM_ANDROID_ANDROID_SURFACE_GL_H_
|
|
#define FLUTTER_SHELL_PLATFORM_ANDROID_ANDROID_SURFACE_GL_H_
|
|
|
|
#include <memory>
|
|
#include "flutter/shell/gpu/gpu_surface_gl.h"
|
|
#include "flutter/shell/platform/android/android_context_gl.h"
|
|
#include "flutter/shell/platform/android/android_environment_gl.h"
|
|
#include "flutter/shell/platform/android/android_native_window.h"
|
|
#include "lib/ftl/macros.h"
|
|
|
|
namespace shell {
|
|
|
|
class AndroidSurfaceGL : public GPUSurfaceGLDelegate {
|
|
public:
|
|
explicit AndroidSurfaceGL(PlatformView::SurfaceConfig offscreen_config);
|
|
|
|
~AndroidSurfaceGL();
|
|
|
|
bool SetNativeWindowForOnScreenContext(
|
|
AndroidNativeWindow window,
|
|
PlatformView::SurfaceConfig onscreen_config);
|
|
|
|
bool IsValid() const;
|
|
|
|
SkISize OnScreenSurfaceSize() const;
|
|
|
|
bool OnScreenSurfaceResize(const SkISize& size) const;
|
|
|
|
bool GLOffscreenContextMakeCurrent();
|
|
|
|
bool GLContextMakeCurrent() override;
|
|
|
|
bool GLContextClearCurrent() override;
|
|
|
|
bool GLContextPresent() override;
|
|
|
|
intptr_t GLContextFBO() const override;
|
|
|
|
private:
|
|
ftl::RefPtr<AndroidContextGL> onscreen_context_;
|
|
ftl::RefPtr<AndroidContextGL> offscreen_context_;
|
|
|
|
FTL_DISALLOW_COPY_AND_ASSIGN(AndroidSurfaceGL);
|
|
};
|
|
|
|
} // namespace shell
|
|
|
|
#endif // FLUTTER_SHELL_PLATFORM_ANDROID_ANDROID_SURFACE_GL_H_
|