Flutter Engine
test_metal_surface.cc
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 #include "flutter/testing/test_metal_surface.h"
6 
7 #if TESTING_ENABLE_METAL
8 #include "flutter/testing/test_metal_surface_impl.h"
9 #endif // TESTING_ENABLE_METAL
10 
11 namespace flutter {
12 
14 #if TESTING_ENABLE_METAL
15  return true;
16 #else // TESTING_ENABLE_METAL
17  return false;
18 #endif // TESTING_ENABLE_METAL
19 }
20 
21 std::unique_ptr<TestMetalSurface> TestMetalSurface::Create(
22  SkISize surface_size) {
23 #if TESTING_ENABLE_METAL
24  return std::make_unique<TestMetalSurfaceImpl>(surface_size);
25 #else // TESTING_ENABLE_METAL
26  return nullptr;
27 #endif // TESTING_ENABLE_METAL
28 }
29 
31 
33 
35  return impl_ ? impl_->IsValid() : false;
36 }
37 
38 sk_sp<GrDirectContext> TestMetalSurface::GetGrContext() const {
39  return impl_ ? impl_->GetGrContext() : nullptr;
40 }
41 
42 sk_sp<SkSurface> TestMetalSurface::GetSurface() const {
43  return impl_ ? impl_->GetSurface() : nullptr;
44 }
45 
46 } // namespace flutter
virtual bool IsValid() const
static std::unique_ptr< TestMetalSurface > Create(SkISize surface_size=SkISize::MakeEmpty())
virtual sk_sp< SkSurface > GetSurface() const
virtual sk_sp< GrDirectContext > GetGrContext() const