2018-11-07 12:24:35 -08:00
|
|
|
// Copyright 2013 The Flutter Authors. All rights reserved.
|
2017-02-22 15:40:23 -08:00
|
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
|
|
|
// found in the LICENSE file.
|
|
|
|
|
|
|
|
|
|
#ifndef FLUTTER_SHELL_GPU_GPU_SURFACE_SOFTWARE_H_
|
|
|
|
|
#define FLUTTER_SHELL_GPU_GPU_SURFACE_SOFTWARE_H_
|
|
|
|
|
|
2018-10-26 14:26:59 -07:00
|
|
|
#include "flutter/flow/embedded_views.h"
|
2018-07-26 12:49:34 -07:00
|
|
|
#include "flutter/fml/macros.h"
|
|
|
|
|
#include "flutter/fml/memory/weak_ptr.h"
|
2017-02-22 15:40:23 -08:00
|
|
|
#include "flutter/shell/common/surface.h"
|
|
|
|
|
#include "third_party/skia/include/core/SkSurface.h"
|
|
|
|
|
|
|
|
|
|
namespace shell {
|
|
|
|
|
|
|
|
|
|
class GPUSurfaceSoftwareDelegate {
|
|
|
|
|
public:
|
|
|
|
|
virtual sk_sp<SkSurface> AcquireBackingStore(const SkISize& size) = 0;
|
2018-08-28 14:13:49 -07:00
|
|
|
|
2017-02-22 15:40:23 -08:00
|
|
|
virtual bool PresentBackingStore(sk_sp<SkSurface> backing_store) = 0;
|
2018-10-26 14:26:59 -07:00
|
|
|
|
|
|
|
|
virtual flow::ExternalViewEmbedder* GetExternalViewEmbedder();
|
2017-02-22 15:40:23 -08:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class GPUSurfaceSoftware : public Surface {
|
|
|
|
|
public:
|
|
|
|
|
GPUSurfaceSoftware(GPUSurfaceSoftwareDelegate* delegate);
|
|
|
|
|
|
|
|
|
|
~GPUSurfaceSoftware() override;
|
|
|
|
|
|
2018-08-28 14:13:49 -07:00
|
|
|
// |shell::Surface|
|
2017-02-22 15:40:23 -08:00
|
|
|
bool IsValid() override;
|
|
|
|
|
|
2018-08-28 14:13:49 -07:00
|
|
|
// |shell::Surface|
|
2017-02-22 15:40:23 -08:00
|
|
|
std::unique_ptr<SurfaceFrame> AcquireFrame(const SkISize& size) override;
|
|
|
|
|
|
2018-08-28 14:13:49 -07:00
|
|
|
// |shell::Surface|
|
|
|
|
|
SkMatrix GetRootTransformation() const override;
|
|
|
|
|
|
|
|
|
|
// |shell::Surface|
|
2017-02-22 15:40:23 -08:00
|
|
|
GrContext* GetContext() override;
|
|
|
|
|
|
2018-10-26 14:26:59 -07:00
|
|
|
// |shell::Surface|
|
|
|
|
|
flow::ExternalViewEmbedder* GetExternalViewEmbedder() override;
|
|
|
|
|
|
2017-02-22 15:40:23 -08:00
|
|
|
private:
|
|
|
|
|
GPUSurfaceSoftwareDelegate* delegate_;
|
2018-07-26 12:49:34 -07:00
|
|
|
fml::WeakPtrFactory<GPUSurfaceSoftware> weak_factory_;
|
2017-02-22 15:40:23 -08:00
|
|
|
|
2018-07-26 12:49:34 -07:00
|
|
|
FML_DISALLOW_COPY_AND_ASSIGN(GPUSurfaceSoftware);
|
2017-02-22 15:40:23 -08:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace shell
|
|
|
|
|
|
|
|
|
|
#endif // FLUTTER_SHELL_GPU_GPU_SURFACE_SOFTWARE_H_
|