blob: 8bc10bab9b304637f26f8c1255c4da8eb0f02169 [file] [log] [blame]
// Copyright 2017 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_SOFTWARE_H_
#define FLUTTER_SHELL_PLATFORM_ANDROID_ANDROID_SURFACE_SOFTWARE_H_
#include "flutter/fml/platform/android/jni_weak_ref.h"
#include "flutter/fml/platform/android/scoped_java_ref.h"
#include "flutter/shell/gpu/gpu_surface_software.h"
#include "flutter/shell/platform/android/android_surface.h"
#include "lib/ftl/macros.h"
namespace shell {
class AndroidSurfaceSoftware : public AndroidSurface,
public GPUSurfaceSoftwareDelegate {
public:
AndroidSurfaceSoftware();
~AndroidSurfaceSoftware() override;
bool IsValid() const override;
bool ResourceContextMakeCurrent() override;
std::unique_ptr<Surface> CreateGPUSurface() override;
sk_sp<SkSurface> AcquireBackingStore(const SkISize& size) override;
bool PresentBackingStore(sk_sp<SkSurface> backing_store) override;
void TeardownOnScreenContext() override;
SkISize OnScreenSurfaceSize() const override;
bool OnScreenSurfaceResize(const SkISize& size) const override;
bool SetNativeWindow(ftl::RefPtr<AndroidNativeWindow> window,
PlatformView::SurfaceConfig config) override;
void SetFlutterView(
const fml::jni::JavaObjectWeakGlobalRef& flutter_view) override;
private:
sk_sp<SkSurface> sk_surface_;
fml::jni::JavaObjectWeakGlobalRef flutter_view_;
ftl::RefPtr<AndroidNativeWindow> native_window_;
SkColorType target_color_type_;
FTL_DISALLOW_COPY_AND_ASSIGN(AndroidSurfaceSoftware);
};
} // namespace shell
#endif // FLUTTER_SHELL_PLATFORM_ANDROID_ANDROID_SURFACE_SOFTWARE_H_