mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
This is part of a larger effort to expose the difference between GrDirectContext, which runs on the GPU thread and can directly perform operations like uploading textures, and GrRecordingContext, which can only queue up work to be delivered to the GrDirectContext later.
47 lines
1.2 KiB
C++
47 lines
1.2 KiB
C++
// Copyright 2013 The Flutter Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
// found in the LICENSE file.
|
|
|
|
#include "flutter/testing/test_metal_surface.h"
|
|
|
|
#if TESTING_ENABLE_METAL
|
|
#include "flutter/testing/test_metal_surface_impl.h"
|
|
#endif // TESTING_ENABLE_METAL
|
|
|
|
namespace flutter {
|
|
|
|
bool TestMetalSurface::PlatformSupportsMetal() {
|
|
#if TESTING_ENABLE_METAL
|
|
return true;
|
|
#else // TESTING_ENABLE_METAL
|
|
return false;
|
|
#endif // TESTING_ENABLE_METAL
|
|
}
|
|
|
|
std::unique_ptr<TestMetalSurface> TestMetalSurface::Create(
|
|
SkISize surface_size) {
|
|
#if TESTING_ENABLE_METAL
|
|
return std::make_unique<TestMetalSurfaceImpl>(surface_size);
|
|
#else // TESTING_ENABLE_METAL
|
|
return nullptr;
|
|
#endif // TESTING_ENABLE_METAL
|
|
}
|
|
|
|
TestMetalSurface::TestMetalSurface() = default;
|
|
|
|
TestMetalSurface::~TestMetalSurface() = default;
|
|
|
|
bool TestMetalSurface::IsValid() const {
|
|
return impl_ ? impl_->IsValid() : false;
|
|
}
|
|
|
|
sk_sp<GrDirectContext> TestMetalSurface::GetGrContext() const {
|
|
return impl_ ? impl_->GetGrContext() : nullptr;
|
|
}
|
|
|
|
sk_sp<SkSurface> TestMetalSurface::GetSurface() const {
|
|
return impl_ ? impl_->GetSurface() : nullptr;
|
|
}
|
|
|
|
} // namespace flutter
|