Flutter Engine
 
Loading...
Searching...
No Matches
test_metal_surface.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_TESTING_TEST_METAL_SURFACE_H_
6#define FLUTTER_TESTING_TEST_METAL_SURFACE_H_
7
11#include "third_party/skia/include/core/SkSize.h"
12#include "third_party/skia/include/core/SkSurface.h"
13#include "third_party/skia/include/gpu/ganesh/GrDirectContext.h"
14
15namespace flutter::testing {
16
17//------------------------------------------------------------------------------
18/// @brief Creates a MTLTexture backed SkSurface and context that can be
19/// used to render to in unit-tests.
20///
22 public:
23 static bool PlatformSupportsMetal();
24
25 static std::unique_ptr<TestMetalSurface> Create(
26 const TestMetalContext& test_metal_context,
27 DlISize surface_size = DlISize());
28
29 static std::unique_ptr<TestMetalSurface> Create(
30 const TestMetalContext& test_metal_context,
31 int64_t texture_id,
32 DlISize surface_size = DlISize());
33
35
36 virtual bool IsValid() const;
37
38 virtual sk_sp<GrDirectContext> GetGrContext() const;
39
40 virtual sk_sp<SkSurface> GetSurface() const;
41
42 virtual sk_sp<SkImage> GetRasterSurfaceSnapshot();
43
45
46 protected:
48
49 private:
50 std::unique_ptr<TestMetalSurface> impl_;
51
52 explicit TestMetalSurface(std::unique_ptr<TestMetalSurface> impl);
53
55};
56
57} // namespace flutter::testing
58
59#endif // FLUTTER_TESTING_TEST_METAL_SURFACE_H_
Creates a MTLTexture backed SkSurface and context that can be used to render to in unit-tests.
static std::unique_ptr< TestMetalSurface > Create(const TestMetalContext &test_metal_context, DlISize surface_size=DlISize())
virtual sk_sp< GrDirectContext > GetGrContext() const
virtual TestMetalContext::TextureInfo GetTextureInfo()
virtual sk_sp< SkSurface > GetSurface() const
virtual sk_sp< SkImage > GetRasterSurfaceSnapshot()
#define FML_DISALLOW_COPY_AND_ASSIGN(TypeName)
Definition macros.h:27
impeller::ISize32 DlISize
int64_t texture_id