Flutter Engine
The Flutter Engine
test_metal_surface_impl.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_IMPL_H_
6#define FLUTTER_TESTING_TEST_METAL_SURFACE_IMPL_H_
7
8#include "flutter/fml/macros.h"
9#include "flutter/testing/test_metal_context.h"
10#include "flutter/testing/test_metal_surface.h"
11
13
14namespace flutter {
15
17 public:
18 TestMetalSurfaceImpl(const TestMetalContext& test_metal_context,
19 const SkISize& surface_size);
20
21 TestMetalSurfaceImpl(const TestMetalContext& test_metal_context,
22 int64_t texture_id,
23 const SkISize& surface_size);
24
25 // |TestMetalSurface|
27
28 private:
29 void Init(const TestMetalContext::TextureInfo& texture_info,
30 const SkISize& surface_size);
31
32 const TestMetalContext& test_metal_context_;
33 bool is_valid_ = false;
34 sk_sp<SkSurface> surface_;
36
37 // |TestMetalSurface|
38 bool IsValid() const override;
39
40 // |TestMetalSurface|
41 sk_sp<GrDirectContext> GetGrContext() const override;
42
43 // |TestMetalSurface|
44 sk_sp<SkSurface> GetSurface() const override;
45
46 // |TestMetalSurface|
47 sk_sp<SkImage> GetRasterSurfaceSnapshot() override;
48
49 // |TestMetalSurface|
50 TestMetalContext::TextureInfo GetTextureInfo() override;
51
52 FML_DISALLOW_COPY_AND_ASSIGN(TestMetalSurfaceImpl);
53};
54
55} // namespace flutter
56
57#endif // FLUTTER_TESTING_TEST_METAL_SURFACE_IMPL_H_
TestMetalSurfaceImpl(const TestMetalContext &test_metal_context, const SkISize &surface_size)
Creates a MTLTexture backed SkSurface and context that can be used to render to in unit-tests.
Definition: SkSize.h:16
int64_t texture_id