Flutter Engine
The Flutter Engine
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
8#include "flutter/fml/macros.h"
9#include "flutter/testing/test_metal_context.h"
13
14namespace flutter {
15
16//------------------------------------------------------------------------------
17/// @brief Creates a MTLTexture backed SkSurface and context that can be
18/// used to render to in unit-tests.
19///
21 public:
22 static bool PlatformSupportsMetal();
23
24 static std::unique_ptr<TestMetalSurface> Create(
25 const TestMetalContext& test_metal_context,
26 SkISize surface_size = SkISize::MakeEmpty());
27
28 static std::unique_ptr<TestMetalSurface> Create(
29 const TestMetalContext& test_metal_context,
30 int64_t texture_id,
31 SkISize surface_size = SkISize::MakeEmpty());
32
34
35 virtual bool IsValid() const;
36
38
39 virtual sk_sp<SkSurface> GetSurface() const;
40
42
44
45 protected:
47
48 private:
49 std::unique_ptr<TestMetalSurface> impl_;
50
51 explicit TestMetalSurface(std::unique_ptr<TestMetalSurface> impl);
52
53 FML_DISALLOW_COPY_AND_ASSIGN(TestMetalSurface);
54};
55
56} // namespace flutter
57
58#endif // FLUTTER_TESTING_TEST_METAL_SURFACE_H_
Creates a MTLTexture backed SkSurface and context that can be used to render to in unit-tests.
virtual sk_sp< GrDirectContext > GetGrContext() const
static std::unique_ptr< TestMetalSurface > Create(const TestMetalContext &test_metal_context, SkISize surface_size=SkISize::MakeEmpty())
virtual bool IsValid() const
virtual sk_sp< SkImage > GetRasterSurfaceSnapshot()
virtual TestMetalContext::TextureInfo GetTextureInfo()
virtual sk_sp< SkSurface > GetSurface() const
Definition: SkSize.h:16
static constexpr SkISize MakeEmpty()
Definition: SkSize.h:22
int64_t texture_id